diff --git a/scripts/globals/quests.lua b/scripts/globals/quests.lua index ed990ed9376..c74ebe078d1 100644 --- a/scripts/globals/quests.lua +++ b/scripts/globals/quests.lua @@ -333,7 +333,7 @@ xi.quest.id = COLLECT_TARUT_CARDS = 10, -- + THE_OLD_MONUMENT = 11, -- + Converted A_MINSTREL_IN_DESPAIR = 12, -- + Converted - RUBBISH_DAY = 13, -- + + RUBBISH_DAY = 13, -- + Converted NEVER_TO_RETURN = 14, -- + COMMUNITY_SERVICE = 15, -- + Converted COOKS_PRIDE = 16, -- + diff --git a/scripts/quests/jeuno/Rubbish_Day.lua b/scripts/quests/jeuno/Rubbish_Day.lua new file mode 100644 index 00000000000..d03dc38e803 --- /dev/null +++ b/scripts/quests/jeuno/Rubbish_Day.lua @@ -0,0 +1,173 @@ +----------------------------------- +-- Rubbish Day +----------------------------------- +-- Log ID: 3, Quest ID: 13 +-- Chululu : !pos -13 -6 -42 245 +-- Mashira : !pos 141 -6 138 200 +----------------------------------- + +local quest = Quest:new(xi.questLog.JEUNO, xi.quest.id.jeuno.RUBBISH_DAY) + +quest.reward = +{ + fame = 30, + fameArea = xi.fameArea.JEUNO, + gil = 6000, + item = xi.item.CHAIN_CHOKER, +} + +local compatibilityReply = +{ + NONE = 0, + CHULULU = 1, -- 'What? With me!? Spare me.' + KUROU_MOROU = 2, -- 'What? With that creep? Over my dead body!' + EMPTY = 3, -- 'Please fill in your partner's name.' +} + +local fortunes = +{ + { 4, 3, 5, 8, 2, 2, 0, 0 }, + { 4, 3, 5, 8, 1, 2, 0, 0 }, + { 2, 1, 0, 0, 0, 1, 0, 0 }, + { 3, 1, 0, 0, 0, 1, 0, 0 }, + { 8, 3, 1, 1, 1, 2, 1, 0 }, + { 8, 3, 5, 8, 2, 1, 1, 0 }, +} + +quest.sections = +{ + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_AVAILABLE and + player:getQuestStatus(xi.questLog.JEUNO, xi.quest.id.jeuno.COLLECT_TARUT_CARDS) == xi.questStatus.QUEST_COMPLETED + end, + + [xi.zone.LOWER_JEUNO] = + { + ['Chululu'] = + { + onTrigger = function(player, npc) + if quest:getVar(player, 'Day') == VanadielUniqueDay() then + return quest:event(57) -- Only one reading per Vana'diel day + elseif quest:getVar(player, 'Prog') < 3 then + return quest:progressEvent(199) -- Compatibility test + else + return quest:progressEvent(198) -- Offers the quest + end + end, + }, + + onEventUpdate = + { + [199] = function(player, csid, option, npc) + if type(option) == 'string' then + if option == '' then + player:updateEvent(player:getID(), 0, compatibilityReply.EMPTY) + elseif option == 'Chululu' then + player:updateEvent(player:getID(), npc:getID(), compatibilityReply.CHULULU) + elseif option == 'Kurou-Morou' then + -- The special code short-circuits the event, so + -- the matched id is not needed here. + player:updateEvent(player:getID(), 0, compatibilityReply.KUROU_MOROU) + elseif option == player:getName() then + player:updateEvent(player:getID(), player:getID(), compatibilityReply.NONE) + else + local partner = GetPlayerByName(option) + + if + partner and + partner:getZoneID() == player:getZoneID() and + npc:checkDistance(partner) < 20 + then + player:setLocalVar('RubbishDayPartner', partner:getID()) + player:updateEvent(player:getID(), partner:getID(), compatibilityReply.NONE) + else + player:updateEvent(player:getID(), 0, compatibilityReply.NONE) + end + end + + elseif option ~= 0 and option == player:getLocalVar('RubbishDayPartner') then + player:setLocalVar('RubbishDayPartner', 0) + player:setLocalVar('RubbishDayFortune', 1) + player:updateEvent(unpack(fortunes[(player:getID() + option) % #fortunes + 1])) + end + end, + }, + + onEventFinish = + { + [199] = function(player, csid, option, npc) + if + option == 1 and + player:getLocalVar('RubbishDayFortune') == 1 + then + player:setLocalVar('RubbishDayFortune', 0) + + if quest:getVar(player, 'Day') ~= VanadielUniqueDay() then + quest:setVar(player, 'Prog', quest:getVar(player, 'Prog') + 1) + quest:setVar(player, 'Day', VanadielUniqueDay()) + end + end + end, + + [198] = function(player, csid, option, npc) + if option == 0 and quest:begin(player) then + npcUtil.giveKeyItem(player, xi.ki.MAGIC_TRASH) + quest:setVar(player, 'Prog', 0) + end + end, + }, + }, + }, + + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_ACCEPTED + end, + + [xi.zone.LOWER_JEUNO] = + { + ['Chululu'] = + { + onTrigger = function(player, npc) + if quest:getVar(player, 'Prog') == 1 then + return quest:progressEvent(197) -- Finishes the quest + else + return quest:event(49) -- Reminder + end + end, + }, + + onEventFinish = + { + [197] = function(player, csid, option, npc) + quest:complete(player) + end, + }, + }, + + [xi.zone.GARLAIGE_CITADEL] = + { + ['Mashira'] = + { + onTrigger = function(player, npc) + if quest:getVar(player, 'Prog') == 0 then + return quest:progressEvent(11, 1) + end + end, + }, + + onEventFinish = + { + [11] = function(player, csid, option, npc) + if option == 1 then + player:delKeyItem(xi.ki.MAGIC_TRASH) + quest:setVar(player, 'Prog', 1) + end + end, + }, + }, + }, +} + +return quest diff --git a/scripts/zones/Garlaige_Citadel/npcs/Mashira.lua b/scripts/zones/Garlaige_Citadel/npcs/Mashira.lua index cde18640ff0..96b4a9f736d 100644 --- a/scripts/zones/Garlaige_Citadel/npcs/Mashira.lua +++ b/scripts/zones/Garlaige_Citadel/npcs/Mashira.lua @@ -8,12 +8,7 @@ local entity = {} entity.onTrigger = function(player, npc) - if - player:getQuestStatus(xi.questLog.JEUNO, xi.quest.id.jeuno.RUBBISH_DAY) == xi.questStatus.QUEST_ACCEPTED and - player:getCharVar('RubbishDayVar') == 0 - then - player:startEvent(11, 1) -- For the quest "Rubbish day" - elseif player:getQuestStatus(xi.questLog.WINDURST, xi.quest.id.windurst.MAKING_AMENS) == xi.questStatus.QUEST_ACCEPTED then + if player:getQuestStatus(xi.questLog.WINDURST, xi.quest.id.windurst.MAKING_AMENS) == xi.questStatus.QUEST_ACCEPTED then if player:hasKeyItem(xi.ki.BROKEN_WAND) then player:startEvent(11, 3) else player:startEvent(11, 0) -- Making Amens dialogue @@ -24,19 +19,10 @@ entity.onTrigger = function(player, npc) end entity.onEventFinish = function(player, csid, option, npc) - local rubbishDay = player:getQuestStatus(xi.questLog.JEUNO, xi.quest.id.jeuno.RUBBISH_DAY) - local makingAmens = player:getQuestStatus(xi.questLog.WINDURST, xi.quest.id.windurst.MAKING_AMENS) if - csid == 11 and - option == 1 and - rubbishDay == xi.questStatus.QUEST_ACCEPTED - then - player:delKeyItem(xi.ki.MAGIC_TRASH) - player:setCharVar('RubbishDayVar', 1) - elseif csid == 11 and option == 0 and - makingAmens == xi.questStatus.QUEST_ACCEPTED + player:getQuestStatus(xi.questLog.WINDURST, xi.quest.id.windurst.MAKING_AMENS) == xi.questStatus.QUEST_ACCEPTED then npcUtil.giveKeyItem(player, xi.ki.BROKEN_WAND) player:tradeComplete() diff --git a/scripts/zones/Lower_Jeuno/npcs/Chululu.lua b/scripts/zones/Lower_Jeuno/npcs/Chululu.lua index db33d0f5087..7a264c93c8f 100644 --- a/scripts/zones/Lower_Jeuno/npcs/Chululu.lua +++ b/scripts/zones/Lower_Jeuno/npcs/Chululu.lua @@ -1,7 +1,7 @@ ----------------------------------- -- Area: Lower Jeuno -- NPC: Chululu --- Starts and Finishes Quests: Collect Tarut Cards, Rubbish Day, All in the Cards +-- Starts and Finishes Quests: Collect Tarut Cards, All in the Cards -- Optional Cutscene at end of Quest: Searching for the Right Words -- !pos -13 -6 -42 245 ----------------------------------- @@ -37,36 +37,6 @@ entity.onTrigger = function(player, npc) elseif collectTarutCards == xi.questStatus.QUEST_ACCEPTED then player:startEvent(27) -- During quest 'Collect Tarut Cards' - elseif - collectTarutCards == xi.questStatus.QUEST_COMPLETED and - rubbishDay == xi.questStatus.QUEST_AVAILABLE and - player:getCharVar('RubbishDay_day') ~= VanadielUniqueDay() - then - -- prog = player:getCharVar('RubbishDay_prog') - -- if prog <= 2 then - -- player:startEvent(199) -- Required to get compatibility 3x on 3 diff game days before quest is kicked off - -- elseif prog == 3 then - player:startEvent(198) -- Start quest "Rubbish Day" with option - -- end - - elseif - collectTarutCards == xi.questStatus.QUEST_COMPLETED and - rubbishDay == xi.questStatus.QUEST_AVAILABLE - then - player:startEvent(57) -- Standard dialog between 2 quests - - elseif - rubbishDay == xi.questStatus.QUEST_ACCEPTED and - player:getCharVar('RubbishDayVar') == 0 - then - player:startEvent(49) -- During quest 'Rubbish Day' - - elseif - rubbishDay == xi.questStatus.QUEST_ACCEPTED and - player:getCharVar('RubbishDayVar') == 1 - then - player:startEvent(197) -- Finish quest 'Rubbish Day' - elseif player:getFameLevel(xi.fameArea.JEUNO) >= 4 and collectTarutCards == xi.questStatus.QUEST_COMPLETED and @@ -128,16 +98,6 @@ entity.onEventFinish = function(player, csid, option, npc) player:tradeComplete() player:completeQuest(xi.questLog.JEUNO, xi.quest.id.jeuno.COLLECT_TARUT_CARDS) - elseif csid == 199 and option == 0 then - player:incrementCharVar('RubbishDay_prog', 1) - player:setCharVar('RubbishDay_day', VanadielUniqueDay()) -- new vanadiel day - - elseif csid == 198 and option == 0 then - player:addQuest(xi.questLog.JEUNO, xi.quest.id.jeuno.RUBBISH_DAY) - npcUtil.giveKeyItem(player, xi.ki.MAGIC_TRASH) - player:setCharVar('RubbishDay_prog', 0) - player:setCharVar('RubbishDay_day', VanadielUniqueDay()) - elseif (csid == 10110 or csid == 10112 or csid == 10113) and option == 0 @@ -172,13 +132,6 @@ entity.onEventFinish = function(player, csid, option, npc) then player:confirmTrade() end - - elseif csid == 197 then - npcUtil.completeQuest(player, xi.questLog.JEUNO, xi.quest.id.jeuno.RUBBISH_DAY, { - gil = 6000, - item = xi.item.CHAIN_CHOKER, - var = { 'RubbishDayVar' } - }) end end