Browse Source

Added RenX_OnTeamChange event; formatSteamID is now const; ReadableString non-format versions of sendPubChan() sendAdmChan() and sendLogChan() added.

pull/3/head
JustinAJ 10 years ago
parent
commit
a04667ee5f
  1. 4
      Jupiter Bot.sln
  2. BIN
      Release/Plugins/RenX.Core.lib
  3. 5
      RenX.Core/RenX_Plugin.cpp
  4. 1
      RenX.Core/RenX_Plugin.h
  5. 29
      RenX.Core/RenX_Server.cpp
  6. 10
      RenX.Core/RenX_Server.h

4
Jupiter Bot.sln

@ -116,6 +116,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RenX.Greetings", "RenX.Gree
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RenX.IRCJoin", "RenX.IRCJoin\RenX.IRCJoin.vcxproj", "{672B3FC9-0B31-45B4-AAB6-669073F2D291}"
ProjectSection(ProjectDependencies) = postProject
{C188871B-5F32-4946-B301-24CA2EBB275D} = {C188871B-5F32-4946-B301-24CA2EBB275D}
{9103DF3D-8B4A-48E5-A6B3-CBE2554630E2} = {9103DF3D-8B4A-48E5-A6B3-CBE2554630E2}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

BIN
Release/Plugins/RenX.Core.lib

Binary file not shown.

5
RenX.Core/RenX_Plugin.cpp

@ -60,6 +60,11 @@ void RenX::Plugin::RenX_OnNameChange(Server *, const PlayerInfo *, const Jupiter
return;
}
void RenX::Plugin::RenX_OnTeamChange(Server *, const PlayerInfo *)
{
return;
}
void RenX::Plugin::RenX_OnChat(Server *, const RenX::PlayerInfo *, const Jupiter::ReadableString &)
{
return;

1
RenX.Core/RenX_Plugin.h

@ -45,6 +45,7 @@ namespace RenX
virtual void RenX_OnJoin(Server *server, const PlayerInfo *player);
virtual void RenX_OnPart(Server *server, const PlayerInfo *player);
virtual void RenX_OnNameChange(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &newPlayerName);
virtual void RenX_OnTeamChange(Server *server, const PlayerInfo *player);
/** Chat type logs */
virtual void RenX_OnChat(Server *server, const PlayerInfo *player, const Jupiter::ReadableString &message);

29
RenX.Core/RenX_Server.cpp

@ -201,12 +201,12 @@ RenX::PlayerInfo *RenX::Server::getPlayerByPartNameFast(const Jupiter::ReadableS
return nullptr;
}
Jupiter::StringS RenX::Server::formatSteamID(const RenX::PlayerInfo *player)
Jupiter::StringS RenX::Server::formatSteamID(const RenX::PlayerInfo *player) const
{
return RenX::Server::formatSteamID(player->steamid);
}
Jupiter::StringS RenX::Server::formatSteamID(uint64_t id)
Jupiter::StringS RenX::Server::formatSteamID(uint64_t id) const
{
switch (RenX::Server::steamFormat)
{
@ -435,6 +435,11 @@ void RenX::Server::sendPubChan(const char *fmt, ...) const
}
else msg.vformat(fmt, args);
va_end(args);
RenX::Server::sendPubChan(msg);
}
void RenX::Server::sendPubChan(const Jupiter::ReadableString &msg) const
{
for (size_t i = 0; i != serverManager->size(); i++)
serverManager->getServer(i)->messageChannels(RenX::Server::logChanType, msg);
}
@ -453,6 +458,11 @@ void RenX::Server::sendAdmChan(const char *fmt, ...) const
}
else msg.vformat(fmt, args);
va_end(args);
RenX::Server::sendAdmChan(msg);
}
void RenX::Server::sendAdmChan(const Jupiter::ReadableString &msg) const
{
for (size_t i = 0; i != serverManager->size(); i++)
serverManager->getServer(i)->messageChannels(RenX::Server::adminLogChanType, msg);
}
@ -471,11 +481,16 @@ void RenX::Server::sendLogChan(const char *fmt, ...) const
}
else msg.vformat(fmt, args);
va_end(args);
RenX::Server::sendLogChan(msg);
}
void RenX::Server::sendLogChan(const Jupiter::ReadableString &msg) const
{
for (size_t i = 0; i != serverManager->size(); i++)
{
IRC_Bot *ircServer = serverManager->getServer(i);
ircServer->messageChannels(RenX::Server::logChanType, msg);
ircServer->messageChannels(RenX::Server::adminLogChanType, msg);
IRC_Bot *server = serverManager->getServer(i);
server->messageChannels(RenX::Server::logChanType, msg);
server->messageChannels(RenX::Server::adminLogChanType, msg);
}
}
@ -680,6 +695,10 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
RenX::PlayerInfo *player = getPlayerOrAdd(this, name, id, team, isBot, 0);
player->deaths++;
Jupiter::ReferenceString damageType = buff.getWord(3, RenX::DelimS);
if (damageType.equals("DamageType"))
for (size_t i = 0; i < xPlugins.size(); i++)
xPlugins.get(i)->RenX_OnTeamChange(this, player);
else
for (size_t i = 0; i < xPlugins.size(); i++)
xPlugins.get(i)->RenX_OnDie(this, player, damageType);
this->firstDeath = true;

10
RenX.Core/RenX_Server.h

@ -204,7 +204,7 @@ namespace RenX
* @param player Player to fetch Steam ID from
* @return A player's formatted Steam ID on success, an empty string otherwise.
*/
Jupiter::StringS formatSteamID(const RenX::PlayerInfo *player);
Jupiter::StringS formatSteamID(const RenX::PlayerInfo *player) const;
/**
* @brief Formats a Steam ID into a readable string.
@ -212,7 +212,7 @@ namespace RenX
* @param id Steam ID to format
* @return A player's formatted Steam ID on success, an empty string otherwise.
*/
Jupiter::StringS formatSteamID(uint64_t id);
Jupiter::StringS formatSteamID(uint64_t id) const;
/**
* @brief Kicks a player from the server.
@ -393,26 +393,26 @@ namespace RenX
/**
* @brief Formats and sends a message to a server's corresponding public channels.
*
* @param server Server corresponding to channel types.
* @param fmt String containing the format specifiers indicating what message to send.
*/
void sendPubChan(const char *fmt, ...) const;
void sendPubChan(const Jupiter::ReadableString &msg) const;
/**
* @brief Formats and sends a message to a server's corresponding adminstrative channels.
*
* @param server Server corresponding to channel types.
* @param fmt String containing the format specifiers indicating what message to send.
*/
void sendAdmChan(const char *fmt, ...) const;
void sendAdmChan(const Jupiter::ReadableString &msg) const;
/**
* @brief Formats and sends a message to a server's corresponding channels.
*
* @param server Server corresponding to channel types.
* @param fmt String containing the format specifiers indicating what message to send.
*/
void sendLogChan(const char *fmt, ...) const;
void sendLogChan(const Jupiter::ReadableString &msg) const;
/**
* @brief Processes a line of RCON input data. Input data SHOULD NOT include a new-line ('\n') terminator.

Loading…
Cancel
Save