mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[8426] Use upper/lower iterator pairs as result instead 2 function calls.
This commit is contained in:
parent
fdb2842f60
commit
5d50bb16b8
9 changed files with 139 additions and 173 deletions
|
|
@ -1242,9 +1242,8 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
|
||||||
spellIter != GetPlayer()->GetSpellMap().end();
|
spellIter != GetPlayer()->GetSpellMap().end();
|
||||||
++spellIter)
|
++spellIter)
|
||||||
{
|
{
|
||||||
for(SkillLineAbilityMap::const_iterator skillIter = spellmgr.GetBeginSkillLineAbilityMap(spellIter->first);
|
SkillLineAbilityMapBounds bounds = spellmgr.GetSkillLineAbilityMapBounds(spellIter->first);
|
||||||
skillIter != spellmgr.GetEndSkillLineAbilityMap(spellIter->first);
|
for(SkillLineAbilityMap::const_iterator skillIter = bounds.first; skillIter != bounds.second; ++skillIter)
|
||||||
++skillIter)
|
|
||||||
{
|
{
|
||||||
if(skillIter->second->skillId == achievementCriteria->learn_skillline_spell.skillLine)
|
if(skillIter->second->skillId == achievementCriteria->learn_skillline_spell.skillLine)
|
||||||
spellCount++;
|
spellCount++;
|
||||||
|
|
@ -1309,14 +1308,11 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
|
||||||
spellIter != GetPlayer()->GetSpellMap().end();
|
spellIter != GetPlayer()->GetSpellMap().end();
|
||||||
++spellIter)
|
++spellIter)
|
||||||
{
|
{
|
||||||
for(SkillLineAbilityMap::const_iterator skillIter = spellmgr.GetBeginSkillLineAbilityMap(spellIter->first);
|
SkillLineAbilityMapBounds bounds = spellmgr.GetSkillLineAbilityMapBounds(spellIter->first);
|
||||||
skillIter != spellmgr.GetEndSkillLineAbilityMap(spellIter->first);
|
for(SkillLineAbilityMap::const_iterator skillIter = bounds.first; skillIter != bounds.second; ++skillIter)
|
||||||
++skillIter)
|
|
||||||
{
|
|
||||||
if (skillIter->second->skillId == achievementCriteria->learn_skill_line.skillLine)
|
if (skillIter->second->skillId == achievementCriteria->learn_skill_line.skillLine)
|
||||||
spellCount++;
|
spellCount++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
SetCriteriaProgress(achievementCriteria, spellCount);
|
SetCriteriaProgress(achievementCriteria, spellCount);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1368,15 +1368,13 @@ valid examples:
|
||||||
if (linkedSpell->Attributes & SPELL_ATTR_TRADESPELL)
|
if (linkedSpell->Attributes & SPELL_ATTR_TRADESPELL)
|
||||||
{
|
{
|
||||||
// lookup skillid
|
// lookup skillid
|
||||||
SkillLineAbilityMap::const_iterator lower = spellmgr.GetBeginSkillLineAbilityMap(linkedSpell->Id);
|
SkillLineAbilityMapBounds bounds = spellmgr.GetSkillLineAbilityMapBounds(linkedSpell->Id);
|
||||||
SkillLineAbilityMap::const_iterator upper = spellmgr.GetEndSkillLineAbilityMap(linkedSpell->Id);
|
if (bounds.first == bounds.second)
|
||||||
|
|
||||||
if(lower == upper)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SkillLineAbilityEntry const *skillInfo = lower->second;
|
SkillLineAbilityEntry const *skillInfo = bounds.first->second;
|
||||||
|
|
||||||
if (!skillInfo)
|
if (!skillInfo)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2028,10 +2028,8 @@ void ObjectMgr::LoadItemRequiredTarget()
|
||||||
if (pItemProto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_USE ||
|
if (pItemProto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_USE ||
|
||||||
pItemProto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE)
|
pItemProto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE)
|
||||||
{
|
{
|
||||||
SpellScriptTarget::const_iterator lower = spellmgr.GetBeginSpellScriptTarget(pSpellInfo->Id);
|
SpellScriptTargetBounds bounds = spellmgr.GetSpellScriptTargetBounds(pSpellInfo->Id);
|
||||||
SpellScriptTarget::const_iterator upper = spellmgr.GetEndSpellScriptTarget(pSpellInfo->Id);
|
if (bounds.first != bounds.second)
|
||||||
|
|
||||||
if (lower != upper)
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
for (int j = 0; j < 3; ++j)
|
for (int j = 0; j < 3; ++j)
|
||||||
|
|
|
||||||
|
|
@ -3031,8 +3031,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
|
||||||
|
|
||||||
SpellLearnSkillNode const* spellLearnSkill = spellmgr.GetSpellLearnSkill(spell_id);
|
SpellLearnSkillNode const* spellLearnSkill = spellmgr.GetSpellLearnSkill(spell_id);
|
||||||
|
|
||||||
SkillLineAbilityMap::const_iterator lower = spellmgr.GetBeginSkillLineAbilityMap(spell_id);
|
SkillLineAbilityMapBounds skill_bounds = spellmgr.GetSkillLineAbilityMapBounds(spell_id);
|
||||||
SkillLineAbilityMap::const_iterator upper = spellmgr.GetEndSkillLineAbilityMap(spell_id);
|
|
||||||
|
|
||||||
if (spellLearnSkill)
|
if (spellLearnSkill)
|
||||||
{
|
{
|
||||||
|
|
@ -3052,7 +3051,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// not ranked skills
|
// not ranked skills
|
||||||
for(SkillLineAbilityMap::const_iterator _spell_idx = lower; _spell_idx != upper; ++_spell_idx)
|
for(SkillLineAbilityMap::const_iterator _spell_idx = skill_bounds.first; _spell_idx != skill_bounds.second; ++_spell_idx)
|
||||||
{
|
{
|
||||||
SkillLineEntry const *pSkill = sSkillLineStore.LookupEntry(_spell_idx->second->skillId);
|
SkillLineEntry const *pSkill = sSkillLineStore.LookupEntry(_spell_idx->second->skillId);
|
||||||
if (!pSkill)
|
if (!pSkill)
|
||||||
|
|
@ -3084,10 +3083,9 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
|
||||||
}
|
}
|
||||||
|
|
||||||
// learn dependent spells
|
// learn dependent spells
|
||||||
SpellLearnSpellMap::const_iterator spell_begin = spellmgr.GetBeginSpellLearnSpell(spell_id);
|
SpellLearnSpellMapBounds spell_bounds = spellmgr.GetSpellLearnSpellMapBounds(spell_id);
|
||||||
SpellLearnSpellMap::const_iterator spell_end = spellmgr.GetEndSpellLearnSpell(spell_id);
|
|
||||||
|
|
||||||
for(SpellLearnSpellMap::const_iterator itr2 = spell_begin; itr2 != spell_end; ++itr2)
|
for(SpellLearnSpellMap::const_iterator itr2 = spell_bounds.first; itr2 != spell_bounds.second; ++itr2)
|
||||||
{
|
{
|
||||||
if (!itr2->second.autoLearned)
|
if (!itr2->second.autoLearned)
|
||||||
{
|
{
|
||||||
|
|
@ -3101,7 +3099,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
|
||||||
if (!GetSession()->PlayerLoading())
|
if (!GetSession()->PlayerLoading())
|
||||||
{
|
{
|
||||||
// not ranked skills
|
// not ranked skills
|
||||||
for(SkillLineAbilityMap::const_iterator _spell_idx = lower; _spell_idx != upper; ++_spell_idx)
|
for(SkillLineAbilityMap::const_iterator _spell_idx = skill_bounds.first; _spell_idx != skill_bounds.second; ++_spell_idx)
|
||||||
{
|
{
|
||||||
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE,_spell_idx->second->skillId);
|
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE,_spell_idx->second->skillId);
|
||||||
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS,_spell_idx->second->skillId);
|
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS,_spell_idx->second->skillId);
|
||||||
|
|
@ -3259,10 +3257,9 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// not ranked skills
|
// not ranked skills
|
||||||
SkillLineAbilityMap::const_iterator lower = spellmgr.GetBeginSkillLineAbilityMap(spell_id);
|
SkillLineAbilityMapBounds bounds = spellmgr.GetSkillLineAbilityMapBounds(spell_id);
|
||||||
SkillLineAbilityMap::const_iterator upper = spellmgr.GetEndSkillLineAbilityMap(spell_id);
|
|
||||||
|
|
||||||
for(SkillLineAbilityMap::const_iterator _spell_idx = lower; _spell_idx != upper; ++_spell_idx)
|
for(SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx)
|
||||||
{
|
{
|
||||||
SkillLineEntry const *pSkill = sSkillLineStore.LookupEntry(_spell_idx->second->skillId);
|
SkillLineEntry const *pSkill = sSkillLineStore.LookupEntry(_spell_idx->second->skillId);
|
||||||
if (!pSkill)
|
if (!pSkill)
|
||||||
|
|
@ -3283,10 +3280,9 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove dependent spells
|
// remove dependent spells
|
||||||
SpellLearnSpellMap::const_iterator spell_begin = spellmgr.GetBeginSpellLearnSpell(spell_id);
|
SpellLearnSpellMapBounds spell_bounds = spellmgr.GetSpellLearnSpellMapBounds(spell_id);
|
||||||
SpellLearnSpellMap::const_iterator spell_end = spellmgr.GetEndSpellLearnSpell(spell_id);
|
|
||||||
|
|
||||||
for(SpellLearnSpellMap::const_iterator itr2 = spell_begin; itr2 != spell_end; ++itr2)
|
for(SpellLearnSpellMap::const_iterator itr2 = spell_bounds.first; itr2 != spell_bounds.second; ++itr2)
|
||||||
removeSpell(itr2->second.spell, disabled);
|
removeSpell(itr2->second.spell, disabled);
|
||||||
|
|
||||||
// activate lesser rank in spellbook/action bar, and cast it if need
|
// activate lesser rank in spellbook/action bar, and cast it if need
|
||||||
|
|
@ -5043,10 +5039,9 @@ bool Player::UpdateCraftSkill(uint32 spellid)
|
||||||
{
|
{
|
||||||
sLog.outDebug("UpdateCraftSkill spellid %d", spellid);
|
sLog.outDebug("UpdateCraftSkill spellid %d", spellid);
|
||||||
|
|
||||||
SkillLineAbilityMap::const_iterator lower = spellmgr.GetBeginSkillLineAbilityMap(spellid);
|
SkillLineAbilityMapBounds bounds = spellmgr.GetSkillLineAbilityMapBounds(spellid);
|
||||||
SkillLineAbilityMap::const_iterator upper = spellmgr.GetEndSkillLineAbilityMap(spellid);
|
|
||||||
|
|
||||||
for(SkillLineAbilityMap::const_iterator _spell_idx = lower; _spell_idx != upper; ++_spell_idx)
|
for(SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx)
|
||||||
{
|
{
|
||||||
if (_spell_idx->second->skillId)
|
if (_spell_idx->second->skillId)
|
||||||
{
|
{
|
||||||
|
|
@ -18584,12 +18579,11 @@ bool Player::IsSpellFitByClassAndRace( uint32 spell_id ) const
|
||||||
uint32 racemask = getRaceMask();
|
uint32 racemask = getRaceMask();
|
||||||
uint32 classmask = getClassMask();
|
uint32 classmask = getClassMask();
|
||||||
|
|
||||||
SkillLineAbilityMap::const_iterator lower = spellmgr.GetBeginSkillLineAbilityMap(spell_id);
|
SkillLineAbilityMapBounds bounds = spellmgr.GetSkillLineAbilityMapBounds(spell_id);
|
||||||
SkillLineAbilityMap::const_iterator upper = spellmgr.GetEndSkillLineAbilityMap(spell_id);
|
if (bounds.first==bounds.second)
|
||||||
if(lower==upper)
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
for(SkillLineAbilityMap::const_iterator _spell_idx = lower; _spell_idx != upper; ++_spell_idx)
|
for(SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx)
|
||||||
{
|
{
|
||||||
// skip wrong race skills
|
// skip wrong race skills
|
||||||
if (_spell_idx->second->racemask && (_spell_idx->second->racemask & racemask) == 0)
|
if (_spell_idx->second->racemask && (_spell_idx->second->racemask & racemask) == 0)
|
||||||
|
|
|
||||||
|
|
@ -116,20 +116,17 @@ void LoadSkillDiscoveryTable()
|
||||||
}
|
}
|
||||||
else if (reqSkillOrSpell == 0) // skill case
|
else if (reqSkillOrSpell == 0) // skill case
|
||||||
{
|
{
|
||||||
SkillLineAbilityMap::const_iterator lower = spellmgr.GetBeginSkillLineAbilityMap(spellId);
|
SkillLineAbilityMapBounds bounds = spellmgr.GetSkillLineAbilityMapBounds(spellId);
|
||||||
SkillLineAbilityMap::const_iterator upper = spellmgr.GetEndSkillLineAbilityMap(spellId);
|
|
||||||
|
|
||||||
if(lower==upper)
|
if (bounds.first==bounds.second)
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Spell (ID: %u) not listed in `SkillLineAbility.dbc` but listed with `reqSpell`=0 in `skill_discovery_template` table",spellId);
|
sLog.outErrorDb("Spell (ID: %u) not listed in `SkillLineAbility.dbc` but listed with `reqSpell`=0 in `skill_discovery_template` table",spellId);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(SkillLineAbilityMap::const_iterator _spell_idx = lower; _spell_idx != upper; ++_spell_idx)
|
for(SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx)
|
||||||
{
|
|
||||||
SkillDiscoveryStore[-int32(_spell_idx->second->skillId)].push_back( SkillDiscoveryEntry(spellId, reqSkillValue, chance) );
|
SkillDiscoveryStore[-int32(_spell_idx->second->skillId)].push_back( SkillDiscoveryEntry(spellId, reqSkillValue, chance) );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Spell (ID: %u) have negative value in `reqSpell` field in `skill_discovery_template` table",spellId);
|
sLog.outErrorDb("Spell (ID: %u) have negative value in `reqSpell` field in `skill_discovery_template` table",spellId);
|
||||||
|
|
@ -170,9 +167,8 @@ uint32 GetExplicitDiscoverySpell(uint32 spellId, Player* player)
|
||||||
if (tab == SkillDiscoveryStore.end())
|
if (tab == SkillDiscoveryStore.end())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
SkillLineAbilityMap::const_iterator lower = spellmgr.GetBeginSkillLineAbilityMap(spellId);
|
SkillLineAbilityMapBounds bounds = spellmgr.GetSkillLineAbilityMapBounds(spellId);
|
||||||
SkillLineAbilityMap::const_iterator upper = spellmgr.GetEndSkillLineAbilityMap(spellId);
|
uint32 skillvalue = bounds.first != bounds.second ? player->GetSkillValue(bounds.first->second->skillId) : 0;
|
||||||
uint32 skillvalue = lower != upper ? player->GetSkillValue(lower->second->skillId) : 0;
|
|
||||||
|
|
||||||
float full_chance = 0;
|
float full_chance = 0;
|
||||||
for(SkillDiscoveryList::const_iterator item_iter = tab->second.begin(); item_iter != tab->second.end(); ++item_iter)
|
for(SkillDiscoveryList::const_iterator item_iter = tab->second.begin(); item_iter != tab->second.end(); ++item_iter)
|
||||||
|
|
|
||||||
|
|
@ -4016,9 +4016,8 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||||
m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT_COORDINATES ||
|
m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT_COORDINATES ||
|
||||||
m_spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT_COORDINATES )
|
m_spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT_COORDINATES )
|
||||||
{
|
{
|
||||||
SpellScriptTarget::const_iterator lower = spellmgr.GetBeginSpellScriptTarget(m_spellInfo->Id);
|
SpellScriptTargetBounds bounds = spellmgr.GetSpellScriptTargetBounds(m_spellInfo->Id);
|
||||||
SpellScriptTarget::const_iterator upper = spellmgr.GetEndSpellScriptTarget(m_spellInfo->Id);
|
if(bounds.first==bounds.second)
|
||||||
if(lower==upper)
|
|
||||||
sLog.outErrorDb("Spell (ID: %u) has effect EffectImplicitTargetA/EffectImplicitTargetB = TARGET_SCRIPT or TARGET_SCRIPT_COORDINATES, but does not have record in `spell_script_target`",m_spellInfo->Id);
|
sLog.outErrorDb("Spell (ID: %u) has effect EffectImplicitTargetA/EffectImplicitTargetB = TARGET_SCRIPT or TARGET_SCRIPT_COORDINATES, but does not have record in `spell_script_target`",m_spellInfo->Id);
|
||||||
|
|
||||||
SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex);
|
SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex);
|
||||||
|
|
@ -4027,7 +4026,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||||
Creature* creatureScriptTarget = NULL;
|
Creature* creatureScriptTarget = NULL;
|
||||||
GameObject* goScriptTarget = NULL;
|
GameObject* goScriptTarget = NULL;
|
||||||
|
|
||||||
for(SpellScriptTarget::const_iterator i_spellST = lower; i_spellST != upper; ++i_spellST)
|
for(SpellScriptTarget::const_iterator i_spellST = bounds.first; i_spellST != bounds.second; ++i_spellST)
|
||||||
{
|
{
|
||||||
switch(i_spellST->second.type)
|
switch(i_spellST->second.type)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1693,10 +1693,9 @@ bool SpellMgr::IsPrimaryProfessionFirstRankSpell(uint32 spellId) const
|
||||||
|
|
||||||
bool SpellMgr::IsSkillBonusSpell(uint32 spellId) const
|
bool SpellMgr::IsSkillBonusSpell(uint32 spellId) const
|
||||||
{
|
{
|
||||||
SkillLineAbilityMap::const_iterator lower = GetBeginSkillLineAbilityMap(spellId);
|
SkillLineAbilityMapBounds bounds = GetSkillLineAbilityMapBounds(spellId);
|
||||||
SkillLineAbilityMap::const_iterator upper = GetEndSkillLineAbilityMap(spellId);
|
|
||||||
|
|
||||||
for(SkillLineAbilityMap::const_iterator _spell_idx = lower; _spell_idx != upper; ++_spell_idx)
|
for(SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx)
|
||||||
{
|
{
|
||||||
SkillLineAbilityEntry const *pAbility = _spell_idx->second;
|
SkillLineAbilityEntry const *pAbility = _spell_idx->second;
|
||||||
if (!pAbility || pAbility->learnOnGetSkill != ABILITY_LEARNED_ON_GET_PROFESSION_SKILL)
|
if (!pAbility || pAbility->learnOnGetSkill != ABILITY_LEARNED_ON_GET_PROFESSION_SKILL)
|
||||||
|
|
@ -2041,11 +2040,10 @@ void SpellMgr::LoadSpellLearnSpells()
|
||||||
// other required explicit dependent learning
|
// other required explicit dependent learning
|
||||||
dbc_node.autoLearned = entry->EffectImplicitTargetA[i]==TARGET_PET || GetTalentSpellCost(spell) > 0 || IsPassiveSpell(spell) || IsSpellHaveEffect(entry,SPELL_EFFECT_SKILL_STEP);
|
dbc_node.autoLearned = entry->EffectImplicitTargetA[i]==TARGET_PET || GetTalentSpellCost(spell) > 0 || IsPassiveSpell(spell) || IsSpellHaveEffect(entry,SPELL_EFFECT_SKILL_STEP);
|
||||||
|
|
||||||
SpellLearnSpellMap::const_iterator db_node_begin = GetBeginSpellLearnSpell(spell);
|
SpellLearnSpellMapBounds db_node_bounds = GetSpellLearnSpellMapBounds(spell);
|
||||||
SpellLearnSpellMap::const_iterator db_node_end = GetEndSpellLearnSpell(spell);
|
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for(SpellLearnSpellMap::const_iterator itr = db_node_begin; itr != db_node_end; ++itr)
|
for(SpellLearnSpellMap::const_iterator itr = db_node_bounds.first; itr != db_node_bounds.second; ++itr)
|
||||||
{
|
{
|
||||||
if (itr->second.spell == dbc_node.spell)
|
if (itr->second.spell == dbc_node.spell)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -545,6 +545,7 @@ struct SpellTargetEntry
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::multimap<uint32,SpellTargetEntry> SpellScriptTarget;
|
typedef std::multimap<uint32,SpellTargetEntry> SpellScriptTarget;
|
||||||
|
typedef std::pair<SpellScriptTarget::const_iterator,SpellScriptTarget::const_iterator> SpellScriptTargetBounds;
|
||||||
|
|
||||||
// coordinates for spells (accessed using SpellMgr functions)
|
// coordinates for spells (accessed using SpellMgr functions)
|
||||||
struct SpellTargetPosition
|
struct SpellTargetPosition
|
||||||
|
|
@ -666,8 +667,10 @@ struct SpellLearnSpellNode
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::multimap<uint32, SpellLearnSpellNode> SpellLearnSpellMap;
|
typedef std::multimap<uint32, SpellLearnSpellNode> SpellLearnSpellMap;
|
||||||
|
typedef std::pair<SpellLearnSpellMap::const_iterator,SpellLearnSpellMap::const_iterator> SpellLearnSpellMapBounds;
|
||||||
|
|
||||||
typedef std::multimap<uint32, SkillLineAbilityEntry const*> SkillLineAbilityMap;
|
typedef std::multimap<uint32, SkillLineAbilityEntry const*> SkillLineAbilityMap;
|
||||||
|
typedef std::pair<SkillLineAbilityMap::const_iterator,SkillLineAbilityMap::const_iterator> SkillLineAbilityMapBounds;
|
||||||
|
|
||||||
typedef std::multimap<uint32, uint32> PetLevelupSpellSet;
|
typedef std::multimap<uint32, uint32> PetLevelupSpellSet;
|
||||||
typedef std::map<uint32, PetLevelupSpellSet> PetLevelupSpellMap;
|
typedef std::map<uint32, PetLevelupSpellSet> PetLevelupSpellMap;
|
||||||
|
|
@ -883,21 +886,15 @@ class SpellMgr
|
||||||
return mSpellLearnSpells.find(spell_id) != mSpellLearnSpells.end();
|
return mSpellLearnSpells.find(spell_id) != mSpellLearnSpells.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
SpellLearnSpellMap::const_iterator GetBeginSpellLearnSpell(uint32 spell_id) const
|
SpellLearnSpellMapBounds GetSpellLearnSpellMapBounds(uint32 spell_id) const
|
||||||
{
|
{
|
||||||
return mSpellLearnSpells.lower_bound(spell_id);
|
return SpellLearnSpellMapBounds(mSpellLearnSpells.lower_bound(spell_id),mSpellLearnSpells.upper_bound(spell_id));
|
||||||
}
|
|
||||||
|
|
||||||
SpellLearnSpellMap::const_iterator GetEndSpellLearnSpell(uint32 spell_id) const
|
|
||||||
{
|
|
||||||
return mSpellLearnSpells.upper_bound(spell_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsSpellLearnToSpell(uint32 spell_id1,uint32 spell_id2) const
|
bool IsSpellLearnToSpell(uint32 spell_id1,uint32 spell_id2) const
|
||||||
{
|
{
|
||||||
SpellLearnSpellMap::const_iterator b = GetBeginSpellLearnSpell(spell_id1);
|
SpellLearnSpellMapBounds bounds = GetSpellLearnSpellMapBounds(spell_id1);
|
||||||
SpellLearnSpellMap::const_iterator e = GetEndSpellLearnSpell(spell_id1);
|
for(SpellLearnSpellMap::const_iterator i = bounds.first; i != bounds.second; ++i)
|
||||||
for(SpellLearnSpellMap::const_iterator i = b; i != e; ++i)
|
|
||||||
if (i->second.spell==spell_id2)
|
if (i->second.spell==spell_id2)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -912,27 +909,17 @@ class SpellMgr
|
||||||
|
|
||||||
|
|
||||||
// Spell script targets
|
// Spell script targets
|
||||||
SpellScriptTarget::const_iterator GetBeginSpellScriptTarget(uint32 spell_id) const
|
SpellScriptTargetBounds GetSpellScriptTargetBounds(uint32 spell_id) const
|
||||||
{
|
{
|
||||||
return mSpellScriptTarget.lower_bound(spell_id);
|
return SpellScriptTargetBounds(mSpellScriptTarget.lower_bound(spell_id),mSpellScriptTarget.upper_bound(spell_id));
|
||||||
}
|
|
||||||
|
|
||||||
SpellScriptTarget::const_iterator GetEndSpellScriptTarget(uint32 spell_id) const
|
|
||||||
{
|
|
||||||
return mSpellScriptTarget.upper_bound(spell_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Spell correctess for client using
|
// Spell correctess for client using
|
||||||
static bool IsSpellValid(SpellEntry const * spellInfo, Player* pl = NULL, bool msg = true);
|
static bool IsSpellValid(SpellEntry const * spellInfo, Player* pl = NULL, bool msg = true);
|
||||||
|
|
||||||
SkillLineAbilityMap::const_iterator GetBeginSkillLineAbilityMap(uint32 spell_id) const
|
SkillLineAbilityMapBounds GetSkillLineAbilityMapBounds(uint32 spell_id) const
|
||||||
{
|
{
|
||||||
return mSkillLineAbilityMap.lower_bound(spell_id);
|
return SkillLineAbilityMapBounds(mSkillLineAbilityMap.lower_bound(spell_id),mSkillLineAbilityMap.upper_bound(spell_id));
|
||||||
}
|
|
||||||
|
|
||||||
SkillLineAbilityMap::const_iterator GetEndSkillLineAbilityMap(uint32 spell_id) const
|
|
||||||
{
|
|
||||||
return mSkillLineAbilityMap.upper_bound(spell_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PetAura const* GetPetAura(uint32 spell_id, uint8 eff)
|
PetAura const* GetPetAura(uint32 spell_id, uint8 eff)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "8425"
|
#define REVISION_NR "8426"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue