Browse Source

Added parsing for new "Dev;" and "Rank;" PLAYER logs.

pull/3/head
Jessica James 9 years ago
parent
commit
8c4e3dec07
  1. BIN
      Release/Plugins/RenX.Core.lib
  2. 7
      RenX.Core/RenX_PlayerInfo.h
  3. 10
      RenX.Core/RenX_Plugin.cpp
  4. 2
      RenX.Core/RenX_Plugin.h
  5. 39
      RenX.Core/RenX_Server.cpp

BIN
Release/Plugins/RenX.Core.lib

Binary file not shown.

7
RenX.Core/RenX_PlayerInfo.h

@ -43,6 +43,8 @@ namespace RenX
*/
struct RENX_API PlayerInfo
{
std::chrono::steady_clock::time_point joinTime = std::chrono::steady_clock::now();
// TODO: Add backpack
Jupiter::StringS name;
Jupiter::StringS ip;
@ -58,11 +60,12 @@ namespace RenX
TeamType team = TeamType::Other;
int id = 0;
bool isBot = false;
std::chrono::steady_clock::time_point joinTime = std::chrono::steady_clock::now();
bool is_dev = false;
unsigned short ping = 0;
double score = 0.0f;
double credits = 0.0f;
unsigned int global_rank = 0;
unsigned int local_rank = 0;
unsigned int kills = 0;
unsigned int deaths = 0;
unsigned int suicides = 0;

10
RenX.Core/RenX_Plugin.cpp

@ -106,6 +106,16 @@ void RenX::Plugin::RenX_OnIDChange(Server *, const PlayerInfo *, int)
return;
}
void RenX::Plugin::RenX_OnDev(Server *, const PlayerInfo *)
{
return;
}
void RenX::Plugin::RenX_OnRank(Server *, const PlayerInfo *)
{
return;
}
void RenX::Plugin::RenX_OnExecute(Server *, const PlayerInfo *, const Jupiter::ReadableString &)
{
return;

2
RenX.Core/RenX_Plugin.h

@ -59,6 +59,8 @@ namespace RenX
virtual void RenX_OnNameChange(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &newPlayerName);
virtual void RenX_OnTeamChange(Server *server, const PlayerInfo *player, const TeamType &oldTeam);
virtual void RenX_OnIDChange(Server *server, const PlayerInfo *player, int oldID);
virtual void RenX_OnRank(Server *server, const PlayerInfo *player);
virtual void RenX_OnDev(Server *server, const PlayerInfo *player);
virtual void RenX_OnExecute(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &command);
virtual void RenX_OnPlayer(Server *server, const Jupiter::ReadableString &raw);

39
RenX.Core/RenX_Server.cpp

@ -2308,7 +2308,27 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
uint64_t steamid = 0;
if (tokens.getToken(5).equals("steamid"))
steamid = tokens.getToken(6).asUnsignedLongLong();
RenX::PlayerInfo *player = getPlayerOrAdd(name, id, team, isBot, steamid, tokens.getToken(4));
if (steamid != 0ULL && default_ladder_database != nullptr && (player->ban_flags & RenX::BanDatabase::Entry::FLAG_TYPE_LADDER) == 0)
{
RenX::LadderDatabase::Entry *itr = RenX::default_ladder_database->getHead();
while (itr != nullptr)
{
if (itr->steam_id == steamid)
{
player->local_rank = itr->rank;
if (this->devBot)
{
player->global_rank = itr->rank;
this->sendData(Jupiter::StringS::Format("xcset_rank %d\n", player->id));
}
break;
}
itr = itr->next;
}
}
for (size_t i = 0; i < xPlugins.size(); i++)
xPlugins.get(i)->RenX_OnJoin(this, player);
}
@ -2366,10 +2386,29 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
player->id = tokens.getToken(3).asInt();
if (player->isBot == false)
this->banCheck(player);
if (this->devBot && player->global_rank != 0U)
this->sendData(Jupiter::StringS::Format("xcset_rank %d\n", player->id));
for (size_t i = 0; i < xPlugins.size(); i++)
xPlugins.get(i)->RenX_OnIDChange(this, player, oldID);
}
}
else if (subHeader.equals("Rank;"))
{
// Player | Rank
if (this->devBot == false)
{
RenX::PlayerInfo *player = parseGetPlayerOrAdd(tokens.getToken(1));
if (player != nullptr)
player->global_rank = tokens.getToken(2).asUnsignedInt();
}
}
else if (subHeader.equals("Dev;"))
{
// Player | true/false
RenX::PlayerInfo *player = parseGetPlayerOrAdd(tokens.getToken(1));
if (player != nullptr)
player->is_dev = tokens.getToken(2).asBool();
}
else
{
Jupiter::ReferenceString raw = gotoToken(1);

Loading…
Cancel
Save