[7083] Implement support for cast-spells in trainer lists for riding also.

This commit is contained in:
VladimirMangos 2009-01-14 02:32:24 +03:00
parent 7b6b0bb816
commit 950df723d7
5 changed files with 32 additions and 7 deletions

View file

@ -7065,7 +7065,7 @@ void ObjectMgr::LoadTrainerSpell()
if(spellinfo->Effect[i]!=SPELL_EFFECT_LEARN_SPELL)
continue;
if(SpellMgr::IsProfessionSpell(spellinfo->EffectTriggerSpell[i]))
if(SpellMgr::IsProfessionOrRidingSpell(spellinfo->EffectTriggerSpell[i]))
{
pTrainerSpell->learned_spell = spellinfo->EffectTriggerSpell[i];
break;

View file

@ -4929,7 +4929,7 @@ void Player::UpdateSkillsToMaxSkillsForLevel()
if (GetUInt32Value(PLAYER_SKILL_INDEX(i)))
{
uint32 pskill = GetUInt32Value(PLAYER_SKILL_INDEX(i)) & 0x0000FFFF;
if( IsProfessionSkill(pskill) || pskill == SKILL_RIDING )
if( IsProfessionOrRidingSkill(pskill))
continue;
uint32 data = GetUInt32Value(PLAYER_SKILL_VALUE_INDEX(i));
@ -18206,20 +18206,25 @@ bool Player::IsSpellFitByClassAndRace( uint32 spell_id ) const
SkillLineAbilityMap::const_iterator lower = spellmgr.GetBeginSkillLineAbilityMap(spell_id);
SkillLineAbilityMap::const_iterator upper = spellmgr.GetEndSkillLineAbilityMap(spell_id);
if(lower==upper)
return true;
for(SkillLineAbilityMap::const_iterator _spell_idx = lower; _spell_idx != upper; ++_spell_idx)
{
// skip wrong race skills
if( _spell_idx->second->racemask && (_spell_idx->second->racemask & racemask) == 0)
return false;
continue;
// skip wrong class skills
if( _spell_idx->second->classmask && (_spell_idx->second->classmask & classmask) == 0)
return false;
}
continue;
return true;
}
return false;
}
bool Player::HasQuestForGO(int32 GOId)
{
for( QuestStatusMap::iterator i = mQuestStatus.begin( ); i != mQuestStatus.end( ); ++i )

View file

@ -1018,7 +1018,7 @@ bool SpellMgr::canStackSpellRanks(SpellEntry const *spellInfo)
{
if(spellInfo->powerType != POWER_MANA && spellInfo->powerType != POWER_HEALTH)
return false;
if(IsProfessionSpell(spellInfo->Id))
if(IsProfessionOrRidingSpell(spellInfo->Id))
return false;
// All stance spells. if any better way, change it.
@ -1399,6 +1399,20 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons
return true;
}
bool SpellMgr::IsProfessionOrRidingSpell(uint32 spellId)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
if(!spellInfo)
return false;
if(spellInfo->Effect[1] != SPELL_EFFECT_SKILL)
return false;
uint32 skill = spellInfo->EffectMiscValue[1];
return IsProfessionOrRidingSkill(skill);
}
bool SpellMgr::IsProfessionSpell(uint32 spellId)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);

View file

@ -721,6 +721,11 @@ inline bool IsProfessionSkill(uint32 skill)
return IsPrimaryProfessionSkill(skill) || skill == SKILL_FISHING || skill == SKILL_COOKING || skill == SKILL_FIRST_AID;
}
inline bool IsProfessionOrRidingSkill(uint32 skill)
{
return IsProfessionSkill(skill) || skill == SKILL_RIDING;
}
class SpellMgr
{
// Constructors
@ -882,6 +887,7 @@ class SpellMgr
return false;
}
static bool IsProfessionOrRidingSpell(uint32 spellId);
static bool IsProfessionSpell(uint32 spellId);
static bool IsPrimaryProfessionSpell(uint32 spellId);
bool IsPrimaryProfessionFirstRankSpell(uint32 spellId) const;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "7082"
#define REVISION_NR "7083"
#endif // __REVISION_NR_H__