[10610] Renamed some functions from the Creature class

Also other classes have been affected, due to the use of search&replace.
This will probably break some patches and 3rd party libraries, so make sure to update them if required.
Thanks to Phille for the original idea and patch!
This commit is contained in:
DasBlub 2010-10-14 21:56:40 +02:00
parent d090bce461
commit 61102e3b16
50 changed files with 305 additions and 305 deletions

View file

@ -30,7 +30,7 @@ int
AggressorAI::Permissible(const Creature *creature) AggressorAI::Permissible(const Creature *creature)
{ {
// have some hostile factions, it will be selected by IsHostileTo check at MoveInLineOfSight // have some hostile factions, it will be selected by IsHostileTo check at MoveInLineOfSight
if( !creature->isCivilian() && !creature->IsNeutralToAll() ) if( !creature->IsCivilian() && !creature->IsNeutralToAll() )
return PERMIT_BASE_PROACTIVE; return PERMIT_BASE_PROACTIVE;
return PERMIT_BASE_NO; return PERMIT_BASE_NO;
@ -44,7 +44,7 @@ void
AggressorAI::MoveInLineOfSight(Unit *u) AggressorAI::MoveInLineOfSight(Unit *u)
{ {
// Ignore Z for flying creatures // Ignore Z for flying creatures
if( !m_creature->canFly() && m_creature->GetDistanceZ(u) > CREATURE_Z_ATTACK_RANGE ) if( !m_creature->CanFly() && m_creature->GetDistanceZ(u) > CREATURE_Z_ATTACK_RANGE )
return; return;
if (m_creature->CanInitiateAttack() && u->isTargetableForAttack() && if (m_creature->CanInitiateAttack() && u->isTargetableForAttack() &&

View file

@ -1587,7 +1587,7 @@ void BattleGround::SpawnBGCreature(uint64 const& guid, uint32 respawntime)
else else
{ {
map->Add(obj); map->Add(obj);
obj->setDeathState(JUST_DIED); obj->SetDeathState(JUST_DIED);
obj->SetRespawnDelay(respawntime); obj->SetRespawnDelay(respawntime);
obj->RemoveCorpse(); obj->RemoveCorpse();
} }

View file

@ -73,8 +73,8 @@ ConfusedMovementGenerator<Creature>::_InitSpecific(Creature &creature, bool &is_
{ {
creature.RemoveSplineFlag(SPLINEFLAG_WALKMODE); creature.RemoveSplineFlag(SPLINEFLAG_WALKMODE);
is_water_ok = creature.canSwim(); is_water_ok = creature.CanSwim();
is_land_ok = creature.canWalk(); is_land_ok = creature.CanWalk();
} }
template<> template<>

View file

@ -172,7 +172,7 @@ void Creature::RemoveCorpse()
return; return;
m_corpseDecayTimer = 0; m_corpseDecayTimer = 0;
setDeathState(DEAD); SetDeathState(DEAD);
UpdateObjectVisibility(); UpdateObjectVisibility();
// stop loot rolling before loot clear and for close client dialogs // stop loot rolling before loot clear and for close client dialogs
@ -418,11 +418,11 @@ void Creature::Update(uint32 diff)
switch( m_deathState ) switch( m_deathState )
{ {
case JUST_ALIVED: case JUST_ALIVED:
// Don't must be called, see Creature::setDeathState JUST_ALIVED -> ALIVE promoting. // Don't must be called, see Creature::SetDeathState JUST_ALIVED -> ALIVE promoting.
sLog.outError("Creature (GUIDLow: %u Entry: %u ) in wrong state: JUST_ALIVED (4)",GetGUIDLow(),GetEntry()); sLog.outError("Creature (GUIDLow: %u Entry: %u ) in wrong state: JUST_ALIVED (4)",GetGUIDLow(),GetEntry());
break; break;
case JUST_DIED: case JUST_DIED:
// Don't must be called, see Creature::setDeathState JUST_DIED -> CORPSE promoting. // Don't must be called, see Creature::SetDeathState JUST_DIED -> CORPSE promoting.
sLog.outError("Creature (GUIDLow: %u Entry: %u ) in wrong state: JUST_DEAD (1)",GetGUIDLow(),GetEntry()); sLog.outError("Creature (GUIDLow: %u Entry: %u ) in wrong state: JUST_DEAD (1)",GetGUIDLow(),GetEntry());
break; break;
case DEAD: case DEAD:
@ -444,14 +444,14 @@ void Creature::Update(uint32 diff)
SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0); SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0);
if (m_isDeadByDefault) if (m_isDeadByDefault)
{ {
setDeathState(JUST_DIED); SetDeathState(JUST_DIED);
SetHealth(0); SetHealth(0);
i_motionMaster.Clear(); i_motionMaster.Clear();
clearUnitState(UNIT_STAT_ALL_STATE); clearUnitState(UNIT_STAT_ALL_STATE);
LoadCreaturesAddon(true); LoadCreatureAddon(true);
} }
else else
setDeathState( JUST_ALIVED ); SetDeathState( JUST_ALIVED );
//Call AI respawn virtual function //Call AI respawn virtual function
i_AI->JustRespawned(); i_AI->JustRespawned();
@ -557,7 +557,7 @@ void Creature::Update(uint32 diff)
} }
case DEAD_FALLING: case DEAD_FALLING:
{ {
setDeathState(CORPSE); SetDeathState(CORPSE);
} }
default: default:
break; break;
@ -611,7 +611,7 @@ void Creature::RegenerateMana()
void Creature::RegenerateHealth() void Creature::RegenerateHealth()
{ {
if (!isRegeneratingHealth()) if (!IsRegeneratingHealth())
return; return;
uint32 curValue = GetHealth(); uint32 curValue = GetHealth();
@ -715,13 +715,13 @@ bool Creature::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry,
m_corpseDelay = sWorld.getConfig(CONFIG_UINT32_CORPSE_DECAY_NORMAL); m_corpseDelay = sWorld.getConfig(CONFIG_UINT32_CORPSE_DECAY_NORMAL);
break; break;
} }
LoadCreaturesAddon(); LoadCreatureAddon();
} }
return bResult; return bResult;
} }
bool Creature::isCanTrainingOf(Player* pPlayer, bool msg) const bool Creature::IsTrainerOf(Player* pPlayer, bool msg) const
{ {
if(!isTrainer()) if(!isTrainer())
return false; return false;
@ -807,7 +807,7 @@ bool Creature::isCanTrainingOf(Player* pPlayer, bool msg) const
return true; return true;
} }
bool Creature::isCanInteractWithBattleMaster(Player* pPlayer, bool msg) const bool Creature::CanInteractWithBattleMaster(Player* pPlayer, bool msg) const
{ {
if(!isBattleMaster()) if(!isBattleMaster())
return false; return false;
@ -842,7 +842,7 @@ bool Creature::isCanInteractWithBattleMaster(Player* pPlayer, bool msg) const
return true; return true;
} }
bool Creature::isCanTrainingAndResetTalentsOf(Player* pPlayer) const bool Creature::CanTrainAndResetTalentsOf(Player* pPlayer) const
{ {
return pPlayer->getLevel() >= 10 return pPlayer->getLevel() >= 10
&& GetCreatureInfo()->trainer_type == TRAINER_TYPE_CLASS && GetCreatureInfo()->trainer_type == TRAINER_TYPE_CLASS
@ -1062,7 +1062,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
void Creature::SelectLevel(const CreatureInfo *cinfo, float percentHealth, float percentMana) void Creature::SelectLevel(const CreatureInfo *cinfo, float percentHealth, float percentMana)
{ {
uint32 rank = isPet()? 0 : cinfo->rank; uint32 rank = IsPet()? 0 : cinfo->rank;
// level // level
uint32 minlevel = std::min(cinfo->maxlevel, cinfo->minlevel); uint32 minlevel = std::min(cinfo->maxlevel, cinfo->minlevel);
@ -1233,7 +1233,7 @@ bool Creature::LoadFromDB(uint32 guidlow, Map *map)
if(m_respawnTime > time(NULL)) // not ready to respawn if(m_respawnTime > time(NULL)) // not ready to respawn
{ {
m_deathState = DEAD; m_deathState = DEAD;
if(canFly()) if(CanFly())
{ {
float tz = GetMap()->GetHeight(data->posX, data->posY, data->posZ, false); float tz = GetMap()->GetHeight(data->posX, data->posY, data->posZ, false);
if(data->posZ - tz > 0.1) if(data->posZ - tz > 0.1)
@ -1288,7 +1288,7 @@ void Creature::LoadEquipment(uint32 equip_entry, bool force)
SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + i, einfo->equipentry[i]); SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + i, einfo->equipentry[i]);
} }
bool Creature::hasQuest(uint32 quest_id) const bool Creature::HasQuest(uint32 quest_id) const
{ {
QuestRelationsMapBounds bounds = sObjectMgr.GetCreatureQuestRelationsMapBounds(GetEntry()); QuestRelationsMapBounds bounds = sObjectMgr.GetCreatureQuestRelationsMapBounds(GetEntry());
for(QuestRelationsMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr) for(QuestRelationsMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
@ -1299,7 +1299,7 @@ bool Creature::hasQuest(uint32 quest_id) const
return false; return false;
} }
bool Creature::hasInvolvedQuest(uint32 quest_id) const bool Creature::HasInvolvedQuest(uint32 quest_id) const
{ {
QuestRelationsMapBounds bounds = sObjectMgr.GetCreatureQuestInvolvedRelationsMapBounds(GetEntry()); QuestRelationsMapBounds bounds = sObjectMgr.GetCreatureQuestInvolvedRelationsMapBounds(GetEntry());
for(QuestRelationsMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr) for(QuestRelationsMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
@ -1337,8 +1337,8 @@ float Creature::GetAttackDistance(Unit const* pl) const
if(aggroRate == 0) if(aggroRate == 0)
return 0.0f; return 0.0f;
uint32 playerlevel = pl->getLevelForTarget(this); uint32 playerlevel = pl->GetLevelForTarget(this);
uint32 creaturelevel = getLevelForTarget(pl); uint32 creaturelevel = GetLevelForTarget(pl);
int32 leveldif = int32(playerlevel) - int32(creaturelevel); int32 leveldif = int32(playerlevel) - int32(creaturelevel);
@ -1369,7 +1369,7 @@ float Creature::GetAttackDistance(Unit const* pl) const
return (RetDistance*aggroRate); return (RetDistance*aggroRate);
} }
void Creature::setDeathState(DeathState s) void Creature::SetDeathState(DeathState s)
{ {
if ((s == JUST_DIED && !m_isDeadByDefault) || (s == JUST_ALIVED && m_isDeadByDefault)) if ((s == JUST_DIED && !m_isDeadByDefault) || (s == JUST_ALIVED && m_isDeadByDefault))
{ {
@ -1377,15 +1377,15 @@ void Creature::setDeathState(DeathState s)
m_respawnTime = time(NULL) + m_respawnDelay; // respawn delay (spawntimesecs) m_respawnTime = time(NULL) + m_respawnDelay; // respawn delay (spawntimesecs)
// always save boss respawn time at death to prevent crash cheating // always save boss respawn time at death to prevent crash cheating
if (sWorld.getConfig(CONFIG_BOOL_SAVE_RESPAWN_TIME_IMMEDIATLY) || isWorldBoss()) if (sWorld.getConfig(CONFIG_BOOL_SAVE_RESPAWN_TIME_IMMEDIATLY) || IsWorldBoss())
SaveRespawnTime(); SaveRespawnTime();
} }
Unit::setDeathState(s); Unit::SetDeathState(s);
if (s == JUST_DIED) if (s == JUST_DIED)
{ {
SetTargetGUID(0); // remove target selection in any cases (can be set at aura remove in Unit::setDeathState) SetTargetGUID(0); // remove target selection in any cases (can be set at aura remove in Unit::SetDeathState)
SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
if (HasSearchedAssistance()) if (HasSearchedAssistance())
@ -1395,10 +1395,10 @@ void Creature::setDeathState(DeathState s)
} }
// return, since we promote to DEAD_FALLING. DEAD_FALLING is promoted to CORPSE at next update. // return, since we promote to DEAD_FALLING. DEAD_FALLING is promoted to CORPSE at next update.
if (canFly() && FallGround()) if (CanFly() && FallGround())
return; return;
Unit::setDeathState(CORPSE); Unit::SetDeathState(CORPSE);
} }
if (s == JUST_ALIVED) if (s == JUST_ALIVED)
@ -1410,11 +1410,11 @@ void Creature::setDeathState(DeathState s)
RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
AddSplineFlag(SPLINEFLAG_WALKMODE); AddSplineFlag(SPLINEFLAG_WALKMODE);
SetUInt32Value(UNIT_NPC_FLAGS, cinfo->npcflag); SetUInt32Value(UNIT_NPC_FLAGS, cinfo->npcflag);
Unit::setDeathState(ALIVE); Unit::SetDeathState(ALIVE);
clearUnitState(UNIT_STAT_ALL_STATE); clearUnitState(UNIT_STAT_ALL_STATE);
i_motionMaster.Clear(); i_motionMaster.Clear();
SetMeleeDamageSchool(SpellSchools(cinfo->dmgschool)); SetMeleeDamageSchool(SpellSchools(cinfo->dmgschool));
LoadCreaturesAddon(true); LoadCreatureAddon(true);
} }
} }
@ -1437,7 +1437,7 @@ bool Creature::FallGround()
if (fabs(GetPositionZ() - tz) < 0.1f) if (fabs(GetPositionZ() - tz) < 0.1f)
return false; return false;
Unit::setDeathState(DEAD_FALLING); Unit::SetDeathState(DEAD_FALLING);
float dz = tz - GetPositionZ(); float dz = tz - GetPositionZ();
float distance = sqrt(dz*dz); float distance = sqrt(dz*dz);
@ -1491,13 +1491,13 @@ void Creature::ForcedDespawn(uint32 timeMSToDespawn)
} }
if (isAlive()) if (isAlive())
setDeathState(JUST_DIED); SetDeathState(JUST_DIED);
RemoveCorpse(); RemoveCorpse();
SetHealth(0); // just for nice GM-mode view SetHealth(0); // just for nice GM-mode view
} }
bool Creature::IsImmunedToSpell(SpellEntry const* spellInfo) bool Creature::IsImmuneToSpell(SpellEntry const* spellInfo)
{ {
if (!spellInfo) if (!spellInfo)
return false; return false;
@ -1505,10 +1505,10 @@ bool Creature::IsImmunedToSpell(SpellEntry const* spellInfo)
if (GetCreatureInfo()->MechanicImmuneMask & (1 << (spellInfo->Mechanic - 1))) if (GetCreatureInfo()->MechanicImmuneMask & (1 << (spellInfo->Mechanic - 1)))
return true; return true;
return Unit::IsImmunedToSpell(spellInfo); return Unit::IsImmuneToSpell(spellInfo);
} }
bool Creature::IsImmunedToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex index) const bool Creature::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex index) const
{ {
if (GetCreatureInfo()->MechanicImmuneMask & (1 << (spellInfo->EffectMechanic[index] - 1))) if (GetCreatureInfo()->MechanicImmuneMask & (1 << (spellInfo->EffectMechanic[index] - 1)))
return true; return true;
@ -1527,10 +1527,10 @@ bool Creature::IsImmunedToSpellEffect(SpellEntry const* spellInfo, SpellEffectIn
return true; return true;
} }
return Unit::IsImmunedToSpellEffect(spellInfo, index); return Unit::IsImmuneToSpellEffect(spellInfo, index);
} }
SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim) SpellEntry const *Creature::ReachWithSpellAttack(Unit *pVictim)
{ {
if(!pVictim) if(!pVictim)
return NULL; return NULL;
@ -1582,7 +1582,7 @@ SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim)
return NULL; return NULL;
} }
SpellEntry const *Creature::reachWithSpellCure(Unit *pVictim) SpellEntry const *Creature::ReachWithSpellCure(Unit *pVictim)
{ {
if(!pVictim) if(!pVictim)
return NULL; return NULL;
@ -1680,7 +1680,7 @@ void Creature::SendAIReaction(AiReaction reactionType)
void Creature::CallAssistance() void Creature::CallAssistance()
{ {
if( !m_AlreadyCallAssistance && getVictim() && !isPet() && !isCharmed()) if( !m_AlreadyCallAssistance && getVictim() && !IsPet() && !isCharmed())
{ {
SetNoCallAssistance(true); SetNoCallAssistance(true);
@ -1706,7 +1706,7 @@ void Creature::CallAssistance()
void Creature::CallForHelp(float fRadius) void Creature::CallForHelp(float fRadius)
{ {
if (fRadius <= 0.0f || !getVictim() || isPet() || isCharmed()) if (fRadius <= 0.0f || !getVictim() || IsPet() || isCharmed())
return; return;
MaNGOS::CallOfHelpCreatureInRangeDo u_do(this, getVictim(), fRadius); MaNGOS::CallOfHelpCreatureInRangeDo u_do(this, getVictim(), fRadius);
@ -1721,7 +1721,7 @@ bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction /
return false; return false;
// we don't need help from non-combatant ;) // we don't need help from non-combatant ;)
if (isCivilian()) if (IsCivilian())
return false; return false;
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_PASSIVE)) if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_PASSIVE))
@ -1770,7 +1770,7 @@ bool Creature::CanInitiateAttack()
void Creature::SaveRespawnTime() void Creature::SaveRespawnTime()
{ {
if(isPet() || !m_DBTableGuid) if(IsPet() || !m_DBTableGuid)
return; return;
if(m_respawnTime > time(NULL)) // dead (no corpse) if(m_respawnTime > time(NULL)) // dead (no corpse)
@ -1820,7 +1820,7 @@ CreatureDataAddon const* Creature::GetCreatureAddon() const
} }
//creature_addon table //creature_addon table
bool Creature::LoadCreaturesAddon(bool reload) bool Creature::LoadCreatureAddon(bool reload)
{ {
CreatureDataAddon const *cainfo = GetCreatureAddon(); CreatureDataAddon const *cainfo = GetCreatureAddon();
if(!cainfo) if(!cainfo)
@ -2139,10 +2139,10 @@ void Creature::AllLootRemovedFromCorpse()
} }
} }
uint32 Creature::getLevelForTarget( Unit const* target ) const uint32 Creature::GetLevelForTarget( Unit const* target ) const
{ {
if(!isWorldBoss()) if(!IsWorldBoss())
return Unit::getLevelForTarget(target); return Unit::GetLevelForTarget(target);
uint32 level = target->getLevel()+sWorld.getConfig(CONFIG_UINT32_WORLD_BOSS_LEVEL_DIFF); uint32 level = target->getLevel()+sWorld.getConfig(CONFIG_UINT32_WORLD_BOSS_LEVEL_DIFF);
if(level < 1) if(level < 1)

View file

@ -394,56 +394,56 @@ class MANGOS_DLL_SPEC Creature : public Unit
void RemoveFromWorld(); void RemoveFromWorld();
bool Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 team, const CreatureData *data = NULL); bool Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 team, const CreatureData *data = NULL);
bool LoadCreaturesAddon(bool reload = false); bool LoadCreatureAddon(bool reload = false);
void SelectLevel(const CreatureInfo *cinfo, float percentHealth = 100.0f, float percentMana = 100.0f); void SelectLevel(const CreatureInfo *cinfo, float percentHealth = 100.0f, float percentMana = 100.0f);
void LoadEquipment(uint32 equip_entry, bool force=false); void LoadEquipment(uint32 equip_entry, bool force=false);
uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; } uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; }
char const* GetSubName() const { return GetCreatureInfo()->SubName; } char const* GetSubName() const { return GetCreatureInfo()->SubName; }
void Update( uint32 time ); // overwrited Unit::Update void Update(uint32 time); // overwrite Unit::Update
void GetRespawnCoord(float &x, float &y, float &z, float* ori = NULL, float* dist =NULL) const; void GetRespawnCoord(float &x, float &y, float &z, float* ori = NULL, float* dist =NULL) const;
uint32 GetEquipmentId() const { return m_equipmentId; } uint32 GetEquipmentId() const { return m_equipmentId; }
CreatureSubtype GetSubtype() const { return m_subtype; } CreatureSubtype GetSubtype() const { return m_subtype; }
bool isPet() const { return m_subtype == CREATURE_SUBTYPE_PET; } bool IsPet() const { return m_subtype == CREATURE_SUBTYPE_PET; }
bool isVehicle() const { return m_subtype == CREATURE_SUBTYPE_VEHICLE; } bool IsVehicle() const { return m_subtype == CREATURE_SUBTYPE_VEHICLE; }
bool isTotem() const { return m_subtype == CREATURE_SUBTYPE_TOTEM; } bool IsTotem() const { return m_subtype == CREATURE_SUBTYPE_TOTEM; }
bool isTemporarySummon() const { return m_subtype == CREATURE_SUBTYPE_TEMPORARY_SUMMON; } bool IsTemporarySummon() const { return m_subtype == CREATURE_SUBTYPE_TEMPORARY_SUMMON; }
void SetCorpseDelay(uint32 delay) { m_corpseDelay = delay; } void SetCorpseDelay(uint32 delay) { m_corpseDelay = delay; }
bool isRacialLeader() const { return GetCreatureInfo()->RacialLeader; } bool IsRacialLeader() const { return GetCreatureInfo()->RacialLeader; }
bool isCivilian() const { return GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_CIVILIAN; } bool IsCivilian() const { return GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_CIVILIAN; }
bool canWalk() const { return GetCreatureInfo()->InhabitType & INHABIT_GROUND; } bool CanWalk() const { return GetCreatureInfo()->InhabitType & INHABIT_GROUND; }
bool canSwim() const { return GetCreatureInfo()->InhabitType & INHABIT_WATER; } bool CanSwim() const { return GetCreatureInfo()->InhabitType & INHABIT_WATER; }
bool canFly() const { return GetCreatureInfo()->InhabitType & INHABIT_AIR; } bool CanFly() const { return GetCreatureInfo()->InhabitType & INHABIT_AIR; }
///// TODO RENAME THIS!!!!!
bool isCanTrainingOf(Player* player, bool msg) const; bool IsTrainerOf(Player* player, bool msg) const;
bool isCanInteractWithBattleMaster(Player* player, bool msg) const; bool CanInteractWithBattleMaster(Player* player, bool msg) const;
bool isCanTrainingAndResetTalentsOf(Player* pPlayer) const; bool CanTrainAndResetTalentsOf(Player* pPlayer) const;
bool IsOutOfThreatArea(Unit* pVictim) const; bool IsOutOfThreatArea(Unit* pVictim) const;
bool IsImmunedToSpell(SpellEntry const* spellInfo); bool IsImmuneToSpell(SpellEntry const* spellInfo);
// redefine Unit::IsImmunedToSpell // redefine Unit::IsImmuneToSpell
bool IsImmunedToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex index) const; bool IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex index) const;
// redefine Unit::IsImmunedToSpellEffect // redefine Unit::IsImmuneToSpellEffect
bool isElite() const bool IsElite() const
{ {
if(isPet()) if(IsPet())
return false; return false;
uint32 rank = GetCreatureInfo()->rank; uint32 rank = GetCreatureInfo()->rank;
return rank != CREATURE_ELITE_NORMAL && rank != CREATURE_ELITE_RARE; return rank != CREATURE_ELITE_NORMAL && rank != CREATURE_ELITE_RARE;
} }
bool isWorldBoss() const bool IsWorldBoss() const
{ {
if(isPet()) if(IsPet())
return false; return false;
return GetCreatureInfo()->rank == CREATURE_ELITE_WORLDBOSS; return GetCreatureInfo()->rank == CREATURE_ELITE_WORLDBOSS;
} }
uint32 getLevelForTarget(Unit const* target) const; // overwrite Unit::getLevelForTarget for boss level support uint32 GetLevelForTarget(Unit const* target) const; // overwrite Unit::GetLevelForTarget for boss level support
bool IsInEvadeMode() const; bool IsInEvadeMode() const;
@ -477,7 +477,7 @@ class MANGOS_DLL_SPEC Creature : public Unit
void SendMonsterMoveWithSpeedToCurrentDestination(Player* player = NULL); void SendMonsterMoveWithSpeedToCurrentDestination(Player* player = NULL);
uint32 GetShieldBlockValue() const //dunno mob block value uint32 GetShieldBlockValue() const // dunno mob block value
{ {
return (getLevel() / 2 + uint32(GetStat(STAT_STRENGTH) / 20)); return (getLevel() / 2 + uint32(GetStat(STAT_STRENGTH) / 20));
} }
@ -529,7 +529,7 @@ class MANGOS_DLL_SPEC Creature : public Unit
// overwrite WorldObject function for proper name localization // overwrite WorldObject function for proper name localization
const char* GetNameForLocaleIdx(int32 locale_idx) const; const char* GetNameForLocaleIdx(int32 locale_idx) const;
void setDeathState(DeathState s); // overwrite virtual Unit::setDeathState void SetDeathState(DeathState s); // overwrite virtual Unit::SetDeathState
bool FallGround(); bool FallGround();
bool LoadFromDB(uint32 guid, Map *map); bool LoadFromDB(uint32 guid, Map *map);
@ -554,8 +554,8 @@ class MANGOS_DLL_SPEC Creature : public Unit
void AllLootRemovedFromCorpse(); void AllLootRemovedFromCorpse();
Player* GetOriginalLootRecipient() const; // ignore group changes/etc, not for looting Player* GetOriginalLootRecipient() const; // ignore group changes/etc, not for looting
SpellEntry const *reachWithSpellAttack(Unit *pVictim); SpellEntry const *ReachWithSpellAttack(Unit *pVictim);
SpellEntry const *reachWithSpellCure(Unit *pVictim); SpellEntry const *ReachWithSpellCure(Unit *pVictim);
uint32 m_spells[CREATURE_MAX_SPELLS]; uint32 m_spells[CREATURE_MAX_SPELLS];
CreatureSpellCooldowns m_CreatureSpellCooldowns; CreatureSpellCooldowns m_CreatureSpellCooldowns;
@ -584,7 +584,7 @@ class MANGOS_DLL_SPEC Creature : public Unit
bool IsVisibleInGridForPlayer(Player* pl) const; bool IsVisibleInGridForPlayer(Player* pl) const;
void RemoveCorpse(); void RemoveCorpse();
bool isDeadByDefault() const { return m_isDeadByDefault; }; bool IsDeadByDefault() const { return m_isDeadByDefault; };
void ForcedDespawn(uint32 timeMSToDespawn = 0); void ForcedDespawn(uint32 timeMSToDespawn = 0);
@ -608,11 +608,11 @@ class MANGOS_DLL_SPEC Creature : public Unit
Unit* SelectAttackingTarget(AttackingTarget target, uint32 position) const; Unit* SelectAttackingTarget(AttackingTarget target, uint32 position) const;
bool hasQuest(uint32 quest_id) const; bool HasQuest(uint32 quest_id) const;
bool hasInvolvedQuest(uint32 quest_id) const; bool HasInvolvedQuest(uint32 quest_id) const;
GridReference<Creature> &GetGridRef() { return m_gridRef; } GridReference<Creature> &GetGridRef() { return m_gridRef; }
bool isRegeneratingHealth() { return m_regenHealth; } bool IsRegeneratingHealth() { return m_regenHealth; }
virtual uint8 GetPetAutoSpellSize() const { return CREATURE_MAX_SPELLS; } virtual uint8 GetPetAutoSpellSize() const { return CREATURE_MAX_SPELLS; }
virtual uint32 GetPetAutoSpellOnPos(uint8 pos) const virtual uint32 GetPetAutoSpellOnPos(uint8 pos) const
{ {

View file

@ -33,7 +33,7 @@ namespace FactorySelector
CreatureAI* selectAI(Creature *creature) CreatureAI* selectAI(Creature *creature)
{ {
// Allow scripting AI for normal creatures and not controlled pets (guardians and mini-pets) // Allow scripting AI for normal creatures and not controlled pets (guardians and mini-pets)
if ((!creature->isPet() || !((Pet*)creature)->isControlled()) && !creature->isCharmed()) if ((!creature->IsPet() || !((Pet*)creature)->isControlled()) && !creature->isCharmed())
if(CreatureAI* scriptedAI = Script->GetAI(creature)) if(CreatureAI* scriptedAI = Script->GetAI(creature))
return scriptedAI; return scriptedAI;
@ -46,10 +46,10 @@ namespace FactorySelector
// select by NPC flags _first_ - otherwise EventAI might be choosen for pets/totems // select by NPC flags _first_ - otherwise EventAI might be choosen for pets/totems
// excplicit check for isControlled() and owner type to allow guardian, mini-pets and pets controlled by NPCs to be scripted by EventAI // excplicit check for isControlled() and owner type to allow guardian, mini-pets and pets controlled by NPCs to be scripted by EventAI
Unit *owner=NULL; Unit *owner=NULL;
if ((creature->isPet() && ((Pet*)creature)->isControlled() && if ((creature->IsPet() && ((Pet*)creature)->isControlled() &&
((owner=creature->GetOwner()) && owner->GetTypeId()==TYPEID_PLAYER)) || creature->isCharmed()) ((owner=creature->GetOwner()) && owner->GetTypeId()==TYPEID_PLAYER)) || creature->isCharmed())
ai_factory = ai_registry.GetRegistryItem("PetAI"); ai_factory = ai_registry.GetRegistryItem("PetAI");
else if (creature->isTotem()) else if (creature->IsTotem())
ai_factory = ai_registry.GetRegistryItem("TotemAI"); ai_factory = ai_registry.GetRegistryItem("TotemAI");
// select by script name // select by script name

View file

@ -1084,13 +1084,13 @@ void CreatureEventAI::MoveInLineOfSight(Unit *who)
} }
} }
if (m_creature->isCivilian() || m_creature->IsNeutralToAll()) if (m_creature->IsCivilian() || m_creature->IsNeutralToAll())
return; return;
if (m_creature->CanInitiateAttack() && who->isTargetableForAttack() && if (m_creature->CanInitiateAttack() && who->isTargetableForAttack() &&
m_creature->IsHostileTo(who) && who->isInAccessablePlaceFor(m_creature)) m_creature->IsHostileTo(who) && who->isInAccessablePlaceFor(m_creature))
{ {
if (!m_creature->canFly() && m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) if (!m_creature->CanFly() && m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE)
return; return;
float attackRadius = m_creature->GetAttackDistance(who); float attackRadius = m_creature->GetAttackDistance(who);

View file

@ -312,8 +312,8 @@ FleeingMovementGenerator<Creature>::_Init(Creature &owner)
{ {
owner.RemoveSplineFlag(SPLINEFLAG_WALKMODE); owner.RemoveSplineFlag(SPLINEFLAG_WALKMODE);
owner.SetTargetGUID(0); owner.SetTargetGUID(0);
is_water_ok = owner.canSwim(); is_water_ok = owner.CanSwim();
is_land_ok = owner.canWalk(); is_land_ok = owner.CanWalk();
} }
template<> template<>

View file

@ -111,7 +111,7 @@ namespace MaNGOS
inline uint32 Gain(Player *pl, Unit *u) inline uint32 Gain(Player *pl, Unit *u)
{ {
if(u->GetTypeId()==TYPEID_UNIT && ( if(u->GetTypeId()==TYPEID_UNIT && (
((Creature*)u)->isTotem() || ((Creature*)u)->isPet() || ((Creature*)u)->IsTotem() || ((Creature*)u)->IsPet() ||
(((Creature*)u)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL) )) (((Creature*)u)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL) ))
return 0; return 0;
@ -119,7 +119,7 @@ namespace MaNGOS
if( xp_gain == 0 ) if( xp_gain == 0 )
return 0; return 0;
if(u->GetTypeId()==TYPEID_UNIT && ((Creature*)u)->isElite()) if(u->GetTypeId()==TYPEID_UNIT && ((Creature*)u)->IsElite())
xp_gain *= 2; xp_gain *= 2;
return (uint32)(xp_gain*sWorld.getConfig(CONFIG_FLOAT_RATE_XP_KILL)); return (uint32)(xp_gain*sWorld.getConfig(CONFIG_FLOAT_RATE_XP_KILL));

View file

@ -635,7 +635,7 @@ GameObjectInfo const *GameObject::GetGOInfo() const
/*********************************************************/ /*********************************************************/
/*** QUEST SYSTEM ***/ /*** QUEST SYSTEM ***/
/*********************************************************/ /*********************************************************/
bool GameObject::hasQuest(uint32 quest_id) const bool GameObject::HasQuest(uint32 quest_id) const
{ {
QuestRelationsMapBounds bounds = sObjectMgr.GetGOQuestRelationsMapBounds(GetEntry()); QuestRelationsMapBounds bounds = sObjectMgr.GetGOQuestRelationsMapBounds(GetEntry());
for(QuestRelationsMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr) for(QuestRelationsMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
@ -646,7 +646,7 @@ bool GameObject::hasQuest(uint32 quest_id) const
return false; return false;
} }
bool GameObject::hasInvolvedQuest(uint32 quest_id) const bool GameObject::HasInvolvedQuest(uint32 quest_id) const
{ {
QuestRelationsMapBounds bounds = sObjectMgr.GetGOQuestInvolvedRelationsMapBounds(GetEntry()); QuestRelationsMapBounds bounds = sObjectMgr.GetGOQuestInvolvedRelationsMapBounds(GetEntry());
for(QuestRelationsMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr) for(QuestRelationsMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)

View file

@ -690,8 +690,8 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
Loot loot; Loot loot;
bool hasQuest(uint32 quest_id) const; bool HasQuest(uint32 quest_id) const;
bool hasInvolvedQuest(uint32 quest_id) const; bool HasInvolvedQuest(uint32 quest_id) const;
bool ActivateToQuest(Player *pTarget) const; bool ActivateToQuest(Player *pTarget) const;
void UseDoorOrButton(uint32 time_to_restore = 0, bool alternative = false); void UseDoorOrButton(uint32 time_to_restore = 0, bool alternative = false);
// 0 = use `gameobject`.`spawntimesecs` // 0 = use `gameobject`.`spawntimesecs`

View file

@ -554,7 +554,7 @@ namespace MaNGOS
bool operator()(Creature* u) bool operator()(Creature* u)
{ {
if (i_fobj->isHonorOrXPTarget(u) || if (i_fobj->isHonorOrXPTarget(u) ||
u->getDeathState() != CORPSE || u->isDeadByDefault() || u->IsTaxiFlying() || u->getDeathState() != CORPSE || u->IsDeadByDefault() || u->IsTaxiFlying() ||
( u->GetCreatureTypeMask() & (1 << (CREATURE_TYPE_HUMANOID-1)) )==0 || ( u->GetCreatureTypeMask() & (1 << (CREATURE_TYPE_HUMANOID-1)) )==0 ||
(u->GetDisplayId() != u->GetNativeDisplayId())) (u->GetDisplayId() != u->GetNativeDisplayId()))
return false; return false;
@ -582,7 +582,7 @@ namespace MaNGOS
} }
bool operator()(Creature* u) bool operator()(Creature* u)
{ {
if (u->getDeathState()!=CORPSE || u->IsTaxiFlying() || u->isDeadByDefault() || if (u->getDeathState()!=CORPSE || u->IsTaxiFlying() || u->IsDeadByDefault() ||
(u->GetDisplayId() != u->GetNativeDisplayId()) || (u->GetDisplayId() != u->GetNativeDisplayId()) ||
(u->GetCreatureTypeMask() & CREATURE_TYPEMASK_MECHANICAL_OR_ELEMENTAL)!=0) (u->GetCreatureTypeMask() & CREATURE_TYPEMASK_MECHANICAL_OR_ELEMENTAL)!=0)
return false; return false;
@ -896,7 +896,7 @@ namespace MaNGOS
return false; return false;
// ignore totems as AoE targets // ignore totems as AoE targets
if(u->GetTypeId()==TYPEID_UNIT && ((Creature*)u)->isTotem()) if(u->GetTypeId()==TYPEID_UNIT && ((Creature*)u)->IsTotem())
return false; return false;
// check visibility only for unit-like original casters // check visibility only for unit-like original casters
@ -931,7 +931,7 @@ namespace MaNGOS
if (!u->isTargetableForAttack()) if (!u->isTargetableForAttack())
return false; return false;
if(u->GetTypeId()==TYPEID_UNIT && ((Creature*)u)->isTotem()) if(u->GetTypeId()==TYPEID_UNIT && ((Creature*)u)->IsTotem())
return false; return false;
if(( i_targetForPlayer ? !i_obj->IsFriendlyTo(u) : i_obj->IsHostileTo(u) )&& i_obj->IsWithinDistInMap(u, i_range)) if(( i_targetForPlayer ? !i_obj->IsFriendlyTo(u) : i_obj->IsHostileTo(u) )&& i_obj->IsWithinDistInMap(u, i_range))

View file

@ -132,7 +132,7 @@ inline void MaNGOS::DynamicObjectUpdater::VisitHelper(Unit* target)
if (!target->isAlive() || target->IsTaxiFlying() ) if (!target->isAlive() || target->IsTaxiFlying() )
return; return;
if (target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->isTotem()) if (target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->IsTotem())
return; return;
if (!i_dynobject.IsWithinDistInMap(target, i_dynobject.GetRadius())) if (!i_dynobject.IsWithinDistInMap(target, i_dynobject.GetRadius()))
@ -168,7 +168,7 @@ inline void MaNGOS::DynamicObjectUpdater::VisitHelper(Unit* target)
SpellEffectIndex eff_index = i_dynobject.GetEffIndex(); SpellEffectIndex eff_index = i_dynobject.GetEffIndex();
// Check target immune to spell or aura // Check target immune to spell or aura
if (target->IsImmunedToSpell(spellInfo) || target->IsImmunedToSpellEffect(spellInfo, eff_index)) if (target->IsImmuneToSpell(spellInfo) || target->IsImmuneToSpellEffect(spellInfo, eff_index))
return; return;
// Apply PersistentAreaAura on target // Apply PersistentAreaAura on target

View file

@ -38,7 +38,7 @@ GuardAI::GuardAI(Creature *c) : CreatureAI(c), i_victimGuid(0), i_state(STATE_NO
void GuardAI::MoveInLineOfSight(Unit *u) void GuardAI::MoveInLineOfSight(Unit *u)
{ {
// Ignore Z for flying creatures // Ignore Z for flying creatures
if (!m_creature->canFly() && m_creature->GetDistanceZ(u) > CREATURE_Z_ATTACK_RANGE) if (!m_creature->CanFly() && m_creature->GetDistanceZ(u) > CREATURE_Z_ATTACK_RANGE)
return; return;
if (!m_creature->getVictim() && u->isTargetableForAttack() && if (!m_creature->getVictim() && u->isTargetableForAttack() &&

View file

@ -81,7 +81,7 @@ HomeMovementGenerator<Creature>::Update(Creature &owner, const uint32& time_diff
} }
} }
owner.LoadCreaturesAddon(true); owner.LoadCreatureAddon(true);
owner.AI()->JustReachedHome(); owner.AI()->JustReachedHome();
return false; return false;
} }

View file

@ -320,8 +320,8 @@ class MANGOS_DLL_SPEC Item : public Object
uState = state; uState = state;
} }
bool hasQuest(uint32 quest_id) const { return GetProto()->StartQuest == quest_id; } bool HasQuest(uint32 quest_id) const { return GetProto()->StartQuest == quest_id; }
bool hasInvolvedQuest(uint32 /*quest_id*/) const { return false; } bool HasInvolvedQuest(uint32 /*quest_id*/) const { return false; }
bool IsPotion() const { return GetProto()->IsPotion(); } bool IsPotion() const { return GetProto()->IsPotion(); }
bool IsConjuredConsumable() const { return GetProto()->IsConjuredConsumable(); } bool IsConjuredConsumable() const { return GetProto()->IsConjuredConsumable(); }

View file

@ -907,7 +907,7 @@ bool ChatHandler::HandleModifyTalentCommand (char* args)
((Player*)target)->SendTalentsInfoData(false); ((Player*)target)->SendTalentsInfoData(false);
return true; return true;
} }
else if(((Creature*)target)->isPet()) else if(((Creature*)target)->IsPet())
{ {
Unit *owner = target->GetOwner(); Unit *owner = target->GetOwner();
if(owner && owner->GetTypeId() == TYPEID_PLAYER && ((Pet *)target)->IsPermanentPetFor((Player*)owner)) if(owner && owner->GetTypeId() == TYPEID_PLAYER && ((Pet *)target)->IsPermanentPetFor((Player*)owner))

View file

@ -1706,7 +1706,7 @@ bool ChatHandler::HandleNpcAddMoveCommand(char* args)
pCreature->GetMotionMaster()->Initialize(); pCreature->GetMotionMaster()->Initialize();
if (pCreature->isAlive()) // dead creature will reset movement generator at respawn if (pCreature->isAlive()) // dead creature will reset movement generator at respawn
{ {
pCreature->setDeathState(JUST_DIED); pCreature->SetDeathState(JUST_DIED);
pCreature->Respawn(); pCreature->Respawn();
} }
pCreature->SaveToDB(); pCreature->SaveToDB();
@ -1739,7 +1739,7 @@ bool ChatHandler::HandleNpcChangeLevelCommand(char* args)
return false; return false;
} }
if (pCreature->isPet()) if (pCreature->IsPet())
{ {
if (((Pet*)pCreature)->getPetType()==HUNTER_PET) if (((Pet*)pCreature)->getPetType()==HUNTER_PET)
{ {
@ -1805,7 +1805,7 @@ bool ChatHandler::HandleNpcDeleteCommand(char* args)
else else
unit = getSelectedCreature(); unit = getSelectedCreature();
if (!unit || unit->isPet() || unit->isTotem() || unit->isVehicle()) if (!unit || unit->IsPet() || unit->IsTotem() || unit->IsVehicle())
{ {
SendSysMessage(LANG_SELECT_CREATURE); SendSysMessage(LANG_SELECT_CREATURE);
SetSentErrorMessage(true); SetSentErrorMessage(true);
@ -1875,7 +1875,7 @@ bool ChatHandler::HandleNpcMoveCommand(char* args)
pCreature->GetMotionMaster()->Initialize(); pCreature->GetMotionMaster()->Initialize();
if (pCreature->isAlive()) // dead creature will reset movement generator at respawn if (pCreature->isAlive()) // dead creature will reset movement generator at respawn
{ {
pCreature->setDeathState(JUST_DIED); pCreature->SetDeathState(JUST_DIED);
pCreature->Respawn(); pCreature->Respawn();
} }
} }
@ -1912,7 +1912,7 @@ bool ChatHandler::HandleNpcSetMoveTypeCommand(char* args)
if (!ExtractUInt32(&args, lowguid)) // case .setmovetype $move_type (with selected creature) if (!ExtractUInt32(&args, lowguid)) // case .setmovetype $move_type (with selected creature)
{ {
pCreature = getSelectedCreature(); pCreature = getSelectedCreature();
if (!pCreature || pCreature->isPet()) if (!pCreature || pCreature->IsPet())
return false; return false;
lowguid = pCreature->GetDBTableGUIDLow(); lowguid = pCreature->GetDBTableGUIDLow();
} }
@ -1966,7 +1966,7 @@ bool ChatHandler::HandleNpcSetMoveTypeCommand(char* args)
pCreature->GetMotionMaster()->Initialize(); pCreature->GetMotionMaster()->Initialize();
if (pCreature->isAlive()) // dead creature will reset movement generator at respawn if (pCreature->isAlive()) // dead creature will reset movement generator at respawn
{ {
pCreature->setDeathState(JUST_DIED); pCreature->SetDeathState(JUST_DIED);
pCreature->Respawn(); pCreature->Respawn();
} }
pCreature->SaveToDB(); pCreature->SaveToDB();
@ -1990,7 +1990,7 @@ bool ChatHandler::HandleNpcSetModelCommand(char* args)
Creature *pCreature = getSelectedCreature(); Creature *pCreature = getSelectedCreature();
if (!pCreature || pCreature->isPet()) if (!pCreature || pCreature->IsPet())
{ {
SendSysMessage(LANG_SELECT_CREATURE); SendSysMessage(LANG_SELECT_CREATURE);
SetSentErrorMessage(true); SetSentErrorMessage(true);
@ -2074,7 +2074,7 @@ bool ChatHandler::HandleNpcSpawnDistCommand(char* args)
pCreature->GetMotionMaster()->Initialize(); pCreature->GetMotionMaster()->Initialize();
if (pCreature->isAlive()) // dead creature will reset movement generator at respawn if (pCreature->isAlive()) // dead creature will reset movement generator at respawn
{ {
pCreature->setDeathState(JUST_DIED); pCreature->SetDeathState(JUST_DIED);
pCreature->Respawn(); pCreature->Respawn();
} }
@ -2165,7 +2165,7 @@ bool ChatHandler::HandleNpcUnFollowCommand(char* /*args*/)
bool ChatHandler::HandleNpcTameCommand(char* /*args*/) bool ChatHandler::HandleNpcTameCommand(char* /*args*/)
{ {
Creature *creatureTarget = getSelectedCreature (); Creature *creatureTarget = getSelectedCreature ();
if (!creatureTarget || creatureTarget->isPet ()) if (!creatureTarget || creatureTarget->IsPet ())
{ {
PSendSysMessage (LANG_SELECT_CREATURE); PSendSysMessage (LANG_SELECT_CREATURE);
SetSentErrorMessage (true); SetSentErrorMessage (true);
@ -2252,7 +2252,7 @@ bool ChatHandler::HandleNpcSetPhaseCommand(char* args)
pCreature->SetPhaseMask(phasemask,true); pCreature->SetPhaseMask(phasemask,true);
if (!pCreature->isPet()) if (!pCreature->IsPet())
pCreature->SaveToDB(); pCreature->SaveToDB();
return true; return true;
@ -2269,7 +2269,7 @@ bool ChatHandler::HandleNpcSetDeathStateCommand(char* args)
} }
Creature* pCreature = getSelectedCreature(); Creature* pCreature = getSelectedCreature();
if (!pCreature || pCreature->isPet()) if (!pCreature || pCreature->IsPet())
{ {
SendSysMessage(LANG_SELECT_CREATURE); SendSysMessage(LANG_SELECT_CREATURE);
SetSentErrorMessage(true); SetSentErrorMessage(true);
@ -2861,7 +2861,7 @@ bool ChatHandler::HandleWpAddCommand(char* args)
// No GUID provided // No GUID provided
// -> Player must have selected a creature // -> Player must have selected a creature
if (!target || target->isPet()) if (!target || target->IsPet())
{ {
SendSysMessage(LANG_SELECT_CREATURE); SendSysMessage(LANG_SELECT_CREATURE);
SetSentErrorMessage(true); SetSentErrorMessage(true);
@ -2945,7 +2945,7 @@ bool ChatHandler::HandleWpAddCommand(char* args)
} }
target = m_session->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, data->id, lowguid)); target = m_session->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, data->id, lowguid));
if (!target || target->isPet()) if (!target || target->IsPet())
{ {
PSendSysMessage(LANG_WAYPOINT_CREATNOTFOUND, lowguid); PSendSysMessage(LANG_WAYPOINT_CREATNOTFOUND, lowguid);
SetSentErrorMessage(true); SetSentErrorMessage(true);
@ -2968,7 +2968,7 @@ bool ChatHandler::HandleWpAddCommand(char* args)
target->GetMotionMaster()->Initialize(); target->GetMotionMaster()->Initialize();
if (target->isAlive()) // dead creature will reset movement generator at respawn if (target->isAlive()) // dead creature will reset movement generator at respawn
{ {
target->setDeathState(JUST_DIED); target->SetDeathState(JUST_DIED);
target->Respawn(); target->Respawn();
} }
target->SaveToDB(); target->SaveToDB();
@ -3184,7 +3184,7 @@ bool ChatHandler::HandleWpModifyCommand(char* args)
npcCreature->GetMotionMaster()->Initialize(); npcCreature->GetMotionMaster()->Initialize();
if (npcCreature->isAlive()) // dead creature will reset movement generator at respawn if (npcCreature->isAlive()) // dead creature will reset movement generator at respawn
{ {
npcCreature->setDeathState(JUST_DIED); npcCreature->SetDeathState(JUST_DIED);
npcCreature->Respawn(); npcCreature->Respawn();
} }
} }
@ -3272,7 +3272,7 @@ bool ChatHandler::HandleWpModifyCommand(char* args)
npcCreature->GetMotionMaster()->Initialize(); npcCreature->GetMotionMaster()->Initialize();
if (npcCreature->isAlive()) // dead creature will reset movement generator at respawn if (npcCreature->isAlive()) // dead creature will reset movement generator at respawn
{ {
npcCreature->setDeathState(JUST_DIED); npcCreature->SetDeathState(JUST_DIED);
npcCreature->Respawn(); npcCreature->Respawn();
} }
npcCreature->SaveToDB(); npcCreature->SaveToDB();
@ -3342,7 +3342,7 @@ bool ChatHandler::HandleWpModifyCommand(char* args)
npcCreature->GetMotionMaster()->Initialize(); npcCreature->GetMotionMaster()->Initialize();
if (npcCreature->isAlive()) // dead creature will reset movement generator at respawn if (npcCreature->isAlive()) // dead creature will reset movement generator at respawn
{ {
npcCreature->setDeathState(JUST_DIED); npcCreature->SetDeathState(JUST_DIED);
npcCreature->Respawn(); npcCreature->Respawn();
} }
} }
@ -3376,7 +3376,7 @@ bool ChatHandler::HandleWpModifyCommand(char* args)
npcCreature->GetMotionMaster()->Initialize(); npcCreature->GetMotionMaster()->Initialize();
if (npcCreature->isAlive()) // dead creature will reset movement generator at respawn if (npcCreature->isAlive()) // dead creature will reset movement generator at respawn
{ {
npcCreature->setDeathState(JUST_DIED); npcCreature->SetDeathState(JUST_DIED);
npcCreature->Respawn(); npcCreature->Respawn();
} }
} }

View file

@ -4849,7 +4849,7 @@ bool ChatHandler::HandleResetTalentsCommand(char* args)
{ {
// Try reset talents as Hunter Pet // Try reset talents as Hunter Pet
Creature* creature = getSelectedCreature(); Creature* creature = getSelectedCreature();
if (!*args && creature && creature->isPet()) if (!*args && creature && creature->IsPet())
{ {
Unit *owner = creature->GetOwner(); Unit *owner = creature->GetOwner();
if(owner && owner->GetTypeId() == TYPEID_PLAYER && ((Pet *)creature)->IsPermanentPetFor((Player*)owner)) if(owner && owner->GetTypeId() == TYPEID_PLAYER && ((Pet *)creature)->IsPermanentPetFor((Player*)owner))

View file

@ -186,7 +186,7 @@ template<>
void Map::AddToGrid(Creature* obj, NGridType *grid, Cell const& cell) void Map::AddToGrid(Creature* obj, NGridType *grid, Cell const& cell)
{ {
// add to world object registry in grid // add to world object registry in grid
if(obj->isPet() || obj->isVehicle()) if(obj->IsPet() || obj->IsVehicle())
{ {
(*grid)(cell.CellX(), cell.CellY()).AddWorldObject<Creature>(obj); (*grid)(cell.CellX(), cell.CellY()).AddWorldObject<Creature>(obj);
obj->SetCurrentCell(cell); obj->SetCurrentCell(cell);
@ -230,7 +230,7 @@ template<>
void Map::RemoveFromGrid(Creature* obj, NGridType *grid, Cell const& cell) void Map::RemoveFromGrid(Creature* obj, NGridType *grid, Cell const& cell)
{ {
// remove from world object registry in grid // remove from world object registry in grid
if(obj->isPet() || obj->isVehicle()) if(obj->IsPet() || obj->IsVehicle())
{ {
(*grid)(cell.CellX(), cell.CellY()).RemoveWorldObject<Creature>(obj); (*grid)(cell.CellX(), cell.CellY()).RemoveWorldObject<Creature>(obj);
} }
@ -1595,7 +1595,7 @@ void Map::AddToActive( WorldObject* obj )
{ {
Creature* c= (Creature*)obj; Creature* c= (Creature*)obj;
if (!c->isPet() && c->GetDBTableGUIDLow()) if (!c->IsPet() && c->GetDBTableGUIDLow())
{ {
float x,y,z; float x,y,z;
c->GetRespawnCoord(x,y,z); c->GetRespawnCoord(x,y,z);
@ -1630,7 +1630,7 @@ void Map::RemoveFromActive( WorldObject* obj )
{ {
Creature* c= (Creature*)obj; Creature* c= (Creature*)obj;
if(!c->isPet() && c->GetDBTableGUIDLow()) if(!c->IsPet() && c->GetDBTableGUIDLow())
{ {
float x,y,z; float x,y,z;
c->GetRespawnCoord(x,y,z); c->GetRespawnCoord(x,y,z);

View file

@ -130,7 +130,7 @@ void WorldSession::SendTrainerList( uint64 guid, const std::string& strTitle )
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
// trainer list loaded at check; // trainer list loaded at check;
if(!unit->isCanTrainingOf(_player,true)) if(!unit->IsTrainerOf(_player,true))
return; return;
CreatureInfo const *ci = unit->GetCreatureInfo(); CreatureInfo const *ci = unit->GetCreatureInfo();
@ -214,7 +214,7 @@ void WorldSession::HandleTrainerBuySpellOpcode( WorldPacket & recv_data )
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED)) if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
if(!unit->isCanTrainingOf(_player,true)) if(!unit->IsTrainerOf(_player,true))
return; return;
// check present spell in trainer spell list // check present spell in trainer spell list

View file

@ -249,7 +249,7 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 updateFlags) const
uint16 moveFlags2 = (isType(TYPEMASK_UNIT) ? ((Unit*)this)->m_movementInfo.GetMovementFlags2() : MOVEFLAG2_NONE); uint16 moveFlags2 = (isType(TYPEMASK_UNIT) ? ((Unit*)this)->m_movementInfo.GetMovementFlags2() : MOVEFLAG2_NONE);
if(GetTypeId() == TYPEID_UNIT) if(GetTypeId() == TYPEID_UNIT)
if(((Creature*)this)->isVehicle()) if(((Creature*)this)->IsVehicle())
moveFlags2 |= MOVEFLAG2_ALLOW_PITCHING; // always allow pitch moveFlags2 |= MOVEFLAG2_ALLOW_PITCHING; // always allow pitch
*data << uint16(updateFlags); // update flags *data << uint16(updateFlags); // update flags
@ -269,7 +269,7 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 updateFlags) const
/*if (((Creature*)unit)->hasUnitState(UNIT_STAT_MOVING)) /*if (((Creature*)unit)->hasUnitState(UNIT_STAT_MOVING))
unit->m_movementInfo.SetMovementFlags(MOVEFLAG_FORWARD);*/ unit->m_movementInfo.SetMovementFlags(MOVEFLAG_FORWARD);*/
if (((Creature*)unit)->canFly()) if (((Creature*)unit)->CanFly())
{ {
// (ok) most seem to have this // (ok) most seem to have this
unit->m_movementInfo.AddMovementFlag(MOVEFLAG_LEVITATING); unit->m_movementInfo.AddMovementFlag(MOVEFLAG_LEVITATING);
@ -606,7 +606,7 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask *
if (appendValue & UNIT_NPC_FLAG_TRAINER) if (appendValue & UNIT_NPC_FLAG_TRAINER)
{ {
if (!((Creature*)this)->isCanTrainingOf(target, false)) if (!((Creature*)this)->IsTrainerOf(target, false))
appendValue &= ~(UNIT_NPC_FLAG_TRAINER | UNIT_NPC_FLAG_TRAINER_CLASS | UNIT_NPC_FLAG_TRAINER_PROFESSION); appendValue &= ~(UNIT_NPC_FLAG_TRAINER | UNIT_NPC_FLAG_TRAINER_CLASS | UNIT_NPC_FLAG_TRAINER_PROFESSION);
} }
@ -1488,11 +1488,11 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float &z) const
{ {
// non fly unit don't must be in air // non fly unit don't must be in air
// non swim unit must be at ground (mostly speedup, because it don't must be in water and water level check less fast // non swim unit must be at ground (mostly speedup, because it don't must be in water and water level check less fast
if (!((Creature const*)this)->canFly()) if (!((Creature const*)this)->CanFly())
{ {
bool canSwim = ((Creature const*)this)->canSwim(); bool CanSwim = ((Creature const*)this)->CanSwim();
float ground_z = z; float ground_z = z;
float max_z = canSwim float max_z = CanSwim
? GetBaseMap()->GetWaterOrGroundLevel(x, y, z, &ground_z, !((Unit const*)this)->HasAuraType(SPELL_AURA_WATER_WALK)) ? GetBaseMap()->GetWaterOrGroundLevel(x, y, z, &ground_z, !((Unit const*)this)->HasAuraType(SPELL_AURA_WATER_WALK))
: ((ground_z = GetBaseMap()->GetHeight(x, y, z, true))); : ((ground_z = GetBaseMap()->GetHeight(x, y, z, true)));
if (max_z > INVALID_HEIGHT) if (max_z > INVALID_HEIGHT)

View file

@ -289,8 +289,8 @@ class MANGOS_DLL_SPEC Object
void InitValues() { _InitValues(); } void InitValues() { _InitValues(); }
virtual bool hasQuest(uint32 /* quest_id */) const { return false; } virtual bool HasQuest(uint32 /* quest_id */) const { return false; }
virtual bool hasInvolvedQuest(uint32 /* quest_id */) const { return false; } virtual bool HasInvolvedQuest(uint32 /* quest_id */) const { return false; }
protected: protected:
Object ( ); Object ( );

View file

@ -57,7 +57,7 @@ ObjectGridRespawnMover::Visit(CreatureMapType &m)
Creature * c = iter->getSource(); Creature * c = iter->getSource();
MANGOS_ASSERT((!c->isPet() || !c->isVehicle()) && "ObjectGridRespawnMover don't must be called for pets"); MANGOS_ASSERT((!c->IsPet() || !c->IsVehicle()) && "ObjectGridRespawnMover don't must be called for pets");
Cell const& cur_cell = c->GetCurrentCell(); Cell const& cur_cell = c->GetCurrentCell();

View file

@ -452,9 +452,9 @@ void Pet::DeleteFromDB(uint32 guidlow)
CharacterDatabase.PExecute("DELETE FROM pet_spell_cooldown WHERE guid = '%u'", guidlow); CharacterDatabase.PExecute("DELETE FROM pet_spell_cooldown WHERE guid = '%u'", guidlow);
} }
void Pet::setDeathState(DeathState s) // overwrite virtual Creature::setDeathState and Unit::setDeathState void Pet::SetDeathState(DeathState s) // overwrite virtual Creature::SetDeathState and Unit::SetDeathState
{ {
Creature::setDeathState(s); Creature::SetDeathState(s);
if(getDeathState()==CORPSE) if(getDeathState()==CORPSE)
{ {
//remove summoned pet (no corpse) //remove summoned pet (no corpse)

View file

@ -156,7 +156,7 @@ class Pet : public Creature
void Remove(PetSaveMode mode, bool returnreagent = false); void Remove(PetSaveMode mode, bool returnreagent = false);
static void DeleteFromDB(uint32 guidlow); static void DeleteFromDB(uint32 guidlow);
void setDeathState(DeathState s); // overwrite virtual Creature::setDeathState and Unit::setDeathState void SetDeathState(DeathState s); // overwrite virtual Creature::SetDeathState and Unit::SetDeathState
void Update(uint32 diff); // overwrite virtual Creature::Update and Unit::Update void Update(uint32 diff); // overwrite virtual Creature::Update and Unit::Update
uint8 GetPetAutoSpellSize() const { return m_autospells.size(); } uint8 GetPetAutoSpellSize() const { return m_autospells.size(); }

View file

@ -30,7 +30,7 @@
int PetAI::Permissible(const Creature *creature) int PetAI::Permissible(const Creature *creature)
{ {
if( creature->isPet()) if( creature->IsPet())
return PERMIT_BASE_SPECIAL; return PERMIT_BASE_SPECIAL;
return PERMIT_BASE_NO; return PERMIT_BASE_NO;
@ -47,7 +47,7 @@ void PetAI::MoveInLineOfSight(Unit *u)
if (m_creature->getVictim()) if (m_creature->getVictim())
return; return;
if (m_creature->isPet() && ((Pet*)m_creature)->GetModeFlags() & PET_MODE_DISABLE_ACTIONS) if (m_creature->IsPet() && ((Pet*)m_creature)->GetModeFlags() & PET_MODE_DISABLE_ACTIONS)
return; return;
if (!m_creature->GetCharmInfo() || !m_creature->GetCharmInfo()->HasReactState(REACT_AGGRESSIVE)) if (!m_creature->GetCharmInfo() || !m_creature->GetCharmInfo()->HasReactState(REACT_AGGRESSIVE))
@ -70,7 +70,7 @@ void PetAI::MoveInLineOfSight(Unit *u)
void PetAI::AttackStart(Unit *u) void PetAI::AttackStart(Unit *u)
{ {
if(!u || (m_creature->isPet() && ((Pet*)m_creature)->getPetType() == MINI_PET)) if(!u || (m_creature->IsPet() && ((Pet*)m_creature)->getPetType() == MINI_PET))
return; return;
if(m_creature->Attack(u,true)) if(m_creature->Attack(u,true))
@ -144,7 +144,7 @@ void PetAI::UpdateAI(const uint32 diff)
else else
m_updateAlliesTimer -= diff; m_updateAlliesTimer -= diff;
if (inCombat && (!m_creature->getVictim() || m_creature->isPet() && ((Pet*)m_creature)->GetModeFlags() & PET_MODE_DISABLE_ACTIONS)) if (inCombat && (!m_creature->getVictim() || m_creature->IsPet() && ((Pet*)m_creature)->GetModeFlags() & PET_MODE_DISABLE_ACTIONS))
_stopAttack(); _stopAttack();
// i_pet.getVictim() can't be used for check in case stop fighting, i_pet.getVictim() clear at Unit death etc. // i_pet.getVictim() can't be used for check in case stop fighting, i_pet.getVictim() clear at Unit death etc.

View file

@ -66,7 +66,7 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
if (!(flag == ACT_COMMAND && spellid == COMMAND_ATTACK)) if (!(flag == ACT_COMMAND && spellid == COMMAND_ATTACK))
return; return;
} }
else if (((Creature*)pet)->isPet()) else if (((Creature*)pet)->IsPet())
{ {
// pet can have action bar disabled // pet can have action bar disabled
if(((Pet*)pet)->GetModeFlags() & PET_MODE_DISABLE_ACTIONS) if(((Pet*)pet)->GetModeFlags() & PET_MODE_DISABLE_ACTIONS)
@ -128,7 +128,7 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
((Creature*)pet)->AI()->AttackStart(TargetUnit); ((Creature*)pet)->AI()->AttackStart(TargetUnit);
// 10% chance to play special pet attack talk, else growl // 10% chance to play special pet attack talk, else growl
if(((Creature*)pet)->isPet() && ((Pet*)pet)->getPetType() == SUMMON_PET && pet != TargetUnit && roll_chance_i(10)) if(((Creature*)pet)->IsPet() && ((Pet*)pet)->getPetType() == SUMMON_PET && pet != TargetUnit && roll_chance_i(10))
pet->SendPetTalk((uint32)PET_TALK_ATTACK); pet->SendPetTalk((uint32)PET_TALK_ATTACK);
else else
{ {
@ -140,14 +140,14 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
break; break;
} }
case COMMAND_ABANDON: // abandon (hunter pet) or dismiss (summoned pet) case COMMAND_ABANDON: // abandon (hunter pet) or dismiss (summoned pet)
if(((Creature*)pet)->isPet()) if(((Creature*)pet)->IsPet())
{ {
Pet* p = (Pet*)pet; Pet* p = (Pet*)pet;
if(p->getPetType() == HUNTER_PET) if(p->getPetType() == HUNTER_PET)
_player->RemovePet(p,PET_SAVE_AS_DELETED); _player->RemovePet(p,PET_SAVE_AS_DELETED);
else else
//dismissing a summoned pet is like killing them (this prevents returning a soulshard...) //dismissing a summoned pet is like killing them (this prevents returning a soulshard...)
p->setDeathState(CORPSE); p->SetDeathState(CORPSE);
} }
else // charmed else // charmed
_player->Uncharm(); _player->Uncharm();
@ -230,7 +230,7 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
//10% chance to play special pet attack talk, else growl //10% chance to play special pet attack talk, else growl
//actually this only seems to happen on special spells, fire shield for imp, torment for voidwalker, but it's stupid to check every spell //actually this only seems to happen on special spells, fire shield for imp, torment for voidwalker, but it's stupid to check every spell
if(((Creature*)pet)->isPet() && (((Pet*)pet)->getPetType() == SUMMON_PET) && (pet != unit_target) && (urand(0, 100) < 10)) if(((Creature*)pet)->IsPet() && (((Pet*)pet)->getPetType() == SUMMON_PET) && (pet != unit_target) && (urand(0, 100) < 10))
pet->SendPetTalk((uint32)PET_TALK_SPECIAL_SPELL); pet->SendPetTalk((uint32)PET_TALK_SPECIAL_SPELL);
else else
{ {
@ -324,7 +324,7 @@ void WorldSession::SendPetNameQuery( uint64 petguid, uint32 petnumber)
data << name.c_str(); data << name.c_str();
data << uint32(pet->GetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP)); data << uint32(pet->GetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP));
if( pet->isPet() && ((Pet*)pet)->GetDeclinedNames() ) if( pet->IsPet() && ((Pet*)pet)->GetDeclinedNames() )
{ {
data << uint8(1); data << uint8(1);
for(int i = 0; i < MAX_DECLINED_NAME_CASES; ++i) for(int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
@ -354,7 +354,7 @@ void WorldSession::HandlePetSetAction( WorldPacket & recv_data )
} }
// pet can have action bar disabled // pet can have action bar disabled
if(pet->isPet() && ((Pet*)pet)->GetModeFlags() & PET_MODE_DISABLE_ACTIONS) if(pet->IsPet() && ((Pet*)pet)->GetModeFlags() & PET_MODE_DISABLE_ACTIONS)
return; return;
CharmInfo *charmInfo = pet->GetCharmInfo(); CharmInfo *charmInfo = pet->GetCharmInfo();
@ -535,7 +535,7 @@ void WorldSession::HandlePetAbandon( WorldPacket & recv_data )
// pet/charmed // pet/charmed
if (Creature* pet = _player->GetMap()->GetAnyTypeCreature(guid)) if (Creature* pet = _player->GetMap()->GetAnyTypeCreature(guid))
{ {
if(pet->isPet()) if(pet->IsPet())
{ {
if(pet->GetGUID() == _player->GetPetGUID()) if(pet->GetGUID() == _player->GetPetGUID())
{ {
@ -671,7 +671,7 @@ void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket )
if (result == SPELL_CAST_OK) if (result == SPELL_CAST_OK)
{ {
pet->AddCreatureSpellCooldown(spellid); pet->AddCreatureSpellCooldown(spellid);
if (pet->isPet()) if (pet->IsPet())
{ {
//10% chance to play special pet attack talk, else growl //10% chance to play special pet attack talk, else growl
//actually this only seems to happen on special spells, fire shield for imp, torment for voidwalker, but it's stupid to check every spell //actually this only seems to happen on special spells, fire shield for imp, torment for voidwalker, but it's stupid to check every spell

View file

@ -1474,7 +1474,7 @@ void Player::Update( uint32 p_time )
TeleportTo(m_teleport_dest, m_teleport_options); TeleportTo(m_teleport_dest, m_teleport_options);
} }
void Player::setDeathState(DeathState s) void Player::SetDeathState(DeathState s)
{ {
uint32 ressSpellId = 0; uint32 ressSpellId = 0;
@ -1484,7 +1484,7 @@ void Player::setDeathState(DeathState s)
{ {
// drunken state is cleared on death // drunken state is cleared on death
SetDrunkValue(0); SetDrunkValue(0);
// lost combo points at any target (targeted combo points clear in Unit::setDeathState) // lost combo points at any target (targeted combo points clear in Unit::SetDeathState)
ClearComboPoints(); ClearComboPoints();
clearResurrectRequestData(); clearResurrectRequestData();
@ -1492,13 +1492,13 @@ void Player::setDeathState(DeathState s)
// remove form before other mods to prevent incorrect stats calculation // remove form before other mods to prevent incorrect stats calculation
RemoveAurasDueToSpell(m_ShapeShiftFormSpellId); RemoveAurasDueToSpell(m_ShapeShiftFormSpellId);
//FIXME: is pet dismissed at dying or releasing spirit? if second, add setDeathState(DEAD) to HandleRepopRequestOpcode and define pet unsummon here with (s == DEAD) //FIXME: is pet dismissed at dying or releasing spirit? if second, add SetDeathState(DEAD) to HandleRepopRequestOpcode and define pet unsummon here with (s == DEAD)
RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true); RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true);
// remove uncontrolled pets // remove uncontrolled pets
RemoveMiniPet(); RemoveMiniPet();
// save value before aura remove in Unit::setDeathState // save value before aura remove in Unit::SetDeathState
ressSpellId = GetUInt32Value(PLAYER_SELF_RES_SPELL); ressSpellId = GetUInt32Value(PLAYER_SELF_RES_SPELL);
// passive spell // passive spell
@ -1513,7 +1513,7 @@ void Player::setDeathState(DeathState s)
mapInstance->OnPlayerDeath(this); mapInstance->OnPlayerDeath(this);
} }
Unit::setDeathState(s); Unit::SetDeathState(s);
// restore resurrection spell id for player after aura remove // restore resurrection spell id for player after aura remove
if(s == JUST_DIED && cur && ressSpellId) if(s == JUST_DIED && cur && ressSpellId)
@ -4475,7 +4475,7 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness)
RemoveAurasDueToSpell(20584); // speed bonuses RemoveAurasDueToSpell(20584); // speed bonuses
RemoveAurasDueToSpell(8326); // SPELL_AURA_GHOST RemoveAurasDueToSpell(8326); // SPELL_AURA_GHOST
setDeathState(ALIVE); SetDeathState(ALIVE);
SetMovement(MOVE_LAND_WALK); SetMovement(MOVE_LAND_WALK);
SetMovement(MOVE_UNROOT); SetMovement(MOVE_UNROOT);
@ -4538,7 +4538,7 @@ void Player::KillPlayer()
StopMirrorTimers(); //disable timers(bars) StopMirrorTimers(); //disable timers(bars)
setDeathState(CORPSE); SetDeathState(CORPSE);
//SetFlag( UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_IN_PVP ); //SetFlag( UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_IN_PVP );
SetFlag(UNIT_DYNAMIC_FLAGS, 0x00); SetFlag(UNIT_DYNAMIC_FLAGS, 0x00);
@ -5570,7 +5570,7 @@ void Player::UpdateCombatSkills(Unit *pVictim, WeaponAttackType attType, bool de
{ {
uint32 plevel = getLevel(); // if defense than pVictim == attacker uint32 plevel = getLevel(); // if defense than pVictim == attacker
uint32 greylevel = MaNGOS::XP::GetGrayLevel(plevel); uint32 greylevel = MaNGOS::XP::GetGrayLevel(plevel);
uint32 moblevel = pVictim->getLevelForTarget(this); uint32 moblevel = pVictim->GetLevelForTarget(this);
if(moblevel < greylevel) if(moblevel < greylevel)
return; return;
@ -6531,7 +6531,7 @@ bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, float honor)
{ {
Creature *cVictim = (Creature *)uVictim; Creature *cVictim = (Creature *)uVictim;
if (!cVictim->isRacialLeader()) if (!cVictim->IsRacialLeader())
return false; return false;
honor = 100; // ??? need more info honor = 100; // ??? need more info
@ -12756,11 +12756,11 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId)
break; break;
} }
case GOSSIP_OPTION_TRAINER: case GOSSIP_OPTION_TRAINER:
if (!pCreature->isCanTrainingOf(this, false)) if (!pCreature->IsTrainerOf(this, false))
hasMenuItem = false; hasMenuItem = false;
break; break;
case GOSSIP_OPTION_UNLEARNTALENTS: case GOSSIP_OPTION_UNLEARNTALENTS:
if (!pCreature->isCanTrainingAndResetTalentsOf(this)) if (!pCreature->CanTrainAndResetTalentsOf(this))
hasMenuItem = false; hasMenuItem = false;
break; break;
case GOSSIP_OPTION_UNLEARNPETSKILLS: case GOSSIP_OPTION_UNLEARNPETSKILLS:
@ -12772,7 +12772,7 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId)
return; return;
break; break;
case GOSSIP_OPTION_BATTLEFIELD: case GOSSIP_OPTION_BATTLEFIELD:
if (!pCreature->isCanInteractWithBattleMaster(this, false)) if (!pCreature->CanInteractWithBattleMaster(this, false))
hasMenuItem = false; hasMenuItem = false;
break; break;
case GOSSIP_OPTION_STABLEPET: case GOSSIP_OPTION_STABLEPET:
@ -12851,13 +12851,13 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId)
if (pCreature->HasFlag(UNIT_NPC_FLAGS,UNIT_NPC_FLAG_TRAINER)) if (pCreature->HasFlag(UNIT_NPC_FLAGS,UNIT_NPC_FLAG_TRAINER))
{ {
// output error message if need // output error message if need
pCreature->isCanTrainingOf(this, true); pCreature->IsTrainerOf(this, true);
} }
if (pCreature->HasFlag(UNIT_NPC_FLAGS,UNIT_NPC_FLAG_BATTLEMASTER)) if (pCreature->HasFlag(UNIT_NPC_FLAGS,UNIT_NPC_FLAG_BATTLEMASTER))
{ {
// output error message if need // output error message if need
pCreature->isCanInteractWithBattleMaster(this, true); pCreature->CanInteractWithBattleMaster(this, true);
} }
}*/ }*/
} }
@ -19320,7 +19320,7 @@ inline void BeforeVisibilityDestroy(T* /*t*/, Player* /*p*/)
template<> template<>
inline void BeforeVisibilityDestroy<Creature>(Creature* t, Player* p) inline void BeforeVisibilityDestroy<Creature>(Creature* t, Player* p)
{ {
if (p->GetPetGUID()==t->GetGUID() && ((Creature*)t)->isPet()) if (p->GetPetGUID()==t->GetGUID() && ((Creature*)t)->IsPet())
((Pet*)t)->Remove(PET_SAVE_NOT_IN_SLOT, true); ((Pet*)t)->Remove(PET_SAVE_NOT_IN_SLOT, true);
} }
@ -20305,8 +20305,8 @@ bool Player::isHonorOrXPTarget(Unit* pVictim) const
if(pVictim->GetTypeId() == TYPEID_UNIT) if(pVictim->GetTypeId() == TYPEID_UNIT)
{ {
if (((Creature*)pVictim)->isTotem() || if (((Creature*)pVictim)->IsTotem() ||
((Creature*)pVictim)->isPet() || ((Creature*)pVictim)->IsPet() ||
((Creature*)pVictim)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL) ((Creature*)pVictim)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL)
return false; return false;
} }
@ -22205,7 +22205,7 @@ void Player::SendDuelCountdown(uint32 counter)
GetSession()->SendPacket(&data); GetSession()->SendPacket(&data);
} }
bool Player::IsImmunedToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex index) const bool Player::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex index) const
{ {
switch(spellInfo->Effect[index]) switch(spellInfo->Effect[index])
{ {
@ -22221,7 +22221,7 @@ bool Player::IsImmunedToSpellEffect(SpellEntry const* spellInfo, SpellEffectInde
default: default:
break; break;
} }
return Unit::IsImmunedToSpellEffect(spellInfo, index); return Unit::IsImmuneToSpellEffect(spellInfo, index);
} }
void Player::SetHomebindToLocation(WorldLocation const& loc, uint32 area_id) void Player::SetHomebindToLocation(WorldLocation const& loc, uint32 area_id)

View file

@ -1199,7 +1199,7 @@ class MANGOS_DLL_SPEC Player : public Unit
void ResetTimeSync(); void ResetTimeSync();
void SendTimeSync(); void SendTimeSync();
void setDeathState(DeathState s); // overwrite Unit::setDeathState void SetDeathState(DeathState s); // overwrite Unit::SetDeathState
float GetRestBonus() const { return m_rest_bonus; } float GetRestBonus() const { return m_rest_bonus; }
void SetRestBonus(float rest_bonus_new); void SetRestBonus(float rest_bonus_new);
@ -1642,7 +1642,7 @@ class MANGOS_DLL_SPEC Player : public Unit
TrainerSpellState GetTrainerSpellState(TrainerSpell const* trainer_spell) const; TrainerSpellState GetTrainerSpellState(TrainerSpell const* trainer_spell) const;
bool IsSpellFitByClassAndRace( uint32 spell_id ) const; bool IsSpellFitByClassAndRace( uint32 spell_id ) const;
bool IsNeedCastPassiveSpellAtLearn(SpellEntry const* spellInfo) const; bool IsNeedCastPassiveSpellAtLearn(SpellEntry const* spellInfo) const;
bool IsImmunedToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex index) const; bool IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex index) const;
void SendProficiency(ItemClass itemClass, uint32 itemSubclassMask); void SendProficiency(ItemClass itemClass, uint32 itemSubclassMask);
void SendInitialSpells(); void SendInitialSpells();

View file

@ -36,7 +36,7 @@ void PointMovementGenerator<T>::Initialize(T &unit)
Traveller<T> traveller(unit); Traveller<T> traveller(unit);
i_destinationHolder.SetDestination(traveller, i_x, i_y, i_z); i_destinationHolder.SetDestination(traveller, i_x, i_y, i_z);
if (unit.GetTypeId() == TYPEID_UNIT && ((Creature*)&unit)->canFly()) if (unit.GetTypeId() == TYPEID_UNIT && ((Creature*)&unit)->CanFly())
((Creature&)unit).AddSplineFlag(SPLINEFLAG_UNKNOWN7); ((Creature&)unit).AddSplineFlag(SPLINEFLAG_UNKNOWN7);
} }
@ -103,7 +103,7 @@ void PointMovementGenerator<Creature>::MovementInform(Creature &unit)
if (unit.AI()) if (unit.AI())
unit.AI()->MovementInform(POINT_MOTION_TYPE, id); unit.AI()->MovementInform(POINT_MOTION_TYPE, id);
if (unit.isTemporarySummon()) if (unit.IsTemporarySummon())
{ {
TemporarySummon* pSummon = (TemporarySummon*)(&unit); TemporarySummon* pSummon = (TemporarySummon*)(&unit);
if (pSummon->GetSummonerGuid().IsCreature()) if (pSummon->GetSummonerGuid().IsCreature())

View file

@ -385,7 +385,7 @@ void PoolGroup<Creature>::Spawn1Object(PoolObject* obj, bool instantly)
if(!instantly) if(!instantly)
{ {
pCreature->SetRespawnTime( pCreature->GetRespawnDelay() ); pCreature->SetRespawnTime( pCreature->GetRespawnDelay() );
if (sWorld.getConfig(CONFIG_BOOL_SAVE_RESPAWN_TIME_IMMEDIATLY) || pCreature->isWorldBoss()) if (sWorld.getConfig(CONFIG_BOOL_SAVE_RESPAWN_TIME_IMMEDIATLY) || pCreature->IsWorldBoss())
pCreature->SaveRespawnTime(); pCreature->SaveRespawnTime();
} }
map->Add(pCreature); map->Add(pCreature);

View file

@ -128,7 +128,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode( WorldPacket & recv_data )
// no or incorrect quest giver // no or incorrect quest giver
if(!pObject if(!pObject
|| (pObject->GetTypeId()!=TYPEID_PLAYER && !pObject->hasQuest(quest)) || (pObject->GetTypeId()!=TYPEID_PLAYER && !pObject->HasQuest(quest))
|| (pObject->GetTypeId()==TYPEID_PLAYER && !((Player*)pObject)->CanShareQuest(quest)) || (pObject->GetTypeId()==TYPEID_PLAYER && !((Player*)pObject)->CanShareQuest(quest))
) )
{ {
@ -243,7 +243,7 @@ void WorldSession::HandleQuestgiverQueryQuestOpcode( WorldPacket & recv_data )
// Verify that the guid is valid and is a questgiver or involved in the requested quest // Verify that the guid is valid and is a questgiver or involved in the requested quest
Object* pObject = _player->GetObjectByTypeMask(guid, TYPEMASK_CREATURE_GAMEOBJECT_OR_ITEM); Object* pObject = _player->GetObjectByTypeMask(guid, TYPEMASK_CREATURE_GAMEOBJECT_OR_ITEM);
if(!pObject||!pObject->hasQuest(quest) && !pObject->hasInvolvedQuest(quest)) if(!pObject||!pObject->HasQuest(quest) && !pObject->HasInvolvedQuest(quest))
{ {
_player->PlayerTalkClass->CloseGossip(); _player->PlayerTalkClass->CloseGossip();
return; return;
@ -290,7 +290,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode( WorldPacket & recv_data )
if(!pObject) if(!pObject)
return; return;
if(!pObject->hasInvolvedQuest(quest)) if(!pObject->HasInvolvedQuest(quest))
return; return;
Quest const *pQuest = sObjectMgr.GetQuestTemplate(quest); Quest const *pQuest = sObjectMgr.GetQuestTemplate(quest);
@ -337,7 +337,7 @@ void WorldSession::HandleQuestgiverRequestRewardOpcode( WorldPacket & recv_data
DEBUG_LOG( "WORLD: Received CMSG_QUESTGIVER_REQUEST_REWARD npc = %u, quest = %u",uint32(GUID_LOPART(guid)),quest ); DEBUG_LOG( "WORLD: Received CMSG_QUESTGIVER_REQUEST_REWARD npc = %u, quest = %u",uint32(GUID_LOPART(guid)),quest );
Object* pObject = _player->GetObjectByTypeMask(guid, TYPEMASK_CREATURE_OR_GAMEOBJECT); Object* pObject = _player->GetObjectByTypeMask(guid, TYPEMASK_CREATURE_OR_GAMEOBJECT);
if(!pObject||!pObject->hasInvolvedQuest(quest)) if(!pObject||!pObject->HasInvolvedQuest(quest))
return; return;
if ( _player->CanCompleteQuest( quest ) ) if ( _player->CanCompleteQuest( quest ) )

View file

@ -35,9 +35,9 @@ RandomMovementGenerator<Creature>::_setRandomLocation(Creature &creature)
Map const* map = creature.GetBaseMap(); Map const* map = creature.GetBaseMap();
// For 2D/3D system selection // For 2D/3D system selection
//bool is_land_ok = creature.canWalk(); // not used? //bool is_land_ok = creature.CanWalk(); // not used?
//bool is_water_ok = creature.canSwim(); // not used? //bool is_water_ok = creature.CanSwim(); // not used?
bool is_air_ok = creature.canFly(); bool is_air_ok = creature.CanFly();
const float angle = rand_norm_f() * (M_PI_F*2.0f); const float angle = rand_norm_f() * (M_PI_F*2.0f);
const float range = rand_norm_f() * wander_distance; const float range = rand_norm_f() * wander_distance;
@ -116,7 +116,7 @@ void RandomMovementGenerator<Creature>::Initialize(Creature &creature)
if (!creature.isAlive()) if (!creature.isAlive())
return; return;
if (creature.canFly()) if (creature.CanFly())
creature.AddSplineFlag(SPLINEFLAG_UNKNOWN7); creature.AddSplineFlag(SPLINEFLAG_UNKNOWN7);
else else
creature.AddSplineFlag(SPLINEFLAG_WALKMODE); creature.AddSplineFlag(SPLINEFLAG_WALKMODE);
@ -155,7 +155,7 @@ bool RandomMovementGenerator<Creature>::Update(Creature &creature, const uint32
i_nextMoveTime.Update(diff); i_nextMoveTime.Update(diff);
if (i_destinationHolder.HasArrived() && !creature.IsStopped() && !creature.canFly()) if (i_destinationHolder.HasArrived() && !creature.IsStopped() && !creature.CanFly())
creature.clearUnitState(UNIT_STAT_ROAMING_MOVE); creature.clearUnitState(UNIT_STAT_ROAMING_MOVE);
if (!i_destinationHolder.HasArrived() && creature.IsStopped()) if (!i_destinationHolder.HasArrived() && creature.IsStopped())
@ -170,14 +170,14 @@ bool RandomMovementGenerator<Creature>::Update(Creature &creature, const uint32
if (i_nextMoveTime.Passed()) if (i_nextMoveTime.Passed())
{ {
if (creature.canFly()) if (creature.CanFly())
creature.AddSplineFlag(SPLINEFLAG_UNKNOWN7); creature.AddSplineFlag(SPLINEFLAG_UNKNOWN7);
else else
creature.AddSplineFlag(SPLINEFLAG_WALKMODE); creature.AddSplineFlag(SPLINEFLAG_WALKMODE);
_setRandomLocation(creature); _setRandomLocation(creature);
} }
else if (creature.isPet() && creature.GetOwner() && !creature.IsWithinDist(creature.GetOwner(), PET_FOLLOW_DIST+2.5f)) else if (creature.IsPet() && creature.GetOwner() && !creature.IsWithinDist(creature.GetOwner(), PET_FOLLOW_DIST+2.5f))
{ {
creature.AddSplineFlag(SPLINEFLAG_WALKMODE); creature.AddSplineFlag(SPLINEFLAG_WALKMODE);
_setRandomLocation(creature); _setRandomLocation(creature);

View file

@ -28,7 +28,7 @@
int int
ReactorAI::Permissible(const Creature *creature) ReactorAI::Permissible(const Creature *creature)
{ {
if( creature->isCivilian() || creature->IsNeutralToAll() ) if( creature->IsCivilian() || creature->IsNeutralToAll() )
return PERMIT_BASE_REACTIVE; return PERMIT_BASE_REACTIVE;
return PERMIT_BASE_NO; return PERMIT_BASE_NO;

View file

@ -797,7 +797,7 @@ void Spell::AddUnitTarget(Unit* pVictim, SpellEffectIndex effIndex)
return; return;
// Check for effect immune skip if immuned // Check for effect immune skip if immuned
bool immuned = pVictim->IsImmunedToSpellEffect(m_spellInfo, effIndex); bool immuned = pVictim->IsImmuneToSpellEffect(m_spellInfo, effIndex);
ObjectGuid targetGUID = pVictim->GetObjectGuid(); ObjectGuid targetGUID = pVictim->GetObjectGuid();
@ -1106,7 +1106,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
{ {
// cast at creature (or GO) quest objectives update at successful cast finished (+channel finished) // cast at creature (or GO) quest objectives update at successful cast finished (+channel finished)
// ignore pets or autorepeat/melee casts for speed (not exist quest for spells (hm... ) // ignore pets or autorepeat/melee casts for speed (not exist quest for spells (hm... )
if (real_caster && !((Creature*)unit)->isPet() && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive()) if (real_caster && !((Creature*)unit)->IsPet() && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive())
if (Player* p = real_caster->GetCharmerOrOwnerPlayerOrPlayerItself()) if (Player* p = real_caster->GetCharmerOrOwnerPlayerOrPlayerItself())
p->RewardPlayerAndGroupAtCast(unit, m_spellInfo->Id); p->RewardPlayerAndGroupAtCast(unit, m_spellInfo->Id);
@ -1129,7 +1129,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
// Recheck immune (only for delayed spells) // Recheck immune (only for delayed spells)
if (m_spellInfo->speed && ( if (m_spellInfo->speed && (
unit->IsImmunedToDamage(GetSpellSchoolMask(m_spellInfo)) || unit->IsImmunedToDamage(GetSpellSchoolMask(m_spellInfo)) ||
unit->IsImmunedToSpell(m_spellInfo))) unit->IsImmuneToSpell(m_spellInfo)))
{ {
if (realCaster) if (realCaster)
realCaster->SendSpellMiss(unit, m_spellInfo->Id, SPELL_MISS_IMMUNE); realCaster->SendSpellMiss(unit, m_spellInfo->Id, SPELL_MISS_IMMUNE);
@ -1915,7 +1915,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
break; break;
case TARGET_NONCOMBAT_PET: case TARGET_NONCOMBAT_PET:
if(Unit* target = m_targets.getUnitTarget()) if(Unit* target = m_targets.getUnitTarget())
if( target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->isPet() && ((Pet*)target)->getPetType() == MINI_PET) if( target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->IsPet() && ((Pet*)target)->getPetType() == MINI_PET)
targetUnitMap.push_back(target); targetUnitMap.push_back(target);
break; break;
case TARGET_CASTER_COORDINATES: case TARGET_CASTER_COORDINATES:
@ -2011,7 +2011,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
} }
else if (m_caster->GetTypeId() == TYPEID_PLAYER) else if (m_caster->GetTypeId() == TYPEID_PLAYER)
{ {
if( targetOwner == m_caster && target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->isPet()) if( targetOwner == m_caster && target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->IsPet())
{ {
targetUnitMap.push_back(target); targetUnitMap.push_back(target);
break; break;
@ -2025,7 +2025,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
if(targetOwner) if(targetOwner)
{ {
if( targetOwner->GetTypeId() == TYPEID_PLAYER && if( targetOwner->GetTypeId() == TYPEID_PLAYER &&
target->GetTypeId() == TYPEID_UNIT && (((Creature*)target)->isPet()) && target->GetTypeId() == TYPEID_UNIT && (((Creature*)target)->IsPet()) &&
target->GetOwnerGUID() == targetOwner->GetGUID() && target->GetOwnerGUID() == targetOwner->GetGUID() &&
pGroup->IsMember(((Player*)targetOwner)->GetObjectGuid())) pGroup->IsMember(((Player*)targetOwner)->GetObjectGuid()))
{ {
@ -2125,7 +2125,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
{ {
if( target->GetTypeId() != TYPEID_PLAYER) if( target->GetTypeId() != TYPEID_PLAYER)
{ {
if(((Creature*)target)->isPet()) if(((Creature*)target)->IsPet())
{ {
Unit *targetOwner = target->GetOwner(); Unit *targetOwner = target->GetOwner();
if(targetOwner->GetTypeId() == TYPEID_PLAYER) if(targetOwner->GetTypeId() == TYPEID_PLAYER)
@ -4497,7 +4497,7 @@ SpellCastResult Spell::CheckCast(bool strict)
} }
if(IsPositiveSpell(m_spellInfo->Id)) if(IsPositiveSpell(m_spellInfo->Id))
if(target->IsImmunedToSpell(m_spellInfo)) if(target->IsImmuneToSpell(m_spellInfo))
return SPELL_FAILED_TARGET_AURASTATE; return SPELL_FAILED_TARGET_AURASTATE;
//Must be behind the target. //Must be behind the target.
@ -4833,7 +4833,7 @@ SpellCastResult Spell::CheckCast(bool strict)
Creature* target = (Creature*)m_targets.getUnitTarget(); Creature* target = (Creature*)m_targets.getUnitTarget();
if(target->isPet() || target->isCharmed()) if(target->IsPet() || target->isCharmed())
{ {
plrCaster->SendPetTameFailure(PETTAME_CREATUREALREADYOWNED); plrCaster->SendPetTameFailure(PETTAME_CREATUREALREADYOWNED);
return SPELL_FAILED_DONT_REPORT; return SPELL_FAILED_DONT_REPORT;
@ -5331,7 +5331,7 @@ SpellCastResult Spell::CheckPetCast(Unit* target)
if(m_caster->isInCombat() && IsNonCombatSpell(m_spellInfo)) if(m_caster->isInCombat() && IsNonCombatSpell(m_spellInfo))
return SPELL_FAILED_AFFECTING_COMBAT; return SPELL_FAILED_AFFECTING_COMBAT;
if(m_caster->GetTypeId()==TYPEID_UNIT && (((Creature*)m_caster)->isPet() || m_caster->isCharmed())) if(m_caster->GetTypeId()==TYPEID_UNIT && (((Creature*)m_caster)->IsPet() || m_caster->isCharmed()))
{ {
//dead owner (pets still alive when owners ressed?) //dead owner (pets still alive when owners ressed?)
if(m_caster->GetCharmerOrOwner() && !m_caster->GetCharmerOrOwner()->isAlive()) if(m_caster->GetCharmerOrOwner() && !m_caster->GetCharmerOrOwner()->isAlive())

View file

@ -732,7 +732,7 @@ namespace MaNGOS
break; break;
case SPELL_TARGETS_AOE_DAMAGE: case SPELL_TARGETS_AOE_DAMAGE:
{ {
if(itr->getSource()->GetTypeId()==TYPEID_UNIT && ((Creature*)itr->getSource())->isTotem()) if(itr->getSource()->GetTypeId()==TYPEID_UNIT && ((Creature*)itr->getSource())->IsTotem())
continue; continue;
if (i_playerControled) if (i_playerControled)

View file

@ -197,7 +197,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
&Aura::HandleAuraSafeFall, //144 SPELL_AURA_SAFE_FALL implemented in WorldSession::HandleMovementOpcodes &Aura::HandleAuraSafeFall, //144 SPELL_AURA_SAFE_FALL implemented in WorldSession::HandleMovementOpcodes
&Aura::HandleAuraModPetTalentsPoints, //145 SPELL_AURA_MOD_PET_TALENT_POINTS &Aura::HandleAuraModPetTalentsPoints, //145 SPELL_AURA_MOD_PET_TALENT_POINTS
&Aura::HandleNoImmediateEffect, //146 SPELL_AURA_ALLOW_TAME_PET_TYPE implemented in Player::CanTameExoticPets &Aura::HandleNoImmediateEffect, //146 SPELL_AURA_ALLOW_TAME_PET_TYPE implemented in Player::CanTameExoticPets
&Aura::HandleModMechanicImmunityMask, //147 SPELL_AURA_MECHANIC_IMMUNITY_MASK implemented in Unit::IsImmunedToSpell and Unit::IsImmunedToSpellEffect (check part) &Aura::HandleModMechanicImmunityMask, //147 SPELL_AURA_MECHANIC_IMMUNITY_MASK implemented in Unit::IsImmuneToSpell and Unit::IsImmuneToSpellEffect (check part)
&Aura::HandleAuraRetainComboPoints, //148 SPELL_AURA_RETAIN_COMBO_POINTS &Aura::HandleAuraRetainComboPoints, //148 SPELL_AURA_RETAIN_COMBO_POINTS
&Aura::HandleNoImmediateEffect, //149 SPELL_AURA_REDUCE_PUSHBACK implemented in Spell::Delayed and Spell::DelayedChannel &Aura::HandleNoImmediateEffect, //149 SPELL_AURA_REDUCE_PUSHBACK implemented in Spell::Delayed and Spell::DelayedChannel
&Aura::HandleShieldBlockValue, //150 SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT &Aura::HandleShieldBlockValue, //150 SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT
@ -317,7 +317,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
&Aura::HandleUnused, //264 unused (3.0.8a-3.2.2a) &Aura::HandleUnused, //264 unused (3.0.8a-3.2.2a)
&Aura::HandleUnused, //265 unused (3.0.8a-3.2.2a) &Aura::HandleUnused, //265 unused (3.0.8a-3.2.2a)
&Aura::HandleUnused, //266 unused (3.0.8a-3.2.2a) &Aura::HandleUnused, //266 unused (3.0.8a-3.2.2a)
&Aura::HandleNoImmediateEffect, //267 SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL implemented in Unit::IsImmunedToSpellEffect &Aura::HandleNoImmediateEffect, //267 SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL implemented in Unit::IsImmuneToSpellEffect
&Aura::HandleAuraModAttackPowerOfStatPercent, //268 SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT &Aura::HandleAuraModAttackPowerOfStatPercent, //268 SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT
&Aura::HandleNoImmediateEffect, //269 SPELL_AURA_MOD_IGNORE_DAMAGE_REDUCTION_SCHOOL implemented in Unit::CalcNotIgnoreDamageRedunction &Aura::HandleNoImmediateEffect, //269 SPELL_AURA_MOD_IGNORE_DAMAGE_REDUCTION_SCHOOL implemented in Unit::CalcNotIgnoreDamageRedunction
&Aura::HandleUnused, //270 SPELL_AURA_MOD_IGNORE_TARGET_RESIST (unused in 3.2.2a) &Aura::HandleUnused, //270 SPELL_AURA_MOD_IGNORE_TARGET_RESIST (unused in 3.2.2a)
@ -473,12 +473,12 @@ Unit *caster, Item* castItem) : Aura(spellproto, eff, currentBasePoints, holder,
{ {
case SPELL_EFFECT_APPLY_AREA_AURA_PARTY: case SPELL_EFFECT_APPLY_AREA_AURA_PARTY:
m_areaAuraType = AREA_AURA_PARTY; m_areaAuraType = AREA_AURA_PARTY;
if (target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->isTotem()) if (target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->IsTotem())
m_modifier.m_auraname = SPELL_AURA_NONE; m_modifier.m_auraname = SPELL_AURA_NONE;
break; break;
case SPELL_EFFECT_APPLY_AREA_AURA_RAID: case SPELL_EFFECT_APPLY_AREA_AURA_RAID:
m_areaAuraType = AREA_AURA_RAID; m_areaAuraType = AREA_AURA_RAID;
if (target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->isTotem()) if (target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->IsTotem())
m_modifier.m_auraname = SPELL_AURA_NONE; m_modifier.m_auraname = SPELL_AURA_NONE;
// Light's Beacon not applied to caster itself (TODO: more generic check for another simialr spell if any?) // Light's Beacon not applied to caster itself (TODO: more generic check for another simialr spell if any?)
else if (target == caster_ptr && spellproto->Id == 53651) else if (target == caster_ptr && spellproto->Id == 53651)
@ -3519,7 +3519,7 @@ void Aura::HandleModPossessPet(bool apply, bool Real)
return; return;
Unit* target = GetTarget(); Unit* target = GetTarget();
if (target->GetTypeId() != TYPEID_UNIT || !((Creature*)target)->isPet()) if (target->GetTypeId() != TYPEID_UNIT || !((Creature*)target)->IsPet())
return; return;
Pet* pet = (Pet*)target; Pet* pet = (Pet*)target;
@ -3665,7 +3665,7 @@ void Aura::HandleModCharm(bool apply, bool Real)
CreatureInfo const *cinfo = ((Creature*)target)->GetCreatureInfo(); CreatureInfo const *cinfo = ((Creature*)target)->GetCreatureInfo();
// restore faction // restore faction
if(((Creature*)target)->isPet()) if(((Creature*)target)->IsPet())
{ {
if(Unit* owner = target->GetOwner()) if(Unit* owner = target->GetOwner())
target->setFaction(owner->getFaction()); target->setFaction(owner->getFaction());
@ -4442,7 +4442,7 @@ void Aura::HandleModMechanicImmunityMask(bool apply, bool /*Real*/)
if(apply && GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY) if(apply && GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY)
GetTarget()->RemoveAurasAtMechanicImmunity(mechanic,GetId()); GetTarget()->RemoveAurasAtMechanicImmunity(mechanic,GetId());
// check implemented in Unit::IsImmunedToSpell and Unit::IsImmunedToSpellEffect // check implemented in Unit::IsImmuneToSpell and Unit::IsImmuneToSpellEffect
} }
//this method is called whenever we add / remove aura which gives m_target some imunity to some spell effect //this method is called whenever we add / remove aura which gives m_target some imunity to some spell effect
@ -4992,7 +4992,7 @@ void Aura::HandleAuraModResistance(bool apply, bool /*Real*/)
if(m_modifier.m_miscvalue & int32(1<<x)) if(m_modifier.m_miscvalue & int32(1<<x))
{ {
GetTarget()->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), TOTAL_VALUE, float(m_modifier.m_amount), apply); GetTarget()->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), TOTAL_VALUE, float(m_modifier.m_amount), apply);
if(GetTarget()->GetTypeId() == TYPEID_PLAYER || ((Creature*)GetTarget())->isPet()) if(GetTarget()->GetTypeId() == TYPEID_PLAYER || ((Creature*)GetTarget())->IsPet())
GetTarget()->ApplyResistanceBuffModsMod(SpellSchools(x), m_positive, float(m_modifier.m_amount), apply); GetTarget()->ApplyResistanceBuffModsMod(SpellSchools(x), m_positive, float(m_modifier.m_amount), apply);
} }
} }
@ -5004,7 +5004,7 @@ void Aura::HandleAuraModBaseResistancePCT(bool apply, bool /*Real*/)
if(GetTarget()->GetTypeId() != TYPEID_PLAYER) if(GetTarget()->GetTypeId() != TYPEID_PLAYER)
{ {
//pets only have base armor //pets only have base armor
if(((Creature*)GetTarget())->isPet() && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL)) if(((Creature*)GetTarget())->IsPet() && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL))
GetTarget()->HandleStatModifier(UNIT_MOD_ARMOR, BASE_PCT, float(m_modifier.m_amount), apply); GetTarget()->HandleStatModifier(UNIT_MOD_ARMOR, BASE_PCT, float(m_modifier.m_amount), apply);
} }
else else
@ -5026,7 +5026,7 @@ void Aura::HandleModResistancePercent(bool apply, bool /*Real*/)
if(m_modifier.m_miscvalue & int32(1<<i)) if(m_modifier.m_miscvalue & int32(1<<i))
{ {
target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_PCT, float(m_modifier.m_amount), apply); target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_PCT, float(m_modifier.m_amount), apply);
if(target->GetTypeId() == TYPEID_PLAYER || ((Creature*)target)->isPet()) if(target->GetTypeId() == TYPEID_PLAYER || ((Creature*)target)->IsPet())
{ {
target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), true, float(m_modifier.m_amount), apply); target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), true, float(m_modifier.m_amount), apply);
target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), false, float(m_modifier.m_amount), apply); target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), false, float(m_modifier.m_amount), apply);
@ -5041,7 +5041,7 @@ void Aura::HandleModBaseResistance(bool apply, bool /*Real*/)
if(GetTarget()->GetTypeId() != TYPEID_PLAYER) if(GetTarget()->GetTypeId() != TYPEID_PLAYER)
{ {
//only pets have base stats //only pets have base stats
if(((Creature*)GetTarget())->isPet() && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL)) if(((Creature*)GetTarget())->IsPet() && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL))
GetTarget()->HandleStatModifier(UNIT_MOD_ARMOR, TOTAL_VALUE, float(m_modifier.m_amount), apply); GetTarget()->HandleStatModifier(UNIT_MOD_ARMOR, TOTAL_VALUE, float(m_modifier.m_amount), apply);
} }
else else
@ -5071,7 +5071,7 @@ void Aura::HandleAuraModStat(bool apply, bool /*Real*/)
{ {
//m_target->ApplyStatMod(Stats(i), m_modifier.m_amount,apply); //m_target->ApplyStatMod(Stats(i), m_modifier.m_amount,apply);
GetTarget()->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_VALUE, float(m_modifier.m_amount), apply); GetTarget()->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_VALUE, float(m_modifier.m_amount), apply);
if(GetTarget()->GetTypeId() == TYPEID_PLAYER || ((Creature*)GetTarget())->isPet()) if(GetTarget()->GetTypeId() == TYPEID_PLAYER || ((Creature*)GetTarget())->IsPet())
GetTarget()->ApplyStatBuffMod(Stats(i), float(m_modifier.m_amount), apply); GetTarget()->ApplyStatBuffMod(Stats(i), float(m_modifier.m_amount), apply);
} }
} }
@ -5173,7 +5173,7 @@ void Aura::HandleModTotalPercentStat(bool apply, bool /*Real*/)
if(m_modifier.m_miscvalue == i || m_modifier.m_miscvalue == -1) if(m_modifier.m_miscvalue == i || m_modifier.m_miscvalue == -1)
{ {
target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, float(m_modifier.m_amount), apply); target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, float(m_modifier.m_amount), apply);
if(target->GetTypeId() == TYPEID_PLAYER || ((Creature*)target)->isPet()) if(target->GetTypeId() == TYPEID_PLAYER || ((Creature*)target)->IsPet())
target->ApplyStatPercentBuffMod(Stats(i), float(m_modifier.m_amount), apply ); target->ApplyStatPercentBuffMod(Stats(i), float(m_modifier.m_amount), apply );
} }
} }
@ -7562,7 +7562,7 @@ void Aura::HandleAuraControlVehicle(bool apply, bool Real)
return; return;
Unit* target = GetTarget(); Unit* target = GetTarget();
if (target->GetTypeId() != TYPEID_UNIT || !((Creature*)target)->isVehicle()) if (target->GetTypeId() != TYPEID_UNIT || !((Creature*)target)->IsVehicle())
return; return;
Vehicle* vehicle = (Vehicle*)target; Vehicle* vehicle = (Vehicle*)target;
@ -7969,7 +7969,7 @@ void SpellAuraHolder::_RemoveSpellAuraHolder()
//passive auras do not get put in slots - said who? ;) //passive auras do not get put in slots - said who? ;)
// Note: but totem can be not accessible for aura target in time remove (to far for find in grid) // Note: but totem can be not accessible for aura target in time remove (to far for find in grid)
//if(m_isPassive && !(caster && caster->GetTypeId() == TYPEID_UNIT && ((Creature*)caster)->isTotem())) //if(m_isPassive && !(caster && caster->GetTypeId() == TYPEID_UNIT && ((Creature*)caster)->IsTotem()))
// return; // return;
uint8 slot = GetAuraSlot(); uint8 slot = GetAuraSlot();
@ -8207,7 +8207,7 @@ bool SpellAuraHolder::IsWeaponBuffCoexistableWith(SpellAuraHolder* ref)
bool SpellAuraHolder::IsNeedVisibleSlot(Unit const* caster) const bool SpellAuraHolder::IsNeedVisibleSlot(Unit const* caster) const
{ {
bool totemAura = caster && caster->GetTypeId() == TYPEID_UNIT && ((Creature*)caster)->isTotem(); bool totemAura = caster && caster->GetTypeId() == TYPEID_UNIT && ((Creature*)caster)->IsTotem();
if (m_spellProto->procFlags) if (m_spellProto->procFlags)
return true; return true;

View file

@ -826,7 +826,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx)
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT)
return; return;
((Creature*)unitTarget)->setDeathState(JUST_ALIVED); ((Creature*)unitTarget)->SetDeathState(JUST_ALIVED);
return; return;
} }
case 10254: // Stone Dwarf Awaken Visual case 10254: // Stone Dwarf Awaken Visual
@ -938,11 +938,11 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx)
} }
case 23019: // Crystal Prison Dummy DND case 23019: // Crystal Prison Dummy DND
{ {
if (!unitTarget || !unitTarget->isAlive() || unitTarget->GetTypeId() != TYPEID_UNIT || ((Creature*)unitTarget)->isPet()) if (!unitTarget || !unitTarget->isAlive() || unitTarget->GetTypeId() != TYPEID_UNIT || ((Creature*)unitTarget)->IsPet())
return; return;
Creature* creatureTarget = (Creature*)unitTarget; Creature* creatureTarget = (Creature*)unitTarget;
if (creatureTarget->isPet()) if (creatureTarget->IsPet())
return; return;
GameObject* pGameObj = new GameObject; GameObject* pGameObj = new GameObject;
@ -1390,7 +1390,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx)
return; return;
unitTarget->CastSpell(m_caster, 43160, true); unitTarget->CastSpell(m_caster, 43160, true);
unitTarget->setDeathState(JUST_DIED); unitTarget->SetDeathState(JUST_DIED);
unitTarget->SetHealth(0); unitTarget->SetHealth(0);
return; return;
} }
@ -1496,7 +1496,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx)
unitTarget->CastSpell(unitTarget, 51278, true); unitTarget->CastSpell(unitTarget, 51278, true);
unitTarget->CastSpell(m_caster, 51279, true); unitTarget->CastSpell(m_caster, 51279, true);
unitTarget->setDeathState(JUST_DIED); unitTarget->SetDeathState(JUST_DIED);
return; return;
} }
case 51330: // Shoot RJR case 51330: // Shoot RJR
@ -4978,7 +4978,7 @@ void Spell::EffectSummonPet(SpellEffectIndex eff_idx)
uint32 faction = m_caster->getFaction(); uint32 faction = m_caster->getFaction();
if(m_caster->GetTypeId() == TYPEID_UNIT) if(m_caster->GetTypeId() == TYPEID_UNIT)
{ {
if ( ((Creature*)m_caster)->isTotem() ) if ( ((Creature*)m_caster)->IsTotem() )
NewSummon->GetCharmInfo()->SetReactState(REACT_AGGRESSIVE); NewSummon->GetCharmInfo()->SetReactState(REACT_AGGRESSIVE);
else else
NewSummon->GetCharmInfo()->SetReactState(REACT_DEFENSIVE); NewSummon->GetCharmInfo()->SetReactState(REACT_DEFENSIVE);
@ -5749,7 +5749,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx)
if (const SpellEntry *pSpell = sSpellStore.LookupEntry(m_spellInfo->CalculateSimpleValue(eff_idx))) if (const SpellEntry *pSpell = sSpellStore.LookupEntry(m_spellInfo->CalculateSimpleValue(eff_idx)))
{ {
// if we used item at least once... // if we used item at least once...
if (pTarget->isTemporarySummon() && pTarget->GetEntry() == pSpell->EffectMiscValue[eff_idx]) if (pTarget->IsTemporarySummon() && pTarget->GetEntry() == pSpell->EffectMiscValue[eff_idx])
{ {
TemporarySummon* pSummon = (TemporarySummon*)pTarget; TemporarySummon* pSummon = (TemporarySummon*)pTarget;
@ -5797,7 +5797,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx)
if (!pQuestCow) if (!pQuestCow)
return; return;
if (!((Creature*)m_caster)->isTemporarySummon()) if (!((Creature*)m_caster)->IsTemporarySummon())
return; return;
if (const SpellEntry *pSpell = sSpellStore.LookupEntry(m_spellInfo->CalculateSimpleValue(eff_idx))) if (const SpellEntry *pSpell = sSpellStore.LookupEntry(m_spellInfo->CalculateSimpleValue(eff_idx)))
@ -6017,7 +6017,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx)
if (m_caster->GetTypeId() != TYPEID_UNIT) if (m_caster->GetTypeId() != TYPEID_UNIT)
return; return;
if (((Creature*)m_caster)->isTemporarySummon()) if (((Creature*)m_caster)->IsTemporarySummon())
{ {
TemporarySummon* pSummon = (TemporarySummon*)m_caster; TemporarySummon* pSummon = (TemporarySummon*)m_caster;
@ -7332,7 +7332,7 @@ void Spell::EffectSkinning(SpellEffectIndex /*eff_idx*/)
int32 skillValue = ((Player*)m_caster)->GetPureSkillValue(skill); int32 skillValue = ((Player*)m_caster)->GetPureSkillValue(skill);
// Double chances for elites // Double chances for elites
((Player*)m_caster)->UpdateGatherSkill(skill, skillValue, reqValue, creature->isElite() ? 2 : 1 ); ((Player*)m_caster)->UpdateGatherSkill(skill, skillValue, reqValue, creature->IsElite() ? 2 : 1 );
} }
void Spell::EffectCharge(SpellEffectIndex /*eff_idx*/) void Spell::EffectCharge(SpellEffectIndex /*eff_idx*/)
@ -7531,7 +7531,7 @@ void Spell::EffectSummonDeadPet(SpellEffectIndex /*eff_idx*/)
return; return;
pet->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0); pet->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0);
pet->RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); pet->RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
pet->setDeathState( ALIVE ); pet->SetDeathState( ALIVE );
pet->clearUnitState(UNIT_STAT_ALL_STATE); pet->clearUnitState(UNIT_STAT_ALL_STATE);
pet->SetHealth( uint32(pet->GetMaxHealth()*(float(damage)/100))); pet->SetHealth( uint32(pet->GetMaxHealth()*(float(damage)/100)));
@ -7965,7 +7965,7 @@ void Spell::EffectTitanGrip(SpellEffectIndex eff_idx)
void Spell::EffectRenamePet(SpellEffectIndex /*eff_idx*/) void Spell::EffectRenamePet(SpellEffectIndex /*eff_idx*/)
{ {
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT || if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT ||
!((Creature*)unitTarget)->isPet() || ((Pet*)unitTarget)->getPetType() != HUNTER_PET) !((Creature*)unitTarget)->IsPet() || ((Pet*)unitTarget)->getPetType() != HUNTER_PET)
return; return;
unitTarget->RemoveByteFlag(UNIT_FIELD_BYTES_2, 2, UNIT_CAN_BE_RENAMED); unitTarget->RemoveByteFlag(UNIT_FIELD_BYTES_2, 2, UNIT_CAN_BE_RENAMED);

View file

@ -79,7 +79,7 @@ void TargetedMovementGeneratorMedium<T,D>::_setTargetLocation(T &owner)
i_destinationHolder.SetDestination(traveller, x, y, z); i_destinationHolder.SetDestination(traveller, x, y, z);
D::_addUnitStateMove(owner); D::_addUnitStateMove(owner);
if (owner.GetTypeId() == TYPEID_UNIT && ((Creature*)&owner)->canFly()) if (owner.GetTypeId() == TYPEID_UNIT && ((Creature*)&owner)->CanFly())
((Creature&)owner).AddSplineFlag(SPLINEFLAG_UNKNOWN7); ((Creature&)owner).AddSplineFlag(SPLINEFLAG_UNKNOWN7);
} }
@ -146,7 +146,7 @@ bool TargetedMovementGeneratorMedium<T,D>::Update(T &owner, const uint32 & time_
if (owner.IsStopped() && !i_destinationHolder.HasArrived()) if (owner.IsStopped() && !i_destinationHolder.HasArrived())
{ {
D::_addUnitStateMove(owner); D::_addUnitStateMove(owner);
if (owner.GetTypeId() == TYPEID_UNIT && ((Creature*)&owner)->canFly()) if (owner.GetTypeId() == TYPEID_UNIT && ((Creature*)&owner)->CanFly())
((Creature&)owner).AddSplineFlag(SPLINEFLAG_UNKNOWN7); ((Creature&)owner).AddSplineFlag(SPLINEFLAG_UNKNOWN7);
i_destinationHolder.StartTravel(traveller); i_destinationHolder.StartTravel(traveller);
@ -210,7 +210,7 @@ void ChaseMovementGenerator<Creature>::Initialize(Creature &owner)
owner.addUnitState(UNIT_STAT_CHASE|UNIT_STAT_CHASE_MOVE); owner.addUnitState(UNIT_STAT_CHASE|UNIT_STAT_CHASE_MOVE);
owner.RemoveSplineFlag(SPLINEFLAG_WALKMODE); owner.RemoveSplineFlag(SPLINEFLAG_WALKMODE);
if (((Creature*)&owner)->canFly()) if (((Creature*)&owner)->CanFly())
owner.AddSplineFlag(SPLINEFLAG_UNKNOWN7); owner.AddSplineFlag(SPLINEFLAG_UNKNOWN7);
_setTargetLocation(owner); _setTargetLocation(owner);
@ -238,7 +238,7 @@ void ChaseMovementGenerator<T>::Reset(T &owner)
template<> template<>
void FollowMovementGenerator<Creature>::_updateWalkMode(Creature &u) void FollowMovementGenerator<Creature>::_updateWalkMode(Creature &u)
{ {
if (i_target.isValid() && u.isPet()) if (i_target.isValid() && u.IsPet())
u.UpdateWalkMode(i_target.getTarget()); u.UpdateWalkMode(i_target.getTarget());
} }
@ -257,7 +257,7 @@ template<>
void FollowMovementGenerator<Creature>::_updateSpeed(Creature &u) void FollowMovementGenerator<Creature>::_updateSpeed(Creature &u)
{ {
// pet only sync speed with owner // 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->GetGUID() != u.GetOwnerGUID())
return; return;
u.UpdateSpeed(MOVE_RUN,true); u.UpdateSpeed(MOVE_RUN,true);
@ -281,7 +281,7 @@ void FollowMovementGenerator<Creature>::Initialize(Creature &owner)
_updateWalkMode(owner); _updateWalkMode(owner);
_updateSpeed(owner); _updateSpeed(owner);
if (((Creature*)&owner)->canFly()) if (((Creature*)&owner)->CanFly())
owner.AddSplineFlag(SPLINEFLAG_UNKNOWN7); owner.AddSplineFlag(SPLINEFLAG_UNKNOWN7);
_setTargetLocation(owner); _setTargetLocation(owner);

View file

@ -139,7 +139,7 @@ void Totem::SetTypeBySummonSpell(SpellEntry const * spellProto)
m_type = TOTEM_STATUE; //Jewelery statue m_type = TOTEM_STATUE; //Jewelery statue
} }
bool Totem::IsImmunedToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex index) const bool Totem::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex index) const
{ {
// TODO: possibly all negative auras immune? // TODO: possibly all negative auras immune?
switch(spellInfo->Effect[index]) switch(spellInfo->Effect[index])
@ -160,5 +160,5 @@ bool Totem::IsImmunedToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex
default: default:
break; break;
} }
return Creature::IsImmunedToSpellEffect(spellInfo, index); return Creature::IsImmuneToSpellEffect(spellInfo, index);
} }

View file

@ -53,7 +53,7 @@ class Totem : public Creature
void UpdateAttackPowerAndDamage(bool /*ranged*/ ) {} void UpdateAttackPowerAndDamage(bool /*ranged*/ ) {}
void UpdateDamagePhysical(WeaponAttackType /*attType*/) {} void UpdateDamagePhysical(WeaponAttackType /*attType*/) {}
bool IsImmunedToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex index) const; bool IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex index) const;
protected: protected:
TotemType m_type; TotemType m_type;

View file

@ -30,7 +30,7 @@
int int
TotemAI::Permissible(const Creature *creature) TotemAI::Permissible(const Creature *creature)
{ {
if( creature->isTotem() ) if( creature->IsTotem() )
return PERMIT_BASE_PROACTIVE; return PERMIT_BASE_PROACTIVE;
return PERMIT_BASE_NO; return PERMIT_BASE_NO;

View file

@ -93,7 +93,7 @@ inline float Traveller<Creature>::GetMoveDestinationTo(float x, float y, float z
float dx = x - GetPositionX(); float dx = x - GetPositionX();
float dy = y - GetPositionY(); float dy = y - GetPositionY();
if (i_traveller.canFly()) if (i_traveller.CanFly())
{ {
float dz = z - GetPositionZ(); float dz = z - GetPositionZ();
return sqrt((dx*dx) + (dy*dy) + (dz*dz)); return sqrt((dx*dx) + (dy*dy) + (dz*dz));

View file

@ -323,7 +323,7 @@ void Unit::Update( uint32 p_time )
getThreatManager().UpdateForClient(p_time); getThreatManager().UpdateForClient(p_time);
// update combat timer only for players and pets // update combat timer only for players and pets
if (isInCombat() && (GetTypeId() == TYPEID_PLAYER || ((Creature*)this)->isPet() || ((Creature*)this)->isCharmed())) if (isInCombat() && (GetTypeId() == TYPEID_PLAYER || ((Creature*)this)->IsPet() || ((Creature*)this)->isCharmed()))
{ {
// Check UNIT_STAT_MELEE_ATTACKING or UNIT_STAT_CHASE (without UNIT_STAT_FOLLOW in this case) so pets can reach far away // Check UNIT_STAT_MELEE_ATTACKING or UNIT_STAT_CHASE (without UNIT_STAT_FOLLOW in this case) so pets can reach far away
// targets without stopping half way there and running off. // targets without stopping half way there and running off.
@ -581,7 +581,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
((Creature*)pVictim)->SetLootRecipient(this); ((Creature*)pVictim)->SetLootRecipient(this);
pVictim->setDeathState(JUST_DIED); pVictim->SetDeathState(JUST_DIED);
pVictim->SetHealth(0); pVictim->SetHealth(0);
// allow loot only if has loot_id in creature_template // allow loot only if has loot_id in creature_template
@ -680,7 +680,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
if (pVictim->GetTypeId() == TYPEID_PLAYER) if (pVictim->GetTypeId() == TYPEID_PLAYER)
((Player*)pVictim)->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_RECEIVED, damage); ((Player*)pVictim)->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_RECEIVED, damage);
if (pVictim->GetTypeId() == TYPEID_UNIT && !((Creature*)pVictim)->isPet() && !((Creature*)pVictim)->HasLootRecipient()) if (pVictim->GetTypeId() == TYPEID_UNIT && !((Creature*)pVictim)->IsPet() && !((Creature*)pVictim)->HasLootRecipient())
((Creature*)pVictim)->SetLootRecipient(this); ((Creature*)pVictim)->SetLootRecipient(this);
if (health <= damage) if (health <= damage)
@ -768,7 +768,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
if (!spiritOfRedemtionTalentReady) if (!spiritOfRedemtionTalentReady)
{ {
DEBUG_FILTER_LOG(LOG_FILTER_DAMAGE,"SET JUST_DIED"); DEBUG_FILTER_LOG(LOG_FILTER_DAMAGE,"SET JUST_DIED");
pVictim->setDeathState(JUST_DIED); pVictim->SetDeathState(JUST_DIED);
} }
DEBUG_FILTER_LOG(LOG_FILTER_DAMAGE,"DealDamageHealth1"); DEBUG_FILTER_LOG(LOG_FILTER_DAMAGE,"DealDamageHealth1");
@ -829,7 +829,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
DEBUG_FILTER_LOG(LOG_FILTER_DAMAGE,"DealDamageNotPlayer"); DEBUG_FILTER_LOG(LOG_FILTER_DAMAGE,"DealDamageNotPlayer");
Creature *cVictim = (Creature*)pVictim; Creature *cVictim = (Creature*)pVictim;
if(!cVictim->isPet()) if(!cVictim->IsPet())
{ {
cVictim->DeleteThreatList(); cVictim->DeleteThreatList();
// only lootable if it has loot or can drop gold // only lootable if it has loot or can drop gold
@ -842,7 +842,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
if (cVictim->AI()) if (cVictim->AI())
cVictim->AI()->JustDied(this); cVictim->AI()->JustDied(this);
if (cVictim->isTemporarySummon()) if (cVictim->IsTemporarySummon())
{ {
TemporarySummon* pSummon = (TemporarySummon*)cVictim; TemporarySummon* pSummon = (TemporarySummon*)cVictim;
if (pSummon->GetSummonerGuid().IsCreature()) if (pSummon->GetSummonerGuid().IsCreature())
@ -2682,9 +2682,9 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack
// 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) // 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 && if( attType != RANGED_ATTACK &&
(GetTypeId() == TYPEID_PLAYER || ((Creature*)this)->isPet()) && (GetTypeId() == TYPEID_PLAYER || ((Creature*)this)->IsPet()) &&
pVictim->GetTypeId() != TYPEID_PLAYER && !((Creature*)pVictim)->isPet() && pVictim->GetTypeId() != TYPEID_PLAYER && !((Creature*)pVictim)->IsPet() &&
getLevel() < pVictim->getLevelForTarget(this) ) getLevel() < pVictim->GetLevelForTarget(this) )
{ {
// cap possible value (with bonuses > max skill) // cap possible value (with bonuses > max skill)
int32 skill = attackerWeaponSkill; int32 skill = attackerWeaponSkill;
@ -2701,9 +2701,9 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack
} }
// mobs can score crushing blows if they're 4 or more levels above victim // mobs can score crushing blows if they're 4 or more levels above victim
if (getLevelForTarget(pVictim) >= pVictim->getLevelForTarget(this) + 4 && if (GetLevelForTarget(pVictim) >= pVictim->GetLevelForTarget(this) + 4 &&
// can be from by creature (if can) or from controlled player that considered as creature // can be from by creature (if can) or from controlled player that considered as creature
(GetTypeId()!=TYPEID_PLAYER && !((Creature*)this)->isPet() && (GetTypeId()!=TYPEID_PLAYER && !((Creature*)this)->IsPet() &&
!(((Creature*)this)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRUSH) || !(((Creature*)this)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRUSH) ||
GetTypeId()==TYPEID_PLAYER && GetCharmerOrOwnerGUID())) GetTypeId()==TYPEID_PLAYER && GetCharmerOrOwnerGUID()))
{ {
@ -3028,7 +3028,7 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit *pVictim, SpellEntry const *spell)
SpellSchoolMask schoolMask = GetSpellSchoolMask(spell); SpellSchoolMask schoolMask = GetSpellSchoolMask(spell);
// PvP - PvE spell misschances per leveldif > 2 // PvP - PvE spell misschances per leveldif > 2
int32 lchance = pVictim->GetTypeId() == TYPEID_PLAYER ? 7 : 11; int32 lchance = pVictim->GetTypeId() == TYPEID_PLAYER ? 7 : 11;
int32 leveldif = int32(pVictim->getLevelForTarget(this)) - int32(getLevelForTarget(pVictim)); int32 leveldif = int32(pVictim->GetLevelForTarget(this)) - int32(GetLevelForTarget(pVictim));
// Base hit chance from attacker and victim levels // Base hit chance from attacker and victim levels
int32 modHitChance; int32 modHitChance;
@ -3114,7 +3114,7 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool
return SPELL_MISS_EVADE; return SPELL_MISS_EVADE;
// Check for immune // Check for immune
if (pVictim->IsImmunedToSpell(spell)) if (pVictim->IsImmuneToSpell(spell))
return SPELL_MISS_IMMUNE; return SPELL_MISS_IMMUNE;
// All positive spells can`t miss // All positive spells can`t miss
@ -3244,7 +3244,7 @@ float Unit::GetUnitDodgeChance() const
return GetFloatValue(PLAYER_DODGE_PERCENTAGE); return GetFloatValue(PLAYER_DODGE_PERCENTAGE);
else else
{ {
if(((Creature const*)this)->isTotem()) if(((Creature const*)this)->IsTotem())
return 0.0f; return 0.0f;
else else
{ {
@ -3306,7 +3306,7 @@ float Unit::GetUnitBlockChance() const
} }
else else
{ {
if(((Creature const*)this)->isTotem()) if(((Creature const*)this)->IsTotem())
return 0.0f; return 0.0f;
else else
{ {
@ -3718,9 +3718,9 @@ void Unit::SetFacingToObject(WorldObject* pObject)
bool Unit::isInAccessablePlaceFor(Creature const* c) const bool Unit::isInAccessablePlaceFor(Creature const* c) const
{ {
if(IsInWater()) if(IsInWater())
return c->canSwim(); return c->CanSwim();
else else
return c->canWalk() || c->canFly(); return c->CanWalk() || c->CanFly();
} }
bool Unit::IsInWater() const bool Unit::IsInWater() const
@ -4671,7 +4671,7 @@ void Unit::RemoveSpellAuraHolder(SpellAuraHolder *holder, AuraRemoveMode mode)
Totem* statue = NULL; Totem* statue = NULL;
Unit* caster = holder->GetCaster(); Unit* caster = holder->GetCaster();
if(IsChanneledSpell(AurSpellInfo) && caster) if(IsChanneledSpell(AurSpellInfo) && caster)
if(caster->GetTypeId()==TYPEID_UNIT && ((Creature*)caster)->isTotem() && ((Totem*)caster)->GetTotemType()==TOTEM_STATUE) if(caster->GetTypeId()==TYPEID_UNIT && ((Creature*)caster)->IsTotem() && ((Totem*)caster)->GetTotemType()==TOTEM_STATUE)
statue = ((Totem*)caster); statue = ((Totem*)caster);
if (m_spellAuraHoldersUpdateIterator != m_spellAuraHolders.end() && m_spellAuraHoldersUpdateIterator->second == holder) if (m_spellAuraHoldersUpdateIterator != m_spellAuraHolders.end() && m_spellAuraHoldersUpdateIterator->second == holder)
@ -5255,7 +5255,7 @@ void Unit::setPowerType(Powers new_powertype)
if(((Player*)this)->GetGroup()) if(((Player*)this)->GetGroup())
((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POWER_TYPE); ((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POWER_TYPE);
} }
else if(((Creature*)this)->isPet()) else if(((Creature*)this)->IsPet())
{ {
Pet *pet = ((Pet*)this); Pet *pet = ((Pet*)this);
if(pet->isControlled()) if(pet->isControlled())
@ -5939,7 +5939,7 @@ Totem* Unit::GetTotem(TotemSlot slot ) const
return NULL; return NULL;
Creature *totem = GetMap()->GetCreature(m_TotemSlot[slot]); Creature *totem = GetMap()->GetCreature(m_TotemSlot[slot]);
return totem && totem->isTotem() ? (Totem*)totem : NULL; return totem && totem->IsTotem() ? (Totem*)totem : NULL;
} }
bool Unit::IsAllTotemSlotsUsed() const bool Unit::IsAllTotemSlotsUsed() const
@ -5982,7 +5982,7 @@ int32 Unit::DealHeal(Unit *pVictim, uint32 addhealth, SpellEntry const *spellPro
Unit* unit = this; Unit* unit = this;
if( GetTypeId()==TYPEID_UNIT && ((Creature*)this)->isTotem() && ((Totem*)this)->GetTotemType()!=TOTEM_STATUE) if( GetTypeId()==TYPEID_UNIT && ((Creature*)this)->IsTotem() && ((Totem*)this)->GetTotemType()!=TOTEM_STATUE)
unit = GetOwner(); unit = GetOwner();
if (unit->GetTypeId()==TYPEID_PLAYER) if (unit->GetTypeId()==TYPEID_PLAYER)
@ -6076,7 +6076,7 @@ int32 Unit::SpellBonusWithCoeffs(SpellEntry const *spellProto, int32 total, int3
float coeff; float coeff;
// Not apply this to creature casted spells // Not apply this to creature casted spells
if (GetTypeId()==TYPEID_UNIT && !((Creature*)this)->isPet()) if (GetTypeId()==TYPEID_UNIT && !((Creature*)this)->IsPet())
coeff = 1.0f; coeff = 1.0f;
// Check for table values // Check for table values
else if (SpellBonusEntry const* bonus = sSpellMgr.GetSpellBonusData(spellProto->Id)) else if (SpellBonusEntry const* bonus = sSpellMgr.GetSpellBonusData(spellProto->Id))
@ -6130,7 +6130,7 @@ uint32 Unit::SpellDamageBonusDone(Unit *pVictim, SpellEntry const *spellProto, u
return pdamage; return pdamage;
// For totems get damage bonus from owner (statue isn't totem in fact) // For totems get damage bonus from owner (statue isn't totem in fact)
if( GetTypeId()==TYPEID_UNIT && ((Creature*)this)->isTotem() && ((Totem*)this)->GetTotemType()!=TOTEM_STATUE) if( GetTypeId()==TYPEID_UNIT && ((Creature*)this)->IsTotem() && ((Totem*)this)->GetTotemType()!=TOTEM_STATUE)
{ {
if(Unit* owner = GetOwner()) if(Unit* owner = GetOwner())
return owner->SpellDamageBonusDone(pVictim, spellProto, pdamage, damagetype); return owner->SpellDamageBonusDone(pVictim, spellProto, pdamage, damagetype);
@ -6140,7 +6140,7 @@ uint32 Unit::SpellDamageBonusDone(Unit *pVictim, SpellEntry const *spellProto, u
int32 DoneTotal = 0; int32 DoneTotal = 0;
// Creature damage // Creature damage
if( GetTypeId() == TYPEID_UNIT && !((Creature*)this)->isPet() ) if( GetTypeId() == TYPEID_UNIT && !((Creature*)this)->IsPet() )
DoneTotalMod *= ((Creature*)this)->GetSpellDamageMod(((Creature*)this)->GetCreatureInfo()->rank); DoneTotalMod *= ((Creature*)this)->GetSpellDamageMod(((Creature*)this)->GetCreatureInfo()->rank);
AuraList const& mModDamagePercentDone = GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); AuraList const& mModDamagePercentDone = GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
@ -6415,7 +6415,7 @@ uint32 Unit::SpellDamageBonusDone(Unit *pVictim, SpellEntry const *spellProto, u
// Pets just add their bonus damage to their spell damage // Pets just add their bonus damage to their spell damage
// note that their spell damage is just gain of their own auras // note that their spell damage is just gain of their own auras
if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet()) if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->IsPet())
DoneAdvertisedBenefit += ((Pet*)this)->GetBonusDamage(); DoneAdvertisedBenefit += ((Pet*)this)->GetBonusDamage();
// apply ap bonus and benefit affected by spell power implicit coeffs and spell level penalties // apply ap bonus and benefit affected by spell power implicit coeffs and spell level penalties
@ -6475,7 +6475,7 @@ uint32 Unit::SpellDamageBonusTaken(Unit *pCaster, SpellEntry const *spellProto,
if(IsAreaOfEffectSpell(spellProto)) if(IsAreaOfEffectSpell(spellProto))
{ {
TakenTotalMod *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE, schoolMask); TakenTotalMod *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE, schoolMask);
if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet()) if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->IsPet())
TakenTotalMod *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_PET_AOE_DAMAGE_AVOIDANCE, schoolMask); TakenTotalMod *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_PET_AOE_DAMAGE_AVOIDANCE, schoolMask);
} }
@ -6784,7 +6784,7 @@ uint32 Unit::SpellCriticalHealingBonus(SpellEntry const *spellProto, uint32 dama
uint32 Unit::SpellHealingBonusDone(Unit *pVictim, SpellEntry const *spellProto, int32 healamount, DamageEffectType damagetype, uint32 stack) uint32 Unit::SpellHealingBonusDone(Unit *pVictim, SpellEntry const *spellProto, int32 healamount, DamageEffectType damagetype, uint32 stack)
{ {
// For totems get healing bonus from owner (statue isn't totem in fact) // For totems get healing bonus from owner (statue isn't totem in fact)
if( GetTypeId()==TYPEID_UNIT && ((Creature*)this)->isTotem() && ((Totem*)this)->GetTotemType()!=TOTEM_STATUE) if( GetTypeId()==TYPEID_UNIT && ((Creature*)this)->IsTotem() && ((Totem*)this)->GetTotemType()!=TOTEM_STATUE)
if(Unit* owner = GetOwner()) if(Unit* owner = GetOwner())
return owner->SpellHealingBonusDone(pVictim, spellProto, healamount, damagetype, stack); return owner->SpellHealingBonusDone(pVictim, spellProto, healamount, damagetype, stack);
@ -7001,7 +7001,7 @@ bool Unit::IsImmunedToDamage(SpellSchoolMask shoolMask)
return false; return false;
} }
bool Unit::IsImmunedToSpell(SpellEntry const* spellInfo) bool Unit::IsImmuneToSpell(SpellEntry const* spellInfo)
{ {
if (!spellInfo) if (!spellInfo)
return false; return false;
@ -7040,7 +7040,7 @@ bool Unit::IsImmunedToSpell(SpellEntry const* spellInfo)
return false; return false;
} }
bool Unit::IsImmunedToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex index) const bool Unit::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex index) const
{ {
//If m_immuneToEffect type contain this effect type, IMMUNE effect. //If m_immuneToEffect type contain this effect type, IMMUNE effect.
uint32 effect = spellInfo->Effect[index]; uint32 effect = spellInfo->Effect[index];
@ -7139,7 +7139,7 @@ uint32 Unit::MeleeDamageBonusDone(Unit *pVictim, uint32 pdamage,WeaponAttackType
} }
// Pets just add their bonus damage to their melee damage // Pets just add their bonus damage to their melee damage
if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet()) if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->IsPet())
DoneFlat += ((Pet*)this)->GetBonusDamage(); DoneFlat += ((Pet*)this)->GetBonusDamage();
} }
@ -7399,7 +7399,7 @@ uint32 Unit::MeleeDamageBonusTaken(Unit *pCaster, uint32 pdamage,WeaponAttackTyp
if(spellProto && IsAreaOfEffectSpell(spellProto)) if(spellProto && IsAreaOfEffectSpell(spellProto))
{ {
TakenPercent *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE, schoolMask); TakenPercent *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE, schoolMask);
if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet()) if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->IsPet())
TakenPercent *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_PET_AOE_DAMAGE_AVOIDANCE, schoolMask); TakenPercent *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_PET_AOE_DAMAGE_AVOIDANCE, schoolMask);
} }
@ -7600,7 +7600,7 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy)
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT);
if (isCharmed() || (GetTypeId()!=TYPEID_PLAYER && ((Creature*)this)->isPet())) if (isCharmed() || (GetTypeId()!=TYPEID_PLAYER && ((Creature*)this)->IsPet()))
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT); SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT);
// interrupt all delayed non-combat casts // interrupt all delayed non-combat casts
@ -7627,7 +7627,7 @@ void Unit::ClearInCombat()
m_CombatTimer = 0; m_CombatTimer = 0;
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT);
if(isCharmed() || (GetTypeId()!=TYPEID_PLAYER && ((Creature*)this)->isPet())) if(isCharmed() || (GetTypeId()!=TYPEID_PLAYER && ((Creature*)this)->IsPet()))
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT); RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT);
// Player's state will be cleared in Player::UpdateContestedPvP // Player's state will be cleared in Player::UpdateContestedPvP
@ -7939,7 +7939,7 @@ bool Unit::isVisibleForOrDetect(Unit const* u, WorldObject const* viewPoint, boo
//Visible distance is modified by //Visible distance is modified by
//-Level Diff (every level diff = 1.0f in visible distance) //-Level Diff (every level diff = 1.0f in visible distance)
visibleDistance += int32(u->getLevelForTarget(this)) - int32(getLevelForTarget(u)); visibleDistance += int32(u->GetLevelForTarget(this)) - int32(GetLevelForTarget(u));
//This allows to check talent tree and will add addition stealth dependent on used points) //This allows to check talent tree and will add addition stealth dependent on used points)
int32 stealthMod = GetTotalAuraModifier(SPELL_AURA_MOD_STEALTH_LEVEL); int32 stealthMod = GetTotalAuraModifier(SPELL_AURA_MOD_STEALTH_LEVEL);
@ -8061,12 +8061,12 @@ void Unit::UpdateWalkMode(Unit* source, bool self)
if (on) if (on)
{ {
if (((Creature*)this)->isPet() && hasUnitState(UNIT_STAT_FOLLOW)) if (((Creature*)this)->IsPet() && hasUnitState(UNIT_STAT_FOLLOW))
((Creature*)this)->AddSplineFlag(SPLINEFLAG_WALKMODE); ((Creature*)this)->AddSplineFlag(SPLINEFLAG_WALKMODE);
} }
else else
{ {
if (((Creature*)this)->isPet()) if (((Creature*)this)->IsPet())
((Creature*)this)->RemoveSplineFlag(SPLINEFLAG_WALKMODE); ((Creature*)this)->RemoveSplineFlag(SPLINEFLAG_WALKMODE);
} }
} }
@ -8082,7 +8082,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced, float ratio)
case MOVE_RUN: case MOVE_RUN:
case MOVE_WALK: case MOVE_WALK:
case MOVE_SWIM: case MOVE_SWIM:
if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet() && hasUnitState(UNIT_STAT_FOLLOW)) if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->IsPet() && hasUnitState(UNIT_STAT_FOLLOW))
{ {
if(Unit* owner = GetOwner()) if(Unit* owner = GetOwner())
{ {
@ -8332,7 +8332,7 @@ void Unit::SetHover(bool on)
RemoveAurasDueToSpell(11010); RemoveAurasDueToSpell(11010);
} }
void Unit::setDeathState(DeathState s) void Unit::SetDeathState(DeathState s)
{ {
if (s != ALIVE && s!= JUST_ALIVED) if (s != ALIVE && s!= JUST_ALIVED)
{ {
@ -8401,15 +8401,15 @@ bool Unit::CanHaveThreatList() const
Creature const* creature = ((Creature const*)this); Creature const* creature = ((Creature const*)this);
// totems can not have threat list // totems can not have threat list
if (creature->isTotem()) if (creature->IsTotem())
return false; return false;
// vehicles can not have threat list // vehicles can not have threat list
if (creature->isVehicle()) if (creature->IsVehicle())
return false; return false;
// pets can not have a threat list, unless they are controlled by a creature // 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() && IS_PLAYER_GUID(((Pet const*)creature)->GetOwnerGUID()))
return false; return false;
// charmed units can not have a threat list if charmed by player // charmed units can not have a threat list if charmed by player
@ -9076,7 +9076,7 @@ void Unit::SetHealth(uint32 val)
if(((Player*)this)->GetGroup()) if(((Player*)this)->GetGroup())
((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_HP); ((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_HP);
} }
else if(((Creature*)this)->isPet()) else if(((Creature*)this)->IsPet())
{ {
Pet *pet = ((Pet*)this); Pet *pet = ((Pet*)this);
if(pet->isControlled()) if(pet->isControlled())
@ -9099,7 +9099,7 @@ void Unit::SetMaxHealth(uint32 val)
if(((Player*)this)->GetGroup()) if(((Player*)this)->GetGroup())
((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_MAX_HP); ((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_MAX_HP);
} }
else if(((Creature*)this)->isPet()) else if(((Creature*)this)->IsPet())
{ {
Pet *pet = ((Pet*)this); Pet *pet = ((Pet*)this);
if(pet->isControlled()) if(pet->isControlled())
@ -9143,7 +9143,7 @@ void Unit::SetPower(Powers power, uint32 val)
if(((Player*)this)->GetGroup()) if(((Player*)this)->GetGroup())
((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_POWER); ((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_POWER);
} }
else if(((Creature*)this)->isPet()) else if(((Creature*)this)->IsPet())
{ {
Pet *pet = ((Pet*)this); Pet *pet = ((Pet*)this);
if(pet->isControlled()) if(pet->isControlled())
@ -9172,7 +9172,7 @@ void Unit::SetMaxPower(Powers power, uint32 val)
if(((Player*)this)->GetGroup()) if(((Player*)this)->GetGroup())
((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_MAX_POWER); ((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_MAX_POWER);
} }
else if(((Creature*)this)->isPet()) else if(((Creature*)this)->IsPet())
{ {
Pet *pet = ((Pet*)this); Pet *pet = ((Pet*)this);
if(pet->isControlled()) if(pet->isControlled())
@ -9197,7 +9197,7 @@ void Unit::ApplyPowerMod(Powers power, uint32 val, bool apply)
if(((Player*)this)->GetGroup()) if(((Player*)this)->GetGroup())
((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_POWER); ((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_POWER);
} }
else if(((Creature*)this)->isPet()) else if(((Creature*)this)->IsPet())
{ {
Pet *pet = ((Pet*)this); Pet *pet = ((Pet*)this);
if(pet->isControlled()) if(pet->isControlled())
@ -9219,7 +9219,7 @@ void Unit::ApplyMaxPowerMod(Powers power, uint32 val, bool apply)
if(((Player*)this)->GetGroup()) if(((Player*)this)->GetGroup())
((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_MAX_POWER); ((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_MAX_POWER);
} }
else if(((Creature*)this)->isPet()) else if(((Creature*)this)->IsPet())
{ {
Pet *pet = ((Pet*)this); Pet *pet = ((Pet*)this);
if(pet->isControlled()) if(pet->isControlled())
@ -9248,9 +9248,9 @@ uint32 Unit::GetCreatePowers( Powers power ) const
case POWER_HEALTH: return 0; case POWER_HEALTH: return 0;
case POWER_MANA: return GetCreateMana(); case POWER_MANA: return GetCreateMana();
case POWER_RAGE: return 1000; 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_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_RUNIC_POWER: return 1000;
case POWER_RUNE: return 0; case POWER_RUNE: return 0;
} }
@ -9744,7 +9744,7 @@ Player* Unit::GetSpellModOwner()
{ {
if(GetTypeId()==TYPEID_PLAYER) if(GetTypeId()==TYPEID_PLAYER)
return (Player*)this; return (Player*)this;
if(((Creature*)this)->isPet() || ((Creature*)this)->isTotem()) if(((Creature*)this)->IsPet() || ((Creature*)this)->IsTotem())
{ {
Unit* owner = GetOwner(); Unit* owner = GetOwner();
if(owner && owner->GetTypeId()==TYPEID_PLAYER) if(owner && owner->GetTypeId()==TYPEID_PLAYER)
@ -10002,7 +10002,7 @@ void Unit::SetDisplayId(uint32 modelId)
UpdateModelData(); UpdateModelData();
if(GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet()) if(GetTypeId() == TYPEID_UNIT && ((Creature*)this)->IsPet())
{ {
Pet *pet = ((Pet*)this); Pet *pet = ((Pet*)this);
if(!pet->isControlled()) if(!pet->isControlled())
@ -10212,7 +10212,7 @@ void Unit::UpdateAuraForGroup(uint8 slot)
player->SetAuraUpdateMask(slot); player->SetAuraUpdateMask(slot);
} }
} }
else if(GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet()) else if(GetTypeId() == TYPEID_UNIT && ((Creature*)this)->IsPet())
{ {
Pet *pet = ((Pet*)this); Pet *pet = ((Pet*)this);
if(pet->isControlled()) if(pet->isControlled())
@ -10537,7 +10537,7 @@ float Unit::GetCombatRatingReduction(CombatRating cr) const
{ {
if (GetTypeId() == TYPEID_PLAYER) if (GetTypeId() == TYPEID_PLAYER)
return ((Player const*)this)->GetRatingBonusValue(cr); return ((Player const*)this)->GetRatingBonusValue(cr);
else if (((Creature const*)this)->isPet()) else if (((Creature const*)this)->IsPet())
{ {
// Player's pet get 100% resilience from owner // Player's pet get 100% resilience from owner
if (Unit* owner = GetOwner()) if (Unit* owner = GetOwner())

View file

@ -1217,7 +1217,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
} }
uint32 getLevel() const { return GetUInt32Value(UNIT_FIELD_LEVEL); } uint32 getLevel() const { return GetUInt32Value(UNIT_FIELD_LEVEL); }
virtual uint32 getLevelForTarget(Unit const* /*target*/) const { return getLevel(); } virtual uint32 GetLevelForTarget(Unit const* /*target*/) const { return getLevel(); }
void SetLevel(uint32 lvl); void SetLevel(uint32 lvl);
uint8 getRace() const { return GetByteValue(UNIT_FIELD_BYTES_0, 0); } uint8 getRace() const { return GetByteValue(UNIT_FIELD_BYTES_0, 0); }
uint32 getRaceMask() const { return 1 << (getRace()-1); } uint32 getRaceMask() const { return 1 << (getRace()-1); }
@ -1298,7 +1298,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
void Mount(uint32 mount, uint32 spellId = 0); void Mount(uint32 mount, uint32 spellId = 0);
void Unmount(); void Unmount();
uint16 GetMaxSkillValueForLevel(Unit const* target = NULL) const { return (target ? getLevelForTarget(target) : getLevel()) * 5; } uint16 GetMaxSkillValueForLevel(Unit const* target = NULL) const { return (target ? GetLevelForTarget(target) : getLevel()) * 5; }
void DealDamageMods(Unit *pVictim, uint32 &damage, uint32* absorb); void DealDamageMods(Unit *pVictim, uint32 &damage, uint32* absorb);
uint32 DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellEntry const *spellProto, bool durabilityLoss); uint32 DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellEntry const *spellProto, bool durabilityLoss);
int32 DealHeal(Unit *pVictim, uint32 addhealth, SpellEntry const *spellProto, bool critical = false, uint32 absorb = 0); int32 DealHeal(Unit *pVictim, uint32 addhealth, SpellEntry const *spellProto, bool critical = false, uint32 absorb = 0);
@ -1345,7 +1345,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
float GetUnitCriticalChance(WeaponAttackType attackType, const Unit *pVictim) const; float GetUnitCriticalChance(WeaponAttackType attackType, const Unit *pVictim) const;
virtual uint32 GetShieldBlockValue() const =0; virtual uint32 GetShieldBlockValue() const =0;
uint32 GetUnitMeleeSkill(Unit const* target = NULL) const { return (target ? getLevelForTarget(target) : getLevel()) * 5; } uint32 GetUnitMeleeSkill(Unit const* target = NULL) const { return (target ? GetLevelForTarget(target) : getLevel()) * 5; }
uint32 GetDefenseSkillValue(Unit const* target = NULL) const; uint32 GetDefenseSkillValue(Unit const* target = NULL) const;
uint32 GetWeaponSkillValue(WeaponAttackType attType, Unit const* target = NULL) const; uint32 GetWeaponSkillValue(WeaponAttackType attType, Unit const* target = NULL) const;
float GetWeaponProcChance() const; float GetWeaponProcChance() const;
@ -1471,7 +1471,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
bool isAlive() const { return (m_deathState == ALIVE); }; bool isAlive() const { return (m_deathState == ALIVE); };
bool isDead() const { return ( m_deathState == DEAD || m_deathState == CORPSE ); }; bool isDead() const { return ( m_deathState == DEAD || m_deathState == CORPSE ); };
DeathState getDeathState() { return m_deathState; }; DeathState getDeathState() { return m_deathState; };
virtual void setDeathState(DeathState s); // overwritten in Creature/Player/Pet virtual void SetDeathState(DeathState s); // overwritten in Creature/Player/Pet
uint64 GetOwnerGUID() const { return GetUInt64Value(UNIT_FIELD_SUMMONEDBY); } uint64 GetOwnerGUID() const { return GetUInt64Value(UNIT_FIELD_SUMMONEDBY); }
void SetOwnerGUID(uint64 owner) { SetUInt64Value(UNIT_FIELD_SUMMONEDBY, owner); } void SetOwnerGUID(uint64 owner) { SetUInt64Value(UNIT_FIELD_SUMMONEDBY, owner); }
@ -1843,10 +1843,10 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply); void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply);
void ApplySpellDispelImmunity(const SpellEntry * spellProto, DispelType type, bool apply); void ApplySpellDispelImmunity(const SpellEntry * spellProto, DispelType type, bool apply);
virtual bool IsImmunedToSpell(SpellEntry const* spellInfo); virtual bool IsImmuneToSpell(SpellEntry const* spellInfo);
// redefined in Creature // redefined in Creature
bool IsImmunedToDamage(SpellSchoolMask meleeSchoolMask); bool IsImmunedToDamage(SpellSchoolMask meleeSchoolMask);
virtual bool IsImmunedToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex index) const; virtual bool IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex index) const;
// redefined in Creature // redefined in Creature
uint32 CalcArmorReducedDamage(Unit* pVictim, const uint32 damage); uint32 CalcArmorReducedDamage(Unit* pVictim, const uint32 damage);

View file

@ -51,9 +51,9 @@ void Vehicle::RemoveFromWorld()
Unit::RemoveFromWorld(); Unit::RemoveFromWorld();
} }
void Vehicle::setDeathState(DeathState s) // overwrite virtual Creature::setDeathState and Unit::setDeathState void Vehicle::SetDeathState(DeathState s) // overwrite virtual Creature::SetDeathState and Unit::SetDeathState
{ {
Creature::setDeathState(s); Creature::SetDeathState(s);
} }
void Vehicle::Update(uint32 diff) void Vehicle::Update(uint32 diff)

View file

@ -35,7 +35,7 @@ class Vehicle : public Creature
bool Create (uint32 guidlow, Map *map, uint32 Entry, uint32 vehicleId, uint32 team); bool Create (uint32 guidlow, Map *map, uint32 Entry, uint32 vehicleId, uint32 team);
void setDeathState(DeathState s); // overwrite virtual Creature::setDeathState and Unit::setDeathState void SetDeathState(DeathState s); // overwrite virtual Creature::SetDeathState and Unit::SetDeathState
void Update(uint32 diff); // overwrite virtual Creature::Update and Unit::Update void Update(uint32 diff); // overwrite virtual Creature::Update and Unit::Update
uint32 GetVehicleId() { return m_vehicleId; } uint32 GetVehicleId() { return m_vehicleId; }

View file

@ -78,7 +78,7 @@ void WaypointMovementGenerator<Creature>::LoadPath(Creature &creature)
// We have to set the destination here (for the first point), right after Initialize. Without, we may not have valid xyz for GetResetPosition // We have to set the destination here (for the first point), right after Initialize. Without, we may not have valid xyz for GetResetPosition
CreatureTraveller traveller(creature); CreatureTraveller traveller(creature);
if (creature.canFly()) if (creature.CanFly())
creature.AddSplineFlag(SPLINEFLAG_UNKNOWN7); creature.AddSplineFlag(SPLINEFLAG_UNKNOWN7);
const WaypointNode &node = i_path->at(i_currentNode); const WaypointNode &node = i_path->at(i_currentNode);
@ -155,7 +155,7 @@ bool WaypointMovementGenerator<Creature>::Update(Creature &creature, const uint3
creature.addUnitState(UNIT_STAT_ROAMING_MOVE); creature.addUnitState(UNIT_STAT_ROAMING_MOVE);
if (creature.canFly()) if (creature.CanFly())
creature.AddSplineFlag(SPLINEFLAG_UNKNOWN7); creature.AddSplineFlag(SPLINEFLAG_UNKNOWN7);
// Now we re-set destination to same node and start travel // Now we re-set destination to same node and start travel
@ -253,7 +253,7 @@ bool WaypointMovementGenerator<Creature>::Update(Creature &creature, const uint3
{ {
creature.addUnitState(UNIT_STAT_ROAMING_MOVE); creature.addUnitState(UNIT_STAT_ROAMING_MOVE);
if (creature.canFly()) if (creature.CanFly())
creature.AddSplineFlag(SPLINEFLAG_UNKNOWN7); creature.AddSplineFlag(SPLINEFLAG_UNKNOWN7);
if (WaypointBehavior *behavior = i_path->at(i_currentNode).behavior) if (WaypointBehavior *behavior = i_path->at(i_currentNode).behavior)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "10609" #define REVISION_NR "10610"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__