Skip to content

Commit

Permalink
Refactor zaldon trade to be faster
Browse files Browse the repository at this point in the history
  • Loading branch information
Flibe-XI committed Jan 7, 2025
1 parent 0a43e0e commit 54848f6
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions scripts/quests/otherAreas/Inside_the_Belly.lua
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ local fishRewards =
gil = 150,
items =
{
{ chance = 50, itemId = xi.item.PINCH_OF_POISON_DUST, min = 1, max = 6 }, -- guessing 10%. Wiki unknown
{ chance = 10, itemId = xi.item.PINCH_OF_POISON_DUST, min = 1, max = 6 }, -- guessing 10%. Wiki unknown
}
},

Expand Down Expand Up @@ -539,6 +539,8 @@ local function giveReward(player)
if rewardItem.min ~= nil and rewardItem.max ~= nil then
itemQt = math.random(rewardItem.min, rewardItem.max)
end

npcUtil.giveItem(player, { { itemId, itemQt } })
end

npcUtil.giveCurrency(player, 'gil', reward.gil)
Expand All @@ -551,9 +553,16 @@ local function giveReward(player)
end

local function zaldonOnTrade(player, npc, trade)
for fish, _ in pairs(fishRewards) do
if npcUtil.tradeHas(trade, fish) then
return tradeFish(player, fish)
local itemId

for itemSlot = 0, trade:getSlotCount() - 1 do
itemId = trade:getItemId(itemSlot)

if
fishRewards[itemId] ~= nil and
npcUtil.tradeHasExactly(trade, itemId)
then
return tradeFish(player, itemId)
end
end
end
Expand Down

0 comments on commit 54848f6

Please sign in to comment.