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

@@ -1294,7 +1294,7 @@ public:
class CorpseExplosionCheck
{
public:
explicit CorpseExplosionCheck(uint64 casterGUID, bool allowGhoul) : _casterGUID(casterGUID), _allowGhoul(allowGhoul) { }
explicit CorpseExplosionCheck(ObjectGuid casterGUID, bool allowGhoul) : _casterGUID(casterGUID), _allowGhoul(allowGhoul) { }
bool operator()(WorldObject* obj) const
{
@@ -1310,7 +1310,7 @@ public:
}
private:
uint64 _casterGUID;
ObjectGuid _casterGUID;
bool _allowGhoul;
};
@@ -2373,12 +2373,12 @@ public:
{
PrepareSpellScript(spell_dk_scourge_strike_SpellScript);
float multiplier;
uint64 guid;
ObjectGuid guid;
bool Load() override
{
multiplier = 1.0f;
guid = 0;
guid.Clear();
return true;
}

View File

@@ -194,7 +194,7 @@ public:
}
if (entry)
target->ToPlayer()->KilledMonsterCredit(entry, 0);
target->ToPlayer()->KilledMonsterCredit(entry);
}
}
@@ -2373,7 +2373,7 @@ public:
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
// Remove all auras with spell id 46221, except the one currently being applied
while (Aura* aur = GetUnitOwner()->GetOwnedAura(SPELL_ANIMAL_BLOOD, 0, 0, 0, GetAura()))
while (Aura* aur = GetUnitOwner()->GetOwnedAura(SPELL_ANIMAL_BLOOD, ObjectGuid::Empty, ObjectGuid::Empty, 0, GetAura()))
GetUnitOwner()->RemoveOwnedAura(aur);
}
@@ -3148,7 +3148,7 @@ public:
if (Unit* target = GetHitUnit())
{
WorldPacket data(SMSG_SPIRIT_HEALER_CONFIRM, 8);
data << uint64(target->GetGUID());
data << target->GetGUID();
originalCaster->GetSession()->SendPacket(&data);
}
}
@@ -4549,7 +4549,7 @@ public:
target->SetTemporaryUnsummonedPetNumber(0);
// Prevent stacking of mounts and client crashes upon dismounting
target->RemoveAurasByType(SPELL_AURA_MOUNTED, 0, GetHitAura());
target->RemoveAurasByType(SPELL_AURA_MOUNTED, ObjectGuid::Empty, GetHitAura());
// Triggered spell id dependent on riding skill and zone
bool canFly = false;
@@ -5096,7 +5096,7 @@ public:
bool instant_exit = true;
if (Player* pCaster = caster->ToPlayer()) // if is a creature instant exits combat, else check if someone in party is in combat in visibility distance
{
uint64 myGUID = pCaster->GetGUID();
ObjectGuid myGUID = pCaster->GetGUID();
float visibilityRange = pCaster->GetMap()->GetVisibilityRange();
if (Group* pGroup = pCaster->GetGroup())
{

View File

@@ -205,7 +205,7 @@ public:
if (Player* target = GetHitPlayer())
{
target->KilledMonsterCredit(29579, 0); // Brann's entry
target->KilledMonsterCredit(29579); // Brann's entry
target->CastSpell(target, 55038, true); // Brann summoning spell
}
}

View File

@@ -549,7 +549,7 @@ public:
void FilterTargets(std::list<WorldObject*>& unitList)
{
unitList.remove_if(acore::ObjectGUIDCheck(GetCaster()->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT), true));
unitList.remove_if(acore::ObjectGUIDCheck(GetCaster()->GetGuidValue(UNIT_FIELD_CHANNEL_OBJECT), true));
}
void Register() override

View File

