diff --git a/data-otservbr-global/lib/core/quests.lua b/data-otservbr-global/lib/core/quests.lua index 8d7d9ede37c..741702b68b5 100644 --- a/data-otservbr-global/lib/core/quests.lua +++ b/data-otservbr-global/lib/core/quests.lua @@ -5250,22 +5250,22 @@ if not Quests then }, [37] = { name = "The First Dragon", - startStorageId = Storage.FirstDragon.Questline, + startStorageId = Storage.Quest.U11_02.TheFirstDragon.Questline, startStorageValue = 1, missions = { [1] = { name = "Power", - storageId = Storage.FirstDragon.DragonCounter, + storageId = Storage.Quest.U11_02.TheFirstDragon.DragonCounter, missionId = 10368, startValue = 0, endValue = 200, description = function(player) - return ("You already hunted %d/200 dragons."):format(player:getStorageValue(Storage.FirstDragon.DragonCounter)) + return ("You already hunted %d/200 dragons."):format(player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.DragonCounter)) end, }, [2] = { name = "Treasure", - storageId = Storage.FirstDragon.ChestCounter, + storageId = Storage.Quest.U11_02.TheFirstDragon.ChestCounter, missionId = 10369, startValue = 0, endValue = 20, @@ -5274,7 +5274,7 @@ if not Quests then }, [3] = { name = "Knowledge", - storageId = Storage.FirstDragon.GelidrazahAccess, + storageId = Storage.Quest.U11_02.TheFirstDragon.GelidrazahAccess, missionId = 10370, startValue = 0, endValue = 1, @@ -5283,7 +5283,7 @@ if not Quests then }, [4] = { name = "Life", - storageId = Storage.FirstDragon.SecretsCounter, + storageId = Storage.Quest.U11_02.TheFirstDragon.SecretsCounter, missionId = 10371, startValue = 0, endValue = 3, diff --git a/data-otservbr-global/lib/core/storages.lua b/data-otservbr-global/lib/core/storages.lua index 1c4033b09bc..f4b3fccb11d 100644 --- a/data-otservbr-global/lib/core/storages.lua +++ b/data-otservbr-global/lib/core/storages.lua @@ -393,27 +393,6 @@ Storage = { AccessDoor = 50263, }, }, - FirstDragon = { - -- Reserved storage from 50350 - 50379 - Questline = 50350, - DragonCounter = 50351, - ChestCounter = 50352, - SecretsCounter = 50355, - GelidrazahAccess = 50356, - DesertTile = 50358, - StoneSculptureTile = 50359, - SuntowerTile = 50360, - Horn = 50362, - Scale = 50363, - Bones = 50364, - Tooth = 50365, - AccessCave = 50366, - SomewhatBeatable = 50367, - FirstDragonTimer = 50368, - RewardFeather = 50369, - RewardMask = 50370, - RewardBackpack = 50371, - }, HeroRathleton = { -- Reserved storage from 50400 - 50419 QuestLine = 50400, @@ -2522,8 +2501,31 @@ Storage = { HeartOfDestruction = {}, }, U11_02 = { -- update 11.02 - Reserved Storages 45451 - 45650 - FestiveOutfits = {}, - FirstDragon = {}, + FestiveOutfits = { + Addon1 = 45451, + Addon2 = 45452, + }, + TheFirstDragon = { + Questline = 45453, + DragonCounter = 45454, + ChestCounter = 45455, + SecretsCounter = 45456, + GelidrazahAccess = 45457, + DesertTile = 45458, + StoneSculptureTile = 45459, + SuntowerTile = 45460, + Horn = 45461, + Scale = 45462, + Bones = 45463, + Tooth = 45464, + AccessCave = 45465, + SomewhatBeatable = 45466, + FirstDragonTimer = 45467, + RewardFeather = 45468, + RewardMask = 45469, + RewardBackpack = 45470, + Feathers = 45471, + }, ForgottenKnowledge = {}, }, U11_40 = { -- update 11.40 - Reserved Storages 45651 - 45850 diff --git a/data-otservbr-global/monster/quests/the_first_dragon/angry_plant.lua b/data-otservbr-global/monster/quests/the_first_dragon/angry_plant.lua index 7ecc32947fb..97f702b6639 100644 --- a/data-otservbr-global/monster/quests/the_first_dragon/angry_plant.lua +++ b/data-otservbr-global/monster/quests/the_first_dragon/angry_plant.lua @@ -20,6 +20,10 @@ monster.corpse = 2983 monster.speed = 55 monster.manaCost = 0 +monster.events = { + "AngryPlantDeath", +} + monster.changeTarget = { interval = 2000, chance = 5, diff --git a/data-otservbr-global/monster/quests/the_first_dragon/bosses/fallen_challenger.lua b/data-otservbr-global/monster/quests/the_first_dragon/bosses/fallen_challenger.lua index 1e050fdfd65..3ac0bb8f18f 100644 --- a/data-otservbr-global/monster/quests/the_first_dragon/bosses/fallen_challenger.lua +++ b/data-otservbr-global/monster/quests/the_first_dragon/bosses/fallen_challenger.lua @@ -20,6 +20,10 @@ monster.corpse = 775 monster.speed = 150 monster.manaCost = 0 +monster.events = { + "FallenDeath", +} + monster.changeTarget = { interval = 5000, chance = 8, diff --git a/data-otservbr-global/monster/quests/the_first_dragon/dragon_essence.lua b/data-otservbr-global/monster/quests/the_first_dragon/dragon_essence.lua index 629b187cf93..a91ecae04c5 100644 --- a/data-otservbr-global/monster/quests/the_first_dragon/dragon_essence.lua +++ b/data-otservbr-global/monster/quests/the_first_dragon/dragon_essence.lua @@ -20,6 +20,10 @@ monster.corpse = 0 monster.speed = 125 monster.manaCost = 0 +monster.events = { + "DragonEssenceDeath", +} + monster.changeTarget = { interval = 2000, chance = 5, diff --git a/data-otservbr-global/monster/quests/the_first_dragon/somewhat_beatable.lua b/data-otservbr-global/monster/quests/the_first_dragon/somewhat_beatable.lua index 8829b1415d9..9c0ace92c1f 100644 --- a/data-otservbr-global/monster/quests/the_first_dragon/somewhat_beatable.lua +++ b/data-otservbr-global/monster/quests/the_first_dragon/somewhat_beatable.lua @@ -53,7 +53,7 @@ monster.flags = { } monster.events = { - "Somewhat Beatable Death", + "SomewhatBeatableDeath", } monster.light = { diff --git a/data-otservbr-global/npc/buddel_helheim.lua b/data-otservbr-global/npc/buddel_helheim.lua index 88f94ccfa27..c1b526270f5 100644 --- a/data-otservbr-global/npc/buddel_helheim.lua +++ b/data-otservbr-global/npc/buddel_helheim.lua @@ -79,7 +79,7 @@ addTravelKeyword("svargrond", "You know a town nicer than this? NICER DICER! Apr end, function() return math.random(5) > 1 end, function(player) - return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) < 8 + return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) == 8 end, function(player) return player:getItemCount(3097) > 0 end, function(player) @@ -90,7 +90,7 @@ addTravelKeyword("okolnir", "It's nice there. Except of the ice dragons which ar end, function() return math.random(5) > 1 end, function(player) - return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) < 8 + return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) == 8 end, function(player) return player:getItemCount(3097) > 0 end, function(player) @@ -101,7 +101,7 @@ addTravelKeyword("tyrsung", "*HICKS* Big, big island east of here. Venorian hunt end, function() return math.random(5) > 1 end, function(player) - return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) < 8 + return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) == 8 end, function(player) return player:getItemCount(3097) > 0 end, function(player) @@ -112,7 +112,7 @@ addTravelKeyword("camp", "Both of you look like you could defend yourself! If yo end, function() return math.random(5) > 1 end, function(player) - return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) < 8 + return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) == 8 end, function(player) return player:getItemCount(3097) > 0 end, function(player) diff --git a/data-otservbr-global/npc/buddel_okolnir.lua b/data-otservbr-global/npc/buddel_okolnir.lua index f21ff049f4b..e4c9ea84f4a 100644 --- a/data-otservbr-global/npc/buddel_okolnir.lua +++ b/data-otservbr-global/npc/buddel_okolnir.lua @@ -82,7 +82,7 @@ addTravelKeyword("svargrond", "You know a town nicer than this? NICER DICER! Apr end, function() return math.random(5) > 1 end, function(player) - return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) < 8 + return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) == 8 end, function(player) return player:getItemCount(3097) > 0 end, function(player) @@ -93,7 +93,7 @@ addTravelKeyword("camp", "Both of you look like you could defend yourself! If yo end, function() return math.random(5) > 1 end, function(player) - return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) < 8 + return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) == 8 end, function(player) return player:getItemCount(3097) > 0 end, function(player) @@ -104,7 +104,7 @@ addTravelKeyword("helheim", "T'at is a small island to the east.", Position(3246 end, function() return math.random(5) > 1 end, function(player) - return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) < 8 + return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) == 8 end, function(player) return player:getItemCount(3097) > 0 end, function(player) @@ -117,7 +117,7 @@ addTravelKeyword("tyrsung", "*HICKS* Big, big island east of here. Venorian hunt end, function() return math.random(5) > 1 end, function(player) - return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) < 8 + return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) == 8 end, function(player) return player:getItemCount(3097) > 0 end, function(player) diff --git a/data-otservbr-global/npc/buddel_raider_camp.lua b/data-otservbr-global/npc/buddel_raider_camp.lua index 06b69175967..11cc062a2b6 100644 --- a/data-otservbr-global/npc/buddel_raider_camp.lua +++ b/data-otservbr-global/npc/buddel_raider_camp.lua @@ -82,7 +82,7 @@ addTravelKeyword("svargrond", "You know a town nicer than this? NICER DICER! Apr end, function() return math.random(5) > 1 end, function(player) - return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) < 8 + return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) == 8 end, function(player) return player:getItemCount(3097) > 0 end, function(player) @@ -93,7 +93,7 @@ addTravelKeyword("okolnir", "It's nice there. Except of the ice dragons which ar end, function() return math.random(5) > 1 end, function(player) - return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) < 8 + return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) == 8 end, function(player) return player:getItemCount(3097) > 0 end, function(player) @@ -104,7 +104,7 @@ addTravelKeyword("helheim", "T'at is a small island to the east.", Position(3246 end, function() return math.random(5) > 1 end, function(player) - return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) < 8 + return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) == 8 end, function(player) return player:getItemCount(3097) > 0 end, function(player) @@ -117,7 +117,7 @@ addTravelKeyword("tyrsung", "*HICKS* Big, big island east of here. Venorian hunt end, function() return math.random(5) > 1 end, function(player) - return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) < 8 + return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) == 8 end, function(player) return player:getItemCount(3097) > 0 end, function(player) diff --git a/data-otservbr-global/npc/buddel_tyrsung.lua b/data-otservbr-global/npc/buddel_tyrsung.lua index cb9025b1a91..65cbaf73066 100644 --- a/data-otservbr-global/npc/buddel_tyrsung.lua +++ b/data-otservbr-global/npc/buddel_tyrsung.lua @@ -82,7 +82,7 @@ addTravelKeyword("svargrond", "You know a town nicer than this? NICER DICER! Apr end, function() return math.random(5) > 1 end, function(player) - return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) < 8 + return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) == 8 end, function(player) return player:getItemCount(3097) > 0 end, function(player) @@ -93,7 +93,7 @@ addTravelKeyword("okolnir", "It's nice there. Except of the ice dragons which ar end, function() return math.random(5) > 1 end, function(player) - return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) < 8 + return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) == 8 end, function(player) return player:getItemCount(3097) > 0 end, function(player) @@ -104,7 +104,7 @@ addTravelKeyword("helheim", "T'at is a small island to the east.", Position(3246 end, function() return math.random(5) > 1 end, function(player) - return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) < 8 + return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) == 8 end, function(player) return player:getItemCount(3097) > 0 end, function(player) @@ -117,7 +117,7 @@ addTravelKeyword("camp", "Both of you look like you could defend yourself! If yo end, function() return math.random(5) > 1 end, function(player) - return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) < 8 + return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) == 8 end, function(player) return player:getItemCount(3097) > 0 end, function(player) diff --git a/data-otservbr-global/npc/gelidrazahs_thirst.lua b/data-otservbr-global/npc/gelidrazahs_thirst.lua index a051dfb791e..beff8d7c6b9 100644 --- a/data-otservbr-global/npc/gelidrazahs_thirst.lua +++ b/data-otservbr-global/npc/gelidrazahs_thirst.lua @@ -72,7 +72,7 @@ local function creatureSayCallback(npc, creature, type, message) elseif MsgContains(message, "Svir") and npcHandler:getTopic(playerId) == 4 then npcHandler:say("That is correct. You satisfactorily answered all questions. You may pass and enter Gelidrazah's lair.", npc, creature) npcHandler:setTopic(playerId, 0) - player:setStorageValue(Storage.FirstDragon.GelidrazahAccess, 1) + player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.GelidrazahAccess, 1) else npcHandler:say("I don't know what you are talking about.", npc, creature) end diff --git a/data-otservbr-global/npc/kizar.lua b/data-otservbr-global/npc/kizar.lua new file mode 100644 index 00000000000..df58dd82d3a --- /dev/null +++ b/data-otservbr-global/npc/kizar.lua @@ -0,0 +1,56 @@ +local internalNpcName = "Kizar" +local npcType = Game.createNpcType(internalNpcName) +local npcConfig = {} + +npcConfig.name = internalNpcName +npcConfig.description = internalNpcName + +npcConfig.health = 100 +npcConfig.maxHealth = npcConfig.health +npcConfig.walkInterval = 2000 +npcConfig.walkRadius = 2 + +npcConfig.outfit = { + lookType = 132, + lookHead = 114, + lookBody = 68, + lookLegs = 19, + lookFeet = 115, + lookAddons = 0, +} + +npcConfig.flags = { + floorchange = false, +} + +local keywordHandler = KeywordHandler:new() +local npcHandler = NpcHandler:new(keywordHandler) + +npcType.onThink = function(npc, interval) + npcHandler:onThink(npc, interval) +end + +npcType.onAppear = function(npc, creature) + npcHandler:onAppear(npc, creature) +end + +npcType.onDisappear = function(npc, creature) + npcHandler:onDisappear(npc, creature) +end + +npcType.onMove = function(npc, creature, fromPosition, toPosition) + npcHandler:onMove(npc, creature, fromPosition, toPosition) +end + +npcType.onSay = function(npc, creature, type, message) + npcHandler:onSay(npc, creature, type, message) +end + +npcType.onCloseChannel = function(npc, creature) + npcHandler:onCloseChannel(npc, creature) +end + +npcHandler:addModule(FocusModule:new(), npcConfig.name, true, true, true) + +-- npcType registering the npcConfig table +npcType:register(npcConfig) diff --git a/data-otservbr-global/npc/muriel.lua b/data-otservbr-global/npc/muriel.lua index 8017528a681..8aece06cd9a 100644 --- a/data-otservbr-global/npc/muriel.lua +++ b/data-otservbr-global/npc/muriel.lua @@ -76,19 +76,58 @@ local function creatureSayCallback(npc, creature, type, message) "The rotworms dug deep into the soil north of Thais. Rumours say that you can access a place of endless moaning from there. ...", "No one knows how old that common grave is but the people who died there are cursed and never come to rest. A bone from that pit would be perfect for my studies.", }, npc, creature) + npcHandler:setTopic(playerId, 0) elseif player:getStorageValue(Storage.Quest.U8_1.TibiaTales.IntoTheBonePit) == 2 then player:setStorageValue(Storage.Quest.U8_1.TibiaTales.IntoTheBonePit, 3) if player:removeItem(131, 1) then player:addItem(6299, 1) npcHandler:say("Excellent! Now I can try to put my theoretical thoughts into practice and find a cure for the symptoms of undead. Here, take this for your efforts.", npc, creature) + npcHandler:setTopic(playerId, 0) else npcHandler:say({ "I am so glad you are still alive. Benjamin found the container with the bone sample inside. Fortunately, I inscribe everything with my name, so he knew it was mine. ...", "I thought you have been haunted and killed by the undead. I'm glad that this is not the case. Thank you for your help.", }, npc, creature) + npcHandler:setTopic(playerId, 0) end else npcHandler:say("I am very glad you helped me, but I am very busy at the moment.", npc, creature) + npcHandler:setTopic(playerId, 0) + end + elseif MsgContains(message, "addons") then + local hasMasks = player:getItemCount(25088) >= 3 + local hasFeathers = player:getItemCount(25089) >= 50 + if player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.Feathers) == 2 and player:getStorageValue(Storage.Quest.U11_02.FestiveOutfits.Addon1) == 1 and hasMasks then + npcHandler:say("I see you have the porcelain masks. Are you ready to exchange them for the first addon?", npc, creature) + npcHandler:setTopic(playerId, 2) + elseif player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.Feathers) == 2 and player:getStorageValue(Storage.Quest.U11_02.FestiveOutfits.Addon2) == 1 and hasFeathers then + npcHandler:say("I see you have the colourful feathers. Are you ready to exchange them for the second addon?", npc, creature) + npcHandler:setTopic(playerId, 4) + else + npcHandler:say("You need the outfit and 3 porcelain masks or 50 colored feathers to get the festive costume accessories.", npc, creature) + npcHandler:setTopic(playerId, 0) + end + elseif MsgContains(message, "mask") and player:getStorageValue(Storage.Quest.U11_02.FestiveOutfits.Addon1) == 1 then + if player:removeItem(25088, 3) then + player:addOutfit(929, 1) + player:addOutfit(931, 1) + npcHandler:say("Very good! You gained the first addon to the festive outfit.", npc, creature) + player:setStorageValue(Storage.Quest.U11_02.FestiveOutfits.Addon1, 2) + npcHandler:setTopic(playerId, 0) + else + npcHandler:say("Oh, sorry but you don't have enough porcelain masks!", npc, creature) + npcHandler:setTopic(playerId, 0) + end + elseif MsgContains(message, "feather") and player:getStorageValue(Storage.Quest.U11_02.FestiveOutfits.Addon2) == 1 then + if player:removeItem(25089, 50) then + player:addOutfit(929, 2) + player:addOutfit(931, 2) + npcHandler:say("Very good! You gained the second addon to the festive outfit.", npc, creature) + player:setStorageValue(Storage.Quest.U11_02.FestiveOutfits.Addon2, 2) + npcHandler:setTopic(playerId, 0) + else + npcHandler:say("Oh, sorry but you don't have enough colourful feathers!", npc, creature) + npcHandler:setTopic(playerId, 0) end elseif MsgContains(message, "yes") then if npcHandler:getTopic(playerId) == 1 then @@ -98,12 +137,22 @@ local function creatureSayCallback(npc, creature, type, message) }, npc, creature) player:addItem(4852, 1) player:setStorageValue(Storage.Quest.U8_1.TibiaTales.IntoTheBonePit, 1) + npcHandler:setTopic(playerId, 0) + elseif npcHandler:getTopic(playerId) == 2 then + npcHandler:say("I provide two addons. For the first one I need you to bring me three porcelain masks. For the second addon you need fifty colourful ostrich feathers. Do you want one of these addons?", npc, creature) + npcHandler:setTopic(playerId, 3) + elseif npcHandler:getTopic(playerId) == 3 then + npcHandler:say("What do you have for me: the porcelain masks or the colourful feathers?", npc, creature) + player:setStorageValue(Storage.Quest.U11_02.FestiveOutfits.Addon1, 1) + elseif npcHandler:getTopic(playerId) == 4 then + npcHandler:say("I provide two addons. For the first one I need you to bring me three porcelain masks. For the second addon you need fifty colourful ostrich feathers. Do you want one of these addons?", npc, creature) + player:setStorageValue(Storage.Quest.U11_02.FestiveOutfits.Addon2, 1) end elseif MsgContains(message, "no") then - if npcHandler:getTopic(playerId) == 1 then - npcHandler:say("Ohh, then I need to find another adventurer who wants to earn a great reward. Bye!", npc, creature) - end + npcHandler:say("Ohh, then I need to find another adventurer who wants to earn a great reward. Bye!", npc, creature) + npcHandler:setTopic(playerId, 0) end + return true end diff --git a/data-otservbr-global/npc/tamoril.lua b/data-otservbr-global/npc/tamoril.lua index 654355d9be5..e6ed393420f 100644 --- a/data-otservbr-global/npc/tamoril.lua +++ b/data-otservbr-global/npc/tamoril.lua @@ -42,16 +42,26 @@ npcType.onThink = function(npc, interval) npcHandler:onThink(npc, interval) end -local function greetCallback(npc, creature) - local playerId = creature:getId() - npcHandler:setMessage(MESSAGE_GREET, "Another pesky mortal who believes his gold outweighs his nutrition value.") - return true +local function isDateWithinEvent() + local currentDate = os.date("*t") + local startDate = { day = 14, month = 1 } + local endDate = { day = 12, month = 2 } + + if (currentDate.month == startDate.month and currentDate.day >= startDate.day) or (currentDate.month == endDate.month and currentDate.day <= endDate.day) or (currentDate.month > startDate.month and currentDate.month < endDate.month) then + return true + end + return false end local function creatureSayCallback(npc, creature, type, message) local player = Player(creature) local playerId = player:getId() + if not isDateWithinEvent() then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can only discuss the First Dragon between January 14 and February 12.") + return true + end + if MsgContains(message, "first dragon") then npcHandler:say("The First Dragon? The first of all of us? The Son of Garsharak? I'm surprised you heard about him. It is such a long time that he wandered Tibia. Yet, there are some {rumours}.", npc, creature) npcHandler:setTopic(playerId, 1) @@ -86,15 +96,22 @@ local function creatureSayCallback(npc, creature, type, message) "And finally an amethyst teleporter in undead-infested caverns underneath Edron allows you to enter the lair of Zorvorax.", }, npc, creature) npcHandler:setTopic(playerId, 0) - player:setStorageValue(Storage.FirstDragon.Questline, 1) - player:setStorageValue(Storage.FirstDragon.DragonCounter, 0) - player:setStorageValue(Storage.FirstDragon.ChestCounter, 0) - player:setStorageValue(Storage.FirstDragon.GelidrazahAccess, 0) - player:setStorageValue(Storage.FirstDragon.SecretsCounter, 0) + if player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.Questline) < 1 then + player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.Questline, 1) + end + if player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.ChestCounter) < 0 then + player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.ChestCounter, 0) + end + player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.DragonCounter, 0) + player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.GelidrazahAccess, 0) + player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.SecretsCounter, 0) end + return true end -npcHandler:setCallback(CALLBACK_GREET, greetCallback) + +npcHandler:setMessage(MESSAGE_GREET, "Another pesky mortal who believes his gold outweighs his nutrition value.") + npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new(), npcConfig.name, true, true, true) @@ -107,6 +124,7 @@ npcConfig.shop = { { itemName = "white gem", clientId = 32769, sell = 12000 }, { itemName = "yellow gem", clientId = 3037, sell = 1000 }, } + -- On buy npc shop message npcType.onBuyItem = function(npc, player, itemId, subType, amount, ignore, inBackpacks, totalCost) npc:sellItem(player, itemId, amount, subType, 0, ignore, inBackpacks) diff --git a/data-otservbr-global/npc/the_first_dragon.lua b/data-otservbr-global/npc/the_first_dragon.lua index 64b10bc4cf5..ec3ba95d004 100644 --- a/data-otservbr-global/npc/the_first_dragon.lua +++ b/data-otservbr-global/npc/the_first_dragon.lua @@ -54,28 +54,30 @@ local function creatureSayCallback(npc, creature, type, message) local player = Player(creature) local playerId = player:getId() - if MsgContains(message, "reward") and npcHandler:getTopic(playerId) == 0 and player:getStorageValue(34013) < 1 then + if MsgContains(message, "reward") and player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.Feathers) == 1 then npcHandler:say({ "Have a look at the chests over there. Feel free to take the things you find within. You know, gold, gems and the like. There's also a garment I'm storing here for a while. As it doesn't fit me I have no need for it. ...", "But it might be a nice outfit for a little human. You also can take the porcelain mask and the feathers. There's a wizard named Muriel in Thais who reportedly embellishes outfits with stuff like this.", }, npc, creature) - player:addOutfit(929, 1) - player:addOutfit(931, 1) + player:addOutfit(929, 0) + player:addOutfit(931, 0) player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE) - player:setStorageValue(34013, 1) + if player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.Feathers) < 2 then + player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.Feathers, 2) + end npcHandler:setTopic(playerId, 0) - elseif MsgContains(message, "fight") and npcHandler:getTopic(playerId) == 0 then + elseif MsgContains(message, "fight") then npcHandler:say({ "Even in {retirement} I sometimes succumb to the temptation of sweet battle. Fighting was so different back in the old {times}. You can read about it in my {memoirs}. There should be a copy lying here somewhere.", }, npc, creature) npcHandler:setTopic(playerId, 0) - elseif MsgContains(message, "retirement") and npcHandler:getTopic(playerId) == 0 then + elseif MsgContains(message, "retirement") then npcHandler:say({ "When you are young, you are much more tolerant towards the burden of life. At a certain age even a {dragon} will start to think about if things will go on forever. ...", "Eventually there comes a time when you decide all the {hassle} isn't worth it anymore and you decide to concentrate on the {finer} things life has to offer.", }, npc, creature) npcHandler:setTopic(playerId, 0) - elseif MsgContains(message, "memoirs") and npcHandler:getTopic(playerId) == 0 then + elseif MsgContains(message, "memoirs") then npcHandler:say({ "I dictated my memoirs to a human servant. I like the idea to share my thoughts and memories with humanity with the help of a {book}. ...", "You are my greatest fans after all. ...", @@ -83,37 +85,37 @@ local function creatureSayCallback(npc, creature, type, message) "By the way, it's a funny story how I learnt the bonelord language. However, I saved it for a possible part two of my memoirs.", }, npc, creature) npcHandler:setTopic(playerId, 0) - elseif MsgContains(message, "hassle") and npcHandler:getTopic(playerId) == 0 then + elseif MsgContains(message, "hassle") then npcHandler:say({ "I really enjoy a good fight now and then. ...", "A real pain, however, is the constant annoyance caused by tedious fights against adventurers with more healing pots than brain.", }, npc, creature) npcHandler:setTopic(playerId, 0) - elseif MsgContains(message, "worthy") and npcHandler:getTopic(playerId) == 0 then + elseif MsgContains(message, "worthy") then npcHandler:say({ "To be honest, the first dragon hunters weren't {worthy}. ...", "They used {weaknesses} to their advantage. It took some time before a dragon could be killed in a fair fight.", }, npc, creature) npcHandler:setTopic(playerId, 0) - elseif MsgContains(message, "weaknesses") and npcHandler:getTopic(playerId) == 0 then + elseif MsgContains(message, "weaknesses") then npcHandler:say({ "The first awoken dragons were quite disoriented when leaving the {mists} and re-entering reality. ...", "This led to certain vulnerabilities. However, the dragons overcame such shortcomings quickly and soon took their rightful place in the food chain, so to say.", }, npc, creature) npcHandler:setTopic(playerId, 0) - elseif MsgContains(message, "mists") and npcHandler:getTopic(playerId) == 0 then + elseif MsgContains(message, "mists") then npcHandler:say({ "There was a time before the gods cast the mists of healing over the world. At that time the dragons ruled and burnt the {world}. ...", "In hindsight I'm not too proud of this. This was some kind of juvenile bullying.", }, npc, creature) npcHandler:setTopic(playerId, 0) - elseif MsgContains(message, "world") and npcHandler:getTopic(playerId) == 0 then + elseif MsgContains(message, "world") then npcHandler:say({ "The world has changed so much; I'm beginning to feel really old. People have changed, the face of the world has changed, even the laws of nature are no longer the same. ...", "I think it is the greatest advantage of you {humans} to be more flexible and adaptable.", }, npc, creature) npcHandler:setTopic(playerId, 0) - elseif MsgContains(message, "books") and npcHandler:getTopic(playerId) == 0 then + elseif MsgContains(message, "books") then npcHandler:say({ "Your books are an amazing thing. Draconic glyphs are so different. ...", "They are not only more complicated but also more specific. A single word which always keeps the same meaning is astonishingly effective in its primitive way. ...", @@ -121,19 +123,19 @@ local function creatureSayCallback(npc, creature, type, message) "Books are a wonderful {invention}. If you are ever tired of your heroic exploits, take the time to read one.", }, npc, creature) npcHandler:setTopic(playerId, 0) - elseif MsgContains(message, "invention") and npcHandler:getTopic(playerId) == 0 then + elseif MsgContains(message, "invention") then npcHandler:say({ "Being powerful creatures themselves, dragons had no need for inventions. ...", "However, now that times have changed and the pressure increases, even my kin might slowly start to change in order to {adapt}.", }, npc, creature) npcHandler:setTopic(playerId, 0) - elseif MsgContains(message, "adapt") and npcHandler:getTopic(playerId) == 0 then + elseif MsgContains(message, "adapt") then npcHandler:say({ "Well, surely some of my kin might whine and complain as they always do. ...", "You have no idea how backwards thinking some dragons can be. A few are even still idealising the times before the {mists}.", }, npc, creature) npcHandler:setTopic(playerId, 0) - elseif MsgContains(message, "finer") and npcHandler:getTopic(playerId) == 0 then + elseif MsgContains(message, "finer") then npcHandler:say({ "The definition of finer things is different for a dragon than for a human. ...", "A young dragon appreciates diving into a lava pool, while an old dragon just can't stand to get rid of the {lava} afterwards and prefers bathing in boiling water.", @@ -144,6 +146,8 @@ local function creatureSayCallback(npc, creature, type, message) return true end +npcHandler:setMessage(MESSAGE_GREET, "Hello, my sparring buddy. We should have another fight sometimes. I think you may have earned a little reward.") + keywordHandler:addKeyword({ "times" }, StdModule.say, { npcHandler = npcHandler, text = "Times have changed . In the past dragons were feared and respected. Only the {demons} rivalled our notoriety." }) keywordHandler:addKeyword({ "demons" }, StdModule.say, { npcHandler = npcHandler, text = "Those upstarts! I wonder why would anyone care about them. They lack our style. For them it is all about brute force and showing-off." }) keywordHandler:addKeyword({ "style" }, StdModule.say, { npcHandler = npcHandler, text = "Breathing fire is an art! Instead of setting everything on fire, you exhale a cone of fire to give a worthy opponent a chance to avoid it." }) diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_ferumbras_lever.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_ferumbras_lever.lua index 161aaafb3e7..80c82795673 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_ferumbras_lever.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_ferumbras_lever.lua @@ -19,6 +19,15 @@ local config = { local leverFerumbras = Action() function leverFerumbras.onUse(player, item, fromPosition, target, toPosition, isHotkey) + local cooldownTime = player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.FerumbrasMortalShellTime) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage("You must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + end + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) for _, spec in pairs(spectators) do if spec:isPlayer() then diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_mazoran.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_mazoran.lua index 56cda9fb65b..7edf91121fd 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_mazoran.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_mazoran.lua @@ -21,7 +21,35 @@ local config = { local leverMazoran = Action() function leverMazoran.onUse(player, item, fromPosition, target, toPosition, isHotkey) + local players = {} local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + + for i = 1, #config.playerPositions do + local pos = config.playerPositions[i].pos + local creature = Tile(pos):getTopCreature() + + if not creature or not creature:isPlayer() then + player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") + return true + end + + local cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.MazoranTime) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + end + + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + for _, spec in pairs(spectators) do if spec:isPlayer() then player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) @@ -34,17 +62,6 @@ function leverMazoran.onUse(player, item, fromPosition, target, toPosition, isHo return true end - local players = {} - for i = 1, #config.playerPositions do - local pos = config.playerPositions[i].pos - local creature = Tile(pos):getTopCreature() - if not creature or not creature:isPlayer() then - player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") - return true - end - table.insert(players, creature) - end - for i = 1, #players do local playerToTeleport = players[i] local teleportPos = config.playerPositions[i].teleport @@ -54,9 +71,6 @@ function leverMazoran.onUse(player, item, fromPosition, target, toPosition, isHo end local boss = Game.createMonster(config.boss.name, config.boss.position) - if boss then - boss:setReward(true) - end addEvent(clearBossRoom, config.timeToDefeat * 1000, config.specPos.from, config.specPos.to, config.exit) diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_plagirath.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_plagirath.lua index b49a0d58db8..a3ed6fd05d3 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_plagirath.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_plagirath.lua @@ -21,7 +21,35 @@ local config = { local leverPlagirath = Action() function leverPlagirath.onUse(player, item, fromPosition, target, toPosition, isHotkey) + local players = {} local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + + for i = 1, #config.playerPositions do + local pos = config.playerPositions[i].pos + local creature = Tile(pos):getTopCreature() + + if not creature or not creature:isPlayer() then + player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") + return true + end + + local cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.PlagirathTime) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + end + + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + for _, spec in pairs(spectators) do if spec:isPlayer() then player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) @@ -34,17 +62,6 @@ function leverPlagirath.onUse(player, item, fromPosition, target, toPosition, is return true end - local players = {} - for i = 1, #config.playerPositions do - local pos = config.playerPositions[i].pos - local creature = Tile(pos):getTopCreature() - if not creature or not creature:isPlayer() then - player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") - return true - end - table.insert(players, creature) - end - for i = 1, #players do local playerToTeleport = players[i] local teleportPos = config.playerPositions[i].teleport diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_ragiaz.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_ragiaz.lua index cbe9d13ba35..e23cf2889f2 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_ragiaz.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_ragiaz.lua @@ -28,7 +28,35 @@ local config = { local leverRagiaz = Action() function leverRagiaz.onUse(player, item, fromPosition, target, toPosition, isHotkey) + local players = {} local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + + for i = 1, #config.playerPositions do + local pos = config.playerPositions[i].pos + local creature = Tile(pos):getTopCreature() + + if not creature or not creature:isPlayer() then + player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") + return true + end + + local cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.RagiazTime) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + end + + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + for _, spec in pairs(spectators) do if spec:isPlayer() then player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) @@ -41,17 +69,6 @@ function leverRagiaz.onUse(player, item, fromPosition, target, toPosition, isHot return true end - local players = {} - for i = 1, #config.playerPositions do - local pos = config.playerPositions[i].pos - local creature = Tile(pos):getTopCreature() - if not creature or not creature:isPlayer() then - player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") - return true - end - table.insert(players, creature) - end - for i = 1, #players do local playerToTeleport = players[i] local teleportPos = config.playerPositions[i].teleport diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_razzagorn.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_razzagorn.lua index c24ec5d2e37..6083111c026 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_razzagorn.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_razzagorn.lua @@ -21,7 +21,35 @@ local config = { local leverRazzagorn = Action() function leverRazzagorn.onUse(player, item, fromPosition, target, toPosition, isHotkey) + local players = {} local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + + for i = 1, #config.playerPositions do + local pos = config.playerPositions[i].pos + local creature = Tile(pos):getTopCreature() + + if not creature or not creature:isPlayer() then + player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") + return true + end + + local cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.RazzagornTime) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + end + + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + for _, spec in pairs(spectators) do if spec:isPlayer() then player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) @@ -34,17 +62,6 @@ function leverRazzagorn.onUse(player, item, fromPosition, target, toPosition, is return true end - local players = {} - for i = 1, #config.playerPositions do - local pos = config.playerPositions[i].pos - local creature = Tile(pos):getTopCreature() - if not creature or not creature:isPlayer() then - player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") - return true - end - table.insert(players, creature) - end - for i = 1, #players do local playerToTeleport = players[i] local teleportPos = config.playerPositions[i].teleport diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_shulgrax.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_shulgrax.lua index 43f5029a6ac..61f7bc205ec 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_shulgrax.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_shulgrax.lua @@ -21,7 +21,35 @@ local config = { local leverShulgrax = Action() function leverShulgrax.onUse(player, item, fromPosition, target, toPosition, isHotkey) + local players = {} local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + + for i = 1, #config.playerPositions do + local pos = config.playerPositions[i].pos + local creature = Tile(pos):getTopCreature() + + if not creature or not creature:isPlayer() then + player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") + return true + end + + local cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.ShulgraxTime) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + end + + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + for _, spec in pairs(spectators) do if spec:isPlayer() then player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) @@ -34,17 +62,6 @@ function leverShulgrax.onUse(player, item, fromPosition, target, toPosition, isH return true end - local players = {} - for i = 1, #config.playerPositions do - local pos = config.playerPositions[i].pos - local creature = Tile(pos):getTopCreature() - if not creature or not creature:isPlayer() then - player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") - return true - end - table.insert(players, creature) - end - for i = 1, #players do local playerToTeleport = players[i] local teleportPos = config.playerPositions[i].teleport diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_tarbaz.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_tarbaz.lua index dfda8c76e8d..fbfc4574903 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_tarbaz.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_tarbaz.lua @@ -21,7 +21,35 @@ local config = { local leverTarbaz = Action() function leverTarbaz.onUse(player, item, fromPosition, target, toPosition, isHotkey) + local players = {} local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + + for i = 1, #config.playerPositions do + local pos = config.playerPositions[i].pos + local creature = Tile(pos):getTopCreature() + + if not creature or not creature:isPlayer() then + player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") + return true + end + + local cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TarbazTime) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + end + + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + for _, spec in pairs(spectators) do if spec:isPlayer() then player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) @@ -34,17 +62,6 @@ function leverTarbaz.onUse(player, item, fromPosition, target, toPosition, isHot return true end - local players = {} - for i = 1, #config.playerPositions do - local pos = config.playerPositions[i].pos - local creature = Tile(pos):getTopCreature() - if not creature or not creature:isPlayer() then - player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") - return true - end - table.insert(players, creature) - end - for i = 1, #players do local playerToTeleport = players[i] local teleportPos = config.playerPositions[i].teleport diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_zamulosh.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_zamulosh.lua index 74e7740bc9f..8ba9fe077b0 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_zamulosh.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_zamulosh.lua @@ -6,6 +6,10 @@ local config = { timeToDefeat = 17 * 60, -- 17 minutes in seconds playerPositions = { { pos = Position(33680, 32741, 11), teleport = Position(33644, 32760, 11), effect = CONST_ME_TELEPORT }, + { pos = Position(33680, 32742, 11), teleport = Position(33644, 32760, 11), effect = CONST_ME_TELEPORT }, + { pos = Position(33680, 32743, 11), teleport = Position(33644, 32760, 11), effect = CONST_ME_TELEPORT }, + { pos = Position(33680, 32744, 11), teleport = Position(33644, 32760, 11), effect = CONST_ME_TELEPORT }, + { pos = Position(33680, 32745, 11), teleport = Position(33644, 32760, 11), effect = CONST_ME_TELEPORT }, }, specPos = { from = Position(33632, 32747, 11), @@ -25,7 +29,35 @@ local config = { local leverZamulosh = Action() function leverZamulosh.onUse(player, item, fromPosition, target, toPosition, isHotkey) + local players = {} local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + + for i = 1, #config.playerPositions do + local pos = config.playerPositions[i].pos + local creature = Tile(pos):getTopCreature() + + if not creature or not creature:isPlayer() then + player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") + return true + end + + local cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.ZamuloshTime) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + end + + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + for _, spec in pairs(spectators) do if spec:isPlayer() then player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) @@ -38,17 +70,6 @@ function leverZamulosh.onUse(player, item, fromPosition, target, toPosition, isH return true end - local players = {} - for i = 1, #config.playerPositions do - local pos = config.playerPositions[i].pos - local creature = Tile(pos):getTopCreature() - if not creature or not creature:isPlayer() then - player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") - return true - end - table.insert(players, creature) - end - for i = 1, #players do local playerToTeleport = players[i] local teleportPos = config.playerPositions[i].teleport diff --git a/data-otservbr-global/scripts/quests/the_djinn_war_quest/action_water_fountain.lua b/data-otservbr-global/scripts/quests/the_djinn_war_quest/action_water_fountain.lua index 0f8ae9f8ac5..9586aae2d80 100644 --- a/data-otservbr-global/scripts/quests/the_djinn_war_quest/action_water_fountain.lua +++ b/data-otservbr-global/scripts/quests/the_djinn_war_quest/action_water_fountain.lua @@ -11,5 +11,5 @@ function action_water_fountain.onUse(player, item, fromPosition, target, toPosit return true end -action_water_fountain:aid(5390) +action_water_fountain:aid(12105) action_water_fountain:register() diff --git a/data-otservbr-global/scripts/quests/the_first_dragon/actions_lair_entrance.lua b/data-otservbr-global/scripts/quests/the_first_dragon/actions_lair_entrance.lua index 2c03f4d86e3..c2666382616 100644 --- a/data-otservbr-global/scripts/quests/the_first_dragon/actions_lair_entrance.lua +++ b/data-otservbr-global/scripts/quests/the_first_dragon/actions_lair_entrance.lua @@ -1,7 +1,7 @@ local lairEntrance = Action() function lairEntrance.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if player:getStorageValue(Storage.FirstDragon.AccessCave) <= 3 then + if player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.AccessCave) <= 3 then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You are not worthy to enter in The First Dragon's Lair yet.") return true end diff --git a/data-otservbr-global/scripts/quests/the_first_dragon/actions_lever.lua b/data-otservbr-global/scripts/quests/the_first_dragon/actions_lever.lua index 2e794aa7fa8..698ada382b2 100644 --- a/data-otservbr-global/scripts/quests/the_first_dragon/actions_lever.lua +++ b/data-otservbr-global/scripts/quests/the_first_dragon/actions_lever.lua @@ -3,7 +3,7 @@ local lever = Action() local config = { centerRoom = { x = 33616, y = 31022, z = 14 }, range = 10, - storage = Storage.FirstDragon.FirstDragonTimer, + storage = Storage.Quest.U11_02.TheFirstDragon.FirstDragonTimer, monsterPosition = { { position = Position(33574, 31013, 14) }, { position = Position(33592, 31013, 14) }, @@ -58,23 +58,63 @@ local config = { { fromPosition = Position(33583, 30997, 14) }, { fromPosition = Position(33584, 30997, 14) }, }, + clearArea = { + from = Position(33566, 31006, 14), + to = Position(33626, 31032, 14), + }, } +local function clearMonstersInArea(fromPos, toPos) + for z = fromPos.z, toPos.z do + for y = fromPos.y, toPos.y do + for x = fromPos.x, toPos.x do + local tile = Tile(Position(x, y, z)) + if tile then + local creature = tile:getTopCreature() + if creature and creature:isMonster() then + creature:remove() + end + end + end + end + end +end + +local function isRoomOccupied(fromPos, toPos) + for z = fromPos.z, toPos.z do + for y = fromPos.y, toPos.y do + for x = fromPos.x, toPos.x do + local tile = Tile(Position(x, y, z)) + if tile then + local creature = tile:getTopCreature() + if creature and creature:isPlayer() then + return true + end + end + end + end + end + return false +end + function lever.onUse(player, item, fromPosition, target, toPosition, isHotkey) if item.itemid == 8911 then for i = 1, #config.playerPositions do local creature = Tile(config.playerPositions[i]):getTopCreature() if not creature then item:transform(8912) - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need 5 players to fight with this boss.") + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need 15 players to fight with this boss.") return true end end end + if item.itemid == 8911 then - if roomIsOccupied(config.centerRoom, false, config.range, config.range) then - player:say("Someone is fighting against the boss! You need wait awhile.", TALKTYPE_MONSTER_SAY) + if isRoomOccupied(config.clearArea.from, config.clearArea.to) then + player:say("Someone is fighting against the boss! You need to wait awhile.", TALKTYPE_MONSTER_SAY) return true + else + clearMonstersInArea(config.clearArea.from, config.clearArea.to) end for d = 1, 5 do @@ -83,6 +123,7 @@ function lever.onUse(player, item, fromPosition, target, toPosition, isHotkey) for b = 1, #config.monsterPosition do Game.createMonster("fallen challenger", config.monsterPosition[b].position, true, true) end + for i = 1, #config.playerPositions do local creature = Tile(config.playerPositions[i]):getTopCreature() if creature then @@ -110,10 +151,10 @@ function lever.onUse(player, item, fromPosition, target, toPosition, isHotkey) end creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT) creature:setStorageValue(config.storage, os.time() + 20 * 3600) - creature:setStorageValue(Storage.FirstDragon.SomewhatBeatable, 0) + creature:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.SomewhatBeatable, 0) end end - -- One hour for clean the room + addEvent(clearRoom, 60 * 60 * 1000, Position(33583, 31022, 14), 50, 50, config.storage) Game.createMonster("spirit of fertility", Position(33625, 31021, 14), true, true) item:transform(8912) diff --git a/data-otservbr-global/scripts/quests/the_first_dragon/actions_rewards.lua b/data-otservbr-global/scripts/quests/the_first_dragon/actions_rewards.lua index 2d1c8ac2a90..bbef9b99c1b 100644 --- a/data-otservbr-global/scripts/quests/the_first_dragon/actions_rewards.lua +++ b/data-otservbr-global/scripts/quests/the_first_dragon/actions_rewards.lua @@ -6,13 +6,13 @@ local bpItems = { { name = "gold token", count = 3 }, { name = "blue gem", count = 1 }, { name = "yellow gem", count = 1 }, - { id = 3039, count = 1 }, -- red gem + { name = "red gem", count = 1 }, { name = "demon horn", count = 2 }, { name = "slime heart", count = 2 }, { name = "energy vein", count = 2 }, { name = "petrified scream", count = 2 }, { name = "brimstone shell", count = 2 }, - { name = "deepling wart", count = 2 }, + { name = "deepling warts", count = 2 }, { name = "wyrm scale", count = 2 }, { name = "hellspawn tail", count = 2 }, } @@ -33,36 +33,44 @@ local chests = { } local finalReward = Action() + function finalReward.onUse(player, item, fromPosition, target, toPosition, isHotkey) local setting = chests[item.uid] if not setting then return true end - if item.uid == 14021 and player:getStorageValue(Storage.FirstDragon.RewardFeather) < os.time() then + + if player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.Feathers) ~= 2 then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You are not eligible to claim these rewards yet.") + return true + end + + if item.uid == 14021 and player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.RewardMask) < os.time() then player:addItem(setting.name, setting.count, true) - player:setStorageValue(Storage.FirstDragon.RewardFeather, os.time() + 24 * 3600) + player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.RewardMask, os.time() + 60 * 60 * 24 * 5) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You found " .. setting.count .. " " .. setting.name .. ".") - elseif item.uid == 14022 and player:getStorageValue(Storage.FirstDragon.RewardBackpack) < os.time() then + elseif item.uid == 14022 and player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.RewardBackpack) < os.time() then local bp = Game.createItem("Backpack", 1) if bp then for i = 1, #bpItems do if bpItems[i].id then - bp:addItem(bpItems[i].id, count) + bp:addItem(bpItems[i].id, bpItems[i].count) else - bp:addItem(bpItems[i].name, count) + bp:addItem(bpItems[i].name, bpItems[i].count) end end bp:moveTo(player) end player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You found a backpack.") - player:setStorageValue(Storage.FirstDragon.RewardBackpack, os.time() + 60 * 60 * 365 * 24) - elseif item.uid == 14023 and player:getStorageValue(Storage.FirstDragon.RewardMask) < os.time() then + player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.RewardBackpack, os.time() + 60 * 60 * 24 * 365) + elseif item.uid == 14023 and player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.RewardFeather) < os.time() then player:addItem(setting.name, setting.count, true) - player:setStorageValue(Storage.FirstDragon.RewardMask, os.time() + 60 * 60 * 5 * 24) + player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.RewardFeather, os.time() + 24 * 3600) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You found " .. setting.count .. " " .. setting.name .. ".") else - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The " .. getItemName(setting.itemId) .. " is empty.") + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The chest is empty.") end + return true end diff --git a/data-otservbr-global/scripts/quests/the_first_dragon/actions_sacrifice_items.lua b/data-otservbr-global/scripts/quests/the_first_dragon/actions_sacrifice_items.lua index 19144117c54..0a9cd03ccaf 100644 --- a/data-otservbr-global/scripts/quests/the_first_dragon/actions_sacrifice_items.lua +++ b/data-otservbr-global/scripts/quests/the_first_dragon/actions_sacrifice_items.lua @@ -1,8 +1,8 @@ local config = { - [24939] = { storage = Storage.FirstDragon.Scale }, - [24940] = { storage = Storage.FirstDragon.Tooth }, - [24941] = { storage = Storage.FirstDragon.Horn }, - [24942] = { storage = Storage.FirstDragon.Bones }, + [24939] = { storage = Storage.Quest.U11_02.TheFirstDragon.Scale }, + [24940] = { storage = Storage.Quest.U11_02.TheFirstDragon.Tooth }, + [24941] = { storage = Storage.Quest.U11_02.TheFirstDragon.Horn }, + [24942] = { storage = Storage.Quest.U11_02.TheFirstDragon.Bones }, } local sacrificeItems = Action() @@ -18,20 +18,20 @@ function sacrificeItems.onUse(player, item, fromPosition, target, toPosition, is return true end - if player:getStorageValue(Storage.FirstDragon.AccessCave) >= 4 then + if player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.AccessCave) >= 4 then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You're plunging " .. item:getName() .. " into the lava. You are now worthy to enter The First Dragon's Lair. Touch the lava pool again.") return true end - if player:getStorageValue(Storage.FirstDragon.AccessCave) < 0 then - player:setStorageValue(Storage.FirstDragon.AccessCave, 0) + if player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.AccessCave) < 0 then + player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.AccessCave, 0) end local targetPosition = Position(33047, 32712, 3) if toPosition == targetPosition then local targetId = Tile(targetPosition):getItemById(25160) if targetId then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You're plunging " .. item:getName() .. " into the lava.") - player:setStorageValue(Storage.FirstDragon.AccessCave, player:getStorageValue(Storage.FirstDragon.AccessCave) + 1) + player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.AccessCave, player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.AccessCave) + 1) player:setStorageValue(setting.storage, 1) item:remove(1) return true diff --git a/data-otservbr-global/scripts/quests/the_first_dragon/actions_treasure_chest.lua b/data-otservbr-global/scripts/quests/the_first_dragon/actions_treasure_chest.lua index d40aec690d2..edbcba3184f 100644 --- a/data-otservbr-global/scripts/quests/the_first_dragon/actions_treasure_chest.lua +++ b/data-otservbr-global/scripts/quests/the_first_dragon/actions_treasure_chest.lua @@ -84,26 +84,30 @@ local UniqueTable = { } local treasureChest = Action() + function treasureChest.onUse(player, item, fromPosition, target, toPosition, isHotkey) local setting = UniqueTable[item.uid] if not setting then return false end - if player:getStorageValue(item.uid) >= 1 then - player:sendTextMessage(string.format(MESSAGE_EVENT_ADVANCE, "The %s is empty.", item:getName())) + local storageValue = player:getStorageValue(item.uid) + if storageValue > 0 then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The " .. item:getName() .. " is empty.") return true end - if player:getStorageValue(Storage.FirstDragon.ChestCounter) >= 19 then + if player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.ChestCounter) >= 19 then player:addAchievement("Treasure Hunter") player:addItem(setting.name or setting.itemId, setting.count, true) player:setStorageValue(item.uid, 1) - player:setStorageValue(Storage.FirstDragon.ChestCounter, player:getStorageValue(Storage.FirstDragon.ChestCounter) + 1) + player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.ChestCounter, player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.ChestCounter) + 1) return true end + player:setStorageValue(item.uid, 1) - player:setStorageValue(Storage.FirstDragon.ChestCounter, player:getStorageValue(Storage.FirstDragon.ChestCounter) + 1) + player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.ChestCounter, player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.ChestCounter) + 1) + if setting.name then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You found " .. setting.count .. " " .. setting.name .. ".") player:addItem(setting.name, setting.count, true) diff --git a/data-otservbr-global/scripts/quests/the_first_dragon/creaturescripts_death_first_dragon.lua b/data-otservbr-global/scripts/quests/the_first_dragon/creaturescripts_death_first_dragon.lua index 90a2451066c..c347f907e09 100644 --- a/data-otservbr-global/scripts/quests/the_first_dragon/creaturescripts_death_first_dragon.lua +++ b/data-otservbr-global/scripts/quests/the_first_dragon/creaturescripts_death_first_dragon.lua @@ -25,7 +25,9 @@ function deathFirstDragon.onDeath(creature, corpse, lasthitkiller, mostdamagekil if spec:isPlayer() then spec:teleportTo(Position(33617, 31020, 13)) spec:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - spec:setStorageValue(Storage.FirstDragon.Feathers, 1) + if spec:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.Feathers) < 1 then + spec:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.Feathers, 1) + end end end return true diff --git a/data-otservbr-global/scripts/quests/the_first_dragon/creaturescripts_death_somewhat_beatable.lua b/data-otservbr-global/scripts/quests/the_first_dragon/creaturescripts_death_somewhat_beatable.lua index be0cab0cd7b..13308f03d97 100644 --- a/data-otservbr-global/scripts/quests/the_first_dragon/creaturescripts_death_somewhat_beatable.lua +++ b/data-otservbr-global/scripts/quests/the_first_dragon/creaturescripts_death_somewhat_beatable.lua @@ -6,15 +6,15 @@ function deathSomewhatBeatable.onDeath(creature, target) local spec = spectators[i] if spec:isPlayer() then if creature:getName():lower() == "somewhat beatable" then - if spec:getStorageValue(Storage.FirstDragon.SomewhatBeatable) < 5 then - spec:setStorageValue(Storage.FirstDragon.SomewhatBeatable, spec:getStorageValue(Storage.FirstDragon.SomewhatBeatable) + 1) + if spec:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.SomewhatBeatable) < 5 then + spec:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.SomewhatBeatable, spec:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.SomewhatBeatable) + 1) end end - if spec:getStorageValue(Storage.FirstDragon.SomewhatBeatable) == 5 then + if spec:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.SomewhatBeatable) == 5 then for b = 1, 6 do Game.createMonster("dragon essence", Position(math.random(33609, 33624), math.random(31017, 31028), 14), true, true) end - spec:setStorageValue(Storage.FirstDragon.SomewhatBeatable, 0) + spec:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.SomewhatBeatable, 0) end end end diff --git a/data-otservbr-global/scripts/quests/the_first_dragon/creaturescripts_kill_dragon.lua b/data-otservbr-global/scripts/quests/the_first_dragon/creaturescripts_kill_dragon.lua index 55045c65e9d..af6bef08e29 100644 --- a/data-otservbr-global/scripts/quests/the_first_dragon/creaturescripts_kill_dragon.lua +++ b/data-otservbr-global/scripts/quests/the_first_dragon/creaturescripts_kill_dragon.lua @@ -2,9 +2,9 @@ local killDragon = CreatureEvent("TheFirstDragonDragonTaskDeath") function killDragon.onDeath(creature, _corpse, _lastHitKiller, mostDamageKiller) onDeathForParty(creature, mostDamageKiller, function(creature, player) - local storage = player:getStorageValue(Storage.FirstDragon.DragonCounter) + local storage = player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.DragonCounter) if storage >= 0 and storage < 200 then - player:setStorageValue(Storage.FirstDragon.DragonCounter, player:getStorageValue(Storage.FirstDragon.DragonCounter) + 1) + player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.DragonCounter, player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.DragonCounter) + 1) end end) return true diff --git a/data-otservbr-global/scripts/quests/the_first_dragon/movements_entrance_teleport.lua b/data-otservbr-global/scripts/quests/the_first_dragon/movements_entrance_teleport.lua index 9eb046b74f7..8543eff38c5 100644 --- a/data-otservbr-global/scripts/quests/the_first_dragon/movements_entrance_teleport.lua +++ b/data-otservbr-global/scripts/quests/the_first_dragon/movements_entrance_teleport.lua @@ -1,7 +1,7 @@ local UniqueTable = { -- Tazhadur entrance [35001] = { - storage = Storage.FirstDragon.DragonCounter, + storage = Storage.Quest.U11_02.TheFirstDragon.DragonCounter, value = 200, range = 10, newPos = { x = 32015, y = 32466, z = 8 }, @@ -10,8 +10,8 @@ local UniqueTable = { }, -- Kalyassa entrance [35002] = { - storage = Storage.FirstDragon.ChestCounter, - value = 5, + storage = Storage.Quest.U11_02.TheFirstDragon.ChestCounter, + value = 4, range = 10, newPos = { x = 32078, y = 32456, z = 8 }, bossName = "Kalyassa", @@ -19,7 +19,7 @@ local UniqueTable = { }, -- Zorvorax entrance [35003] = { - storage = Storage.FirstDragon.SecretsCounter, + storage = Storage.Quest.U11_02.TheFirstDragon.SecretsCounter, value = 3, range = 10, newPos = { x = 32008, y = 32396, z = 8 }, @@ -28,7 +28,7 @@ local UniqueTable = { }, -- Gelidrazah entrance [35004] = { - storage = Storage.FirstDragon.GelidrazahAccess, + storage = Storage.Quest.U11_02.TheFirstDragon.GelidrazahAccess, value = 1, range = 10, newPos = { x = 32076, y = 32402, z = 8 }, @@ -65,7 +65,7 @@ function entranceTeleport.onStepIn(creature, item, position, fromPosition) return true end - if player:getStorageValue(Storage.FirstDragon.Questline) < 1 or player:getStorageValue(setting.storage) < setting.value then + if player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.Questline) < 1 or player:getStorageValue(setting.storage) < setting.value then player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) player:teleportTo(fromPosition) player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) diff --git a/data-otservbr-global/scripts/quests/the_first_dragon/movements_last_teleport.lua b/data-otservbr-global/scripts/quests/the_first_dragon/movements_last_teleport.lua index 310fabe8cd7..80509399d64 100644 --- a/data-otservbr-global/scripts/quests/the_first_dragon/movements_last_teleport.lua +++ b/data-otservbr-global/scripts/quests/the_first_dragon/movements_last_teleport.lua @@ -1,27 +1,43 @@ local lastTeleport = MoveEvent() +local function isDateWithinEvent() + local currentDate = os.date("*t") + local startDate = { day = 14, month = 1 } + local endDate = { day = 12, month = 2 } + + if (currentDate.month == startDate.month and currentDate.day >= startDate.day) or (currentDate.month == endDate.month and currentDate.day <= endDate.day) or (currentDate.month > startDate.month and currentDate.month < endDate.month) then + return true + end + return false +end + function lastTeleport.onStepIn(creature, item, position, fromPosition) local player = creature:getPlayer() if not player then return end - local setting = UniqueTable[item.uid] - if not setting then + local destination = { x = 33585, y = 30990, z = 14 } + + if not isDateWithinEvent() then + player:teleportTo(fromPosition, true) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "This teleport is only available between January 14 and February 12.") + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) return true end - if player:getStorageValue(Storage.FirstDragon.FirstDragonTimer) < os.time() then + if player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.FirstDragonTimer) < os.time() then position:sendMagicEffect(CONST_ME_TELEPORT) - player:teleportTo(setting.destination) + player:teleportTo(destination) player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) else player:teleportTo(fromPosition, true) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have to wait to challenge The First Dragon again!") player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) end + return true end -lastTeleport:uid(24894) +lastTeleport:uid(24889) lastTeleport:register() diff --git a/data-otservbr-global/scripts/quests/the_first_dragon/movements_zorvorax_secrets.lua b/data-otservbr-global/scripts/quests/the_first_dragon/movements_zorvorax_secrets.lua index 16ea14e9fcd..36772967418 100644 --- a/data-otservbr-global/scripts/quests/the_first_dragon/movements_zorvorax_secrets.lua +++ b/data-otservbr-global/scripts/quests/the_first_dragon/movements_zorvorax_secrets.lua @@ -1,18 +1,15 @@ local UniqueTable = { [25002] = { - storage = Storage.FirstDragon.DesertTile, - msg = "You enter the beautiful oasis. \ - By visiting this sacred site you're infused with the power of water bringing life to the desert.", + storage = Storage.Quest.U11_02.TheFirstDragon.DesertTile, + msg = "You enter the beautiful oasis. By visiting this sacred site you're infused with the power of water bringing life to the desert.", }, [25003] = { - storage = Storage.FirstDragon.StoneSculptureTile, - msg = "You enter the circle of trees and flowers. \ - By visiting this sacred site you're infused with the power of nature and plants.", + storage = Storage.Quest.U11_02.TheFirstDragon.StoneSculptureTile, + msg = "You enter the circle of trees and flowers. By visiting this sacred site you're infused with the power of nature and plants.", }, [25004] = { - storage = Storage.FirstDragon.SuntowerTile, - msg = "You entered the suntower of Ab'dendriel. \ - By visiting this sacred site you're infused with the power of the life-giving sun.", + storage = Storage.Quest.U11_02.TheFirstDragon.SuntowerTile, + msg = "You entered the suntower of Ab'dendriel. By visiting this sacred site you're infused with the power of the life-giving sun.", }, } @@ -31,7 +28,7 @@ function zorvoraxSecrets.onStepIn(creature, item, position, fromPosition) if player:getStorageValue(setting.storage) < 1 then player:setStorageValue(setting.storage, 1) - player:setStorageValue(Storage.FirstDragon.SecretsCounter, player:getStorageValue(Storage.FirstDragon.SecretsCounter) + 1) + player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.SecretsCounter, player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.SecretsCounter) + 1) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, setting.msg) return true end diff --git a/data-otservbr-global/startup/tables/item.lua b/data-otservbr-global/startup/tables/item.lua index ed01d30aeed..6fa23fb8bd9 100644 --- a/data-otservbr-global/startup/tables/item.lua +++ b/data-otservbr-global/startup/tables/item.lua @@ -1623,6 +1623,11 @@ ItemUnique = { itemId = 2576, itemPos = { x = 32455, y = 31166, z = 12 }, }, + -- The First Dragon + [1066] = { + itemId = 3657, + itemPos = { x = 33608, y = 31022, z = 14 }, + }, -- The Pits of Inferno Quest [2000] = { itemId = 599, diff --git a/data-otservbr-global/startup/tables/teleport.lua b/data-otservbr-global/startup/tables/teleport.lua index 367dc51ba4e..b32575f117d 100644 --- a/data-otservbr-global/startup/tables/teleport.lua +++ b/data-otservbr-global/startup/tables/teleport.lua @@ -34,6 +34,11 @@ TeleportUnique = { }, -- The first dragon quest -- Path: data\scripts\movements\quests\first_dragon\entrance_teleport.lua + -- Boss First Dragon + [24889] = { + itemId = 1949, + itemPos = { x = 33597, y = 30996, z = 14 }, + }, -- Tazhadur entrance [35001] = { itemId = 8649, diff --git a/data-otservbr-global/startup/tables/tile.lua b/data-otservbr-global/startup/tables/tile.lua index 546bc66ef65..59d9d3be69f 100644 --- a/data-otservbr-global/startup/tables/tile.lua +++ b/data-otservbr-global/startup/tables/tile.lua @@ -54,6 +54,7 @@ TileAction = { { x = 32696, y = 31720, z = 7 }, { x = 32697, y = 31720, z = 7 }, { x = 32698, y = 31720, z = 7 }, + { x = 32691, y = 31724, z = 7 }, }, }, --Dawnport diff --git a/data-otservbr-global/world/otservbr-npc.xml b/data-otservbr-global/world/otservbr-npc.xml index 5a475b8999d..5c53601aa9c 100644 --- a/data-otservbr-global/world/otservbr-npc.xml +++ b/data-otservbr-global/world/otservbr-npc.xml @@ -2818,6 +2818,9 @@ + + + diff --git a/data/libs/functions/boss_lever.lua b/data/libs/functions/boss_lever.lua index 9cd577ee911..821587a59d5 100644 --- a/data/libs/functions/boss_lever.lua +++ b/data/libs/functions/boss_lever.lua @@ -146,10 +146,22 @@ end function BossLever:onUse(player) local monsterName = MonsterType(self.name):getName() local isParticipant = false - for _, v in ipairs(self.playerPositions) do - if Position(v.pos) == player:getPosition() then + local players = {} + + for i = 1, #self.playerPositions do + local pos = self.playerPositions[i].pos + local creature = Tile(pos):getTopCreature() + + if not creature or not creature:isPlayer() then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need " .. #self.playerPositions .. " players to challenge " .. self.name .. ".") + return true + end + + if pos == player:getPosition() then isParticipant = true end + + table.insert(players, creature) end if not isParticipant then return false