Browse Source

RenX.Core:

* Mutators are now tracked.
* Proxy mine placements/disarms are now tracked.
* Added Server::isPure().
RenX.Logging:
* Cleaner default Kick format.
Updated Jupiter
pull/3/head
JustinAJ 10 years ago
parent
commit
99e8d4674d
  1. 2
      Jupiter
  2. BIN
      Release/Bot.lib
  3. BIN
      Release/Plugins/RenX.Core.lib
  4. 4
      RenX.Core/RenX.h
  5. 2
      RenX.Core/RenX_PlayerInfo.h
  6. 44
      RenX.Core/RenX_Server.cpp
  7. 9
      RenX.Core/RenX_Server.h
  8. 2
      RenX.Core/RenX_Tags.cpp
  9. 2
      RenX.Logging/RenX_Logging.cpp

2
Jupiter

@ -1 +1 @@
Subproject commit 6400a1542e1d005e47cd5c9989a58a1731e00e27
Subproject commit 5a45d44a5000587917a5d9ae53fac712e8247e98

BIN
Release/Bot.lib

Binary file not shown.

BIN
Release/Plugins/RenX.Core.lib

Binary file not shown.

4
RenX.Core/RenX.h

@ -70,6 +70,8 @@ namespace RenX
{
SocketError,
SocketErrorReconnect,
ProtocolError,
ProtocolErrorReconnect,
PingTimeout,
PingTimeoutReconnect,
IncompatibleVersion,
@ -78,6 +80,8 @@ namespace RenX
TriggeredReconnect,
Rehash,
RehashReconnect,
OtherError,
OtherErrorReconnect,
Other,
OtherReconnect
};

2
RenX.Core/RenX_PlayerInfo.h

@ -69,6 +69,8 @@ namespace RenX
unsigned int loses = 0;
unsigned int beaconPlacements = 0;
unsigned int beaconDisarms = 0;
unsigned int proxy_placements = 0;
unsigned int proxy_disarms = 0;
unsigned int captures = 0;
unsigned int steals = 0;
unsigned int stolen = 0;

44
RenX.Core/RenX_Server.cpp

@ -184,6 +184,11 @@ bool RenX::Server::isLogChanType(int type) const
return RenX::Server::isPublicLogChanType(type) || RenX::Server::isAdminLogChanType(type);
}
bool RenX::Server::isPure() const
{
return RenX::Server::pure;
}
int RenX::Server::send(const Jupiter::ReadableString &command)
{
Jupiter::String cmd(command.size() + 2);
@ -923,6 +928,8 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
player->defenceKills = 0;
player->beaconPlacements = 0;
player->beaconDisarms = 0;
player->proxy_placements = 0;
player->proxy_disarms = 0;
player->captures = 0;
player->steals = 0;
player->stolen = 0;
@ -1046,6 +1053,7 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
if (r->name.isEmpty())
{
r->name = name;
r->name.processEscapeSequences();
recalcUUID = true;
}
if (recalcUUID)
@ -1420,6 +1428,23 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
buff.shiftLeft(1);
}
}
else if (this->lastCommand.equalsi("mutatorlist"_jrs))
{
// "The following mutators are loaded:" [ | Mutator [ | Mutator [ ... ] ] ]
buff.shiftRight(1);
size_t token_count = buff.tokenCount(RenX::DelimC);
if (token_count == 1)
RenX::Server::pure = true;
else if (token_count == 0)
RenX::Server::disconnect(RenX::DisconnectReason::ProtocolError);
else
{
RenX::Server::mutators.emptyAndDelete();
while (--token_count != 0)
RenX::Server::mutators.add(new Jupiter::StringS(Jupiter::ReferenceString::getToken(buff, token_count, RenX::DelimC)));
}
buff.shiftLeft(1);
}
else if (this->lastCommand.equalsi("changename"))
{
buff.shiftRight(1);
@ -1445,7 +1470,9 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
RenX::PlayerInfo *player = parseGetPlayerOrAdd(buff.getToken(4, RenX::DelimC));
Jupiter::ReferenceString objectType = buff.getToken(2, RenX::DelimC);
if (objectType.match("*Beacon"))
player->beaconPlacements++;
++player->beaconPlacements;
else if (objectType.equals("Rx_Weapon_DeployedProxyC4"_jrs))
++player->proxy_placements;
for (size_t i = 0; i < xPlugins.size(); i++)
xPlugins.get(i)->RenX_OnDeploy(this, player, objectType);
onAction();
@ -1457,7 +1484,9 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
RenX::PlayerInfo *player = parseGetPlayerOrAdd(buff.getToken(4, RenX::DelimC));
Jupiter::ReferenceString objectType = buff.getToken(2, RenX::DelimC);
if (objectType.match("*Beacon"))
player->beaconDisarms++;
++player->beaconDisarms;
else if (objectType.equals("Rx_Weapon_DeployedProxyC4"_jrs))
++player->proxy_disarms;
if (buff.getToken(5, RenX::DelimC).equals("owned by"))
{
@ -2413,20 +2442,15 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
if (this->rconVersion >= 3)
{
RenX::Server::sock.send(STRING_LITERAL_AS_REFERENCE("s\n"));
RenX::Server::send(STRING_LITERAL_AS_REFERENCE("serverinfo"));
RenX::Server::sock.send("s\n"_jrs);
RenX::Server::send("serverinfo"_jrs);
RenX::Server::send("mutatorlist"_jrs);
RenX::Server::fetchClientList();
RenX::Server::updateBuildingList();
this->firstGame = true;
this->seamless = true;
/*else if (this->firstGame == false)
{
this->firstAction = false;
this->silenceJoins = true;
}*/
for (size_t i = 0; i < xPlugins.size(); i++)
xPlugins.get(i)->RenX_OnVersion(this, buff);
buff.shiftLeft(1);

9
RenX.Core/RenX_Server.h

@ -84,6 +84,7 @@ namespace RenX
public: // RenX::Server
Jupiter::DLList<RenX::PlayerInfo> players; /** A list of players in the server */
Jupiter::ArrayList<RenX::BuildingInfo> buildings; /** A list of buildings in the server */
Jupiter::ArrayList<Jupiter::StringS> mutators; /** A list of buildings the server is running */
Jupiter::INIFile varData; /** This may be replaced later with a more dedicated type. */
/**
@ -159,6 +160,13 @@ namespace RenX
*/
bool isLogChanType(int type) const;
/**
* @brief Checks if a server is "pure" (i.e: not running any mutators).
*
* @return True if the server is pure, false otherwise.
*/
bool isPure() const;
/**
* @brief Sends a command to the server.
*
@ -814,6 +822,7 @@ namespace RenX
void init();
/** Tracking variables */
bool pure = false;
bool connected = false;
bool seamless = false;
bool passworded = false;

2
RenX.Core/RenX_Tags.cpp

@ -285,7 +285,7 @@ Jupiter::StringS TagsImp::get_building_health_bar(const RenX::BuildingInfo *buil
return Jupiter::StringS::empty;
size_t index = 0;
size_t greenBars = (building->health / building->max_health) * TagsImp::bar_width;
size_t greenBars = static_cast<size_t>((building->health / building->max_health) * TagsImp::bar_width);
Jupiter::String r(TagsImp::bar_width);
if (greenBars != 0)
{

2
RenX.Logging/RenX_Logging.cpp

@ -115,7 +115,7 @@ void RenX_LoggingPlugin::init()
Jupiter::StringS::Format(IRCCOLOR "12[Part] " IRCBOLD "%.*s" IRCBOLD " left the %.*s.", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->teamLongTag.size(), RenX::tags->teamLongTag.ptr()));
RenX_LoggingPlugin::kickFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("KickFormat"),
Jupiter::StringS::Format(IRCCOLOR "04[Kick] " IRCBOLD "%.*s" IRCCOLOR IRCBOLD " was " IRCBOLD IRCCOLOR "04kicked" IRCCOLOR IRCBOLD " from the server for \"" IRCCOLOR "04%.*s" IRCCOLOR "\".", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->messageTag.size(), RenX::tags->messageTag.ptr()));
Jupiter::StringS::Format(IRCCOLOR "04[Kick] " IRCBOLD "%.*s" IRCCOLOR IRCBOLD " was " IRCBOLD IRCCOLOR "04kicked" IRCCOLOR IRCBOLD " (" IRCCOLOR "04%.*s" IRCCOLOR ")", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->messageTag.size(), RenX::tags->messageTag.ptr()));
RenX_LoggingPlugin::playerExecuteFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("PlayerExecuteFormat"),
Jupiter::StringS::Format("%.*s" IRCCOLOR "07 executed: %.*s", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->messageTag.size(), RenX::tags->messageTag.ptr()));

Loading…
Cancel
Save