Browse Source

RenX.Core:

* Added more per-building data; added tags for new data
RenX.Commands:
* Added 'StaffTitle' config option to be able to configure the generic title for staff (default: "Moderator"). Reworded some strings.
RenX.AlwaysRecord:
* Added explicit 'override' keyword to 'RenX_OnMapStart'
pull/3/head
Jessica James 9 years ago
parent
commit
c9858d76cc
  1. BIN
      Release/Plugins/RenX.Core.lib
  2. 4
      RenX.AlwaysRecord/RenX_AlwaysRecord.h
  3. 50
      RenX.Commands/RenX_Commands.cpp
  4. 2
      RenX.Commands/RenX_Commands.h
  5. 10
      RenX.Core/RenX_BuildingInfo.h
  6. 23
      RenX.Core/RenX_Server.cpp
  7. 67
      RenX.Core/RenX_Tags.cpp
  8. 14
      RenX.Core/RenX_Tags.h

BIN
Release/Plugins/RenX.Core.lib

Binary file not shown.

4
RenX.AlwaysRecord/RenX_AlwaysRecord.h

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2015 Jessica James. * Copyright (C) 2015-2016 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -26,7 +26,7 @@
class RenX_AlwaysRecord : public RenX::Plugin class RenX_AlwaysRecord : public RenX::Plugin
{ {
public: // RenX::Plugin public: // RenX::Plugin
void RenX_OnMapStart(RenX::Server *server, const Jupiter::ReadableString &); void RenX_OnMapStart(RenX::Server *server, const Jupiter::ReadableString &) override;
public: // Jupiter::Plugin public: // Jupiter::Plugin
const Jupiter::ReadableString &getName() override { return name; } const Jupiter::ReadableString &getName() override { return name; }

50
RenX.Commands/RenX_Commands.cpp

@ -70,6 +70,7 @@ int RenX_CommandsPlugin::OnRehash()
RenX_CommandsPlugin::playerInfoFormat = Jupiter::IRC::Client::Config->get(RenX_CommandsPlugin::getName(), STRING_LITERAL_AS_REFERENCE("PlayerInfoFormat"), STRING_LITERAL_AS_REFERENCE(IRCCOLOR "03[Player Info]" IRCCOLOR "{TCOLOR} Name: " IRCBOLD "{RNAME}" IRCBOLD " - ID: {ID} - Team: " IRCBOLD "{TEAML}" IRCBOLD " - Vehicle Kills: {VEHICLEKILLS} - Building Kills {BUILDINGKILLS} - Kills {KILLS} - Deaths: {DEATHS} - KDR: {KDR} - Access: {ACCESS}")); RenX_CommandsPlugin::playerInfoFormat = Jupiter::IRC::Client::Config->get(RenX_CommandsPlugin::getName(), STRING_LITERAL_AS_REFERENCE("PlayerInfoFormat"), STRING_LITERAL_AS_REFERENCE(IRCCOLOR "03[Player Info]" IRCCOLOR "{TCOLOR} Name: " IRCBOLD "{RNAME}" IRCBOLD " - ID: {ID} - Team: " IRCBOLD "{TEAML}" IRCBOLD " - Vehicle Kills: {VEHICLEKILLS} - Building Kills {BUILDINGKILLS} - Kills {KILLS} - Deaths: {DEATHS} - KDR: {KDR} - Access: {ACCESS}"));
RenX_CommandsPlugin::adminPlayerInfoFormat = Jupiter::IRC::Client::Config->get(RenX_CommandsPlugin::getName(), STRING_LITERAL_AS_REFERENCE("AdminPlayerInfoFormat"), Jupiter::StringS::Format("%.*s - IP: " IRCBOLD "{IP}" IRCBOLD " - RDNS: " IRCBOLD "{RDNS}" IRCBOLD " - Steam ID: " IRCBOLD "{STEAM}", RenX_CommandsPlugin::playerInfoFormat.size(), RenX_CommandsPlugin::playerInfoFormat.ptr())); RenX_CommandsPlugin::adminPlayerInfoFormat = Jupiter::IRC::Client::Config->get(RenX_CommandsPlugin::getName(), STRING_LITERAL_AS_REFERENCE("AdminPlayerInfoFormat"), Jupiter::StringS::Format("%.*s - IP: " IRCBOLD "{IP}" IRCBOLD " - RDNS: " IRCBOLD "{RDNS}" IRCBOLD " - Steam ID: " IRCBOLD "{STEAM}", RenX_CommandsPlugin::playerInfoFormat.size(), RenX_CommandsPlugin::playerInfoFormat.ptr()));
RenX_CommandsPlugin::buildingInfoFormat = Jupiter::IRC::Client::Config->get(RenX_CommandsPlugin::getName(), STRING_LITERAL_AS_REFERENCE("BuildingInfoFormat"), STRING_LITERAL_AS_REFERENCE(IRCCOLOR) + RenX::tags->buildingTeamColorTag + RenX::tags->buildingNameTag + STRING_LITERAL_AS_REFERENCE(IRCCOLOR " - " IRCCOLOR "07") + RenX::tags->buildingHealthPercentageTag + STRING_LITERAL_AS_REFERENCE("%")); RenX_CommandsPlugin::buildingInfoFormat = Jupiter::IRC::Client::Config->get(RenX_CommandsPlugin::getName(), STRING_LITERAL_AS_REFERENCE("BuildingInfoFormat"), STRING_LITERAL_AS_REFERENCE(IRCCOLOR) + RenX::tags->buildingTeamColorTag + RenX::tags->buildingNameTag + STRING_LITERAL_AS_REFERENCE(IRCCOLOR " - " IRCCOLOR "07") + RenX::tags->buildingHealthPercentageTag + STRING_LITERAL_AS_REFERENCE("%"));
RenX_CommandsPlugin::staffTitle = Jupiter::IRC::Client::Config->get(RenX_CommandsPlugin::getName(), STRING_LITERAL_AS_REFERENCE("StaffTitle"), STRING_LITERAL_AS_REFERENCE("Moderator"));
RenX::sanitizeTags(RenX_CommandsPlugin::playerInfoFormat); RenX::sanitizeTags(RenX_CommandsPlugin::playerInfoFormat);
RenX::sanitizeTags(RenX_CommandsPlugin::adminPlayerInfoFormat); RenX::sanitizeTags(RenX_CommandsPlugin::adminPlayerInfoFormat);
@ -97,6 +98,11 @@ const Jupiter::ReadableString &RenX_CommandsPlugin::getBuildingInfoFormat() cons
return RenX_CommandsPlugin::buildingInfoFormat; return RenX_CommandsPlugin::buildingInfoFormat;
} }
const Jupiter::ReadableString &RenX_CommandsPlugin::getStaffTitle() const
{
return RenX_CommandsPlugin::staffTitle;
}
RenX_CommandsPlugin::RenX_CommandsPlugin() RenX_CommandsPlugin::RenX_CommandsPlugin()
{ {
this->OnRehash(); this->OnRehash();
@ -1039,6 +1045,7 @@ IRC_COMMAND_INIT(KillDeathRatioIRCCommand)
void ShowModsIRCCommand::create() void ShowModsIRCCommand::create()
{ {
this->addTrigger(STRING_LITERAL_AS_REFERENCE("showstaff"));
this->addTrigger(STRING_LITERAL_AS_REFERENCE("showmods")); this->addTrigger(STRING_LITERAL_AS_REFERENCE("showmods"));
} }
@ -1067,7 +1074,7 @@ void ShowModsIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString
const Jupiter::ReadableString &ShowModsIRCCommand::getHelp(const Jupiter::ReadableString &) const Jupiter::ReadableString &ShowModsIRCCommand::getHelp(const Jupiter::ReadableString &)
{ {
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Sends a message, displaying the in-game moderators. Syntax: showmods"); static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Sends a message, displaying in-game staff. Syntax: showstaff");
return defaultHelp; return defaultHelp;
} }
@ -1077,6 +1084,7 @@ IRC_COMMAND_INIT(ShowModsIRCCommand)
void ModsIRCCommand::create() void ModsIRCCommand::create()
{ {
this->addTrigger(STRING_LITERAL_AS_REFERENCE("staff"));
this->addTrigger(STRING_LITERAL_AS_REFERENCE("mods")); this->addTrigger(STRING_LITERAL_AS_REFERENCE("mods"));
} }
@ -1091,6 +1099,7 @@ void ModsIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &cha
int type = chan->getType(); int type = chan->getType();
RenX::PlayerInfo *player; RenX::PlayerInfo *player;
Jupiter::StringL msg; Jupiter::StringL msg;
const Jupiter::ReadableString &staff_word = pluginInstance.getStaffTitle();
for (unsigned int i = 0; i != RenX::getCore()->getServerCount(); i++) for (unsigned int i = 0; i != RenX::getCore()->getServerCount(); i++)
{ {
RenX::Server *server = RenX::getCore()->getServer(i); RenX::Server *server = RenX::getCore()->getServer(i);
@ -1106,14 +1115,14 @@ void ModsIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &cha
{ {
if (msg.isNotEmpty()) if (msg.isNotEmpty())
msg += ", "; msg += ", ";
else msg += "Moderators in-game: "; else msg += staff_word + "s in-game: "_jrs;
msg += player->gamePrefix; msg += player->gamePrefix;
msg += player->name; msg += player->name;
} }
} }
} }
if (msg.isEmpty()) if (msg.isEmpty())
msg = "No moderators are in-game."; msg = "No "_jrs + staff_word + "s are in-game."_jrs;
source->sendMessage(channel, msg); source->sendMessage(channel, msg);
} }
} }
@ -1125,7 +1134,7 @@ void ModsIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &cha
const Jupiter::ReadableString &ModsIRCCommand::getHelp(const Jupiter::ReadableString &) const Jupiter::ReadableString &ModsIRCCommand::getHelp(const Jupiter::ReadableString &)
{ {
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Sends a message, displaying the in-game moderators. Syntax: mods [show]"); static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Sends a message, displaying in-game staff. Syntax: staff [show]");
return defaultHelp; return defaultHelp;
} }
@ -3099,6 +3108,7 @@ GAME_COMMAND_INIT(HelpGameCommand)
void ModsGameCommand::create() void ModsGameCommand::create()
{ {
this->addTrigger(STRING_LITERAL_AS_REFERENCE("staff"));
this->addTrigger(STRING_LITERAL_AS_REFERENCE("mods")); this->addTrigger(STRING_LITERAL_AS_REFERENCE("mods"));
this->addTrigger(STRING_LITERAL_AS_REFERENCE("showmods")); this->addTrigger(STRING_LITERAL_AS_REFERENCE("showmods"));
} }
@ -3107,13 +3117,14 @@ void ModsGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *, const Ju
{ {
RenX::PlayerInfo *player; RenX::PlayerInfo *player;
Jupiter::StringL msg; Jupiter::StringL msg;
const Jupiter::ReadableString &staff_word = pluginInstance.getStaffTitle();
for (Jupiter::DLList<RenX::PlayerInfo>::Node *node = source->players.getNode(0); node != nullptr; node = node->next) for (Jupiter::DLList<RenX::PlayerInfo>::Node *node = source->players.getNode(0); node != nullptr; node = node->next)
{ {
player = node->data; player = node->data;
if (player->isBot == false && (player->adminType.isNotEmpty() || (player->access != 0 && (player->gamePrefix.isNotEmpty() || player->formatNamePrefix.isNotEmpty())))) if (player->isBot == false && (player->adminType.isNotEmpty() || (player->access != 0 && (player->gamePrefix.isNotEmpty() || player->formatNamePrefix.isNotEmpty()))))
{ {
if (msg.isEmpty()) if (msg.isEmpty())
msg = "Moderators in-game: "; msg = staff_word + "s in-game: "_jrs;
else else
msg += ", "; msg += ", ";
msg += player->gamePrefix; msg += player->gamePrefix;
@ -3122,7 +3133,7 @@ void ModsGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *, const Ju
} }
if (msg.isEmpty()) if (msg.isEmpty())
{ {
msg += "No moderators are in-game"; msg += "No "_jrs + staff_word + "s are in-game"_jrs;
RenX::GameCommand *cmd = source->getCommand(STRING_LITERAL_AS_REFERENCE("modrequest")); RenX::GameCommand *cmd = source->getCommand(STRING_LITERAL_AS_REFERENCE("modrequest"));
if (cmd != nullptr) if (cmd != nullptr)
msg.aformat("; please use \"%.*s%.*s\" if you require assistance.", source->getCommandPrefix().size(), source->getCommandPrefix().ptr(), cmd->getTrigger().size(), cmd->getTrigger().ptr()); msg.aformat("; please use \"%.*s%.*s\" if you require assistance.", source->getCommandPrefix().size(), source->getCommandPrefix().ptr(), cmd->getTrigger().size(), cmd->getTrigger().ptr());
@ -3133,7 +3144,7 @@ void ModsGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *, const Ju
const Jupiter::ReadableString &ModsGameCommand::getHelp(const Jupiter::ReadableString &) const Jupiter::ReadableString &ModsGameCommand::getHelp(const Jupiter::ReadableString &)
{ {
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Displays the in-game moderators. Syntax: mods"); static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Displays in-game staff. Syntax: staff");
return defaultHelp; return defaultHelp;
} }
@ -3173,14 +3184,15 @@ void ModRequestGameCommand::create()
void ModRequestGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player, const Jupiter::ReadableString &parameters) void ModRequestGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player, const Jupiter::ReadableString &parameters)
{ {
const Jupiter::ReadableString &staff_word = pluginInstance.getStaffTitle();
unsigned int serverCount = serverManager->size(); unsigned int serverCount = serverManager->size();
IRC_Bot *server; IRC_Bot *server;
Jupiter::IRC::Client::Channel *channel; Jupiter::IRC::Client::Channel *channel;
unsigned int channelCount; unsigned int channelCount;
unsigned int messageCount = 0; unsigned int messageCount = 0;
Jupiter::String &fmtName = RenX::getFormattedPlayerName(player); Jupiter::String &fmtName = RenX::getFormattedPlayerName(player);
Jupiter::StringL msg = Jupiter::StringL::Format(IRCCOLOR "12[Moderator Request] " IRCCOLOR IRCBOLD "%.*s" IRCBOLD IRCCOLOR "07 has requested assistance in-game; please look in ", fmtName.size(), fmtName.ptr()); Jupiter::StringL msg = Jupiter::StringL::Format(IRCCOLOR "12[%.*s Request] " IRCCOLOR IRCBOLD "%.*s" IRCBOLD IRCCOLOR "07 has requested assistance in-game; please look in ", staff_word.size(), staff_word.ptr(), fmtName.size(), fmtName.ptr());
Jupiter::StringS msg2 = Jupiter::StringS::Format(IRCCOLOR "12[Moderator Request] " IRCCOLOR IRCBOLD "%.*s" IRCBOLD IRCCOLOR "07 has requested assistance in-game!" IRCCOLOR, fmtName.size(), fmtName.ptr()); Jupiter::StringS msg2 = Jupiter::StringS::Format(IRCCOLOR "12[%.*s Request] " IRCCOLOR IRCBOLD "%.*s" IRCBOLD IRCCOLOR "07 has requested assistance in-game!" IRCCOLOR, staff_word.size(), staff_word.ptr(), fmtName.size(), fmtName.ptr());
for (unsigned int a = 0; a < serverCount; a++) for (unsigned int a = 0; a < serverCount; a++)
{ {
server = serverManager->getServer(a); server = serverManager->getServer(a);
@ -3204,12 +3216,12 @@ void ModRequestGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *play
} }
} }
} }
source->sendMessage(player, Jupiter::StringS::Format("A total of %u moderators have been notified of your assistance request.", messageCount)); source->sendMessage(player, Jupiter::StringS::Format("A total of %u %.*ss have been notified of your assistance request.", staff_word.size(), staff_word.ptr(), messageCount));
} }
const Jupiter::ReadableString &ModRequestGameCommand::getHelp(const Jupiter::ReadableString &) const Jupiter::ReadableString &ModRequestGameCommand::getHelp(const Jupiter::ReadableString &)
{ {
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Notifies the moderators on IRC that assistance is required. Syntax: modRequest"); static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Notifies staff on IRC that assistance is required. Syntax: modRequest");
return defaultHelp; return defaultHelp;
} }
@ -3231,7 +3243,7 @@ void KillGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player, co
if (target == nullptr) if (target == nullptr)
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: Player not found.")); source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: Player not found."));
else if (target->access >= player->access) else if (target->access >= player->access)
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: You can not kill higher level moderators.")); source->sendMessage(player, "Error: You can not kill higher level "_jrs + pluginInstance.getStaffTitle() + "s."_jrs);
else else
{ {
source->kill(target); source->kill(target);
@ -3266,7 +3278,7 @@ void DisarmGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player,
if (target == nullptr) if (target == nullptr)
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: Player not found.")); source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: Player not found."));
else if (target->access >= player->access) else if (target->access >= player->access)
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: You can not disarm higher level moderators.")); source->sendMessage(player, "Error: You can not disarm higher level "_jrs + pluginInstance.getStaffTitle() + "s."_jrs);
else if (source->disarm(target) == false) else if (source->disarm(target) == false)
source->sendMessage(player, "Error: Server does not support disarms."_jrs); source->sendMessage(player, "Error: Server does not support disarms."_jrs);
else else
@ -3300,7 +3312,7 @@ void DisarmC4GameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player
if (target == nullptr) if (target == nullptr)
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: Player not found.")); source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: Player not found."));
else if (target->access >= player->access) else if (target->access >= player->access)
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: You can not disarm higher level moderators.")); source->sendMessage(player, "Error: You can not disarm higher level "_jrs + pluginInstance.getStaffTitle() + "s."_jrs);
else if (source->disarmC4(target) == false) else if (source->disarmC4(target) == false)
source->sendMessage(player, "Error: Server does not support disarms."_jrs); source->sendMessage(player, "Error: Server does not support disarms."_jrs);
else else
@ -3336,7 +3348,7 @@ void DisarmBeaconGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *pl
if (target == nullptr) if (target == nullptr)
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: Player not found.")); source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: Player not found."));
else if (target->access >= player->access) else if (target->access >= player->access)
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: You can not disarm higher level moderators.")); source->sendMessage(player, "Error: You can not disarm higher level "_jrs + pluginInstance.getStaffTitle() + "s."_jrs);
else if (source->disarmBeacon(target) == false) else if (source->disarmBeacon(target) == false)
source->sendMessage(player, "Error: Server does not support disarms."_jrs); source->sendMessage(player, "Error: Server does not support disarms."_jrs);
else else
@ -3370,7 +3382,7 @@ void MineBanGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player,
if (target == nullptr) if (target == nullptr)
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: Player not found.")); source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: Player not found."));
else if (target->access >= player->access) else if (target->access >= player->access)
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: You can not mine-ban higher level moderators.")); source->sendMessage(player, "Error: You can not mine-ban higher level "_jrs + pluginInstance.getStaffTitle() + "s."_jrs);
else else
{ {
source->mineBan(target); source->mineBan(target);
@ -3411,7 +3423,7 @@ void KickGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player, co
else if (player == target) else if (player == target)
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: You can not kick yourself.")); source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: You can not kick yourself."));
else if (target->access >= player->access) else if (target->access >= player->access)
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: You can not kick higher level moderators.")); source->sendMessage(player, "Error: You can not kick higher level "_jrs + pluginInstance.getStaffTitle() + "s."_jrs);
else else
{ {
source->kickPlayer(target, reason); source->kickPlayer(target, reason);
@ -3452,7 +3464,7 @@ void TempBanGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player,
else if (player == target) else if (player == target)
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: You can not ban yourself.")); source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: You can not ban yourself."));
else if (target->access >= player->access) else if (target->access >= player->access)
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: You can not ban higher level moderators.")); source->sendMessage(player, "Error: You can not ban higher level "_jrs + pluginInstance.getStaffTitle() + "s."_jrs);
else else
{ {
source->banPlayer(target, player->name, reason, pluginInstance.getTBanTime()); source->banPlayer(target, player->name, reason, pluginInstance.getTBanTime());
@ -3494,7 +3506,7 @@ void KickBanGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player,
else if (player == target) else if (player == target)
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: You can not ban yourself.")); source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: You can not ban yourself."));
else if (target->access >= player->access) else if (target->access >= player->access)
source->sendMessage(player, STRING_LITERAL_AS_REFERENCE("Error: You can not ban higher level moderators.")); source->sendMessage(player, "Error: You can not ban higher level "_jrs + pluginInstance.getStaffTitle() + "s."_jrs);
else else
{ {
source->banPlayer(target, player->name, reason); source->banPlayer(target, player->name, reason);

2
RenX.Commands/RenX_Commands.h

@ -41,6 +41,7 @@ public:
const Jupiter::ReadableString &getPlayerInfoFormat() const; const Jupiter::ReadableString &getPlayerInfoFormat() const;
const Jupiter::ReadableString &getAdminPlayerInfoFormat() const; const Jupiter::ReadableString &getAdminPlayerInfoFormat() const;
const Jupiter::ReadableString &getBuildingInfoFormat() const; const Jupiter::ReadableString &getBuildingInfoFormat() const;
const Jupiter::ReadableString &getStaffTitle() const;
RenX_CommandsPlugin(); RenX_CommandsPlugin();
private: private:
@ -49,6 +50,7 @@ private:
Jupiter::StringS playerInfoFormat; Jupiter::StringS playerInfoFormat;
Jupiter::StringS adminPlayerInfoFormat; Jupiter::StringS adminPlayerInfoFormat;
Jupiter::StringS buildingInfoFormat; Jupiter::StringS buildingInfoFormat;
Jupiter::StringS staffTitle;
}; };
GENERIC_CONSOLE_COMMAND(RawRCONConsoleCommand) GENERIC_CONSOLE_COMMAND(RawRCONConsoleCommand)

10
RenX.Core/RenX_BuildingInfo.h

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2015 Jessica James. * Copyright (C) 2015-2016 Jessica James.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -44,9 +44,13 @@ namespace RenX
{ {
Jupiter::StringS name; Jupiter::StringS name;
TeamType team = TeamType::Other; TeamType team = TeamType::Other;
double health = 0; int health = 0;
double max_health = 0; int max_health = 0;
int armor = 0;
int max_armor = 0;
bool capturable = false; bool capturable = false;
bool destroyed = false;
std::chrono::steady_clock::time_point destruction_time;
mutable Jupiter::INIFile varData; mutable Jupiter::INIFile varData;
}; };

23
RenX.Core/RenX_Server.cpp

@ -1690,8 +1690,8 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
{ {
/* /*
lRCON Command; DevBot executed: binfo lRCON Command; DevBot executed: binfo
rBuilding Health MaxHealth Team Capturable rBuilding Health MaxHealth Armor MaxArmor Team Capturable Destroyed
rRx_Building_Refinery_GDI 4000 4000 GDI False rRx_Building_Refinery_GDI 2000 2000 2000 2000 GDI False False
*/ */
Jupiter::INIFile::Section table; Jupiter::INIFile::Section table;
size_t i = tokens.token_count; size_t i = tokens.token_count;
@ -1727,6 +1727,18 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
pair = table.getPair("Capturable"_jrs); pair = table.getPair("Capturable"_jrs);
if (pair != nullptr) if (pair != nullptr)
building->capturable = pair->getValue().asBool(); building->capturable = pair->getValue().asBool();
pair = table.getPair("Destroyed"_jrs);
if (pair != nullptr)
building->destroyed = pair->getValue().asBool();
pair = table.getPair("Armor"_jrs);
if (pair != nullptr)
building->armor = pair->getValue().asInt(10);
pair = table.getPair("MaxArmor"_jrs);
if (pair != nullptr)
building->max_armor = pair->getValue().asInt(10);
} }
} }
} }
@ -2264,7 +2276,12 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
objectName.truncate(internalsStr.size()); objectName.truncate(internalsStr.size());
building = RenX::Server::getBuildingByName(objectName); building = RenX::Server::getBuildingByName(objectName);
if (building != nullptr) if (building != nullptr)
building->health = 0.0; {
building->health = 0;
building->armor = 0;
building->destroyed = true;
building->destruction_time = std::chrono::steady_clock::now();
}
} }
break; break;

