Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
248 changes: 0 additions & 248 deletions scripts/globals/hobbies/fishing/data.lua

This file was deleted.

4 changes: 4 additions & 0 deletions scripts/globals/interaction/interaction_global.lua
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,8 @@ function InteractionGlobal.onEventUpdate(player, csid, option, npc, fallbackFn)
return InteractionGlobal.lookup:onEventUpdate(player, csid, option, npc, fallbackFn)
end

function InteractionGlobal.onFishingCheck(player, areaId)
return InteractionGlobal.lookup:onFishingCheck(player, areaId)
end

return InteractionGlobal
5 changes: 5 additions & 0 deletions scripts/globals/interaction/interaction_lookup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ local function addHandlers(secondLevel, lookupSecondLevel, checkFunc, container)
'onZoneIn',
'onZoneOut',
'afterZoneIn',
'onFishingCheck',
}

for _, keyName in ipairs(wrappedDefinitions) do
Expand Down Expand Up @@ -498,3 +499,7 @@ end
function InteractionLookup:onEventUpdate(player, csid, option, npc, fallbackFn)
return onHandler(self.data, 'onEventUpdate', csid, { player, csid, option, npc }, fallbackFn)
end

function InteractionLookup:onFishingCheck(player, areaId)
return runHandlersInData(self.data, player, 'onFishingCheck', 1, { player, areaId })
end
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ quest.sections =
end,
},

onFishingCheck = function(player)
Comment thread
zach2good marked this conversation as resolved.
Resolved
return { xi.item.HYDROGAUGE }
end,

onEventFinish =
{
[283] = function(player, csid, option, npc)
Expand Down Expand Up @@ -137,6 +141,34 @@ quest.sections =
end,
},
},

[xi.zone.AL_ZAHBI] =
{
onFishingCheck = function(player)
return { xi.item.HYDROGAUGE }
end,
},

[xi.zone.AHT_URHGAN_WHITEGATE] =
{
onFishingCheck = function(player)
Comment thread
zach2good marked this conversation as resolved.
Resolved
return { xi.item.HYDROGAUGE }
end,
},

[xi.zone.SILVER_SEA_ROUTE_TO_NASHMAU] =
{
onFishingCheck = function(player)
return { xi.item.HYDROGAUGE }
end,
},

[xi.zone.SILVER_SEA_ROUTE_TO_AL_ZAHBI] =
{
onFishingCheck = function(player)
return { xi.item.HYDROGAUGE }
end,
},
},
}

Expand Down
10 changes: 10 additions & 0 deletions scripts/quests/jeuno/Hook_Line_and_Sinker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
-- Omer, Lower Jeuno: !pos -89.43 0 -124.1 245
-- EGRET_FISHING_ROD: !additem 1726
-----------------------------------
local qufimID = zones[xi.zone.QUFIM_ISLAND]
-----------------------------------

local quest = Quest:new(xi.questLog.JEUNO, xi.quest.id.jeuno.HOOK_LINE_AND_SINKER)

Expand Down Expand Up @@ -72,6 +74,14 @@ quest.sections =
end,
},
},

-- Since the 2004-12-09 update only anglers on this quest can fish up the Kraken that drops the rod
[xi.zone.QUFIM_ISLAND] =
{
onFishingCheck = function(player)
return qufimID.mob.KRAKEN_FISHED_NM
end,
},
},
}

Expand Down
19 changes: 19 additions & 0 deletions scripts/quests/outlands/Secret_of_the_Damp_Scroll.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,25 @@ quest.sections =
},
},
},

{
check = function(player, status, vars)
return status ~= xi.questStatus.QUEST_COMPLETED and
not player:hasItem(xi.item.DAMP_SCROLL)
end,

[xi.zone.SEA_SERPENT_GROTTO] =
{
onFishingCheck = function(player, areaId)
-- It only bites in fishing area 2, the pond under the bridge
if areaId ~= 2 then
return {}
end

return { xi.item.DAMP_SCROLL }
end,
},
},
}

