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

feat(Core/SAI): implement SMART_ACTION_DISABLE_REWARD #21105

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

Conversation

Kitzunu
Copy link
Member

@Kitzunu Kitzunu commented Jan 6, 2025

Changes Proposed:

This PR proposes changes to:

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

Issues Addressed:

  • Closes

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 Script file-cpp Used to trigger the matrix build labels Jan 6, 2025
@Kitzunu
Copy link
Member Author

Kitzunu commented Jan 6, 2025

@sudlud sudlud added the Requires WIKI Update Wiki sources will need to be updated after merging this PR. label Jan 7, 2025
@TheSCREWEDSoftware
Copy link
Contributor

TheSCREWEDSoftware commented Jan 18, 2025

Kitzunu so i was trying to test this.

So you have add a new SAI ACTION (238) Which allows to choose disabling or enabling reputation gain or loot (or both).

I was able to test by having action_param 2 set to 1 (true) to disable the loot. But I'm unable to do the same for the reputation. (param_1)

Using the following settings to test:

-- Adds Hydraxian Rep Gain (40) from to Hogger upon being killed.
DELETE FROM `creature_onkill_reputation` WHERE (`creature_id` = 448);
INSERT INTO `creature_onkill_reputation` (`creature_id`, `RewOnKillRepFaction1`, `RewOnKillRepFaction2`, `MaxStanding1`, `IsTeamAward1`, `RewOnKillRepValue1`, `MaxStanding2`, `IsTeamAward2`, `RewOnKillRepValue2`, `TeamDependent`) VALUES
(448, 749, 0, 5, 0, 40, 0, 0, 0, 0);

-- Upon death disables "loot" for Hogger
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(448, 0, 4, 0, 6, 0, 100, 0, 0, 0, 0, 0, 0, 0, 238, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'When Hogger Dies Can\'t be Looted');
  • .go c i 448 // Hogger
  • Kill it, you can't loot him and you gain reputation.
  • If you try to set the 0 (between 238 and 1) to a 1 it wont disable reputation gain.

image

@TheSCREWEDSoftware TheSCREWEDSoftware added Waiting For More Info from Author Issue pending due to needing more additional informatino from the author and removed Testing in Progress labels Jan 18, 2025
@Kitzunu
Copy link
Member Author

Kitzunu commented Jan 19, 2025

I will look. But I am pretty sure rep is handed out on kill, which means you have to disable it prior. So for example on spawn

@TheSCREWEDSoftware
Copy link
Contributor

I can test this on the unit init via sai for the rep one. And give you my result in a bit

@Kitzunu
Copy link
Member Author

Kitzunu commented Jan 19, 2025

I am working on it, wait

@TheSCREWEDSoftware
Copy link
Contributor

Understood, ping me when I can test it again

@TheSCREWEDSoftware TheSCREWEDSoftware removed the Waiting For More Info from Author Issue pending due to needing more additional informatino from the author label Jan 19, 2025
@Kitzunu
Copy link
Member Author

Kitzunu commented Jan 19, 2025

Yeah this is fucked. Unit::Kill() is called before the unit actually dies, which then calls RewardPlayerAndGroupAtKill() and goes into a rabbit hole of functions calling functions until it gives rep. So rep gain is actually awarded before the unit is dead, hence why the action doesn't work

@Kitzunu
Copy link
Member Author

Kitzunu commented Jan 19, 2025

Changing the event to OnAggro (4) makes it work

@Kitzunu
Copy link
Member Author

Kitzunu commented Jan 19, 2025

So for me, this is good to go. The fact the core calculates and rewards before the kill is outside the scope of the pr to fix

@TheSCREWEDSoftware
Copy link
Contributor

Let me test it with on aggro and initiate tests to see the results so give me a moment

@TheSCREWEDSoftware
Copy link
Contributor

Using ai_init (37) or aggro works fine. Whenever the entry gets make for the wiki it's keep intention that rep disabling has be perfomered before the unit is not dead.

-- Upon death disables rep gain and "loot" for Hogger
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(448, 0, 4, 0, 37, 0, 100, 0, 0, 0, 0, 0, 0, 0, 238, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Hogger - On Initialize - Disable Hogger Rep gain and Loot drop');

(for anyone else who wants to test the sql above). But it's working as intended.

@TheSCREWEDSoftware TheSCREWEDSoftware added Tested This PR has been tested and is working. and removed Testing in Progress labels Jan 19, 2025
@Kitzunu
Copy link
Member Author

Kitzunu commented Jan 19, 2025

this will fix it #21210

@TheSCREWEDSoftware
Copy link
Contributor

Want to me test the other PR when this one gets merged?

@Kitzunu
Copy link
Member Author

Kitzunu commented Jan 19, 2025

Do what you want, it works

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 Requires WIKI Update Wiki sources will need to be updated after merging this PR. Script Tested This PR has been tested and is working. To Be Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: SMART_ACTION to disable onkill reputation gains and loot/gold drops for source creature
4 participants