diff options
author | ariel- <ariel-@users.noreply.github.com> | 2016-08-28 05:25:09 -0300 |
---|---|---|
committer | joschiwald <joschiwald.trinity@gmail.com> | 2017-02-18 17:17:18 +0100 |
commit | 8a3f053a2f82460cf5d856404f6fcaf4b7eb44aa (patch) | |
tree | 641d41f13096dd2438f46769f89694bafd2ddb21 /src | |
parent | 54b038fe2f4434fcf6b56bbbacc3cbb21d354249 (diff) |
Core/GameObject: save spawn GOState and reset to it instead of toggling from whatever current state we have
Prevents exploit of SMART_ACTION_ACTIVATE_GOBJECT
(cherry picked from commit be3199314ab4c8fba31dd29cbc3a79838e5b3138)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/GameObject/GameObject.cpp | 6 | ||||
-rw-r--r-- | src/server/game/Entities/GameObject/GameObject.h | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 8e99560dc0e..0aa37080ce6 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -53,6 +53,7 @@ GameObject::GameObject() : WorldObject(false), MapObject(), m_usetimes = 0; m_spellId = 0; m_cooldownTime = 0; + m_prevGoState = GO_STATE_ACTIVE; m_goInfo = nullptr; m_goData = nullptr; m_packedRotation = 0; @@ -260,6 +261,7 @@ bool GameObject::Create(uint32 name_id, Map* map, uint32 /*phaseMask*/, Position m_model = CreateModel(); // GAMEOBJECT_BYTES_1, index at 0, 1, 2 and 3 SetGoType(GameobjectTypes(goinfo->type)); + m_prevGoState = go_state; SetGoState(go_state); SetGoArtKit(artKit); @@ -1197,7 +1199,9 @@ void GameObject::ResetDoorOrButton() if (m_lootState == GO_READY || m_lootState == GO_JUST_DEACTIVATED) return; - SwitchDoorOrButton(false); + RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); + SetGoState(m_prevGoState); + SetLootState(GO_JUST_DEACTIVATED); m_cooldownTime = 0; } diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index f438c0366b8..b2173ad170b 100644 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -1167,6 +1167,8 @@ class TC_GAME_API GameObject : public WorldObject, public GridObject<GameObject> bool m_spawnedByDefault; time_t m_cooldownTime; // used as internal reaction delay time store (not state change reaction). // For traps this: spell casting cooldown, for doors/buttons: reset time. + GOState m_prevGoState; // What state to set whenever resetting + GuidSet m_SkillupList; ObjectGuid m_ritualOwnerGUID; // used for GAMEOBJECT_TYPE_RITUAL where GO is not summoned (no owner) |