Browse Source

RenX.Core:

* Building health is now set to 0 when a building is destroyed.
* Added isPassworded() function to Server.
* Improved appearance of Building Bars.
RenX.IRCJoin:
* Removed unusable variables.
pull/3/head
JustinAJ 9 years ago
parent
commit
4fc735db9a
  1. BIN
      Release/Plugins/RenX.Core.lib
  2. 16
      RenX.Core/RenX_Server.cpp
  3. 10
      RenX.Core/RenX_Server.h
  4. 24
      RenX.Core/RenX_Tags.cpp
  5. 12
      RenX.IRCJoin/RenX_IRCJoin.cpp
  6. 8
      RenX.IRCJoin/RenX_IRCJoin.h

BIN
Release/Plugins/RenX.Core.lib

Binary file not shown.

16
RenX.Core/RenX_Server.cpp

@ -597,6 +597,11 @@ time_t RenX::Server::getDelay() const
return RenX::Server::delay;
}
bool RenX::Server::isPassworded() const
{
return RenX::Server::passworded;
}
const Jupiter::ReadableString &RenX::Server::getPassword() const
{
return RenX::Server::pass;
@ -1403,6 +1408,7 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
buff.shiftRight(1);
this->port = static_cast<unsigned short>(buff.getToken(1, RenX::DelimC).asUnsignedInt(10));
this->serverName = buff.getToken(3, RenX::DelimC);
this->passworded = buff.getToken(5, RenX::DelimC).asBool();
this->map = buff.getToken(7, RenX::DelimC);
buff.shiftLeft(1);
}
@ -1816,6 +1822,16 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
break;
case RenX::ObjectType::Building:
player->buildingKills++;
{
auto internalsStr = "_Internals"_jrs;
RenX::BuildingInfo *building;
if (objectName.findi(internalsStr) != Jupiter::INVALID_INDEX)
objectName.truncate(internalsStr.size());
building = RenX::Server::getBuildingByName(objectName);
if (building != nullptr)
building->health = 0.0;
}
break;
case RenX::ObjectType::Defence:
player->defenceKills++;

10
RenX.Core/RenX_Server.h

@ -580,7 +580,14 @@ namespace RenX
time_t getDelay() const;
/**
* @brief Fetches the password of a server.
* @brief Checks if the server has a game password.
*
* @return True if the game is passworded, false otherwise.
*/
bool isPassworded() const;
/**
* @brief Fetches the RCON password of a server.
*
* @return String containing the password of the server.
*/
@ -806,6 +813,7 @@ namespace RenX
/** Tracking variables */
bool connected = false;
bool seamless = false;
bool passworded = false;
bool needsCList = false;
bool silenceParts = false;
bool silenceJoins = false;

24
RenX.Core/RenX_Tags.cpp

@ -56,7 +56,7 @@ TagsImp::TagsImp()
this->uniqueTag = STRING_LITERAL_AS_REFERENCE("\0\0\0\0\0\0");
const Jupiter::ReadableString &configSection = Jupiter::IRC::Client::Config->get(STRING_LITERAL_AS_REFERENCE("RenX"), STRING_LITERAL_AS_REFERENCE("TagDefinitions"), STRING_LITERAL_AS_REFERENCE("RenX.Tags"));
TagsImp::bar_width = Jupiter::IRC::Client::Config->getInt(configSection, STRING_LITERAL_AS_REFERENCE("BarWidth"), 20);
TagsImp::bar_width = Jupiter::IRC::Client::Config->getInt(configSection, STRING_LITERAL_AS_REFERENCE("BarWidth"), 19);
/** Global formats */
this->dateFmt = Jupiter::IRC::Client::Config->get(configSection, STRING_LITERAL_AS_REFERENCE("DateFormat"), STRING_LITERAL_AS_REFERENCE("%A, %B %d, %Y"));
@ -289,17 +289,27 @@ Jupiter::StringS TagsImp::get_building_health_bar(const RenX::BuildingInfo *buil
Jupiter::String r(TagsImp::bar_width);
if (greenBars != 0)
{
r = IRCCOLOR "09,09";
r = IRCCOLOR "02,09";
do
r += " ";
{
if (index % 2 == 0)
r += '/';
else
r += ' ';
}
while (++index != greenBars);
if (greenBars == TagsImp::bar_width)
if (index == TagsImp::bar_width)
return r += IRCNORMAL;
}
r += IRCCOLOR "04,04";
r += IRCCOLOR "02,04";
do
r += " ";
while (++greenBars != TagsImp::bar_width);
{
if (index % 2 == 0)
r += '\\';
else
r += ' ';
}
while (++index != TagsImp::bar_width);
return r += IRCNORMAL;
}

12
RenX.IRCJoin/RenX_IRCJoin.cpp

