mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
Merge commit 'origin/master' into 320
This commit is contained in:
commit
54cc2dcb53
16 changed files with 486 additions and 38 deletions
|
|
@ -2909,7 +2909,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
|
|||
if(!rankSpellId || rankSpellId==spell_id)
|
||||
continue;
|
||||
|
||||
removeSpell(rankSpellId);
|
||||
removeSpell(rankSpellId,false,false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3158,7 +3158,7 @@ void Player::learnSpell(uint32 spell_id, bool dependent)
|
|||
GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
void Player::removeSpell(uint32 spell_id, bool disabled, bool update_action_bar_for_low_rank)
|
||||
void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
|
||||
{
|
||||
PlayerSpellMap::iterator itr = m_spells.find(spell_id);
|
||||
if (itr == m_spells.end())
|
||||
|
|
@ -3171,7 +3171,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool update_action_bar_
|
|||
SpellChainMapNext const& nextMap = spellmgr.GetSpellChainNext();
|
||||
for(SpellChainMapNext::const_iterator itr2 = nextMap.lower_bound(spell_id); itr2 != nextMap.upper_bound(spell_id); ++itr2)
|
||||
if(HasSpell(itr2->second) && !GetTalentSpellPos(itr2->second))
|
||||
removeSpell(itr2->second,disabled);
|
||||
removeSpell(itr2->second,disabled,false);
|
||||
|
||||
// re-search, it can be corrupted in prev loop
|
||||
itr = m_spells.find(spell_id);
|
||||
|
|
@ -3300,13 +3300,16 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool update_action_bar_
|
|||
{
|
||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id);
|
||||
|
||||
// if talent then lesser rank also talent and need learn
|
||||
// if talent then lesser rank also talent and need learn
|
||||
if(talentCosts)
|
||||
learnSpell (prev_id,false);
|
||||
// if ranked non-stackable spell: need activate lesser rank and update dendence state
|
||||
{
|
||||
if(learn_low_rank)
|
||||
learnSpell (prev_id,false);
|
||||
}
|
||||
// if ranked non-stackable spell: need activate lesser rank and update dendence state
|
||||
else if(cur_active && !SpellMgr::canStackSpellRanks(spellInfo) && spellmgr.GetSpellRank(spellInfo->Id) != 0)
|
||||
{
|
||||
// need manually update dependence state (learn spell ignore like attempts)
|
||||
// need manually update dependence state (learn spell ignore like attempts)
|
||||
PlayerSpellMap::iterator prev_itr = m_spells.find(prev_id);
|
||||
if (prev_itr != m_spells.end())
|
||||
{
|
||||
|
|
@ -3318,19 +3321,16 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool update_action_bar_
|
|||
}
|
||||
|
||||
// now re-learn if need re-activate
|
||||
if(cur_active && !prev_itr->second->active)
|
||||
if(cur_active && !prev_itr->second->active && learn_low_rank)
|
||||
{
|
||||
if(addSpell(prev_id,true,false,prev_itr->second->dependent,prev_itr->second->disabled))
|
||||
{
|
||||
if(update_action_bar_for_low_rank)
|
||||
{
|
||||
// downgrade spell ranks in spellbook and action bar
|
||||
WorldPacket data(SMSG_SUPERCEDED_SPELL, 4 + 4);
|
||||
data << uint32(spell_id);
|
||||
data << uint32(prev_id);
|
||||
GetSession()->SendPacket( &data );
|
||||
prev_activate = true;
|
||||
}
|
||||
// downgrade spell ranks in spellbook and action bar
|
||||
WorldPacket data(SMSG_SUPERCEDED_SPELL, 4 + 4);
|
||||
data << uint32(spell_id);
|
||||
data << uint32(prev_id);
|
||||
GetSession()->SendPacket( &data );
|
||||
prev_activate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3537,7 +3537,13 @@ bool Player::resetTalents(bool no_cost)
|
|||
uint32 itrFirstId = spellmgr.GetFirstSpellInChain(itr->first);
|
||||
|
||||
// unlearn if first rank is talent or learned by talent
|
||||
if (itrFirstId == talentInfo->RankID[j] || spellmgr.IsSpellLearnToSpell(talentInfo->RankID[j],itrFirstId))
|
||||
if (itrFirstId == talentInfo->RankID[j])
|
||||
{
|
||||
removeSpell(itr->first,!IsPassiveSpell(itr->first),false);
|
||||
itr = GetSpellMap().begin();
|
||||
continue;
|
||||
}
|
||||
else if (spellmgr.IsSpellLearnToSpell(talentInfo->RankID[j],itrFirstId))
|
||||
{
|
||||
removeSpell(itr->first,!IsPassiveSpell(itr->first));
|
||||
itr = GetSpellMap().begin();
|
||||
|
|
@ -18224,7 +18230,7 @@ void Player::resetSpells()
|
|||
PlayerSpellMap smap = GetSpellMap();
|
||||
|
||||
for(PlayerSpellMap::const_iterator iter = smap.begin();iter != smap.end(); ++iter)
|
||||
removeSpell(iter->first); // only iter->first can be accessed, object by iter->second can be deleted already
|
||||
removeSpell(iter->first,false,false); // only iter->first can be accessed, object by iter->second can be deleted already
|
||||
|
||||
learnDefaultSpells();
|
||||
learnQuestRewardedSpells();
|
||||
|
|
@ -19395,6 +19401,7 @@ void Player::EnterVehicle(Vehicle *vehicle)
|
|||
SetFarSightGUID(vehicle->GetGUID()); // set view
|
||||
|
||||
SetClientControl(vehicle, 1); // redirect controls to vehicle
|
||||
SetMover(vehicle);
|
||||
|
||||
WorldPacket data(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0);
|
||||
GetSession()->SendPacket(&data);
|
||||
|
|
@ -19446,6 +19453,7 @@ void Player::ExitVehicle(Vehicle *vehicle)
|
|||
SetFarSightGUID(0);
|
||||
|
||||
SetClientControl(vehicle, 0);
|
||||
SetMover(NULL);
|
||||
|
||||
WorldPacket data(MSG_MOVE_TELEPORT_ACK, 30);
|
||||
data.append(GetPackGUID());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue