Merge pull request #324 from iThorgrim-Hub/master

Add SetAchievement to Eluna
This commit is contained in:
Foereaper
2020-09-12 18:02:58 +02:00
committed by GitHub
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