mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[7478] Avoid rescan data at some achievments triggering for speed.
Only if chnage can affect result * ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL * ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS * ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION * ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION if
This commit is contained in:
parent
4215b65b8c
commit
2215f77ec3
3 changed files with 30 additions and 9 deletions
|
|
@ -689,7 +689,10 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
|
|||
SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE);
|
||||
break;
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL:
|
||||
if(GetPlayer()->HasSpell(achievementCriteria->learn_spell.spellID))
|
||||
// spell always provide and at login spell learning.
|
||||
if(miscvalue1 && miscvalue1!=achievementCriteria->learn_spell.spellID)
|
||||
continue;
|
||||
if(GetPlayer()->HasSpell(miscvalue1))
|
||||
SetCriteriaProgress(achievementCriteria, 1);
|
||||
break;
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM:
|
||||
|
|
@ -736,6 +739,10 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
|
|||
break;
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION:
|
||||
{
|
||||
// skip faction check only at loading
|
||||
if (miscvalue1 && miscvalue1 != achievementCriteria->gain_reputation.factionID)
|
||||
continue;
|
||||
|
||||
int32 reputation = GetPlayer()->GetReputation(achievementCriteria->gain_reputation.factionID);
|
||||
if (reputation > 0)
|
||||
SetCriteriaProgress(achievementCriteria, reputation);
|
||||
|
|
@ -743,6 +750,10 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
|
|||
}
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION:
|
||||
{
|
||||
// skip faction check only at loading
|
||||
if (miscvalue1 && GetPlayer()->GetReputationRank(miscvalue1) < REP_EXALTED)
|
||||
continue;
|
||||
|
||||
uint32 counter = 0;
|
||||
const FactionStateList factionStateList = GetPlayer()->GetFactionStateList();
|
||||
for (FactionStateList::const_iterator iter = factionStateList.begin(); iter!= factionStateList.end(); ++iter)
|
||||
|
|
@ -817,6 +828,16 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
|
|||
break;
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS:
|
||||
{
|
||||
// spell always provide and at login spell learning.
|
||||
if(!miscvalue1)
|
||||
continue;
|
||||
// rescan only when change possible
|
||||
SkillLineAbilityMap::const_iterator skillIter0 = spellmgr.GetBeginSkillLineAbilityMap(miscvalue1);
|
||||
if(skillIter0 == spellmgr.GetEndSkillLineAbilityMap(miscvalue1))
|
||||
continue;
|
||||
if(skillIter0->second->skillId != achievementCriteria->learn_skilline_spell.skillLine)
|
||||
continue;
|
||||
|
||||
uint32 spellCount = 0;
|
||||
for (PlayerSpellMap::const_iterator spellIter = GetPlayer()->GetSpellMap().begin();
|
||||
spellIter != GetPlayer()->GetSpellMap().end();
|
||||
|
|
|
|||
|
|
@ -2933,8 +2933,8 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
|
|||
|
||||
if(IsInWorld())
|
||||
{
|
||||
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL);
|
||||
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS);
|
||||
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL,spell_id);
|
||||
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS,spell_id);
|
||||
}
|
||||
|
||||
// return true (for send learn packet) only if spell active (in case ranked spells) and not replace old spell
|
||||
|
|
@ -5949,8 +5949,8 @@ bool Player::ModifyOneFactionReputation(FactionEntry const* factionEntry, int32
|
|||
}
|
||||
}
|
||||
}
|
||||
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION);
|
||||
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION);
|
||||
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION,factionEntry->ID);
|
||||
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION,factionEntry->ID);
|
||||
SendFactionState(&(itr->second));
|
||||
|
||||
return true;
|
||||
|
|
@ -6016,8 +6016,8 @@ bool Player::SetOneFactionReputation(FactionEntry const* factionEntry, int32 sta
|
|||
SetFactionAtWar(&itr->second,true);
|
||||
|
||||
SendFactionState(&(itr->second));
|
||||
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION);
|
||||
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION);
|
||||
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION,factionEntry->ID);
|
||||
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION,factionEntry->ID);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "7477"
|
||||
#define REVISION_NR "7478"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue