From c44438a517a95e7e2b683a74840f0eb9a654affd Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Thu, 14 Oct 2010 14:43:29 +0200 Subject: [PATCH] [10607] Handle GAMEOBJECT_TYPE_GENERIC at Use() to trigger despawn of GO In addition, a check is added to prevent unexpected call to Use() at received opcode. Despawn of this type GO can then only be used with explicit call to Use() Signed-off-by: NoFantasy --- src/game/GameObject.cpp | 6 ++++++ src/game/SpellHandler.cpp | 7 +++++++ src/shared/revision_nr.h | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index 500f43037..2469294d0 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -974,6 +974,12 @@ void GameObject::Use(Unit* user) return; } + case GAMEOBJECT_TYPE_GENERIC: // 5 + { + // No known way to exclude some - only different approach is to select despawnable GOs by Entry + SetLootState(GO_JUST_DEACTIVATED); + return; + } case GAMEOBJECT_TYPE_CHAIR: //7 Sitting: Wooden bench, chairs { GameObjectInfo const* info = GetGOInfo(); diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp index 73ea8710d..e24a3fa25 100644 --- a/src/game/SpellHandler.cpp +++ b/src/game/SpellHandler.cpp @@ -285,6 +285,13 @@ void WorldSession::HandleGameObjectUseOpcode( WorldPacket & recv_data ) if(!obj) return; + // Never expect this opcode for some type GO's + if (obj->GetGoType() == GAMEOBJECT_TYPE_GENERIC) + { + sLog.outError("HandleGameObjectUseOpcode: CMSG_GAMEOBJ_USE for not allowed GameObject type %u (Entry %u), didn't expect this to happen.", obj->GetGoType(), obj->GetEntry()); + return; + } + obj->Use(_player); } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index acf927e00..cda430440 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10606" + #define REVISION_NR "10607" #endif // __REVISION_NR_H__