The achievement is correctly given if players complete ToGC 25 with 50 attempts remaining, but is given every time this happens and not only the first time. So is there something else I must add to make this achievement work properly?
The core already performs this control in function AchievementMgr::IsCompletedCriteria
if (achievement->flags & (ACHIEVEMENT_FLAG_REALM_FIRST_REACH | ACHIEVEMENT_FLAG_REALM_FIRST_KILL))
{
// someone on this realm has already completed that achievement
if (sAchievementMgr->IsRealmCompleted(achievement))
return false;
}
I checked the DBC and the achievement is correctly flagged as a Realm First achievement.
EDIT: maybe I found the source of the problem: in function AchievementMgr::CompletedAchievement there is this piece of code:
// don't insert for ACHIEVEMENT_FLAG_REALM_FIRST_KILL since otherwise only the first group member would reach that achievement
// TODO: where do set this instead?
if (!(achievement->flags & ACHIEVEMENT_FLAG_REALM_FIRST_KILL))
sAchievementMgr->SetRealmCompleted(achievement);