Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Quest] Implement Fisherman's Heart Quest and supporting tools #6230

Open
wants to merge 1 commit into
base: base
Choose a base branch
from

Conversation

paladindamarus
Copy link
Contributor

@paladindamarus paladindamarus commented Sep 9, 2024

I affirm:

  • I understand that if I do not agree to the following points by completing the checkboxes my PR will be ignored.
  • I understand I should leave resolving conversations to the LandSandBoat team so that reviewers won't miss what was said.
  • I have read and understood the Contributing Guide and the Code of Conduct.
  • I have tested my code and the things my code has changed since the last commit in the PR and will test after any later commits.

What does this pull request do?

  • Implements FIsherman's Heart Quest
  • Adds data structures to log fishing history as reported by NPC in Mhaura (Katsunaga)

Steps to test these changes

  • Do any amount of fishing and report to Katsunaga in Mhaura
  • Katsunaga will not provide stats until the quest is complete. Requires Fishing level 20, min Recruit, and a Gugru Tuna (ID: 4480)
  • As you catch fish types, it should be marked with a STAR in the list provided by Katsunaga.
  • You can fake catching a fish by self-targeting and using !exec target:setFishCaught(1234, true) (replacing 1234 with the fish ID)

Sources

  • Capture discord (captures from Siknoz)
  • Custom captures
  • Trial / Error on bitmapping using local client

@paladindamarus paladindamarus force-pushed the fishing_history branch 7 times, most recently from a8ae270 to 139af14 Compare September 11, 2024 00:19
@@ -482,7 +482,7 @@ xi.quest.id =
THE_SAND_CHARM = 8, -- +
A_POTTER_S_PREFERENCE = 9, -- +
THE_OLD_LADY = 10, -- +
FISHERMAN_S_HEART = 11,
FISHERMAN_S_HEART = 11, -- + Converted
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for my own sake, can you please rename this enum to FISHERMANS_HEART?

-- (NOTE: Fishing Rank 0 is handled as default action)
{
check = function(player, status, vars)
return
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting-wise, return <and/or> newline, then following ones with 4-space indent

{
['Katsunaga'] =
{
onTrigger = function(player, npc)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simplified: onTrigger = quest:progressEvent(192, xi.item.GUGRU_TUNA),

{
['Katsunaga'] =
{
onTrigger = function(player, npc)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above

[197] = function(player, csid, option, npc)
if option == 33554432 then
-- 'Catching Fish'
local fishingStats = player:getFishingStats() or {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't gotten there yet, but I'd rather break out if fishing stats are non-existent. updateEvent can take 0 params, so no need to pass an empty table. Also, is this data returned always the same, and could we consolidate it to always return what we need in the format needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to go on the first part, but I'm not sure I understand the second question? the code for getFishingStats() checks the contents of PChar->m_fishHistory, which is a fixed struct. If the C++ function fails, it returns a table of 0s instead with the same labels.

 local fishingStats = player:getFishingStats()
 if fishingStats ~= nil then
     player:updateEvent({
         [0] = player:getFishingCatchCount() or 0,
         [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,
     })
 else
     player:updateEvent(0, 0, 0, 0, 0, 0, 0)
 end

})
elseif option == 0 then
-- 'Types of Fish Caught'
local fishingCatches = player:getFishingCatches() or {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to check this datatype to see if it can be simplified, similar to above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 24-byte bitset (for 196 bits) uses 163 of those bits to build a set of 6 32-bit integers as flags for which fish have been caught. I'm not sure if that's actually the easiest method, but it is how the client receives the data to show "which fish should I put a star next to?"

@paladindamarus paladindamarus changed the title Implement Fisherman's Heart Quest and supporting tools [Quest] Implement Fisherman's Heart Quest and supporting tools Sep 13, 2024
"FROM char_fishing_history "
"WHERE charid = (?);";

auto ret = db::preparedStmt(Query, PChar->id);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new db system returns rset (result set), the old system returns ret (return code)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants