aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegamage <none@none>2009-04-04 15:12:36 -0600
committermegamage <none@none>2009-04-04 15:12:36 -0600
commitf744c0907514a48425df8c96bffaadbe54ac3e79 (patch)
treec5b3e53bd84f86d4b2e91170c7697b91ed50d35f /src
parent6e00dd978970bbad082102fef34fe71f02a63a52 (diff)
parent86bd3bfb422a299d6e0aac0f196ba4fea9affbc4 (diff)
*Merge.
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/bindings/scripts/scripts/zone/black_temple/instance_black_temple.cpp62
-rw-r--r--src/game/Chat.cpp7
-rw-r--r--src/game/Creature.cpp5
-rw-r--r--src/game/InstanceData.cpp10
-rw-r--r--src/game/InstanceData.h7
5 files changed, 50 insertions, 41 deletions
diff --git a/src/bindings/scripts/scripts/zone/black_temple/instance_black_temple.cpp b/src/bindings/scripts/scripts/zone/black_temple/instance_black_temple.cpp
index ca5401b99e8..43646746505 100644
--- a/src/bindings/scripts/scripts/zone/black_temple/instance_black_temple.cpp
+++ b/src/bindings/scripts/scripts/zone/black_temple/instance_black_temple.cpp
@@ -129,20 +129,6 @@ struct TRINITY_DLL_DECL instance_black_temple : public ScriptedInstance
return NULL;
}
- void HandleGameObject(uint64 guid, uint32 state)
- {
- Player *player = GetPlayerInMap();
-
- if (!player || !guid)
- {
- debug_log("TSCR: Black Temple: HandleGameObject fail");
- return;
- }
-
- if (GameObject *go = GameObject::GetGameObject(*player,guid))
- go->SetGoState(state);
- }
-
void OnCreatureCreate(Creature *creature, uint32 creature_entry)
{
switch(creature->GetEntry())
@@ -167,24 +153,24 @@ struct TRINITY_DLL_DECL instance_black_temple : public ScriptedInstance
switch(go->GetEntry())
{
case 185483: NajentusGate = go->GetGUID();// Gate past Naj'entus (at the entrance to Supermoose's courtyards)
- if(Encounters[0] == DONE) go->SetGoState(0);break;
+ if(Encounters[0] == DONE)HandleGameObject(NULL,true,go);break;
case 185882: MainTempleDoors = go->GetGUID();// Main Temple Doors - right past Supermoose (Supremus)
- if(Encounters[1] == DONE)go->SetGoState(0);break;
+ if(Encounters[1] == DONE)HandleGameObject(NULL,true,go);break;
case 185478: ShadeOfAkamaDoor = go->GetGUID();break;
case 185480: CommonDoor = go->GetGUID();
- if(Encounters[3] == DONE) go->SetGoState(0);break;
+ if(Encounters[3] == DONE)HandleGameObject(NULL,true,go);;break;
case 186153: TeronDoor = go->GetGUID();
- if(Encounters[3] == DONE)go->SetGoState(0);break;
+ if(Encounters[3] == DONE)HandleGameObject(NULL,true,go);;break;
case 185892: GuurtogDoor = go->GetGUID();
- if(Encounters[4] == DONE)go->SetGoState(0);break;
+ if(Encounters[4] == DONE)HandleGameObject(NULL,true,go);break;
case 185479: TempleDoor = go->GetGUID();
- if(Encounters[5] == DONE)go->SetGoState(0);break;
+ if(Encounters[5] == DONE)HandleGameObject(NULL,true,go);break;
case 185482: MotherDoor = go->GetGUID();
- if(Encounters[6] == DONE)go->SetGoState(0);break;
+ if(Encounters[6] == DONE)HandleGameObject(NULL,true,go);break;
case 185481: CouncilDoor = go->GetGUID();
- if(Encounters[7] == DONE)go->SetGoState(0);break;
+ if(Encounters[7] == DONE)HandleGameObject(NULL,true,go);break;
case 186152: SimpleDoor = go->GetGUID();
- if(Encounters[7] == DONE)go->SetGoState(0);break;
+ if(Encounters[7] == DONE)HandleGameObject(NULL,true,go);break;
case 185905: IllidanGate = go->GetGUID(); break; // Gate leading to Temple Summit
case 186261: IllidanDoor[0] = go->GetGUID(); break; // Right door at Temple Summit
case 186262: IllidanDoor[1] = go->GetGUID(); break; // Left door at Temple Summit
@@ -224,59 +210,59 @@ struct TRINITY_DLL_DECL instance_black_temple : public ScriptedInstance
case DATA_HIGHWARLORDNAJENTUSEVENT:
if(data == DONE)
{
- HandleGameObject(NajentusGate, 0);
+ HandleGameObject(NajentusGate, true);
}
Encounters[0] = data;break;
case DATA_SUPREMUSEVENT:
if(data == DONE)
{
- HandleGameObject(NajentusGate, 0);
+ HandleGameObject(NajentusGate, true);
}
Encounters[1] = data; break;
case DATA_SHADEOFAKAMAEVENT:
if(data == IN_PROGRESS)
{
- HandleGameObject(ShadeOfAkamaDoor, 1);
- }else HandleGameObject(ShadeOfAkamaDoor, 0);
+ HandleGameObject(ShadeOfAkamaDoor, false);
+ }else HandleGameObject(ShadeOfAkamaDoor, true);
Encounters[2] = data; break;
case DATA_TERONGOREFIENDEVENT:
if(data == IN_PROGRESS)
{
- HandleGameObject(TeronDoor, 1);
- HandleGameObject(CommonDoor, 1);
+ HandleGameObject(TeronDoor, false);
+ HandleGameObject(CommonDoor, false);
}else
{
- HandleGameObject(TeronDoor, 0);
- HandleGameObject(CommonDoor, 0);
+ HandleGameObject(TeronDoor, true);
+ HandleGameObject(CommonDoor, true);
}
Encounters[3] = data; break;
case DATA_GURTOGGBLOODBOILEVENT:
if(data == DONE)
{
- HandleGameObject(GuurtogDoor, 0);
+ HandleGameObject(GuurtogDoor, true);
}
Encounters[4] = data; break;
case DATA_RELIQUARYOFSOULSEVENT:
if(data == DONE)
{
- HandleGameObject(TempleDoor, 0);
+ HandleGameObject(TempleDoor, true);
}
Encounters[5] = data; break;
case DATA_MOTHERSHAHRAZEVENT:
if(data == DONE)
{
- HandleGameObject(MotherDoor, 0);
+ HandleGameObject(MotherDoor, true);
}
Encounters[6] = data; break;
case DATA_ILLIDARICOUNCILEVENT:
if(data == IN_PROGRESS)
{
- HandleGameObject(CouncilDoor, 1);
- HandleGameObject(SimpleDoor, 1);
+ HandleGameObject(CouncilDoor, false);
+ HandleGameObject(SimpleDoor, false);
}else
{
- HandleGameObject(CouncilDoor, 0);
- HandleGameObject(SimpleDoor, 0);
+ HandleGameObject(CouncilDoor, true);
+ HandleGameObject(SimpleDoor, true);
}
Encounters[7] = data; break;
case DATA_ILLIDANSTORMRAGEEVENT: Encounters[8] = data; break;
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