From f07521a1aa27f200d415d63b36d2b84ce3e155bb Mon Sep 17 00:00:00 2001 From: Salja Date: Sun, 23 Mar 2014 22:50:28 +0200 Subject: [PATCH] Eluna Classic Support for Honor things (GetHonorStoredKills, GetRankPoints, GetHonorLastWeekStandingPos, SetHonorStoredKills, SetRankPoints, SetHonorLastWeekStandingPos, UpdateHonor, ResetHonor, ClearHonorInfo) --- LuaFunctions.cpp | 15 +++++++++++ PlayerMethods.h | 69 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) diff --git a/LuaFunctions.cpp b/LuaFunctions.cpp index 9f20942..daa8528 100644 --- a/LuaFunctions.cpp +++ b/LuaFunctions.cpp @@ -450,6 +450,11 @@ ElunaRegister PlayerMethods[] = #ifndef CATA { "GetShieldBlockValue", &LuaPlayer::GetShieldBlockValue }, // :GetShieldBlockValue() - Returns block value #endif +#ifdef CLASSIC + {"GetHonorStoredKills", &LuaPlayer::GetHonorStoredKills}, // :GetHonorStoredKills(on/off) + {"GetRankPoints", &LuaPlayer::GetRankPoints}, // :GetRankPoints() + {"GetHonorLastWeekStandingPos", &LuaPlayer::GetHonorLastWeekStandingPos}, // :GetHonorLastWeekStandingPos() +#endif // Setters { "AdvanceSkillsToMax", &LuaPlayer::AdvanceSkillsToMax }, // :AdvanceSkillsToMax() - Advances all currently known skills to the currently known max level @@ -467,6 +472,11 @@ ElunaRegister PlayerMethods[] = { "SetArenaPoints", &LuaPlayer::SetArenaPoints }, // :SetArenaPoints(amount) { "SetHonorPoints", &LuaPlayer::SetHonorPoints }, // :SetHonorPoints(amount) #endif +#endif +#ifdef CLASSIC + {"SetHonorStoredKills", &LuaPlayer::SetHonorStoredKills}, // :SetHonorStoredKills(kills, [on/off]) + {"SetRankPoints", &LuaPlayer::SetRankPoints}, // :SetRankPoints(rankPoints) + {"SetHonorLastWeekStandingPos", &LuaPlayer::SetHonorLastWeekStandingPos}, // :SetHonorLastWeekStandingPos(standingPos) #endif { "SetLifetimeKills", &LuaPlayer::SetLifetimeKills }, // :SetLifetimeKills(val) - Sets the overall lifetime (honorable) kills of the player { "SetGameMaster", &LuaPlayer::SetGameMaster }, // :SetGameMaster([on]) - Sets GM mode on or off @@ -668,6 +678,11 @@ ElunaRegister PlayerMethods[] = { "Mute", &LuaPlayer::Mute }, // :Mute(time[, reason]) - Mutes the player for given time in seconds. { "SummonPlayer", &LuaPlayer::SummonPlayer }, // :SummonPlayer(player, map, x, y, z, zoneId[, delay]) - Sends a popup to the player asking if he wants to be summoned if yes, teleported to coords. ZoneID defines the location name shown in the popup Delay is the time until the popup closes automatically. { "SaveToDB", &LuaPlayer::SaveToDB }, // :SaveToDB() - Saves to database +#ifdef CLASSIC + {"UpdateHonor", &LuaPlayer::UpdateHonor}, // :UpdateHonor() - Updates Player Honor + {"ResetHonor", &LuaPlayer::ResetHonor}, // :ResetHonor() - Resets Player Honor + {"ClearHonorInfo", &LuaPlayer::ClearHonorInfo}, // :ClearHonorInfo() - Clear Player Honor Info +#endif { NULL, NULL }, }; diff --git a/PlayerMethods.h b/PlayerMethods.h index a6cb73d..9e24d54 100644 --- a/PlayerMethods.h +++ b/PlayerMethods.h @@ -163,6 +163,28 @@ namespace LuaPlayer } #endif +#ifdef CLASSIC + int GetHonorStoredKills(lua_State* L, Player* player) + { + bool honorable = sEluna->CHECKVAL(L, 2, true); + + sEluna->Push(L, player->GetHonorStoredKills(honorable)); + return 0; + } + + int GetRankPoints(lua_State* L, Player* player) + { + sEluna->Push(L, player->GetRankPoints()); + return 1; + } + + int GetHonorLastWeekStandingPos(lua_State* L, Player* player) + { + sEluna->Push(L, player->GetHonorLastWeekStandingPos()); + return 1; + } +#endif + int IsInWater(lua_State* L, Player* player) { sEluna->Push(L, player->IsInWater()); @@ -175,6 +197,26 @@ namespace LuaPlayer return 1; } +#ifdef CLASSIC + int UpdateHonor(lua_State* L, Player* player) + { + player->UpdateHonor(); + return 0; + } + + int ResetHonor(lua_State* L, Player* player) + { + player->ResetHonor(); + return 0; + } + + int ClearHonorInfo(lua_State* L, Player* player) + { + player->ClearHonorInfo(); + return 0; + } +#endif + #ifndef CLASSIC int IsFlying(lua_State* L, Player* player) // enable for unit when mangos support it { @@ -1177,6 +1219,33 @@ namespace LuaPlayer #endif #endif +#ifdef CLASSIC + int SetHonorStoredKills(lua_State* L, Player* player) + { + uint32 kills = sEluna->CHECKVAL(L, 2); + bool honorable = sEluna->CHECKVAL(L, 3, true); + + player->SetHonorStoredKills(kills, honorable); + return 0; + } + + int SetRankPoints(lua_State* L, Player* player) + { + float rankPoints = sEluna->CHECKVAL(L, 2); + + player->SetRankPoints(rankPoints); + return 0; + } + + int SetHonorLastWeekStandingPos(lua_State* L, Player* player) + { + int32 standingPos = sEluna->CHECKVAL(L, 2); + + player->SetHonorLastWeekStandingPos(standingPos); + return 0; + } +#endif + int SetLifetimeKills(lua_State* L, Player* player) { uint32 val = sEluna->CHECKVAL(L, 2);