mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
feat: add getter and setter for halaa ownership (#79)
This commit is contained in:
@@ -13,6 +13,9 @@
|
||||
|
||||
#include "BanMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "OutdoorPvPMgr.h"
|
||||
#include "../../../../src/server/scripts/OutdoorPvP/OutdoorPvPNA.h"
|
||||
|
||||
enum BanMode
|
||||
{
|
||||
@@ -3327,5 +3330,58 @@ namespace LuaGlobalFunctions
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef AZEROTHCORE
|
||||
/**
|
||||
* Gets the faction which is the current owner of Halaa in Nagrand
|
||||
* 0 = Alliance
|
||||
* 1 = Horde
|
||||
*
|
||||
* 600 = slider max Alliance
|
||||
* -600 = slider max Horde
|
||||
*
|
||||
* @return int16 the ID of the team to own Halaa
|
||||
* @return float the slider position.
|
||||
*/
|
||||
int GetOwnerHalaa(lua_State* L)
|
||||
{
|
||||
OutdoorPvPNA* nagrandPvp = (OutdoorPvPNA*)sOutdoorPvPMgr->GetOutdoorPvPToZoneId(3518);
|
||||
OPvPCapturePointNA* halaa = nagrandPvp->GetCapturePoint();
|
||||
Eluna::Push(L, halaa->GetControllingFaction());
|
||||
Eluna::Push(L, halaa->GetSlider());
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the owner of Halaa in Nagrand to the respective faction
|
||||
* 0 = Alliance
|
||||
* 1 = Horde
|
||||
*
|
||||
* @param uint16 teamId : the ID of the team to own Halaa
|
||||
*/
|
||||
int SetOwnerHalaa(lua_State* L)
|
||||
{
|
||||
uint16 teamId = Eluna::CHECKVAL<uint16>(L, 1);
|
||||
|
||||
OutdoorPvPNA* nagrandPvp = (OutdoorPvPNA*)sOutdoorPvPMgr->GetOutdoorPvPToZoneId(3518);
|
||||
OPvPCapturePointNA* halaa = nagrandPvp->GetCapturePoint();
|
||||
|
||||
if (teamId == 0)
|
||||
{
|
||||
halaa->SetSlider(599);
|
||||
}
|
||||
else if (teamId == 1)
|
||||
{
|
||||
halaa->SetSlider(-599);
|
||||
}
|
||||
else
|
||||
{
|
||||
return luaL_argerror(L, 1, "0 for Alliance or 1 for Horde expected");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -98,6 +98,7 @@ luaL_Reg GlobalMethods[] =
|
||||
{ "GetGUIDType", &LuaGlobalFunctions::GetGUIDType },
|
||||
{ "GetGUIDEntry", &LuaGlobalFunctions::GetGUIDEntry },
|
||||
{ "GetAreaName", &LuaGlobalFunctions::GetAreaName },
|
||||
{ "GetOwnerHalaa", &LuaGlobalFunctions::GetOwnerHalaa },
|
||||
{ "bit_not", &LuaGlobalFunctions::bit_not },
|
||||
{ "bit_xor", &LuaGlobalFunctions::bit_xor },
|
||||
{ "bit_rshift", &LuaGlobalFunctions::bit_rshift },
|
||||
@@ -148,6 +149,7 @@ luaL_Reg GlobalMethods[] =
|
||||
{ "StartGameEvent", &LuaGlobalFunctions::StartGameEvent },
|
||||
{ "StopGameEvent", &LuaGlobalFunctions::StopGameEvent },
|
||||
{ "HttpRequest", &LuaGlobalFunctions::HttpRequest },
|
||||
{ "SetOwnerHalaa", &LuaGlobalFunctions::SetOwnerHalaa },
|
||||
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user