-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
Core/RestState: Check area trigger radius instead of wrong 1.0f. #15052
Conversation
@@ -7424,7 +7426,7 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea) | |||
if (GetRestType() == REST_TYPE_IN_TAVERN) // Still inside a tavern or has recently left | |||
{ | |||
// Remove rest state if we have recently left a tavern. | |||
if (GetMapId() != GetInnPosMapId() || GetExactDist(GetInnPosX(), GetInnPosY(), GetInnPosZ()) > 1.0f) | |||
if (GetMapId() != GetInnPosMapId() || GetExactDist(GetInnPosX(), GetInnPosY(), GetInnPosZ()) > (GetInnPosRadius() ? GetInnPosRadius() : 1.0f)) |
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.
please don't try to convert a float to bool, use G3D::fuzzyEq() or similar to compare float
This ignores the areatrigger box though if those are used for inns. I would suggest this kind of fix https://gist.github.com/Rochet2/541bfecca1bfaa3b396d |
Yes there are a few. |
The code really needs fixing the exploit mentioned earlier or something to make the update tick when the player goes outside of the inn. You can basically just walk out slowly or not send the zone update to avoid both fixes. |
I think I already said it in previous PR, TC1 just calls UpdateZone on movementpackets. We could simply remove m_needsZoneUpdate, but performance wise this is not a good idea. |
if the exploit exists in current code, it's ok to focus just on fixing the chair thing in this PR |
@@ -1193,6 +1193,35 @@ bool WorldObject::IsWithinLOSInMap(const WorldObject* obj) const | |||
return IsWithinLOS(ox, oy, oz); | |||
} | |||
|
|||
bool WorldObject::IsWithinBox(const Position& center, float xradius, float yradius, float zradius) const |
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.
Since this method does not access any WorldObject members you can move it to Position class
Used code from @Rochet2. Somehow if I squash commits the author is removed. 👎 |
Well, if the current code is used, no one leaving the inn will have their rested removed. The old code worked so that almost always you are out of range with the 1.0f checking, but if it is corrected, the delays between client and server make it glitch more as you can just go out of the inn with the inn buff even when not hacking. One of the few proper fixes that would fix the problems and the exploit would be to keep a timed event for the players with rested bonus of an inn triggered by an area trigger that would check if they are still in the inn. |
Here is the proper edit that fixes both the exploit and the issue at hand. |
@robinsch : to set Rochet2 as author, checkout your
This will open the |
double sinVal = std::sin(rotation); | ||
double cosVal = std::cos(rotation); | ||
|
||
float BoxDistX = GetPositionX() - GetPositionX(); |
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.
it does not make sense
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.
The refactor was bad.
Read #15052 (comment)
which contains the link to the code it should look like.
PR needs update.
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.
OK, I see it. Inserted 31 lines too far down, should be between line 99 and 100 instead of 130-131.
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.
OK, I see it. Inserted 31 lines too far down, should be between line 99 and 100 instead of 130-131.
I dont think the actual position matters that much .. unlike the correctness of the actual code.
👍 Didnt even notice this was updated |
is this PR ready to be merged ? both the exploits and the bugs are fixed ? |
It is not!
But after a closer look its missing this vital part: https://gist.github.com/Rochet2/541bfecca1bfaa3b396d#file-innsfix-diff-L73-L83 I tested the code in the gist and as said it fixes both exploits. Exploits being players able to walk out slowly and the relying on client sent data. The exploits are fixed by the code in However the PR does not resolve the issue of using client sent data for any other piece of code than inn resting.
Probably should create a separate issue for that exploit as it doesnt consern the inns anymore after this PR, but I have no other known things it could affect atm. |
Exploit was also possible before so I think it's fine to merge. |
@Rochet2 so it makes more sense to close this PR and open on with your diff |
Closes TrinityCore#15016 Closes TrinityCore#15052 Signed-off-by: jackpoz <giacomopoz@gmail.com>
I wonder what is wrong with the goldshire lion's inn area trigger. even with that commit it doesn't seem to add the resting state. the trigger itself is also very far under the ground so dunno if the trigger there is even triggered or so. |
Can not reproduce on facb656. Have you made any edits to the areatrigger or smart scripts tables? |
nvm. forgot to change the worldserver after the compile. seems to be fine |
BUT I found another issue. If you stand on the wooden parts of the Inn the rest state is there but when you walk down on the brick floor there near the cozy fire the rest state disappears |
Can not reproduce on facb656. |
Will fix #15016.