diff options
| author | Machiavelli <none@none> | 2009-08-15 23:32:53 +0200 |
|---|---|---|
| committer | Machiavelli <none@none> | 2009-08-15 23:32:53 +0200 |
| commit | 340a206f05b93b16aa66a57d567635ba47caa553 (patch) | |
| tree | 30b97a282eeda06e746230c19536fdfabfeb7144 /src/game/Creature.cpp | |
| parent | 00d53460c8dc34fbc0ea038973943a7ea666cd3d (diff) | |
| parent | 8387e8a4fd0eb5fc8aa17d3fbd4f6c4fee72982f (diff) | |
*Merge
--HG--
branch : trunk
Diffstat (limited to 'src/game/Creature.cpp')
| -rw-r--r-- | src/game/Creature.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 19eae315e9c..1fc31e8a93a 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -923,7 +923,7 @@ void Creature::prepareGossipMenu( Player *pPlayer,uint32 gossipid ) cantalking=false; break; case GOSSIP_OPTION_LEARNDUALSPEC: - if(!(pPlayer->GetSpecsCount() == 1 && isCanTrainingAndResetTalentsOf(pPlayer) && !(pPlayer->getLevel() < 40))) + if(!(pPlayer->GetSpecsCount() == 1 && isCanTrainingAndResetTalentsOf(pPlayer) && !(pPlayer->getLevel() < sWorld.getConfig(CONFIG_MIN_DUALSPEC_LEVEL)))) cantalking=false; break; case GOSSIP_OPTION_UNLEARNTALENTS: @@ -1074,7 +1074,7 @@ void Creature::OnGossipSelect(Player* player, uint32 option) player->SendTalentWipeConfirm(guid); break; case GOSSIP_OPTION_LEARNDUALSPEC: - if(player->GetSpecsCount() == 1 && !(player->getLevel() < 40)) + if(player->GetSpecsCount() == 1 && !(player->getLevel() < sWorld.getConfig(CONFIG_MIN_DUALSPEC_LEVEL))) { if (player->GetMoney() < 10000000) { @@ -1704,7 +1704,7 @@ bool Creature::IsWithinSightDist(Unit const* u) const bool Creature::canStartAttack(Unit const* who, bool force) const { - if(isCivilian() || !who->isInAccessiblePlaceFor(this)) + if(isCivilian()) return false; if(!canFly() && (GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE)) @@ -1716,7 +1716,7 @@ bool Creature::canStartAttack(Unit const* who, bool force) const if(!force && (IsNeutralToAll() || !IsWithinDistInMap(who, GetAttackDistance(who)))) return false; - if(!canAttack(who, force)) + if(!canCreatureAttack(who, force)) return false; return IsWithinLOSInMap(who); @@ -2180,29 +2180,29 @@ void Creature::SaveRespawnTime() objmgr.SaveCreatureRespawnTime(m_DBTableGuid,GetInstanceId(),time(NULL)+m_respawnDelay+m_deathTimer/IN_MILISECONDS); } -bool Creature::IsOutOfThreatArea(Unit* pVictim) const +// this should not be called by petAI or +bool Creature::canCreatureAttack(Unit const *pVictim, bool force) const { - if(!pVictim) - return true; - if(!pVictim->IsInMap(this)) - return true; + return false; - if(!canAttack(pVictim)) - return true; + if(!canAttack(pVictim, force)) + return false; if(!pVictim->isInAccessiblePlaceFor(this)) - return true; + return false; if(sMapStore.LookupEntry(GetMapId())->IsDungeon()) - return false; + return true; float AttackDist = GetAttackDistance(pVictim); uint32 ThreatRadius = sWorld.getConfig(CONFIG_THREAT_RADIUS); //Use AttackDistance in distance check if threat radius is lower. This prevents creature bounce in and out of combat every update tick. - return !pVictim->IsWithinDist3d(mHome_X,mHome_Y,mHome_Z, - ThreatRadius > AttackDist ? ThreatRadius : AttackDist); + if(Unit *unit = GetCharmerOrOwner()) + return pVictim->IsWithinDist(unit, ThreatRadius > AttackDist ? ThreatRadius : AttackDist); + else + return pVictim->IsWithinDist3d(mHome_X, mHome_Y, mHome_Z, ThreatRadius > AttackDist ? ThreatRadius : AttackDist); } CreatureDataAddon const* Creature::GetCreatureAddon() const |
