mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
Change player access from sessions to players
This commit is contained in:
@@ -149,21 +149,24 @@ namespace LuaGlobalFunctions
|
|||||||
int tbl = lua_gettop(L);
|
int tbl = lua_gettop(L);
|
||||||
uint32 i = 0;
|
uint32 i = 0;
|
||||||
|
|
||||||
SessionMap const& sessions = eWorld->GetAllSessions();
|
|
||||||
for (SessionMap::const_iterator it = sessions.begin(); it != sessions.end(); ++it)
|
|
||||||
{
|
{
|
||||||
if (Player* player = it->second->GetPlayer())
|
HashMapHolder<Player>::ReadGuard g(HashMapHolder<Player>::GetLock());
|
||||||
|
HashMapHolder<Player>::MapType& m = eObjectAccessor->GetPlayers();
|
||||||
|
for (HashMapHolder<Player>::MapType::iterator it = m.begin(); it != m.end(); ++it)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
if (Player* player = it->second)
|
||||||
if ((team == TEAM_NEUTRAL || player->GetTeamId() == team) && (!onlyGM || player->isGameMaster()))
|
|
||||||
#else
|
|
||||||
if ((team == TEAM_NEUTRAL || player->GetTeamId() == team) && (!onlyGM || player->IsGameMaster()))
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
++i;
|
#ifndef TRINITY
|
||||||
Eluna::Push(L, i);
|
if ((team == TEAM_NEUTRAL || player->GetTeamId() == team) && (!onlyGM || player->isGameMaster()))
|
||||||
Eluna::Push(L, player);
|
#else
|
||||||
lua_settable(L, tbl);
|
if ((team == TEAM_NEUTRAL || player->GetTeamId() == team) && (!onlyGM || player->IsGameMaster()))
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
++i;
|
||||||
|
Eluna::Push(L, i);
|
||||||
|
Eluna::Push(L, player);
|
||||||
|
lua_settable(L, tbl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,17 +21,20 @@ namespace LuaGuild
|
|||||||
int tbl = lua_gettop(L);
|
int tbl = lua_gettop(L);
|
||||||
uint32 i = 0;
|
uint32 i = 0;
|
||||||
|
|
||||||
SessionMap const& sessions = eWorld->GetAllSessions();
|
|
||||||
for (SessionMap::const_iterator it = sessions.begin(); it != sessions.end(); ++it)
|
|
||||||
{
|
{
|
||||||
if (Player* player = it->second->GetPlayer())
|
HashMapHolder<Player>::ReadGuard g(HashMapHolder<Player>::GetLock());
|
||||||
|
HashMapHolder<Player>::MapType& m = eObjectAccessor->GetPlayers();
|
||||||
|
for (HashMapHolder<Player>::MapType::iterator it = m.begin(); it != m.end(); ++it)
|
||||||
{
|
{
|
||||||
if (player->GetSession() && (player->GetGuildId() == guild->GetId()))
|
if (Player* player = it->second)
|
||||||
{
|
{
|
||||||
++i;
|
if (player->GetSession() && (player->GetGuildId() == guild->GetId()))
|
||||||
Eluna::Push(L, i);
|
{
|
||||||
Eluna::Push(L, player);
|
++i;
|
||||||
lua_settable(L, tbl);
|
Eluna::Push(L, i);
|
||||||
|
Eluna::Push(L, player);
|
||||||
|
lua_settable(L, tbl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ namespace LuaMap
|
|||||||
uint32 weatherType = Eluna::CHECKVAL<uint32>(L, 3);
|
uint32 weatherType = Eluna::CHECKVAL<uint32>(L, 3);
|
||||||
float grade = Eluna::CHECKVAL<float>(L, 4);
|
float grade = Eluna::CHECKVAL<float>(L, 4);
|
||||||
|
|
||||||
#if (defined(CMANGOS) && defined(WOTLK))
|
#if ((defined(CMANGOS) || defined(MANGOS)) && defined(WOTLK))
|
||||||
if (Weather::IsValidWeatherType(weatherType))
|
if (Weather::IsValidWeatherType(weatherType))
|
||||||
map->SetWeather(zoneId, (WeatherType)weatherType, grade, false);
|
map->SetWeather(zoneId, (WeatherType)weatherType, grade, false);
|
||||||
#else
|
#else
|
||||||
|
|||||||
Reference in New Issue
Block a user