Skip to content

Commit

Permalink
Merge pull request #4575 from LandSandBoat/cancelled-event
Browse files Browse the repository at this point in the history
Replace event cancelled magic number with utils.EVENT_CANCELLED_OPTION
  • Loading branch information
claywar authored Oct 2, 2023
2 parents 81842ad + 3fdc724 commit 38ae46f
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 12 deletions.
2 changes: 1 addition & 1 deletion scripts/globals/abyssea/conflux.lua
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ xi.conflux.confluxEventFinish = function(player, csid, option, npc)
if
option ~= 0 and
option ~= 9 and -- Conflux 0 option, always free
option ~= 1073741824 and
option ~= utils.EVENT_CANCELLED_OPTION and
utils.mask.getBit(activatedMask, confluxInfo[1])
then
player:delCurrency('cruor', confluxInfo[3][option])
Expand Down
5 changes: 4 additions & 1 deletion scripts/globals/crafting.lua
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,10 @@ xi.crafting.guildPointOnEventFinish = function(player, option, target, guildId)
end

-- HQ crystal Option.
elseif category == 0 and option ~= 1073741824 then
elseif
category == 0 and
option ~= utils.EVENT_CANCELLED_OPTION
then
local crystal = hqCrystals[bit.band(bit.rshift(option, 5), 15)]
local quantity = bit.rshift(option, 9)
local cost = quantity * crystal.cost
Expand Down
2 changes: 1 addition & 1 deletion scripts/globals/teleports/eschan_portals.lua
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ xi.escha.portals.eschanPortalEventFinish = function(player, csid, option, npc)
elseif
option ~= 0 and
option ~= 4 and -- Scintillating Rhapsody usage.
option ~= 1073741824
option ~= utils.EVENT_CANCELLED_OPTION
then
player:delCurrency('escha_silt', portalCost)
end
Expand Down
2 changes: 1 addition & 1 deletion scripts/missions/wotg/54_Lest_We_Forget.lua
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ mission.sections =
onEventFinish =
{
[39] = function(player, csid, option, npc)
if option ~= 1073741824 then
if option ~= utils.EVENT_CANCELLED_OPTION then
local ID = zones[player:getZoneID()]
local firstAugSel = bit.band(bit.rshift(option, 1), 0xF)
local secondAugSel = bit.band(bit.rshift(option, 17), 0xF)
Expand Down
2 changes: 1 addition & 1 deletion scripts/zones/Alzadaal_Undersea_Ruins/npcs/_20m.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ entity.onEventFinish = function(player, csid, option, npc)
-- here as a special case
if
csid == 405 and
option == 1073741824 and
option == utils.EVENT_CANCELLED_OPTION and
player:getLocalVar('NYZUL_INSTANCE') == 1
then
player:startEvent(116, 2) -- This means the event was force terminated. Loop into the entrance animation.
Expand Down
6 changes: 5 additions & 1 deletion scripts/zones/Nashmau/npcs/Kilusha.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ end
entity.onEventFinish = function(player, csid, option, npc)
if csid == 23 then
player:setCharVar('EinherjarIntro', 0) -- deletes CharVar set at character creation
elseif csid == 24 and option ~= 1073741824 and option ~= 0 then
elseif
csid == 24 and
option ~= utils.EVENT_CANCELLED_OPTION and
option ~= 0
then
local kilushaItems =
{
[1] = { item = xi.item.ANIMATOR_P1, cost = 15000 },
Expand Down
5 changes: 4 additions & 1 deletion scripts/zones/Norg/npcs/Fouvia.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ entity.onEventUpdate = function(player, csid, option, npc)
end

entity.onEventFinish = function(player, csid, option, npc)
if csid == 130 and option ~= 1073741824 then -- Player didn't cancel out
if
csid == 130 and
option ~= utils.EVENT_CANCELLED_OPTION
then
player:delGil(9800)
player:setCharVar('ChangedWyvernName', 1)
player:setPetName(xi.petType.WYVERN, option + 1)
Expand Down
4 changes: 2 additions & 2 deletions scripts/zones/Nyzul_Isle/npcs/Rune_of_Transfer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ entity.onEventUpdate = function(player, csid, option, npc)

if
csid == 201 and
option ~= 1073741824 and
option ~= utils.EVENT_CANCELLED_OPTION and
instance:getLocalVar('runeHandler') == 0
then
local chars = instance:getChars()
Expand All @@ -57,7 +57,7 @@ entity.onEventFinish = function(player, csid, option, npc)
end
elseif
csid == 201 and
option ~= 1073741824 and
option ~= utils.EVENT_CANCELLED_OPTION and
instance:getLocalVar('runeHandler') == player:getID()
then
-- Leave Assault
Expand Down
7 changes: 5 additions & 2 deletions scripts/zones/Port_Jeuno/npcs/Shami.lua
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,11 @@ entity.onEventFinish = function(player, csid, option, npc)
if csid == 22 then
player:confirmTrade()

-- Retrieving Seals (Option 1073741824 is escaping out of cutscene, and we do not process on this)
elseif option >= 508 and option ~= 1073741824 then
-- Retrieving Seals
elseif
option >= 508 and
option ~= utils.EVENT_CANCELLED_OPTION
then
local itemID, sealID, retrievedSealCount = convertSealRetrieveOption(option)

if npcUtil.giveItem(player, { { itemID, retrievedSealCount } }) then
Expand Down
2 changes: 1 addition & 1 deletion scripts/zones/RuLude_Gardens/npcs/Splintery_Chest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ entity.onEventFinish = function(player, csid, option, npc)

local itemId = optionTable[option] and optionTable[option] or nil

if option ~= 1073741824 then
if option ~= utils.EVENT_CANCELLED_OPTION then
if not itemId then
-- How did you get here??
player:PrintToPlayer('itemId or OptionID related script error!')
Expand Down

0 comments on commit 38ae46f

Please sign in to comment.