67
RenX.Core/RenX_Tags.cpp

@ -36,7 +36,6 @@ struct TagsImp : RenX::Tags
void processTags(Jupiter::StringType &msg, const RenX::LadderDatabase::Entry &entry); void processTags(Jupiter::StringType &msg, const RenX::LadderDatabase::Entry &entry);
void sanitizeTags(Jupiter::StringType &fmt); void sanitizeTags(Jupiter::StringType &fmt);
const Jupiter::ReadableString &getUniqueInternalTag(); const Jupiter::ReadableString &getUniqueInternalTag();
Jupiter::StringS get_building_health_bar(const RenX::BuildingInfo *building);
private: private:
Jupiter::StringS uniqueTag; Jupiter::StringS uniqueTag;
union union
@ -196,7 +195,12 @@ TagsImp::TagsImp()
this->INTERNAL_BUILDING_HEALTH_TAG = this->getUniqueInternalTag(); this->INTERNAL_BUILDING_HEALTH_TAG = this->getUniqueInternalTag();
this->INTERNAL_BUILDING_MAX_HEALTH_TAG = this->getUniqueInternalTag(); this->INTERNAL_BUILDING_MAX_HEALTH_TAG = this->getUniqueInternalTag();
this->INTERNAL_BUILDING_HEALTH_PERCENTAGE_TAG = this->getUniqueInternalTag(); this->INTERNAL_BUILDING_HEALTH_PERCENTAGE_TAG = this->getUniqueInternalTag();
this->INTERNAL_BUILDING_HEALTH_BAR_TAG = this->getUniqueInternalTag(); this->INTERNAL_BUILDING_ARMOR_TAG = this->getUniqueInternalTag();
this->INTERNAL_BUILDING_MAX_ARMOR_TAG = this->getUniqueInternalTag();
this->INTERNAL_BUILDING_ARMOR_PERCENTAGE_TAG = this->getUniqueInternalTag();
this->INTERNAL_BUILDING_DURABILITY_TAG = this->getUniqueInternalTag();
this->INTERNAL_BUILDING_MAX_DURABILITY_TAG = this->getUniqueInternalTag();
this->INTERNAL_BUILDING_DURABILITY_PERCENTAGE_TAG = this->getUniqueInternalTag();
this->INTERNAL_BUILDING_TEAM_COLOR_TAG = this->getUniqueInternalTag(); this->INTERNAL_BUILDING_TEAM_COLOR_TAG = this->getUniqueInternalTag();
this->INTERNAL_BUILDING_TEAM_SHORT_TAG = this->getUniqueInternalTag(); this->INTERNAL_BUILDING_TEAM_SHORT_TAG = this->getUniqueInternalTag();
this->INTERNAL_BUILDING_TEAM_LONG_TAG = this->getUniqueInternalTag(); this->INTERNAL_BUILDING_TEAM_LONG_TAG = this->getUniqueInternalTag();
@ -375,7 +379,12 @@ TagsImp::TagsImp()
this->buildingHealthTag = Jupiter::IRC::Client::Config->get(configSection, "BuildingHealthTag"_jrs, "{BHEALTH}"_jrs); this->buildingHealthTag = Jupiter::IRC::Client::Config->get(configSection, "BuildingHealthTag"_jrs, "{BHEALTH}"_jrs);
this->buildingMaxHealthTag = Jupiter::IRC::Client::Config->get(configSection, "BuildingMaxHealthTag"_jrs, "{BMHEALTH}"_jrs); this->buildingMaxHealthTag = Jupiter::IRC::Client::Config->get(configSection, "BuildingMaxHealthTag"_jrs, "{BMHEALTH}"_jrs);
this->buildingHealthPercentageTag = Jupiter::IRC::Client::Config->get(configSection, "BuildingHealthPercentageTag"_jrs, "{BHP}"_jrs); this->buildingHealthPercentageTag = Jupiter::IRC::Client::Config->get(configSection, "BuildingHealthPercentageTag"_jrs, "{BHP}"_jrs);
this->buildingHealthBarTag = Jupiter::IRC::Client::Config->get(configSection, "BuildingHealthBarTag"_jrs, "{BHBAR}"_jrs); this->buildingArmorTag = Jupiter::IRC::Client::Config->get(configSection, "BuildingArmorTag"_jrs, "{BARMOR}"_jrs);
this->buildingMaxArmorTag = Jupiter::IRC::Client::Config->get(configSection, "BuildingMaxArmorTag"_jrs, "{BMARMOR}"_jrs);
this->buildingArmorPercentageTag = Jupiter::IRC::Client::Config->get(configSection, "BuildingArmorPercentageTag"_jrs, "{BAP}"_jrs);
this->buildingDurabilityTag = Jupiter::IRC::Client::Config->get(configSection, "BuildingDurabilityTag"_jrs, "{BDURABILITY}"_jrs);
this->buildingMaxDurabilityTag = Jupiter::IRC::Client::Config->get(configSection, "BuildingMaxDurabilityTag"_jrs, "{BMDURABILITY}"_jrs);
this->buildingDurabilityPercentageTag = Jupiter::IRC::Client::Config->get(configSection, "BuildingDurabilityPercentageTag"_jrs, "{BDP}"_jrs);
this->buildingTeamColorTag = Jupiter::IRC::Client::Config->get(configSection, "BuildingTeamColorTag"_jrs, "{BCOLOR}"_jrs); this->buildingTeamColorTag = Jupiter::IRC::Client::Config->get(configSection, "BuildingTeamColorTag"_jrs, "{BCOLOR}"_jrs);
this->buildingTeamShortTag = Jupiter::IRC::Client::Config->get(configSection, "BuildingShortTeamTag"_jrs, "{BTEAMS}"_jrs); this->buildingTeamShortTag = Jupiter::IRC::Client::Config->get(configSection, "BuildingShortTeamTag"_jrs, "{BTEAMS}"_jrs);
this->buildingTeamLongTag = Jupiter::IRC::Client::Config->get(configSection, "BuildingLongTeamTag"_jrs, "{BTEAML}"_jrs); this->buildingTeamLongTag = Jupiter::IRC::Client::Config->get(configSection, "BuildingLongTeamTag"_jrs, "{BTEAML}"_jrs);
@ -425,40 +434,6 @@ TagsImp::TagsImp()
this->loseScoreTag = Jupiter::IRC::Client::Config->get(configSection, "LoseScoreTag"_jrs, "{LOSESCORE}"_jrs); this->loseScoreTag = Jupiter::IRC::Client::Config->get(configSection, "LoseScoreTag"_jrs, "{LOSESCORE}"_jrs);
} }
Jupiter::StringS TagsImp::get_building_health_bar(const RenX::BuildingInfo *building)
{
if (TagsImp::bar_width == 0)
return Jupiter::StringS::empty;
size_t index = 0;
size_t greenBars = static_cast<size_t>((building->health / building->max_health) * TagsImp::bar_width);
Jupiter::String r(TagsImp::bar_width);
if (greenBars != 0)
{
r = IRCCOLOR "02,09";
do
{
if (index % 2 == 0)
r += '/';
else
r += ' ';
}
while (++index != greenBars);
if (index == TagsImp::bar_width)
return r += IRCNORMAL;
}
r += IRCCOLOR "02,04";
do
{
if (index % 2 == 0)
r += '\\';
else
r += ' ';
}
while (++index != TagsImp::bar_width);
return r += IRCNORMAL;
}
double get_ratio(double num, double denom) double get_ratio(double num, double denom)
{ {
if (denom == 0.0f) if (denom == 0.0f)
@ -588,10 +563,15 @@ void TagsImp::processTags(Jupiter::StringType &msg, const RenX::Server *server,
{ {
PROCESS_TAG(this->INTERNAL_BUILDING_NAME_TAG, RenX::translateName(building->name)); PROCESS_TAG(this->INTERNAL_BUILDING_NAME_TAG, RenX::translateName(building->name));
PROCESS_TAG(this->INTERNAL_BUILDING_RAW_NAME_TAG, building->name); PROCESS_TAG(this->INTERNAL_BUILDING_RAW_NAME_TAG, building->name);
PROCESS_TAG(this->INTERNAL_BUILDING_HEALTH_TAG, Jupiter::StringS::Format("%.0f", building->health)); PROCESS_TAG(this->INTERNAL_BUILDING_HEALTH_TAG, Jupiter::StringS::Format("%d", building->health));
PROCESS_TAG(this->INTERNAL_BUILDING_MAX_HEALTH_TAG, Jupiter::StringS::Format("%.0f", building->health)); PROCESS_TAG(this->INTERNAL_BUILDING_MAX_HEALTH_TAG, Jupiter::StringS::Format("%d", building->max_health));
PROCESS_TAG(this->INTERNAL_BUILDING_HEALTH_PERCENTAGE_TAG, Jupiter::StringS::Format("%.0f", (building->health / building->max_health) * 100.0)); PROCESS_TAG(this->INTERNAL_BUILDING_HEALTH_PERCENTAGE_TAG, Jupiter::StringS::Format("%.0f", (building->health / building->max_health) * 100.0));
PROCESS_TAG(this->INTERNAL_BUILDING_HEALTH_BAR_TAG, get_building_health_bar(building)); PROCESS_TAG(this->INTERNAL_BUILDING_ARMOR_TAG, Jupiter::StringS::Format("%d", building->armor));
PROCESS_TAG(this->INTERNAL_BUILDING_MAX_ARMOR_TAG, Jupiter::StringS::Format("%d", building->max_armor));
PROCESS_TAG(this->INTERNAL_BUILDING_ARMOR_PERCENTAGE_TAG, Jupiter::StringS::Format("%.0f", (static_cast<double>(building->armor) / static_cast<double>(building->max_armor)) * 100.0));
PROCESS_TAG(this->INTERNAL_BUILDING_DURABILITY_TAG, Jupiter::StringS::Format("%d", building->health + building->armor));
PROCESS_TAG(this->INTERNAL_BUILDING_MAX_DURABILITY_TAG, Jupiter::StringS::Format("%d", building->max_health + building->max_armor));
PROCESS_TAG(this->INTERNAL_BUILDING_DURABILITY_PERCENTAGE_TAG, Jupiter::StringS::Format("%.0f", (static_cast<double>(building->health + building->armor) / static_cast<double>(building->max_health + building->max_armor)) * 100.0));
PROCESS_TAG(this->INTERNAL_BUILDING_TEAM_COLOR_TAG, RenX::getTeamColor(building->team)); PROCESS_TAG(this->INTERNAL_BUILDING_TEAM_COLOR_TAG, RenX::getTeamColor(building->team));
PROCESS_TAG(this->INTERNAL_BUILDING_TEAM_SHORT_TAG, RenX::getTeamName(building->team)); PROCESS_TAG(this->INTERNAL_BUILDING_TEAM_SHORT_TAG, RenX::getTeamName(building->team));
PROCESS_TAG(this->INTERNAL_BUILDING_TEAM_LONG_TAG, RenX::getFullTeamName(building->team)); PROCESS_TAG(this->INTERNAL_BUILDING_TEAM_LONG_TAG, RenX::getFullTeamName(building->team));
@ -827,7 +807,12 @@ void TagsImp::sanitizeTags(Jupiter::StringType &fmt)
fmt.replace(this->buildingHealthTag, this->INTERNAL_BUILDING_HEALTH_TAG); fmt.replace(this->buildingHealthTag, this->INTERNAL_BUILDING_HEALTH_TAG);
fmt.replace(this->buildingMaxHealthTag, this->INTERNAL_BUILDING_MAX_HEALTH_TAG); fmt.replace(this->buildingMaxHealthTag, this->INTERNAL_BUILDING_MAX_HEALTH_TAG);
fmt.replace(this->buildingHealthPercentageTag, this->INTERNAL_BUILDING_HEALTH_PERCENTAGE_TAG); fmt.replace(this->buildingHealthPercentageTag, this->INTERNAL_BUILDING_HEALTH_PERCENTAGE_TAG);
fmt.replace(this->buildingHealthBarTag, this->INTERNAL_BUILDING_HEALTH_BAR_TAG); fmt.replace(this->buildingArmorTag, this->INTERNAL_BUILDING_ARMOR_TAG);
fmt.replace(this->buildingMaxArmorTag, this->INTERNAL_BUILDING_MAX_ARMOR_TAG);
fmt.replace(this->buildingArmorPercentageTag, this->INTERNAL_BUILDING_ARMOR_PERCENTAGE_TAG);
fmt.replace(this->buildingDurabilityTag, this->INTERNAL_BUILDING_DURABILITY_TAG);
fmt.replace(this->buildingMaxDurabilityTag, this->INTERNAL_BUILDING_MAX_DURABILITY_TAG);
fmt.replace(this->buildingDurabilityPercentageTag, this->INTERNAL_BUILDING_DURABILITY_PERCENTAGE_TAG);
fmt.replace(this->buildingTeamColorTag, this->INTERNAL_BUILDING_TEAM_COLOR_TAG); fmt.replace(this->buildingTeamColorTag, this->INTERNAL_BUILDING_TEAM_COLOR_TAG);
fmt.replace(this->buildingTeamShortTag, this->INTERNAL_BUILDING_TEAM_SHORT_TAG); fmt.replace(this->buildingTeamShortTag, this->INTERNAL_BUILDING_TEAM_SHORT_TAG);
fmt.replace(this->buildingTeamLongTag, this->INTERNAL_BUILDING_TEAM_LONG_TAG); fmt.replace(this->buildingTeamLongTag, this->INTERNAL_BUILDING_TEAM_LONG_TAG);

14
RenX.Core/RenX_Tags.h

@ -181,7 +181,12 @@ namespace RenX
Jupiter::StringS INTERNAL_BUILDING_HEALTH_TAG; Jupiter::StringS INTERNAL_BUILDING_HEALTH_TAG;
Jupiter::StringS INTERNAL_BUILDING_MAX_HEALTH_TAG; Jupiter::StringS INTERNAL_BUILDING_MAX_HEALTH_TAG;
Jupiter::StringS INTERNAL_BUILDING_HEALTH_PERCENTAGE_TAG; Jupiter::StringS INTERNAL_BUILDING_HEALTH_PERCENTAGE_TAG;
Jupiter::StringS INTERNAL_BUILDING_HEALTH_BAR_TAG; Jupiter::StringS INTERNAL_BUILDING_ARMOR_TAG;
Jupiter::StringS INTERNAL_BUILDING_MAX_ARMOR_TAG;
Jupiter::StringS INTERNAL_BUILDING_ARMOR_PERCENTAGE_TAG;
Jupiter::StringS INTERNAL_BUILDING_DURABILITY_TAG;
Jupiter::StringS INTERNAL_BUILDING_MAX_DURABILITY_TAG;
Jupiter::StringS INTERNAL_BUILDING_DURABILITY_PERCENTAGE_TAG;
Jupiter::StringS INTERNAL_BUILDING_TEAM_COLOR_TAG; Jupiter::StringS INTERNAL_BUILDING_TEAM_COLOR_TAG;
Jupiter::StringS INTERNAL_BUILDING_TEAM_SHORT_TAG; Jupiter::StringS INTERNAL_BUILDING_TEAM_SHORT_TAG;
Jupiter::StringS INTERNAL_BUILDING_TEAM_LONG_TAG; Jupiter::StringS INTERNAL_BUILDING_TEAM_LONG_TAG;
@ -360,7 +365,12 @@ namespace RenX
Jupiter::StringS buildingHealthTag; Jupiter::StringS buildingHealthTag;
Jupiter::StringS buildingMaxHealthTag; Jupiter::StringS buildingMaxHealthTag;
Jupiter::StringS buildingHealthPercentageTag; Jupiter::StringS buildingHealthPercentageTag;
Jupiter::StringS buildingHealthBarTag; Jupiter::StringS buildingArmorTag;
Jupiter::StringS buildingMaxArmorTag;
Jupiter::StringS buildingArmorPercentageTag;
Jupiter::StringS buildingDurabilityTag;
Jupiter::StringS buildingMaxDurabilityTag;
Jupiter::StringS buildingDurabilityPercentageTag;
Jupiter::StringS buildingTeamColorTag; Jupiter::StringS buildingTeamColorTag;
Jupiter::StringS buildingTeamShortTag; Jupiter::StringS buildingTeamShortTag;
Jupiter::StringS buildingTeamLongTag; Jupiter::StringS buildingTeamLongTag;

Loading…
Cancel
Save