From 3bb7be16c2e1947773d177e9e0572a11e7d08cfb Mon Sep 17 00:00:00 2001 From: slashtangent <78345197+slashtangent@users.noreply.github.com> Date: Fri, 25 Apr 2025 14:35:29 -0500 Subject: [PATCH] Convert Exit the Gambler to IF --- scripts/globals/quests.lua | 2 +- scripts/quests/sandoria/Exit_the_Gambler.lua | 124 ++++++++++++++++++ scripts/zones/Northern_San_dOria/IDs.lua | 3 + .../zones/Northern_San_dOria/npcs/Aurege.lua | 45 ------- .../Northern_San_dOria/npcs/Guilberdrier.lua | 34 ----- .../Southern_San_dOria/DefaultActions.lua | 1 + scripts/zones/Southern_San_dOria/IDs.lua | 1 + .../zones/Southern_San_dOria/npcs/Varchet.lua | 14 +- sql/npc_list.sql | 2 +- 9 files changed, 134 insertions(+), 92 deletions(-) create mode 100644 scripts/quests/sandoria/Exit_the_Gambler.lua delete mode 100644 scripts/zones/Northern_San_dOria/npcs/Aurege.lua diff --git a/scripts/globals/quests.lua b/scripts/globals/quests.lua index bdb00a0b3c6..4751899786f 100644 --- a/scripts/globals/quests.lua +++ b/scripts/globals/quests.lua @@ -96,7 +96,7 @@ xi.quest.id = METHODS_CREATE_MADNESS = 98, -- + Converted SOULS_IN_SHADOW = 99, -- + Converted A_TASTE_FOR_MEAT = 100, -- + Converted - EXIT_THE_GAMBLER = 101, -- ± + EXIT_THE_GAMBLER = 101, -- + Converted OLD_WOUNDS = 102, -- + Converted ESCORT_FOR_HIRE = 103, A_DISCERNING_EYE = 104, diff --git a/scripts/quests/sandoria/Exit_the_Gambler.lua b/scripts/quests/sandoria/Exit_the_Gambler.lua new file mode 100644 index 00000000000..dbf78515476 --- /dev/null +++ b/scripts/quests/sandoria/Exit_the_Gambler.lua @@ -0,0 +1,124 @@ +----------------------------------- +-- Exit the Gambler +----------------------------------- +-- Log ID: 0, Quest ID: 101 +-- Aurege : !pos -156.253 11.999 253.691 231 +-- Guilberdrier : !pos -159.082 12.000 253.794 231 +-- Varchet : !pos 116.484 -1 91.554 230 +----------------------------------- +local northenSandoriaID = zones[xi.zone.NORTHERN_SAN_DORIA] +local southernSandoriaID = zones[xi.zone.SOUTHERN_SAN_DORIA] +----------------------------------- + +local quest = Quest:new(xi.questLog.SANDORIA, xi.quest.id.sandoria.EXIT_THE_GAMBLER) + +quest.reward = +{ + exp = 2000, + ki = xi.ki.MAP_OF_KING_RANPERRES_TOMB, + title = xi.title.DAYBREAK_GAMBLER, +} + +quest.sections = +{ + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_AVAILABLE and + vars.Stage == 0 + end, + + [xi.zone.NORTHERN_SAN_DORIA] = + { + ['Aurege'] = quest:progressEvent(521), + + ['Guilberdrier'] = quest:progressEvent(521), + + onEventFinish = + { + [521] = function(player, csid, option, npc) + quest:setVar(player, 'Stage', 1) + end, + }, + }, + }, + + { + check = function(player, status, vars) + return vars.Stage == 1 + end, + + [xi.zone.NORTHERN_SAN_DORIA] = + { + ['Aurege'] = + { + onTrigger = function(player, npc) + if quest:getVar(player, 'Prog') == 1 then + return quest:progressEvent(516) + else + return quest:messageText(northenSandoriaID.text.GAMBLING_IS_THE_RUIN) -- Reminder + end + end, + }, + + ['Guilberdrier'] = + { + onTrigger = function(player, npc) + if quest:getVar(player, 'Prog') == 1 then + return quest:progressEvent(518) + else + return quest:messageText(northenSandoriaID.text.WHO_DOES_HE_THINK) -- Reminder + end + end, + }, + + onEventFinish = + { + [516] = function(player, csid, option, npc) + quest:complete(player) + end, + + [518] = function(player, csid, option, npc) + quest:complete(player) + end, + }, + }, + + [xi.zone.SOUTHERN_SAN_DORIA] = + { + ['Varchet'] = + { + onTrigger = function(player, npc) + if + quest:getVar(player, 'Prog') == 0 and + not quest:getMustZone(player) + then + return quest:event(638):oncePerZone() + else + return quest:event(643) + end + end, + }, + }, + }, + + { + check = function(player, status, vars) + return status == xi.questStatus.QUEST_COMPLETED + end, + + [xi.zone.NORTHERN_SAN_DORIA] = + { + ['Aurege'] = quest:event(514):replaceDefault(), + + ['Guilberdrier'] = quest:messageText(northenSandoriaID.text.HE_WAS_JUST_HERE):replaceDefault(), + }, + + [xi.zone.SOUTHERN_SAN_DORIA] = + { + ['Varchet'] = quest:messageText(southernSandoriaID.text.NOBODY_ONE_WANTS_TO_PLAY):replaceDefault(), + }, + + }, +} + +return quest diff --git a/scripts/zones/Northern_San_dOria/IDs.lua b/scripts/zones/Northern_San_dOria/IDs.lua index 8030e32ecd5..73ed08b9934 100644 --- a/scripts/zones/Northern_San_dOria/IDs.lua +++ b/scripts/zones/Northern_San_dOria/IDs.lua @@ -41,6 +41,9 @@ zones[xi.zone.NORTHERN_SAN_DORIA] = OBTAIN_SCYLDS = 8038, -- You obtain [scyld/scylds]! Current balance: [scyld/scylds]. HUNT_CANCELED = 8042, -- Hunt canceled. WHAT_DO_YOU_WANT = 11170, -- What do you want? + WHO_DOES_HE_THINK = 11174, -- Who does he think he is, running off when we've piles of work to do! I'll give him a good lashing when he gets back! + GAMBLING_IS_THE_RUIN = 11175, -- Gambling is the ruin of many, I tell you... + HE_WAS_JUST_HERE = 11181, -- Eh? That gambler, Varchet? Aye, he was just here. FFR_GUILBERDRIER = 11183, -- A magic shop, you say? A bit of magic would come in handy... I know! I'll have my daughter study it for me! YOU_DONATE_GIL = 11192, -- You donate 10 gil. AILBECHE_FATHER_WHERE = 11209, -- Oh, Father! Where are you? diff --git a/scripts/zones/Northern_San_dOria/npcs/Aurege.lua b/scripts/zones/Northern_San_dOria/npcs/Aurege.lua deleted file mode 100644 index 5019a590129..00000000000 --- a/scripts/zones/Northern_San_dOria/npcs/Aurege.lua +++ /dev/null @@ -1,45 +0,0 @@ ------------------------------------ --- Area: Northern San d'Oria --- NPC: Aurege --- Type: Quest Giver NPC --- Starts Quest: Exit the Gambler --- !pos -156.253 11.999 253.691 231 ------------------------------------ ----@type TNpcEntity -local entity = {} - -entity.onTrigger = function(player, npc) - local exitTheGambler = player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.EXIT_THE_GAMBLER) - local exitTheGamblerStat = player:getCharVar('exitTheGamblerStat') - - if - exitTheGambler < xi.questStatus.QUEST_COMPLETED and - exitTheGamblerStat == 0 - then - player:startEvent(521) - elseif - exitTheGambler == xi.questStatus.QUEST_ACCEPTED and - exitTheGamblerStat == 1 - then - player:startEvent(516) - else - player:startEvent(514) - end -end - -entity.onEventFinish = function(player, csid, option, npc) - if - csid == 521 and - player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.EXIT_THE_GAMBLER) == xi.questStatus.QUEST_AVAILABLE - then - player:addQuest(xi.questLog.SANDORIA, xi.quest.id.sandoria.EXIT_THE_GAMBLER) - elseif csid == 516 then - npcUtil.completeQuest(player, xi.questLog.SANDORIA, xi.quest.id.sandoria.EXIT_THE_GAMBLER, { - keyItem = xi.ki.MAP_OF_KING_RANPERRES_TOMB, - exp = 2000, - title = xi.title.DAYBREAK_GAMBLER - }) - end -end - -return entity diff --git a/scripts/zones/Northern_San_dOria/npcs/Guilberdrier.lua b/scripts/zones/Northern_San_dOria/npcs/Guilberdrier.lua index e5a58b9f15b..ea88fde3ef2 100644 --- a/scripts/zones/Northern_San_dOria/npcs/Guilberdrier.lua +++ b/scripts/zones/Northern_San_dOria/npcs/Guilberdrier.lua @@ -13,38 +13,4 @@ entity.onTrade = function(player, npc, trade) quests.ffr.onTrade(player, npc, trade, 6) -- FLYERS FOR REGINE end -entity.onTrigger = function(player, npc) - local exitTheGambler = player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.EXIT_THE_GAMBLER) - local exitTheGamblerStat = player:getCharVar('exitTheGamblerStat') - - if - exitTheGambler < xi.questStatus.QUEST_COMPLETED and - exitTheGamblerStat == 0 - then - player:startEvent(522) - elseif - exitTheGambler == xi.questStatus.QUEST_ACCEPTED and - exitTheGamblerStat == 1 - then - player:startEvent(518) - else - player:startEvent(514) - end -end - -entity.onEventFinish = function(player, csid, option, npc) - if - csid == 522 and - player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.EXIT_THE_GAMBLER) == xi.questStatus.QUEST_AVAILABLE - then - player:addQuest(xi.questLog.SANDORIA, xi.quest.id.sandoria.EXIT_THE_GAMBLER) - elseif csid == 518 then - npcUtil.completeQuest(player, xi.questLog.SANDORIA, xi.quest.id.sandoria.EXIT_THE_GAMBLER, { - keyItem = xi.ki.MAP_OF_KING_RANPERRES_TOMB, - exp = 2000, - title = xi.title.DAYBREAK_GAMBLER - }) - end -end - return entity diff --git a/scripts/zones/Southern_San_dOria/DefaultActions.lua b/scripts/zones/Southern_San_dOria/DefaultActions.lua index 670d9172684..b526fee2f40 100644 --- a/scripts/zones/Southern_San_dOria/DefaultActions.lua +++ b/scripts/zones/Southern_San_dOria/DefaultActions.lua @@ -48,4 +48,5 @@ return { ['Sobane'] = { text = ID.text.SOBANE_DIALOG }, ['Taumila'] = { text = ID.text.TAUMILA_DIALOG }, ['Valderotaux'] = { event = 58 }, + ['Varchet'] = { event = 525 }, } diff --git a/scripts/zones/Southern_San_dOria/IDs.lua b/scripts/zones/Southern_San_dOria/IDs.lua index bcb32cb881d..905cd0192ad 100644 --- a/scripts/zones/Southern_San_dOria/IDs.lua +++ b/scripts/zones/Southern_San_dOria/IDs.lua @@ -48,6 +48,7 @@ zones[xi.zone.SOUTHERN_SAN_DORIA] = YOU_CANNOT_ENTER_DYNAMIS = 7452, -- You cannot enter Dynamis - [Dummy/San d'Oria/Bastok/Windurst/Jeuno/Beaucedine/Xarcabard/Valkurm/Buburimu/Qufim/Tavnazia] for [day/days] (Vana'diel time). PLAYERS_HAVE_NOT_REACHED_LEVEL = 7454, -- Players who have not reached level are prohibited from entering Dynamis. DYNA_NPC_DEFAULT_MESSAGE = 7464, -- There is an unusual arrangement of branches here. + NOBODY_ONE_WANTS_TO_PLAY = 7780, -- Ah, nobody wants to play games of chance these days. VARCHET_BET_LOST = 7795, -- You lose your bet of 5 gil. VARCHET_KEEP_PROMISE = 7804, -- As promised, I shall go and see about those woodchippers. Maybe we can play another game later. ROSEL_GREETINGS = 7805, -- Greetings! diff --git a/scripts/zones/Southern_San_dOria/npcs/Varchet.lua b/scripts/zones/Southern_San_dOria/npcs/Varchet.lua index 1fc8c75372d..c442ad0ef15 100644 --- a/scripts/zones/Southern_San_dOria/npcs/Varchet.lua +++ b/scripts/zones/Southern_San_dOria/npcs/Varchet.lua @@ -37,14 +37,6 @@ entity.onTrade = function(player, npc, trade) end end -entity.onTrigger = function(player, npc) - if player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.EXIT_THE_GAMBLER) == xi.questStatus.QUEST_ACCEPTED then - player:startEvent(638) - else - player:startEvent(525) - end -end - entity.onEventFinish = function(player, csid, option, npc) if csid == 519 then local result = player:getLocalVar('VarchetGame') @@ -54,10 +46,10 @@ entity.onEventFinish = function(player, csid, option, npc) local eventTarget = player:getEventTarget() if eventTarget and - player:getQuestStatus(xi.questLog.SANDORIA, xi.quest.id.sandoria.EXIT_THE_GAMBLER) == xi.questStatus.QUEST_ACCEPTED + xi.quest.getVar(player, xi.questLog.SANDORIA, xi.quest.id.sandoria.EXIT_THE_GAMBLER, 'Stage') == 1 then - player:setCharVar('exitTheGamblerStat', 1) - player:showText(eventTarget, ID.text.VARCHET_KEEP_PROMISE) + xi.quest.setVar(player, xi.questLog.SANDORIA, xi.quest.id.sandoria.EXIT_THE_GAMBLER, 'Prog', 1) + player:showText(eventTarget, ID.text.VARCHET_KEEP_PROMISE) -- Repeats everytime the player wins until the quest is complete end elseif result == gameTie then npcUtil.giveCurrency(player, 'gil', 5) diff --git a/sql/npc_list.sql b/sql/npc_list.sql index ce82ea90cf9..98638843429 100644 --- a/sql/npc_list.sql +++ b/sql/npc_list.sql @@ -26007,7 +26007,7 @@ INSERT INTO `npc_list` VALUES (17719388,'Carautia','Carautia',29,68.426,0.000,39 INSERT INTO `npc_list` VALUES (17719389,'Victoire','Victoire',15,68.426,0.001,38.173,7,50,50,0,1,0,0,27,0x0100020406101620173009400850006000700000,32,NULL,1); INSERT INTO `npc_list` VALUES (17719390,'Michilca','Michilca',126,75.602,1.999,40.765,0,40,40,0,1,0,6,27,0x010003041A101A201A301A401A50006000700000,32,NULL,1); INSERT INTO `npc_list` VALUES (17719391,'Hinaree','Hinaree',236,-301.535,-9.199,97.698,14,40,40,0,0,0,0,27,0x00002B0300000000000000000000000000000000,32,NULL,1); -INSERT INTO `npc_list` VALUES (17719392,'Varchet','Varchet',110,116.484,0.000,91.554,6,40,40,0,1,0,0,27,0x0100080304100020003008400050006000700000,32,NULL,1); +INSERT INTO `npc_list` VALUES (17719392,'Varchet','Varchet',29,116.484,0.000,91.554,6,40,40,0,1,0,0,27,0x0100080304100020003008400050006000700000,32,NULL,1); INSERT INTO `npc_list` VALUES (17719393,'Endracion','Endracion',224,-112.817,0.999,-37.190,1,40,40,0,1,0,0,27,0x010002030C100C200C300C400C50006000700000,32,NULL,1); INSERT INTO `npc_list` VALUES (17719394,'Ambrotien','Ambrotien',158,93.419,0.999,-57.347,6,40,40,0,1,0,0,27,0x010007030C100C200C300C400C50006000700000,32,NULL,1); INSERT INTO `npc_list` VALUES (17719395,'Malecharisant','Malecharisant',232,-109.124,0.000,-49.180,7,40,40,0,1,0,0,27,0x01000C031A101C201A301C401A50006000700000,32,NULL,1);