From 03d5c10bcf8ef54acd42d05feaf7b63478ab1cbf Mon Sep 17 00:00:00 2001 From: Skold177 <113406182+Skold177@users.noreply.github.com> Date: Wed, 20 May 2026 11:44:17 -0400 Subject: [PATCH] PromyvionXPFix Removes duplicate XP gains from Promyvions while preserving helper XP --- .../Spire_of_Dem/ancient_flames_beckon.lua | 27 ++++++++++--------- .../Spire_of_Holla/ancient_flames_beckon.lua | 25 ++++++++--------- .../Spire_of_Mea/ancient_flames_beckon.lua | 25 ++++++++--------- scripts/globals/battlefield.lua | 10 +++++++ scripts/missions/cop/helpers.lua | 1 - 5 files changed, 50 insertions(+), 38 deletions(-) diff --git a/scripts/battlefields/Spire_of_Dem/ancient_flames_beckon.lua b/scripts/battlefields/Spire_of_Dem/ancient_flames_beckon.lua index c5fd5811cb7..da674ea3c49 100644 --- a/scripts/battlefields/Spire_of_Dem/ancient_flames_beckon.lua +++ b/scripts/battlefields/Spire_of_Dem/ancient_flames_beckon.lua @@ -7,19 +7,20 @@ local spireOfDemID = zones[xi.zone.SPIRE_OF_DEM] ----------------------------------- local content = Battlefield:new({ - zoneId = xi.zone.SPIRE_OF_DEM, - battlefieldId = xi.battlefield.id.ANCIENT_FLAMES_BECKON_SPIRE_OF_DEM, - canLoseExp = false, - isMission = true, - allowTrusts = true, - maxPlayers = 6, - levelCap = 30, - timeLimit = utils.minutes(30), - index = 0, - entryNpc = '_0j0', - exitNpcs = { '_0j1', '_0j2', '_0j3' }, - - grantXP = 1500, + zoneId = xi.zone.SPIRE_OF_DEM, + battlefieldId = xi.battlefield.id.ANCIENT_FLAMES_BECKON_SPIRE_OF_DEM, + canLoseExp = false, + isMission = true, + allowTrusts = true, + maxPlayers = 6, + levelCap = 30, + timeLimit = utils.minutes(30), + index = 0, + entryNpc = '_0j0', + exitNpcs = { '_0j1', '_0j2', '_0j3' }, + + grantXP = 1500, + grantXPLockout = true, }) function content:entryRequirement(player, npc, isRegistrant, trade) diff --git a/scripts/battlefields/Spire_of_Holla/ancient_flames_beckon.lua b/scripts/battlefields/Spire_of_Holla/ancient_flames_beckon.lua index 08a97b343ba..55f07451496 100644 --- a/scripts/battlefields/Spire_of_Holla/ancient_flames_beckon.lua +++ b/scripts/battlefields/Spire_of_Holla/ancient_flames_beckon.lua @@ -7,19 +7,20 @@ local spireOfHollaID = zones[xi.zone.SPIRE_OF_HOLLA] ----------------------------------- local content = Battlefield:new({ - zoneId = xi.zone.SPIRE_OF_HOLLA, - battlefieldId = xi.battlefield.id.ANCIENT_FLAMES_BECKON_SPIRE_OF_HOLLA, - canLoseExp = false, - isMission = true, - allowTrusts = true, - maxPlayers = 6, - levelCap = 30, - timeLimit = utils.minutes(30), - index = 0, - entryNpc = '_0h0', - exitNpcs = { '_0h1', '_0h2', '_0h3' }, + zoneId = xi.zone.SPIRE_OF_HOLLA, + battlefieldId = xi.battlefield.id.ANCIENT_FLAMES_BECKON_SPIRE_OF_HOLLA, + canLoseExp = false, + isMission = true, + allowTrusts = true, + maxPlayers = 6, + levelCap = 30, + timeLimit = utils.minutes(30), + index = 0, + entryNpc = '_0h0', + exitNpcs = { '_0h1', '_0h2', '_0h3' }, - grantXP = 1500, + grantXP = 1500, + grantXPLockout = true, }) function content:entryRequirement(player, npc, isRegistrant, trade) diff --git a/scripts/battlefields/Spire_of_Mea/ancient_flames_beckon.lua b/scripts/battlefields/Spire_of_Mea/ancient_flames_beckon.lua index 1ee1fddcc6a..6a49bc1f849 100644 --- a/scripts/battlefields/Spire_of_Mea/ancient_flames_beckon.lua +++ b/scripts/battlefields/Spire_of_Mea/ancient_flames_beckon.lua @@ -7,19 +7,20 @@ local spireOfMeaID = zones[xi.zone.SPIRE_OF_MEA] ----------------------------------- local content = Battlefield:new({ - zoneId = xi.zone.SPIRE_OF_MEA, - battlefieldId = xi.battlefield.id.ANCIENT_FLAMES_BECKON_SPIRE_OF_MEA, - canLoseExp = false, - isMission = true, - allowTrusts = true, - maxPlayers = 6, - levelCap = 30, - timeLimit = utils.minutes(30), - index = 0, - entryNpc = '_0l0', - exitNpcs = { '_0l1', '_0l2', '_0l3' }, + zoneId = xi.zone.SPIRE_OF_MEA, + battlefieldId = xi.battlefield.id.ANCIENT_FLAMES_BECKON_SPIRE_OF_MEA, + canLoseExp = false, + isMission = true, + allowTrusts = true, + maxPlayers = 6, + levelCap = 30, + timeLimit = utils.minutes(30), + index = 0, + entryNpc = '_0l0', + exitNpcs = { '_0l1', '_0l2', '_0l3' }, - grantXP = 1500, + grantXP = 1500, + grantXPLockout = true, }) function content:entryRequirement(player, npc, isRegistrant, trade) diff --git a/scripts/globals/battlefield.lua b/scripts/globals/battlefield.lua index a9ffb4481b5..6a63da0dbf1 100644 --- a/scripts/globals/battlefield.lua +++ b/scripts/globals/battlefield.lua @@ -408,6 +408,7 @@ end -- - requiredKeyItems: Key items required to be able to enter the battlefield - these are removed upon entry unless 'keep = true' (optional) -- - title: Title given to players upon victory (optional) -- - grantXP: Amount of XP to grant upon victory (optional) +-- - grantXPLockout: If true, players can only receive the grantXP once per day, resetting at JST midnight. (optional) -- - lossEventParams: Parameters given to the loss event (32002). Defaults to none. (optional) ---@diagnostic disable-next-line: duplicate-set-field function Battlefield:new(data) @@ -436,6 +437,7 @@ function Battlefield:new(data) obj.title = data.title obj.grantXP = data.grantXP + obj.grantXPLockout = data.grantXPLockout obj.levelCap = data.levelCap or 0 obj.allowSubjob = (data.allowSubjob == nil or data.allowSubjob) or false obj.allowTrusts = data.allowTrusts and data.allowTrusts or false @@ -928,6 +930,14 @@ function Battlefield:onEventFinishWin(player, csid, option, npc) end if self.grantXP then + if self.grantXPLockout then + if self:getVar(player, 'XP') > GetSystemTime() then + return + end + + self:setVar(player, 'XP', JstMidnight()) + end + player:addExp(self.grantXP) end end diff --git a/scripts/missions/cop/helpers.lua b/scripts/missions/cop/helpers.lua index 4852b9558b0..ba97eab17c0 100644 --- a/scripts/missions/cop/helpers.lua +++ b/scripts/missions/cop/helpers.lua @@ -158,7 +158,6 @@ xi.cop.helpers.spireEventFinish = function(mission, player, csid, option, npc) player:addKeyItem(xi.ki.LIGHT_OF_HOLLA + promyvionId) player:messageSpecial(zones[player:getZoneID()].text.CANT_REMEMBER, xi.ki.LIGHT_OF_HOLLA + promyvionId) - player:addExp(1500) mission:setVar(player, 'Option', 0) local numCompletedPromyvions = xi.cop.helpers.numPromyvionCompleted(player)