mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
feat: add Player:GetAchievementCriteriaProgress() (#78)
This commit is contained in:
@@ -612,6 +612,7 @@ ElunaRegister<Player> PlayerMethods[] =
|
|||||||
// {"HasPendingBind", &LuaPlayer::HasPendingBind}, // :HasPendingBind() - UNDOCUMENTED - Returns true if the player has a pending instance bind
|
// {"HasPendingBind", &LuaPlayer::HasPendingBind}, // :HasPendingBind() - UNDOCUMENTED - Returns true if the player has a pending instance bind
|
||||||
#if (!defined(TBC) && !defined(CLASSIC))
|
#if (!defined(TBC) && !defined(CLASSIC))
|
||||||
{ "HasAchieved", &LuaPlayer::HasAchieved },
|
{ "HasAchieved", &LuaPlayer::HasAchieved },
|
||||||
|
{ "GetAchievementCriteriaProgress", &LuaPlayer::GetAchievementCriteriaProgress },
|
||||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||||
{ "SetAchievement", &LuaPlayer::SetAchievement },
|
{ "SetAchievement", &LuaPlayer::SetAchievement },
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -64,6 +64,28 @@ namespace LuaPlayer
|
|||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the progress of the [Player] for the specified achievement criteria.
|
||||||
|
*
|
||||||
|
* @param uint32 criteriaId
|
||||||
|
* @return uint32 progress : progress value or nil
|
||||||
|
*/
|
||||||
|
int GetAchievementCriteriaProgress(lua_State* L, Player* player)
|
||||||
|
{
|
||||||
|
uint32 criteriaId = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
|
const AchievementCriteriaEntry* criteria = sAchievementCriteriaStore.LookupEntry(criteriaId);
|
||||||
|
CriteriaProgress* progress = player->GetAchievementMgr()->GetCriteriaProgress(criteria);
|
||||||
|
if (progress)
|
||||||
|
{
|
||||||
|
Eluna::Push(L, progress->counter);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Eluna::Push(L, (void*)nullptr);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user