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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
568 changed files with 10655 additions and 11019 deletions

View file

@ -488,7 +488,7 @@ public:
npc_air_force_botsAI(Creature* creature) : ScriptedAI(creature)
{
SpawnAssoc = nullptr;
SpawnedGUID = 0;
SpawnedGUID.Clear();
// find the correct spawnhandling
static uint32 entryCount = sizeof(spawnAssociations) / sizeof(SpawnAssociation);
@ -518,7 +518,7 @@ public:
}
SpawnAssociation* SpawnAssoc;
uint64 SpawnedGUID;
ObjectGuid SpawnedGUID;
void Reset() override {}
@ -561,11 +561,11 @@ public:
if (!playerTarget)
return;
Creature* lastSpawnedGuard = SpawnedGUID == 0 ? nullptr : GetSummonedGuard();
Creature* lastSpawnedGuard = !SpawnedGUID ? nullptr : GetSummonedGuard();
// prevent calling ObjectAccessor::GetUnit at next MoveInLineOfSight call - speedup
if (!lastSpawnedGuard)
SpawnedGUID = 0;
SpawnedGUID.Clear();
switch (SpawnAssoc->spawnType)
{
@ -892,7 +892,7 @@ public:
{
npc_doctorAI(Creature* creature) : ScriptedAI(creature) { }
uint64 PlayerGUID;
ObjectGuid PlayerGUID;
uint32 SummonPatientTimer;
uint32 SummonPatientCount;
@ -901,12 +901,12 @@ public:
bool Event;
std::list<uint64> Patients;
GuidList Patients;
std::vector<Location*> Coordinates;
void Reset() override
{
PlayerGUID = 0;
PlayerGUID.Clear();
SummonPatientTimer = 10000;
SummonPatientCount = 0;
@ -983,10 +983,9 @@ public:
{
if (!Patients.empty())
{
std::list<uint64>::const_iterator itr;
for (itr = Patients.begin(); itr != Patients.end(); ++itr)
for (ObjectGuid const guid : Patients)
{
if (Creature* patient = ObjectAccessor::GetCreature((*me), *itr))
if (Creature* patient = ObjectAccessor::GetCreature(*me, guid))
patient->setDeathState(JUST_DIED);
}
}
@ -1037,12 +1036,12 @@ public:
{
npc_injured_patientAI(Creature* creature) : ScriptedAI(creature) { }
uint64 DoctorGUID;
ObjectGuid DoctorGUID;
Location* Coord;
void Reset() override
{
DoctorGUID = 0;
DoctorGUID.Clear();
Coord = nullptr;
//no select
@ -1236,7 +1235,7 @@ public:
Reset();
}
uint64 CasterGUID;
ObjectGuid CasterGUID;
bool IsHealed;
bool CanRun;
@ -1245,7 +1244,7 @@ public:
void Reset() override
{
CasterGUID = 0;
CasterGUID.Clear();
IsHealed = false;
CanRun = false;
@ -1393,7 +1392,7 @@ public:
break;
}
Start(false, true, true);
Start(false, true);
}
else
EnterEvadeMode(); //something went wrong
@ -2321,12 +2320,12 @@ public:
uint32 jumpTimer;
uint32 bunnyTimer;
uint32 searchTimer;
uint64 rabbitGUID;
ObjectGuid rabbitGUID;
void Reset() override
{
inLove = false;
rabbitGUID = 0;
rabbitGUID.Clear();
jumpTimer = urand(5000, 10000);
bunnyTimer = urand(10000, 20000);
searchTimer = urand(5000, 10000);