fix(CORE/SmartScripts): Remove Invoker in SMART_EVENT_EVENT_PHASE_CHANGE #24051
+1
−8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes Proposed:
This PR proposes changes to:
SMART_EVENT_EVENT_PHASE_CHANGE currently exits early if the previous event that led to its trigger did not have an invoker. I believe this behavior to be incorrect since ProcessEventsFor(SMART_EVENT_EVENT_PHASE_CHANGE); is called directly by the core whenever SetPhase is executed and even when trying to use target type 7 (invoker) in a smart script which uses this event type results in a worldserver error about this event not using invoker. Additionally, the invoker is often not present (cases where the event which led to this one did not have an invoker), resulting in this event exiting early despite a phase change occurring.
This change restores proper functionality by removing the invoker check entirely, as it doesn't seem to be necessary.
Issues Addressed:
This smart event currently does nothing.
Tests Performed:
This PR has been:
How to Test the Changes:
This smart event is unused in the db currently so to test
Here are some test scripts people could use:
These will add smart events to Marshal McBride in Northshire Valley. When the player approaches him, he will laugh once. This will not repeat. Then, when right clicking him to speak to him, he will cast renew on himself. This will not repeat either.
.tele northshirevalley
walk into the building and approach Marshal McBride, see him laugh, then right click him and see him cast renew.
Prior to this PR, the above scripts would not play the laugh emote, as SMART_EVENT_NEAR_PLAYER does not have an invoker, but the renew cast would still happen on gossip hello since that does have an invoker. After the PR, both actions will work on their respective phase changes.
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.