--HG--
branch : trunk
This commit is contained in:
megamage
2009-04-04 15:12:36 -06:00
5 changed files with 50 additions and 41 deletions
@@ -129,20 +129,6 @@ struct TRINITY_DLL_DECL instance_black_temple : public ScriptedInstance
return NULL; 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) void OnCreatureCreate(Creature *creature, uint32 creature_entry)
{ {
switch(creature->GetEntry()) switch(creature->GetEntry())
@@ -167,24 +153,24 @@ struct TRINITY_DLL_DECL instance_black_temple : public ScriptedInstance
switch(go->GetEntry()) switch(go->GetEntry())
{ {
case 185483: NajentusGate = go->GetGUID();// Gate past Naj'entus (at the entrance to Supermoose's courtyards) 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) 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 185478: ShadeOfAkamaDoor = go->GetGUID();break;
case 185480: CommonDoor = go->GetGUID(); 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(); 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(); 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(); 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(); 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(); 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(); 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 185905: IllidanGate = go->GetGUID(); break; // Gate leading to Temple Summit
case 186261: IllidanDoor[0] = go->GetGUID(); break; // Right door at 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 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: case DATA_HIGHWARLORDNAJENTUSEVENT:
if(data == DONE) if(data == DONE)
{ {
HandleGameObject(NajentusGate, 0); HandleGameObject(NajentusGate, true);
} }
Encounters[0] = data;break; Encounters[0] = data;break;
case DATA_SUPREMUSEVENT: case DATA_SUPREMUSEVENT:
if(data == DONE) if(data == DONE)
{ {
HandleGameObject(NajentusGate, 0); HandleGameObject(NajentusGate, true);
} }
Encounters[1] = data; break; Encounters[1] = data; break;
case DATA_SHADEOFAKAMAEVENT: case DATA_SHADEOFAKAMAEVENT:
if(data == IN_PROGRESS) if(data == IN_PROGRESS)
{ {
HandleGameObject(ShadeOfAkamaDoor, 1); HandleGameObject(ShadeOfAkamaDoor, false);
}else HandleGameObject(ShadeOfAkamaDoor, 0); }else HandleGameObject(ShadeOfAkamaDoor, true);
Encounters[2] = data; break; Encounters[2] = data; break;
case DATA_TERONGOREFIENDEVENT: case DATA_TERONGOREFIENDEVENT:
if(data == IN_PROGRESS) if(data == IN_PROGRESS)
{ {
HandleGameObject(TeronDoor, 1); HandleGameObject(TeronDoor, false);
HandleGameObject(CommonDoor, 1); HandleGameObject(CommonDoor, false);
}else }else
{ {
HandleGameObject(TeronDoor, 0); HandleGameObject(TeronDoor, true);
HandleGameObject(CommonDoor, 0); HandleGameObject(CommonDoor, true);
} }
Encounters[3] = data; break; Encounters[3] = data; break;
case DATA_GURTOGGBLOODBOILEVENT: case DATA_GURTOGGBLOODBOILEVENT:
if(data == DONE) if(data == DONE)
{ {
HandleGameObject(GuurtogDoor, 0); HandleGameObject(GuurtogDoor, true);
} }
Encounters[4] = data; break; Encounters[4] = data; break;
case DATA_RELIQUARYOFSOULSEVENT: case DATA_RELIQUARYOFSOULSEVENT:
if(data == DONE) if(data == DONE)
{ {
HandleGameObject(TempleDoor, 0); HandleGameObject(TempleDoor, true);
} }
Encounters[5] = data; break; Encounters[5] = data; break;
case DATA_MOTHERSHAHRAZEVENT: case DATA_MOTHERSHAHRAZEVENT:
if(data == DONE) if(data == DONE)
{ {
HandleGameObject(MotherDoor, 0); HandleGameObject(MotherDoor, true);
} }
Encounters[6] = data; break; Encounters[6] = data; break;
case DATA_ILLIDARICOUNCILEVENT: case DATA_ILLIDARICOUNCILEVENT:
if(data == IN_PROGRESS) if(data == IN_PROGRESS)
{ {
HandleGameObject(CouncilDoor, 1); HandleGameObject(CouncilDoor, false);
HandleGameObject(SimpleDoor, 1); HandleGameObject(SimpleDoor, false);
}else }else
{ {
HandleGameObject(CouncilDoor, 0); HandleGameObject(CouncilDoor, true);
HandleGameObject(SimpleDoor, 0); HandleGameObject(SimpleDoor, true);
} }
Encounters[7] = data; break; Encounters[7] = data; break;
case DATA_ILLIDANSTORMRAGEEVENT: Encounters[8] = data; break; case DATA_ILLIDANSTORMRAGEEVENT: Encounters[8] = data; break;
+5 -2
View File
@@ -1013,8 +1013,11 @@ int ChatHandler::ParseCommands(const char* text)
++text; ++text;
if(!ExecuteCommandInTable(getCommandTable(), text, fullcmd)) 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; return 1;
} }
+4 -1
View File
@@ -193,9 +193,12 @@ void Creature::RemoveFromWorld()
void Creature::SearchFormation() void Creature::SearchFormation()
{ {
if(isPet())
return;
uint32 lowguid = GetDBTableGUIDLow(); uint32 lowguid = GetDBTableGUIDLow();
if(CreatureGroupMap.find(lowguid) != CreatureGroupMap.end()) if(lowguid && CreatureGroupMap.find(lowguid) != CreatureGroupMap.end())
{ {
m_formationID = CreatureGroupMap[lowguid]->leaderGUID; m_formationID = CreatureGroupMap[lowguid]->leaderGUID;
formation_mgr.UpdateCreatureGroup(m_formationID, this); formation_mgr.UpdateCreatureGroup(m_formationID, this);
+10
View File
@@ -30,3 +30,13 @@ void InstanceData::SaveToDB()
CharacterDatabase.PExecute("UPDATE instance SET data = '%s' WHERE id = '%d'", data.c_str(), instance->GetInstanceId()); 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");
}
+7
View File
@@ -22,6 +22,8 @@
#define TRINITY_INSTANCE_DATA_H #define TRINITY_INSTANCE_DATA_H
#include "Common.h" #include "Common.h"
#include "GameObject.h"
#include "Map.h"
class Map; class Map;
class Unit; class Unit;
@@ -68,6 +70,11 @@ class TRINITY_DLL_SPEC InstanceData
//All-purpose data storage 32 bit //All-purpose data storage 32 bit
virtual uint32 GetData(uint32) { return 0; } virtual uint32 GetData(uint32) { return 0; }
virtual void SetData(uint32, uint32 data) {} 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 #endif