mirror of
https://github.com/mangosfour/server.git
synced 2025-12-28 04:37:04 +00:00
[10671] Convert some Unit owner/etc guids to ObjectGuid way.
This commit is contained in:
parent
92d98b9fb2
commit
a32d68febd
18 changed files with 154 additions and 149 deletions
|
|
@ -1219,7 +1219,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
|
|||
void clearUnitState(uint32 f) { m_state &= ~f; }
|
||||
bool CanFreeMove() const
|
||||
{
|
||||
return !hasUnitState(UNIT_STAT_NO_FREE_MOVE) && GetOwnerGUID()==0;
|
||||
return !hasUnitState(UNIT_STAT_NO_FREE_MOVE) && GetOwnerGuid().IsEmpty();
|
||||
}
|
||||
|
||||
uint32 getLevel() const { return GetUInt32Value(UNIT_FIELD_LEVEL); }
|
||||
|
|
@ -1479,29 +1479,30 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
|
|||
DeathState getDeathState() { return m_deathState; };
|
||||
virtual void SetDeathState(DeathState s); // overwritten in Creature/Player/Pet
|
||||
|
||||
uint64 GetOwnerGUID() const { return GetUInt64Value(UNIT_FIELD_SUMMONEDBY); }
|
||||
void SetOwnerGUID(uint64 owner) { SetUInt64Value(UNIT_FIELD_SUMMONEDBY, owner); }
|
||||
uint64 GetCreatorGUID() const { return GetUInt64Value(UNIT_FIELD_CREATEDBY); }
|
||||
void SetCreatorGUID(uint64 creator) { SetUInt64Value(UNIT_FIELD_CREATEDBY, creator); }
|
||||
uint64 GetPetGUID() const { return GetUInt64Value(UNIT_FIELD_SUMMON); }
|
||||
void SetPetGUID(uint64 pet) { SetUInt64Value(UNIT_FIELD_SUMMON, pet); }
|
||||
uint64 GetCharmerGUID() const { return GetUInt64Value(UNIT_FIELD_CHARMEDBY); }
|
||||
void SetCharmerGUID(uint64 owner) { SetUInt64Value(UNIT_FIELD_CHARMEDBY, owner); }
|
||||
uint64 GetCharmGUID() const { return GetUInt64Value(UNIT_FIELD_CHARM); }
|
||||
void SetCharmGUID(uint64 charm) { SetUInt64Value(UNIT_FIELD_CHARM, charm); }
|
||||
ObjectGuid const& GetOwnerGuid() const { return GetGuidValue(UNIT_FIELD_SUMMONEDBY); }
|
||||
void SetOwnerGuid(ObjectGuid owner) { SetGuidValue(UNIT_FIELD_SUMMONEDBY, owner); }
|
||||
ObjectGuid const& GetCreatorGuid() const { return GetGuidValue(UNIT_FIELD_CREATEDBY); }
|
||||
void SetCreatorGuid(ObjectGuid creator) { SetGuidValue(UNIT_FIELD_CREATEDBY, creator); }
|
||||
ObjectGuid const& GetPetGuid() const { return GetGuidValue(UNIT_FIELD_SUMMON); }
|
||||
void SetPetGuid(ObjectGuid pet) { SetGuidValue(UNIT_FIELD_SUMMON, pet); }
|
||||
ObjectGuid const& GetCharmerGuid() const { return GetGuidValue(UNIT_FIELD_CHARMEDBY); }
|
||||
void SetCharmerGuid(ObjectGuid owner) { SetGuidValue(UNIT_FIELD_CHARMEDBY, owner); }
|
||||
ObjectGuid const& GetCharmGuid() const { return GetGuidValue(UNIT_FIELD_CHARM); }
|
||||
void SetCharmGuid(ObjectGuid charm) { SetGuidValue(UNIT_FIELD_CHARM, charm); }
|
||||
ObjectGuid const& GetTargetGuid() const { return GetGuidValue(UNIT_FIELD_TARGET); }
|
||||
void SetTargetGuid(ObjectGuid targetGuid) { SetGuidValue(UNIT_FIELD_TARGET, targetGuid); }
|
||||
ObjectGuid const& GetChannelObjectGuid() const { return GetGuidValue(UNIT_FIELD_CHANNEL_OBJECT); }
|
||||
void SetChannelObjectGuid(ObjectGuid targetGuid) { SetGuidValue(UNIT_FIELD_CHANNEL_OBJECT, targetGuid); }
|
||||
|
||||
uint64 GetCharmerOrOwnerGUID() const { return GetCharmerGUID() ? GetCharmerGUID() : GetOwnerGUID(); }
|
||||
uint64 GetCharmerOrOwnerOrOwnGUID() const
|
||||
ObjectGuid const& GetCharmerOrOwnerGuid() const { return !GetCharmerGuid().IsEmpty() ? GetCharmerGuid() : GetOwnerGuid(); }
|
||||
ObjectGuid const& GetCharmerOrOwnerOrOwnGuid() const
|
||||
{
|
||||
if(uint64 guid = GetCharmerOrOwnerGUID())
|
||||
ObjectGuid const& guid = GetCharmerOrOwnerGuid();
|
||||
if (!guid.IsEmpty())
|
||||
return guid;
|
||||
return GetGUID();
|
||||
return GetObjectGuid();
|
||||
}
|
||||
bool isCharmedOwnedByPlayerOrPlayer() const { return IS_PLAYER_GUID(GetCharmerOrOwnerOrOwnGUID()); }
|
||||
bool isCharmedOwnedByPlayerOrPlayer() const { return GetCharmerOrOwnerOrOwnGuid().IsPlayer(); }
|
||||
|
||||
Player* GetSpellModOwner();
|
||||
|
||||
|
|
@ -1510,7 +1511,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
|
|||
Unit* GetCharmer() const;
|
||||
Unit* GetCharm() const;
|
||||
void Uncharm();
|
||||
Unit* GetCharmerOrOwner() const { return GetCharmerGUID() ? GetCharmer() : GetOwner(); }
|
||||
Unit* GetCharmerOrOwner() const { return !GetCharmerGuid().IsEmpty() ? GetCharmer() : GetOwner(); }
|
||||
Unit* GetCharmerOrOwnerOrSelf()
|
||||
{
|
||||
if(Unit* u = GetCharmerOrOwner())
|
||||
|
|
@ -1530,7 +1531,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
|
|||
void RemoveGuardians();
|
||||
Pet* FindGuardianWithEntry(uint32 entry);
|
||||
|
||||
bool isCharmed() const { return GetCharmerGUID() != 0; }
|
||||
bool isCharmed() const { return !GetCharmerGuid().IsEmpty(); }
|
||||
|
||||
CharmInfo* GetCharmInfo() { return m_charmInfo; }
|
||||
CharmInfo* InitCharmInfo(Unit* charm);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue