diff --git a/LuaFunctions.cpp b/LuaFunctions.cpp index db06749..d25437d 100644 --- a/LuaFunctions.cpp +++ b/LuaFunctions.cpp @@ -600,6 +600,7 @@ ElunaRegister 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 }, diff --git a/PlayerMethods.h b/PlayerMethods.h index 1d64832..e04b784 100644 --- a/PlayerMethods.h +++ b/PlayerMethods.h @@ -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(L, 2); + AchievementEntry const* t = sAchievementStore.LookupEntry(id); + if (t) + player->CompletedAchievement(t); + return 0; + } + #endif #if !defined TRINITY && !AZEROTHCORE