Skip to content

feat(Core/Scripting): Add hook for OnPlayerCanLootFishingPool #22291

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Zerkenn
Copy link

@Zerkenn Zerkenn commented Jun 9, 2025

Changes Proposed:

  • Adds a new script hook that is called when the player loots a fishing pool.

I am implementing this script for a module I am creating so I can reward players additional items when they loot a fishing pool. You can return false to stop the looting of the fishing pool object.

This PR proposes changes to:

  • Core (units, players, creatures, game systems).
  • Scripts (bosses, spell scripts, creature scripts).
  • Database (SAI, creatures, etc).

SOURCE:

The changes have been validated through:

  • Live research (checked on live servers, e.g Classic WotLK, Retail, etc.)
  • Sniffs (remember to share them with the open source community!)
  • Video evidence, knowledge databases or other public sources (e.g forums, Wowhead, etc.)
  • The changes promoted by this pull request come partially or entirely from another project (cherry-pick). Cherry-picks must be committed using the proper --author tag in order to be accepted, thus crediting the original authors, unless otherwise unable to be found

Tests Performed:

This PR has been:

  • Tested in-game by the author.
  • Tested in-game by other community members/someone else other than the author/has been live on production servers.
  • This pull request requires further testing and may have edge cases to be tested.

How to Test the Changes:

  • This pull request can be tested by following the reproduction steps provided in the linked issue
  • This pull request requires further testing. Provide steps to test your changes. If it requires any specific setup e.g multiple players please specify it as well.

Known Issues and TODO List:

  • [ ]
  • [ ]

How to Test AzerothCore PRs

When a PR is ready to be tested, it will be marked as [WAITING TO BE TESTED].

You can help by testing PRs and writing your feedback here on the PR's page on GitHub. Follow the instructions here:

http://www.azerothcore.org/wiki/How-to-test-a-PR

REMEMBER: when testing a PR that changes something generic (i.e. a part of code that handles more than one specific thing), the tester should not only check that the PR does its job (e.g. fixing spell XXX) but especially check that the PR does not cause any regression (i.e. introducing new bugs).

For example: if a PR fixes spell X by changing a part of code that handles spells X, Y, and Z, we should not only test X, but we should test Y and Z as well.

@github-actions github-actions bot added CORE Related to the core file-cpp Used to trigger the matrix build labels Jun 9, 2025
@TheSCREWEDSoftware TheSCREWEDSoftware requested a review from sudlud June 9, 2025 11:12
@sudlud
Copy link
Member

sudlud commented Jun 10, 2025

Should probably be named OnPlayerCan...

@Zerkenn
Copy link
Author

Zerkenn commented Jun 10, 2025

Should probably be named OnPlayerCan...

I fixed the naming. Thanks.

@Zerkenn Zerkenn changed the title feat(Core/Scripting): Add hook for OnPlayerLootFishingPool feat(Core/Scripting): Add hook for OnPlayerCanLootFishingPool Jun 10, 2025
Comment on lines 1780 to 1782
{
ok->Use(player);
}
Copy link
Member

Choose a reason for hiding this comment

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

There should be no braces here. See AC Codestyle guide for reference

Also I'm missing a parameter referring to the pool itself (go pointer for example) - seems useful for a fishing pool related hook imo

@sudlud
Copy link
Member

sudlud commented Jun 10, 2025

It somehow feels wrong to add another hook like 3 lines after an existing hook with exactly the same parameters.

@sudlud
Copy link
Member

sudlud commented Jun 10, 2025

I would argue that you can already implement all your desired functionality with the existing hook. Just fetch the game object there and loot it / deactivate it or something similar, no need for a new hook here imo.

@Zerkenn
Copy link
Author

Zerkenn commented Jun 11, 2025

I would argue that you can already implement all your desired functionality with the existing hook. Just fetch the game object there and loot it / deactivate it or something similar, no need for a new hook here imo.

I can modify this to just pass the player, skill, fishing_skill, zone_skill, pointer to the fishing pool object.

I really don't want to have to fetch the fishing pool object every time when using OnPlayerUpdateFishingSkill and then check if a pool exist before rewarding the player. Then try to figure out how to stop the code a few lines down from doing its normal looting behavior on the fishing pool.

I just wanted a simple hook where I can either add additional items/currency to fishing pools and return false to prevent looting of the fishing pool in certain circumstances. I figured t would be a nice hook to add for others to use too.

If you still think this is unacceptable than feel free to close the PR. I am primarily using this on my own server. I can just add it to my own fork. I am a little new to C++. I don't want to waste anyone's time here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CORE Related to the core file-cpp Used to trigger the matrix build Ready to be Reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants