|
@ -72,6 +72,21 @@ bool RenX::Server::isConnected() const |
|
|
return RenX::Server::connected; |
|
|
return RenX::Server::connected; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool RenX::Server::isFirstGame() const |
|
|
|
|
|
{ |
|
|
|
|
|
return RenX::Server::firstGame; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool RenX::Server::isFirstKill() const |
|
|
|
|
|
{ |
|
|
|
|
|
return RenX::Server::firstKill; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool RenX::Server::isFirstDeath() const |
|
|
|
|
|
{ |
|
|
|
|
|
return RenX::Server::firstDeath; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
bool RenX::Server::isPublicLogChanType(int type) const |
|
|
bool RenX::Server::isPublicLogChanType(int type) const |
|
|
{ |
|
|
{ |
|
|
return RenX::Server::logChanType == type; |
|
|
return RenX::Server::logChanType == type; |
|
@ -491,8 +506,11 @@ inline RenX::PlayerInfo *getPlayerOrAdd(RenX::Server *server, const Jupiter::Rea |
|
|
return r; |
|
|
return r; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
inline void onPreGameOver(RenX::Server *server, RenX::WinType winType, RenX::TeamType team, int gScore, int nScore) |
|
|
void RenX::Server::processLine(const Jupiter::ReadableString &line) |
|
|
{ |
|
|
{ |
|
|
|
|
|
/** Local functions */ |
|
|
|
|
|
auto onPreGameOver = [&](RenX::Server *server, RenX::WinType winType, RenX::TeamType team, int gScore, int nScore) |
|
|
|
|
|
{ |
|
|
RenX::PlayerInfo *player; |
|
|
RenX::PlayerInfo *player; |
|
|
|
|
|
|
|
|
if (server->players.size() != 0) |
|
|
if (server->players.size() != 0) |
|
@ -508,10 +526,13 @@ inline void onPreGameOver(RenX::Server *server, RenX::WinType winType, RenX::Tea |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}; |
|
|
|
|
|
auto onPostGameOver = [&](RenX::Server *server, RenX::WinType winType, RenX::TeamType team, int gScore, int nScore) |
|
|
inline void onPostGameOver(RenX::Server *server, RenX::WinType winType, RenX::TeamType team, int gScore, int nScore) |
|
|
{ |
|
|
{ |
|
|
this->firstGame = false; |
|
|
|
|
|
this->firstAction = false; |
|
|
|
|
|
this->firstKill = false; |
|
|
|
|
|
this->firstDeath = false; |
|
|
RenX::PlayerInfo *player; |
|
|
RenX::PlayerInfo *player; |
|
|
|
|
|
|
|
|
if (server->players.size() != 0) |
|
|
if (server->players.size() != 0) |
|
@ -531,10 +552,9 @@ inline void onPostGameOver(RenX::Server *server, RenX::WinType winType, RenX::Te |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}; |
|
|
|
|
|
auto onChat = [&](RenX::Server *server, RenX::PlayerInfo *player, const Jupiter::ReadableString &message, bool isPublic) |
|
|
inline void onChat(RenX::Server *server, RenX::PlayerInfo *player, const Jupiter::ReadableString &message, bool isPublic) |
|
|
{ |
|
|
{ |
|
|
|
|
|
const Jupiter::ReadableString &prefix = server->getCommandPrefix(); |
|
|
const Jupiter::ReadableString &prefix = server->getCommandPrefix(); |
|
|
if (message.find(prefix) == 0 && message.size() != prefix.size()) |
|
|
if (message.find(prefix) == 0 && message.size() != prefix.size()) |
|
|
{ |
|
|
{ |
|
@ -553,10 +573,16 @@ inline void onChat(RenX::Server *server, RenX::PlayerInfo *player, const Jupiter |
|
|
} |
|
|
} |
|
|
server->triggerCommand(command, player, parameters); |
|
|
server->triggerCommand(command, player, parameters); |
|
|
} |
|
|
} |
|
|
} |
|
|
}; |
|
|
|
|
|
auto onAction = [&]() |
|
|
|
|
|
{ |
|
|
|
|
|
if (this->firstAction == false) |
|
|
|
|
|
{ |
|
|
|
|
|
this->firstAction = true; |
|
|
|
|
|
this->silenceJoins = false; |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
void RenX::Server::processLine(const Jupiter::ReadableString &line) |
|
|
|
|
|
{ |
|
|
|
|
|
Jupiter::ReferenceString buff = line; |
|
|
Jupiter::ReferenceString buff = line; |
|
|
Jupiter::ArrayList<RenX::Plugin> &xPlugins = *RenX::getCore()->getPlugins(); |
|
|
Jupiter::ArrayList<RenX::Plugin> &xPlugins = *RenX::getCore()->getPlugins(); |
|
|
Jupiter::ReferenceString header = buff.getWord(0, RenX::DelimS); |
|
|
Jupiter::ReferenceString header = buff.getWord(0, RenX::DelimS); |
|
@ -576,6 +602,7 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) |
|
|
if (objectType.match("*Beacon")) player->beaconPlacements++; |
|
|
if (objectType.match("*Beacon")) player->beaconPlacements++; |
|
|
for (size_t i = 0; i < xPlugins.size(); i++) |
|
|
for (size_t i = 0; i < xPlugins.size(); i++) |
|
|
xPlugins.get(i)->RenX_OnDeploy(this, player, objectType); |
|
|
xPlugins.get(i)->RenX_OnDeploy(this, player, objectType); |
|
|
|
|
|
onAction(); |
|
|
} |
|
|
} |
|
|
else if (action.equals("suicided by")) |
|
|
else if (action.equals("suicided by")) |
|
|
{ |
|
|
{ |
|
@ -585,6 +612,8 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) |
|
|
Jupiter::ReferenceString damageType = buff.getWord(3, RenX::DelimS); |
|
|
Jupiter::ReferenceString damageType = buff.getWord(3, RenX::DelimS); |
|
|
for (size_t i = 0; i < xPlugins.size(); i++) |
|
|
for (size_t i = 0; i < xPlugins.size(); i++) |
|
|
xPlugins.get(i)->RenX_OnSuicide(this, player, damageType); |
|
|
xPlugins.get(i)->RenX_OnSuicide(this, player, damageType); |
|
|
|
|
|
this->firstDeath = true; |
|
|
|
|
|
onAction(); |
|
|
} |
|
|
} |
|
|
else if (action.equals("killed")) |
|
|
else if (action.equals("killed")) |
|
|
{ |
|
|
{ |
|
@ -615,6 +644,10 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) |
|
|
|
|
|
|
|
|
for (size_t i = 0; i < xPlugins.size(); i++) |
|
|
for (size_t i = 0; i < xPlugins.size(); i++) |
|
|
xPlugins.get(i)->RenX_OnKill(this, player, victim, damageType); |
|
|
xPlugins.get(i)->RenX_OnKill(this, player, victim, damageType); |
|
|
|
|
|
|
|
|
|
|
|
this->firstKill = true; |
|
|
|
|
|
this->firstDeath = true; |
|
|
|
|
|
onAction(); |
|
|
} |
|
|
} |
|
|
else if (action.match("died by")) |
|
|
else if (action.match("died by")) |
|
|
{ |
|
|
{ |
|
@ -623,6 +656,8 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) |
|
|
Jupiter::ReferenceString damageType = buff.getWord(3, RenX::DelimS); |
|
|
Jupiter::ReferenceString damageType = buff.getWord(3, RenX::DelimS); |
|
|
for (size_t i = 0; i < xPlugins.size(); i++) |
|
|
for (size_t i = 0; i < xPlugins.size(); i++) |
|
|
xPlugins.get(i)->RenX_OnDie(this, player, damageType); |
|
|
xPlugins.get(i)->RenX_OnDie(this, player, damageType); |
|
|
|
|
|
this->firstDeath = true; |
|
|
|
|
|
onAction(); |
|
|
} |
|
|
} |
|
|
else if (action.match("destroyed*")) |
|
|
else if (action.match("destroyed*")) |
|
|
{ |
|
|
{ |
|
@ -647,6 +682,7 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) |
|
|
} |
|
|
} |
|
|
for (size_t i = 0; i < xPlugins.size(); i++) |
|
|
for (size_t i = 0; i < xPlugins.size(); i++) |
|
|
xPlugins.get(i)->RenX_OnDestroy(this, player, victim, damageType, type); |
|
|
xPlugins.get(i)->RenX_OnDestroy(this, player, victim, damageType, type); |
|
|
|
|
|
onAction(); |
|
|
} |
|
|
} |
|
|
else if (playerData.match("??? wins (*)")) |
|
|
else if (playerData.match("??? wins (*)")) |
|
|
{ |
|
|
{ |
|
@ -718,6 +754,7 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) |
|
|
for (size_t i = 0; i < xPlugins.size(); i++) |
|
|
for (size_t i = 0; i < xPlugins.size(); i++) |
|
|
xPlugins.get(i)->RenX_OnChat(this, player, message); |
|
|
xPlugins.get(i)->RenX_OnChat(this, player, message); |
|
|
} |
|
|
} |
|
|
|
|
|
onAction(); |
|
|
} |
|
|
} |
|
|
else if (header.equals("lPLAYER:")) |
|
|
else if (header.equals("lPLAYER:")) |
|
|
{ |
|
|
{ |
|
@ -748,6 +785,7 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (this->silenceJoins == false) |
|
|
for (size_t i = 0; i < xPlugins.size(); i++) |
|
|
for (size_t i = 0; i < xPlugins.size(); i++) |
|
|
xPlugins.get(i)->RenX_OnJoin(this, player); |
|
|
xPlugins.get(i)->RenX_OnJoin(this, player); |
|
|
} |
|
|
} |
|
@ -759,6 +797,7 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) |
|
|
player->name = newName; |
|
|
player->name = newName; |
|
|
if (RenX::Server::uuidMode == 1) |
|
|
if (RenX::Server::uuidMode == 1) |
|
|
player->uuid = player->name; |
|
|
player->uuid = player->name; |
|
|
|
|
|
onAction(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
else if (header.equals("lRCON:")) |
|
|
else if (header.equals("lRCON:")) |
|
@ -887,6 +926,11 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line) |
|
|
else if (gameVersion.equals("Open Beta 3")) |
|
|
else if (gameVersion.equals("Open Beta 3")) |
|
|
this->profile = RenX::openBeta3Profile; |
|
|
this->profile = RenX::openBeta3Profile; |
|
|
|
|
|
|
|
|
|
|
|
if (this->profile->disconnectOnGameOver == false) |
|
|
|
|
|
this->firstGame = true; |
|
|
|
|
|
else if (this->firstGame == false) |
|
|
|
|
|
this->silenceJoins = true; |
|
|
|
|
|
|
|
|
for (size_t i = 0; i < xPlugins.size(); i++) |
|
|
for (size_t i = 0; i < xPlugins.size(); i++) |
|
|
xPlugins.get(i)->RenX_OnVersion(this, buff); |
|
|
xPlugins.get(i)->RenX_OnVersion(this, buff); |
|
|
buff.shiftLeft(1); |
|
|
buff.shiftLeft(1); |
|
|