Merge pull request #81 from H0zen/develop21

Fix displaying the right ranks of spells in spellbook
This commit is contained in:
Antz 2016-02-16 15:08:20 +00:00
commit d721f96076
5 changed files with 28 additions and 42 deletions

View File

@ -2845,15 +2845,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
}
else if (IsInWorld())
{
if (next_active_spell_id)
{
// update spell ranks in spellbook and action bar
WorldPacket data(SMSG_SUPERCEDED_SPELL, (4));
data << uint16(spell_id);
data << uint16(next_active_spell_id);
GetSession()->SendPacket(&data);
}
else
if (!next_active_spell_id)
{
WorldPacket data(SMSG_REMOVED_SPELL, 4);
data << uint16(spell_id);
@ -2931,8 +2923,10 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
newspell.dependent = dependent;
newspell.disabled = disabled;
bool canAddToSpellBook = true;
// replace spells in action bars and spellbook to bigger rank if only one spell rank must be accessible
if (newspell.active && !newspell.disabled && sSpellMgr.IsRankedSpellNonStackableInSpellBook(spellInfo))
if (newspell.active && !newspell.disabled)
{
for (PlayerSpellMap::iterator itr2 = m_spells.begin(); itr2 != m_spells.end(); ++itr2)
{
@ -2946,7 +2940,8 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
{
if (playerSpell2.active)
{
if (sSpellMgr.IsHighRankOfSpell(spell_id, itr2->first))
if (sSpellMgr.IsHighRankOfSpell(spell_id, itr2->first) &&
sSpellMgr.IsRankedSpellNonStackableInSpellBook(i_spellInfo))
{
if (IsInWorld()) // not send spell (re-/over-)learn packets at loading
{
@ -2960,8 +2955,11 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
playerSpell2.active = false;
if (playerSpell2.state != PLAYERSPELL_NEW)
{ playerSpell2.state = PLAYERSPELL_CHANGED; }
canAddToSpellBook = false;
}
else if (sSpellMgr.IsHighRankOfSpell(itr2->first, spell_id))
else if (sSpellMgr.IsHighRankOfSpell(itr2->first, spell_id) &&
sSpellMgr.IsRankedSpellNonStackableInSpellBook(spellInfo))
{
if (IsInWorld()) // not send spell (re-/over-)learn packets at loading
{
@ -2975,6 +2973,8 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
newspell.active = false;
if (newspell.state != PLAYERSPELL_NEW)
{ newspell.state = PLAYERSPELL_CHANGED; }
canAddToSpellBook = false;
}
}
}
@ -2983,8 +2983,8 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
m_spells[spell_id] = newspell;
// return false if spell disabled
if (newspell.disabled)
// return false if spell disabled or spell is non-stackable in spellbook
if (newspell.disabled || !canAddToSpellBook)
{ return false; }
}

View File

@ -1958,30 +1958,15 @@ bool SpellMgr::canStackSpellRanksInSpellBook(SpellEntry const* spellInfo) const
if (IsSkillBonusSpell(spellInfo->Id))
{ return false; }
// All stance spells. if any better way, change it.
for (int i = 0; i < MAX_EFFECT_INDEX; ++i)
// Any spell which has skill forward spell
// Include party auras from paladins, stealth from rogues, shapeshift spells for druids...and more :)
SkillLineAbilityMap::const_iterator itr = mSkillLineAbilityMap.find(spellInfo->Id);
if (itr != mSkillLineAbilityMap.end())
{
switch (spellInfo->SpellFamilyName)
{
case SPELLFAMILY_PALADIN:
// Paladin aura Spell
if (spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_PARTY)
{ return false; }
break;
case SPELLFAMILY_DRUID:
// Druid form Spell
if (spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA &&
spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_SHAPESHIFT)
{ return false; }
break;
case SPELLFAMILY_ROGUE:
// Rogue Stealth
if (spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA &&
spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_SHAPESHIFT)
{ return false; }
break;
}
if (itr->second->forward_spellid != 0)
{ return false; }
}
return true;
}

View File

@ -2274,8 +2274,8 @@ void Spell::EffectLearnSpell(SpellEffectIndex eff_idx)
}
Player* player = (Player*)unitTarget;
uint32 spellToLearn = m_spellInfo->EffectTriggerSpell[eff_idx];
player->learnSpell(spellToLearn, false);
if (WorldObject const* caster = GetCastingObject())

View File

@ -706,6 +706,7 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit* pVictim, uint32 damage, Aura
uint32 spellId;
switch (triggeredByAura->GetId())
{
case 20154:
case 21084: spellId = 25742; break; // Rank 1
case 20287: spellId = 25740; break; // Rank 2
case 20288: spellId = 25739; break; // Rank 3

View File

@ -32,12 +32,12 @@
#define REALMD_DB_UPDATE_DESCRIPTION "dbdocs update"
#define CHAR_DB_VERSION_NR 21
#define CHAR_DB_STRUCTURE_NR 2
#define CHAR_DB_STRUCTURE_NR 3
#define CHAR_DB_CONTENT_NR 1
#define CHAR_DB_UPDATE_DESCRIPTION "Characters dbdocs update"
#define CHAR_DB_UPDATE_DESCRIPTION "Fix SoR paladin"
#define WORLD_DB_VERSION_NR 21
#define WORLD_DB_STRUCTURE_NR 2
#define WORLD_DB_CONTENT_NR 3
#define WORLD_DB_UPDATE_DESCRIPTION "NPC 15213 event_ai fix"
#define WORLD_DB_STRUCTURE_NR 3
#define WORLD_DB_CONTENT_NR 1
#define WORLD_DB_UPDATE_DESCRIPTION "Fix SoR paladin"
#endif // __REVISION_H__