Eluna Classic Support for Honor things (GetHonorStoredKills, GetRankPoints, GetHonorLastWeekStandingPos, SetHonorStoredKills, SetRankPoints, SetHonorLastWeekStandingPos, UpdateHonor, ResetHonor, ClearHonorInfo)

This commit is contained in:
Salja
2014-03-23 22:50:28 +02:00
committed by Foereaper
parent 3b8d4cbc02
commit f07521a1aa
2 changed files with 84 additions and 0 deletions

View File

@@ -450,6 +450,11 @@ ElunaRegister<Player> 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<Player> 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<Player> 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 },
};

View File

@@ -163,6 +163,28 @@ namespace LuaPlayer
}
#endif
#ifdef CLASSIC
int GetHonorStoredKills(lua_State* L, Player* player)
{
bool honorable = sEluna->CHECKVAL<bool>(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<uint32>(L, 2);
bool honorable = sEluna->CHECKVAL<bool>(L, 3, true);
player->SetHonorStoredKills(kills, honorable);
return 0;
}
int SetRankPoints(lua_State* L, Player* player)
{
float rankPoints = sEluna->CHECKVAL<float>(L, 2);
player->SetRankPoints(rankPoints);
return 0;
}
int SetHonorLastWeekStandingPos(lua_State* L, Player* player)
{
int32 standingPos = sEluna->CHECKVAL<int32>(L, 2);
player->SetHonorLastWeekStandingPos(standingPos);
return 0;
}
#endif
int SetLifetimeKills(lua_State* L, Player* player)
{
uint32 val = sEluna->CHECKVAL<uint32>(L, 2);