@ -1,5 +1,5 @@
/**
* Copyright (C) 2014 Justin James.
* Copyright (C) 2014-2015 Justin James.
*
* This license must be preserved.
* Any applications, libraries, or code which make any use of any
@ -27,8 +27,6 @@ void RenX_IRCJoinPlugin::init()
RenX_IRCJoinPlugin::publicOnly = Jupiter::IRC::Client::Config->getBool(this->getName(), STRING_LITERAL_AS_REFERENCE("PublicOnly"), true);
RenX_IRCJoinPlugin::joinMsgAlways = Jupiter::IRC::Client::Config->getBool(this->getName(), STRING_LITERAL_AS_REFERENCE("Join.MsgAlways"), false);
RenX_IRCJoinPlugin::partMsgAlways = Jupiter::IRC::Client::Config->getBool(this->getName(), STRING_LITERAL_AS_REFERENCE("Part.MsgAlways"), false);
RenX_IRCJoinPlugin::minAccessJoinMessage = Jupiter::IRC::Client::Config->getInt(this->getName(), STRING_LITERAL_AS_REFERENCE("Join.MinAccess"), 0);
RenX_IRCJoinPlugin::maxAccessJoinMessage = Jupiter::IRC::Client::Config->getInt(this->getName(), STRING_LITERAL_AS_REFERENCE("Join.MaxAccess"), -1);
RenX_IRCJoinPlugin::minAccessPartMessage = Jupiter::IRC::Client::Config->getInt(this->getName(), STRING_LITERAL_AS_REFERENCE("Part.MinAccess"), 0);
RenX_IRCJoinPlugin::maxAccessPartMessage = Jupiter::IRC::Client::Config->getInt(this->getName(), STRING_LITERAL_AS_REFERENCE("Part.MaxAccess"), -1);
RenX_IRCJoinPlugin::nameTag = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("NameTag"), STRING_LITERAL_AS_REFERENCE("{NAME}"));
@ -41,13 +39,10 @@ void RenX_IRCJoinPlugin::init()
void RenX_IRCJoinPlugin::OnJoin(Jupiter::IRC::Client *source, const Jupiter::ReadableString &channel, const Jupiter::ReadableString &nick)
{
int access = source->getAccessLevel(channel, nick);
if (access >= RenX_IRCJoinPlugin::minAccessJoinMessage && (RenX_IRCJoinPlugin::maxAccessJoinMessage == -1 || access <= RenX_IRCJoinPlugin::maxAccessJoinMessage))
if (RenX_IRCJoinPlugin::joinFmt.isNotEmpty())
{
RenX::Server *server;
int type = source->getChannel(channel)->getType();
Jupiter::String msg = RenX_IRCJoinPlugin::joinFmt;
msg.replace(RenX_IRCJoinPlugin::nameTag, nick);
msg.replace(RenX_IRCJoinPlugin::chanTag, channel);
@ -70,6 +65,8 @@ void RenX_IRCJoinPlugin::OnJoin(Jupiter::IRC::Client *source, const Jupiter::Rea
void RenX_IRCJoinPlugin::OnPart(Jupiter::IRC::Client *source, const Jupiter::ReadableString &channel, const Jupiter::ReadableString &nick, const Jupiter::ReadableString &reason)
{
if (RenX_IRCJoinPlugin::partFmt.isNotEmpty())
{
int access = source->getAccessLevel(channel, nick);
if (access >= RenX_IRCJoinPlugin::minAccessPartMessage && (RenX_IRCJoinPlugin::maxAccessPartMessage == -1 || access <= RenX_IRCJoinPlugin::maxAccessPartMessage))
@ -100,6 +97,7 @@ void RenX_IRCJoinPlugin::OnPart(Jupiter::IRC::Client *source, const Jupiter::Rea
server->sendMessage(msg);
}
}
}
}
int RenX_IRCJoinPlugin::OnRehash()

8
RenX.IRCJoin/RenX_IRCJoin.h

@ -1,5 +1,5 @@
/**
* Copyright (C) 2014 Justin James.
* Copyright (C) 2014-2015 Justin James.
*
* This license must be preserved.
* Any applications, libraries, or code which make any use of any
@ -33,11 +33,11 @@ public: // Jupiter::Plugin
private:
void init();
// Config Variables
bool publicOnly;
bool joinMsgAlways;
bool partMsgAlways;
int minAccessJoinMessage;
int maxAccessJoinMessage;
int minAccessPartMessage;
int maxAccessPartMessage;
Jupiter::StringS nameTag;
@ -46,6 +46,8 @@ private:
Jupiter::StringS joinFmt;
Jupiter::StringS partFmt;
Jupiter::StringS partFmtNoReason;
// Internal Variables
STRING_LITERAL_AS_NAMED_REFERENCE(name, "RenX.IRCJoin");
};

Loading…
Cancel
Save