[7715] Provided way for scripts set alternative gameobject state for client show. Author: VladimirMangos
Also use enum for gsmeobject states. --HG-- branch : trunk
This commit is contained in:
1 parent
f9c4047441
commit
5ac67c27f7
43 files changed
+168
-149
No files matched your search
@@ -207,7 +207,7 @@ float ethereum_NPC[2][7] =
|
||||
|
||||
bool GOHello_go_ethereum_prison(Player *player, GameObject* _GO)
|
||||
{
|
||||
_GO->SetGoState(0);
|
||||
_GO->SetGoState(GO_STATE_ACTIVE);
|
||||
switch(rand()%2){
|
||||
case 0:
|
||||
_GO->SummonCreature(ethereum_NPC[0][rand()%6],_GO->GetPositionX(),_GO->GetPositionY(),_GO->GetPositionZ()+0.3, 0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,10000);
|
||||
|
||||
@@ -185,7 +185,7 @@ struct TRINITY_DLL_DECL npc_ruul_snowhoofAI : public npc_escortAI
|
||||
m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
|
||||
GameObject* Cage = FindGameObject(GO_CAGE, 20, m_creature);
|
||||
if(Cage)
|
||||
Cage->SetGoState(0);
|
||||
Cage->SetGoState(GO_STATE_ACTIVE);
|
||||
break;}
|
||||
case 13:
|
||||
m_creature->SummonCreature(3922, 3449.218018, -587.825073, 174.978867, 4.714445, TEMPSUMMON_DEAD_DESPAWN, 60000);
|
||||
@@ -215,7 +215,7 @@ struct TRINITY_DLL_DECL npc_ruul_snowhoofAI : public npc_escortAI
|
||||
|
||||
GameObject* Cage = FindGameObject(GO_CAGE, 20, m_creature);
|
||||
if(Cage)
|
||||
Cage->SetGoState(1);
|
||||
Cage->SetGoState(GO_STATE_READY);
|
||||
}
|
||||
|
||||
void JustSummoned(Creature* summoned)
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ struct TRINITY_DLL_DECL instance_sethekk_halls : public ScriptedInstance
|
||||
{
|
||||
case DATA_IKISSDOOREVENT:
|
||||
if( IkissDoor )
|
||||
IkissDoor->SetGoState(0);
|
||||
IkissDoor->SetGoState(GO_STATE_ACTIVE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -461,7 +461,7 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI
|
||||
{
|
||||
GameObject* Door = GameObject::GetGameObject((*m_creature), pInstance->GetData64(i));
|
||||
if(Door)
|
||||
Door->SetGoState(0); // Open Doors
|
||||
Door->SetGoState(GO_STATE_ACTIVE); // Open Doors
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1005,10 +1005,10 @@ struct TRINITY_DLL_DECL npc_akama_illidanAI : public ScriptedAI
|
||||
DoorGUID[1] = pInstance->GetData64(DATA_GAMEOBJECT_ILLIDAN_DOOR_L);
|
||||
|
||||
if(GETGO(Gate, GateGUID))
|
||||
Gate->SetGoState(1);
|
||||
Gate->SetGoState(GO_STATE_READY);
|
||||
for(uint8 i = 0; i < 2; i++)
|
||||
if(GETGO(Door, DoorGUID[i]))
|
||||
Door->SetGoState(1);
|
||||
Door->SetGoState(GO_STATE_READY);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1078,7 +1078,7 @@ struct TRINITY_DLL_DECL npc_akama_illidanAI : public ScriptedAI
|
||||
|
||||
for(uint8 i = 0; i < 2; i++)
|
||||
if(GETGO(Door, DoorGUID[i]))
|
||||
Door->SetGoState(1);
|
||||
Door->SetGoState(GO_STATE_READY);
|
||||
|
||||
if(GETCRE(Illidan, IllidanGUID))
|
||||
{
|
||||
@@ -1244,7 +1244,7 @@ struct TRINITY_DLL_DECL npc_akama_illidanAI : public ScriptedAI
|
||||
Spirit[0]->InterruptNonMeleeSpells(true);
|
||||
Spirit[1]->InterruptNonMeleeSpells(true);
|
||||
if(GETGO(Gate, GateGUID))
|
||||
Gate->SetGoState(0);
|
||||
Gate->SetGoState(GO_STATE_ACTIVE);
|
||||
Timer = 2000;
|
||||
break;
|
||||
case 4:
|
||||
@@ -1275,7 +1275,7 @@ struct TRINITY_DLL_DECL npc_akama_illidanAI : public ScriptedAI
|
||||
case 6:
|
||||
for(uint8 i = 0; i < 2; i++)
|
||||
if(GETGO(Door, DoorGUID[i]))
|
||||
Door->SetGoState(0);
|
||||
Door->SetGoState(GO_STATE_ACTIVE);
|
||||
break;
|
||||
case 8:
|
||||
if(Phase == PHASE_WALK)
|
||||
@@ -1678,7 +1678,7 @@ bool GOHello_cage_trap(Player* plr, GameObject* go)
|
||||
cell_lock->Visit(cell_lock, cSearcher, *(plr->GetMap()));
|
||||
|
||||
((cage_trap_triggerAI*)trigger->AI())->Active = true;
|
||||
go->SetGoState(0);
|
||||
go->SetGoState(GO_STATE_ACTIVE);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -105,8 +105,8 @@ struct TRINITY_DLL_DECL boss_supremusAI : public ScriptedAI
|
||||
{
|
||||
if(GameObject* Doors = GameObject::GetGameObject(*m_creature, pInstance->GetData64(DATA_GAMEOBJECT_SUPREMUS_DOORS)))
|
||||
{
|
||||
if(close) Doors->SetGoState(1); // Closed
|
||||
else Doors->SetGoState(0); // Open
|
||||
if(close) Doors->SetGoState(GO_STATE_READY); // Closed
|
||||
else Doors->SetGoState(GO_STATE_ACTIVE); // Open
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -129,14 +129,6 @@ struct TRINITY_DLL_DECL npc_grimstoneAI : public npc_escortAI
|
||||
|
||||
void Aggro(Unit *who) { }
|
||||
|
||||
void DoGate(uint32 id, uint32 state)
|
||||
{
|
||||
if (GameObject *go = GameObject::GetGameObject(*m_creature,pInstance->GetData64(id)))
|
||||
go->SetGoState(state);
|
||||
|
||||
debug_log("TSCR: npc_grimstone, arena gate update state.");
|
||||
}
|
||||
|
||||
//TODO: move them to center
|
||||
void SummonRingMob()
|
||||
{
|
||||
@@ -257,7 +249,7 @@ struct TRINITY_DLL_DECL npc_grimstoneAI : public npc_escortAI
|
||||
Event_Timer = 2000;
|
||||
break;
|
||||
case 3:
|
||||
DoGate(DATA_ARENA1,0);
|
||||
HandleGameObject(DATA_ARENA1, true);
|
||||
Event_Timer = 3000;
|
||||
break;
|
||||
case 4:
|
||||
@@ -277,13 +269,13 @@ struct TRINITY_DLL_DECL npc_grimstoneAI : public npc_escortAI
|
||||
break;
|
||||
case 7:
|
||||
m_creature->SetVisibility(VISIBILITY_ON);
|
||||
DoGate(DATA_ARENA1,1);
|
||||
HandleGameObject(DATA_ARENA1, false);
|
||||
DoScriptText(-1000000, m_creature);//4
|
||||
CanWalk = true;
|
||||
Event_Timer = 0;
|
||||
break;
|
||||
case 8:
|
||||
DoGate(DATA_ARENA2,0);
|
||||
HandleGameObject(DATA_ARENA2, true);
|
||||
Event_Timer = 5000;
|
||||
break;
|
||||
case 9:
|
||||
@@ -293,9 +285,9 @@ struct TRINITY_DLL_DECL npc_grimstoneAI : public npc_escortAI
|
||||
break;
|
||||
case 10:
|
||||
//if quest, complete
|
||||
DoGate(DATA_ARENA2,1);
|
||||
DoGate(DATA_ARENA3,0);
|
||||
DoGate(DATA_ARENA4,0);
|
||||
HandleGameObject(DATA_ARENA2, false);
|
||||
HandleGameObject(DATA_ARENA3, true);
|
||||
HandleGameObject(DATA_ARENA4, true);
|
||||
CanWalk = true;
|
||||
Event_Timer = 0;
|
||||
break;
|
||||
|
||||
@@ -101,16 +101,16 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance
|
||||
case 182060:
|
||||
HordeGate = go->GetGUID();
|
||||
if(allianceRetreat)
|
||||
go->SetGoState(0);
|
||||
go->SetGoState(GO_STATE_ACTIVE);
|
||||
else
|
||||
go->SetGoState(1);
|
||||
go->SetGoState(GO_STATE_READY);
|
||||
break;
|
||||
case 182061:
|
||||
ElfGate = go->GetGUID();
|
||||
if(hordeRetreat)
|
||||
go->SetGoState(0);
|
||||
go->SetGoState(GO_STATE_ACTIVE);
|
||||
else
|
||||
go->SetGoState(1);
|
||||
go->SetGoState(GO_STATE_READY);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -137,7 +137,7 @@ struct TRINITY_DLL_DECL instance_serpentshrine_cavern : public ScriptedInstance
|
||||
void OpenDoor(uint64 DoorGUID, bool open)
|
||||
{
|
||||
if(GameObject *Door = instance->GetGameObject(DoorGUID))
|
||||
Door->SetGoState(open ? 0 : 1);
|
||||
Door->SetGoState(open ? GO_STATE_ACTIVE : GO_STATE_READY);
|
||||
}
|
||||
|
||||
void OnCreatureCreate(Creature *creature, uint32 creature_entry)
|
||||
|
||||
+4
-4
@@ -141,12 +141,12 @@ struct TRINITY_DLL_DECL instance_steam_vault : public ScriptedInstance
|
||||
if (data == SPECIAL)
|
||||
{
|
||||
if (GameObject *_go = GameObject::GetGameObject(*player,AccessPanelHydro))
|
||||
_go->SetGoState(0);
|
||||
_go->SetGoState(GO_STATE_ACTIVE);
|
||||
|
||||
if (GetData(TYPE_MEKGINEER_STEAMRIGGER) == SPECIAL)
|
||||
{
|
||||
if (GameObject *_go = GameObject::GetGameObject(*player,MainChambersDoor))
|
||||
_go->SetGoState(0);
|
||||
_go->SetGoState(GO_STATE_ACTIVE);
|
||||
}
|
||||
debug_log("TSCR: Instance Steamvault: Access panel used.");
|
||||
}
|
||||
@@ -156,12 +156,12 @@ struct TRINITY_DLL_DECL instance_steam_vault : public ScriptedInstance
|
||||
if (data == SPECIAL)
|
||||
{
|
||||
if (GameObject *_go = GameObject::GetGameObject(*player,AccessPanelMek))
|
||||
_go->SetGoState(0);
|
||||
_go->SetGoState(GO_STATE_ACTIVE);
|
||||
|
||||
if (GetData(TYPE_HYDROMANCER_THESPIA) == SPECIAL)
|
||||
{
|
||||
if (GameObject *_go = GameObject::GetGameObject(*player,MainChambersDoor))
|
||||
_go->SetGoState(0);
|
||||
_go->SetGoState(GO_STATE_ACTIVE);
|
||||
}
|
||||
debug_log("TSCR: Instance Steamvault: Access panel used.");
|
||||
}
|
||||
|
||||
@@ -120,13 +120,13 @@ struct TRINITY_DLL_DECL instance_deadmines : public ScriptedInstance
|
||||
|
||||
void ShootCannon()
|
||||
{
|
||||
DefiasCannon->SetGoState(0);
|
||||
DefiasCannon->SetGoState(GO_STATE_ACTIVE);
|
||||
DoPlaySound(DefiasCannon, SOUND_CANNONFIRE);
|
||||
}
|
||||
|
||||
void BlastOutDoor()
|
||||
{
|
||||
IronCladDoor->SetGoState(2);
|
||||
IronCladDoor->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE);
|
||||
DoPlaySound(IronCladDoor, SOUND_DESTROYDOOR);
|
||||
}
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ struct TRINITY_DLL_DECL npc_ranger_lilathaAI : public npc_escortAI
|
||||
m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
|
||||
GameObject* Cage = FindGameObject(GO_CAGE, 20, m_creature);
|
||||
if(Cage)
|
||||
Cage->SetGoState(0);
|
||||
Cage->SetGoState(GO_STATE_ACTIVE);
|
||||
DoScriptText(SAY_START, m_creature, player);
|
||||
break;
|
||||
}
|
||||
@@ -220,7 +220,7 @@ struct TRINITY_DLL_DECL npc_ranger_lilathaAI : public npc_escortAI
|
||||
|
||||
GameObject* Cage = FindGameObject(GO_CAGE, 20, m_creature);
|
||||
if(Cage)
|
||||
Cage->SetGoState(1);
|
||||
Cage->SetGoState(GO_STATE_READY);
|
||||
}
|
||||
|
||||
void JustDied(Unit* killer)
|
||||
|
||||
@@ -113,7 +113,7 @@ struct TRINITY_DLL_DECL boss_gruulAI : public ScriptedAI
|
||||
|
||||
GameObject* EncounterDoor = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GRUULDOOR));
|
||||
if (EncounterDoor)
|
||||
EncounterDoor->SetGoState(0); // Open the encounter door
|
||||
EncounterDoor->SetGoState(GO_STATE_ACTIVE); // Open the encounter door
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -127,7 +127,7 @@ struct TRINITY_DLL_DECL instance_magtheridons_lair : public ScriptedInstance
|
||||
if(data != IN_PROGRESS)
|
||||
{
|
||||
if(GameObject *Door = instance->GetGameObject(DoorGUID))
|
||||
Door->SetGoState(0);
|
||||
Door->SetGoState(GO_STATE_ACTIVE);
|
||||
}
|
||||
break;
|
||||
case DATA_CHANNELER_EVENT:
|
||||
@@ -149,7 +149,7 @@ struct TRINITY_DLL_DECL instance_magtheridons_lair : public ScriptedInstance
|
||||
}
|
||||
CageTimer = 0;
|
||||
if(GameObject *Door = instance->GetGameObject(DoorGUID))
|
||||
Door->SetGoState(0);
|
||||
Door->SetGoState(GO_STATE_ACTIVE);
|
||||
}break;
|
||||
case IN_PROGRESS: // Event start.
|
||||
if(Encounters[1] != IN_PROGRESS)
|
||||
@@ -170,7 +170,7 @@ struct TRINITY_DLL_DECL instance_magtheridons_lair : public ScriptedInstance
|
||||
CageTimer = 120000;
|
||||
}
|
||||
if(GameObject *Door = instance->GetGameObject(DoorGUID))
|
||||
Door->SetGoState(1);
|
||||
Door->SetGoState(GO_STATE_READY);
|
||||
}break;
|
||||
case DONE: // Add buff and check if all channelers are dead.
|
||||
for(std::set<uint64>::iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i)
|
||||
|
||||
+1
-1
@@ -244,7 +244,7 @@ struct TRINITY_DLL_DECL boss_grand_warlock_nethekurseAI : public ScriptedAI
|
||||
if (pInstance->GetData64(DATA_NETHEKURSE_DOOR))
|
||||
{
|
||||
if (GameObject *Door = GameObject::GetGameObject(*m_creature,pInstance->GetData64(DATA_NETHEKURSE_DOOR)))
|
||||
Door->SetGoState(0);
|
||||
Door->SetGoState(GO_STATE_ACTIVE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -134,9 +134,9 @@ struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI
|
||||
void HandleTerraceDoors(bool open)
|
||||
{
|
||||
if(GameObject *Door = GameObject::GetGameObject((*m_creature),pInstance->GetData64(DATA_MASTERS_TERRACE_DOOR_1)))
|
||||
Door->SetGoState(open ? 0 : 1);
|
||||
Door->SetGoState(open ? GO_STATE_ACTIVE : GO_STATE_READY);
|
||||
if(GameObject *Door = GameObject::GetGameObject((*m_creature),pInstance->GetData64(DATA_MASTERS_TERRACE_DOOR_2)))
|
||||
Door->SetGoState(open ? 0 : 1);
|
||||
Door->SetGoState(open ? GO_STATE_ACTIVE : GO_STATE_READY);
|
||||
}
|
||||
|
||||
void Aggro(Unit *who)
|
||||
|
||||
@@ -212,7 +212,7 @@ struct TRINITY_DLL_DECL boss_malchezaarAI : public ScriptedAI
|
||||
GameObject* Door = GameObject::GetGameObject((*m_creature),pInstance->GetData64(DATA_GAMEOBJECT_NETHER_DOOR));
|
||||
if(Door)
|
||||
{
|
||||
Door->SetGoState(0);
|
||||
Door->SetGoState(GO_STATE_ACTIVE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -244,7 +244,7 @@ struct TRINITY_DLL_DECL boss_malchezaarAI : public ScriptedAI
|
||||
GameObject* Door = GameObject::GetGameObject((*m_creature),pInstance->GetData64(DATA_GAMEOBJECT_NETHER_DOOR));
|
||||
if(Door)
|
||||
{
|
||||
Door->SetGoState(0);
|
||||
Door->SetGoState(GO_STATE_ACTIVE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -258,7 +258,7 @@ struct TRINITY_DLL_DECL boss_malchezaarAI : public ScriptedAI
|
||||
GameObject* Door = GameObject::GetGameObject((*m_creature),pInstance->GetData64(DATA_GAMEOBJECT_NETHER_DOOR));
|
||||
if(Door)
|
||||
{
|
||||
Door->SetGoState(1);
|
||||
Door->SetGoState(GO_STATE_READY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ struct TRINITY_DLL_DECL boss_aranAI : public ScriptedAI
|
||||
pInstance->SetData(DATA_SHADEOFARAN_EVENT, NOT_STARTED);
|
||||
|
||||
if(GameObject* Door = GameObject::GetGameObject(*m_creature, pInstance->GetData64(DATA_GAMEOBJECT_LIBRARY_DOOR)))
|
||||
Door->SetGoState(0);
|
||||
Door->SetGoState(GO_STATE_ACTIVE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ struct TRINITY_DLL_DECL boss_aranAI : public ScriptedAI
|
||||
pInstance->SetData(DATA_SHADEOFARAN_EVENT, DONE);
|
||||
|
||||
if(GameObject* Door = GameObject::GetGameObject(*m_creature, pInstance->GetData64(DATA_GAMEOBJECT_LIBRARY_DOOR)))
|
||||
Door->SetGoState(0);
|
||||
Door->SetGoState(GO_STATE_ACTIVE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ struct TRINITY_DLL_DECL boss_aranAI : public ScriptedAI
|
||||
{
|
||||
pInstance->SetData(DATA_SHADEOFARAN_EVENT, IN_PROGRESS);
|
||||
if(GameObject* Door = GameObject::GetGameObject(*m_creature, pInstance->GetData64(DATA_GAMEOBJECT_LIBRARY_DOOR)))
|
||||
Door->SetGoState(1);
|
||||
Door->SetGoState(GO_STATE_READY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ struct TRINITY_DLL_DECL boss_aranAI : public ScriptedAI
|
||||
if(pInstance)
|
||||
{
|
||||
if(GameObject* Door = GameObject::GetGameObject(*m_creature, pInstance->GetData64(DATA_GAMEOBJECT_LIBRARY_DOOR)))
|
||||
Door->SetGoState(1);
|
||||
Door->SetGoState(GO_STATE_READY);
|
||||
CloseDoorTimer = 0;
|
||||
}
|
||||
}else CloseDoorTimer -= diff;
|
||||
|
||||
@@ -574,9 +574,9 @@ struct TRINITY_DLL_DECL boss_croneAI : public ScriptedAI
|
||||
pInstance->SetData(DATA_OPERA_EVENT, DONE);
|
||||
|
||||
if (GameObject* lDoor = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GAMEOBJECT_STAGEDOORLEFT)))
|
||||
lDoor->SetGoState(0);
|
||||
lDoor->SetGoState(GO_STATE_ACTIVE);
|
||||
if (GameObject* rDoor = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GAMEOBJECT_STAGEDOORRIGHT)))
|
||||
rDoor->SetGoState(0);
|
||||
rDoor->SetGoState(GO_STATE_ACTIVE);
|
||||
if (GameObject* pSideEntrance = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR)))
|
||||
pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED);
|
||||
}
|
||||
@@ -769,9 +769,9 @@ struct TRINITY_DLL_DECL boss_bigbadwolfAI : public ScriptedAI
|
||||
pInstance->SetData(DATA_OPERA_EVENT, DONE);
|
||||
|
||||
if (GameObject* lDoor = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GAMEOBJECT_STAGEDOORLEFT)))
|
||||
lDoor->SetGoState(0);
|
||||
lDoor->SetGoState(GO_STATE_ACTIVE);
|
||||
if (GameObject* rDoor = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GAMEOBJECT_STAGEDOORRIGHT)))
|
||||
rDoor->SetGoState(0);
|
||||
rDoor->SetGoState(GO_STATE_ACTIVE);
|
||||
if (GameObject* pSideEntrance = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR)))
|
||||
pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED);
|
||||
}
|
||||
@@ -1016,9 +1016,9 @@ struct TRINITY_DLL_DECL boss_julianneAI : public ScriptedAI
|
||||
pInstance->SetData(DATA_OPERA_EVENT, DONE);
|
||||
|
||||
if (GameObject* lDoor = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GAMEOBJECT_STAGEDOORLEFT)))
|
||||
lDoor->SetGoState(0);
|
||||
lDoor->SetGoState(GO_STATE_ACTIVE);
|
||||
if (GameObject* rDoor = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GAMEOBJECT_STAGEDOORRIGHT)))
|
||||
rDoor->SetGoState(0);
|
||||
rDoor->SetGoState(GO_STATE_ACTIVE);
|
||||
if (GameObject* pSideEntrance = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR)))
|
||||
pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED);
|
||||
}
|
||||
@@ -1105,9 +1105,9 @@ struct TRINITY_DLL_DECL boss_romuloAI : public ScriptedAI
|
||||
pInstance->SetData(DATA_OPERA_EVENT, DONE);
|
||||
|
||||
if (GameObject* lDoor = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GAMEOBJECT_STAGEDOORLEFT)))
|
||||
lDoor->SetGoState(0);
|
||||
lDoor->SetGoState(GO_STATE_ACTIVE);
|
||||
if (GameObject* rDoor = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GAMEOBJECT_STAGEDOORRIGHT)))
|
||||
rDoor->SetGoState(0);
|
||||
rDoor->SetGoState(GO_STATE_ACTIVE);
|
||||
if (GameObject* pSideEntrance = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR)))
|
||||
pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED);
|
||||
}
|
||||
|
||||
@@ -149,10 +149,10 @@ struct TRINITY_DLL_DECL npc_barnesAI : public npc_escortAI
|
||||
Event = pInstance->GetData(DATA_OPERA_PERFORMANCE);
|
||||
|
||||
if (GameObject* Door = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GAMEOBJECT_STAGEDOORLEFT)))
|
||||
Door->SetGoState(1);
|
||||
Door->SetGoState(GO_STATE_READY);
|
||||
|
||||
if (GameObject* Curtain = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GAMEOBJECT_CURTAINS)))
|
||||
Curtain->SetGoState(1);
|
||||
Curtain->SetGoState(GO_STATE_READY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ struct TRINITY_DLL_DECL npc_barnesAI : public npc_escortAI
|
||||
if(pInstance)
|
||||
{
|
||||
if (GameObject* Door = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GAMEOBJECT_STAGEDOORLEFT)))
|
||||
Door->SetGoState(1);
|
||||
Door->SetGoState(GO_STATE_READY);
|
||||
}
|
||||
IsBeingEscorted = false;
|
||||
PerformanceReady = true;
|
||||
@@ -262,7 +262,7 @@ struct TRINITY_DLL_DECL npc_barnesAI : public npc_escortAI
|
||||
return;
|
||||
|
||||
if (GameObject* Curtain = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GAMEOBJECT_CURTAINS)))
|
||||
Curtain->SetGoState(0);
|
||||
Curtain->SetGoState(GO_STATE_ACTIVE);
|
||||
|
||||
CurtainTimer = 0;
|
||||
}else CurtainTimer -= diff;
|
||||
@@ -315,7 +315,7 @@ struct TRINITY_DLL_DECL npc_barnesAI : public npc_escortAI
|
||||
pInstance->SetData(DATA_OPERA_EVENT, IN_PROGRESS);
|
||||
|
||||
if (GameObject* Door = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GAMEOBJECT_STAGEDOORLEFT)))
|
||||
Door->SetGoState(0);
|
||||
Door->SetGoState(GO_STATE_ACTIVE);
|
||||
|
||||
m_creature->CastSpell(m_creature, SPELL_TUXEDO, true);
|
||||
m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
|
||||
@@ -132,7 +132,7 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI
|
||||
|
||||
GameObject* Door = GameObject::GetGameObject(*m_creature, pInstance->GetData64(DATA_KAEL_DOOR));
|
||||
if (Door)
|
||||
Door->SetGoState(0); // Open the big encounter door. Close it in Aggro and open it only in JustDied(and here)
|
||||
Door->SetGoState(GO_STATE_ACTIVE); // Open the big encounter door. Close it in Aggro and open it only in JustDied(and here)
|
||||
// Small door opened after event are expected to be closed by default
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI
|
||||
DoScriptText(SAY_DEATH, m_creature);
|
||||
GameObject* EncounterDoor = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_KAEL_DOOR));
|
||||
if (EncounterDoor)
|
||||
EncounterDoor->SetGoState(0); // Open the encounter door
|
||||
EncounterDoor->SetGoState(GO_STATE_ACTIVE); // Open the encounter door
|
||||
}
|
||||
|
||||
void DamageTaken(Unit* done_by, uint32 &damage)
|
||||
@@ -156,7 +156,7 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI
|
||||
{
|
||||
GameObject* EncounterDoor = GameObject::GetGameObject(*m_creature, pInstance->GetData64(DATA_KAEL_DOOR));
|
||||
if (EncounterDoor)
|
||||
EncounterDoor->SetGoState(1); //Close the encounter door, open it in JustDied/Reset
|
||||
EncounterDoor->SetGoState(GO_STATE_READY); //Close the encounter door, open it in JustDied/Reset
|
||||
}
|
||||
}
|
||||
|
||||
@@ -348,9 +348,9 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI
|
||||
if (pInstance)
|
||||
{
|
||||
GameObject* KaelLeft = GameObject::GetGameObject(*m_creature, pInstance->GetData64(DATA_KAEL_STATUE_LEFT));
|
||||
if (KaelLeft) KaelLeft->SetGoState(0);
|
||||
if (KaelLeft) KaelLeft->SetGoState(GO_STATE_ACTIVE);
|
||||
GameObject* KaelRight = GameObject::GetGameObject(*m_creature, pInstance->GetData64(DATA_KAEL_STATUE_RIGHT));
|
||||
if (KaelRight) KaelRight->SetGoState(0);
|
||||
if (KaelRight) KaelRight->SetGoState(GO_STATE_ACTIVE);
|
||||
}
|
||||
}else
|
||||
{
|
||||
|
||||
@@ -232,7 +232,7 @@ struct TRINITY_DLL_DECL boss_priestess_delrissaAI : public ScriptedAI
|
||||
pInstance->SetData(DATA_DELRISSA_EVENT, DONE);
|
||||
|
||||
if (GameObject* Door = GameObject::GetGameObject(*m_creature, pInstance->GetData64(DATA_DELRISSA_DOOR)))
|
||||
Door->SetGoState(0);
|
||||
Door->SetGoState(GO_STATE_ACTIVE);
|
||||
}
|
||||
|
||||
void CheckLootable()
|
||||
|
||||
@@ -107,7 +107,7 @@ struct TRINITY_DLL_DECL boss_selin_fireheartAI : public ScriptedAI
|
||||
|
||||
GameObject* Door = GameObject::GetGameObject(*m_creature, pInstance->GetData64(DATA_SELIN_ENCOUNTER_DOOR));
|
||||
if (Door)
|
||||
Door->SetGoState(0); // Open the big encounter door. Close it in Aggro and open it only in JustDied(and here)
|
||||
Door->SetGoState(GO_STATE_ACTIVE); // Open the big encounter door. Close it in Aggro and open it only in JustDied(and here)
|
||||
// Small door opened after event are expected to be closed by default
|
||||
// Set Inst data for encounter
|
||||
pInstance->SetData(DATA_SELIN_EVENT, NOT_STARTED);
|
||||
@@ -189,7 +189,7 @@ struct TRINITY_DLL_DECL boss_selin_fireheartAI : public ScriptedAI
|
||||
{
|
||||
GameObject* EncounterDoor = GameObject::GetGameObject(*m_creature, pInstance->GetData64(DATA_SELIN_ENCOUNTER_DOOR));
|
||||
if (EncounterDoor)
|
||||
EncounterDoor->SetGoState(1); //Close the encounter door, open it in JustDied/Reset
|
||||
EncounterDoor->SetGoState(GO_STATE_READY); //Close the encounter door, open it in JustDied/Reset
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,11 +238,11 @@ struct TRINITY_DLL_DECL boss_selin_fireheartAI : public ScriptedAI
|
||||
|
||||
GameObject* EncounterDoor = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_SELIN_ENCOUNTER_DOOR));
|
||||
if (EncounterDoor)
|
||||
EncounterDoor->SetGoState(0); // Open the encounter door
|
||||
EncounterDoor->SetGoState(GO_STATE_ACTIVE); // Open the encounter door
|
||||
|
||||
GameObject* ContinueDoor = GameObject::GetGameObject(*m_creature, pInstance->GetData64(DATA_SELIN_DOOR));
|
||||
if (ContinueDoor)
|
||||
ContinueDoor->SetGoState(0); // Open the door leading further in
|
||||
ContinueDoor->SetGoState(GO_STATE_ACTIVE); // Open the door leading further in
|
||||
|
||||
ShatterRemainingCrystals();
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ struct TRINITY_DLL_DECL boss_vexallusAI : public ScriptedAI
|
||||
pInstance->SetData(DATA_VEXALLUS_EVENT, DONE);
|
||||
|
||||
if (GameObject* Door = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_VEXALLUS_DOOR)))
|
||||
Door->SetGoState(0);
|
||||
Door->SetGoState(GO_STATE_ACTIVE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ struct TRINITY_DLL_DECL instance_scarlet_monastery : public ScriptedInstance
|
||||
{
|
||||
GameObject *Shrine = instance->GetGameObject(PumpkinShrineGUID);
|
||||
if(Shrine)
|
||||
Shrine->SetGoState(1);
|
||||
Shrine->SetGoState(GO_STATE_READY);
|
||||
}break;
|
||||
case DATA_HORSEMAN_EVENT:
|
||||
if (data == DONE)
|
||||
@@ -109,7 +109,7 @@ struct TRINITY_DLL_DECL instance_scarlet_monastery : public ScriptedInstance
|
||||
HorsemanAdds.clear();
|
||||
GameObject *Shrine = instance->GetGameObject(PumpkinShrineGUID);
|
||||
if(Shrine)
|
||||
Shrine->SetGoState(1);
|
||||
Shrine->SetGoState(GO_STATE_READY);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -97,17 +97,17 @@ struct TRINITY_DLL_DECL instance_shadowfang_keep : public ScriptedInstance
|
||||
case GO_COURTYARD_DOOR:
|
||||
DoorCourtyardGUID = go->GetGUID();
|
||||
if (Encounter[0] == DONE)
|
||||
go->SetGoState(0);
|
||||
go->SetGoState(GO_STATE_ACTIVE);
|
||||
break;
|
||||
case GO_SORCERER_DOOR:
|
||||
DoorSorcererGUID = go->GetGUID();
|
||||
if (Encounter[2] == DONE)
|
||||
go->SetGoState(0);
|
||||
go->SetGoState(GO_STATE_ACTIVE);
|
||||
break;
|
||||
case GO_ARUGAL_DOOR:
|
||||
DoorArugalGUID = go->GetGUID();
|
||||
if (Encounter[3] == DONE)
|
||||
go->SetGoState(0);
|
||||
go->SetGoState(GO_STATE_ACTIVE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -314,7 +314,7 @@ struct TRINITY_DLL_DECL npc_warden_mellicharAI : public ScriptedAI
|
||||
{
|
||||
pInstance->SetData(TYPE_HARBINGERSKYRISS,IN_PROGRESS);
|
||||
if (GameObject* Sphere = GameObject::GetGameObject(*m_creature,pInstance->GetData64(DATA_SPHERE_SHIELD)))
|
||||
Sphere->SetGoState(1);
|
||||
Sphere->SetGoState(GO_STATE_READY);
|
||||
IsRunning = true;
|
||||
}
|
||||
}
|
||||
@@ -355,7 +355,7 @@ struct TRINITY_DLL_DECL npc_warden_mellicharAI : public ScriptedAI
|
||||
DoCast(m_creature,SPELL_TARGET_ALPHA);
|
||||
pInstance->SetData(TYPE_WARDEN_1,IN_PROGRESS);
|
||||
if (GameObject *Sphere = GameObject::GetGameObject(*m_creature,pInstance->GetData64(DATA_SPHERE_SHIELD)))
|
||||
Sphere->SetGoState(1);
|
||||
Sphere->SetGoState(GO_STATE_READY);
|
||||
break;
|
||||
case 3:
|
||||
DoCast(m_creature,SPELL_TARGET_BETA);
|
||||
|
||||
@@ -163,7 +163,7 @@ struct TRINITY_DLL_DECL boss_harbinger_skyrissAI : public ScriptedAI
|
||||
case 1:
|
||||
DoScriptText(SAY_INTRO, m_creature);
|
||||
if (GameObject* Sphere = GameObject::GetGameObject(*m_creature,pInstance->GetData64(DATA_SPHERE_SHIELD)))
|
||||
Sphere->SetGoState(0);
|
||||
Sphere->SetGoState(GO_STATE_ACTIVE);
|
||||
++Intro_Phase;
|
||||
Intro_Timer = 25000;
|
||||
break;
|
||||
|
||||
@@ -389,7 +389,7 @@ struct TRINITY_DLL_DECL npc_isla_starmaneAI : public npc_escortAI
|
||||
{
|
||||
GameObject* Cage = FindGameObject(GO_CAGE, 10, m_creature);
|
||||
if(Cage)
|
||||
Cage->SetGoState(0);
|
||||
Cage->SetGoState(GO_STATE_ACTIVE);
|
||||
}break;
|
||||
case 2: DoScriptText(SAY_PROGRESS_1, m_creature, player); break;
|
||||
case 5: DoScriptText(SAY_PROGRESS_2, m_creature, player); break;
|
||||
|
||||
@@ -117,7 +117,7 @@ bool GOHello_go_mausoleum_door(Player *player, GameObject* _GO)
|
||||
|
||||
if (GameObject *trigger = SearchMausoleumGo(player, GO_TRIGGER, 30))
|
||||
{
|
||||
trigger->SetGoState(1);
|
||||
trigger->SetGoState(GO_STATE_READY);
|
||||
player->SummonCreature(C_ULAG, 2390.26, 336.47, 40.01, 2.26, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 300000);
|
||||
return false;
|
||||
}
|
||||
@@ -132,7 +132,7 @@ bool GOHello_go_mausoleum_trigger(Player *player, GameObject* _GO)
|
||||
|
||||
if (GameObject *door = SearchMausoleumGo(player, GO_DOOR, 30))
|
||||
{
|
||||
_GO->SetGoState(0);
|
||||
_GO->SetGoState(GO_STATE_ACTIVE);
|
||||
door->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance
|
||||
break;
|
||||
|
||||
case ANCIENT_VAULT_DOOR:
|
||||
go->SetGoState(1);
|
||||
go->SetGoState(GO_STATE_READY);
|
||||
go->SetUInt32Value(GAMEOBJECT_FLAGS, 33);
|
||||
ancientVaultDoor = go->GetGUID();
|
||||
break;
|
||||
@@ -93,7 +93,7 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance
|
||||
return;
|
||||
|
||||
go->SetUInt32Value(GAMEOBJECT_FLAGS, 33);
|
||||
go->SetGoState(0);
|
||||
go->SetGoState(GO_STATE_ACTIVE);
|
||||
}
|
||||
|
||||
void ActivateStoneKeepers()
|
||||
|
||||
@@ -140,7 +140,7 @@ struct TRINITY_DLL_DECL instance_zulaman : public ScriptedInstance
|
||||
void OpenDoor(uint64 DoorGUID, bool open)
|
||||
{
|
||||
if(GameObject *Door = instance->GetGameObject(DoorGUID))
|
||||
Door->SetGoState(open ? 0 : 1);
|
||||
Door->SetGoState(open ? GO_STATE_ACTIVE : GO_STATE_READY);
|
||||
}
|
||||
|
||||
void SummonHostage(uint8 num)
|
||||
|
||||
@@ -1331,7 +1331,7 @@ bool BattleGround::AddObject(uint32 type, uint32 entry, float x, float y, float
|
||||
// so we must create it specific for this instance
|
||||
GameObject * go = new GameObject;
|
||||
if(!go->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT),entry, map,
|
||||
PHASEMASK_NORMAL, x,y,z,o,rotation0,rotation1,rotation2,rotation3,100,1))
|
||||
PHASEMASK_NORMAL, x,y,z,o,rotation0,rotation1,rotation2,rotation3,100,GO_STATE_READY))
|
||||
{
|
||||
sLog.outErrorDb("Gameobject template %u not found in database! BattleGround not created!", entry);
|
||||
sLog.outError("Cannot create gameobject template %u! BattleGround not created!", entry);
|
||||
@@ -1374,7 +1374,7 @@ void BattleGround::DoorClose(uint32 type)
|
||||
if (obj)
|
||||
{
|
||||
//if doors are open, close it
|
||||
if (obj->getLootState() == GO_ACTIVATED && !obj->GetGoState())
|
||||
if (obj->getLootState() == GO_ACTIVATED && obj->GetGoState() != GO_STATE_READY)
|
||||
{
|
||||
//change state to allow door to be closed
|
||||
obj->SetLootState(GO_READY);
|
||||
|
||||
+27
-21
@@ -107,7 +107,7 @@ void GameObject::RemoveFromWorld()
|
||||
}
|
||||
}
|
||||
|
||||
bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, uint32 go_state, uint32 ArtKit)
|
||||
bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, GOState go_state, uint32 ArtKit)
|
||||
{
|
||||
Relocate(x,y,z,ang);
|
||||
SetMapId(map->GetId());
|
||||
@@ -209,7 +209,7 @@ void GameObject::Update(uint32 /*p_time*/)
|
||||
Unit* caster = GetOwner();
|
||||
if(caster && caster->GetTypeId()==TYPEID_PLAYER)
|
||||
{
|
||||
SetGoState(0);
|
||||
SetGoState(GO_STATE_ACTIVE);
|
||||
SetUInt32Value(GAMEOBJECT_FLAGS, GO_FLAG_NODESPAWN);
|
||||
|
||||
UpdateData udata;
|
||||
@@ -267,11 +267,11 @@ void GameObject::Update(uint32 /*p_time*/)
|
||||
case GAMEOBJECT_TYPE_DOOR:
|
||||
case GAMEOBJECT_TYPE_BUTTON:
|
||||
//we need to open doors if they are closed (add there another condition if this code breaks some usage, but it need to be here for battlegrounds)
|
||||
if( !GetGoState() )
|
||||
SwitchDoorOrButton(false);
|
||||
if (GetGoState() != GO_STATE_READY)
|
||||
ResetDoorOrButton();
|
||||
//flags in AB are type_button and we need to add them here so no break!
|
||||
default:
|
||||
if(!m_spawnedByDefault) // despawn timer
|
||||
if (!m_spawnedByDefault) // despawn timer
|
||||
{
|
||||
// can be despawned or destroyed
|
||||
SetLootState(GO_JUST_DEACTIVATED);
|
||||
@@ -371,11 +371,8 @@ void GameObject::Update(uint32 /*p_time*/)
|
||||
{
|
||||
case GAMEOBJECT_TYPE_DOOR:
|
||||
case GAMEOBJECT_TYPE_BUTTON:
|
||||
if(GetAutoCloseTime() && (m_cooldownTime < time(NULL)))
|
||||
{
|
||||
SwitchDoorOrButton(false);
|
||||
SetLootState(GO_JUST_DEACTIVATED);
|
||||
}
|
||||
if (GetAutoCloseTime() && (m_cooldownTime < time(NULL)))
|
||||
ResetDoorOrButton();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -463,7 +460,7 @@ void GameObject::Delete()
|
||||
{
|
||||
SendObjectDeSpawnAnim(GetGUID());
|
||||
|
||||
SetGoState(1);
|
||||
SetGoState(GO_STATE_READY);
|
||||
SetUInt32Value(GAMEOBJECT_FLAGS, GetGOInfo()->flags);
|
||||
|
||||
uint16 poolid = poolhandler.IsPartOfAPool(GetGUIDLow(), TYPEID_GAMEOBJECT);
|
||||
@@ -549,8 +546,8 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
|
||||
<< GetFloatValue(GAMEOBJECT_PARENTROTATION+2) << ", "
|
||||
<< GetFloatValue(GAMEOBJECT_PARENTROTATION+3) << ", "
|
||||
<< m_respawnDelayTime << ", "
|
||||
<< (uint32)GetGoAnimProgress() << ", "
|
||||
<< (uint32)GetGoState() << ")";
|
||||
<< uint32(GetGoAnimProgress()) << ", "
|
||||
<< uint32(GetGoState()) << ")";
|
||||
|
||||
WorldDatabase.BeginTransaction();
|
||||
WorldDatabase.PExecuteLog("DELETE FROM gameobject WHERE guid = '%u'", m_DBTableGuid);
|
||||
@@ -582,7 +579,7 @@ bool GameObject::LoadFromDB(uint32 guid, Map *map)
|
||||
float rotation3 = data->rotation3;
|
||||
|
||||
uint32 animprogress = data->animprogress;
|
||||
uint32 go_state = data->go_state;
|
||||
GOState go_state = data->go_state;
|
||||
uint32 ArtKit = data->ArtKit;
|
||||
|
||||
m_DBTableGuid = guid;
|
||||
@@ -865,7 +862,17 @@ GameObject* GameObject::LookupFishingHoleAround(float range)
|
||||
return ok;
|
||||
}
|
||||
|
||||
void GameObject::UseDoorOrButton(uint32 time_to_restore)
|
||||
void GameObject::ResetDoorOrButton()
|
||||
{
|
||||
if (m_lootState == GO_READY || m_lootState == GO_JUST_DEACTIVATED)
|
||||
return;
|
||||
|
||||
SwitchDoorOrButton(false);
|
||||
SetLootState(GO_JUST_DEACTIVATED);
|
||||
m_cooldownTime = 0;
|
||||
}
|
||||
|
||||
void GameObject::UseDoorOrButton(uint32 time_to_restore, bool alternative /* = false */)
|
||||
{
|
||||
if(m_lootState != GO_READY)
|
||||
return;
|
||||
@@ -873,11 +880,10 @@ void GameObject::UseDoorOrButton(uint32 time_to_restore)
|
||||
if(!time_to_restore)
|
||||
time_to_restore = GetAutoCloseTime();
|
||||
|
||||
SwitchDoorOrButton(true);
|
||||
SwitchDoorOrButton(true,alternative);
|
||||
SetLootState(GO_ACTIVATED);
|
||||
|
||||
m_cooldownTime = time(NULL) + time_to_restore;
|
||||
|
||||
}
|
||||
|
||||
void GameObject::SetGoArtKit(uint8 kit)
|
||||
@@ -888,17 +894,17 @@ void GameObject::SetGoArtKit(uint8 kit)
|
||||
data->ArtKit = kit;
|
||||
}
|
||||
|
||||
void GameObject::SwitchDoorOrButton(bool activate)
|
||||
void GameObject::SwitchDoorOrButton(bool activate, bool alternative /* = false */)
|
||||
{
|
||||
if(activate)
|
||||
SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
|
||||
else
|
||||
RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
|
||||
|
||||
if(GetGoState()) //if closed -> open
|
||||
SetGoState(0);
|
||||
if(GetGoState() == GO_STATE_READY) //if closed -> open
|
||||
SetGoState(alternative ? GO_STATE_ACTIVE_ALTERNATIVE : GO_STATE_ACTIVE);
|
||||
else //if open -> close
|
||||
SetGoState(1);
|
||||
SetGoState(GO_STATE_READY);
|
||||
}
|
||||
|
||||
void GameObject::Use(Unit* user)
|
||||
|
||||
+27
-14
@@ -368,12 +368,29 @@ struct GameObjectInfo
|
||||
uint32 ScriptId;
|
||||
};
|
||||
|
||||
// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform
|
||||
#if defined( __GNUC__ )
|
||||
#pragma pack()
|
||||
#else
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
struct GameObjectLocale
|
||||
{
|
||||
std::vector<std::string> Name;
|
||||
std::vector<std::string> CastBarCaption;
|
||||
};
|
||||
|
||||
// client side GO show states
|
||||
enum GOState
|
||||
{
|
||||
GO_STATE_ACTIVE = 0, // show in world as used and not reset (closed door open)
|
||||
GO_STATE_READY = 1, // show in world as ready (closed door close)
|
||||
GO_STATE_ACTIVE_ALTERNATIVE = 2 // show in world as used in alt way and not reset (closed door open by cannon fire)
|
||||
};
|
||||
|
||||
#define MAX_GO_STATE 3
|
||||
|
||||
// from `gameobject`
|
||||
struct GameObjectData
|
||||
{
|
||||
@@ -390,18 +407,11 @@ struct GameObjectData
|
||||
float rotation3;
|
||||
int32 spawntimesecs;
|
||||
uint32 animprogress;
|
||||
uint32 go_state;
|
||||
GOState go_state;
|
||||
uint8 spawnMask;
|
||||
uint32 ArtKit;
|
||||
};
|
||||
|
||||
// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform
|
||||
#if defined( __GNUC__ )
|
||||
#pragma pack()
|
||||
#else
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
// For containers: [GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY -> ...
|
||||
// For bobber: GO_NOT_READY ->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED-><deleted>
|
||||
// For door(closed):[GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY(close) -> ...
|
||||
@@ -428,7 +438,7 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject
|
||||
void AddToWorld();
|
||||
void RemoveFromWorld();
|
||||
|
||||
bool Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, uint32 go_state, uint32 ArtKit = 0);
|
||||
bool Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, GOState go_state, uint32 ArtKit = 0);
|
||||
void Update(uint32 p_time);
|
||||
static GameObject* GetGameObject(WorldObject& object, uint64 guid);
|
||||
GameObjectInfo const* GetGOInfo() const;
|
||||
@@ -460,7 +470,6 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject
|
||||
void SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask);
|
||||
bool LoadFromDB(uint32 guid, Map *map);
|
||||
void DeleteFromDB();
|
||||
void SetLootState(LootState s) { m_lootState = s; }
|
||||
static uint32 GetLootId(GameObjectInfo const* info);
|
||||
uint32 GetLootId() const { return GetLootId(GetGOInfo()); }
|
||||
uint32 GetLockId() const
|
||||
@@ -528,8 +537,8 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject
|
||||
void getFishLoot(Loot *loot, Player* loot_owner);
|
||||
GameobjectTypes GetGoType() const { return GameobjectTypes(GetByteValue(GAMEOBJECT_BYTES_1, 1)); }
|
||||
void SetGoType(GameobjectTypes type) { SetByteValue(GAMEOBJECT_BYTES_1, 1, type); }
|
||||
uint8 GetGoState() const { return GetByteValue(GAMEOBJECT_BYTES_1, 0); }
|
||||
void SetGoState(uint8 state) { SetByteValue(GAMEOBJECT_BYTES_1, 0, state); }
|
||||
GOState GetGoState() const { return GOState(GetByteValue(GAMEOBJECT_BYTES_1, 0)); }
|
||||
void SetGoState(GOState state) { SetByteValue(GAMEOBJECT_BYTES_1, 0, state); }
|
||||
uint8 GetGoArtKit() const { return GetByteValue(GAMEOBJECT_BYTES_1, 2); }
|
||||
void SetGoArtKit(uint8 artkit);
|
||||
uint8 GetGoAnimProgress() const { return GetByteValue(GAMEOBJECT_BYTES_1, 3); }
|
||||
@@ -538,6 +547,7 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject
|
||||
void Use(Unit* user);
|
||||
|
||||
LootState getLootState() const { return m_lootState; }
|
||||
void SetLootState(LootState s) { m_lootState = s; }
|
||||
|
||||
void AddToSkillupList(uint32 PlayerGuidLow) { m_SkillupList.push_back(PlayerGuidLow); }
|
||||
bool IsInSkillupList(uint32 PlayerGuidLow) const
|
||||
@@ -561,7 +571,10 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject
|
||||
bool hasQuest(uint32 quest_id) const;
|
||||
bool hasInvolvedQuest(uint32 quest_id) const;
|
||||
bool ActivateToQuest(Player *pTarget) const;
|
||||
void UseDoorOrButton(uint32 time_to_restore = 0); // 0 = use `gameobject`.`spawntimesecs`
|
||||
void UseDoorOrButton(uint32 time_to_restore = 0, bool alternative = false);
|
||||
// 0 = use `gameobject`.`spawntimesecs`
|
||||
void ResetDoorOrButton();
|
||||
// 0 = use `gameobject`.`spawntimesecs`
|
||||
|
||||
uint32 GetLinkedGameObjectEntry() const
|
||||
{
|
||||
@@ -617,7 +630,7 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject
|
||||
uint32 m_DBTableGuid; ///< For new or temporary gameobjects is 0 for saved it is lowguid
|
||||
GameObjectInfo const* m_goInfo;
|
||||
private:
|
||||
void SwitchDoorOrButton(bool activate);
|
||||
void SwitchDoorOrButton(bool activate, bool alternative = false);
|
||||
|
||||
GridReference<GameObject> m_gridRef;
|
||||
};
|
||||
|
||||
@@ -35,7 +35,7 @@ void InstanceData::HandleGameObject(uint64 GUID, bool open, GameObject *go)
|
||||
if(!go)
|
||||
go = instance->GetGameObject(GUID);
|
||||
if(go)
|
||||
go->SetGoState(open ? 0 : 1);
|
||||
go->SetGoState(open ? GO_STATE_ACTIVE : GO_STATE_READY);
|
||||
else
|
||||
debug_log("TSCR: InstanceData: HandleGameObject failed");
|
||||
}
|
||||
|
||||
+1
-1
@@ -786,7 +786,7 @@ bool ChatHandler::HandleGameObjectAddCommand(const char* args)
|
||||
GameObject* pGameObj = new GameObject;
|
||||
uint32 db_lowGUID = objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT);
|
||||
|
||||
if(!pGameObj->Create(db_lowGUID, goI->id, map, chr->GetPhaseMaskForSpawn(), x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, 1))
|
||||
if(!pGameObj->Create(db_lowGUID, goI->id, map, chr->GetPhaseMaskForSpawn(), x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY))
|
||||
{
|
||||
delete pGameObj;
|
||||
return false;
|
||||
|
||||
+1
-1
@@ -3043,7 +3043,7 @@ bool ChatHandler::HandleGameObjectStateCommand(const char* args)
|
||||
if(state < 0)
|
||||
gobj->SendObjectDeSpawnAnim(gobj->GetGUID());
|
||||
else
|
||||
gobj->SetGoState(state);
|
||||
gobj->SetGoState((GOState)state);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
+1
-1
@@ -1826,7 +1826,7 @@ GameObject* WorldObject::SummonGameObject(uint32 entry, float x, float y, float
|
||||
}
|
||||
Map *map = GetMap();
|
||||
GameObject *go = new GameObject();
|
||||
if(!go->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, map, GetPhaseMask(), x,y,z,ang,rotation0,rotation1,rotation2,rotation3,100,1))
|
||||
if(!go->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, map, GetPhaseMask(), x,y,z,ang,rotation0,rotation1,rotation2,rotation3,100,GO_STATE_READY))
|
||||
{
|
||||
delete go;
|
||||
return NULL;
|
||||
|
||||
@@ -1257,8 +1257,16 @@ void ObjectMgr::LoadGameobjects()
|
||||
data.rotation3 = fields[10].GetFloat();
|
||||
data.spawntimesecs = fields[11].GetInt32();
|
||||
data.animprogress = fields[12].GetUInt32();
|
||||
data.go_state = fields[13].GetUInt32();
|
||||
data.ArtKit = 0;
|
||||
|
||||
uint32 go_state = fields[13].GetUInt32();
|
||||
if (go_state >= MAX_GO_STATE)
|
||||
{
|
||||
sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with invalid `state` (%u) value, skip",guid,data.id,go_state);
|
||||
continue;
|
||||
}
|
||||
data.go_state = GOState(go_state);
|
||||
|
||||
data.spawnMask = fields[14].GetUInt8();
|
||||
data.phaseMask = fields[15].GetUInt16();
|
||||
int16 gameEvent = fields[16].GetInt16();
|
||||
|
||||
@@ -3707,19 +3707,19 @@ void AuraEffect::HandleAuraModDisarm(bool apply, bool Real)
|
||||
flag=UNIT_FLAG_DISARMED;
|
||||
slot=EQUIPMENT_SLOT_MAINHAND;
|
||||
attType=BASE_ATTACK;
|
||||
break;
|
||||
break;
|
||||
case SPELL_AURA_MOD_DISARM_OFFHAND:
|
||||
field=UNIT_FIELD_FLAGS_2;
|
||||
flag=UNIT_FLAG2_DISARM_OFFHAND;
|
||||
slot=EQUIPMENT_SLOT_OFFHAND;
|
||||
attType=OFF_ATTACK;
|
||||
break;
|
||||
break;
|
||||
case SPELL_AURA_MOD_DISARM_RANGED:
|
||||
field=UNIT_FIELD_FLAGS_2;
|
||||
flag=UNIT_FLAG2_DISARM_RANGED;
|
||||
slot=EQUIPMENT_SLOT_RANGED;
|
||||
attType=RANGED_ATTACK;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
if(apply)
|
||||
m_target->SetFlag(field, flag);
|
||||
|
||||
@@ -716,7 +716,7 @@ void Spell::EffectDummy(uint32 i)
|
||||
|
||||
if (!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), 181574, creatureTarget->GetMap(), creatureTarget->GetPhaseMask(),
|
||||
creatureTarget->GetPositionX(), creatureTarget->GetPositionY(), creatureTarget->GetPositionZ(),
|
||||
creatureTarget->GetOrientation(), 0, 0, 0, 0, 100, 1))
|
||||
creatureTarget->GetOrientation(), 0, 0, 0, 0, 100, GO_STATE_READY))
|
||||
{
|
||||
delete pGameObj;
|
||||
return;
|
||||
@@ -4450,7 +4450,7 @@ void Spell::EffectSummonObjectWild(uint32 i)
|
||||
Map *map = target->GetMap();
|
||||
|
||||
if(!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), gameobject_id, map,
|
||||
m_caster->GetPhaseMask(), x, y, z, target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, 1))
|
||||
m_caster->GetPhaseMask(), x, y, z, target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY))
|
||||
{
|
||||
delete pGameObj;
|
||||
return;
|
||||
@@ -4498,7 +4498,7 @@ void Spell::EffectSummonObjectWild(uint32 i)
|
||||
{
|
||||
GameObject* linkedGO = new GameObject;
|
||||
if(linkedGO->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), linkedEntry, map,
|
||||
m_caster->GetPhaseMask(), x, y, z, target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, 1))
|
||||
m_caster->GetPhaseMask(), x, y, z, target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY))
|
||||
{
|
||||
linkedGO->SetRespawnTime(duration > 0 ? duration/IN_MILISECONDS : 0);
|
||||
linkedGO->SetSpellId(m_spellInfo->Id);
|
||||
@@ -5261,7 +5261,7 @@ void Spell::EffectDuel(uint32 i)
|
||||
m_caster->GetPositionX()+(unitTarget->GetPositionX()-m_caster->GetPositionX())/2 ,
|
||||
m_caster->GetPositionY()+(unitTarget->GetPositionY()-m_caster->GetPositionY())/2 ,
|
||||
m_caster->GetPositionZ(),
|
||||
m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0, 1))
|
||||
m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY))
|
||||
{
|
||||
delete pGameObj;
|
||||
return;
|
||||
@@ -5564,7 +5564,7 @@ void Spell::EffectSummonObject(uint32 i)
|
||||
|
||||
Map *map = m_caster->GetMap();
|
||||
if(!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), go_id, map,
|
||||
m_caster->GetPhaseMask(), x, y, z, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0, 1))
|
||||
m_caster->GetPhaseMask(), x, y, z, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY))
|
||||
{
|
||||
delete pGameObj;
|
||||
return;
|
||||
@@ -6120,7 +6120,7 @@ void Spell::EffectTransmitted(uint32 effIndex)
|
||||
GameObject* pGameObj = new GameObject;
|
||||
|
||||
if(!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), name_id, cMap,
|
||||
m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, 1))
|
||||
m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY))
|
||||
{
|
||||
delete pGameObj;
|
||||
return;
|
||||
@@ -6187,7 +6187,7 @@ void Spell::EffectTransmitted(uint32 effIndex)
|
||||
{
|
||||
GameObject* linkedGO = new GameObject;
|
||||
if(linkedGO->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), linkedEntry, cMap,
|
||||
m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, 1))
|
||||
m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY))
|
||||
{
|
||||
linkedGO->SetRespawnTime(duration > 0 ? duration/IN_MILISECONDS : 0);
|
||||
//linkedGO->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel() );
|
||||
|
||||
@@ -176,7 +176,7 @@ bool Transport::Create(uint32 guidlow, uint32 mapid, float x, float y, float z,
|
||||
|
||||
SetUInt32Value(GAMEOBJECT_DISPLAYID, goinfo->displayId);
|
||||
|
||||
SetGoState(1);
|
||||
SetGoState(GO_STATE_READY);
|
||||
SetGoType(GameobjectTypes(goinfo->type));
|
||||
|
||||
SetGoAnimProgress(animprogress);
|
||||
|
||||
+4
-4
@@ -2225,18 +2225,18 @@ void World::ScriptsProcess()
|
||||
CellLock<GridReadGuard> cell_lock(cell, p);
|
||||
cell_lock->Visit(cell_lock, object_checker, *MapManager::Instance().GetMap(caster->GetMapId(), (Unit*)source));
|
||||
|
||||
if ( !door )
|
||||
if (!door)
|
||||
{
|
||||
sLog.outError("SCRIPT_COMMAND_OPEN_DOOR failed for gameobject(guid: %u).", step.script->datalong);
|
||||
break;
|
||||
}
|
||||
if ( door->GetGoType() != GAMEOBJECT_TYPE_DOOR )
|
||||
if (door->GetGoType() != GAMEOBJECT_TYPE_DOOR)
|
||||
{
|
||||
sLog.outError("SCRIPT_COMMAND_OPEN_DOOR failed for non-door(GoType: %u).", door->GetGoType());
|
||||
break;
|
||||
}
|
||||
|
||||
if( !door->GetGoState() )
|
||||
if (door->GetGoState() != GO_STATE_READY)
|
||||
break; //door already open
|
||||
|
||||
door->UseDoorOrButton(time_to_close);
|
||||
@@ -2292,7 +2292,7 @@ void World::ScriptsProcess()
|
||||
break;
|
||||
}
|
||||
|
||||
if( door->GetGoState() )
|
||||
if( door->GetGoState() == GO_STATE_READY )
|
||||
break; //door already closed
|
||||
|
||||
door->UseDoorOrButton(time_to_open);
|
||||
|
||||
Reference in new issue
Block a user