Browse Source

RenX.Core: RenX_OnPlayerIdentify event

RenX.Logging: Added log for RenX_OnPlayerIdentify; disabled some logs by default.
MakeRelease.bat: Now copies LICENSE and all files in "Configs/"
pull/4/head
Jessica James 8 years ago
parent
commit
016f71d2c5
  1. 5
      Configs/RenX.Logging.ini
  2. 2
      LICENSE
  3. 6
      MakeRelease.bat
  4. 3
      RenX.Core/RenX_GameCommand.cpp
  5. 5
      RenX.Core/RenX_GameCommand.h
  6. 5
      RenX.Core/RenX_Plugin.cpp
  7. 1
      RenX.Core/RenX_Plugin.h
  8. 16
      RenX.Core/RenX_Server.cpp
  9. 27
      RenX.Logging/RenX_Logging.cpp
  10. 5
      RenX.Logging/RenX_Logging.h

5
Configs/RenX.Logging.ini

@ -100,9 +100,10 @@ MuteOwnExecute=true
;
;PlayerRDNSFormat=05[RDNS] {NAME}'s hostname is {RDNS}
;PlayerIdentifyFormat=12[Join] {NAME} ({STEAM}) joined the game fighting for the {TEAML} from {IP} ({RDNS}) with HWID {HWID}
;JoinPublicFormat=12[Join] {NAME} joined the game fighting for the {TEAML}!
;JoinAdminFormat=12[Join] {NAME} joined the game fighting for the {TEAML} from {IP} using Steam ID {STEAM}. HWID: "{HWID}"
;JoinNoSteamAdminFormat=12[Join] {NAME} joined the game fighting for the {TEAML} from {IP}, but is not using Steam. HWID: "{HWID}"
;JoinAdminFormat=12[Join] {NAME} joined the game fighting for the {TEAML} from {IP} using Steam ID {STEAM}."
;JoinNoSteamAdminFormat=12[Join] {NAME} joined the game fighting for the {TEAML} from {IP}, but is not using Steam."
;PartFormat=12[Part] {NAME} left the {TEAML}.
;KickFormat=04[Kick] {NAME} was 04kicked (04{MESSAGE})
;PlayerExecuteFormat={NAME}07 executed: {MESSAGE}

2
LICENSE

@ -1,4 +1,4 @@
Copyright (C) 2013-2015 Jessica James.
Copyright (C) 2013-2016 Jessica James.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above

6
MakeRelease.bat

@ -1,5 +1,5 @@
@ECHO OFF
if NOT "%2" == "-scr" ECHO Copyright (C) 2014 Jessica James. All rights reserved.
if NOT "%2" == "-scr" ECHO Copyright (C) 2014-2016 Jessica James. All rights reserved.
ECHO.
if "%1" == "/?" GOTO Help
@ -45,8 +45,8 @@ GOTO EOF
:BinaryCopy:
ROBOCOPY "Release\\" "..\Jupiter Bot Binaries\\" *.dll *.exe /S /xf Tester.exe
ROBOCOPY "Configs\\" "..\Jupiter Bot Binaries\Configs\\" *.ini
ROBOCOPY ".\\" "..\Jupiter Bot Binaries\\" *.ini *.txt
ROBOCOPY "Configs\\" "..\Jupiter Bot Binaries\Configs\\" *
ROBOCOPY ".\\" "..\Jupiter Bot Binaries\\" *.ini *.txt LICENSE
"C:\Program Files\WinRAR\WinRAR.exe" a -r "..\Jupiter Bot Binaries.zip" "..\Jupiter Bot Binaries"
GOTO EOF

3
RenX.Core/RenX_GameCommand.cpp

@ -22,6 +22,9 @@
Jupiter::ArrayList<RenX::GameCommand> _GameMasterCommandList;
Jupiter::ArrayList<RenX::GameCommand> *RenX::GameMasterCommandList = &_GameMasterCommandList;
RenX::Server *RenX::GameCommand::active_server = nullptr;
RenX::Server *RenX::GameCommand::selected_server = nullptr;
RenX::GameCommand::GameCommand(nullptr_t)
{
}

5
RenX.Core/RenX_GameCommand.h

@ -109,6 +109,11 @@ namespace RenX
*/
virtual ~GameCommand();
/** Public members */
static RenX::Server *active_server; /** Currently active IRC server */
static RenX::Server *selected_server; /** Currently selected IRC server */
private:
int access = 0; /** Minimum access level */
};

5
RenX.Core/RenX_Plugin.cpp

