mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-17 02:50:29 +00:00
feat(Core/Misc): implement ObjectGuid class (port from TC) (#4885)
This commit is contained in:
@@ -194,7 +194,7 @@ public:
|
||||
|
||||
// We declare all the required variables
|
||||
uint32 playerGuid = player->GetSession()->GetAccountId();
|
||||
uint32 characterGuid = player->GetGUIDLow();
|
||||
ObjectGuid::LowType characterGuid = player->GetGUID().GetCounter();
|
||||
const std::string currentIp = player->GetSession()->GetRemoteAddress();
|
||||
std::string systemNote = "ERROR"; // "ERROR" is a placeholder here. We change it...
|
||||
|
||||
@@ -245,18 +245,18 @@ public:
|
||||
CharacterDeleteActionIpLogger() : PlayerScript("CharacterDeleteActionIpLogger") { }
|
||||
|
||||
// CHARACTER_DELETE = 10
|
||||
void OnDelete(uint64 guid, uint32 accountId) override
|
||||
void OnDelete(ObjectGuid guid, uint32 accountId) override
|
||||
{
|
||||
DeleteIPLogAction(guid, accountId, CHARACTER_DELETE);
|
||||
}
|
||||
|
||||
// CHARACTER_FAILED_DELETE = 11
|
||||
void OnFailedDelete(uint64 guid, uint32 accountId) override
|
||||
void OnFailedDelete(ObjectGuid guid, uint32 accountId) override
|
||||
{
|
||||
DeleteIPLogAction(guid, accountId, CHARACTER_FAILED_DELETE);
|
||||
}
|
||||
|
||||
void DeleteIPLogAction(uint64 guid, uint32 playerGuid, IPLoggingTypes aType)
|
||||
void DeleteIPLogAction(ObjectGuid guid, ObjectGuid::LowType playerGuid, IPLoggingTypes aType)
|
||||
{
|
||||
if (!sWorld->getBoolConfig(CONFIG_IP_BASED_ACTION_LOGGING))
|
||||
return;
|
||||
@@ -265,7 +265,7 @@ public:
|
||||
// Else, this script isn't loaded in the first place: We require no config check.
|
||||
|
||||
// We declare all the required variables
|
||||
uint32 characterGuid = GUID_LOPART(guid); // We have no access to any member function of Player* or WorldSession*. So use old-fashioned way.
|
||||
ObjectGuid::LowType characterGuid = guid.GetCounter(); // We have no access to any member function of Player* or WorldSession*. So use old-fashioned way.
|
||||
// Query playerGuid/accountId, as we only have characterGuid
|
||||
std::string systemNote = "ERROR"; // "ERROR" is a placeholder here. We change it later.
|
||||
|
||||
|
||||
@@ -390,7 +390,7 @@ public:
|
||||
|
||||
struct npc_spirit_shadeAI : public PassiveAI
|
||||
{
|
||||
npc_spirit_shadeAI(Creature* creature) : PassiveAI(creature), _summonerGuid(0)
|
||||
npc_spirit_shadeAI(Creature* creature) : PassiveAI(creature)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -405,7 +405,7 @@ public:
|
||||
|
||||
void MovementInform(uint32 moveType, uint32 data) override
|
||||
{
|
||||
if (moveType == FOLLOW_MOTION_TYPE && data == _summonerGuid)
|
||||
if (moveType == FOLLOW_MOTION_TYPE && data == _summonerGuid.GetCounter())
|
||||
{
|
||||
me->CastSpell((Unit*)nullptr, SPELL_DARK_OFFERING, false);
|
||||
me->DespawnOrUnsummon(1000);
|
||||
@@ -413,7 +413,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
uint64 _summonerGuid;
|
||||
ObjectGuid _summonerGuid;
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
|
||||
@@ -311,7 +311,7 @@ public:
|
||||
GetCreatureListWithEntryInGrid(cList, go, NPC_WINTERFIN_TADPOLE, 5.0f);
|
||||
for (std::list<Creature*>::const_iterator itr = cList.begin(); itr != cList.end(); ++itr)
|
||||
{
|
||||
player->KilledMonsterCredit(NPC_WINTERFIN_TADPOLE, 0);
|
||||
player->KilledMonsterCredit(NPC_WINTERFIN_TADPOLE);
|
||||
(*itr)->DespawnOrUnsummon(urand(45000, 60000));
|
||||
(*itr)->GetMotionMaster()->MoveFollow(player, 1.0f, frand(0.0f, 2 * M_PI), MOTION_SLOT_CONTROLLED);
|
||||
}
|
||||
@@ -1247,7 +1247,7 @@ public:
|
||||
return false;
|
||||
|
||||
pPrisoner->DespawnOrUnsummon();
|
||||
player->KilledMonsterCredit(NPC_EBON_BLADE_PRISONER_HUMAN, 0);
|
||||
player->KilledMonsterCredit(NPC_EBON_BLADE_PRISONER_HUMAN);
|
||||
switch (pPrisoner->GetEntry())
|
||||
{
|
||||
case NPC_EBON_BLADE_PRISONER_HUMAN:
|
||||
@@ -1486,7 +1486,7 @@ public:
|
||||
if (qInfo)
|
||||
{
|
||||
/// @todo prisoner should help player for a short period of time
|
||||
player->KilledMonsterCredit(qInfo->RequiredNpcOrGo[0], 0);
|
||||
player->KilledMonsterCredit(qInfo->RequiredNpcOrGo[0]);
|
||||
pPrisoner->DisappearAndDie();
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
{
|
||||
banishTimer = 5000;
|
||||
exileTimer = 8500;
|
||||
playerGUID = 0;
|
||||
playerGUID.Clear();
|
||||
canTeleport = false;
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
temp->CastSpell(temp, SPELL_EXILE, true);
|
||||
temp->CastSpell(temp, SPELL_BANISH_TELEPORT, true);
|
||||
}
|
||||
playerGUID = 0;
|
||||
playerGUID.Clear();
|
||||
exileTimer = 8500;
|
||||
canTeleport = false;
|
||||
}
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
private:
|
||||
uint32 exileTimer;
|
||||
uint32 banishTimer;
|
||||
uint64 playerGUID;
|
||||
ObjectGuid playerGUID;
|
||||
bool canTeleport;
|
||||
};
|
||||
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
{
|
||||
banishTimer = 5000;
|
||||
exileTimer = 8500;
|
||||
playerGUID = 0;
|
||||
playerGUID.Clear();
|
||||
canTeleport = false;
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ public:
|
||||
temp->CastSpell(temp, SPELL_EXILE, true);
|
||||
temp->CastSpell(temp, SPELL_BANISH_TELEPORT, true);
|
||||
}
|
||||
playerGUID = 0;
|
||||
playerGUID.Clear();
|
||||
exileTimer = 8500;
|
||||
canTeleport = false;
|
||||
}
|
||||
@@ -154,7 +154,7 @@ public:
|
||||
private:
|
||||
uint32 exileTimer;
|
||||
uint32 banishTimer;
|
||||
uint64 playerGUID;
|
||||
ObjectGuid playerGUID;
|
||||
bool canTeleport;
|
||||
};
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user