mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +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
|
|
@ -595,7 +595,7 @@ void Creature::RegenerateMana()
|
|||
uint32 addvalue = 0;
|
||||
|
||||
// Combat and any controlled creature
|
||||
if (isInCombat() || GetCharmerOrOwnerGUID())
|
||||
if (isInCombat() || !GetCharmerOrOwnerGuid().IsEmpty())
|
||||
{
|
||||
if(!IsUnderLastManaUseEffect())
|
||||
{
|
||||
|
|
@ -625,7 +625,7 @@ void Creature::RegenerateHealth()
|
|||
uint32 addvalue = 0;
|
||||
|
||||
// Not only pet, but any controlled creature
|
||||
if(GetCharmerOrOwnerGUID())
|
||||
if (!GetCharmerOrOwnerGuid().IsEmpty())
|
||||
{
|
||||
float HealthIncreaseRate = sWorld.getConfig(CONFIG_FLOAT_RATE_HEALTH);
|
||||
float Spirit = GetStat(STAT_SPIRIT);
|
||||
|
|
@ -1734,7 +1734,7 @@ bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction /
|
|||
return false;
|
||||
|
||||
// only free creature
|
||||
if (GetCharmerOrOwnerGUID())
|
||||
if (!GetCharmerOrOwnerGuid().IsEmpty())
|
||||
return false;
|
||||
|
||||
// only from same creature faction
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ namespace FactorySelector
|
|||
MovementGeneratorRegistry &mv_registry(MovementGeneratorRepository::Instance());
|
||||
MANGOS_ASSERT( creature->GetCreatureInfo() != NULL );
|
||||
MovementGeneratorCreator const * mv_factory = mv_registry.GetRegistryItem(
|
||||
IS_PLAYER_GUID(creature->GetOwnerGUID()) ? FOLLOW_MOTION_TYPE : creature->GetDefaultMovementType());
|
||||
creature->GetOwnerGuid().IsPlayer() ? FOLLOW_MOTION_TYPE : creature->GetDefaultMovementType());
|
||||
|
||||
/* if( mv_factory == NULL )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2174,7 +2174,7 @@ bool ChatHandler::HandleNpcTameCommand(char* /*args*/)
|
|||
|
||||
Player *player = m_session->GetPlayer ();
|
||||
|
||||
if (player->GetPetGUID())
|
||||
if (!player->GetPetGuid().IsEmpty())
|
||||
{
|
||||
SendSysMessage(LANG_YOU_ALREADY_HAVE_PET);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
|
|||
|
|
@ -232,12 +232,12 @@ void MotionMaster::MoveTargetedHome()
|
|||
|
||||
Clear(false);
|
||||
|
||||
if (m_owner->GetTypeId() == TYPEID_UNIT && !((Creature*)m_owner)->GetCharmerOrOwnerGUID())
|
||||
if (m_owner->GetTypeId() == TYPEID_UNIT && ((Creature*)m_owner)->GetCharmerOrOwnerGuid().IsEmpty())
|
||||
{
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "%s targeted home", m_owner->GetObjectGuid().GetString().c_str());
|
||||
Mutate(new HomeMovementGenerator<Creature>());
|
||||
}
|
||||
else if (m_owner->GetTypeId() == TYPEID_UNIT && ((Creature*)m_owner)->GetCharmerOrOwnerGUID())
|
||||
else if (m_owner->GetTypeId() == TYPEID_UNIT && !((Creature*)m_owner)->GetCharmerOrOwnerGuid().IsEmpty())
|
||||
{
|
||||
if (Unit *target = ((Creature*)m_owner)->GetCharmerOrOwner())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -386,9 +386,9 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket &recv_data)
|
|||
recv_data >> guid.ReadAsPacked();
|
||||
recv_data >> mi;
|
||||
|
||||
uint64 vehicleGUID = _player->GetCharmGUID();
|
||||
ObjectGuid vehicleGUID = _player->GetCharmGuid();
|
||||
|
||||
if(!vehicleGUID) // something wrong here...
|
||||
if (vehicleGUID.IsEmpty()) // something wrong here...
|
||||
return;
|
||||
|
||||
_player->m_movementInfo = mi;
|
||||
|
|
|
|||
|
|
@ -135,15 +135,15 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) c
|
|||
if(updateFlags & UPDATEFLAG_HAS_POSITION)
|
||||
{
|
||||
// UPDATETYPE_CREATE_OBJECT2 dynamic objects, corpses...
|
||||
if(isType(TYPEMASK_DYNAMICOBJECT) || isType(TYPEMASK_CORPSE) || isType(TYPEMASK_PLAYER))
|
||||
if (isType(TYPEMASK_DYNAMICOBJECT) || isType(TYPEMASK_CORPSE) || isType(TYPEMASK_PLAYER))
|
||||
updatetype = UPDATETYPE_CREATE_OBJECT2;
|
||||
|
||||
// UPDATETYPE_CREATE_OBJECT2 for pets...
|
||||
if(target->GetPetGUID() == GetGUID())
|
||||
if (target->GetPetGuid() == GetObjectGuid())
|
||||
updatetype = UPDATETYPE_CREATE_OBJECT2;
|
||||
|
||||
// UPDATETYPE_CREATE_OBJECT2 for some gameobject types...
|
||||
if(isType(TYPEMASK_GAMEOBJECT))
|
||||
if (isType(TYPEMASK_GAMEOBJECT))
|
||||
{
|
||||
switch(((GameObject*)this)->GetGoType())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
|
|||
|
||||
m_charmInfo->SetPetNumber(pet_number, IsPermanentPetFor(owner));
|
||||
|
||||
SetOwnerGUID(owner->GetGUID());
|
||||
SetOwnerGuid(owner->GetObjectGuid());
|
||||
SetDisplayId(fields[3].GetUInt32());
|
||||
SetNativeDisplayId(fields[3].GetUInt32());
|
||||
uint32 petlevel = fields[4].GetUInt32();
|
||||
|
|
@ -234,7 +234,7 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
|
|||
|
||||
SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL)));
|
||||
SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, fields[5].GetUInt32());
|
||||
SetCreatorGUID(owner->GetGUID());
|
||||
SetCreatorGuid(owner->GetObjectGuid());
|
||||
|
||||
m_charmInfo->SetReactState(ReactStates(fields[6].GetUInt8()));
|
||||
|
||||
|
|
@ -352,7 +352,7 @@ void Pet::SavePetToDB(PetSaveMode mode)
|
|||
return;
|
||||
|
||||
// not save not player pets
|
||||
if(!IS_PLAYER_GUID(GetOwnerGUID()))
|
||||
if (!GetOwnerGuid().IsPlayer())
|
||||
return;
|
||||
|
||||
Player* pOwner = (Player*)GetOwner();
|
||||
|
|
@ -385,29 +385,29 @@ void Pet::SavePetToDB(PetSaveMode mode)
|
|||
_SaveSpellCooldowns();
|
||||
_SaveAuras();
|
||||
|
||||
uint32 owner = GUID_LOPART(GetOwnerGUID());
|
||||
uint32 ownerLow = GetOwnerGuid().GetCounter();
|
||||
std::string name = m_name;
|
||||
CharacterDatabase.escape_string(name);
|
||||
CharacterDatabase.BeginTransaction();
|
||||
// remove current data
|
||||
CharacterDatabase.PExecute("DELETE FROM character_pet WHERE owner = '%u' AND id = '%u'", owner,m_charmInfo->GetPetNumber() );
|
||||
CharacterDatabase.PExecute("DELETE FROM character_pet WHERE owner = '%u' AND id = '%u'", ownerLow, m_charmInfo->GetPetNumber());
|
||||
|
||||
// prevent duplicate using slot (except PET_SAVE_NOT_IN_SLOT)
|
||||
if(mode <= PET_SAVE_LAST_STABLE_SLOT)
|
||||
if (mode <= PET_SAVE_LAST_STABLE_SLOT)
|
||||
CharacterDatabase.PExecute("UPDATE character_pet SET slot = '%u' WHERE owner = '%u' AND slot = '%u'",
|
||||
PET_SAVE_NOT_IN_SLOT, owner, uint32(mode) );
|
||||
PET_SAVE_NOT_IN_SLOT, ownerLow, uint32(mode) );
|
||||
|
||||
// prevent existence another hunter pet in PET_SAVE_AS_CURRENT and PET_SAVE_NOT_IN_SLOT
|
||||
if(getPetType()==HUNTER_PET && (mode==PET_SAVE_AS_CURRENT||mode > PET_SAVE_LAST_STABLE_SLOT))
|
||||
if (getPetType()==HUNTER_PET && (mode==PET_SAVE_AS_CURRENT||mode > PET_SAVE_LAST_STABLE_SLOT))
|
||||
CharacterDatabase.PExecute("DELETE FROM character_pet WHERE owner = '%u' AND (slot = '%u' OR slot > '%u')",
|
||||
owner,PET_SAVE_AS_CURRENT,PET_SAVE_LAST_STABLE_SLOT);
|
||||
ownerLow, PET_SAVE_AS_CURRENT, PET_SAVE_LAST_STABLE_SLOT);
|
||||
// save pet
|
||||
std::ostringstream ss;
|
||||
ss << "INSERT INTO character_pet ( id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, curhappiness, abdata, savetime, resettalents_cost, resettalents_time, CreatedBySpell, PetType) "
|
||||
<< "VALUES ("
|
||||
<< m_charmInfo->GetPetNumber() << ", "
|
||||
<< GetEntry() << ", "
|
||||
<< owner << ", "
|
||||
<< ownerLow << ", "
|
||||
<< GetNativeDisplayId() << ", "
|
||||
<< getLevel() << ", "
|
||||
<< GetUInt32Value(UNIT_FIELD_PETEXPERIENCE) << ", "
|
||||
|
|
@ -503,22 +503,22 @@ void Pet::Update(uint32 diff)
|
|||
{
|
||||
// unsummon pet that lost owner
|
||||
Unit* owner = GetOwner();
|
||||
if(!owner || (!IsWithinDistInMap(owner, GetMap()->GetVisibilityDistance()) && (owner->GetCharmGUID() && (owner->GetCharmGUID() != GetGUID()))) || (isControlled() && !owner->GetPetGUID()))
|
||||
if (!owner || (!IsWithinDistInMap(owner, GetMap()->GetVisibilityDistance()) && (!owner->GetCharmGuid().IsEmpty() && (owner->GetCharmGuid() != GetObjectGuid()))) || (isControlled() && owner->GetPetGuid().IsEmpty()))
|
||||
{
|
||||
Remove(PET_SAVE_NOT_IN_SLOT, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if(isControlled())
|
||||
if (isControlled())
|
||||
{
|
||||
if( owner->GetPetGUID() != GetGUID() )
|
||||
if (owner->GetPetGuid() != GetObjectGuid())
|
||||
{
|
||||
Remove(getPetType()==HUNTER_PET?PET_SAVE_AS_DELETED:PET_SAVE_NOT_IN_SLOT);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(m_duration > 0)
|
||||
if (m_duration > 0)
|
||||
{
|
||||
if(m_duration > (int32)diff)
|
||||
m_duration -= (int32)diff;
|
||||
|
|
@ -675,7 +675,7 @@ void Pet::Remove(PetSaveMode mode, bool returnreagent)
|
|||
}
|
||||
|
||||
// only if current pet in slot
|
||||
if(owner->GetPetGUID()==GetGUID())
|
||||
if (owner->GetPetGuid() == GetObjectGuid())
|
||||
owner->SetPet(0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
|
|||
return;
|
||||
}
|
||||
|
||||
if (GetPlayer()->GetGUID() != pet->GetCharmerOrOwnerGUID())
|
||||
if (GetPlayer()->GetObjectGuid() != pet->GetCharmerOrOwnerGuid())
|
||||
{
|
||||
sLog.outError("HandlePetAction: %s isn't controlled by %s.", petGuid.GetString().c_str(), GetPlayer()->GetObjectGuid().GetString().c_str());
|
||||
return;
|
||||
|
|
@ -286,7 +286,7 @@ void WorldSession::HandlePetStopAttack(WorldPacket& recv_data)
|
|||
return;
|
||||
}
|
||||
|
||||
if (GetPlayer()->GetGUID() != pet->GetCharmerOrOwnerGUID())
|
||||
if (GetPlayer()->GetObjectGuid() != pet->GetCharmerOrOwnerGuid())
|
||||
{
|
||||
sLog.outError("HandlePetStopAttack: %s isn't charm/pet of %s.", petGuid.GetString().c_str(), GetPlayer()->GetObjectGuid().GetString().c_str());
|
||||
return;
|
||||
|
|
@ -475,7 +475,7 @@ void WorldSession::HandlePetRename( WorldPacket & recv_data )
|
|||
// check it!
|
||||
if( !pet || pet->getPetType() != HUNTER_PET ||
|
||||
!pet->HasByteFlag(UNIT_FIELD_BYTES_2, 2, UNIT_CAN_BE_RENAMED) ||
|
||||
pet->GetOwnerGUID() != _player->GetGUID() || !pet->GetCharmInfo() )
|
||||
pet->GetOwnerGuid() != _player->GetObjectGuid() || !pet->GetCharmInfo() )
|
||||
return;
|
||||
|
||||
PetNameInvalidReason res = ObjectMgr::CheckPetName(name);
|
||||
|
|
@ -544,9 +544,9 @@ void WorldSession::HandlePetAbandon( WorldPacket & recv_data )
|
|||
// pet/charmed
|
||||
if (Creature* pet = _player->GetMap()->GetAnyTypeCreature(guid))
|
||||
{
|
||||
if(pet->IsPet())
|
||||
if (pet->IsPet())
|
||||
{
|
||||
if(pet->GetGUID() == _player->GetPetGUID())
|
||||
if (pet->GetObjectGuid() == _player->GetPetGuid())
|
||||
{
|
||||
uint32 feelty = pet->GetPower(POWER_HAPPINESS);
|
||||
pet->SetPower(POWER_HAPPINESS ,(feelty-50000) > 0 ?(feelty-50000) : 0);
|
||||
|
|
@ -554,7 +554,7 @@ void WorldSession::HandlePetAbandon( WorldPacket & recv_data )
|
|||
|
||||
_player->RemovePet((Pet*)pet,PET_SAVE_AS_DELETED);
|
||||
}
|
||||
else if(pet->GetGUID() == _player->GetCharmGUID())
|
||||
else if (pet->GetObjectGuid() == _player->GetCharmGuid())
|
||||
{
|
||||
_player->Uncharm();
|
||||
}
|
||||
|
|
@ -597,7 +597,7 @@ void WorldSession::HandlePetSpellAutocastOpcode( WorldPacket& recvPacket )
|
|||
recvPacket >> guid >> spellid >> state;
|
||||
|
||||
Creature* pet = _player->GetMap()->GetAnyTypeCreature(guid);
|
||||
if (!pet || (guid.GetRawValue() != _player->GetPetGUID() && guid.GetRawValue() != _player->GetCharmGUID()))
|
||||
if (!pet || (guid != _player->GetPetGuid() && guid != _player->GetCharmGuid()))
|
||||
{
|
||||
sLog.outError("HandlePetSpellAutocastOpcode. %s isn't pet of %s .", guid.GetString().c_str(), GetPlayer()->GetObjectGuid().GetString().c_str());
|
||||
return;
|
||||
|
|
@ -638,7 +638,7 @@ void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket )
|
|||
|
||||
Creature* pet = _player->GetMap()->GetAnyTypeCreature(guid);
|
||||
|
||||
if (!pet || (guid.GetRawValue() != _player->GetPetGUID() && guid.GetRawValue() != _player->GetCharmGUID()))
|
||||
if (!pet || (guid != _player->GetPetGuid() && guid != _player->GetCharmGuid()))
|
||||
{
|
||||
sLog.outError("HandlePetCastSpellOpcode: %s isn't pet of %s .", guid.GetString().c_str(), GetPlayer()->GetObjectGuid().GetString().c_str());
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1464,7 +1464,7 @@ void Player::Update( uint32 p_time )
|
|||
SendUpdateToOutOfRangeGroupMembers();
|
||||
|
||||
Pet* pet = GetPet();
|
||||
if(pet && !pet->IsWithinDistInMap(this, GetMap()->GetVisibilityDistance()) && (GetCharmGUID() && (pet->GetGUID() != GetCharmGUID())))
|
||||
if (pet && !pet->IsWithinDistInMap(this, GetMap()->GetVisibilityDistance()) && (!GetCharmGuid().IsEmpty() && (pet->GetObjectGuid() != GetCharmGuid())))
|
||||
{
|
||||
RemovePet(pet, PET_SAVE_NOT_IN_SLOT, true);
|
||||
}
|
||||
|
|
@ -2261,7 +2261,7 @@ Creature* Player::GetNPCIfCanInteractWith(ObjectGuid guid, uint32 npcflagmask)
|
|||
return NULL;
|
||||
|
||||
// not allow interaction under control, but allow with own pets
|
||||
if (unit->GetCharmerGUID())
|
||||
if (!unit->GetCharmerGuid().IsEmpty())
|
||||
return NULL;
|
||||
|
||||
// not enemy
|
||||
|
|
@ -6906,12 +6906,12 @@ void Player::DuelComplete(DuelCompleteType type)
|
|||
// cleanup combo points
|
||||
if (GetComboTargetGuid() == duel->opponent->GetObjectGuid())
|
||||
ClearComboPoints();
|
||||
else if (GetComboTargetGuid().GetRawValue() == duel->opponent->GetPetGUID())
|
||||
else if (GetComboTargetGuid() == duel->opponent->GetPetGuid())
|
||||
ClearComboPoints();
|
||||
|
||||
if (duel->opponent->GetComboTargetGuid() == GetObjectGuid())
|
||||
duel->opponent->ClearComboPoints();
|
||||
else if (duel->opponent->GetComboTargetGuid().GetRawValue() == GetPetGUID())
|
||||
else if (duel->opponent->GetComboTargetGuid() == GetPetGuid())
|
||||
duel->opponent->ClearComboPoints();
|
||||
|
||||
//cleanups
|
||||
|
|
@ -15392,9 +15392,9 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
|||
SetCharm(NULL);
|
||||
SetPet(NULL);
|
||||
SetTargetGuid(ObjectGuid());
|
||||
SetCharmerGUID(0);
|
||||
SetOwnerGUID(0);
|
||||
SetCreatorGUID(0);
|
||||
SetCharmerGuid(ObjectGuid());
|
||||
SetOwnerGuid(ObjectGuid());
|
||||
SetCreatorGuid(ObjectGuid());
|
||||
|
||||
// reset some aura modifiers before aura apply
|
||||
|
||||
|
|
@ -17738,7 +17738,7 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent)
|
|||
if (!pet)
|
||||
pet = GetPet();
|
||||
|
||||
if (!pet || pet->GetOwnerGUID() != GetGUID())
|
||||
if (!pet || pet->GetOwnerGuid() != GetObjectGuid())
|
||||
return;
|
||||
|
||||
// not save secondary permanent pet as current
|
||||
|
|
@ -17780,7 +17780,7 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent)
|
|||
RemoveGuardian(pet);
|
||||
break;
|
||||
default:
|
||||
if (GetPetGUID() == pet->GetGUID())
|
||||
if (GetPetGuid() == pet->GetObjectGuid())
|
||||
SetPet(NULL);
|
||||
break;
|
||||
}
|
||||
|
|
@ -17965,13 +17965,13 @@ void Player::PetSpellInitialize()
|
|||
|
||||
void Player::SendPetGUIDs()
|
||||
{
|
||||
if(!GetPetGUID())
|
||||
if (GetPetGuid().IsEmpty())
|
||||
return;
|
||||
|
||||
// Later this function might get modified for multiple guids
|
||||
WorldPacket data(SMSG_PET_GUIDS, 12);
|
||||
data << uint32(1); // count
|
||||
data << uint64(GetPetGUID());
|
||||
data << ObjectGuid(GetPetGuid());
|
||||
GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
|
|
@ -19435,7 +19435,7 @@ inline void BeforeVisibilityDestroy(T* /*t*/, Player* /*p*/)
|
|||
template<>
|
||||
inline void BeforeVisibilityDestroy<Creature>(Creature* t, Player* p)
|
||||
{
|
||||
if (p->GetPetGUID()==t->GetGUID() && ((Creature*)t)->IsPet())
|
||||
if (p->GetPetGuid() == t->GetObjectGuid() && ((Creature*)t)->IsPet())
|
||||
((Pet*)t)->Remove(PET_SAVE_NOT_IN_SLOT, true);
|
||||
}
|
||||
|
||||
|
|
@ -20970,7 +20970,7 @@ void Player::EnterVehicle(Vehicle *vehicle)
|
|||
if(!veSeat)
|
||||
return;
|
||||
|
||||
vehicle->SetCharmerGUID(GetGUID());
|
||||
vehicle->SetCharmerGuid(GetObjectGuid());
|
||||
vehicle->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
|
||||
vehicle->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
|
||||
vehicle->setFaction(getFaction());
|
||||
|
|
@ -21022,7 +21022,7 @@ void Player::EnterVehicle(Vehicle *vehicle)
|
|||
|
||||
void Player::ExitVehicle(Vehicle *vehicle)
|
||||
{
|
||||
vehicle->SetCharmerGUID(0);
|
||||
vehicle->SetCharmerGuid(ObjectGuid());
|
||||
vehicle->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
|
||||
vehicle->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
|
||||
vehicle->setFaction((GetTeam() == ALLIANCE) ? vehicle->GetCreatureInfo()->faction_A : vehicle->GetCreatureInfo()->faction_H);
|
||||
|
|
@ -21775,14 +21775,14 @@ void Player::UnsummonPetTemporaryIfAny()
|
|||
|
||||
void Player::ResummonPetTemporaryUnSummonedIfAny()
|
||||
{
|
||||
if(!m_temporaryUnsummonedPetNumber)
|
||||
if (!m_temporaryUnsummonedPetNumber)
|
||||
return;
|
||||
|
||||
// not resummon in not appropriate state
|
||||
if(IsPetNeedBeTemporaryUnsummoned())
|
||||
if (IsPetNeedBeTemporaryUnsummoned())
|
||||
return;
|
||||
|
||||
if(GetPetGUID())
|
||||
if (!GetPetGuid().IsEmpty())
|
||||
return;
|
||||
|
||||
Pet* NewPet = new Pet;
|
||||
|
|
|
|||
|
|
@ -1152,7 +1152,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
|
|||
// Recheck UNIT_FLAG_NON_ATTACKABLE for delayed spells
|
||||
if (m_spellInfo->speed > 0.0f &&
|
||||
unit->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE) &&
|
||||
unit->GetCharmerOrOwnerGUID() != m_caster->GetGUID())
|
||||
unit->GetCharmerOrOwnerGuid() != m_caster->GetObjectGuid())
|
||||
{
|
||||
realCaster->SendSpellMiss(unit, m_spellInfo->Id, SPELL_MISS_EVADE);
|
||||
ResetEffectDamageAndHeal();
|
||||
|
|
@ -2026,7 +2026,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
|
|||
{
|
||||
if( targetOwner->GetTypeId() == TYPEID_PLAYER &&
|
||||
target->GetTypeId() == TYPEID_UNIT && (((Creature*)target)->IsPet()) &&
|
||||
target->GetOwnerGUID() == targetOwner->GetGUID() &&
|
||||
target->GetOwnerGuid() == targetOwner->GetObjectGuid() &&
|
||||
pGroup->IsMember(((Player*)targetOwner)->GetObjectGuid()))
|
||||
{
|
||||
targetUnitMap.push_back(target);
|
||||
|
|
@ -4473,7 +4473,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||
}
|
||||
// TODO: this check can be applied and for player to prevent cheating when IsPositiveSpell will return always correct result.
|
||||
// check target for pet/charmed casts (not self targeted), self targeted cast used for area effects and etc
|
||||
if (!explicit_target_mode && m_caster->GetTypeId() == TYPEID_UNIT && m_caster->GetCharmerOrOwnerGUID())
|
||||
if (!explicit_target_mode && m_caster->GetTypeId() == TYPEID_UNIT && !m_caster->GetCharmerOrOwnerGuid().IsEmpty())
|
||||
{
|
||||
// check correctness positive/negative cast target (pet cast real check and cheating check)
|
||||
if(IsPositiveSpell(m_spellInfo->Id))
|
||||
|
|
@ -4768,7 +4768,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||
if (target->GetCreatureType() != CREATURE_TYPE_UNDEAD)
|
||||
return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
|
||||
// owned
|
||||
if (target->GetOwnerGUID() != m_caster->GetGUID())
|
||||
if (target->GetOwnerGuid() != m_caster->GetObjectGuid())
|
||||
return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
|
||||
|
||||
float dist = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i]));
|
||||
|
|
@ -4862,7 +4862,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||
return SPELL_FAILED_DONT_REPORT;
|
||||
}
|
||||
|
||||
if(plrCaster->GetPetGUID() || plrCaster->GetCharmGUID())
|
||||
if (!plrCaster->GetPetGuid().IsEmpty() || !plrCaster->GetCharmGuid().IsEmpty())
|
||||
{
|
||||
plrCaster->SendPetTameFailure(PETTAME_ANOTHERSUMMONACTIVE);
|
||||
return SPELL_FAILED_DONT_REPORT;
|
||||
|
|
@ -5066,10 +5066,10 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||
{
|
||||
if(summon_prop->Group == SUMMON_PROP_GROUP_PETS)
|
||||
{
|
||||
if(m_caster->GetPetGUID())
|
||||
if (!m_caster->GetPetGuid().IsEmpty())
|
||||
return SPELL_FAILED_ALREADY_HAVE_SUMMON;
|
||||
|
||||
if(m_caster->GetCharmGUID())
|
||||
if (!m_caster->GetCharmGuid().IsEmpty())
|
||||
return SPELL_FAILED_ALREADY_HAVE_CHARM;
|
||||
}
|
||||
}
|
||||
|
|
@ -5078,7 +5078,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||
}
|
||||
case SPELL_EFFECT_SUMMON_PET:
|
||||
{
|
||||
if(m_caster->GetPetGUID()) //let warlock do a replacement summon
|
||||
if (!m_caster->GetPetGuid().IsEmpty()) //let warlock do a replacement summon
|
||||
{
|
||||
|
||||
Pet* pet = ((Player*)m_caster)->GetPet();
|
||||
|
|
@ -5092,7 +5092,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||
return SPELL_FAILED_ALREADY_HAVE_SUMMON;
|
||||
}
|
||||
|
||||
if(m_caster->GetCharmGUID())
|
||||
if (!m_caster->GetCharmGuid().IsEmpty())
|
||||
return SPELL_FAILED_ALREADY_HAVE_CHARM;
|
||||
|
||||
break;
|
||||
|
|
@ -5174,73 +5174,73 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||
}
|
||||
case SPELL_AURA_MOD_POSSESS:
|
||||
{
|
||||
if(m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return SPELL_FAILED_UNKNOWN;
|
||||
|
||||
if(m_targets.getUnitTarget() == m_caster)
|
||||
if (m_targets.getUnitTarget() == m_caster)
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
if(m_caster->GetPetGUID())
|
||||
if (!m_caster->GetPetGuid().IsEmpty())
|
||||
return SPELL_FAILED_ALREADY_HAVE_SUMMON;
|
||||
|
||||
if(m_caster->GetCharmGUID())
|
||||
if (!m_caster->GetCharmGuid().IsEmpty())
|
||||
return SPELL_FAILED_ALREADY_HAVE_CHARM;
|
||||
|
||||
if(m_caster->GetCharmerGUID())
|
||||
if (!m_caster->GetCharmerGuid().IsEmpty())
|
||||
return SPELL_FAILED_CHARMED;
|
||||
|
||||
if(!m_targets.getUnitTarget())
|
||||
if (!m_targets.getUnitTarget())
|
||||
return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
|
||||
|
||||
if(m_targets.getUnitTarget()->GetCharmerGUID())
|
||||
if (!m_targets.getUnitTarget()->GetCharmerGuid().IsEmpty())
|
||||
return SPELL_FAILED_CHARMED;
|
||||
|
||||
if(int32(m_targets.getUnitTarget()->getLevel()) > CalculateDamage(SpellEffectIndex(i),m_targets.getUnitTarget()))
|
||||
if (int32(m_targets.getUnitTarget()->getLevel()) > CalculateDamage(SpellEffectIndex(i),m_targets.getUnitTarget()))
|
||||
return SPELL_FAILED_HIGHLEVEL;
|
||||
|
||||
break;
|
||||
}
|
||||
case SPELL_AURA_MOD_CHARM:
|
||||
{
|
||||
if(m_targets.getUnitTarget() == m_caster)
|
||||
if (m_targets.getUnitTarget() == m_caster)
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
if(m_caster->GetPetGUID())
|
||||
if (!m_caster->GetPetGuid().IsEmpty())
|
||||
return SPELL_FAILED_ALREADY_HAVE_SUMMON;
|
||||
|
||||
if(m_caster->GetCharmGUID())
|
||||
if (!m_caster->GetCharmGuid().IsEmpty())
|
||||
return SPELL_FAILED_ALREADY_HAVE_CHARM;
|
||||
|
||||
if(m_caster->GetCharmerGUID())
|
||||
if (!m_caster->GetCharmerGuid().IsEmpty())
|
||||
return SPELL_FAILED_CHARMED;
|
||||
|
||||
if(!m_targets.getUnitTarget())
|
||||
if (!m_targets.getUnitTarget())
|
||||
return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
|
||||
|
||||
if(m_targets.getUnitTarget()->GetCharmerGUID())
|
||||
if (!m_targets.getUnitTarget()->GetCharmerGuid().IsEmpty())
|
||||
return SPELL_FAILED_CHARMED;
|
||||
|
||||
if(int32(m_targets.getUnitTarget()->getLevel()) > CalculateDamage(SpellEffectIndex(i),m_targets.getUnitTarget()))
|
||||
if (int32(m_targets.getUnitTarget()->getLevel()) > CalculateDamage(SpellEffectIndex(i),m_targets.getUnitTarget()))
|
||||
return SPELL_FAILED_HIGHLEVEL;
|
||||
|
||||
break;
|
||||
}
|
||||
case SPELL_AURA_MOD_POSSESS_PET:
|
||||
{
|
||||
if(m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return SPELL_FAILED_UNKNOWN;
|
||||
|
||||
if(m_caster->GetCharmGUID())
|
||||
if (!m_caster->GetCharmGuid().IsEmpty())
|
||||
return SPELL_FAILED_ALREADY_HAVE_CHARM;
|
||||
|
||||
if(m_caster->GetCharmerGUID())
|
||||
if (!m_caster->GetCharmerGuid().IsEmpty())
|
||||
return SPELL_FAILED_CHARMED;
|
||||
|
||||
Pet* pet = m_caster->GetPet();
|
||||
if(!pet)
|
||||
if (!pet)
|
||||
return SPELL_FAILED_NO_PET;
|
||||
|
||||
if(pet->GetCharmerGUID())
|
||||
if (!pet->GetCharmerGuid().IsEmpty())
|
||||
return SPELL_FAILED_CHARMED;
|
||||
|
||||
break;
|
||||
|
|
@ -6332,7 +6332,7 @@ bool Spell::CheckTarget( Unit* target, SpellEffectIndex eff )
|
|||
|
||||
// Check targets for not_selectable unit flag and remove
|
||||
// A player can cast spells on his pet (or other controlled unit) though in any state
|
||||
if (target != m_caster && target->GetCharmerOrOwnerGUID() != m_caster->GetGUID())
|
||||
if (target != m_caster && target->GetCharmerOrOwnerGuid() != m_caster->GetObjectGuid())
|
||||
{
|
||||
// any unattackable target skipped
|
||||
if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
|
||||
|
|
|
|||
|
|
@ -814,7 +814,7 @@ void AreaAura::Update(uint32 diff)
|
|||
else if( m_areaAuraType == AREA_AURA_PARTY) // check if in same sub group
|
||||
{
|
||||
// not check group if target == owner or target == pet
|
||||
if (caster->GetCharmerOrOwnerGUID() != target->GetGUID() && caster->GetGUID() != target->GetCharmerOrOwnerGUID())
|
||||
if (caster->GetCharmerOrOwnerGuid() != target->GetObjectGuid() && caster->GetObjectGuid() != target->GetCharmerOrOwnerGuid())
|
||||
{
|
||||
Player* check = caster->GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
|
||||
|
|
@ -832,7 +832,7 @@ void AreaAura::Update(uint32 diff)
|
|||
else if( m_areaAuraType == AREA_AURA_RAID) // TODO: fix me!
|
||||
{
|
||||
// not check group if target == owner or target == pet
|
||||
if (caster->GetCharmerOrOwnerGUID() != target->GetGUID() && caster->GetGUID() != target->GetCharmerOrOwnerGUID())
|
||||
if (caster->GetCharmerOrOwnerGuid() != target->GetObjectGuid() && caster->GetObjectGuid() != target->GetCharmerOrOwnerGuid())
|
||||
{
|
||||
Player* check = caster->GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
|
||||
|
|
@ -847,9 +847,9 @@ void AreaAura::Update(uint32 diff)
|
|||
target->RemoveSingleAuraFromSpellAuraHolder(GetId(), GetEffIndex(), GetCasterGUID());
|
||||
}
|
||||
}
|
||||
else if( m_areaAuraType == AREA_AURA_PET || m_areaAuraType == AREA_AURA_OWNER )
|
||||
else if (m_areaAuraType == AREA_AURA_PET || m_areaAuraType == AREA_AURA_OWNER)
|
||||
{
|
||||
if( target->GetGUID() != caster->GetCharmerOrOwnerGUID() )
|
||||
if (target->GetObjectGuid() != caster->GetCharmerOrOwnerGuid())
|
||||
target->RemoveSingleAuraFromSpellAuraHolder(GetId(), GetEffIndex(), GetCasterGUID());
|
||||
}
|
||||
}
|
||||
|
|
@ -3425,7 +3425,7 @@ void Aura::HandleModPossess(bool apply, bool Real)
|
|||
target->addUnitState(UNIT_STAT_CONTROLLED);
|
||||
|
||||
target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
|
||||
target->SetCharmerGUID(p_caster->GetGUID());
|
||||
target->SetCharmerGuid(p_caster->GetObjectGuid());
|
||||
target->setFaction(p_caster->getFaction());
|
||||
|
||||
// target should became visible at SetView call(if not visible before):
|
||||
|
|
@ -3484,7 +3484,7 @@ void Aura::HandleModPossess(bool apply, bool Real)
|
|||
|
||||
target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
|
||||
|
||||
target->SetCharmerGUID(0);
|
||||
target->SetCharmerGuid(ObjectGuid());
|
||||
|
||||
if(target->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
|
|
@ -3603,13 +3603,13 @@ void Aura::HandleModCharm(bool apply, bool Real)
|
|||
|
||||
if( apply )
|
||||
{
|
||||
if (target->GetCharmerGUID())
|
||||
if (!target->GetCharmerGuid().IsEmpty())
|
||||
{
|
||||
target->RemoveSpellsCausingAura(SPELL_AURA_MOD_CHARM);
|
||||
target->RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS);
|
||||
}
|
||||
|
||||
target->SetCharmerGUID(GetCasterGUID());
|
||||
target->SetCharmerGuid(GetCasterGuid());
|
||||
target->setFaction(caster->getFaction());
|
||||
target->CastStop(target == caster ? GetId() : 0);
|
||||
caster->SetCharm(target);
|
||||
|
|
@ -3654,7 +3654,7 @@ void Aura::HandleModCharm(bool apply, bool Real)
|
|||
}
|
||||
else
|
||||
{
|
||||
target->SetCharmerGUID(0);
|
||||
target->SetCharmerGuid(ObjectGuid());
|
||||
|
||||
if(target->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)target)->setFactionForRace(target->getRace());
|
||||
|
|
|
|||
|
|
@ -4092,7 +4092,7 @@ void Spell::EffectSummonType(SpellEffectIndex eff_idx)
|
|||
|
||||
void Spell::DoSummon(SpellEffectIndex eff_idx)
|
||||
{
|
||||
if (m_caster->GetPetGUID())
|
||||
if (!m_caster->GetPetGuid().IsEmpty())
|
||||
return;
|
||||
|
||||
if (!unitTarget)
|
||||
|
|
@ -4162,7 +4162,7 @@ void Spell::DoSummon(SpellEffectIndex eff_idx)
|
|||
if (duration > 0)
|
||||
spawnCreature->SetDuration(duration);
|
||||
|
||||
spawnCreature->SetOwnerGUID(m_caster->GetGUID());
|
||||
spawnCreature->SetOwnerGuid(m_caster->GetObjectGuid());
|
||||
spawnCreature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
|
||||
spawnCreature->setPowerType(POWER_MANA);
|
||||
spawnCreature->setFaction(m_caster->getFaction());
|
||||
|
|
@ -4172,7 +4172,7 @@ void Spell::DoSummon(SpellEffectIndex eff_idx)
|
|||
spawnCreature->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, 0);
|
||||
spawnCreature->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0);
|
||||
spawnCreature->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, 1000);
|
||||
spawnCreature->SetCreatorGUID(m_caster->GetGUID());
|
||||
spawnCreature->SetCreatorGuid(m_caster->GetObjectGuid());
|
||||
spawnCreature->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
|
||||
|
||||
spawnCreature->InitStatsForLevel(level, m_caster);
|
||||
|
|
@ -4511,7 +4511,7 @@ void Spell::DoSummonWild(SpellEffectIndex eff_idx, uint32 forceFaction)
|
|||
if(Creature *summon = m_caster->SummonCreature(creature_entry, px, py, pz, m_caster->GetOrientation(), summonType, duration))
|
||||
{
|
||||
summon->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
|
||||
summon->SetCreatorGUID(m_caster->GetGUID());
|
||||
summon->SetCreatorGuid(m_caster->GetObjectGuid());
|
||||
|
||||
if(forceFaction)
|
||||
summon->setFaction(forceFaction);
|
||||
|
|
@ -4601,14 +4601,14 @@ void Spell::DoSummonGuardian(SpellEffectIndex eff_idx, uint32 forceFaction)
|
|||
if (duration > 0)
|
||||
spawnCreature->SetDuration(duration);
|
||||
|
||||
spawnCreature->SetOwnerGUID(m_caster->GetGUID());
|
||||
spawnCreature->SetOwnerGuid(m_caster->GetObjectGuid());
|
||||
spawnCreature->setPowerType(POWER_MANA);
|
||||
spawnCreature->SetUInt32Value(UNIT_NPC_FLAGS, spawnCreature->GetCreatureInfo()->npcflag);
|
||||
spawnCreature->setFaction(forceFaction ? forceFaction : m_caster->getFaction());
|
||||
spawnCreature->SetUInt32Value(UNIT_FIELD_FLAGS, 0);
|
||||
spawnCreature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
|
||||
spawnCreature->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, 0);
|
||||
spawnCreature->SetCreatorGUID(m_caster->GetGUID());
|
||||
spawnCreature->SetCreatorGuid(m_caster->GetObjectGuid());
|
||||
spawnCreature->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
|
||||
|
||||
spawnCreature->InitStatsForLevel(level, m_caster);
|
||||
|
|
@ -5034,8 +5034,8 @@ void Spell::EffectSummonPet(SpellEffectIndex eff_idx)
|
|||
NewSummon->GetCharmInfo()->SetReactState(REACT_DEFENSIVE);
|
||||
}
|
||||
|
||||
NewSummon->SetOwnerGUID(m_caster->GetGUID());
|
||||
NewSummon->SetCreatorGUID(m_caster->GetGUID());
|
||||
NewSummon->SetOwnerGuid(m_caster->GetObjectGuid());
|
||||
NewSummon->SetCreatorGuid(m_caster->GetObjectGuid());
|
||||
NewSummon->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
|
||||
NewSummon->setFaction(faction);
|
||||
NewSummon->SetUInt32Value(UNIT_FIELD_BYTES_0, 2048);
|
||||
|
|
@ -7516,8 +7516,8 @@ void Spell::DoSummonCritter(SpellEffectIndex eff_idx, uint32 forceFaction)
|
|||
return;
|
||||
}
|
||||
|
||||
critter->SetOwnerGUID(m_caster->GetGUID());
|
||||
critter->SetCreatorGUID(m_caster->GetGUID());
|
||||
critter->SetOwnerGuid(m_caster->GetObjectGuid());
|
||||
critter->SetCreatorGuid(m_caster->GetObjectGuid());
|
||||
|
||||
critter->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
|
||||
critter->setFaction(forceFaction ? forceFaction : m_caster->getFaction());
|
||||
|
|
|
|||
|
|
@ -509,13 +509,13 @@ void WorldSession::HandlePetCancelAuraOpcode( WorldPacket& recvPacket)
|
|||
return;
|
||||
}
|
||||
|
||||
if (guid.GetRawValue() != GetPlayer()->GetPetGUID() && guid.GetRawValue() != GetPlayer()->GetCharmGUID())
|
||||
if (guid != GetPlayer()->GetPetGuid() && guid != GetPlayer()->GetCharmGuid())
|
||||
{
|
||||
sLog.outError("HandlePetCancelAura. %s isn't pet of %s", guid.GetString().c_str(), GetPlayer()->GetObjectGuid().GetString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if(!pet->isAlive())
|
||||
if (!pet->isAlive())
|
||||
{
|
||||
pet->SendPetActionFeedback(FEEDBACK_PET_DEAD);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -257,7 +257,7 @@ template<>
|
|||
void FollowMovementGenerator<Creature>::_updateSpeed(Creature &u)
|
||||
{
|
||||
// pet only sync speed with owner
|
||||
if (!((Creature&)u).IsPet() || !i_target.isValid() || i_target->GetGUID() != u.GetOwnerGUID())
|
||||
if (!((Creature&)u).IsPet() || !i_target.isValid() || i_target->GetObjectGuid() != u.GetOwnerGuid())
|
||||
return;
|
||||
|
||||
u.UpdateSpeed(MOVE_RUN,true);
|
||||
|
|
|
|||
|
|
@ -115,18 +115,18 @@ void Totem::UnSummon()
|
|||
|
||||
void Totem::SetOwner(Unit* owner)
|
||||
{
|
||||
SetCreatorGUID(owner->GetGUID());
|
||||
SetOwnerGUID(owner->GetGUID());
|
||||
SetCreatorGuid(owner->GetObjectGuid());
|
||||
SetOwnerGuid(owner->GetObjectGuid());
|
||||
setFaction(owner->getFaction());
|
||||
SetLevel(owner->getLevel());
|
||||
}
|
||||
|
||||
Unit *Totem::GetOwner()
|
||||
{
|
||||
uint64 ownerid = GetOwnerGUID();
|
||||
if(!ownerid)
|
||||
ObjectGuid ownerGuid = GetOwnerGuid();
|
||||
if (ownerGuid.IsEmpty())
|
||||
return NULL;
|
||||
return ObjectAccessor::GetUnit(*this, ownerid);
|
||||
return ObjectAccessor::GetUnit(*this, ownerGuid);
|
||||
}
|
||||
|
||||
void Totem::SetTypeBySummonSpell(SpellEntry const * spellProto)
|
||||
|
|
|
|||
|
|
@ -600,7 +600,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
|
|||
if(pVictim->GetTypeId() == TYPEID_PLAYER && ((Player*)pVictim)->duel && damage >= (health-1))
|
||||
{
|
||||
// prevent kill only if killed in duel and killed by opponent or opponent controlled creature
|
||||
if(((Player*)pVictim)->duel->opponent==this || ((Player*)pVictim)->duel->opponent->GetGUID() == GetOwnerGUID())
|
||||
if(((Player*)pVictim)->duel->opponent==this || ((Player*)pVictim)->duel->opponent->GetObjectGuid() == GetOwnerGuid())
|
||||
damage = health-1;
|
||||
|
||||
duel_hasEnded = true;
|
||||
|
|
@ -1709,7 +1709,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
|
|||
|
||||
// If this is a creature and it attacks from behind it has a probability to daze it's victim
|
||||
if( (damageInfo->hitOutCome==MELEE_HIT_CRIT || damageInfo->hitOutCome==MELEE_HIT_CRUSHING || damageInfo->hitOutCome==MELEE_HIT_NORMAL || damageInfo->hitOutCome==MELEE_HIT_GLANCING) &&
|
||||
GetTypeId() != TYPEID_PLAYER && !((Creature*)this)->GetCharmerOrOwnerGUID() && !pVictim->HasInArc(M_PI_F, this) )
|
||||
GetTypeId() != TYPEID_PLAYER && ((Creature*)this)->GetCharmerOrOwnerGuid().IsEmpty() && !pVictim->HasInArc(M_PI_F, this) )
|
||||
{
|
||||
// -probability is between 0% and 40%
|
||||
// 20% base chance
|
||||
|
|
@ -2695,7 +2695,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack
|
|||
// can be from by creature (if can) or from controlled player that considered as creature
|
||||
(GetTypeId()!=TYPEID_PLAYER && !((Creature*)this)->IsPet() &&
|
||||
!(((Creature*)this)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRUSH) ||
|
||||
GetTypeId()==TYPEID_PLAYER && GetCharmerOrOwnerGUID()))
|
||||
GetTypeId()==TYPEID_PLAYER && !GetCharmerOrOwnerGuid().IsEmpty()))
|
||||
{
|
||||
// when their weapon skill is 15 or more above victim's defense skill
|
||||
tmp = victimDefenseSkill;
|
||||
|
|
@ -5788,14 +5788,16 @@ void Unit::ModifyAuraState(AuraState flag, bool apply)
|
|||
|
||||
Unit *Unit::GetOwner() const
|
||||
{
|
||||
if(uint64 ownerid = GetOwnerGUID())
|
||||
ObjectGuid ownerid = GetOwnerGuid();
|
||||
if (!ownerid.IsEmpty())
|
||||
return ObjectAccessor::GetUnit(*this, ownerid);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Unit *Unit::GetCharmer() const
|
||||
{
|
||||
if(uint64 charmerid = GetCharmerGUID())
|
||||
ObjectGuid charmerid = GetCharmerGuid();
|
||||
if (!charmerid.IsEmpty())
|
||||
return ObjectAccessor::GetUnit(*this, charmerid);
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -5805,13 +5807,13 @@ bool Unit::IsCharmerOrOwnerPlayerOrPlayerItself() const
|
|||
if (GetTypeId()==TYPEID_PLAYER)
|
||||
return true;
|
||||
|
||||
return IS_PLAYER_GUID(GetCharmerOrOwnerGUID());
|
||||
return GetCharmerOrOwnerGuid().IsPlayer();
|
||||
}
|
||||
|
||||
Player* Unit::GetCharmerOrOwnerPlayerOrPlayerItself()
|
||||
{
|
||||
uint64 guid = GetCharmerOrOwnerGUID();
|
||||
if(IS_PLAYER_GUID(guid))
|
||||
ObjectGuid guid = GetCharmerOrOwnerGuid();
|
||||
if (guid.IsPlayer())
|
||||
return ObjectAccessor::FindPlayer(guid);
|
||||
|
||||
return GetTypeId()==TYPEID_PLAYER ? (Player*)this : NULL;
|
||||
|
|
@ -5819,12 +5821,13 @@ Player* Unit::GetCharmerOrOwnerPlayerOrPlayerItself()
|
|||
|
||||
Pet* Unit::GetPet() const
|
||||
{
|
||||
if(uint64 pet_guid = GetPetGUID())
|
||||
ObjectGuid pet_guid = GetPetGuid();
|
||||
if (!pet_guid.IsEmpty())
|
||||
{
|
||||
if(Pet* pet = GetMap()->GetPet(pet_guid))
|
||||
return pet;
|
||||
|
||||
sLog.outError("Unit::GetPet: Pet %u not exist.",GUID_LOPART(pet_guid));
|
||||
sLog.outError("Unit::GetPet: %s not exist.", pet_guid.GetString().c_str());
|
||||
const_cast<Unit*>(this)->SetPet(0);
|
||||
}
|
||||
|
||||
|
|
@ -5838,12 +5841,13 @@ Pet* Unit::_GetPet(ObjectGuid guid) const
|
|||
|
||||
Unit* Unit::GetCharm() const
|
||||
{
|
||||
if (uint64 charm_guid = GetCharmGUID())
|
||||
ObjectGuid charm_guid = GetCharmGuid();
|
||||
if (!charm_guid.IsEmpty())
|
||||
{
|
||||
if(Unit* pet = ObjectAccessor::GetUnit(*this, charm_guid))
|
||||
if (Unit* pet = ObjectAccessor::GetUnit(*this, charm_guid))
|
||||
return pet;
|
||||
|
||||
sLog.outError("Unit::GetCharm: Charmed creature %u not exist.",GUID_LOPART(charm_guid));
|
||||
sLog.outError("Unit::GetCharm: Charmed %s not exist.", charm_guid.GetString().c_str());
|
||||
const_cast<Unit*>(this)->SetCharm(NULL);
|
||||
}
|
||||
|
||||
|
|
@ -5871,7 +5875,7 @@ float Unit::GetCombatDistance( const Unit* target ) const
|
|||
|
||||
void Unit::SetPet(Pet* pet)
|
||||
{
|
||||
SetPetGUID(pet ? pet->GetGUID() : 0);
|
||||
SetPetGuid(pet ? pet->GetObjectGuid() : ObjectGuid());
|
||||
|
||||
if(pet && GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)this)->SendPetGUIDs();
|
||||
|
|
@ -5879,7 +5883,7 @@ void Unit::SetPet(Pet* pet)
|
|||
|
||||
void Unit::SetCharm(Unit* pet)
|
||||
{
|
||||
SetCharmGUID(pet ? pet->GetGUID() : 0);
|
||||
SetCharmGuid(pet ? pet->GetObjectGuid() : ObjectGuid());
|
||||
}
|
||||
|
||||
void Unit::AddGuardian( Pet* pet )
|
||||
|
|
@ -7797,7 +7801,7 @@ bool Unit::isVisibleForOrDetect(Unit const* u, WorldObject const* viewPoint, boo
|
|||
return false;
|
||||
}
|
||||
}
|
||||
else if(GetCharmerOrOwnerGUID()) // distance for show pet/charmed
|
||||
else if (!GetCharmerOrOwnerGuid().IsEmpty()) // distance for show pet/charmed
|
||||
{
|
||||
// Pet/charmed far than max visible distance for player or not in our map are not visible too
|
||||
if (!IsWithinDistInMap(viewPoint, _map.GetVisibilityDistance() + (inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f), is3dDistance))
|
||||
|
|
@ -7811,7 +7815,7 @@ bool Unit::isVisibleForOrDetect(Unit const* u, WorldObject const* viewPoint, boo
|
|||
}
|
||||
|
||||
// always seen by owner
|
||||
if (GetCharmerOrOwnerGUID()==u->GetGUID())
|
||||
if (GetCharmerOrOwnerGuid() == u->GetObjectGuid())
|
||||
return true;
|
||||
|
||||
// isInvisibleForAlive() those units can only be seen by dead or if other
|
||||
|
|
@ -8409,11 +8413,11 @@ bool Unit::CanHaveThreatList() const
|
|||
return false;
|
||||
|
||||
// pets can not have a threat list, unless they are controlled by a creature
|
||||
if (creature->IsPet() && IS_PLAYER_GUID(((Pet const*)creature)->GetOwnerGUID()))
|
||||
if (creature->IsPet() && creature->GetOwnerGuid().IsPlayer())
|
||||
return false;
|
||||
|
||||
// charmed units can not have a threat list if charmed by player
|
||||
if (creature->isCharmed() && IS_PLAYER_GUID(creature->GetCharmerGUID()))
|
||||
if (creature->GetCharmerGuid().IsPlayer())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
@ -10307,8 +10311,8 @@ Pet* Unit::CreateTamedPetFrom(Creature* creatureTarget,uint32 spell_id)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
pet->SetOwnerGUID(GetGUID());
|
||||
pet->SetCreatorGUID(GetGUID());
|
||||
pet->SetOwnerGuid(GetObjectGuid());
|
||||
pet->SetCreatorGuid(GetObjectGuid());
|
||||
pet->setFaction(getFaction());
|
||||
pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, spell_id);
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "10670"
|
||||
#define REVISION_NR "10671"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue