From 3dba4036d0b0f64958f26e3e066af1511f59350a Mon Sep 17 00:00:00 2001 From: iThorgrim Date: Mon, 24 Aug 2020 11:42:23 +0200 Subject: [PATCH] Add SetAchievement to Eluna --- LuaFunctions.cpp | 1 + PlayerMethods.h | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/LuaFunctions.cpp b/LuaFunctions.cpp index c3375dd..7081c9c 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 10e9034..76cd40e 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