--HG--
branch : trunk
This commit is contained in:
maximius
2009-10-18 18:38:46 -07:00
parent 864b3f31e9
commit d22768a6b5
25 changed files with 543 additions and 541 deletions
+3 -3
View File
@@ -255,7 +255,7 @@ bool AchievementCriteriaData::Meets(Player const* source, Unit const* target, ui
return false;
return target->GetEntry() == creature.id;
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE:
if (!target || target->GetTypeId()!=TYPEID_PLAYER)
if (!target || target->GetTypeId() != TYPEID_PLAYER)
return false;
if(classRace.class_id && classRace.class_id != ((Player*)target)->getClass())
return false;
@@ -263,7 +263,7 @@ bool AchievementCriteriaData::Meets(Player const* source, Unit const* target, ui
return false;
return true;
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_LESS_HEALTH:
if (!target || target->GetTypeId()!=TYPEID_PLAYER)
if (!target || target->GetTypeId() != TYPEID_PLAYER)
return false;
return target->GetHealth()*100 <= health.percent*target->GetMaxHealth();
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD:
@@ -1210,7 +1210,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
continue;
// map specific case (BG in fact) expected player targeted damage/heal
if(!unit || unit->GetTypeId()!=TYPEID_PLAYER)
if(!unit || unit->GetTypeId() != TYPEID_PLAYER)
continue;
}
+16 -16
View File
@@ -229,7 +229,7 @@ void GameObject::Update(uint32 /*p_time*/)
{
// splash bobber (bobber ready now)
Unit* caster = GetOwner();
if(caster && caster->GetTypeId()==TYPEID_PLAYER)
if(caster && caster->GetTypeId() == TYPEID_PLAYER)
{
SetGoState(GO_STATE_ACTIVE);
SetUInt32Value(GAMEOBJECT_FLAGS, GO_FLAG_NODESPAWN);
@@ -268,7 +268,7 @@ void GameObject::Update(uint32 /*p_time*/)
case GAMEOBJECT_TYPE_FISHINGNODE: // can't fish now
{
Unit* caster = GetOwner();
if(caster && caster->GetTypeId()==TYPEID_PLAYER)
if(caster && caster->GetTypeId() == TYPEID_PLAYER)
{
caster->FinishSpell(CURRENT_CHANNELED_SPELL);
@@ -965,7 +965,7 @@ void GameObject::Use(Unit* user)
case GAMEOBJECT_TYPE_QUESTGIVER: //2
{
if(user->GetTypeId()!=TYPEID_PLAYER)
if(user->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)user;
@@ -981,7 +981,7 @@ void GameObject::Use(Unit* user)
if(!info)
return;
if(user->GetTypeId()!=TYPEID_PLAYER)
if(user->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)user;
@@ -1040,7 +1040,7 @@ void GameObject::Use(Unit* user)
{
GameObjectInfo const* info = GetGOInfo();
if(user->GetTypeId()==TYPEID_PLAYER)
if(user->GetTypeId() == TYPEID_PLAYER)
{
Player* player = (Player*)user;
@@ -1070,7 +1070,7 @@ void GameObject::Use(Unit* user)
if(!info)
return;
if(user->GetTypeId()!=TYPEID_PLAYER)
if(user->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)user;
@@ -1086,7 +1086,7 @@ void GameObject::Use(Unit* user)
//fishing bobber
case GAMEOBJECT_TYPE_FISHINGNODE: //17
{
if(user->GetTypeId()!=TYPEID_PLAYER)
if(user->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)user;
@@ -1162,7 +1162,7 @@ void GameObject::Use(Unit* user)
case GAMEOBJECT_TYPE_SUMMONING_RITUAL: //18
{
if(user->GetTypeId()!=TYPEID_PLAYER)
if(user->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)user;
@@ -1171,7 +1171,7 @@ void GameObject::Use(Unit* user)
GameObjectInfo const* info = GetGOInfo();
if( !caster || caster->GetTypeId()!=TYPEID_PLAYER )
if( !caster || caster->GetTypeId() != TYPEID_PLAYER )
return;
// accept only use by player from same group for caster except caster itself
@@ -1219,10 +1219,10 @@ void GameObject::Use(Unit* user)
if(info->spellcaster.partyOnly)
{
Unit* caster = GetOwner();
if( !caster || caster->GetTypeId()!=TYPEID_PLAYER )
if( !caster || caster->GetTypeId() != TYPEID_PLAYER )
return;
if(user->GetTypeId()!=TYPEID_PLAYER || !((Player*)user)->IsInSameRaidWith((Player*)caster))
if(user->GetTypeId() != TYPEID_PLAYER || !((Player*)user)->IsInSameRaidWith((Player*)caster))
return;
}
@@ -1235,7 +1235,7 @@ void GameObject::Use(Unit* user)
{
GameObjectInfo const* info = GetGOInfo();
if(user->GetTypeId()!=TYPEID_PLAYER)
if(user->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)user;
@@ -1264,7 +1264,7 @@ void GameObject::Use(Unit* user)
case GAMEOBJECT_TYPE_FLAGSTAND: // 24
{
if(user->GetTypeId()!=TYPEID_PLAYER)
if(user->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)user;
@@ -1289,7 +1289,7 @@ void GameObject::Use(Unit* user)
}
case GAMEOBJECT_TYPE_FLAGDROP: // 26
{
if(user->GetTypeId()!=TYPEID_PLAYER)
if(user->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)user;
@@ -1338,7 +1338,7 @@ void GameObject::Use(Unit* user)
if(!info)
return;
if(user->GetTypeId()!=TYPEID_PLAYER)
if(user->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)user;
@@ -1363,7 +1363,7 @@ void GameObject::Use(Unit* user)
SpellEntry const *spellInfo = sSpellStore.LookupEntry( spellId );
if(!spellInfo)
{
if(user->GetTypeId()!=TYPEID_PLAYER || !sOutdoorPvPMgr.HandleCustomSpell((Player*)user,spellId,this))
if(user->GetTypeId() != TYPEID_PLAYER || !sOutdoorPvPMgr.HandleCustomSpell((Player*)user,spellId,this))
sLog.outError("WORLD: unknown spell id %u at use action for gameobject (Entry: %u GoType: %u )", spellId,GetEntry(),GetGoType());
else
sLog.outDebug("WORLD: %u non-dbc spell was handled by OutdoorPvP", spellId);
+2 -2
View File
@@ -524,7 +524,7 @@ namespace Trinity
RaiseDeadObjectCheck(Unit* funit, float range) : i_funit(funit), i_range(range) {}
bool operator()(Creature* u)
{
if (i_funit->GetTypeId()!=TYPEID_PLAYER || !((Player*)i_funit)->isHonorOrXPTarget(u) ||
if (i_funit->GetTypeId() != TYPEID_PLAYER || !((Player*)i_funit)->isHonorOrXPTarget(u) ||
u->getDeathState() != CORPSE || u->isDeadByDefault() || u->isInFlight() ||
( u->GetCreatureTypeMask() & (1 << (CREATURE_TYPE_HUMANOID-1)) )==0 ||
(u->GetDisplayId() != u->GetNativeDisplayId()))
@@ -903,7 +903,7 @@ namespace Trinity
Unit const* owner = i_funit->GetOwner();
if(owner)
check = owner;
i_targetForPlayer = ( check->GetTypeId()==TYPEID_PLAYER );
i_targetForPlayer = ( check->GetTypeId() == TYPEID_PLAYER );
}
bool operator()(Unit* u)
{
+2 -2
View File
@@ -166,7 +166,7 @@ inline void Trinity::DynamicObjectUpdater::VisitHelper(Unit* target)
return;
//Check player targets and remove if in GM mode or GM invisibility (for not self casting case)
if( target->GetTypeId()==TYPEID_PLAYER && target != i_check && (((Player*)target)->isGameMaster() || ((Player*)target)->GetVisibility()==VISIBILITY_OFF) )
if( target->GetTypeId() == TYPEID_PLAYER && target != i_check && (((Player*)target)->isGameMaster() || ((Player*)target)->GetVisibility()==VISIBILITY_OFF) )
return;
if (i_dynobject.IsAffecting(target))
@@ -190,7 +190,7 @@ inline void Trinity::DynamicObjectUpdater::VisitHelper(Unit* target)
if(!i_check->IsFriendlyTo(target))
return;
}
else if( i_check->GetTypeId()==TYPEID_PLAYER )
else if( i_check->GetTypeId() == TYPEID_PLAYER )
{
if (i_check->IsFriendlyTo( target ))
return;
+12 -12
View File
@@ -34,33 +34,33 @@ HostilRefManager::~HostilRefManager()
// The pVictim is hated than by them as well
// use for buffs and healing threat functionality
void HostilRefManager::threatAssist(Unit *pVictim, float pThreat, SpellEntry const *pThreatSpell, bool pSingleTarget)
void HostilRefManager::threatAssist(Unit *pVictim, float fThreat, SpellEntry const *pThreatSpell, bool pSingleTarget)
{
HostilReference* ref;
uint32 size = pSingleTarget ? 1 : getSize(); // if pSingleTarget do not devide threat
float size = pSingleTarget ? 1.0f : getSize(); // if pSingleTarget do not divide threat
ref = getFirst();
while(ref != NULL)
{
float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, pThreat, (pThreatSpell ? GetSpellSchoolMask(pThreatSpell) : SPELL_SCHOOL_MASK_NORMAL), pThreatSpell);
float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, fThreat, (pThreatSpell ? GetSpellSchoolMask(pThreatSpell) : SPELL_SCHOOL_MASK_NORMAL), pThreatSpell);
if(pVictim == getOwner())
ref->addThreat(float (threat) / size); // It is faster to modify the threat durectly if possible
ref->addThreat(threat / size); // It is faster to modify the threat durectly if possible
else
ref->getSource()->addThreat(pVictim, float (threat) / size);
ref->getSource()->addThreat(pVictim, threat / size);
ref = ref->next();
}
}
//=================================================
void HostilRefManager::addThreatPercent(int32 pValue)
void HostilRefManager::addThreatPercent(int32 iPercent)
{
HostilReference* ref;
ref = getFirst();
while(ref != NULL)
while (ref != NULL)
{
ref->addThreatPercent(pValue);
ref->addThreatPercent(iPercent);
ref = ref->next();
}
}
@@ -68,14 +68,14 @@ void HostilRefManager::addThreatPercent(int32 pValue)
//=================================================
// The online / offline status is given to the method. The calculation has to be done before
void HostilRefManager::setOnlineOfflineState(bool pIsOnline)
void HostilRefManager::setOnlineOfflineState(bool bIsOnline)
{
HostilReference* ref;
ref = getFirst();
while(ref != NULL)
{
ref->setOnlineOfflineState(pIsOnline);
ref->setOnlineOfflineState(bIsOnline);
ref = ref->next();
}
}
@@ -131,7 +131,7 @@ void HostilRefManager::deleteReference(Unit *pCreature)
//=================================================
// set state for one reference, defined by Unit
void HostilRefManager::setOnlineOfflineState(Unit *pCreature,bool pIsOnline)
void HostilRefManager::setOnlineOfflineState(Unit *pCreature, bool bIsOnline)
{
HostilReference* ref = getFirst();
while(ref)
@@ -139,7 +139,7 @@ void HostilRefManager::setOnlineOfflineState(Unit *pCreature,bool pIsOnline)
HostilReference* nextRef = ref->next();
if(ref->getSource()->getOwner() == pCreature)
{
ref->setOnlineOfflineState(pIsOnline);
ref->setOnlineOfflineState(bIsOnline);
break;
}
ref = nextRef;
+4 -4
View File
@@ -44,9 +44,9 @@ class HostilRefManager : public RefManager<Unit, ThreatManager>
// send threat to all my hateres for the pVictim
// The pVictim is hated than by them as well
// use for buffs and healing threat functionality
void threatAssist(Unit *pVictim, float threat, SpellEntry const *threatSpell = 0, bool pSingleTarget=false);
void threatAssist(Unit *pVictim, float fThreat, SpellEntry const *threatSpell = 0, bool pSingleTarget = false);
void addThreatPercent(int32 pValue);
void addThreatPercent(int32 iPercent);
// The references are not needed anymore
// tell the source to remove them from the list and free the mem
@@ -56,10 +56,10 @@ class HostilRefManager : public RefManager<Unit, ThreatManager>
void updateThreatTables();
void setOnlineOfflineState(bool pIsOnline);
void setOnlineOfflineState(bool bIsOnline);
// set state for one reference, defined by Unit
void setOnlineOfflineState(Unit *pCreature,bool pIsOnline);
void setOnlineOfflineState(Unit *pCreature, bool bIsOnline);
// delete one reference, defined by Unit
void deleteReference(Unit *pCreature);
+1 -1
View File
@@ -1483,7 +1483,7 @@ bool ChatHandler::HandleModifyTalentCommand (const char* args)
return false;
}
if(target->GetTypeId()==TYPEID_PLAYER)
if(target->GetTypeId() == TYPEID_PLAYER)
{
// check online security
if (HasLowerSecurity((Player*)target, 0))
+3 -3
View File
@@ -4215,7 +4215,7 @@ bool ChatHandler::HandleDieCommand(const char* /*args*/)
return false;
}
if(target->GetTypeId()==TYPEID_PLAYER)
if(target->GetTypeId() == TYPEID_PLAYER)
{
if(HasLowerSecurity((Player*)target,0,false))
return false;
@@ -6416,7 +6416,7 @@ bool ChatHandler::HandleMovegensCommand(const char* /*args*/)
return false;
}
PSendSysMessage(LANG_MOVEGENS_LIST,(unit->GetTypeId()==TYPEID_PLAYER ? "Player" : "Creature" ),unit->GetGUIDLow());
PSendSysMessage(LANG_MOVEGENS_LIST,(unit->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature" ),unit->GetGUIDLow());
MotionMaster* mm = unit->GetMotionMaster();
for (uint8 i = 0; i < MAX_MOTION_SLOT; ++i)
@@ -6436,7 +6436,7 @@ bool ChatHandler::HandleMovegensCommand(const char* /*args*/)
case CONFUSED_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_CONFUSED); break;
case TARGETED_MOTION_TYPE:
{
if(unit->GetTypeId()==TYPEID_PLAYER)
if(unit->GetTypeId() == TYPEID_PLAYER)
{
TargetedMovementGenerator<Player> const* mgen = static_cast<TargetedMovementGenerator<Player> const*>(mg);
Unit* target = mgen->GetTarget();
+3 -3
View File
@@ -3419,7 +3419,7 @@ void Map::ScriptsProcess()
WorldObject* worldObject;
Player* player;
if(target->GetTypeId()==TYPEID_PLAYER)
if(target->GetTypeId() == TYPEID_PLAYER)
{
if(source->GetTypeId()!=TYPEID_UNIT && source->GetTypeId()!=TYPEID_GAMEOBJECT)
{
@@ -3438,7 +3438,7 @@ void Map::ScriptsProcess()
break;
}
if(source->GetTypeId()!=TYPEID_PLAYER)
if(source->GetTypeId() != TYPEID_PLAYER)
{
sLog.outError("SCRIPT_COMMAND_QUEST_EXPLORED call for non-player(TypeId: %u, Entry: %u, GUID: %u), skipping.",source->GetTypeId(),source->GetEntry(),source->GetGUIDLow());
break;
@@ -3685,7 +3685,7 @@ void Map::ScriptsProcess()
break;
}
if(target->GetTypeId()!=TYPEID_PLAYER)
if(target->GetTypeId() != TYPEID_PLAYER)
{
sLog.outError("SCRIPT_COMMAND_PLAY_SOUND in targeted mode call for non-player (TypeId: %u, Entry: %u, GUID: %u), skipping.",target->GetTypeId(),target->GetEntry(),target->GetGUIDLow());
break;
+27 -27
View File
@@ -217,7 +217,7 @@ MotionMaster::MoveTargetedHome()
void
MotionMaster::MoveConfused()
{
if(i_owner->GetTypeId()==TYPEID_PLAYER)
if(i_owner->GetTypeId() == TYPEID_PLAYER)
{
DEBUG_LOG("Player (GUID: %u) move confused", i_owner->GetGUIDLow() );
Mutate(new ConfusedMovementGenerator<Player>(), MOTION_SLOT_CONTROLLED);
@@ -238,20 +238,20 @@ MotionMaster::MoveChase(Unit* target, float dist, float angle)
return;
i_owner->clearUnitState(UNIT_STAT_FOLLOW);
if(i_owner->GetTypeId()==TYPEID_PLAYER)
if(i_owner->GetTypeId() == TYPEID_PLAYER)
{
DEBUG_LOG("Player (GUID: %u) chase to %s (GUID: %u)",
i_owner->GetGUIDLow(),
target->GetTypeId()==TYPEID_PLAYER ? "player" : "creature",
target->GetTypeId()==TYPEID_PLAYER ? i_owner->GetGUIDLow() : ((Creature*)i_owner)->GetDBTableGUIDLow() );
target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
target->GetTypeId() == TYPEID_PLAYER ? i_owner->GetGUIDLow() : ((Creature*)i_owner)->GetDBTableGUIDLow() );
Mutate(new TargetedMovementGenerator<Player>(*target,dist,angle), MOTION_SLOT_ACTIVE);
}
else
{
DEBUG_LOG("Creature (Entry: %u GUID: %u) chase to %s (GUID: %u)",
i_owner->GetEntry(), i_owner->GetGUIDLow(),
target->GetTypeId()==TYPEID_PLAYER ? "player" : "creature",
target->GetTypeId()==TYPEID_PLAYER ? target->GetGUIDLow() : ((Creature*)target)->GetDBTableGUIDLow() );
target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : ((Creature*)target)->GetDBTableGUIDLow() );
Mutate(new TargetedMovementGenerator<Creature>(*target,dist,angle), MOTION_SLOT_ACTIVE);
}
}
@@ -264,19 +264,19 @@ MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlot slo
return;
i_owner->addUnitState(UNIT_STAT_FOLLOW);
if(i_owner->GetTypeId()==TYPEID_PLAYER)
if(i_owner->GetTypeId() == TYPEID_PLAYER)
{
DEBUG_LOG("Player (GUID: %u) follow to %s (GUID: %u)", i_owner->GetGUIDLow(),
target->GetTypeId()==TYPEID_PLAYER ? "player" : "creature",
target->GetTypeId()==TYPEID_PLAYER ? i_owner->GetGUIDLow() : ((Creature*)i_owner)->GetDBTableGUIDLow() );
target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
target->GetTypeId() == TYPEID_PLAYER ? i_owner->GetGUIDLow() : ((Creature*)i_owner)->GetDBTableGUIDLow() );
Mutate(new TargetedMovementGenerator<Player>(*target,dist,angle), slot);
}
else
{
DEBUG_LOG("Creature (Entry: %u GUID: %u) follow to %s (GUID: %u)",
i_owner->GetEntry(), i_owner->GetGUIDLow(),
target->GetTypeId()==TYPEID_PLAYER ? "player" : "creature",
target->GetTypeId()==TYPEID_PLAYER ? target->GetGUIDLow() : ((Creature*)target)->GetDBTableGUIDLow() );
target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : ((Creature*)target)->GetDBTableGUIDLow() );
Mutate(new TargetedMovementGenerator<Creature>(*target,dist,angle), slot);
}
}
@@ -284,7 +284,7 @@ MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlot slo
void
MotionMaster::MovePoint(uint32 id, float x, float y, float z)
{
if(i_owner->GetTypeId()==TYPEID_PLAYER)
if(i_owner->GetTypeId() == TYPEID_PLAYER)
{
DEBUG_LOG("Player (GUID: %u) targeted point (Id: %u X: %f Y: %f Z: %f)", i_owner->GetGUIDLow(), id, x, y, z );
Mutate(new PointMovementGenerator<Player>(id,x,y,z), MOTION_SLOT_ACTIVE);
@@ -300,7 +300,7 @@ MotionMaster::MovePoint(uint32 id, float x, float y, float z)
void MotionMaster::MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ)
{
//this function may make players fall below map
if(i_owner->GetTypeId()==TYPEID_PLAYER)
if(i_owner->GetTypeId() == TYPEID_PLAYER)
return;
float x, y, z;
@@ -312,7 +312,7 @@ void MotionMaster::MoveKnockbackFrom(float srcX, float srcY, float speedXY, floa
void MotionMaster::MoveJumpTo(float angle, float speedXY, float speedZ)
{
//this function may make players fall below map
if(i_owner->GetTypeId()==TYPEID_PLAYER)
if(i_owner->GetTypeId() == TYPEID_PLAYER)
return;
float x, y, z;
@@ -328,7 +328,7 @@ void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float spee
i_owner->addUnitState(UNIT_STAT_CHARGING | UNIT_STAT_JUMPING);
i_owner->m_TempSpeed = speedXY;
if(i_owner->GetTypeId()==TYPEID_PLAYER)
if(i_owner->GetTypeId() == TYPEID_PLAYER)
{
DEBUG_LOG("Player (GUID: %u) jump to point (X: %f Y: %f Z: %f)", i_owner->GetGUIDLow(), x, y, z );
Mutate(new PointMovementGenerator<Player>(0,x,y,z), MOTION_SLOT_CONTROLLED);
@@ -351,7 +351,7 @@ MotionMaster::MoveCharge(float x, float y, float z, float speed, uint32 id)
i_owner->addUnitState(UNIT_STAT_CHARGING);
i_owner->m_TempSpeed = speed;
if(i_owner->GetTypeId()==TYPEID_PLAYER)
if(i_owner->GetTypeId() == TYPEID_PLAYER)
{
DEBUG_LOG("Player (GUID: %u) charge point (X: %f Y: %f Z: %f)", i_owner->GetGUIDLow(), x, y, z );
Mutate(new PointMovementGenerator<Player>(id,x,y,z), MOTION_SLOT_CONTROLLED);
@@ -375,7 +375,7 @@ void MotionMaster::MoveFall(float z, uint32 id)
void
MotionMaster::MoveSeekAssistance(float x, float y, float z)
{
if(i_owner->GetTypeId()==TYPEID_PLAYER)
if(i_owner->GetTypeId() == TYPEID_PLAYER)
{
sLog.outError("Player (GUID: %u) attempt to seek assistance",i_owner->GetGUIDLow());
}
@@ -392,7 +392,7 @@ MotionMaster::MoveSeekAssistance(float x, float y, float z)
void
MotionMaster::MoveSeekAssistanceDistract(uint32 time)
{
if(i_owner->GetTypeId()==TYPEID_PLAYER)
if(i_owner->GetTypeId() == TYPEID_PLAYER)
{
sLog.outError("Player (GUID: %u) attempt to call distract after assistance",i_owner->GetGUIDLow());
}
@@ -413,19 +413,19 @@ MotionMaster::MoveFleeing(Unit* enemy, uint32 time)
if(i_owner->HasAuraType(SPELL_AURA_PREVENTS_FLEEING))
return;
if(i_owner->GetTypeId()==TYPEID_PLAYER)
if(i_owner->GetTypeId() == TYPEID_PLAYER)
{
DEBUG_LOG("Player (GUID: %u) flee from %s (GUID: %u)", i_owner->GetGUIDLow(),
enemy->GetTypeId()==TYPEID_PLAYER ? "player" : "creature",
enemy->GetTypeId()==TYPEID_PLAYER ? enemy->GetGUIDLow() : ((Creature*)enemy)->GetDBTableGUIDLow() );
enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
enemy->GetTypeId() == TYPEID_PLAYER ? enemy->GetGUIDLow() : ((Creature*)enemy)->GetDBTableGUIDLow() );
Mutate(new FleeingMovementGenerator<Player>(enemy->GetGUID()), MOTION_SLOT_CONTROLLED);
}
else
{
DEBUG_LOG("Creature (Entry: %u GUID: %u) flee from %s (GUID: %u)%s",
i_owner->GetEntry(), i_owner->GetGUIDLow(),
enemy->GetTypeId()==TYPEID_PLAYER ? "player" : "creature",
enemy->GetTypeId()==TYPEID_PLAYER ? enemy->GetGUIDLow() : ((Creature*)enemy)->GetDBTableGUIDLow(),
enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
enemy->GetTypeId() == TYPEID_PLAYER ? enemy->GetGUIDLow() : ((Creature*)enemy)->GetDBTableGUIDLow(),
time ? " for a limited time" : "");
if (time)
Mutate(new TimedFleeingMovementGenerator(enemy->GetGUID(), time), MOTION_SLOT_CONTROLLED);
@@ -437,7 +437,7 @@ MotionMaster::MoveFleeing(Unit* enemy, uint32 time)
void
MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode)
{
if(i_owner->GetTypeId()==TYPEID_PLAYER)
if(i_owner->GetTypeId() == TYPEID_PLAYER)
{
DEBUG_LOG("Player (GUID: %u) taxi to (Path %u node %u)", i_owner->GetGUIDLow(), path, pathnode);
FlightPathMovementGenerator* mgen = new FlightPathMovementGenerator(path,pathnode);
@@ -456,7 +456,7 @@ MotionMaster::MoveDistract(uint32 timer)
if(Impl[MOTION_SLOT_CONTROLLED])
return;
if(i_owner->GetTypeId()==TYPEID_PLAYER)
if(i_owner->GetTypeId() == TYPEID_PLAYER)
{
DEBUG_LOG("Player (GUID: %u) distracted (timer: %u)", i_owner->GetGUIDLow(), timer);
}
@@ -510,12 +510,12 @@ void MotionMaster::MovePath(uint32 path_id, bool repeatable)
delete curr;
}*/
//i_owner->GetTypeId()==TYPEID_PLAYER ?
//i_owner->GetTypeId() == TYPEID_PLAYER ?
//Mutate(new WaypointMovementGenerator<Player>(path_id, repeatable)):
Mutate(new WaypointMovementGenerator<Creature>(path_id, repeatable), MOTION_SLOT_IDLE);
DEBUG_LOG("%s (GUID: %u) start moving over path(Id:%u, repeatable: %s)",
i_owner->GetTypeId()==TYPEID_PLAYER ? "Player" : "Creature",
i_owner->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature",
i_owner->GetGUIDLow(), path_id, repeatable ? "YES" : "NO" );
}
+1 -1
View File
@@ -229,7 +229,7 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
//sLog.outDebug("WORLD: Recvd %s (%u, 0x%X) opcode", LookupOpcodeName(opcode), opcode, opcode);
Unit *mover = _player->m_mover;
Player *plMover = mover->GetTypeId()==TYPEID_PLAYER ? (Player*)mover : NULL;
Player *plMover = mover->GetTypeId() == TYPEID_PLAYER ? (Player*)mover : NULL;
// ignore, waiting processing in WorldSession::HandleMoveWorldportAckOpcode and WorldSession::HandleMoveTeleportAck
if(plMover && plMover->IsBeingTeleported())
+2 -2
View File
@@ -1903,7 +1903,7 @@ GameObject* WorldObject::SummonGameObject(uint32 entry, float x, float y, float
return NULL;
}
go->SetRespawnTime(respawnTime);
if(GetTypeId()==TYPEID_PLAYER || GetTypeId()==TYPEID_UNIT) //not sure how to handle this
if(GetTypeId() == TYPEID_PLAYER || GetTypeId()==TYPEID_UNIT) //not sure how to handle this
((Unit*)this)->AddGameObject(go);
else
go->SetSpawnedByDefault(false);
@@ -1920,7 +1920,7 @@ Creature* WorldObject::SummonTrigger(float x, float y, float z, float ang, uint3
return NULL;
//summon->SetName(GetName());
if(GetTypeId()==TYPEID_PLAYER || GetTypeId()==TYPEID_UNIT)
if(GetTypeId() == TYPEID_PLAYER || GetTypeId()==TYPEID_UNIT)
{
summon->setFaction(((Unit*)this)->getFaction());
summon->SetLevel(((Unit*)this)->getLevel());
+2 -2
View File
@@ -1520,7 +1520,7 @@ void Pet::InitPetCreateSpells()
bool Pet::resetTalents(bool no_cost)
{
Unit *owner = GetOwner();
if (!owner || owner->GetTypeId()!=TYPEID_PLAYER)
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
return false;
// not need after this call
@@ -1862,7 +1862,7 @@ void Pet::LearnPetPassives()
void Pet::CastPetAuras(bool current)
{
Unit* owner = GetOwner();
if(!owner || owner->GetTypeId()!=TYPEID_PLAYER)
if(!owner || owner->GetTypeId() != TYPEID_PLAYER)
return;
if(!IsPermanentPetFor((Player*)owner))
+4 -4
View File
@@ -13130,7 +13130,7 @@ void Player::AddQuest( Quest const *pQuest, Object *questGiver )
uint32 limittime = pQuest->GetLimitTime();
// shared timed quest
if(questGiver && questGiver->GetTypeId()==TYPEID_PLAYER)
if(questGiver && questGiver->GetTypeId() == TYPEID_PLAYER)
limittime = ((Player*)questGiver)->getQuestStatusMap()[quest_id].m_timer / IN_MILISECONDS;
AddTimedQuest( quest_id );
@@ -19004,7 +19004,7 @@ bool Player::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool
if (!m_seer->IsWithinDistInMap(u, _map.GetVisibilityDistance() + (inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), is3dDistance))
return false;
}
else if(u->GetTypeId()==TYPEID_PLAYER) // distance for show player
else if(u->GetTypeId() == TYPEID_PLAYER) // distance for show player
{
// Players far than max visible distance for player or not in our map are not visible too
if (!at_same_transport && !m_seer->IsWithinDistInMap(u, _map.GetVisibilityDistance() + (inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f), is3dDistance))
@@ -19052,7 +19052,7 @@ bool Player::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool
// player see other player with stealth/invisibility only if he in same group or raid or same team (raid/team case dependent from conf setting)
if(!m_mover->canDetectInvisibilityOf(u))
if(!(u->GetTypeId()==TYPEID_PLAYER && !IsHostileTo(u) && IsGroupVisibleFor(((Player*)u))))
if(!(u->GetTypeId() == TYPEID_PLAYER && !IsHostileTo(u) && IsGroupVisibleFor(((Player*)u))))
return false;
}
@@ -19065,7 +19065,7 @@ bool Player::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool
if(!isAlive())
detect = false;
if(m_DetectInvTimer < 300 || !HaveAtClient(u))
if(!(u->GetTypeId()==TYPEID_PLAYER && !IsHostileTo(u) && IsGroupVisibleFor(((Player*)u))))
if(!(u->GetTypeId() == TYPEID_PLAYER && !IsHostileTo(u) && IsGroupVisibleFor(((Player*)u))))
if(!detect || !m_mover->canDetectStealthOf(u, GetDistance(u)))
return false;
}
+2 -2
View File
@@ -124,8 +124,8 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode( WorldPacket & recv_data )
// no or incorrect quest giver
if(!pObject
|| (pObject->GetTypeId()!=TYPEID_PLAYER && !pObject->hasQuest(quest))
|| (pObject->GetTypeId()==TYPEID_PLAYER && !((Player*)pObject)->CanShareQuest(quest))
|| (pObject->GetTypeId() != TYPEID_PLAYER && !pObject->hasQuest(quest))
|| (pObject->GetTypeId() == TYPEID_PLAYER && !((Player*)pObject)->CanShareQuest(quest))
)
{
_player->PlayerTalkClass->CloseGossip();
+16 -16
View File
@@ -630,7 +630,7 @@ void Spell::SelectSpellTargets()
AddUnitTarget(m_caster, i);
break;
case SPELL_EFFECT_SUMMON_PLAYER:
if(m_caster->GetTypeId()==TYPEID_PLAYER && ((Player*)m_caster)->GetSelection())
if(m_caster->GetTypeId() == TYPEID_PLAYER && ((Player*)m_caster)->GetSelection())
{
Player* target = objmgr.GetPlayer(((Player*)m_caster)->GetSelection());
if(target)
@@ -2321,7 +2321,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
}
else
{
if (m_caster->GetTypeId()==TYPEID_PLAYER)
if (m_caster->GetTypeId() == TYPEID_PLAYER)
((Player*)m_caster)->RemoveSpellCooldown(m_spellInfo->Id,true);
SendCastResult(SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW);
finish(false);
@@ -2543,7 +2543,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
// Pet not found - remove cooldown
else
{
if (modOwner->GetTypeId()==TYPEID_PLAYER)
if (modOwner->GetTypeId() == TYPEID_PLAYER)
modOwner->RemoveSpellCooldown(m_spellInfo->Id,true);
SendCastResult(SPELL_FAILED_NO_PET);
finish(false);
@@ -2648,11 +2648,11 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect* triggeredByAura
}
}
if (m_caster->GetTypeId()==TYPEID_PLAYER)
if (m_caster->GetTypeId() == TYPEID_PLAYER)
((Player*)m_caster)->SetSpellModTakingSpell(this, true);
// Fill cost data (not use power for item casts
m_powerCost = m_CastItem ? 0 : CalculatePowerCost(m_spellInfo, m_caster, m_spellSchoolMask);
if (m_caster->GetTypeId()==TYPEID_PLAYER)
if (m_caster->GetTypeId() == TYPEID_PLAYER)
((Player*)m_caster)->SetSpellModTakingSpell(this, false);
SpellCastResult result = CheckCast(true);
@@ -2811,7 +2811,7 @@ void Spell::cast(bool skipCheck)
m_caster->SetInFront(m_targets.getUnitTarget());
// Should this be done for original caster?
if (m_caster->GetTypeId()==TYPEID_PLAYER)
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
// Set spell which will drop charges for triggered cast spells
// if not successfully casted, will be remove in finish(false)
@@ -2967,7 +2967,7 @@ void Spell::cast(bool skipCheck)
m_caster->CastSpell(m_targets.getUnitTarget() ? m_targets.getUnitTarget() : m_caster, *i, true);
}
if (m_caster->GetTypeId()==TYPEID_PLAYER)
if (m_caster->GetTypeId() == TYPEID_PLAYER)
((Player*)m_caster)->SetSpellModTakingSpell(this, false);
SetExecutedCurrently(false);
@@ -3015,7 +3015,7 @@ uint64 Spell::handle_delayed(uint64 t_offset)
{
UpdatePointers();
if (m_caster->GetTypeId()==TYPEID_PLAYER)
if (m_caster->GetTypeId() == TYPEID_PLAYER)
((Player*)m_caster)->SetSpellModTakingSpell(this, true);
uint64 next_time = 0;
@@ -3052,7 +3052,7 @@ uint64 Spell::handle_delayed(uint64 t_offset)
}
}
if (m_caster->GetTypeId()==TYPEID_PLAYER)
if (m_caster->GetTypeId() == TYPEID_PLAYER)
((Player*)m_caster)->SetSpellModTakingSpell(this, false);
// All targets passed - need finish phase
@@ -4329,7 +4329,7 @@ void Spell::TriggerSpell()
SpellCastResult Spell::CheckCast(bool strict)
{
// check cooldowns to prevent cheating
if(m_caster->GetTypeId()==TYPEID_PLAYER)
if(m_caster->GetTypeId() == TYPEID_PLAYER)
{
//can cast triggered (by aura only?) spells while have this flag
if (!m_IsTriggeredSpell && ((Player*)m_caster)->HasFlag(PLAYER_FLAGS, PLAYER_ALLOW_ONLY_ABILITY))
@@ -4411,7 +4411,7 @@ SpellCastResult Spell::CheckCast(bool strict)
// cancel autorepeat spells if cast start when moving
// (not wand currently autorepeat cast delayed to moving stop anyway in spell update code)
if( m_caster->GetTypeId()==TYPEID_PLAYER && ((Player*)m_caster)->isMoving() )
if( m_caster->GetTypeId() == TYPEID_PLAYER && ((Player*)m_caster)->isMoving() )
{
// skip stuck spell to allow use it in falling case and apply spell limitations at movement
if( (!((Player*)m_caster)->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_FALLING) || m_spellInfo->Effect[0] != SPELL_EFFECT_STUCK) &&
@@ -4569,13 +4569,13 @@ SpellCastResult Spell::CheckCast(bool strict)
m_caster->GetZoneAndAreaId(zone,area);
SpellCastResult locRes= spellmgr.GetSpellAllowedInLocationError(m_spellInfo,m_caster->GetMapId(),zone,area,
m_caster->GetTypeId()==TYPEID_PLAYER ? ((Player*)m_caster) : NULL);
m_caster->GetTypeId() == TYPEID_PLAYER ? ((Player*)m_caster) : NULL);
if(locRes != SPELL_CAST_OK)
return locRes;
}
// not let players cast spells at mount (and let do it to creatures)
if (m_caster->IsMounted() && m_caster->GetTypeId()==TYPEID_PLAYER && !m_IsTriggeredSpell &&
if (m_caster->IsMounted() && m_caster->GetTypeId() == TYPEID_PLAYER && !m_IsTriggeredSpell &&
!IsPassiveSpell(m_spellInfo->Id) && !(m_spellInfo->Attributes & SPELL_ATTR_CASTABLE_WHILE_MOUNTED))
{
if (m_caster->isInFlight())
@@ -5002,7 +5002,7 @@ SpellCastResult Spell::CheckCast(bool strict)
{
if(m_caster->GetPetGUID()) //let warlock do a replacement summon
{
if (m_caster->GetTypeId()==TYPEID_PLAYER && m_caster->getClass()==CLASS_WARLOCK)
if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->getClass()==CLASS_WARLOCK)
{
if (strict) //starting cast, trigger pet stun (cast by pet so it doesn't attack player)
if(Pet* pet = ((Player*)m_caster)->GetPet())
@@ -5043,7 +5043,7 @@ SpellCastResult Spell::CheckCast(bool strict)
case SPELL_EFFECT_TELEPORT_UNITS_FACE_CASTER:
{
//Do not allow to cast it before BG starts.
if(m_caster->GetTypeId()==TYPEID_PLAYER)
if(m_caster->GetTypeId() == TYPEID_PLAYER)
if(BattleGround const *bg = ((Player*)m_caster)->GetBattleGround())
if(bg->GetStatus() != STATUS_IN_PROGRESS)
return SPELL_FAILED_TRY_AGAIN;
@@ -6060,7 +6060,7 @@ bool Spell::CheckTargetCreatureType(Unit* target) const
m_spellInfo->SpellFamilyName==SPELLFAMILY_PALADIN && m_spellInfo->Category == 19)
{
// not allow cast at player
if(target->GetTypeId()==TYPEID_PLAYER)
if(target->GetTypeId() == TYPEID_PLAYER)
return false;
spellCreatureTargetMask = 0x7FF;
+35 -35
View File
@@ -1347,7 +1347,7 @@ void Aura::HandleAuraSpecificMods(bool apply)
{
if (Unit * caster = GetCaster())
{
if (caster->GetTypeId()==TYPEID_PLAYER && ((Player*)caster)->isHonorOrXPTarget(m_target))
if (caster->GetTypeId() == TYPEID_PLAYER && ((Player*)caster)->isHonorOrXPTarget(m_target))
caster->CastSpell(m_target, 18662, true, NULL, GetPartAura(0));
}
}
@@ -2349,7 +2349,7 @@ void AuraEffect::TriggerSpell()
case 17949:
case 27252:
{
if (caster->GetTypeId()!=TYPEID_PLAYER)
if (caster->GetTypeId() != TYPEID_PLAYER)
return;
Item* item = ((Player*)caster)->GetWeaponForAttack(BASE_ATTACK);
if (!item)
@@ -2815,11 +2815,11 @@ void AuraEffect::HandleAuraDummy(bool apply, bool Real, bool changeAmount)
}
return;
case 46699: // Requires No Ammo
if(m_target->GetTypeId()==TYPEID_PLAYER)
if(m_target->GetTypeId() == TYPEID_PLAYER)
((Player*)m_target)->RemoveAmmo(); // not use ammo and not allow use
return;
case 52916: // Honor Among Thieves
if(m_target->GetTypeId()==TYPEID_PLAYER)
if(m_target->GetTypeId() == TYPEID_PLAYER)
if (Unit * target = ObjectAccessor::GetUnit(*m_target,((Player*)m_target)->GetComboTarget()))
m_target->CastSpell(target, 51699, true);
return;
@@ -3100,7 +3100,7 @@ void AuraEffect::HandleAuraDummy(bool apply, bool Real, bool changeAmount)
if (!Real && !changeAmount)
break;
// Pain and Suffering
if( m_spellProto->SpellIconID == 2874 && m_target->GetTypeId()==TYPEID_PLAYER )
if( m_spellProto->SpellIconID == 2874 && m_target->GetTypeId() == TYPEID_PLAYER )
{
if(apply)
{
@@ -3163,7 +3163,7 @@ void AuraEffect::HandleAuraDummy(bool apply, bool Real, bool changeAmount)
}
}
// Predatory Strikes
if(m_target->GetTypeId()==TYPEID_PLAYER && GetSpellProto()->SpellIconID == 1563)
if(m_target->GetTypeId() == TYPEID_PLAYER && GetSpellProto()->SpellIconID == 1563)
{
((Player*)m_target)->UpdateAttackPowerAndDamage();
return;
@@ -3234,7 +3234,7 @@ void AuraEffect::HandleAuraDummy(bool apply, bool Real, bool changeAmount)
return;
}
if(GetEffIndex()==0 && m_target->GetTypeId()==TYPEID_PLAYER)
if(GetEffIndex()==0 && m_target->GetTypeId() == TYPEID_PLAYER)
{
SpellAreaForAreaMapBounds saBounds = spellmgr.GetSpellAreaForAuraMapBounds(GetId());
if(saBounds.first != saBounds.second)
@@ -3275,7 +3275,7 @@ void AuraEffect::HandleAuraMounted(bool apply, bool Real, bool /*changeAmount*/)
}
uint32 team = 0;
if (m_target->GetTypeId()==TYPEID_PLAYER)
if (m_target->GetTypeId() == TYPEID_PLAYER)
team = ((Player*)m_target)->GetTeam();
uint32 display_id = objmgr.ChooseDisplayId(team,ci);
@@ -3351,7 +3351,7 @@ void AuraEffect::HandleAuraHover(bool apply, bool Real, bool /*changeAmount*/)
void AuraEffect::HandleWaterBreathing(bool apply, bool Real, bool /*changeAmount*/)
{
// update timers in client
if(m_target->GetTypeId()==TYPEID_PLAYER)
if(m_target->GetTypeId() == TYPEID_PLAYER)
((Player*)m_target)->UpdateMirrorTimers();
}
@@ -3582,7 +3582,7 @@ void AuraEffect::HandleAuraModShapeshift(bool apply, bool Real, bool changeAmoun
// add/remove the shapeshift aura's boosts
HandleShapeshiftBoosts(apply);
if(m_target->GetTypeId()==TYPEID_PLAYER)
if(m_target->GetTypeId() == TYPEID_PLAYER)
((Player*)m_target)->InitDataForForm();
if(m_target->getClass() == CLASS_DRUID)
@@ -3606,7 +3606,7 @@ void AuraEffect::HandleAuraModShapeshift(bool apply, bool Real, bool changeAmoun
m_target->HandleAuraEffect(aurEff, false);
}
}
if (m_target->GetTypeId()==TYPEID_PLAYER)
if (m_target->GetTypeId() == TYPEID_PLAYER)
{
SpellShapeshiftEntry const *shapeInfo = sSpellShapeshiftStore.LookupEntry(form);
// Learn spells for shapeshift form - no need to send action bars or add spells to spellbook
@@ -3630,7 +3630,7 @@ void AuraEffect::HandleAuraTransform(bool apply, bool Real, bool /*changeAmount*
if(GetMiscValue()==0)
{
// player applied only
if (m_target->GetTypeId()!=TYPEID_PLAYER)
if (m_target->GetTypeId() != TYPEID_PLAYER)
return;
switch (GetId())
@@ -3769,7 +3769,7 @@ void AuraEffect::HandleAuraTransform(bool apply, bool Real, bool /*changeAmount*
if(CreatureInfo const* ci = objmgr.GetCreatureTemplate(cr_id))
{
uint32 team = 0;
if (m_target->GetTypeId()==TYPEID_PLAYER)
if (m_target->GetTypeId() == TYPEID_PLAYER)
team = ((Player*)m_target)->GetTeam();
uint32 display_id = objmgr.ChooseDisplayId(team,ci);
@@ -3877,7 +3877,7 @@ void AuraEffect::HandleFarSight(bool apply, bool Real, bool /*changeAmount*/)
void AuraEffect::HandleAuraTrackCreatures(bool apply, bool Real, bool /*changeAmount*/)
{
if(m_target->GetTypeId()!=TYPEID_PLAYER)
if(m_target->GetTypeId() != TYPEID_PLAYER)
return;
m_target->SetUInt32Value(PLAYER_TRACK_CREATURES, apply ? ((uint32)1)<<(GetMiscValue()-1) : 0 );
@@ -3885,7 +3885,7 @@ void AuraEffect::HandleAuraTrackCreatures(bool apply, bool Real, bool /*changeAm
void AuraEffect::HandleAuraTrackResources(bool apply, bool Real, bool /*changeAmount*/)
{
if(m_target->GetTypeId()!=TYPEID_PLAYER)
if(m_target->GetTypeId() != TYPEID_PLAYER)
return;
m_target->SetUInt32Value(PLAYER_TRACK_RESOURCES, apply ? ((uint32)1)<<(GetMiscValue()-1): 0 );
@@ -3893,7 +3893,7 @@ void AuraEffect::HandleAuraTrackResources(bool apply, bool Real, bool /*changeAm
void AuraEffect::HandleAuraTrackStealthed(bool apply, bool Real, bool /*changeAmount*/)
{
if(m_target->GetTypeId()!=TYPEID_PLAYER)
if(m_target->GetTypeId() != TYPEID_PLAYER)
return;
m_target->ApplyModFlag(PLAYER_FIELD_BYTES,PLAYER_FIELD_BYTE_TRACK_STEALTHED,apply);
@@ -4072,7 +4072,7 @@ void AuraEffect::HandleModStealth(bool apply, bool Real, bool /*changeAmount*/)
m_target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION);
m_target->SetStandFlags(UNIT_STAND_FLAGS_CREEP);
if(m_target->GetTypeId()==TYPEID_PLAYER)
if(m_target->GetTypeId() == TYPEID_PLAYER)
m_target->SetFlag(PLAYER_FIELD_BYTES2, 0x2000);
// apply only if not in GM invisibility (and overwrite invisibility state)
@@ -4082,7 +4082,7 @@ void AuraEffect::HandleModStealth(bool apply, bool Real, bool /*changeAmount*/)
else if(!m_target->HasAuraType(SPELL_AURA_MOD_STEALTH)) // if last SPELL_AURA_MOD_STEALTH
{
m_target->RemoveStandFlags(UNIT_STAND_FLAGS_CREEP);
if(m_target->GetTypeId()==TYPEID_PLAYER)
if(m_target->GetTypeId() == TYPEID_PLAYER)
m_target->RemoveFlag(PLAYER_FIELD_BYTES2, 0x2000);
if(m_target->GetVisibility() != VISIBILITY_OFF)
@@ -4101,7 +4101,7 @@ void AuraEffect::HandleInvisibility(bool apply, bool Real, bool /*changeAmount*/
m_target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION);
// apply glow vision
if(m_target->GetTypeId()==TYPEID_PLAYER)
if(m_target->GetTypeId() == TYPEID_PLAYER)
m_target->SetFlag(PLAYER_FIELD_BYTES2,PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW);
m_target->SetToNotify();
@@ -4141,7 +4141,7 @@ void AuraEffect::HandleInvisibilityDetect(bool apply, bool Real, bool /*changeAm
for (Unit::AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
m_target->m_detectInvisibilityMask |= (1 << GetMiscValue());
}
if(Real && m_target->GetTypeId()==TYPEID_PLAYER)
if(Real && m_target->GetTypeId() == TYPEID_PLAYER)
m_target->SetToNotify();
}
@@ -4302,7 +4302,7 @@ void AuraEffect::HandleAuraModIncreaseFlightSpeed(bool apply, bool Real, bool ch
m_target->SendMessageToSet(&data, true);
//Players on flying mounts must be immune to polymorph
if (m_target->GetTypeId()==TYPEID_PLAYER)
if (m_target->GetTypeId() == TYPEID_PLAYER)
m_target->ApplySpellImmune(GetId(),IMMUNITY_MECHANIC,MECHANIC_POLYMORPH,apply);
// Dragonmaw Illusion (overwrite mount model, mounted aura already applied)
@@ -4538,7 +4538,7 @@ void AuraEffect::HandleAuraProcTriggerSpell(bool apply, bool Real, bool /*change
if(!Real)
return;
// Elemental oath - "while Clearcasting from Elemental Focus is active, you deal 5%/10% more spell damage."
if (m_target->GetTypeId()==TYPEID_PLAYER && (GetId() == 51466 || GetId() == 51470))
if (m_target->GetTypeId() == TYPEID_PLAYER && (GetId() == 51466 || GetId() == 51470))
{
if (apply)
{
@@ -5074,7 +5074,7 @@ void AuraEffect::HandleAuraIncreaseBaseHealthPercent(bool apply, bool /*Real*/,
void AuraEffect::HandleAuraModParryPercent(bool /*apply*/, bool Real, bool /*changeAmount*/)
{
if(m_target->GetTypeId()!=TYPEID_PLAYER)
if(m_target->GetTypeId() != TYPEID_PLAYER)
return;
((Player*)m_target)->UpdateParryPercentage();
@@ -5082,7 +5082,7 @@ void AuraEffect::HandleAuraModParryPercent(bool /*apply*/, bool Real, bool /*cha
void AuraEffect::HandleAuraModDodgePercent(bool /*apply*/, bool Real, bool /*changeAmount*/)
{
if(m_target->GetTypeId()!=TYPEID_PLAYER)
if(m_target->GetTypeId() != TYPEID_PLAYER)
return;
((Player*)m_target)->UpdateDodgePercentage();
@@ -5091,7 +5091,7 @@ void AuraEffect::HandleAuraModDodgePercent(bool /*apply*/, bool Real, bool /*cha
void AuraEffect::HandleAuraModBlockPercent(bool /*apply*/, bool Real, bool /*changeAmount*/)
{
if(m_target->GetTypeId()!=TYPEID_PLAYER)
if(m_target->GetTypeId() != TYPEID_PLAYER)
return;
((Player*)m_target)->UpdateBlockPercentage();
@@ -5104,7 +5104,7 @@ void AuraEffect::HandleAuraModRegenInterrupt(bool /*apply*/, bool Real, bool cha
if(!Real && !changeAmount)
return;
if(m_target->GetTypeId()!=TYPEID_PLAYER)
if(m_target->GetTypeId() != TYPEID_PLAYER)
return;
((Player*)m_target)->UpdateManaRegen();
@@ -5112,7 +5112,7 @@ void AuraEffect::HandleAuraModRegenInterrupt(bool /*apply*/, bool Real, bool cha
void AuraEffect::HandleAuraModWeaponCritPercent(bool apply, bool Real, bool changeAmount)
{
if(m_target->GetTypeId()!=TYPEID_PLAYER)
if(m_target->GetTypeId() != TYPEID_PLAYER)
return;
// apply item specific bonuses for already equipped weapon
@@ -5308,7 +5308,7 @@ void AuraEffect::HandleAuraModAttackPowerOfArmor(bool /*apply*/, bool Real, bool
void AuraEffect::HandleModDamageDone(bool apply, bool Real, bool changeAmount)
{
// apply item specific bonuses for already equipped weapon
if((Real || changeAmount) && m_target->GetTypeId()==TYPEID_PLAYER)
if((Real || changeAmount) && m_target->GetTypeId() == TYPEID_PLAYER)
{
for (int i = 0; i < MAX_ATTACK; ++i)
if(Item* pItem = ((Player*)m_target)->GetWeaponForAttack(WeaponAttackType(i)))
@@ -5390,7 +5390,7 @@ void AuraEffect::HandleModDamagePercentDone(bool apply, bool Real, bool changeAm
sLog.outDebug("AURA MOD DAMAGE type:%u negative:%u", GetMiscValue(), m_amount > 0);
// apply item specific bonuses for already equipped weapon
if((Real || changeAmount) && m_target->GetTypeId()==TYPEID_PLAYER)
if((Real || changeAmount) && m_target->GetTypeId() == TYPEID_PLAYER)
{
for (int i = 0; i < MAX_ATTACK; ++i)
if(Item* pItem = ((Player*)m_target)->GetWeaponForAttack(WeaponAttackType(i)))
@@ -5511,7 +5511,7 @@ void AuraEffect::HandleAuraAllowOnlyAbility(bool apply, bool Real, bool /*change
if(!apply && m_target->HasAuraType(SPELL_AURA_ALLOW_ONLY_ABILITY))
return;
if(m_target->GetTypeId()==TYPEID_PLAYER)
if(m_target->GetTypeId() == TYPEID_PLAYER)
{
if (apply)
m_target->SetFlag(PLAYER_FLAGS, PLAYER_ALLOW_ONLY_ABILITY);
@@ -5715,7 +5715,7 @@ void AuraEffect::HandleSpiritOfRedemption( bool apply, bool Real , bool /*change
// prepare spirit state
if(apply)
{
if(m_target->GetTypeId()==TYPEID_PLAYER)
if(m_target->GetTypeId() == TYPEID_PLAYER)
{
// disable breath/etc timers
((Player*)m_target)->StopMirrorTimers();
@@ -5847,7 +5847,7 @@ void AuraEffect::PeriodicTick()
//As of 2.2 resilience reduces damage from DoT ticks as much as the chance to not be critically hit
// Reduce dot damage from resilience for players
if (m_target->GetTypeId()==TYPEID_PLAYER)
if (m_target->GetTypeId() == TYPEID_PLAYER)
pdamage-=((Player*)m_target)->GetDotDamageReduction(pdamage);
pCaster->CalcAbsorbResist(m_target, GetSpellSchoolMask(GetSpellProto()), DOT, pdamage, &absorb, &resist, m_spellProto);
@@ -5914,7 +5914,7 @@ void AuraEffect::PeriodicTick()
//As of 2.2 resilience reduces damage from DoT ticks as much as the chance to not be critically hit
// Reduce dot damage from resilience for players
if (m_target->GetTypeId()==TYPEID_PLAYER)
if (m_target->GetTypeId() == TYPEID_PLAYER)
pdamage-=((Player*)m_target)->GetDotDamageReduction(pdamage);
pCaster->CalcAbsorbResist(m_target, GetSpellSchoolMask(GetSpellProto()), DOT, pdamage, &absorb, &resist, m_spellProto);
@@ -6042,7 +6042,7 @@ void AuraEffect::PeriodicTick()
if(m_target!=pCaster && GetSpellProto()->AttributesEx2 & SPELL_ATTR_EX2_HEALTH_FUNNEL)
{
uint32 dmg = spellProto->manaPerSecond;
if(pCaster->GetHealth() <= dmg && pCaster->GetTypeId()==TYPEID_PLAYER)
if(pCaster->GetHealth() <= dmg && pCaster->GetTypeId() == TYPEID_PLAYER)
{
pCaster->RemoveAurasDueToSpell(GetId());
@@ -6922,7 +6922,7 @@ void AuraEffect::HandlePhase(bool apply, bool Real, bool /*changeAmount*/)
// no-phase is also phase state so same code for apply and remove
// phase auras normally not expected at BG but anyway better check
if(m_target->GetTypeId()==TYPEID_PLAYER)
if(m_target->GetTypeId() == TYPEID_PLAYER)
{
// drop flag at invisible in bg
if(((Player*)m_target)->InBattleGround())
+19 -19
View File
@@ -547,7 +547,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
case SPELLFAMILY_ROGUE:
{
// Envenom
if (m_caster->GetTypeId()==TYPEID_PLAYER && (m_spellInfo->SpellFamilyFlags[1] & 0x8))
if (m_caster->GetTypeId() == TYPEID_PLAYER && (m_spellInfo->SpellFamilyFlags[1] & 0x8))
{
// consume from stack dozes not more that have combo-points
if (uint32 combo = ((Player*)m_caster)->GetComboPoints())
@@ -572,7 +572,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
}
}
// Eviscerate
else if ((m_spellInfo->SpellFamilyFlags[0] & 0x00020000) && m_caster->GetTypeId()==TYPEID_PLAYER)
else if ((m_spellInfo->SpellFamilyFlags[0] & 0x00020000) && m_caster->GetTypeId() == TYPEID_PLAYER)
{
if (uint32 combo = ((Player*)m_caster)->GetComboPoints())
{
@@ -875,7 +875,7 @@ void Spell::EffectDummy(uint32 i)
}
case 17271: // Test Fetid Skull
{
if(!itemTarget && m_caster->GetTypeId()!=TYPEID_PLAYER)
if(!itemTarget && m_caster->GetTypeId() != TYPEID_PLAYER)
return;
uint32 spell_id = roll_chance_i(50)
@@ -1029,7 +1029,7 @@ void Spell::EffectDummy(uint32 i)
return;
case 33060: // Make a Wish
{
if(m_caster->GetTypeId()!=TYPEID_PLAYER)
if(m_caster->GetTypeId() != TYPEID_PLAYER)
return;
uint32 spell_id = 0;
@@ -1325,7 +1325,7 @@ void Spell::EffectDummy(uint32 i)
{
case 11958: // Cold Snap
{
if(m_caster->GetTypeId()!=TYPEID_PLAYER)
if(m_caster->GetTypeId() != TYPEID_PLAYER)
return;
// immediately finishes the cooldown on Frost spells
@@ -1583,7 +1583,7 @@ void Spell::EffectDummy(uint32 i)
}
case 14185: // Preparation
{
if(m_caster->GetTypeId()!=TYPEID_PLAYER)
if(m_caster->GetTypeId() != TYPEID_PLAYER)
return;
//immediately finishes the cooldown on certain Rogue abilities
@@ -1611,7 +1611,7 @@ void Spell::EffectDummy(uint32 i)
{
case 23989: // Readiness talent
{
if(m_caster->GetTypeId()!=TYPEID_PLAYER)
if(m_caster->GetTypeId() != TYPEID_PLAYER)
return;
// immediately finishes the cooldown on your other Hunter abilities except Bestial Wrath
@@ -1629,7 +1629,7 @@ void Spell::EffectDummy(uint32 i)
}
case 37506: // Scatter Shot
{
if (m_caster->GetTypeId()!=TYPEID_PLAYER)
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
// break Auto Shot and autohit
@@ -1722,7 +1722,7 @@ void Spell::EffectDummy(uint32 i)
// non-standard cast requirement check
if (!unitTarget || unitTarget->getAttackers().empty())
{
if(m_caster->GetTypeId()==TYPEID_PLAYER)
if(m_caster->GetTypeId() == TYPEID_PLAYER)
((Player*)m_caster)->RemoveSpellCooldown(m_spellInfo->Id,true);
SendCastResult(SPELL_FAILED_TARGET_AFFECTING_COMBAT);
return;
@@ -1858,7 +1858,7 @@ void Spell::EffectDummy(uint32 i)
// Lava Lash
if (m_spellInfo->SpellFamilyFlags[2] & 0x00000004)
{
if (m_caster->GetTypeId()!=TYPEID_PLAYER)
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
if (Item *item = ((Player*)m_caster)->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND))
@@ -2929,7 +2929,7 @@ void Spell::EffectCreateItem(uint32 i)
void Spell::EffectCreateItem2(uint32 i)
{
if(m_caster->GetTypeId()!=TYPEID_PLAYER)
if(m_caster->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)m_caster;
@@ -2954,7 +2954,7 @@ void Spell::EffectCreateItem2(uint32 i)
void Spell::EffectCreateRandomItem(uint32 i)
{
if(m_caster->GetTypeId()!=TYPEID_PLAYER)
if(m_caster->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)m_caster;
@@ -3430,7 +3430,7 @@ void Spell::EffectSummonType(uint32 i)
uint32 level = m_caster->getLevel();
// level of creature summoned using engineering item based at engineering skill level
if(m_caster->GetTypeId()==TYPEID_PLAYER && m_CastItem)
if(m_caster->GetTypeId() == TYPEID_PLAYER && m_CastItem)
{
ItemPrototype const *proto = m_CastItem->GetProto();
if(proto && proto->RequiredSkill == SKILL_ENGINERING)
@@ -4315,7 +4315,7 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
// Devastate bonus and sunder armor refresh
if(m_spellInfo->SpellFamilyFlags[1] & 0x40)
{
if (m_caster->GetTypeId()!=TYPEID_PLAYER)
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
SpellEntry const *spellInfo = NULL;
uint32 stack = 0;
@@ -4377,14 +4377,14 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
// Hemorrhage
if(m_spellInfo->SpellFamilyFlags[0] & 0x2000000)
{
if(m_caster->GetTypeId()==TYPEID_PLAYER)
if(m_caster->GetTypeId() == TYPEID_PLAYER)
((Player*)m_caster)->AddComboPoints(unitTarget, 1, this);
}
// Fan of Knives
else if(m_spellInfo->SpellFamilyFlags[1] & 0x40000)
{
// 50% more damage with daggers
if(m_caster->GetTypeId()==TYPEID_PLAYER)
if(m_caster->GetTypeId() == TYPEID_PLAYER)
if (Item* item = ((Player*)m_caster)->GetWeaponForAttack(m_attackType, true))
if (item->GetProto()->SubClass == ITEM_SUBCLASS_WEAPON_DAGGER)
totalDamagePercentMod *= 1.5f;
@@ -4463,7 +4463,7 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
// Mangle (Cat): CP
if(m_spellInfo->SpellFamilyFlags[1] & 0x400)
{
if(m_caster->GetTypeId()==TYPEID_PLAYER)
if(m_caster->GetTypeId() == TYPEID_PLAYER)
((Player*)m_caster)->AddComboPoints(unitTarget,1, this);
}
// Shred, Maul - Rend and Tear
@@ -4767,7 +4767,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
{
case 6962:
{
if(m_caster->GetTypeId()!=TYPEID_PLAYER)
if(m_caster->GetTypeId() != TYPEID_PLAYER)
return;
Player* plr = ((Player*)m_caster);
@@ -4900,7 +4900,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// Bending Shinbone
case 8856:
{
if(!itemTarget && m_caster->GetTypeId()!=TYPEID_PLAYER)
if(!itemTarget && m_caster->GetTypeId() != TYPEID_PLAYER)
return;
uint32 spell_id = 0;
+4 -4
View File
@@ -294,7 +294,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
// ignore for remote control state (for player case)
Unit* mover = _player->m_mover;
if(mover != _player && mover->GetTypeId()==TYPEID_PLAYER)
if(mover != _player && mover->GetTypeId() == TYPEID_PLAYER)
{
recvPacket.rpos(recvPacket.wpos()); // prevent spam at ignore packet
return;
@@ -312,7 +312,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
return;
}
if(mover->GetTypeId()==TYPEID_PLAYER)
if(mover->GetTypeId() == TYPEID_PLAYER)
{
// not have spell in spellbook or spell passive and not casted by client
if (!((Player*)mover)->HasActiveSpell (spellId) || IsPassiveSpell(spellId) )
@@ -473,7 +473,7 @@ void WorldSession::HandleCancelChanneling( WorldPacket & recv_data)
// ignore for remote control state (for player case)
Unit* mover = _player->m_mover;
if(mover != _player && mover->GetTypeId()==TYPEID_PLAYER)
if(mover != _player && mover->GetTypeId() == TYPEID_PLAYER)
return;
mover->InterruptSpell(CURRENT_CHANNELED_SPELL);
@@ -570,7 +570,7 @@ void WorldSession::HandleMirrrorImageDataRequest( WorldPacket & recv_data )
WorldPacket data(SMSG_MIRRORIMAGE_DATA, 68);
data << (uint64)guid;
data << (uint32)creator->GetDisplayId();
if (creator->GetTypeId()==TYPEID_PLAYER)
if (creator->GetTypeId() == TYPEID_PLAYER)
{
Player * pCreator = (Player *)creator;
data << (uint8)pCreator->getRace();
+1 -1
View File
@@ -1063,7 +1063,7 @@ void Guardian::UpdateAttackPowerAndDamage(bool ranged)
val = 2 * GetStat(STAT_STRENGTH) - 20.0f;
Unit* owner = GetOwner();
if( owner && owner->GetTypeId()==TYPEID_PLAYER)
if( owner && owner->GetTypeId() == TYPEID_PLAYER)
{
if(isHunterPet()) //hunter pets benefit from owner's attack power
{
+44 -48
View File
@@ -32,24 +32,23 @@
//==============================================================
// The pHatingUnit is not used yet
float ThreatCalcHelper::calcThreat(Unit* pHatedUnit, Unit* pHatingUnit, float pThreat, SpellSchoolMask schoolMask, SpellEntry const *pThreatSpell)
float ThreatCalcHelper::calcThreat(Unit* pHatedUnit, Unit* pHatingUnit, float fThreat, SpellSchoolMask schoolMask, SpellEntry const *pThreatSpell)
{
if (pThreatSpell)
if (Player* modOwner = pHatedUnit->GetSpellModOwner())
modOwner->ApplySpellMod(pThreatSpell->Id, SPELLMOD_THREAT, pThreat);
modOwner->ApplySpellMod(pThreatSpell->Id, SPELLMOD_THREAT, fThreat);
float threat = pHatedUnit->ApplyTotalThreatModifier(pThreat, schoolMask);
return threat;
return pHatedUnit->ApplyTotalThreatModifier(fThreat, schoolMask);
}
//============================================================
//================= HostilReference ==========================
//============================================================
HostilReference::HostilReference(Unit* pUnit, ThreatManager *pThreatManager, float pThreat)
HostilReference::HostilReference(Unit* pUnit, ThreatManager *pThreatManager, float fThreat)
{
iThreat = pThreat;
iTempThreatModifyer = 0.0f;
iThreat = fThreat;
iTempThreatModifier = 0.0f;
link(pUnit, pThreatManager);
iUnitGuid = pUnit->GetGUID();
iOnline = true;
@@ -83,29 +82,29 @@ void HostilReference::sourceObjectDestroyLink()
void HostilReference::fireStatusChanged(ThreatRefStatusChangeEvent& pThreatRefStatusChangeEvent)
{
if(getSource())
if (getSource())
getSource()->processThreatEvent(&pThreatRefStatusChangeEvent);
}
//============================================================
void HostilReference::addThreat(float pMod)
void HostilReference::addThreat(float fModThreat)
{
iThreat += pMod;
// the threat is changed. Source and target unit have to be availabe
iThreat += fModThreat;
// the threat is changed. Source and target unit have to be available
// if the link was cut before relink it again
if(!isOnline())
if (!isOnline())
updateOnlineStatus();
if(pMod != 0.0f)
if (fModThreat != 0.0f)
{
ThreatRefStatusChangeEvent event(UEV_THREAT_REF_THREAT_CHANGE, this, pMod);
ThreatRefStatusChangeEvent event(UEV_THREAT_REF_THREAT_CHANGE, this, fModThreat);
fireStatusChanged(event);
}
if(isValid() && pMod >= 0)
if (isValid() && fModThreat >= 0.0f)
{
Unit* victim_owner = getTarget()->GetCharmerOrOwner();
if(victim_owner && victim_owner->isAlive())
if (victim_owner && victim_owner->isAlive())
getSource()->addThreat(victim_owner, 0.0f); // create a threat to the owner of a pet, if the pet attacks
}
}
@@ -118,25 +117,23 @@ void HostilReference::updateOnlineStatus()
bool online = false;
bool accessible = false;
if(!isValid())
{
Unit* target = ObjectAccessor::GetUnit(*getSourceUnit(), getUnitGuid());
if(target)
if (!isValid())
if (Unit* target = ObjectAccessor::GetUnit(*getSourceUnit(), getUnitGuid()))
link(target, getSource());
}
// only check for online status if
// ref is valid
// target is no player or not gamemaster
// target is not in flight
if(isValid() &&
if (isValid() &&
((getTarget()->GetTypeId() != TYPEID_PLAYER || !((Player*)getTarget())->isGameMaster()) ||
!getTarget()->hasUnitState(UNIT_STAT_IN_FLIGHT)))
{
Creature* creature = (Creature* ) getSourceUnit();
Creature* creature = (Creature*)getSourceUnit();
online = getTarget()->isInAccessiblePlaceFor(creature);
if(!online)
if (!online)
{
if(creature->IsWithinCombatRange(getTarget(), creature->m_CombatDistance))
if (creature->IsWithinCombatRange(getTarget(), creature->m_CombatDistance))
online = true; // not accessible but stays online
}
else
@@ -152,10 +149,10 @@ void HostilReference::updateOnlineStatus()
void HostilReference::setOnlineOfflineState(bool pIsOnline)
{
if(iOnline != pIsOnline)
if (iOnline != pIsOnline)
{
iOnline = pIsOnline;
if(!iOnline)
if (!iOnline)
setAccessibleState(false); // if not online that not accessable as well
ThreatRefStatusChangeEvent event(UEV_THREAT_REF_ONLINE_STATUS, this);
@@ -167,7 +164,7 @@ void HostilReference::setOnlineOfflineState(bool pIsOnline)
void HostilReference::setAccessibleState(bool pIsAccessible)
{
if(iAccessible != pIsAccessible)
if (iAccessible != pIsAccessible)
{
iAccessible = pIsAccessible;
@@ -231,20 +228,20 @@ HostilReference* ThreatContainer::getReferenceByTarget(Unit* pVictim)
//============================================================
// Add the threat, if we find the reference
HostilReference* ThreatContainer::addThreat(Unit* pVictim, float pThreat)
HostilReference* ThreatContainer::addThreat(Unit* pVictim, float fThreat)
{
HostilReference* ref = getReferenceByTarget(pVictim);
if(ref)
ref->addThreat(pThreat);
if (ref)
ref->addThreat(fThreat);
return ref;
}
//============================================================
void ThreatContainer::modifyThreatPercent(Unit *pVictim, int32 pPercent)
void ThreatContainer::modifyThreatPercent(Unit *pVictim, int32 iPercent)
{
if(HostilReference* ref = getReferenceByTarget(pVictim))
ref->addThreatPercent(pPercent);
ref->addThreatPercent(iPercent);
}
//============================================================
@@ -361,7 +358,7 @@ void ThreatManager::clearReferences()
//============================================================
void ThreatManager::addThreat(Unit* pVictim, float pThreat, SpellSchoolMask schoolMask, SpellEntry const *pThreatSpell)
void ThreatManager::addThreat(Unit* pVictim, float fThreat, SpellSchoolMask schoolMask, SpellEntry const *pThreatSpell)
{
//function deals with adding threat and adding players and pets into ThreatList
//mobs, NPCs, guards have ThreatList and HateOfflineList
@@ -373,19 +370,19 @@ void ThreatManager::addThreat(Unit* pVictim, float pThreat, SpellSchoolMask scho
return;
// not to GM
if(!pVictim || (pVictim->GetTypeId() == TYPEID_PLAYER && ((Player*)pVictim)->isGameMaster()) )
if (!pVictim || (pVictim->GetTypeId() == TYPEID_PLAYER && ((Player*)pVictim)->isGameMaster()))
return;
// not to dead and not for dead
if(!pVictim->isAlive() || !getOwner()->isAlive() )
if (!pVictim->isAlive() || !getOwner()->isAlive())
return;
assert(getOwner()->GetTypeId()== TYPEID_UNIT);
float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, pThreat, schoolMask, pThreatSpell);
float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, fThreat, schoolMask, pThreatSpell);
// must check > 0.0f, otherwise dead loop
if(threat > 0.0f && pVictim->GetReducedThreatPercent())
if (threat > 0.0f && pVictim->GetReducedThreatPercent())
{
float reducedThreat = threat * pVictim->GetReducedThreatPercent() / 100;
threat -= reducedThreat;
@@ -396,19 +393,19 @@ void ThreatManager::addThreat(Unit* pVictim, float pThreat, SpellSchoolMask scho
_addThreat(pVictim, threat);
}
void ThreatManager::_addThreat(Unit *pVictim, float threat)
void ThreatManager::_addThreat(Unit *pVictim, float fThreat)
{
HostilReference* ref = iThreatContainer.addThreat(pVictim, threat);
HostilReference* ref = iThreatContainer.addThreat(pVictim, fThreat);
// Ref is not in the online refs, search the offline refs next
if(!ref)
ref = iThreatOfflineContainer.addThreat(pVictim, threat);
if (!ref)
ref = iThreatOfflineContainer.addThreat(pVictim, fThreat);
if(!ref) // there was no ref => create a new one
if (!ref) // there was no ref => create a new one
{
// threat has to be 0 here
HostilReference* hostilReference = new HostilReference(pVictim, this, 0);
iThreatContainer.addReference(hostilReference);
hostilReference->addThreat(threat); // now we add the real threat
hostilReference->addThreat(fThreat); // now we add the real threat
if(pVictim->GetTypeId() == TYPEID_PLAYER && ((Player*)pVictim)->isGameMaster())
hostilReference->setOnlineOfflineState(false); // GM is always offline
}
@@ -416,9 +413,9 @@ void ThreatManager::_addThreat(Unit *pVictim, float threat)
//============================================================
void ThreatManager::modifyThreatPercent(Unit *pVictim, int32 pPercent)
void ThreatManager::modifyThreatPercent(Unit *pVictim, int32 iPercent)
{
iThreatContainer.modifyThreatPercent(pVictim, pPercent);
iThreatContainer.modifyThreatPercent(pVictim, iPercent);
}
//============================================================
@@ -451,8 +448,7 @@ void ThreatManager::tauntApply(Unit* pTaunter)
HostilReference* ref = iThreatContainer.getReferenceByTarget(pTaunter);
if(getCurrentVictim() && ref && (ref->getThreat() < getCurrentVictim()->getThreat()))
{
if(ref->getTempThreatModifyer() == 0.0f)
// Ok, temp threat is unused
if(ref->getTempThreatModifier() == 0.0f) // Ok, temp threat is unused
ref->setTempThreat(getCurrentVictim()->getThreat());
}
}
+30 -19
View File
@@ -43,21 +43,26 @@ struct SpellEntry;
class ThreatCalcHelper
{
public:
static float calcThreat(Unit* pHatedUnit, Unit* pHatingUnit, float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *threatSpell = NULL);
static float calcThreat(Unit* pHatedUnit, Unit* pHatingUnit, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *threatSpell = NULL);
};
//==============================================================
class TRINITY_DLL_SPEC HostilReference : public Reference<Unit, ThreatManager>
{
public:
HostilReference(Unit* pUnit, ThreatManager *pThreatManager, float pThreat);
HostilReference(Unit* pUnit, ThreatManager *pThreatManager, float fThreat);
//=================================================
void addThreat(float pMod);
void addThreat(float fModThreat);
void setThreat(float pThreat) { addThreat(pThreat - getThreat()); }
void setThreat(float fThreat) { addThreat(fThreat - getThreat()); }
void addThreatPercent(int32 pPercent) { float tmpThreat = iThreat; tmpThreat = tmpThreat * (pPercent+100) / 100; addThreat(tmpThreat-iThreat); }
void addThreatPercent(int32 pPercent)
{
float tmpThreat = iThreat;
tmpThreat = tmpThreat * (pPercent+100.0f) / 100.0f;
addThreat(tmpThreat-iThreat);
}
float getThreat() const { return iThreat; }
@@ -69,17 +74,23 @@ class TRINITY_DLL_SPEC HostilReference : public Reference<Unit, ThreatManager>
// used for temporary setting a threat and reducting it later again.
// the threat modification is stored
void setTempThreat(float pThreat) { iTempThreatModifyer = pThreat - getThreat(); if(iTempThreatModifyer != 0.0f) addThreat(iTempThreatModifyer); }
void setTempThreat(float fThreat)
{
iTempThreatModifier = fThreat - getThreat();
if (iTempThreatModifier != 0.0f)
addThreat(iTempThreatModifier);
}
void resetTempThreat()
{
if(iTempThreatModifyer != 0.0f)
if (iTempThreatModifier != 0.0f)
{
addThreat(-iTempThreatModifyer); iTempThreatModifyer = 0.0f;
addThreat(-iTempThreatModifier);
iTempThreatModifier = 0.0f;
}
}
float getTempThreatModifyer() { return iTempThreatModifyer; }
float getTempThreatModifier() { return iTempThreatModifier; }
//=================================================
// check, if source can reach target and set the status
@@ -122,7 +133,7 @@ class TRINITY_DLL_SPEC HostilReference : public Reference<Unit, ThreatManager>
Unit* getSourceUnit();
private:
float iThreat;
float iTempThreatModifyer; // used for taunt
float iTempThreatModifier; // used for taunt
uint64 iUnitGuid;
bool iOnline;
bool iAccessible;
@@ -148,9 +159,9 @@ class TRINITY_DLL_SPEC ThreatContainer
ThreatContainer() { iDirty = false; }
~ThreatContainer() { clearReferences(); }
HostilReference* addThreat(Unit* pVictim, float pThreat);
HostilReference* addThreat(Unit* pVictim, float fThreat);
void modifyThreatPercent(Unit *pVictim, int32 percent);
void modifyThreatPercent(Unit *pVictim, int32 iPercent);
HostilReference* selectNextVictim(Creature* pAttacker, HostilReference* pCurrentVictim);
@@ -180,12 +191,12 @@ class TRINITY_DLL_SPEC ThreatManager
void clearReferences();
void addThreat(Unit* pVictim, float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *threatSpell = NULL);
void modifyThreatPercent(Unit *pVictim, int32 pPercent);
void addThreat(Unit* pVictim, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *threatSpell = NULL);
void modifyThreatPercent(Unit *pVictim, int32 iPercent);
float getThreat(Unit *pVictim, bool pAlsoSearchOfflineList = false);
bool isThreatListEmpty() { return iThreatContainer.empty();}
bool isThreatListEmpty() { return iThreatContainer.empty(); }
void processThreatEvent(ThreatRefStatusChangeEvent* threatRefStatusChangeEvent);
@@ -193,7 +204,7 @@ class TRINITY_DLL_SPEC ThreatManager
HostilReference* getCurrentVictim() { return iCurrentVictim; }
Unit* getOwner() { return iOwner; }
Unit* getOwner() { return iOwner; }
Unit* getHostilTarget();
@@ -202,16 +213,16 @@ class TRINITY_DLL_SPEC ThreatManager
void setCurrentVictim(HostilReference* pHostilReference);
void setDirty(bool pDirty) { iThreatContainer.setDirty(pDirty); }
void setDirty(bool bDirty) { iThreatContainer.setDirty(bDirty); }
// methods to access the lists from the outside to do sume dirty manipulation (scriping and such)
// methods to access the lists from the outside to do some dirty manipulation (scriping and such)
// I hope they are used as little as possible.
std::list<HostilReference*>& getThreatList() { return iThreatContainer.getThreatList(); }
std::list<HostilReference*>& getOfflieThreatList() { return iThreatOfflineContainer.getThreatList(); }
ThreatContainer& getOnlineContainer() { return iThreatContainer; }
ThreatContainer& getOfflineContainer() { return iThreatOfflineContainer; }
private:
void _addThreat(Unit *pVictim, float threat);
void _addThreat(Unit *pVictim, float fThreat);
HostilReference* iCurrentVictim;
Unit* iOwner;
+306 -311
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -1645,8 +1645,8 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
// Threat related methods
bool CanHaveThreatList() const;
void AddThreat(Unit* pVictim, float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *threatSpell = NULL);
float ApplyTotalThreatModifier(float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL);
void AddThreat(Unit* pVictim, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *threatSpell = NULL);
float ApplyTotalThreatModifier(float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL);
void DeleteThreatList();
void TauntApply(Unit* pVictim);
void TauntFadeOut(Unit *taunter);
+2 -2
View File
@@ -326,11 +326,11 @@ void WorldSession::LogoutPlayer(bool Save)
Unit* owner = (*itr)->GetOwner(); // including player controlled case
if(owner)
{
if(owner->GetTypeId()==TYPEID_PLAYER)
if(owner->GetTypeId() == TYPEID_PLAYER)
aset.insert((Player*)owner);
}
else
if((*itr)->GetTypeId()==TYPEID_PLAYER)
if((*itr)->GetTypeId() == TYPEID_PLAYER)
aset.insert((Player*)(*itr));
}