@ -66,6 +66,11 @@ void RenX::Plugin::RenX_OnPlayerRDNS(Server *, const RenX::PlayerInfo *)
return;
}
void RenX::Plugin::RenX_OnPlayerIdentify(Server *, const RenX::PlayerInfo *)
{
return;
}
void RenX::Plugin::RenX_OnServerCreate(Server *)
{
return;

1
RenX.Core/RenX_Plugin.h

@ -50,6 +50,7 @@ namespace RenX
virtual void RenX_OnPlayerDelete(Server *server, const PlayerInfo *player);
virtual void RenX_OnPlayerUUIDChange(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &newUUID);
virtual void RenX_OnPlayerRDNS(Server *server, const PlayerInfo *player);
virtual void RenX_OnPlayerIdentify(Server *server, const PlayerInfo *player);
virtual void RenX_OnServerCreate(Server *server);
virtual void RenX_OnServerFullyConnected(Server *server);
virtual void RenX_OnServerDisconnect(Server *server, RenX::DisconnectReason reason);

16
RenX.Core/RenX_Server.cpp

@ -80,6 +80,11 @@ int RenX::Server::think()
for (size_t index = 0; index < xPlugins.size(); ++index)
xPlugins.get(index)->RenX_OnPlayerRDNS(this, player);
// Fire player indentified event if ready
if (player->hwid.isNotEmpty())
for (size_t index = 0; index < xPlugins.size(); ++index)
xPlugins.get(index)->RenX_OnPlayerIdentify(this, player);
if (this->player_rdns_resolutions_pending == 0) // No more resolutions pending
return;
}
@ -1099,6 +1104,7 @@ RenX::GameCommand *RenX::Server::triggerCommand(const Jupiter::ReadableString &t
{
RenX::GameCommand *cmd;
RenX::GameCommand::active_server = this;
for (size_t i = 0; i < RenX::Server::commands.size(); i++)
{
cmd = RenX::Server::commands.get(i);
@ -1112,6 +1118,7 @@ RenX::GameCommand *RenX::Server::triggerCommand(const Jupiter::ReadableString &t
return cmd;
}
}
RenX::GameCommand::active_server = RenX::GameCommand::selected_server;
return nullptr;
}
@ -2679,6 +2686,10 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
for (size_t index = 0; index < xPlugins.size(); ++index)
xPlugins.get(index)->RenX_OnHWID(this, player);
if (player->rdns.isNotEmpty())
for (size_t index = 0; index < xPlugins.size(); ++index)
xPlugins.get(index)->RenX_OnPlayerIdentify(this, player);
}
else if (subHeader.equals("Exit;"))
{
@ -3542,6 +3553,11 @@ void RenX::Server::init(const Jupiter::INIFile::Section &config)
RenX::Server::~Server()
{
if (RenX::GameCommand::selected_server == nullptr)
RenX::GameCommand::selected_server = nullptr;
if (RenX::GameCommand::active_server == nullptr)
RenX::GameCommand::active_server = RenX::GameCommand::selected_server;
sock.close();
RenX::Server::wipeData();
RenX::Server::commands.emptyAndDelete();

27
RenX.Logging/RenX_Logging.cpp

@ -31,6 +31,7 @@ bool RenX_LoggingPlugin::initialize()
{
RenX_LoggingPlugin::muteOwnExecute = this->config.getBool(Jupiter::ReferenceString::empty, "MuteOwnExecute"_jrs, true);
RenX_LoggingPlugin::playerRDNSPublic = this->config.getBool(Jupiter::ReferenceString::empty, "PlayerRDNSPublic"_jrs, false);
RenX_LoggingPlugin::playerIdentifyPublic = this->config.getBool(Jupiter::ReferenceString::empty, "PlayerIdentifyPublic"_jrs, false);
RenX_LoggingPlugin::joinPublic = this->config.getBool(Jupiter::ReferenceString::empty, "JoinPublic"_jrs, true);
RenX_LoggingPlugin::partPublic = this->config.getBool(Jupiter::ReferenceString::empty, "PartPublic"_jrs, true);
RenX_LoggingPlugin::kickPublic = this->config.getBool(Jupiter::ReferenceString::empty, "KickPublic"_jrs, true);
@ -110,16 +111,19 @@ bool RenX_LoggingPlugin::initialize()
/** Event formats */
RenX_LoggingPlugin::playerRDNSFmt = this->config.get(Jupiter::ReferenceString::empty, "PlayerRDNSFormat"_jrs,
Jupiter::StringS::Format(IRCCOLOR "05[RDNS] " IRCBOLD "%.*s" IRCNORMAL "'s hostname is " IRCBOLD "%.*s", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->rdnsTag.size(), RenX::tags->rdnsTag.ptr()));
Jupiter::ReferenceString::empty);
RenX_LoggingPlugin::playerIdentifyFmt = this->config.get(Jupiter::ReferenceString::empty, "PlayerIdentifyFormat"_jrs,
Jupiter::StringS::Format(IRCCOLOR "12[Join] " IRCBOLD "%.*s" IRCBOLD " (" IRCBOLD "%.*s" IRCBOLD ") joined the game fighting for the %.*s from " IRCBOLD "%.*s" IRCBOLD " (" IRCBOLD "%.*s" IRCBOLD ") with HWID " IRCBOLD "%.*s" IRCBOLD ".", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->steamTag.size(), RenX::tags->steamTag.ptr(), RenX::tags->teamLongTag.size(), RenX::tags->teamLongTag.ptr(), RenX::tags->ipTag.size(), RenX::tags->ipTag.ptr(), RenX::tags->rdnsTag.size(), RenX::tags->rdnsTag.ptr(), RenX::tags->hwidTag.size(), RenX::tags->hwidTag.ptr()));
RenX_LoggingPlugin::joinPublicFmt = this->config.get(Jupiter::ReferenceString::empty, "JoinPublicFormat"_jrs,
Jupiter::StringS::Format(IRCCOLOR "12[Join] " IRCBOLD "%.*s" IRCBOLD " joined the game fighting for the %.*s!", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->teamLongTag.size(), RenX::tags->teamLongTag.ptr()));
RenX_LoggingPlugin::joinAdminFmt = this->config.get(Jupiter::ReferenceString::empty, "JoinAdminFormat"_jrs,
Jupiter::StringS::Format(IRCCOLOR "12[Join] " IRCBOLD "%.*s" IRCBOLD " joined the game fighting for the %.*s from " IRCBOLD "%.*s" IRCBOLD " using Steam ID " IRCBOLD "%.*s" IRCBOLD ". HWID: \"" IRCBOLD "%.*s" IRCBOLD "\"", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->teamLongTag.size(), RenX::tags->teamLongTag.ptr(), RenX::tags->ipTag.size(), RenX::tags->ipTag.ptr(), RenX::tags->steamTag.size(), RenX::tags->steamTag.ptr(), RenX::tags->hwidTag.size(), RenX::tags->hwidTag.ptr()));
Jupiter::ReferenceString::empty);
RenX_LoggingPlugin::joinNoSteamAdminFmt = this->config.get(Jupiter::ReferenceString::empty, "JoinNoSteamAdminFormat"_jrs,
Jupiter::StringS::Format(IRCCOLOR "12[Join] " IRCBOLD "%.*s" IRCBOLD " joined the game fighting for the %.*s from " IRCBOLD "%.*s" IRCBOLD ", but is " IRCBOLD "not" IRCBOLD " using Steam. HWID: \"" IRCBOLD "%.*s" IRCBOLD "\"", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->teamLongTag.size(), RenX::tags->teamLongTag.ptr(), RenX::tags->ipTag.size(), RenX::tags->ipTag.ptr(), RenX::tags->hwidTag.size(), RenX::tags->hwidTag.ptr()));
Jupiter::ReferenceString::empty);
RenX_LoggingPlugin::partFmt = this->config.get(Jupiter::ReferenceString::empty, "PartFormat"_jrs,
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()));
@ -427,6 +431,7 @@ bool RenX_LoggingPlugin::initialize()
/** Sanitize tags */
RenX::sanitizeTags(playerRDNSFmt);
RenX::sanitizeTags(playerIdentifyFmt);
RenX::sanitizeTags(joinPublicFmt);
RenX::sanitizeTags(joinAdminFmt);
RenX::sanitizeTags(joinNoSteamAdminFmt);
@ -554,6 +559,22 @@ void RenX_LoggingPlugin::RenX_OnPlayerRDNS(RenX::Server *server, const RenX::Pla
}
}
void RenX_LoggingPlugin::RenX_OnPlayerIdentify(RenX::Server *server, const RenX::PlayerInfo *player)
{
logFuncType func;
if (RenX_LoggingPlugin::playerIdentifyPublic)
func = &RenX::Server::sendLogChan;
else
func = &RenX::Server::sendAdmChan;
Jupiter::String msg = this->playerIdentifyFmt;
if (msg.isNotEmpty() && server->isMatchPending() == false)
{
RenX::processTags(msg, server, player);
(server->*func)(msg);
}
}
void RenX_LoggingPlugin::RenX_OnJoin(RenX::Server *server, const RenX::PlayerInfo *player)
{
Jupiter::String msg;

5
RenX.Logging/RenX_Logging.h

@ -26,6 +26,7 @@ class RenX_LoggingPlugin : public RenX::Plugin
{
public: // RenX::Plugin
void RenX_OnPlayerRDNS(RenX::Server *server, const RenX::PlayerInfo *player) override;
void RenX_OnPlayerIdentify(RenX::Server *server, const RenX::PlayerInfo *player) override;
void RenX_OnJoin(RenX::Server *server, const RenX::PlayerInfo *player) override;
void RenX_OnPart(RenX::Server *server, const RenX::PlayerInfo *player) override;
@ -134,6 +135,7 @@ public: // Jupiter::Plugin
private:
unsigned int muteOwnExecute : 1;
unsigned int playerRDNSPublic : 1;
unsigned int playerIdentifyPublic : 1;
unsigned int joinPublic : 1;
unsigned int partPublic : 1;
unsigned int kickPublic : 1;
@ -212,7 +214,8 @@ private:
unsigned int otherPublic : 1;
/** Event formats */
Jupiter::String playerRDNSFmt;
Jupiter::StringS playerRDNSFmt;
Jupiter::StringS playerIdentifyFmt;
Jupiter::StringS joinPublicFmt, joinAdminFmt, joinNoSteamAdminFmt;
Jupiter::StringS partFmt;
Jupiter::StringS kickFmt;

Loading…
Cancel
Save