-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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): OnFfaPvpStateUpdate Event #13023
Conversation
I needed to do the check for the event I didn’t want the Event to fire unless the Byte actually changed not just because the system Set it on or off when it was already on or off.
Sent from Mail for Windows From: SkjalfSent: Wednesday, September 14, 2022 3:33 AMTo: azerothcore/azerothcore-wotlkCc: DavuKnight; AuthorSubject: Re: [azerothcore/azerothcore-wotlk] OnFfaPvpStateUpdate Event (PR #13023) Hey, any reason why you’re checking if they have the flag before removing? It’s not a very common practice as it has no practical effect—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Fine by me but the CI build is failing, please take a look at those errors |
I don't understand why we fire the hook if a creature and a game object change their FfaPvP state. Do they have that state at all? Wouldn't it suffice to check just for players? Or I do read the code wrong maybe. |
I did it everywhere I saw the UnitPVPStateFlags.UNIT_BYTE2_FLAG_FFA_PVP Byte being set. It should be Player and Creature. The Creature is to account for Pets. But I didnt dig into the why of someone trying to set FFA_PVP I just set the event up for any place the UNIT_BYTE2_FLAG_PVP was being set. The only change to the when/why or how its being set. Was that It now checks it before setting it. This is so the event only fires when the stat actually changes not whenever someone updates a state to the same state its already in. Looking at the call in GameObject thats a Spell handler I presume it ensures that your Per Enters FFA_PVP as soon as you summon it when necessary. |
Tested with azerothcore/mod-eluna#63 |
Thank you for the PR |
Hi Dav, we got a crash. |
Looking through the crash log Im not understanding the connection. Is there a specific Area of the log that assiciates the crash to this change? Or is it just a timing thing? |
if (!HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP)) | ||
{ | ||
sScriptMgr->OnFfaPvpStateUpdate(trigger, true); | ||
trigger->SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the crashlog, this is related. I found it odd too :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thread #19.2 is calling GameObject line 2092. 2092 is the event handler. Could it be something in an event payload in a lua script?
Should Event caLLs be wrapped in a try / catch / swallow to avoid crashing the server if the event overloads Blow out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure there is no lua script running with that hook yet, although It's pretty odd indeed. It was a frost trap that made it crash, which is shown on the crashlog, but I don't have more information about it sadly :/
The event per-se it's okay, it doesn't need a try catch.
It's hitting the assert about the byte flag being larger than expected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to me the biggest change is the
ASSERT(offset < 4);
That HasByte Performs compared to the
if (offset > 3)
{
LOG_ERROR("entities.object", "Object::SetByteFlag: wrong offset {}", offset);
return;
}
That SetByteFlag Does
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
azerothcore/mod-eluna#63 went in a few hours back not sure how quick the server picks those up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While the mod-Eluna PR is merged, there are no events registered yet in any Lua scripts.
Changes Proposed:
Issues Addressed:
SOURCE:
Tests Performed:
How to Test the Changes:
55Honey has a direct need for this event in a current LuaScript and will Likely be the one to test it.
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.