Browse Source

Added events:

* RenX_OnTSVehicleCrate
* RenX_OnRAVehicleCrate
* RenX_OnMapStart
Adjusted RenX.Logging accordingly.
pull/3/head
JustinAJ 10 years ago
parent
commit
07231aafc4
  1. BIN
      Release/Plugins/RenX.Core.lib
  2. 15
      RenX.Core/RenX_Plugin.cpp
  3. 3
      RenX.Core/RenX_Plugin.h
  4. 22
      RenX.Core/RenX_Server.cpp
  5. 68
      RenX.Logging/RenX_Logging.cpp
  6. 9
      RenX.Logging/RenX_Logging.h

BIN
Release/Plugins/RenX.Core.lib

Binary file not shown.

15
RenX.Core/RenX_Plugin.cpp

@ -250,6 +250,16 @@ void RenX::Plugin::RenX_OnVehicleCrate(Server *, const PlayerInfo *, const Jupit
return;
}
void RenX::Plugin::RenX_OnTSVehicleCrate(Server *, const PlayerInfo *, const Jupiter::ReadableString &)
{
return;
}
void RenX::Plugin::RenX_OnRAVehicleCrate(Server *, const PlayerInfo *, const Jupiter::ReadableString &)
{
return;
}
void RenX::Plugin::RenX_OnDeathCrate(Server *, const PlayerInfo *)
{
return;
@ -450,6 +460,11 @@ void RenX::Plugin::RenX_OnMapLoad(Server *, const Jupiter::ReadableString &)
return;
}
void RenX::Plugin::RenX_OnMapStart(Server *, const Jupiter::ReadableString &)
{
return;
}
void RenX::Plugin::RenX_OnMap(Server *, const Jupiter::ReadableString &)
{
return;

3
RenX.Core/RenX_Plugin.h

@ -90,6 +90,8 @@ namespace RenX
virtual void RenX_OnSpawn(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &character);
virtual void RenX_OnBotJoin(Server *server, const PlayerInfo *player);
virtual void RenX_OnVehicleCrate(Server *server, const PlayerInfo *owner, const Jupiter::ReadableString &vehicle);
virtual void RenX_OnTSVehicleCrate(Server *server, const PlayerInfo *owner, const Jupiter::ReadableString &vehicle);
virtual void RenX_OnRAVehicleCrate(Server *server, const PlayerInfo *owner, const Jupiter::ReadableString &vehicle);
virtual void RenX_OnDeathCrate(Server *server, const PlayerInfo *player);
virtual void RenX_OnMoneyCrate(Server *server, const PlayerInfo *player, int amount);
virtual void RenX_OnCharacterCrate(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &character);
@ -138,6 +140,7 @@ namespace RenX
/** Map Type Logs */
virtual void RenX_OnMapChange(Server *server, const Jupiter::ReadableString &map, bool seamless);
virtual void RenX_OnMapLoad(Server *server, const Jupiter::ReadableString &map);
virtual void RenX_OnMapStart(Server *server, const Jupiter::ReadableString &map);
virtual void RenX_OnMap(Server *server, const Jupiter::ReadableString &raw);
/** Demo Type Logs */

22
RenX.Core/RenX_Server.cpp

@ -1466,6 +1466,20 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
for (size_t i = 0; i < xPlugins.size(); i++)
xPlugins.get(i)->RenX_OnVehicleCrate(this, player, vehicle);
}
else if (type.equals("tsvehicle"))
{
Jupiter::ReferenceString vehicle = buff.getToken(3, RenX::DelimC);
RenX::PlayerInfo *player = parseGetPlayerOrAdd(buff.getToken(5, RenX::DelimC));
for (size_t i = 0; i < xPlugins.size(); i++)
xPlugins.get(i)->RenX_OnVehicleCrate(this, player, vehicle);
}
else if (type.equals("ravehicle"))
{
Jupiter::ReferenceString vehicle = buff.getToken(3, RenX::DelimC);
RenX::PlayerInfo *player = parseGetPlayerOrAdd(buff.getToken(5, RenX::DelimC));
for (size_t i = 0; i < xPlugins.size(); i++)
xPlugins.get(i)->RenX_OnVehicleCrate(this, player, vehicle);
}
else if (type.equals("death") || type.equals("suicide"))
{
RenX::PlayerInfo *player = parseGetPlayerOrAdd(buff.getToken(4, RenX::DelimC));
@ -2156,6 +2170,14 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
for (size_t i = 0; i < xPlugins.size(); i++)
xPlugins.get(i)->RenX_OnMapLoad(this, map);
}
else if (subHeader.equals("Start;"))
{
// Map
Jupiter::ReferenceString map = buff.getToken(2, RenX::DelimC);
this->map = map;
for (size_t i = 0; i < xPlugins.size(); i++)
xPlugins.get(i)->RenX_OnMapStart(this, map);
}
else
{
Jupiter::ReferenceString raw = buff.gotoToken(1, RenX::DelimC);

68
RenX.Logging/RenX_Logging.cpp

@ -57,7 +57,9 @@ void RenX_LoggingPlugin::init()
RenX_LoggingPlugin::vehicleSpawnPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("VehicleSpawnPublic"), true);
RenX_LoggingPlugin::spawnPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("SpawnPublic"), true);
RenX_LoggingPlugin::botJoinPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("BotJoinPublic"), true);
RenX_LoggingPlugin::vehicleCratePublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("VehicleCratePublic"), false);
RenX_LoggingPlugin::vehicleCratePublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("VehicleCratePublic"), RenX_LoggingPlugin::vehicleCratePublic);
RenX_LoggingPlugin::TSVehicleCratePublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("TSVehicleCratePublic"), RenX_LoggingPlugin::vehicleCratePublic);
RenX_LoggingPlugin::RAVehicleCratePublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("RAVehicleCratePublic"), RenX_LoggingPlugin::vehicleCratePublic);
RenX_LoggingPlugin::deathCratePublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("DeathCratePublic"), true);
RenX_LoggingPlugin::moneyCratePublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("MoneyCratePublic"), false);
RenX_LoggingPlugin::characterCratePublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("CharacterCratePublic"), false);
@ -86,6 +88,7 @@ void RenX_LoggingPlugin::init()
RenX_LoggingPlugin::votePublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("VotePublic"), false);
RenX_LoggingPlugin::mapChangePublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("MapChangePublic"), true);
RenX_LoggingPlugin::mapLoadPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("MapLoadPublic"), true);
RenX_LoggingPlugin::mapStartPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("MapStartPublic"), true);
RenX_LoggingPlugin::mapPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("MapPublic"), false);
RenX_LoggingPlugin::demoRecordPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("DemoRecordPublic"), true);
RenX_LoggingPlugin::demoRecordStopPublic = Jupiter::IRC::Client::Config->getBool(RenX_LoggingPlugin::getName(), STRING_LITERAL_AS_REFERENCE("DemoRecordStopPublic"), true);
@ -230,6 +233,12 @@ void RenX_LoggingPlugin::init()
RenX_LoggingPlugin::vehicleCrateFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("VehicleCrateFormat"),
Jupiter::StringS::Format(IRCBOLD "%.*s" IRCCOLOR IRCBOLD " picked up a %.*s vehicle crate.", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->objectTag.size(), RenX::tags->objectTag.ptr()));
RenX_LoggingPlugin::TSVehicleCrateFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("TSVehicleCrateFormat"),
RenX_LoggingPlugin::vehicleCrateFmt);
RenX_LoggingPlugin::RAVehicleCrateFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("RAVehicleCrateFormat"),
RenX_LoggingPlugin::vehicleCrateFmt);
RenX_LoggingPlugin::deathCrateFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("DeathCrateFormat"),
Jupiter::StringS::Format(IRCBOLD "%.*s" IRCCOLOR IRCBOLD " picked up a " IRCCOLOR "12death" IRCCOLOR " crate.", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr()));
@ -329,6 +338,9 @@ void RenX_LoggingPlugin::init()
RenX_LoggingPlugin::mapLoadFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("MapLoadFormat"),
Jupiter::StringS::Format(IRCCOLOR "03%.*s loaded.", RenX::tags->messageTag.size(), RenX::tags->messageTag.ptr()));
RenX_LoggingPlugin::mapStartFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("MapStartFormat"),
Jupiter::StringS::Format(IRCCOLOR "03%.*s started.", RenX::tags->messageTag.size(), RenX::tags->messageTag.ptr()));
RenX_LoggingPlugin::mapFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("MapFormat"),
Jupiter::StringS::Format(IRCCOLOR "06[Map]" IRCCOLOR " %.*s", RenX::tags->messageTag.size(), RenX::tags->messageTag.ptr()));
@ -404,6 +416,8 @@ void RenX_LoggingPlugin::init()
RenX::sanitizeTags(spawnFmt);
RenX::sanitizeTags(botJoinFmt);
RenX::sanitizeTags(vehicleCrateFmt);
RenX::sanitizeTags(TSVehicleCrateFmt);
RenX::sanitizeTags(RAVehicleCrateFmt);
RenX::sanitizeTags(deathCrateFmt);
RenX::sanitizeTags(moneyCrateFmt);
RenX::sanitizeTags(characterCrateFmt);
@ -440,6 +454,7 @@ void RenX_LoggingPlugin::init()
RenX::sanitizeTags(voteFmt);
RenX::sanitizeTags(mapChangeFmt);
RenX::sanitizeTags(mapLoadFmt);
RenX::sanitizeTags(mapStartFmt);
RenX::sanitizeTags(mapFmt);
RenX::sanitizeTags(demoRecordFmt);
RenX::sanitizeTags(rconDemoRecordFmt);
@ -1115,6 +1130,40 @@ void RenX_LoggingPlugin::RenX_OnVehicleCrate(RenX::Server *server, const RenX::P
}
}
void RenX_LoggingPlugin::RenX_OnTSVehicleCrate(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &vehicle)
{
logFuncType func;
if (RenX_LoggingPlugin::TSVehicleCratePublic)
func = &RenX::Server::sendLogChan;
else
func = &RenX::Server::sendAdmChan;
Jupiter::String msg = this->TSVehicleCrateFmt;
if (msg.isEmpty() == false)
{
RenX::processTags(msg, server, player);
msg.replace(RenX::tags->INTERNAL_OBJECT_TAG, RenX::translateName(vehicle));
(server->*func)(msg);
}
}
void RenX_LoggingPlugin::RenX_OnRAVehicleCrate(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &vehicle)
{
logFuncType func;
if (RenX_LoggingPlugin::RAVehicleCratePublic)
func = &RenX::Server::sendLogChan;
else
func = &RenX::Server::sendAdmChan;
Jupiter::String msg = this->RAVehicleCrateFmt;
if (msg.isEmpty() == false)
{
RenX::processTags(msg, server, player);
msg.replace(RenX::tags->INTERNAL_OBJECT_TAG, RenX::translateName(vehicle));
(server->*func)(msg);
}
}
void RenX_LoggingPlugin::RenX_OnDeathCrate(RenX::Server *server, const RenX::PlayerInfo *player)
{
logFuncType func;
@ -1723,6 +1772,23 @@ void RenX_LoggingPlugin::RenX_OnMapLoad(RenX::Server *server, const Jupiter::Rea
}
}
void RenX_LoggingPlugin::RenX_OnMapStart(RenX::Server *server, const Jupiter::ReadableString &map)
{
logFuncType func;
if (RenX_LoggingPlugin::mapStartPublic)
func = &RenX::Server::sendLogChan;
else
func = &RenX::Server::sendAdmChan;
Jupiter::String msg = this->mapStartFmt;
if (msg.isEmpty() == false)
{
RenX::processTags(msg, server);
msg.replace(RenX::tags->INTERNAL_MESSAGE_TAG, map);
(server->*func)(msg);
}
}
void RenX_LoggingPlugin::RenX_OnMap(RenX::Server *server, const Jupiter::ReadableString &raw)
{
logFuncType func;

9
RenX.Logging/RenX_Logging.h

@ -61,6 +61,8 @@ public: // RenX::Plugin
void RenX_OnSpawn(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &character) override;
void RenX_OnBotJoin(RenX::Server *server, const RenX::PlayerInfo *player) override;
void RenX_OnVehicleCrate(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &vehicle) override;
void RenX_OnTSVehicleCrate(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &vehicle) override;
void RenX_OnRAVehicleCrate(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &vehicle) override;
void RenX_OnDeathCrate(RenX::Server *server, const RenX::PlayerInfo *player) override;
void RenX_OnMoneyCrate(RenX::Server *server, const RenX::PlayerInfo *player, int amount) override;
void RenX_OnCharacterCrate(RenX::Server *server, const RenX::PlayerInfo *player, const Jupiter::ReadableString &character) override;
@ -94,6 +96,7 @@ public: // RenX::Plugin
void RenX_OnMapChange(RenX::Server *server, const Jupiter::ReadableString &map, bool seamless) override;
void RenX_OnMapLoad(RenX::Server *server, const Jupiter::ReadableString &map) override;
void RenX_OnMapStart(RenX::Server *server, const Jupiter::ReadableString &map) override;
void RenX_OnMap(RenX::Server *server, const Jupiter::ReadableString &raw) override;
void RenX_OnDemoRecord(RenX::Server *server, const RenX::PlayerInfo *player) override;
@ -151,6 +154,8 @@ private:
unsigned int spawnPublic : 1;
unsigned int botJoinPublic : 1;
unsigned int vehicleCratePublic : 1;
unsigned int TSVehicleCratePublic : 1;
unsigned int RAVehicleCratePublic : 1;
unsigned int deathCratePublic : 1;
unsigned int moneyCratePublic : 1;
unsigned int characterCratePublic : 1;
@ -179,6 +184,7 @@ private:
unsigned int votePublic : 1;
unsigned int mapChangePublic : 1;
unsigned int mapLoadPublic : 1;
unsigned int mapStartPublic : 1;
unsigned int mapPublic : 1;
unsigned int demoRecordPublic : 1;
unsigned int demoRecordStopPublic : 1;
@ -232,6 +238,8 @@ private:
Jupiter::StringS spawnFmt;
Jupiter::StringS botJoinFmt;
Jupiter::StringS vehicleCrateFmt;
Jupiter::StringS TSVehicleCrateFmt;
Jupiter::StringS RAVehicleCrateFmt;
Jupiter::StringS deathCrateFmt;
Jupiter::StringS moneyCrateFmt;
Jupiter::StringS characterCrateFmt;
@ -265,6 +273,7 @@ private:
Jupiter::StringS voteFmt;
Jupiter::StringS mapChangeFmt;
Jupiter::StringS mapLoadFmt;
Jupiter::StringS mapStartFmt;
Jupiter::StringS mapFmt;
Jupiter::StringS demoRecordFmt, rconDemoRecordFmt;
Jupiter::StringS demoRecordStopFmt;

Loading…
Cancel
Save