Eluna implement changes from new_mthread to master ~ Does not add multithread support

This commit is contained in:
Rochet2
2014-11-30 01:37:45 +02:00
parent a7f4954fbe
commit 6268216a64
27 changed files with 3331 additions and 3000 deletions

View File

@@ -10,10 +10,10 @@
namespace LuaGuild
{
/* GETTERS */
int GetMembers(lua_State* L, Guild* guild)
int GetMembers(Eluna* E, Guild* guild)
{
lua_newtable(L);
int tbl = lua_gettop(L);
lua_newtable(E->L);
int tbl = lua_gettop(E->L);
uint32 i = 0;
SessionMap const& sessions = eWorld->GetAllSessions();
@@ -24,76 +24,76 @@ namespace LuaGuild
if (player->GetSession() && (player->GetGuildId() == guild->GetId()))
{
++i;
Eluna::Push(L, i);
Eluna::Push(L, player);
lua_settable(L, tbl);
Eluna::Push(E->L, i);
Eluna::Push(E->L, player);
lua_settable(E->L, tbl);
}
}
}
lua_settop(L, tbl); // push table to top of stack
lua_settop(E->L, tbl); // push table to top of stack
return 1;
}
int GetMemberCount(lua_State* L, Guild* guild)
int GetMemberCount(Eluna* E, Guild* guild)
{
Eluna::Push(L, guild->GetMemberSize());
Eluna::Push(E->L, guild->GetMemberSize());
return 1;
}
int GetLeader(lua_State* L, Guild* guild)
int GetLeader(Eluna* E, Guild* guild)
{
#ifndef TRINITY
Eluna::Push(L, eObjectAccessor->FindPlayer(guild->GetLeaderGuid()));
Eluna::Push(E->L, eObjectAccessor->FindPlayer(guild->GetLeaderGuid()));
#else
Eluna::Push(L, eObjectAccessor->FindPlayer(guild->GetLeaderGUID()));
Eluna::Push(E->L, eObjectAccessor->FindPlayer(guild->GetLeaderGUID()));
#endif
return 1;
}
int GetLeaderGUID(lua_State* L, Guild* guild)
int GetLeaderGUID(Eluna* E, Guild* guild)
{
#ifndef TRINITY
Eluna::Push(L, guild->GetLeaderGuid());
Eluna::Push(E->L, guild->GetLeaderGuid());
#else
Eluna::Push(L, guild->GetLeaderGUID());
Eluna::Push(E->L, guild->GetLeaderGUID());
#endif
return 1;
}
int GetId(lua_State* L, Guild* guild)
int GetId(Eluna* E, Guild* guild)
{
Eluna::Push(L, guild->GetId());
Eluna::Push(E->L, guild->GetId());
return 1;
}
int GetName(lua_State* L, Guild* guild)
int GetName(Eluna* E, Guild* guild)
{
Eluna::Push(L, guild->GetName());
Eluna::Push(E->L, guild->GetName());
return 1;
}
int GetMOTD(lua_State* L, Guild* guild)
int GetMOTD(Eluna* E, Guild* guild)
{
Eluna::Push(L, guild->GetMOTD());
Eluna::Push(E->L, guild->GetMOTD());
return 1;
}
int GetInfo(lua_State* L, Guild* guild)
int GetInfo(Eluna* E, Guild* guild)
{
#ifndef TRINITY
Eluna::Push(L, guild->GetGINFO());
Eluna::Push(E->L, guild->GetGINFO());
#else
Eluna::Push(L, guild->GetInfo());
Eluna::Push(E->L, guild->GetInfo());
#endif
return 1;
}
/* SETTERS */
#ifndef CATA
int SetLeader(lua_State* L, Guild* guild)
int SetLeader(Eluna* E, Guild* guild)
{
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
Player* player = Eluna::CHECKOBJ<Player>(E->L, 2);
#ifndef TRINITY
guild->SetLeader(player->GET_GUID());
@@ -105,10 +105,10 @@ namespace LuaGuild
#endif
#ifndef CLASSIC
int SetBankTabText(lua_State* L, Guild* guild)
int SetBankTabText(Eluna* E, Guild* guild)
{
uint8 tabId = Eluna::CHECKVAL<uint8>(L, 2);
const char* text = Eluna::CHECKVAL<const char*>(L, 3);
uint8 tabId = Eluna::CHECKVAL<uint8>(E->L, 2);
const char* text = Eluna::CHECKVAL<const char*>(E->L, 3);
#ifndef TRINITY
guild->SetGuildBankTabText(tabId, text);
#else
@@ -120,43 +120,43 @@ namespace LuaGuild
/* OTHER */
// SendPacketToGuild(packet)
int SendPacket(lua_State* L, Guild* guild)
int SendPacket(Eluna* E, Guild* guild)
{
WorldPacket* data = Eluna::CHECKOBJ<WorldPacket>(L, 2);
WorldPacket* data = Eluna::CHECKOBJ<WorldPacket>(E->L, 2);
guild->BroadcastPacket(data);
return 0;
}
// SendPacketToRankedInGuild(packet, rankId)
int SendPacketToRanked(lua_State* L, Guild* guild)
int SendPacketToRanked(Eluna* E, Guild* guild)
{
WorldPacket* data = Eluna::CHECKOBJ<WorldPacket>(L, 2);
uint8 ranked = Eluna::CHECKVAL<uint8>(L, 3);
WorldPacket* data = Eluna::CHECKOBJ<WorldPacket>(E->L, 2);
uint8 ranked = Eluna::CHECKVAL<uint8>(E->L, 3);
guild->BroadcastPacketToRank(data, ranked);
return 0;
}
int Disband(lua_State* /*L*/, Guild* guild)
int Disband(Eluna* /*E*/, Guild* guild)
{
guild->Disband();
return 0;
}
int AddMember(lua_State* L, Guild* guild)
int AddMember(Eluna* E, Guild* guild)
{
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
uint8 rankId = Eluna::CHECKVAL<uint8>(L, 3, GUILD_RANK_NONE);
Player* player = Eluna::CHECKOBJ<Player>(E->L, 2);
uint8 rankId = Eluna::CHECKVAL<uint8>(E->L, 3, GUILD_RANK_NONE);
guild->AddMember(player->GET_GUID(), rankId);
return 0;
}
int DeleteMember(lua_State* L, Guild* guild)
int DeleteMember(Eluna* E, Guild* guild)
{
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
bool isDisbanding = Eluna::CHECKVAL<bool>(L, 3, false);
Player* player = Eluna::CHECKOBJ<Player>(E->L, 2);
bool isDisbanding = Eluna::CHECKVAL<bool>(E->L, 3, false);
#ifndef TRINITY
guild->DelMember(player->GET_GUID(), isDisbanding);
@@ -166,10 +166,10 @@ namespace LuaGuild
return 0;
}
int SetMemberRank(lua_State* L, Guild* guild)
int SetMemberRank(Eluna* E, Guild* guild)
{
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
uint8 newRank = Eluna::CHECKVAL<uint8>(L, 3);
Player* player = Eluna::CHECKOBJ<Player>(E->L, 2);
uint8 newRank = Eluna::CHECKVAL<uint8>(E->L, 3);
guild->ChangeMemberRank(player->GET_GUID(), newRank);
return 0;
@@ -177,10 +177,10 @@ namespace LuaGuild
#ifndef CLASSIC
// Move to Player methods
int WithdrawBankMoney(lua_State* L, Guild* guild)
int WithdrawBankMoney(Eluna* E, Guild* guild)
{
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
uint32 money = Eluna::CHECKVAL<uint32>(L, 3);
Player* player = Eluna::CHECKOBJ<Player>(E->L, 2);
uint32 money = Eluna::CHECKVAL<uint32>(E->L, 3);
#ifndef TRINITY
if (guild->GetGuildBankMoney() < money)
return 0;
@@ -192,10 +192,10 @@ namespace LuaGuild
}
// Move to Player methods
int DepositBankMoney(lua_State* L, Guild* guild)
int DepositBankMoney(Eluna* E, Guild* guild)
{
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
uint32 money = Eluna::CHECKVAL<uint32>(L, 3);
Player* player = Eluna::CHECKOBJ<Player>(E->L, 2);
uint32 money = Eluna::CHECKVAL<uint32>(E->L, 3);
#ifndef TRINITY
guild->SetBankMoney(guild->GetGuildBankMoney() + money);