--HG--
branch : trunk
This commit is contained in:
Machiavelli
2009-08-15 23:32:53 +02:00
14 changed files with 230 additions and 235 deletions
+15 -15
View File
@@ -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
+1 -1
View File
@@ -527,7 +527,7 @@ class TRINITY_DLL_SPEC Creature : public Unit
bool isCanTrainingOf(Player* player, bool msg) const;
bool isCanInteractWithBattleMaster(Player* player, bool msg) const;
bool isCanTrainingAndResetTalentsOf(Player* pPlayer) const;
bool IsOutOfThreatArea(Unit* pVictim) const;
bool canCreatureAttack(Unit const *pVictim, bool force = true) const;
bool IsImmunedToSpell(SpellEntry const* spellInfo);
// redefine Unit::IsImmunedToSpell
bool IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const;
+2 -1
View File
@@ -286,7 +286,8 @@ void Item::UpdateDuration(Player* owner, uint32 diff)
if (GetUInt32Value(ITEM_FIELD_DURATION)<=diff)
{
owner->DestroyItem(GetBagSlot(), GetSlot(), true);
Script->ItemExpire(owner, GetProto());
if(const ItemPrototype *proto = GetProto())
Script->ItemExpire(owner, proto);
return;
}
+1 -1
View File
@@ -2547,7 +2547,7 @@ void Player::InitTalentForLevel()
}
else
{
if (level < 40 || m_specsCount == 0)
if (level < sWorld.getConfig(CONFIG_MIN_DUALSPEC_LEVEL) || m_specsCount == 0)
{
m_specsCount = 1;
m_activeSpec = 0;
+1 -1
View File
@@ -325,7 +325,7 @@ void Guardian::InitStats(uint32 duration)
if(m_owner->GetTypeId() == TYPEID_PLAYER && HasSummonMask(SUMMON_MASK_CONTROLABLE_GUARDIAN))
m_charmInfo->InitCharmCreateSpells();
SetReactState(REACT_DEFENSIVE);
SetReactState(REACT_AGGRESSIVE);
}
Puppet::Puppet(SummonPropertiesEntry const *properties, Unit *owner) : Minion(properties, owner)
+1 -1
View File
@@ -306,7 +306,7 @@ HostilReference* ThreatContainer::selectNextVictim(Creature* pAttacker, HostilRe
}
}
if(!pAttacker->IsOutOfThreatArea(target)) // skip non attackable currently targets
if(pAttacker->canCreatureAttack(target)) // skip non attackable currently targets
{
if(pCurrentVictim) // select 1.3/1.1 better target in comparison current target
{
+1 -4
View File
@@ -11187,11 +11187,8 @@ Unit* Creature::SelectVictim()
// search nearby enemy before enter evade mode
if(HasReactState(REACT_AGGRESSIVE))
{
target = SelectNearestTarget();
if(target && !IsOutOfThreatArea(target))
if(target = SelectNearestTarget())
return target;
}
if(m_invisibilityMask)
{
+2
View File
@@ -729,6 +729,8 @@ void World::LoadConfigSettings(bool reload)
m_configs[CONFIG_MAX_PLAYER_LEVEL] = MAX_LEVEL;
}
m_configs[CONFIG_MIN_DUALSPEC_LEVEL] = sConfig.GetIntDefault("MinDualSpecLevel", 40);
m_configs[CONFIG_START_PLAYER_LEVEL] = sConfig.GetIntDefault("StartPlayerLevel", 1);
if(m_configs[CONFIG_START_PLAYER_LEVEL] < 1)
{
+1
View File
@@ -124,6 +124,7 @@ enum WorldConfigs
CONFIG_MIN_LEVEL_FOR_HEROIC_CHARACTER_CREATING,
CONFIG_SKIP_CINEMATICS,
CONFIG_MAX_PLAYER_LEVEL,
CONFIG_MIN_DUALSPEC_LEVEL,
CONFIG_START_PLAYER_LEVEL,
CONFIG_START_HEROIC_PLAYER_LEVEL,
CONFIG_START_PLAYER_MONEY,