-
Notifications
You must be signed in to change notification settings - Fork 612
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Fisherman's Heart Quest and supporting tools
- Loading branch information
1 parent
7a46bb1
commit 432a726
Showing
17 changed files
with
755 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
----------------------------------- | ||
-- func: getFishHistory | ||
-- desc: Prints the history stats of a given player | ||
----------------------------------- | ||
---@type TCommand | ||
local commandObj = {} | ||
|
||
commandObj.cmdprops = | ||
{ | ||
permission = 1, | ||
parameters = 's' | ||
} | ||
|
||
commandObj.onTrigger = function(player, target) | ||
-- validate target | ||
local targ | ||
if target ~= nil then | ||
targ = GetPlayerByName(target) | ||
else | ||
targ = player:getCursorTarget() | ||
end | ||
|
||
if targ == nil then | ||
if target ~= nil then | ||
player:printToPlayer(string.format('Player named %s not found!', target)) | ||
return | ||
else | ||
player:printToPlayer('Find a target, either by name or cursor!') | ||
return | ||
end | ||
elseif not targ:isPC() then | ||
player:printToPlayer('Target is not a player!') | ||
return | ||
end | ||
|
||
if targ == nil then | ||
return | ||
end | ||
|
||
if targ:getFishingStats() == nil then | ||
player:printToPlayer('Unable to retrieve stats from target!') | ||
return | ||
end | ||
|
||
local fishStats = targ:getFishingStats() or {} | ||
player:printToPlayer(string.format('Showing Fishing Stats for: %s', targ:getName() or 'Unknown'), xi.msg.channel.SYSTEM_3) | ||
player:printToPlayer(string.format('Lines Cast: %s', fishStats['fishLinesCast'] or 0), xi.msg.channel.SYSTEM_3) | ||
player:printToPlayer(string.format('Fish Caught: %s', fishStats['fishReeled'] or 0), xi.msg.channel.SYSTEM_3) | ||
player:printToPlayer(string.format('Biggest Fish: %s ilms (%s)', fishStats['fishLongestLength'] or 0, fishStats['fishLongestId'] or 0), xi.msg.channel.SYSTEM_3) | ||
player:printToPlayer(string.format('Heaviest Fish: %s ponzes (%s)', fishStats['fishHeaviestWeight'] or 0, fishStats['fishHeaviestId'] or 0), xi.msg.channel.SYSTEM_3) | ||
end | ||
|
||
return commandObj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
----------------------------------- | ||
-- Fisherman's Heart | ||
-- Katsunaga !pos -4.726 -1.148 2.183 | ||
-- Log ID: 4, Quest ID: 11 | ||
----------------------------------- | ||
local quest = Quest:new(xi.questLog.OTHER_AREAS, xi.quest.id.otherAreas.FISHERMAN_S_HEART) | ||
|
||
quest.reward = | ||
{ | ||
fame_area = xi.fameArea.WINDURST, | ||
fame = 30, | ||
} | ||
|
||
quest.sections = | ||
{ | ||
-- Quest available, but fishing rank is 1 and skill < 20 | ||
-- (NOTE: Fishing Rank 0 is handled as default action) | ||
{ | ||
check = function(player, status, vars) | ||
return | ||
status == xi.questStatus.QUEST_AVAILABLE and | ||
player:getSkillRank(xi.skill.FISHING) >= 1 and -- Must have leveled up to first fishing rank | ||
player:getCharSkillLevel(xi.skill.FISHING) < 200 -- Skill is below 20.0 | ||
end, | ||
|
||
[xi.zone.MHAURA] = | ||
{ | ||
['Katsunaga'] = quest:event(191), | ||
}, | ||
}, | ||
|
||
-- Quest available, skill >= 20, Windurst Fame >= 2 | ||
{ | ||
check = function(player, status, vars) | ||
return | ||
status == xi.questStatus.QUEST_AVAILABLE and | ||
player:getFameLevel(xi.fameArea.WINDURST) >= 2 and | ||
player:getCharSkillLevel(xi.skill.FISHING) >= 200 | ||
end, | ||
|
||
[xi.zone.MHAURA] = | ||
{ | ||
['Katsunaga'] = | ||
{ | ||
onTrigger = function(player, npc) | ||
return quest:progressEvent(192, xi.item.GUGRU_TUNA) | ||
end, | ||
}, | ||
|
||
onEventFinish = | ||
{ | ||
[192] = function(player, csid, option, npc) | ||
quest:begin(player) | ||
end, | ||
}, | ||
}, | ||
}, | ||
|
||
-- Quest Accepted | ||
{ | ||
check = function(player, status, vars) | ||
return status == xi.questStatus.QUEST_ACCEPTED | ||
end, | ||
|
||
[xi.zone.MHAURA] = | ||
{ | ||
['Katsunaga'] = | ||
{ | ||
onTrigger = function(player, npc) | ||
return quest:progressEvent(194, xi.item.GUGRU_TUNA) | ||
end, | ||
|
||
onTrade = function(player, npc, trade) | ||
if npcUtil.tradeHasExactly(trade, xi.item.GUGRU_TUNA) then | ||
local fishingStats = player:getFishingStats() or {} | ||
return quest:progressEvent(193, { | ||
[1] = fishingStats['fishLinesCast'] or 0, | ||
[2] = fishingStats['fishReeled'] or 0, | ||
[3] = fishingStats['fishLongestLength'] or 0, | ||
[4] = fishingStats['fishLongestId'] or 0, | ||
[5] = fishingStats['fishHeaviestWeight'] or 0, | ||
[6] = fishingStats['fishHeaviestId'] or 0, | ||
}) | ||
end | ||
end, | ||
}, | ||
|
||
onEventFinish = | ||
{ | ||
[193] = function(player, csid, option, npc) | ||
player:confirmTrade() | ||
quest:complete(player) | ||
end, | ||
}, | ||
}, | ||
}, | ||
|
||
-- Quest Complete | ||
{ | ||
check = function(player, status, vars) | ||
return status == xi.questStatus.QUEST_COMPLETED | ||
end, | ||
|
||
[xi.zone.MHAURA] = | ||
{ | ||
['Katsunaga'] = | ||
{ | ||
onTrigger = function(player, npc) | ||
return quest:progressEvent(197, player:getFishingCatchCount() or 0) -- Number of fish types caught | ||
end, | ||
}, | ||
|
||
onEventUpdate = | ||
{ | ||
[197] = function(player, csid, option, npc) | ||
if option == 33554432 then | ||
-- 'Catching Fish' | ||
local fishingStats = player:getFishingStats() or {} | ||
player:updateEvent({ | ||
[0] = player:getFishingCatchCount(), | ||
[1] = fishingStats['fishLinesCast'] or 0, | ||
[2] = fishingStats['fishReeled'] or 0, | ||
[3] = fishingStats['fishLongestLength'] or 0, | ||
[4] = fishingStats['fishLongestId'] or 0, | ||
[5] = fishingStats['fishHeaviestWeight'] or 0, | ||
[6] = fishingStats['fishHeaviestId'] or 0, | ||
}) | ||
elseif option == 0 then | ||
-- 'Types of Fish Caught' | ||
local fishingCatches = player:getFishingCatches() or {} | ||
-- The server sends the client the bitmap data as a series of 32-bit integers | ||
player:updateEvent({ | ||
[0] = fishingCatches[0] or 0, | ||
[1] = fishingCatches[1] or 0, | ||
[2] = fishingCatches[2] or 0, | ||
[3] = fishingCatches[3] or 0, | ||
[4] = fishingCatches[4] or 0, | ||
[5] = fishingCatches[5] or 0, | ||
}) | ||
end | ||
end, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
return quest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
-- -------------------------------------------------------- | ||
-- Add history for player fishing data | ||
-- -------------------------------------------------------- | ||
|
||
DROP TABLE IF EXISTS `char_fishing_history`; | ||
CREATE TABLE IF NOT EXISTS `char_fishing_history` ( | ||
`charid` int(10) unsigned NOT NULL, | ||
`fish_catches` blob, | ||
`fish_linescast` int(6) unsigned NOT NULL DEFAULT 0, | ||
`fish_reeled` int(5) unsigned NOT NULL DEFAULT 0, | ||
`fish_longest` int(4) unsigned NOT NULL DEFAULT 0, | ||
`fish_longest_id` int(4) unsigned NOT NULL DEFAULT 0, | ||
`fish_heaviest` int(4) unsigned NOT NULL DEFAULT 0, | ||
`fish_heaviest_id` int(4) unsigned NOT NULL DEFAULT 0, | ||
PRIMARY KEY (`charid`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
Oops, something went wrong.