diff options
Diffstat (limited to 'src/game')
| -rw-r--r-- | src/game/Chat.cpp | 7 | ||||
| -rw-r--r-- | src/game/Creature.cpp | 5 | ||||
| -rw-r--r-- | src/game/InstanceData.cpp | 10 | ||||
| -rw-r--r-- | src/game/InstanceData.h | 7 |
4 files changed, 26 insertions, 3 deletions
diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 3a9317e6cef..e28da9d0063 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -1013,8 +1013,11 @@ int ChatHandler::ParseCommands(const char* text) ++text; if(!ExecuteCommandInTable(getCommandTable(), text, fullcmd)) - SendSysMessage(LANG_NO_CMD); - + { + if(m_session && m_session->GetSecurity() == SEC_PLAYER) + return 0; + SendSysMessage(LANG_NO_CMD); + } return 1; } diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 049218cca86..69e371d323e 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -193,9 +193,12 @@ void Creature::RemoveFromWorld() void Creature::SearchFormation() { + if(isPet()) + return; + uint32 lowguid = GetDBTableGUIDLow(); - if(CreatureGroupMap.find(lowguid) != CreatureGroupMap.end()) + if(lowguid && CreatureGroupMap.find(lowguid) != CreatureGroupMap.end()) { m_formationID = CreatureGroupMap[lowguid]->leaderGUID; formation_mgr.UpdateCreatureGroup(m_formationID, this); diff --git a/src/game/InstanceData.cpp b/src/game/InstanceData.cpp index 473d8433395..bd8f510e594 100644 --- a/src/game/InstanceData.cpp +++ b/src/game/InstanceData.cpp @@ -30,3 +30,13 @@ void InstanceData::SaveToDB() CharacterDatabase.PExecute("UPDATE instance SET data = '%s' WHERE id = '%d'", data.c_str(), instance->GetInstanceId()); } +void InstanceData::HandleGameObject(uint64 GUID, bool open, GameObject *go) +{ + if(!go) + go = instance->GetGameObjectInMap(GUID); + if(go) + go->SetGoState(open ? 0 : 1); + else + debug_log("SD2: InstanceData: HandleGameObject failed"); +} + diff --git a/src/game/InstanceData.h b/src/game/InstanceData.h index 0b7c1f7faf3..b2571de66bd 100644 --- a/src/game/InstanceData.h +++ b/src/game/InstanceData.h @@ -22,6 +22,8 @@ #define TRINITY_INSTANCE_DATA_H #include "Common.h" +#include "GameObject.h" +#include "Map.h" class Map; class Unit; @@ -68,6 +70,11 @@ class TRINITY_DLL_SPEC InstanceData //All-purpose data storage 32 bit virtual uint32 GetData(uint32) { return 0; } virtual void SetData(uint32, uint32 data) {} + + //Handle open / close objects + //use HandleGameObject(NULL,boolen,GO); in OnObjectCreate in instance scripts + //use HandleGameObject(GUID,boolen,NULL); in any other script + virtual void HandleGameObject(uint64 GUID, bool open, GameObject *go = NULL); }; #endif |