@@ -64,7 +64,7 @@ public:
{
Player* player = GetCaster()->ToPlayer();
player->KilledMonsterCredit(23343, 0);
player->KilledMonsterCredit(23343);
if (Creature* cr = GetCaster()->SummonCreature(23343, ar->GetPositionX(), ar->GetPositionY(), ar->GetPositionZ(), ar->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 180000))
{
cr->CastSpell(player, 40926, true);
@@ -241,7 +241,7 @@ public:
if (Unit* target = GetHitUnit())
if (Unit* owner = target->ToTempSummon()->GetSummoner())
if (owner->GetTypeId() == TYPEID_PLAYER)
owner->ToPlayer()->KilledMonsterCredit(23327, 0); // Some trigger, just count
owner->ToPlayer()->KilledMonsterCredit(23327); // Some trigger, just count
}
void Register() override
@@ -348,12 +348,12 @@ public:
void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (Creature* target = GetHitCreature())
if (target->GetDBTableGUIDLow() == 77757 || target->GetDBTableGUIDLow() == 78693)
if (target->GetSpawnId() == 77757 || target->GetSpawnId() == 78693)
{
count++;
if (count == 2)
if (GetCaster() && GetCaster()->ToPlayer())
GetCaster()->ToPlayer()->KilledMonsterCredit(22383, 0);
GetCaster()->ToPlayer()->KilledMonsterCredit(22383);
}
}
@@ -382,7 +382,7 @@ public:
{
if (GetCaster() && GetHitUnit())
if (Player* player = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself())
player->KilledMonsterCredit(GetHitUnit()->GetEntry(), 0);
player->KilledMonsterCredit(GetHitUnit()->GetEntry());
}
void Register() override
@@ -536,7 +536,7 @@ public:
if (Unit* target = GetHitUnit())
if (Player* player = target->GetCharmerOrOwnerPlayerOrPlayerItself())
if (player->HasAura(38224))
player->KilledMonsterCredit(22051, 0);
player->KilledMonsterCredit(22051);
}
void Register() override
@@ -1201,7 +1201,7 @@ public:
{
creatureTarget->UpdateEntry(newEntry);
creatureTarget->DespawnOrUnsummon(DESPAWN_TIME);
caster->KilledMonsterCredit(newEntry, 0);
caster->KilledMonsterCredit(newEntry);
}
}
}
@@ -1738,7 +1738,7 @@ public:
if (Creature* target = GetHitCreature())
{
caster->CastSpell(caster, SPELL_TRIGGER_AID_OF_THE_EARTHEN, true, nullptr);
caster->KilledMonsterCredit(NPC_FALLEN_EARTHEN_DEFENDER, 0);
caster->KilledMonsterCredit(NPC_FALLEN_EARTHEN_DEFENDER);
target->DespawnOrUnsummon();
}
}
@@ -1872,7 +1872,7 @@ public:
if (Creature* target = GetHitCreature())
{
target->DespawnOrUnsummon();
caster->KilledMonsterCredit(NPC_SCALPS_KC_BUNNY, 0);
caster->KilledMonsterCredit(NPC_SCALPS_KC_BUNNY);
}
}
@@ -1916,7 +1916,7 @@ public:
if (Creature* target = GetHitCreature())
if (target && !target->HasAura(SPELL_FLAMES))
{
caster->KilledMonsterCredit(NPC_VILLAGER_KILL_CREDIT, 0);
caster->KilledMonsterCredit(NPC_VILLAGER_KILL_CREDIT);
target->CastSpell(target, SPELL_FLAMES, true);
target->DespawnOrUnsummon(20000);
}
@@ -1960,7 +1960,7 @@ public:
Player* caster = GetCaster()->ToPlayer();
if (Creature* target = GetHitCreature())
{
caster->KilledMonsterCredit(NPC_SHARD_KILL_CREDIT, 0);
caster->KilledMonsterCredit(NPC_SHARD_KILL_CREDIT);
target->CastSpell(target, uint32(GetEffectValue()), true);
target->DespawnOrUnsummon(2000);
}
@@ -2003,7 +2003,7 @@ public:
Unit* caster = GetCaster();
if (caster->IsVehicle())
if (Unit* player = caster->GetVehicleKit()->GetPassenger(0))
player->ToPlayer()->KilledMonsterCredit(NPC_KING_OF_THE_MOUNTAINT_KC, 0);
player->ToPlayer()->KilledMonsterCredit(NPC_KING_OF_THE_MOUNTAINT_KC);
}
void Register() override
@@ -2154,7 +2154,7 @@ public:
if (Creature* trigger = target->FindNearestCreature(NPC_ICE_SPIKE_BUNNY, 25.0f))
{
sCreatureTextMgr->SendChat(trigger, SAY_1, target, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_NEUTRAL, false, target);
target->KilledMonsterCredit(NPC_KILLCREDIT, 0);
target->KilledMonsterCredit(NPC_KILLCREDIT);
sCreatureTextMgr->SendChat(trigger, SAY_2, target, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_NEUTRAL, false, target);
}
}

View File

@@ -116,7 +116,7 @@ public:
bool Load() override
{
_procTargetGUID = 0;
_procTargetGUID.Clear();
return true;
}
@@ -154,7 +154,7 @@ public:
}
private:
uint64 _procTargetGUID;
ObjectGuid _procTargetGUID;
};
AuraScript* GetAuraScript() const override
@@ -282,7 +282,8 @@ public:
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(enchant->spellid[s]);
if (!spellInfo)
{
LOG_ERROR("server", "Player::CastItemCombatSpell Enchant %i, player (Name: %s, GUID: %u) cast unknown spell %i", enchant->ID, player->GetName().c_str(), player->GetGUIDLow(), enchant->spellid[s]);
LOG_ERROR("server", "Player::CastItemCombatSpell Enchant %i, player (Name: %s, %s) cast unknown spell %i",
enchant->ID, player->GetName().c_str(), player->GetGUID().ToString().c_str(), enchant->spellid[s]);
continue;
}
@@ -394,7 +395,7 @@ public:
{
while (!_targets.empty())
{
uint64 guid = acore::Containers::SelectRandomContainerElement(_targets);
ObjectGuid guid = acore::Containers::SelectRandomContainerElement(_targets);
if (Unit* target = ObjectAccessor::GetUnit(*GetTarget(), guid))
{
// xinef: target may be no longer valid
@@ -437,7 +438,7 @@ public:
}
private:
std::list<uint64> _targets;
GuidList _targets;
};
AuraScript* GetAuraScript() const override

View File

@@ -152,7 +152,7 @@ public:
if (owner->GetAuraEffectDummy(56250))
{
Unit* target = GetTarget();
target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE, 0, target->GetAura(32409)); // SW:D shall not be removed.
target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE, ObjectGuid::Empty, target->GetAura(32409)); // SW:D shall not be removed.
target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT);
target->RemoveAurasByType(SPELL_AURA_PERIODIC_LEECH);
}
@@ -275,7 +275,7 @@ public:
void HandleAuraApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
// Remove Fel Armor and Demon Armor
GetTarget()->RemoveAurasWithFamily(SPELLFAMILY_WARLOCK, 0, 0x20000020, 0, 0);
GetTarget()->RemoveAurasWithFamily(SPELLFAMILY_WARLOCK, 0, 0x20000020, 0, ObjectGuid::Empty);
}
void Register() override