diff options
-rw-r--r-- | src/server/game/Entities/GameObject/GameObject.h | 20 | ||||
-rw-r--r-- | src/server/game/Handlers/SpellHandler.cpp | 11 |
2 files changed, 23 insertions, 8 deletions
diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index 556e4275edc..3f16ea5f273 100644 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -81,7 +81,7 @@ struct GameObjectTemplate uint32 noDamageImmune; //5 uint32 openTextID; //6 can be used to replace castBarCaption? uint32 losOK; //7 - uint32 allowMounted; //8 + uint32 allowMounted; //8 Is usable while on mount/vehicle. (0/1) uint32 large; //9 } questgiver; //3 GAMEOBJECT_TYPE_CHEST @@ -160,7 +160,7 @@ struct GameObjectTemplate uint32 pageID; //0 uint32 language; //1 uint32 pageMaterial; //2 - uint32 allowMounted; //3 + uint32 allowMounted; //3 Is usable while on mount/vehicle. (0/1) } text; //10 GAMEOBJECT_TYPE_GOOBER struct @@ -182,7 +182,7 @@ struct GameObjectTemplate uint32 openTextID; //14 can be used to replace castBarCaption? uint32 closeTextID; //15 uint32 losOK; //16 isBattlegroundObject - uint32 allowMounted; //17 + uint32 allowMounted; //17 Is usable while on mount/vehicle. (0/1) uint32 floatingTooltip; //18 uint32 gossipID; //19 uint32 WorldStateSetsState; //20 @@ -257,7 +257,7 @@ struct GameObjectTemplate uint32 spellId; //0 uint32 charges; //1 uint32 partyOnly; //2 - uint32 allowMounted; //3 + uint32 allowMounted; //3 Is usable while on mount/vehicle. (0/1) uint32 large; //4 } spellcaster; //23 GAMEOBJECT_TYPE_MEETINGSTONE @@ -409,6 +409,18 @@ struct GameObjectTemplate } } + bool IsUsableMounted() const + { + switch (type) + { + case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.allowMounted; + case GAMEOBJECT_TYPE_TEXT: return text.allowMounted; + case GAMEOBJECT_TYPE_GOOBER: return goober.allowMounted; + case GAMEOBJECT_TYPE_SPELLCASTER: return spellcaster.allowMounted; + default: return false; + } + } + uint32 GetLockId() const { switch (type) diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp index ef5a749f9c6..d1c65951a5d 100644 --- a/src/server/game/Handlers/SpellHandler.cpp +++ b/src/server/game/Handlers/SpellHandler.cpp @@ -271,12 +271,15 @@ void WorldSession::HandleGameObjectUseOpcode(WorldPacket& recvData) sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_GAMEOBJ_USE Message [guid=%u]", GUID_LOPART(guid)); - // ignore for remote control state - if (_player->m_mover != _player) - return; - if (GameObject* obj = GetPlayer()->GetMap()->GetGameObject(guid)) + { + // ignore for remote control state + if (_player->m_mover != _player) + if (!_player->IsOnVehicle(_player->m_mover) || !_player->IsMounted() && !obj->GetGOInfo()->IsUsableMounted()) + return; + obj->Use(_player); + } } void WorldSession::HandleGameobjectReportUse(WorldPacket& recvPacket) |