mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-30 17:13:47 +00:00
feat(Core/Misc): implement ObjectGuid class (port from TC) (#4885)
This commit is contained in:
@@ -395,7 +395,7 @@ public:
|
||||
{
|
||||
PreventHitEffect(effIndex);
|
||||
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
|
||||
if (Creature* alar = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(NPC_ALAR)))
|
||||
if (Creature* alar = ObjectAccessor::GetCreature(*GetCaster(), instance->GetGuidData(NPC_ALAR)))
|
||||
Unit::DealDamage(GetCaster(), alar, alar->CountPctFromMaxHealth(2));
|
||||
}
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ public:
|
||||
void PrepareAdvisors()
|
||||
{
|
||||
for (uint8 i = DATA_KAEL_ADVISOR1; i <= DATA_KAEL_ADVISOR4; ++i)
|
||||
if (Creature* advisor = ObjectAccessor::GetCreature(*me, instance->GetData64(i)))
|
||||
if (Creature* advisor = ObjectAccessor::GetCreature(*me, instance->GetGuidData(i)))
|
||||
{
|
||||
advisor->Respawn(true);
|
||||
advisor->StopMovingOnCurrentPos();
|
||||
@@ -198,7 +198,7 @@ public:
|
||||
{
|
||||
for (SummonList::const_iterator i = summons.begin(); i != summons.end(); ++i)
|
||||
if (Creature* summon = ObjectAccessor::GetCreature(*me, *i))
|
||||
if (summon->GetDBTableGUIDLow())
|
||||
if (summon->GetSpawnId())
|
||||
{
|
||||
summon->SetReactState(REACT_PASSIVE);
|
||||
summon->setDeathState(JUST_RESPAWNED);
|
||||
@@ -209,11 +209,11 @@ public:
|
||||
|
||||
void SetRoomState(GOState state)
|
||||
{
|
||||
if (GameObject* window = ObjectAccessor::GetGameObject(*me, instance->GetData64(GO_BRIDGE_WINDOW)))
|
||||
if (GameObject* window = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_BRIDGE_WINDOW)))
|
||||
window->SetGoState(state);
|
||||
if (GameObject* window = ObjectAccessor::GetGameObject(*me, instance->GetData64(GO_KAEL_STATUE_RIGHT)))
|
||||
if (GameObject* window = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_KAEL_STATUE_RIGHT)))
|
||||
window->SetGoState(state);
|
||||
if (GameObject* window = ObjectAccessor::GetGameObject(*me, instance->GetData64(GO_KAEL_STATUE_LEFT)))
|
||||
if (GameObject* window = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_KAEL_STATUE_LEFT)))
|
||||
window->SetGoState(state);
|
||||
}
|
||||
|
||||
@@ -273,11 +273,11 @@ public:
|
||||
if (phase == PHASE_FINAL)
|
||||
return;
|
||||
|
||||
if (summon->GetDBTableGUIDLow() && phase == PHASE_ALL_ADVISORS)
|
||||
if (summon->GetSpawnId() && phase == PHASE_ALL_ADVISORS)
|
||||
{
|
||||
for (SummonList::const_iterator i = summons.begin(); i != summons.end(); ++i)
|
||||
if (Creature* summon = ObjectAccessor::GetCreature(*me, *i))
|
||||
if (summon->GetDBTableGUIDLow() && summon->IsAlive())
|
||||
if (summon->GetSpawnId() && summon->IsAlive())
|
||||
return;
|
||||
|
||||
events2.ScheduleEvent(EVENT_PREFIGHT_PHASE71, 2000);
|
||||
@@ -434,7 +434,7 @@ public:
|
||||
for (SummonList::const_iterator i = summons.begin(); i != summons.end(); ++i)
|
||||
{
|
||||
if (Creature* summon = ObjectAccessor::GetCreature(*me, *i))
|
||||
if (!summon->GetDBTableGUIDLow())
|
||||
if (!summon->GetSpawnId())
|
||||
{
|
||||
summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE);
|
||||
summon->SetInCombatWithZone();
|
||||
@@ -456,7 +456,7 @@ public:
|
||||
case EVENT_PREFIGHT_PHASE63:
|
||||
for (SummonList::const_iterator i = summons.begin(); i != summons.end(); ++i)
|
||||
if (Creature* summon = ObjectAccessor::GetCreature(*me, *i))
|
||||
if (summon->GetDBTableGUIDLow())
|
||||
if (summon->GetSpawnId())
|
||||
{
|
||||
summon->SetReactState(REACT_AGGRESSIVE);
|
||||
summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||
@@ -486,19 +486,19 @@ public:
|
||||
events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000);
|
||||
break;
|
||||
case EVENT_SCENE_1:
|
||||
me->SetTarget(0);
|
||||
me->SetTarget();
|
||||
me->SetFacingTo(M_PI);
|
||||
me->SetWalk(true);
|
||||
Talk(SAY_PHASE5_NUTS);
|
||||
break;
|
||||
case EVENT_SCENE_2:
|
||||
me->SetTarget(0);
|
||||
me->SetTarget();
|
||||
me->CastSpell(me, SPELL_KAEL_EXPLODES1, true);
|
||||
me->CastSpell(me, SPELL_KAEL_GAINING_POWER, false);
|
||||
me->SetDisableGravity(true);
|
||||
break;
|
||||
case EVENT_SCENE_3:
|
||||
me->SetTarget(0);
|
||||
me->SetTarget();
|
||||
for (uint8 i = 0; i < 2; ++i)
|
||||
if (Creature* trigger = me->SummonCreature(WORLD_TRIGGER, triggersPos[i], TEMPSUMMON_TIMED_DESPAWN, 60000))
|
||||
trigger->CastSpell(me, SPELL_NETHERBEAM1 + i, false);
|
||||
@@ -506,7 +506,7 @@ public:
|
||||
me->CastSpell(me, SPELL_GROW, true);
|
||||
break;
|
||||
case EVENT_SCENE_4:
|
||||
me->SetTarget(0);
|
||||
me->SetTarget();
|
||||
me->CastSpell(me, SPELL_GROW, true);
|
||||
me->CastSpell(me, SPELL_KAEL_EXPLODES2, true);
|
||||
me->CastSpell(me, SPELL_NETHERBEAM_AURA1, true);
|
||||
@@ -515,7 +515,7 @@ public:
|
||||
trigger->CastSpell(me, SPELL_NETHERBEAM1 + i, false);
|
||||
break;
|
||||
case EVENT_SCENE_5:
|
||||
me->SetTarget(0);
|
||||
me->SetTarget();
|
||||
me->CastSpell(me, SPELL_GROW, true);
|
||||
me->CastSpell(me, SPELL_KAEL_EXPLODES3, true);
|
||||
me->CastSpell(me, SPELL_NETHERBEAM_AURA2, true);
|
||||
@@ -676,7 +676,7 @@ public:
|
||||
events.ScheduleEvent(EVENT_SPELL_NETHER_VAPOR, 0);
|
||||
me->CastSpell(me, SPELL_SHOCK_BARRIER, false);
|
||||
me->CastSpell(me, SPELL_GRAVITY_LAPSE, false);
|
||||
me->SetTarget(0);
|
||||
me->SetTarget();
|
||||
me->GetMotionMaster()->Clear();
|
||||
me->StopMoving();
|
||||
Talk(SAY_GRAVITYLAPSE);
|
||||
@@ -723,7 +723,7 @@ public:
|
||||
{
|
||||
if (GetCaster()->GetTypeId() == TYPEID_UNIT)
|
||||
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
|
||||
if (Creature* kael = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(NPC_KAELTHAS)))
|
||||
if (Creature* kael = ObjectAccessor::GetCreature(*GetCaster(), instance->GetGuidData(NPC_KAELTHAS)))
|
||||
kael->AI()->SummonedCreatureDies(GetCaster()->ToCreature(), nullptr);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -15,28 +15,19 @@ public:
|
||||
{
|
||||
instance_the_eye_InstanceMapScript(Map* map) : InstanceScript(map) {}
|
||||
|
||||
uint64 ThaladredTheDarkenerGUID;
|
||||
uint64 LordSanguinarGUID;
|
||||
uint64 GrandAstromancerCapernianGUID;
|
||||
uint64 MasterEngineerTelonicusGUID;
|
||||
uint64 AlarGUID;
|
||||
uint64 KaelthasGUID;
|
||||
uint64 BridgeWindowGUID;
|
||||
uint64 KaelStateRightGUID;
|
||||
uint64 KaelStateLeftGUID;
|
||||
ObjectGuid ThaladredTheDarkenerGUID;
|
||||
ObjectGuid LordSanguinarGUID;
|
||||
ObjectGuid GrandAstromancerCapernianGUID;
|
||||
ObjectGuid MasterEngineerTelonicusGUID;
|
||||
ObjectGuid AlarGUID;
|
||||
ObjectGuid KaelthasGUID;
|
||||
ObjectGuid BridgeWindowGUID;
|
||||
ObjectGuid KaelStateRightGUID;
|
||||
ObjectGuid KaelStateLeftGUID;
|
||||
|
||||
void Initialize() override
|
||||
{
|
||||
SetBossNumber(MAX_ENCOUNTER);
|
||||
AlarGUID = 0;
|
||||
KaelthasGUID = 0;
|
||||
ThaladredTheDarkenerGUID = 0;
|
||||
LordSanguinarGUID = 0;
|
||||
GrandAstromancerCapernianGUID = 0;
|
||||
MasterEngineerTelonicusGUID = 0;
|
||||
BridgeWindowGUID = 0;
|
||||
KaelStateRightGUID = 0;
|
||||
KaelStateLeftGUID = 0;
|
||||
}
|
||||
|
||||
void OnCreatureCreate(Creature* creature) override
|
||||
@@ -80,7 +71,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
uint64 GetData64(uint32 identifier) const override
|
||||
ObjectGuid GetGuidData(uint32 identifier) const override
|
||||
{
|
||||
switch (identifier)
|
||||
{
|
||||
@@ -103,7 +94,8 @@ public:
|
||||
case DATA_KAEL_ADVISOR4:
|
||||
return MasterEngineerTelonicusGUID;
|
||||
}
|
||||
return 0;
|
||||
|
||||
return ObjectGuid::Empty;
|
||||
}
|
||||
|
||||
std::string GetSaveData() override
|
||||
|
||||
Reference in New Issue
Block a user