return quest
21 changes: 21 additions & 0 deletions scripts/quests/windurst/All_At_Sea.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,27 @@ quest.reward =

quest.sections =
{
{
check = function(player, status, vars)
return status ~= xi.questStatus.QUEST_COMPLETED and
not player:hasItem(xi.item.RIPPED_CAP)
end,

[xi.zone.PORT_WINDURST] =
{
onFishingCheck = function(player)
return { xi.item.RIPPED_CAP }
end,
},

[xi.zone.KAZHAM] =
{
onFishingCheck = function(player)
return { xi.item.RIPPED_CAP }
end,
},
},

{
check = function(player, status, vars)
return status == xi.questStatus.QUEST_AVAILABLE and
Expand Down
1 change: 1 addition & 0 deletions scripts/specs/types/Container.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
---@field onEventFinish? onEventHandler
---@field onTriggerAreaEnter? onTriggerAreaHandler
---@field onTriggerAreaLeave? onTriggerAreaHandler
---@field onFishingCheck? fun(player: CBaseEntity, areaId: integer): integer[]
---@field [string]? EntitySection|TAction|fun(player: CBaseEntity, npc: CBaseEntity): TAction?

---@alias onZoneHandler fun(player: CBaseEntity): TAction?
Expand Down
68 changes: 68 additions & 0 deletions scripts/tests/quests/fishing_catches.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
-- Zone-wide quest catches ignore the fishing area
local anyArea = 1

-- Flattens onFishingCheck answers the same way luautils::OnFishingCheck does
local function offeredCatches(player, areaId)
local catches = {}
for _, answer in ipairs(InteractionGlobal.onFishingCheck(player, areaId)) do
for _, catchId in ipairs(answer) do
catches[catchId] = true
end
end

return catches
end

describe('Quest fishing catches', function()
it('offers the Ripped Cap in Port Windurst until the angler holds one', function()
local player = xi.test.world:spawnPlayer({ zone = xi.zone.PORT_WINDURST })
assert(offeredCatches(player, anyArea)[xi.item.RIPPED_CAP], 'Ripped Cap was not offered')

player:addItem(xi.item.RIPPED_CAP)
assert(not offeredCatches(player, anyArea)[xi.item.RIPPED_CAP], 'Ripped Cap was offered to an angler holding one')
end)

it('offers the Hydrogauge only while Navigating the Unfriendly Seas is accepted', function()
local player = xi.test.world:spawnPlayer({ zone = xi.zone.NASHMAU })
assert(not offeredCatches(player, anyArea)[xi.item.HYDROGAUGE], 'Hydrogauge was offered before the quest')

player:addQuest(xi.questLog.AHT_URHGAN, xi.quest.id.ahtUrhgan.NAVIGATING_THE_UNFRIENDLY_SEAS)
assert(offeredCatches(player, anyArea)[xi.item.HYDROGAUGE], 'Hydrogauge was not offered during the quest')
end)

it('offers the Damp Scroll only in the pond under the bridge until Secret of the Damp Scroll is done', function()
local pond = 2
local player = xi.test.world:spawnPlayer({ zone = xi.zone.SEA_SERPENT_GROTTO })
assert(offeredCatches(player, pond)[xi.item.DAMP_SCROLL], 'Damp Scroll was not offered in the pond')
assert(not offeredCatches(player, 1)[xi.item.DAMP_SCROLL], 'Damp Scroll was offered outside the pond')

player:addItem(xi.item.DAMP_SCROLL)
assert(not offeredCatches(player, pond)[xi.item.DAMP_SCROLL], 'Damp Scroll was offered to an angler holding one')

player:delItem(xi.item.DAMP_SCROLL, 1)
player:completeQuest(xi.questLog.OUTLANDS, xi.quest.id.outlands.SECRET_OF_THE_DAMP_SCROLL)
assert(not offeredCatches(player, pond)[xi.item.DAMP_SCROLL], 'Damp Scroll was offered after the quest')
end)

it('offers both fished Krakens only while Hook, Line, and Sinker is accepted', function()
local qufimID = zones[xi.zone.QUFIM_ISLAND]
local player = xi.test.world:spawnPlayer({ zone = xi.zone.QUFIM_ISLAND })
local krakens = qufimID.mob.KRAKEN_FISHED_NM

assert(#krakens == 2, 'expected two fished Krakens in Qufim Island')
for _, krakenId in ipairs(krakens) do
assert(krakenId ~= qufimID.mob.KRAKEN_NM, 'the roaming Kraken was listed as a fished one')
assert(not offeredCatches(player, anyArea)[krakenId], 'a Kraken was offered before the quest')
end

player:addQuest(xi.questLog.JEUNO, xi.quest.id.jeuno.HOOK_LINE_AND_SINKER)
for _, krakenId in ipairs(krakens) do
assert(offeredCatches(player, anyArea)[krakenId], 'a Kraken was not offered during the quest')
end

player:completeQuest(xi.questLog.JEUNO, xi.quest.id.jeuno.HOOK_LINE_AND_SINKER)
for _, krakenId in ipairs(krakens) do
assert(not offeredCatches(player, anyArea)[krakenId], 'a Kraken was offered after the quest')
end
end)
end)
1 change: 1 addition & 0 deletions scripts/zones/Qufim_Island/IDs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ zones[xi.zone.QUFIM_ISLAND] =
HOBGOBLIN_THIEF = GetFirstID('Hobgoblin_Thief'),
HOBGOBLIN_WARRIOR = GetFirstID('Hobgoblin_Warrior'),
HOBGOBLIN_WHITE_MAGE = GetFirstID('Hobgoblin_White_Mage'),
KRAKEN_FISHED_NM = { GetTableOfIDs('Kraken')[1], GetTableOfIDs('Kraken')[2] },
KRAKEN_NM = GetTableOfIDs('Kraken')[3],
OPHIOTAURUS = GetFirstID('Ophiotaurus'),
SLIPPERY_SUCKER = GetFirstID('Slippery_Sucker'),
Expand Down
2 changes: 1 addition & 1 deletion sql/fishing_fish.sql
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ INSERT INTO `fishing_fish` VALUES (4480,'Gugru Tuna',41,16,6,13,40,120,22,1,1,25
INSERT INTO `fishing_fish` VALUES (5127,'Gugrusaurus',140,39,6,5,155,420,33,1,1,255,255,0,0,3,1,4,1,7,0,1,350,1977,'',0,0,1,0);
INSERT INTO `fishing_fish` VALUES (5132,'Gurnard',26,13,11,9,1,1,5,0,0,255,255,0,0,6,4,3,0,0,0,1,550,0,'',0,0,0,0);
INSERT INTO `fishing_fish` VALUES (5449,'Hamsi',9,21,11,6,1,1,10,0,0,255,255,0,1,7,1,6,0,0,0,3,1000,0,'',0,0,0,0);
INSERT INTO `fishing_fish` VALUES (2341,'Hydrogauge',7,25,13,2,1,1,1,0,0,6,25,0,0,0,0,0,0,0,1,1,1000,0,'',0,0,0,0);
INSERT INTO `fishing_fish` VALUES (2341,'Hydrogauge',7,25,13,2,1,1,1,0,0,6,25,0,0,0,0,0,0,0,1,1,1000,0,'',0,1,0,0);
INSERT INTO `fishing_fish` VALUES (4470,'Icefish',49,38,11,7,1,1,14,0,0,255,255,0,0,3,1,3,0,0,0,3,900,0,'',0,0,0,0);
INSERT INTO `fishing_fish` VALUES (5453,'Istakoz',46,35,4,3,1,1,14,0,0,255,255,0,0,3,1,3,0,0,0,1,1000,0,'',0,0,0,0);
INSERT INTO `fishing_fish` VALUES (5136,'Istavrit',18,13,11,5,10,20,16,1,0,255,255,0,0,1,2,6,0,0,0,1,1000,0,'',0,0,0,0);
Expand Down
Loading
Loading