Merge commit 'origin/master' into 320

This commit is contained in:
tomrus88 2009-07-26 10:52:21 +04:00
commit 299f40ac0c
39 changed files with 1131 additions and 480 deletions

View file

@ -1275,8 +1275,8 @@ void Player::Update( uint32 p_time )
{
if (p_time >= m_DetectInvTimer)
{
m_DetectInvTimer = 3000;
HandleStealthedUnitsDetection();
m_DetectInvTimer = 3000;
}
else
m_DetectInvTimer -= p_time;
@ -6999,7 +6999,7 @@ void Player::CastItemCombatSpell(Unit* Target, WeaponAttackType attType)
if(spellData.SpellPPMRate)
{
uint32 WeaponSpeed = GetAttackTime(attType);
uint32 WeaponSpeed = proto->Delay;
chance = GetPPMProcChance(WeaponSpeed, spellData.SpellPPMRate);
}
else if(chance > 100.0f)
@ -7029,7 +7029,17 @@ void Player::CastItemCombatSpell(Unit* Target, WeaponAttackType attType)
continue;
}
float chance = pEnchant->amount[s] != 0 ? float(pEnchant->amount[s]) : GetWeaponProcChance();
// Use first rank to access spell item enchant procs
float ppmRate = spellmgr.GetItemEnchantProcChance(spellInfo->Id);
float chance = ppmRate
? GetPPMProcChance(proto->Delay, ppmRate)
: pEnchant->amount[s] != 0 ? float(pEnchant->amount[s]) : GetWeaponProcChance();
ApplySpellMod(spellInfo->Id,SPELLMOD_CHANCE_OF_SUCCESS,chance);
ApplySpellMod(spellInfo->Id,SPELLMOD_FREQUENCY_OF_SUCCESS,chance);
if (roll_chance_f(chance))
{
if(IsPositiveSpell(pEnchant->spellid[s]))
@ -16892,35 +16902,40 @@ void Player::HandleStealthedUnitsDetection()
cell_lock->Visit(cell_lock, world_unit_searcher, *GetMap());
cell_lock->Visit(cell_lock, grid_unit_searcher, *GetMap());
for (std::list<Unit*>::iterator i = stealthedUnits.begin(); i != stealthedUnits.end();)
for (std::list<Unit*>::const_iterator i = stealthedUnits.begin(); i != stealthedUnits.end(); ++i)
{
if((*i)==this)
{
i = stealthedUnits.erase(i);
continue;
}
if ((*i)->isVisibleForOrDetect(this,true))
bool hasAtClient = HaveAtClient((*i));
bool hasDetected = (*i)->isVisibleForOrDetect(this, true);
if (hasDetected)
{
if(!hasAtClient)
{
(*i)->SendUpdateToPlayer(this);
m_clientGUIDs.insert((*i)->GetGUID());
(*i)->SendUpdateToPlayer(this);
m_clientGUIDs.insert((*i)->GetGUID());
#ifdef MANGOS_DEBUG
if((sLog.getLogFilter() & LOG_FILTER_VISIBILITY_CHANGES)==0)
sLog.outDebug("Object %u (Type: %u) is detected in stealth by player %u. Distance = %f",(*i)->GetGUIDLow(),(*i)->GetTypeId(),GetGUIDLow(),GetDistance(*i));
#endif
#ifdef MANGOS_DEBUG
if((sLog.getLogFilter() & LOG_FILTER_VISIBILITY_CHANGES)==0)
sLog.outDebug("Object %u (Type: %u) is detected in stealth by player %u. Distance = %f",(*i)->GetGUIDLow(),(*i)->GetTypeId(),GetGUIDLow(),GetDistance(*i));
#endif
// target aura duration for caster show only if target exist at caster client
// send data at target visibility change (adding to client)
if((*i)!=this && (*i)->isType(TYPEMASK_UNIT))
SendAurasForTarget(*i);
i = stealthedUnits.erase(i);
continue;
// target aura duration for caster show only if target exist at caster client
// send data at target visibility change (adding to client)
if((*i)!=this && (*i)->isType(TYPEMASK_UNIT))
SendAurasForTarget(*i);
}
}
else
{
if(hasAtClient)
{
(*i)->DestroyForPlayer(this);
m_clientGUIDs.erase((*i)->GetGUID());
}
}
++i;
}
}
@ -19676,13 +19691,19 @@ bool Player::IsAllowUseFlyMountsHere() const
return v_map == 530 || v_map == 571 && HasSpell(54197);
}
struct DoPlayerLearnSpell
{
DoPlayerLearnSpell(Player& _player) : player(_player) {}
void operator() (uint32 spell_id) { player.learnSpell(spell_id,false); }
Player& player;
};
void Player::learnSpellHighRank(uint32 spellid)
{
learnSpell(spellid,false);
SpellChainMapNext const& nextMap = spellmgr.GetSpellChainNext();
for(SpellChainMapNext::const_iterator itr = nextMap.lower_bound(spellid); itr != nextMap.upper_bound(spellid); ++itr)
learnSpellHighRank(itr->second);
DoPlayerLearnSpell worker(*this);
spellmgr.doForHighRanks(spellid,worker);
}
void Player::_LoadSkills()