Added base BG methods and hooks

This has only been tested on Mangos Zero and will definitely need tweaking on Trinity

More methods will be added SHORTLY
This commit is contained in:
Foereaper
2014-09-10 22:38:21 +02:00
parent f2a591b87b
commit 0bfdf632e7
8 changed files with 308 additions and 2 deletions

221
BattleGroundMethods.h Normal file
View File

@@ -0,0 +1,221 @@
/*
* Copyright (C) 2010 - 2014 Eluna Lua Engine <http://emudevs.com/>
* This program is free software licensed under GPL version 3
* Please see the included DOCS/LICENSE.md for more information
*/
#ifndef BATTLEGROUNDMETHODS_H
#define BATTLEGROUNDMETHODS_H
namespace LuaBattleGround
{
#ifdef MANGOS // Currently only tested on Mangos. May need tweaking for TC
/**
* Returns the name of the [Battleground]
*
* @return string name
*/
int GetName(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetName());
return 1;
}
/**
* Returns the amount of alive players in the [Battleground] by the team ID.
*
* @param uint32 team : team ID
* @return uint32 count
*/
int GetAlivePlayersCountByTeam(lua_State* L, BattleGround* bg)
{
uint32 team = Eluna::CHECKVAL<uint32>(L, 2);
Eluna::Push(L, bg->GetAlivePlayersCountByTeam((Team)team));
return 1;
}
/**
* Returns the [Map] of the [Battleground].
*
* @return [Map] map
*/
int GetMap(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetBgMap());
return 1;
}
/**
* Returns the bonus honor given by amount of kills in the specific [Battleground].
*
* @param uint32 kills : amount of kills
* @return uint32 bonusHonor
*/
int GetBonusHonorFromKillCount(lua_State* L, BattleGround* bg)
{
uint32 kills = Eluna::CHECKVAL<uint32>(L, 2);
Eluna::Push(L, bg->GetBonusHonorFromKill(kills));
return 1;
}
/**
* Returns the bracket ID of the specific [Battleground].
*
* @return BattleGroundBracketId bracketId
*/
int GetBracketId(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetBracketId());
return 1;
}
/**
* Returns the end time of the [Battleground].
*
* @return uint32 endTime
*/
int GetEndTime(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetEndTime());
return 1;
}
/**
* Returns the amount of free slots for the selected team in the specific [Battleground].
*
* @param uint32 team : team ID
* @return uint32 freeSlots
*/
int GetFreeSlotsForTeam(lua_State* L, BattleGround* bg)
{
uint32 team = Eluna::CHECKVAL<uint32>(L, 2);
Eluna::Push(L, bg->GetFreeSlotsForTeam((Team)team));
return 1;
}
/**
* Returns the instance ID of the [Battleground].
*
* @return uint32 instanceId
*/
int GetInstanceId(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetInstanceID());
return 1;
}
/**
* Returns the map ID of the [Battleground].
*
* @return uint32 mapId
*/
int GetMapId(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetMapId());
return 1;
}
/**
* Returns the type ID of the [Battleground].
*
* @return BattleGroundTypeId typeId
*/
int GetTypeId(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetTypeID());
return 1;
}
/**
* Returns the max allowed [Player] level of the specific [Battleground].
*
* @return uint32 maxLevel
*/
int GetMaxLevel(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetMaxLevel());
return 1;
}
/**
* Returns the minimum allowed [Player] level of the specific [Battleground].
*
* @return uint32 minLevel
*/
int GetMinLevel(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetMinLevel());
return 1;
}
/**
* Returns the maximum allowed [Player] count of the specific [Battleground].
*
* @return uint32 maxPlayerCount
*/
int GetMaxPlayers(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetMaxPlayers());
return 1;
}
/**
* Returns the minimum allowed [Player] count of the specific [Battleground].
*
* @return uint32 minPlayerCount
*/
int GetMinPlayers(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetMinPlayers());
return 1;
}
/**
* Returns the maximum allowed [Player] count per team of the specific [Battleground].
*
* @return uint32 maxTeamPlayerCount
*/
int GetMaxPlayersPerTeam(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetMaxPlayersPerTeam());
return 1;
}
/**
* Returns the minimum allowed [Player] count per team of the specific [Battleground].
*
* @return uint32 minTeamPlayerCount
*/
int GetMinPlayersPerTeam(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetMinPlayersPerTeam());
return 1;
}
/**
* Returns the winning team of the specific [Battleground].
*
* @return Team team
*/
int GetWinner(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetWinner());
return 1;
}
/**
* Returns the status of the specific [Battleground].
*
* @return BattleGroundStatus status
*/
int GetStatus(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetStatus());
return 1;
}
#endif
};
#endif