Add SetAchievement to Eluna

This commit is contained in:
iThorgrim
2020-08-24 11:42:23 +02:00
parent 31f4cfd98c
commit 3dba4036d0
2 changed files with 17 additions and 0 deletions

View File

@@ -600,6 +600,7 @@ ElunaRegister<Player> PlayerMethods[] =
// {"HasPendingBind", &LuaPlayer::HasPendingBind}, // :HasPendingBind() - UNDOCUMENTED - Returns true if the player has a pending instance bind
#if (!defined(TBC) && !defined(CLASSIC))
{ "HasAchieved", &LuaPlayer::HasAchieved },
{ "SetAchievement", &LuaPlayer::SetAchievement },
#endif
{ "CanUninviteFromGroup", &LuaPlayer::CanUninviteFromGroup },
{ "IsRested", &LuaPlayer::IsRested },

View File

@@ -2057,6 +2057,22 @@ namespace LuaPlayer
player->SetTitle(t, false);
return 0;
}
/**
* Adds the specified achievement to the [Player]s
*
* @param uint32 achievementid
*/
int SetAchievement(lua_State* L, Player* player)
{
uint32 id = Eluna::CHECKVAL<uint32>(L, 2);
AchievementEntry const* t = sAchievementStore.LookupEntry(id);
if (t)
player->CompletedAchievement(t);
return 0;
}
#endif
#if !defined TRINITY && !AZEROTHCORE