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
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue