Core/SAI: Add check so npc will not send text to pet. Also updated isPet() to IsPet().
This commit is contained in:
1 parent
9ec22fffa0
commit
047608e7de
33 files changed
+134
-134
No files matched your search
@@ -333,7 +333,7 @@ void Unit::Update(uint32 p_time)
|
||||
SendThreatListUpdate();
|
||||
|
||||
// update combat timer only for players and pets (only pets with PetAI)
|
||||
if (isInCombat() && (GetTypeId() == TYPEID_PLAYER || (ToCreature()->isPet() && IsControlledByPlayer())))
|
||||
if (isInCombat() && (GetTypeId() == TYPEID_PLAYER || (ToCreature()->IsPet() && IsControlledByPlayer())))
|
||||
{
|
||||
// Check UNIT_STATE_MELEE_ATTACKING or UNIT_STATE_CHASE (without UNIT_STATE_FOLLOW in this case) so pets can reach far away
|
||||
// targets without stopping half way there and running off.
|
||||
@@ -583,7 +583,7 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam
|
||||
}
|
||||
|
||||
// Signal the pet it was attacked so the AI can respond if needed
|
||||
if (victim->GetTypeId() == TYPEID_UNIT && this != victim && victim->isPet() && victim->isAlive())
|
||||
if (victim->GetTypeId() == TYPEID_UNIT && this != victim && victim->IsPet() && victim->isAlive())
|
||||
victim->ToPet()->AI()->AttackedBy(this);
|
||||
|
||||
if (damagetype != NODAMAGE)
|
||||
@@ -2085,8 +2085,8 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT
|
||||
|
||||
// Max 40% chance to score a glancing blow against mobs that are higher level (can do only players and pets and not with ranged weapon)
|
||||
if (attType != RANGED_ATTACK &&
|
||||
(GetTypeId() == TYPEID_PLAYER || ToCreature()->isPet()) &&
|
||||
victim->GetTypeId() != TYPEID_PLAYER && !victim->ToCreature()->isPet() &&
|
||||
(GetTypeId() == TYPEID_PLAYER || ToCreature()->IsPet()) &&
|
||||
victim->GetTypeId() != TYPEID_PLAYER && !victim->ToCreature()->IsPet() &&
|
||||
getLevel() < victim->getLevelForTarget(this))
|
||||
{
|
||||
// cap possible value (with bonuses > max skill)
|
||||
@@ -3148,7 +3148,7 @@ bool Unit::IsUnderWater() const
|
||||
|
||||
void Unit::UpdateUnderwaterState(Map* m, float x, float y, float z)
|
||||
{
|
||||
if (!isPet() && !IsVehicle())
|
||||
if (!IsPet() && !IsVehicle())
|
||||
return;
|
||||
|
||||
LiquidData liquid_status;
|
||||
@@ -8442,7 +8442,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
|
||||
case 48090:
|
||||
{
|
||||
// Get talent aura from owner
|
||||
if (isPet())
|
||||
if (IsPet())
|
||||
if (Unit* owner = GetOwner())
|
||||
{
|
||||
if (AuraEffect* aurEff = owner->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, 3220, 0))
|
||||
@@ -8999,7 +8999,7 @@ bool Unit::Attack(Unit* victim, bool meleeAttack)
|
||||
//if (GetTypeId() == TYPEID_UNIT)
|
||||
// ToCreature()->SetCombatStartPosition(GetPositionX(), GetPositionY(), GetPositionZ());
|
||||
|
||||
if (GetTypeId() == TYPEID_UNIT && !ToCreature()->isPet())
|
||||
if (GetTypeId() == TYPEID_UNIT && !ToCreature()->IsPet())
|
||||
{
|
||||
// should not let player enter combat by right clicking target - doesn't helps
|
||||
SetInCombatWith(victim);
|
||||
@@ -9355,10 +9355,10 @@ void Unit::SetMinion(Minion *minion, bool apply)
|
||||
{
|
||||
if (Guardian* oldPet = GetGuardianPet())
|
||||
{
|
||||
if (oldPet != minion && (oldPet->isPet() || minion->isPet() || oldPet->GetEntry() != minion->GetEntry()))
|
||||
if (oldPet != minion && (oldPet->IsPet() || minion->IsPet() || oldPet->GetEntry() != minion->GetEntry()))
|
||||
{
|
||||
// remove existing minion pet
|
||||
if (oldPet->isPet())
|
||||
if (oldPet->IsPet())
|
||||
((Pet*)oldPet)->Remove(PET_SAVE_AS_CURRENT);
|
||||
else
|
||||
oldPet->UnSummon();
|
||||
@@ -9389,7 +9389,7 @@ void Unit::SetMinion(Minion *minion, bool apply)
|
||||
minion->SetByteValue(UNIT_FIELD_BYTES_2, 1, GetByteValue(UNIT_FIELD_BYTES_2, 1));
|
||||
|
||||
// FIXME: hack, speed must be set only at follow
|
||||
if (GetTypeId() == TYPEID_PLAYER && minion->isPet())
|
||||
if (GetTypeId() == TYPEID_PLAYER && minion->IsPet())
|
||||
for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i)
|
||||
minion->SetSpeed(UnitMoveType(i), m_speed_rate[i], true);
|
||||
|
||||
@@ -9477,7 +9477,7 @@ void Unit::SetMinion(Minion *minion, bool apply)
|
||||
// show another pet bar if there is no charm bar
|
||||
if (GetTypeId() == TYPEID_PLAYER && !GetCharmGUID())
|
||||
{
|
||||
if ((*itr)->isPet())
|
||||
if ((*itr)->IsPet())
|
||||
ToPlayer()->PetSpellInitialize();
|
||||
else
|
||||
ToPlayer()->CharmSpellInitialize();
|
||||
@@ -9730,7 +9730,7 @@ Unit* Unit::GetNextRandomRaidMemberOrPet(float radius)
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
player = ToPlayer();
|
||||
// Should we enable this also for charmed units?
|
||||
else if (GetTypeId() == TYPEID_UNIT && ToCreature()->isPet())
|
||||
else if (GetTypeId() == TYPEID_UNIT && ToCreature()->IsPet())
|
||||
player = GetOwner()->ToPlayer();
|
||||
|
||||
if (!player)
|
||||
@@ -9895,7 +9895,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
|
||||
int32 DoneTotal = 0;
|
||||
|
||||
// Pet damage?
|
||||
if (GetTypeId() == TYPEID_UNIT && !ToCreature()->isPet())
|
||||
if (GetTypeId() == TYPEID_UNIT && !ToCreature()->IsPet())
|
||||
DoneTotalMod *= ToCreature()->GetSpellDamageMod(ToCreature()->GetCreatureTemplate()->rank);
|
||||
|
||||
// Some spells don't benefit from pct done mods
|
||||
@@ -10174,7 +10174,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
|
||||
if (HasAura(100001))
|
||||
DoneTotalMod *= 4;
|
||||
// Shadow Bite (15% increase from each dot)
|
||||
if (spellProto->SpellFamilyFlags[1] & 0x00400000 && isPet())
|
||||
if (spellProto->SpellFamilyFlags[1] & 0x00400000 && IsPet())
|
||||
if (uint8 count = victim->GetDoTsByCaster(GetOwnerGUID()))
|
||||
AddPct(DoneTotalMod, 15 * count);
|
||||
break;
|
||||
@@ -11670,7 +11670,7 @@ void Unit::CombatStart(Unit* target, bool initialAggro)
|
||||
if (!target->isInCombat() && target->GetTypeId() != TYPEID_PLAYER
|
||||
&& !target->ToCreature()->HasReactState(REACT_PASSIVE) && target->ToCreature()->IsAIEnabled)
|
||||
{
|
||||
if (target->isPet())
|
||||
if (target->IsPet())
|
||||
target->ToCreature()->AI()->AttackedBy(this); // PetAI has special handler before AttackStart()
|
||||
else
|
||||
target->ToCreature()->AI()->AttackStart(this);
|
||||
@@ -11726,7 +11726,7 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy)
|
||||
creature->GetFormation()->MemberAttackStart(creature, enemy);
|
||||
}
|
||||
|
||||
if (isPet())
|
||||
if (IsPet())
|
||||
{
|
||||
UpdateSpeed(MOVE_RUN, true);
|
||||
UpdateSpeed(MOVE_SWIM, true);
|
||||
@@ -11759,7 +11759,7 @@ void Unit::ClearInCombat()
|
||||
if (HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TAPPED))
|
||||
SetUInt32Value(UNIT_DYNAMIC_FLAGS, creature->GetCreatureTemplate()->dynamicflags);
|
||||
|
||||
if (creature->isPet())
|
||||
if (creature->IsPet())
|
||||
{
|
||||
if (Unit* owner = GetOwner())
|
||||
for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i)
|
||||
@@ -12008,7 +12008,7 @@ int32 Unit::ModifyHealth(int32 dVal)
|
||||
return 0;
|
||||
|
||||
// Part of Evade mechanics. Only track health lost, not gained.
|
||||
if (dVal < 0 && GetTypeId() != TYPEID_PLAYER && !isPet())
|
||||
if (dVal < 0 && GetTypeId() != TYPEID_PLAYER && !IsPet())
|
||||
SetLastDamagedTime(time(NULL));
|
||||
|
||||
int32 curHealth = (int32)GetHealth();
|
||||
@@ -12240,7 +12240,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced)
|
||||
if (GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
Unit* pOwner = GetCharmerOrOwner();
|
||||
if ((isPet() || isGuardian()) && !isInCombat() && pOwner) // Must check for owner or crash on "Tame Beast"
|
||||
if ((IsPet() || isGuardian()) && !isInCombat() && pOwner) // Must check for owner or crash on "Tame Beast"
|
||||
{
|
||||
// For every yard over 5, increase speed by 0.01
|
||||
// to help prevent pet from lagging behind and despawning
|
||||
@@ -13428,9 +13428,9 @@ uint32 Unit::GetCreatePowers(Powers power) const
|
||||
{
|
||||
case POWER_MANA: return GetCreateMana();
|
||||
case POWER_RAGE: return 1000;
|
||||
case POWER_FOCUS: return (GetTypeId() == TYPEID_PLAYER || !((Creature const*)this)->isPet() || ((Pet const*)this)->getPetType() != HUNTER_PET ? 0 : 100);
|
||||
case POWER_FOCUS: return (GetTypeId() == TYPEID_PLAYER || !((Creature const*)this)->IsPet() || ((Pet const*)this)->getPetType() != HUNTER_PET ? 0 : 100);
|
||||
case POWER_ENERGY: return 100;
|
||||
case POWER_HAPPINESS: return (GetTypeId() == TYPEID_PLAYER || !((Creature const*)this)->isPet() || ((Pet const*)this)->getPetType() != HUNTER_PET ? 0 : 1050000);
|
||||
case POWER_HAPPINESS: return (GetTypeId() == TYPEID_PLAYER || !((Creature const*)this)->IsPet() || ((Pet const*)this)->getPetType() != HUNTER_PET ? 0 : 1050000);
|
||||
case POWER_RUNIC_POWER: return 1000;
|
||||
case POWER_RUNE: return 0;
|
||||
case POWER_HEALTH: return 0;
|
||||
@@ -14382,7 +14382,7 @@ Player* Unit::GetSpellModOwner() const
|
||||
{
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
return (Player*)this;
|
||||
if (ToCreature()->isPet() || ToCreature()->isTotem())
|
||||
if (ToCreature()->IsPet() || ToCreature()->isTotem())
|
||||
{
|
||||
Unit* owner = GetOwner();
|
||||
if (owner && owner->GetTypeId() == TYPEID_PLAYER)
|
||||
@@ -14671,7 +14671,7 @@ void Unit::ApplyCastTimePercentMod(float val, bool apply)
|
||||
uint32 Unit::GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectType damagetype, uint32 CastingTime) const
|
||||
{
|
||||
// Not apply this to creature casted spells with casttime == 0
|
||||
if (CastingTime == 0 && GetTypeId() == TYPEID_UNIT && !ToCreature()->isPet())
|
||||
if (CastingTime == 0 && GetTypeId() == TYPEID_UNIT && !ToCreature()->IsPet())
|
||||
return 3500;
|
||||
|
||||
if (CastingTime > 7000) CastingTime = 7000;
|
||||
@@ -14771,7 +14771,7 @@ void Unit::UpdateAuraForGroup(uint8 slot)
|
||||
player->SetAuraUpdateMaskForRaid(slot);
|
||||
}
|
||||
}
|
||||
else if (GetTypeId() == TYPEID_UNIT && ToCreature()->isPet())
|
||||
else if (GetTypeId() == TYPEID_UNIT && ToCreature()->IsPet())
|
||||
{
|
||||
Pet* pet = ((Pet*)this);
|
||||
if (pet->isControlled())
|
||||
@@ -15240,7 +15240,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
|
||||
}
|
||||
|
||||
// Do KILL and KILLED procs. KILL proc is called only for the unit who landed the killing blow (and its owner - for pets and totems) regardless of who tapped the victim
|
||||
if (isPet() || isTotem())
|
||||
if (IsPet() || isTotem())
|
||||
if (Unit* owner = GetOwner())
|
||||
owner->ProcDamageAndSpell(victim, PROC_FLAG_KILL, PROC_FLAG_NONE, PROC_EX_NONE, 0);
|
||||
|
||||
@@ -15331,7 +15331,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
|
||||
{
|
||||
TC_LOG_DEBUG(LOG_FILTER_UNITS, "DealDamageNotPlayer");
|
||||
|
||||
if (!creature->isPet())
|
||||
if (!creature->IsPet())
|
||||
{
|
||||
creature->DeleteThreatList();
|
||||
CreatureTemplate const* cInfo = creature->GetCreatureTemplate();
|
||||
@@ -16398,7 +16398,7 @@ float Unit::GetCombatRatingReduction(CombatRating cr) const
|
||||
if (Player const* player = ToPlayer())
|
||||
return player->GetRatingBonusValue(cr);
|
||||
// Player's pet get resilience from owner
|
||||
else if (isPet() && GetOwner())
|
||||
else if (IsPet() && GetOwner())
|
||||
if (Player* owner = GetOwner()->ToPlayer())
|
||||
return owner->GetRatingBonusValue(cr);
|
||||
|
||||
|
||||
Reference in new issue
Block a user