From 37e2caeab3633da7e92edfc6958dd97df46138d5 Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Mon, 16 Sep 2024 10:38:51 -0300 Subject: [PATCH] The Great Dragon Hunt Quest --- data-otservbr-global/lib/core/quests.lua | 40 ++++----------- data-otservbr-global/lib/core/storages.lua | 18 +++---- .../creaturescripts/customs/freequests.lua | 4 +- .../adventurers_guild/actions_treasure.lua | 51 ------------------- .../actions_treasure.lua | 47 +++++++++++++++++ .../actions_warrior_skeleton.lua | 9 ++-- .../creaturescripts_the_great_dragon_hunt.lua | 2 +- .../startup/tables/corpse.lua | 7 +++ data-otservbr-global/startup/tables/item.lua | 12 +++++ 9 files changed, 94 insertions(+), 96 deletions(-) delete mode 100644 data-otservbr-global/scripts/quests/adventurers_guild/actions_treasure.lua create mode 100644 data-otservbr-global/scripts/quests/the_great_dragon_hunt_quest/actions_treasure.lua rename data-otservbr-global/scripts/quests/{adventurers_guild => the_great_dragon_hunt_quest}/actions_warrior_skeleton.lua (67%) rename data-otservbr-global/scripts/quests/{adventurers_guild => the_great_dragon_hunt_quest}/creaturescripts_the_great_dragon_hunt.lua (84%) diff --git a/data-otservbr-global/lib/core/quests.lua b/data-otservbr-global/lib/core/quests.lua index 65398ba4b68..cc1a89b0eba 100644 --- a/data-otservbr-global/lib/core/quests.lua +++ b/data-otservbr-global/lib/core/quests.lua @@ -5597,38 +5597,20 @@ if not Quests then }, }, }, - [40] = { -- FREE SLOT FOR A SIMPLE QUEST - name = "XXXXXXXXXXXX", - startStorageId = Storage.AdventurersGuild.GreatDragonHunt.WarriorSkeleton, - startStorageValue = 1, - missions = { - [1] = { - name = "XXXXXXXXXXXX", - storageId = Storage.AdventurersGuild.GreatDragonHunt.WarriorSkeleton, - missionId = 10387, - startValue = 1, - endValue = 2, - states = { - [1] = "XXXXXXXXXXXX", - [2] = "XXXXXXXXXXXX", - }, - }, - }, - }, - [41] = { + [40] = { name = "Adventurers Guild", startStorageId = Storage.AdventurersGuild.QuestLine, startStorageValue = 1, missions = { [1] = { name = "The Great Dragon Hunt", - storageId = Storage.AdventurersGuild.GreatDragonHunt.WarriorSkeleton, + storageId = Storage.Quest.U10_80.TheGreatDragonHunt.WarriorSkeleton, missionId = 10388, startValue = 0, endValue = 2, description = function(player) return ("You are exploring the Kha'zeel Dragon Lairs. Others obviously found a terrible end here. \z - But the dragon hoards might justify the risks. You killed %d/50 dragons and dragon lords."):format(math.max(player:getStorageValue(Storage.AdventurersGuild.GreatDragonHunt.DragonCounter), 0)) + But the dragon hoards might justify the risks. You killed %d/50 dragons and dragon lords."):format(math.max(player:getStorageValue(Storage.Quest.U10_80.TheGreatDragonHunt.DragonCounter), 0)) end, }, [2] = { @@ -5645,7 +5627,7 @@ if not Quests then }, }, }, - [42] = { + [41] = { name = "Dawnport", startStorageId = Storage.Quest.U10_55.Dawnport.Questline, startStorageValue = 1, @@ -5740,7 +5722,7 @@ if not Quests then }, }, }, - [43] = { + [42] = { name = "The Rookie Guard", startStorageId = Storage.Quest.U9_1.TheRookieGuard.Questline, startStorageValue = 1, @@ -5922,7 +5904,7 @@ if not Quests then }, }, }, - [44] = { + [43] = { name = "The New Frontier", startStorageId = Storage.Quest.U8_54.TheNewFrontier.Questline, startStorageValue = 1, @@ -6171,7 +6153,7 @@ if not Quests then }, }, }, - [45] = { + [44] = { name = "Spirithunters Quest", startStorageId = Storage.Quest.U8_7.SpiritHunters.Mission01, startStorageValue = 1, @@ -6211,7 +6193,7 @@ if not Quests then }, }, }, - [46] = { + [45] = { name = "Threatened Dreams", startStorageId = Storage.Quest.U11_40.ThreatenedDreams.QuestLine, startStorageValue = 1, @@ -6306,7 +6288,7 @@ if not Quests then }, }, }, - [47] = { + [46] = { name = "Blood Brothers", startStorageId = Storage.Quest.U8_4.BloodBrothers.QuestLine, startStorageValue = 1, @@ -6359,7 +6341,7 @@ if not Quests then }, }, }, - [48] = { + [47] = { name = "Grave Danger", startStorageId = Storage.Quest.U12_20.GraveDanger.QuestLine, startStorageValue = 1, @@ -6536,7 +6518,7 @@ if not Quests then }, }, }, - [49] = { + [48] = { name = "The Outlaw Camp", startStorageId = Storage.Quest.U6_4.OutlawCampQuest, startStorageValue = 1, diff --git a/data-otservbr-global/lib/core/storages.lua b/data-otservbr-global/lib/core/storages.lua index 1d9d2beaf41..b51d4430854 100644 --- a/data-otservbr-global/lib/core/storages.lua +++ b/data-otservbr-global/lib/core/storages.lua @@ -551,10 +551,6 @@ Storage = { Yberius = 52144, Rahkem = 52145, }, - GreatDragonHunt = { - WarriorSkeleton = 52146, - DragonCounter = 52147, - }, QuestLine = 52148, TheLostBrother = 52149, }, @@ -2459,16 +2455,20 @@ Storage = { ChakoyaIcebergMiniWorldChange = {}, GrimvaleMineWorldChange = {}, GrimvaleQuest = { - AncientFeudDoors = 44956, - AncientFeudShortcut = 44957, - SilverVein = 50380, - WereHelmetEnchant = 50381, + AncientFeudDoors = 45150, + AncientFeudShortcut = 45151, + SilverVein = 45152, + WereHelmetEnchant = 45153, }, HiveOutpostMiniWorldChange = {}, JungleCampMiniWorldChange = {}, NightmareIslesMiniWorldChange = {}, PoacherCavesMiniWorldChange = {}, - TheGreatDragonHunt = {}, + TheGreatDragonHunt = { + WarriorSkeleton = 45180, + DragonCounter = 45181, + Achievement = 45182, + }, TheTaintedSouls = {}, }, U10_90 = { -- update 10.90 - Reserved Storages 45201 - 45350 diff --git a/data-otservbr-global/scripts/creaturescripts/customs/freequests.lua b/data-otservbr-global/scripts/creaturescripts/customs/freequests.lua index c1b6b379057..b07e6b37420 100644 --- a/data-otservbr-global/scripts/creaturescripts/customs/freequests.lua +++ b/data-otservbr-global/scripts/creaturescripts/customs/freequests.lua @@ -277,8 +277,8 @@ local questTable = { { storage = Storage.Quest.U11_40.ThreatenedDreams.Mission01[1], storageValue = 16 }, { storage = Storage.Quest.U11_40.ThreatenedDreams.Mission02.KroazurAccess, storageValue = 1 }, { storage = Storage.AdventurersGuild.QuestLine, storageValue = 1 }, - { storage = Storage.AdventurersGuild.GreatDragonHunt.WarriorSkeleton, storageValue = 1 }, - { storage = Storage.AdventurersGuild.GreatDragonHunt.WarriorSkeleton, storageValue = 2 }, + { storage = Storage.Quest.U10_80.TheGreatDragonHunt.WarriorSkeleton, storageValue = 1 }, + { storage = Storage.Quest.U10_80.TheGreatDragonHunt.WarriorSkeleton, storageValue = 2 }, { storage = Storage.AdventurersGuild.TheLostBrother, storageValue = 3 }, { storage = Storage.Quest.U10_55.Dawnport.Questline, storageValue = 1 }, { storage = Storage.Quest.U10_55.Dawnport.GoMain, storageValue = 1 }, diff --git a/data-otservbr-global/scripts/quests/adventurers_guild/actions_treasure.lua b/data-otservbr-global/scripts/quests/adventurers_guild/actions_treasure.lua deleted file mode 100644 index ed866a5e893..00000000000 --- a/data-otservbr-global/scripts/quests/adventurers_guild/actions_treasure.lua +++ /dev/null @@ -1,51 +0,0 @@ -local items = { - { description = "a platinum coins", items = { { id = ITEM_PLATINUM_COIN, count = 5 } } }, - { - description = "some gems", - items = { - { id = 3029, count = 1 }, - { id = 3032, count = 1 }, - { id = 3030, count = 1 }, - }, - }, - { description = "a life ring", items = { { id = 3089, count = 1 } } }, - { description = "a red gem", items = { { id = 3039, count = 1 } } }, - { description = "a mana potion", items = { { id = 237, count = 10 } } }, - { description = "a health potion", items = { { id = 236, count = 8 } } }, -} - -local adventurersTreasure = Action() -function adventurersTreasure.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if player:getStorageValue(Storage.AdventurersGuild.GreatDragonHunt.DragonCounter) >= 50 then - local treasure = items[math.random(#items)] - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "It is impossible to take along all of the treasures here. Buy you pick out " .. treasure.description) - for _, item in ipairs(treasure.items) do - player:addItem(item.id, item.count) - end - - -- reset dragon counter - player:setStorageValue(Storage.AdventurersGuild.GreatDragonHunt.DragonCounter, 0) - - -- hoard of the dragon achievement - local achievement = getAchievementInfoByName("Hoard of the Dragon") - if not achievement or player:hasAchievement(achievement.id) then - return true - end - - local times = player:getStorageValue(achievement.actionStorage) - if times < 10 then - player:setStorageValue(achievement.actionStorage, times + 1) - end - - if times + 1 == 10 then - player:addAchievement(achievement.id) - end - else - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to pick a treasure, but you hear further dragons approaching. You should kill some more before picking out something.") - end - - return true -end - -adventurersTreasure:aid(50808) -adventurersTreasure:register() diff --git a/data-otservbr-global/scripts/quests/the_great_dragon_hunt_quest/actions_treasure.lua b/data-otservbr-global/scripts/quests/the_great_dragon_hunt_quest/actions_treasure.lua new file mode 100644 index 00000000000..5aeff30a3f6 --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_great_dragon_hunt_quest/actions_treasure.lua @@ -0,0 +1,47 @@ +local items = { + { description = "a platinum coins", items = { { id = ITEM_PLATINUM_COIN, count = 5 } } }, + { + description = "some gems", + items = { + { id = 3029, count = 1 }, + { id = 3032, count = 1 }, + { id = 3030, count = 1 }, + }, + }, + { description = "a life ring", items = { { id = 3089, count = 1 } } }, + { description = "a red gem", items = { { id = 3039, count = 1 } } }, + { description = "a mana potion", items = { { id = 237, count = 10 } } }, + { description = "a health potion", items = { { id = 236, count = 8 } } }, +} + +local adventurersTreasure = Action() + +function adventurersTreasure.onUse(player, item, fromPosition, target, toPosition, isHotkey) + if player:getStorageValue(Storage.Quest.U10_80.TheGreatDragonHunt.DragonCounter) >= 50 then + local treasure = items[math.random(#items)] + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "It is impossible to take along all of the treasures here. But you pick out " .. treasure.description) + for _, item in ipairs(treasure.items) do + player:addItem(item.id, item.count) + end + + player:setStorageValue(Storage.Quest.U10_80.TheGreatDragonHunt.DragonCounter, 0) + + local times = player:getStorageValue(Storage.Quest.U10_80.TheGreatDragonHunt.Achievement) + if times < 0 then + times = 0 + end + times = times + 1 + player:setStorageValue(Storage.Quest.U10_80.TheGreatDragonHunt.Achievement, times) + + if times == 10 then + player:addAchievement("Hoard of the Dragon") + end + else + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to pick a treasure, but you hear further dragons approaching. You should kill some more before picking out something.") + end + + return true +end + +adventurersTreasure:aid(50808) +adventurersTreasure:register() diff --git a/data-otservbr-global/scripts/quests/adventurers_guild/actions_warrior_skeleton.lua b/data-otservbr-global/scripts/quests/the_great_dragon_hunt_quest/actions_warrior_skeleton.lua similarity index 67% rename from data-otservbr-global/scripts/quests/adventurers_guild/actions_warrior_skeleton.lua rename to data-otservbr-global/scripts/quests/the_great_dragon_hunt_quest/actions_warrior_skeleton.lua index 73a5d3f8acb..23feb2315c9 100644 --- a/data-otservbr-global/scripts/quests/adventurers_guild/actions_warrior_skeleton.lua +++ b/data-otservbr-global/scripts/quests/the_great_dragon_hunt_quest/actions_warrior_skeleton.lua @@ -1,15 +1,16 @@ local adventurersWarriorSkeleton = Action() + function adventurersWarriorSkeleton.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if player:getStorageValue(Storage.AdventurersGuild.GreatDragonHunt.WarriorSkeleton) < 1 then + if player:getStorageValue(Storage.Quest.U10_80.TheGreatDragonHunt.WarriorSkeleton) < 1 then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have discovered a deceased warrior's skeleton. It seems he tried to hunt the dragons around here - and failed.") - player:addItem(5882, 1) -- red dragon scale + player:addItem(5882, 1) if player:getStorageValue(Storage.AdventurersGuild.QuestLine) < 1 then player:setStorageValue(Storage.AdventurersGuild.QuestLine, 1) end - player:setStorageValue(Storage.AdventurersGuild.GreatDragonHunt.WarriorSkeleton, 1) - player:setStorageValue(Storage.AdventurersGuild.GreatDragonHunt.DragonCounter, 0) + player:setStorageValue(Storage.Quest.U10_80.TheGreatDragonHunt.WarriorSkeleton, 1) + player:setStorageValue(Storage.Quest.U10_80.TheGreatDragonHunt.DragonCounter, 0) else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The dead explorer is empty.") end diff --git a/data-otservbr-global/scripts/quests/adventurers_guild/creaturescripts_the_great_dragon_hunt.lua b/data-otservbr-global/scripts/quests/the_great_dragon_hunt_quest/creaturescripts_the_great_dragon_hunt.lua similarity index 84% rename from data-otservbr-global/scripts/quests/adventurers_guild/creaturescripts_the_great_dragon_hunt.lua rename to data-otservbr-global/scripts/quests/the_great_dragon_hunt_quest/creaturescripts_the_great_dragon_hunt.lua index 75cd6f92366..31d88658b3f 100644 --- a/data-otservbr-global/scripts/quests/adventurers_guild/creaturescripts_the_great_dragon_hunt.lua +++ b/data-otservbr-global/scripts/quests/the_great_dragon_hunt_quest/creaturescripts_the_great_dragon_hunt.lua @@ -21,7 +21,7 @@ function adventurersGuildHunt.onDeath(creature, _corpse, _lastHitKiller, mostDam return true end onDeathForParty(creature, mostDamageKiller, function(creature, player) - player:setStorageValue(Storage.AdventurersGuild.GreatDragonHunt.DragonCounter, math.max(0, player:getStorageValue(Storage.AdventurersGuild.GreatDragonHunt.DragonCounter)) + 1) + player:setStorageValue(Storage.Quest.U10_80.TheGreatDragonHunt.DragonCounter, math.max(0, player:getStorageValue(Storage.Quest.U10_80.TheGreatDragonHunt.DragonCounter)) + 1) end) return true end diff --git a/data-otservbr-global/startup/tables/corpse.lua b/data-otservbr-global/startup/tables/corpse.lua index 7ea26c59c42..0efa3f46cae 100644 --- a/data-otservbr-global/startup/tables/corpse.lua +++ b/data-otservbr-global/startup/tables/corpse.lua @@ -22,6 +22,13 @@ CorpseAction = { { x = 32031, y = 32914, z = 8 }, }, }, + -- The Great Dragon Hunt Quest + [50806] = { + itemId = 21412, + itemPos = { + { x = 32991, y = 32642, z = 8 }, + }, + }, } CorpseUnique = { diff --git a/data-otservbr-global/startup/tables/item.lua b/data-otservbr-global/startup/tables/item.lua index fc727e4845b..e4bfabf610d 100644 --- a/data-otservbr-global/startup/tables/item.lua +++ b/data-otservbr-global/startup/tables/item.lua @@ -1446,6 +1446,18 @@ ItemAction = { { x = 32788, y = 32227, z = 14 }, }, }, + -- The Great Dragon Hunt Quest + [50808] = { + itemId = false, + itemPos = { + { x = 33010, y = 32638, z = 5 }, + { x = 33039, y = 32652, z = 6 }, + { x = 33010, y = 32687, z = 7 }, + { x = 33037, y = 32662, z = 7 }, + { x = 33078, y = 32657, z = 6 }, + { x = 32994, y = 32625, z = 6 }, + }, + }, -- Roshamuul Quest [55000] = { itemId = false,