mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[10266] Implement CONDITION_ACHIEVEMENT and CONDITION_ACHIEVEMENT_REALM
This commit is contained in:
parent
30def33fed
commit
d9a7a2ba12
5 changed files with 45 additions and 2 deletions
|
|
@ -252,8 +252,11 @@ class AchievementMgr
|
|||
void CheckAllAchievementCriteria();
|
||||
void SendAllAchievementData();
|
||||
void SendRespondInspectAchievements(Player* player);
|
||||
|
||||
Player* GetPlayer() { return m_player;}
|
||||
|
||||
bool HasAchievement(uint32 achievement_id) const { return m_completedAchievements.find(achievement_id) != m_completedAchievements.end(); }
|
||||
|
||||
private:
|
||||
enum ProgressType { PROGRESS_SET, PROGRESS_ACCUMULATE, PROGRESS_HIGHEST };
|
||||
void SendAchievementEarned(AchievementEntry const* achievement);
|
||||
|
|
|
|||
|
|
@ -7642,6 +7642,25 @@ bool PlayerCondition::Meets(Player const * player) const
|
|||
else
|
||||
false;
|
||||
}
|
||||
case CONDITION_ACHIEVEMENT:
|
||||
{
|
||||
switch(value2)
|
||||
{
|
||||
case 0: return player->GetAchievementMgr().HasAchievement(value1);
|
||||
case 1: return !player->GetAchievementMgr().HasAchievement(value1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
case CONDITION_ACHIEVEMENT_REALM:
|
||||
{
|
||||
AchievementEntry const* ach = sAchievementStore.LookupEntry(value1);
|
||||
switch(value2)
|
||||
{
|
||||
case 0: return sAchievementMgr.IsRealmCompleted(ach);
|
||||
case 1: return !sAchievementMgr.IsRealmCompleted(ach);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
@ -7870,6 +7889,23 @@ bool PlayerCondition::IsValid(ConditionType condition, uint32 value1, uint32 val
|
|||
|
||||
break;
|
||||
}
|
||||
case CONDITION_ACHIEVEMENT:
|
||||
case CONDITION_ACHIEVEMENT_REALM:
|
||||
{
|
||||
if (!sAchievementStore.LookupEntry(value1))
|
||||
{
|
||||
sLog.outErrorDb("Achievement condition (%u) requires to have non existing achievement (Id: %d), skipped", condition, value1);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (value2 > 1)
|
||||
{
|
||||
sLog.outErrorDb("Achievement condition (%u) has invalid argument %u (must be 0..1), skipped", condition, value2);
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case CONDITION_NONE:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -370,9 +370,11 @@ enum ConditionType
|
|||
CONDITION_SPELL = 17, // spell_id 0, 1 (0: has spell, 1: hasn't spell)
|
||||
CONDITION_INSTANCE_SCRIPT = 18, // map_id instance_condition_id (instance script specific enum)
|
||||
CONDITION_QUESTAVAILABLE = 19, // quest_id 0 for case when loot/gossip possible only if player can start quest
|
||||
CONDITION_ACHIEVEMENT = 20, // ach_id 0, 1 (0: has achievement, 1: hasn't achievement) for player
|
||||
CONDITION_ACHIEVEMENT_REALM = 21, // ach_id 0, 1 (0: has achievement, 1: hasn't achievement) for server
|
||||
};
|
||||
|
||||
#define MAX_CONDITION 20 // maximum value in ConditionType enum
|
||||
#define MAX_CONDITION 22 // maximum value in ConditionType enum
|
||||
|
||||
struct PlayerCondition
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2374,8 +2374,10 @@ class MANGOS_DLL_SPEC Player : public Unit
|
|||
void AddRunePower(uint8 index);
|
||||
void InitRunes();
|
||||
|
||||
AchievementMgr const& GetAchievementMgr() const { return m_achievementMgr; }
|
||||
AchievementMgr& GetAchievementMgr() { return m_achievementMgr; }
|
||||
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscvalue1=0, uint32 miscvalue2=0, Unit *unit=NULL, uint32 time=0);
|
||||
|
||||
bool HasTitle(uint32 bitIndex);
|
||||
bool HasTitle(CharTitlesEntry const* title) { return HasTitle(title->bit_index); }
|
||||
void SetTitle(CharTitlesEntry const* title, bool lost = false);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "10265"
|
||||
#define REVISION_NR "10266"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue