feat(Core/Misc): implement ObjectGuid class (port from TC) (#4885)

This commit is contained in:
UltraNix
2021-04-25 22:18:03 +02:00
committed by GitHub
parent 91081f4ad8
commit f4c226423d
568 changed files with 10655 additions and 11019 deletions

View File

@@ -421,7 +421,7 @@ public:
Player* player = who->ToPlayer();
if (player->HasItemCount(ITEM_PORTABLE_BREWFEST_KEG)) // portable brewfest keg
{
player->KilledMonsterCredit(KEG_KILL_CREDIT, 0);
player->KilledMonsterCredit(KEG_KILL_CREDIT);
player->CastSpell(me, SPELL_THROW_KEG, true); // throw keg
player->DestroyItemCount(ITEM_PORTABLE_BREWFEST_KEG, 1, true);
@@ -539,7 +539,7 @@ public:
QuestStatusData& q_status = itr->second;
if (q_status.CreatureOrGOCount[me->GetEntry() - 24202] == 0)
{
player->KilledMonsterCredit(me->GetEntry(), 0);
player->KilledMonsterCredit(me->GetEntry());
player->MonsterSay(GetTextFor(me->GetEntry(), quest).c_str(), LANG_UNIVERSAL, player);
}
}
@@ -949,7 +949,7 @@ public:
}
uint32 timer;
uint64 targetGUID;
ObjectGuid targetGUID;
void EnterCombat(Unit*) override {}
void MoveInLineOfSight(Unit*) override {}
void AttackStart(Unit*) override {}
@@ -1004,7 +1004,7 @@ public:
void Reset() override
{
timer = 0;
targetGUID = 0;
targetGUID.Clear();
me->SetWalk(true);
FindNextKeg();
me->ApplySpellImmune(SPELL_ATTACK_KEG, IMMUNITY_ID, SPELL_ATTACK_KEG, true);
@@ -1225,7 +1225,7 @@ public:
privateLevel++;
}
else if (questTick++ > 3)
caster->ToPlayer()->KilledMonsterCredit(CREDIT_TROT, 0);
caster->ToPlayer()->KilledMonsterCredit(CREDIT_TROT);
break;
case 2:
// Two - three clicks to maintains speed, less to decrease, more to increase
@@ -1242,7 +1242,7 @@ public:
questTick = 0;
}
else if (questTick++ > 3)
caster->ToPlayer()->KilledMonsterCredit(CREDIT_CANTER, 0);
caster->ToPlayer()->KilledMonsterCredit(CREDIT_CANTER);
break;
case 3:
// Four or more clicks to maintains speed, less to decrease
@@ -1253,7 +1253,7 @@ public:
questTick = 0;
}
else if (questTick++ > 3)
caster->ToPlayer()->KilledMonsterCredit(CREDIT_GALLOP, 0);
caster->ToPlayer()->KilledMonsterCredit(CREDIT_GALLOP);
break;
}
@@ -1463,7 +1463,7 @@ public:
{
player->DestroyItemCount(itemCaster->GetEntry(), 1, true);
GetSpell()->m_CastItem = nullptr;
GetSpell()->m_castItemGUID = 0;
GetSpell()->m_castItemGUID.Clear();
}
}
}
@@ -1530,7 +1530,7 @@ public:
{
player->DestroyItemCount(itemCaster->GetEntry(), 1, true);
GetSpell()->m_CastItem = nullptr;
GetSpell()->m_castItemGUID = 0;
GetSpell()->m_castItemGUID.Clear();
}
}
}

View File

@@ -120,13 +120,13 @@ enum Misc
DISPLAY_INVISIBLE = 11686,
};
uint64 getOrphanGUID(Player* player, uint32 orphan)
ObjectGuid getOrphanGUID(Player* player, uint32 orphan)
{
if (Aura* orphanOut = player->GetAura(SPELL_ORPHAN_OUT))
if (orphanOut->GetCaster() && orphanOut->GetCaster()->GetEntry() == orphan)
return orphanOut->GetCaster()->GetGUID();
return 0;
return ObjectGuid::Empty;
}
/*######
@@ -145,8 +145,8 @@ public:
{
timer = 0;
phase = 0;
playerGUID = 0;
orphanGUID = 0;
playerGUID.Clear();
orphanGUID.Clear();
}
void MoveInLineOfSight(Unit* who) override
@@ -216,8 +216,8 @@ public:
private:
uint32 timer;
int8 phase;
uint64 playerGUID;
uint64 orphanGUID;
ObjectGuid playerGUID;
ObjectGuid orphanGUID;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -242,8 +242,8 @@ public:
{
timer = 0;
phase = 0;
playerGUID = 0;
orphanGUID = 0;
playerGUID.Clear();
orphanGUID.Clear();
}
void MoveInLineOfSight(Unit* who) override
@@ -313,8 +313,8 @@ public:
private:
uint32 timer;
int8 phase;
uint64 playerGUID;
uint64 orphanGUID;
ObjectGuid playerGUID;
ObjectGuid orphanGUID;
};
CreatureAI* GetAI(Creature* pCreature) const override
@@ -342,8 +342,8 @@ public:
{
timer = 1000;
phase = 0;
playerGUID = 0;
orphanGUID = 0;
playerGUID.Clear();
orphanGUID.Clear();
}
void MoveInLineOfSight(Unit* who) override
@@ -401,8 +401,8 @@ public:
private:
uint32 timer;
uint8 phase;
uint64 playerGUID;
uint64 orphanGUID;
ObjectGuid playerGUID;
ObjectGuid orphanGUID;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -427,8 +427,8 @@ public:
{
timer = 0;
phase = 0;
playerGUID = 0;
orphanGUID = 0;
playerGUID.Clear();
orphanGUID.Clear();
}
void MoveInLineOfSight(Unit* who) override
@@ -488,8 +488,8 @@ public:
private:
uint32 timer;
int8 phase;
uint64 playerGUID;
uint64 orphanGUID;
ObjectGuid playerGUID;
ObjectGuid orphanGUID;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -514,8 +514,8 @@ public:
{
timer = 0;
phase = 0;
playerGUID = 0;
orphanGUID = 0;
playerGUID.Clear();
orphanGUID.Clear();
}
void MoveInLineOfSight(Unit* who) override
@@ -574,8 +574,8 @@ public:
private:
uint32 timer;
int8 phase;
uint64 playerGUID;
uint64 orphanGUID;
ObjectGuid playerGUID;
ObjectGuid orphanGUID;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -601,8 +601,8 @@ public:
{
timer = 0;
phase = 0;
playerGUID = 0;
orphanGUID = 0;
playerGUID.Clear();
orphanGUID.Clear();
}
void MoveInLineOfSight(Unit* who) override
@@ -669,8 +669,8 @@ public:
private:
uint32 timer;
int8 phase;
uint64 playerGUID;
uint64 orphanGUID;
ObjectGuid playerGUID;
ObjectGuid orphanGUID;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -695,8 +695,8 @@ public:
{
timer = 0;
phase = 0;
playerGUID = 0;
orphanGUID = 0;
playerGUID.Clear();
orphanGUID.Clear();
}
void SetData(uint32 type, uint32 data) override
@@ -828,8 +828,8 @@ public:
private:
int8 phase;
uint32 timer;
uint64 playerGUID;
uint64 orphanGUID;
ObjectGuid playerGUID;
ObjectGuid orphanGUID;
};
CreatureAI* GetAI(Creature* creature) const override

View File

@@ -368,13 +368,13 @@ public:
uint32 eventStarted;
bool allowQuest;
uint64 horseGUID;
ObjectGuid horseGUID;
void Reset() override
{
eventStarted = 0;
allowQuest = false;
horseGUID = 0;
horseGUID.Clear();
}
void GetInitXYZ(float& x, float& y, float& z, float& o, uint32& path)
@@ -606,7 +606,7 @@ public:
bool Unmount;
EventMap events;
uint32 counter;
std::list<uint64> unitList;
GuidList unitList;
int32 pos;
void EnterCombat(Unit*) override {}
void MoveInLineOfSight(Unit* /*who*/) override {}
@@ -699,8 +699,8 @@ public:
if (counter > 12)
{
bool failed = false;
for (std::list<uint64>::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
if (Unit* c = ObjectAccessor::GetUnit(*me, *itr))
for (ObjectGuid const guid : unitList)
if (Unit* c = ObjectAccessor::GetUnit(*me, guid))
if (c->HasAuraType(SPELL_AURA_PERIODIC_DUMMY))
{
failed = true;
@@ -753,8 +753,8 @@ public:
Unit* getTrigger()
{
std::list<Unit*> tmpList;
for (std::list<uint64>::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
if (Unit* c = ObjectAccessor::GetUnit(*me, *itr))
for (ObjectGuid const guid : unitList)
if (Unit* c = ObjectAccessor::GetUnit(*me, guid))
if (!c->HasAuraType(SPELL_AURA_PERIODIC_DUMMY))
tmpList.push_back(c);
@@ -772,8 +772,8 @@ public:
{
me->MonsterYell("Fire consumes! You've tried and failed. Let there be no doubt, justice prevailed!", LANG_UNIVERSAL, 0);
me->PlayDirectSound(11967);
for (std::list<uint64>::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
if (Unit* c = ObjectAccessor::GetUnit(*me, *itr))
for (ObjectGuid const guid : unitList)
if (Unit* c = ObjectAccessor::GetUnit(*me, guid))
c->RemoveAllAuras();
me->DespawnOrUnsummon(1);
@@ -867,7 +867,7 @@ public:
else
me->RemoveAllAuras();
caster->ToPlayer()->KilledMonsterCredit(me->GetEntry(), 0);
caster->ToPlayer()->KilledMonsterCredit(me->GetEntry());
}
}
}
@@ -954,7 +954,7 @@ public:
EventMap events;
SummonList summons;
uint64 playerGUID;
ObjectGuid playerGUID;
uint8 talkCount;
bool inFight;
uint8 phase;
@@ -1079,7 +1079,7 @@ public:
{
events.Reset();
summons.DespawnAll();
playerGUID = 0;
playerGUID.Clear();
talkCount = 0;
phase = 0;
inFight = false;

View File

@@ -571,7 +571,7 @@ public:
void PeriodicTick(AuraEffect const* /*aurEff*/)
{
uint64 guid = (GetCaster() ? GetCaster()->GetGUID() : 0);
ObjectGuid guid = GetCaster() ? GetCaster()->GetGUID() : ObjectGuid::Empty;
if (Unit* target = GetTarget())
{
uint32 spellId = (GetId() == SPELL_THROW_COLOGNE ? 68934 : 68927);

View File

@@ -40,7 +40,7 @@ public:
npc_midsummer_bonfireAI(Creature* c) : ScriptedAI(c)
{
me->IsAIEnabled = true;
goGUID = 0;
goGUID.Clear();
if (GameObject* go = me->SummonGameObject(GO_MIDSUMMER_BONFIRE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0))
{
goGUID = go->GetGUID();
@@ -48,7 +48,7 @@ public:
}
}
uint64 goGUID;
ObjectGuid goGUID;
void SpellHit(Unit*, SpellInfo const* spellInfo) override
{
@@ -90,20 +90,20 @@ public:
teleTimer = 0;
startTimer = 1;
posVec.clear();
playerGUID = 0;
playerGUID.Clear();
me->CastSpell(me, 43313, true);
counter = 0;
maxCount = 0;
}
uint64 playerGUID;
ObjectGuid playerGUID;
uint32 startTimer;
uint32 teleTimer;
std::vector<Position> posVec;
uint8 counter;
uint8 maxCount;
void SetPlayerGUID(uint64 guid, uint8 cnt)
void SetPlayerGUID(ObjectGuid guid, uint8 cnt)
{
playerGUID = guid;
maxCount = cnt;
@@ -330,11 +330,11 @@ public:
bool Load() override
{
torchGUID = 0;
torchGUID.Clear();
return true;
}
uint64 torchGUID;
ObjectGuid torchGUID;
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{

View File

@@ -96,7 +96,7 @@ public:
{
npc_pilgrims_bounty_chairAI(Creature* creature) : VehicleAI(creature)
{
plateGUID = 0;
plateGUID.Clear();
timerSpawnPlate = 1;
timerRotateChair = 0;
me->SetReactState(REACT_PASSIVE);
@@ -111,7 +111,7 @@ public:
who->ToPlayer()->SetClientControl(me, 0, true);
}
uint64 plateGUID;
ObjectGuid plateGUID;
uint32 timerSpawnPlate;
uint32 timerRotateChair;