1
0

Merge pull request #468 from mc-server/colourchange

Update chat colours
This commit is contained in:
Alexander Harkness 2013-12-24 07:55:15 -08:00
commit f2d2b4fecb
5 changed files with 14 additions and 26 deletions

View File

@ -1,4 +1,3 @@
-- APIDesc.lua -- APIDesc.lua
-- Contains the API objects' descriptions -- Contains the API objects' descriptions
@ -308,18 +307,15 @@ g_APIDesc =
A wrapper class for constants representing colors or effects. A wrapper class for constants representing colors or effects.
]], ]],
Functions = Functions = {},
{
MakeColor = { Params = "ColorCodeConstant", Return = "string", Notes = "Creates the complete color-code-sequence from the color or effect constant" },
},
Constants = Constants =
{ {
Black = { Notes = "" }, Black = { Notes = "" },
Blue = { Notes = "" }, Blue = { Notes = "" },
Bold = { Notes = "" }, Bold = { Notes = "" },
Color = { Notes = "The first character of the color-code-sequence, §" }, Color = { Notes = "The first character of the color-code-sequence, <EFBFBD>" },
DarkPurple = { Notes = "" }, DarkPurple = { Notes = "" },
Delimiter = { Notes = "The first character of the color-code-sequence, §" }, Delimiter = { Notes = "The first character of the color-code-sequence, <EFBFBD>" },
Gold = { Notes = "" }, Gold = { Notes = "" },
Gray = { Notes = "" }, Gray = { Notes = "" },
Green = { Notes = "" }, Green = { Notes = "" },

View File

@ -1,4 +1,3 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "ChatColor.h" #include "ChatColor.h"
@ -29,11 +28,5 @@ const std::string cChatColor::Underlined = cChatColor::Color + "n";
const std::string cChatColor::Italic = cChatColor::Color + "o"; const std::string cChatColor::Italic = cChatColor::Color + "o";
const std::string cChatColor::Plain = cChatColor::Color + "r"; const std::string cChatColor::Plain = cChatColor::Color + "r";
const std::string cChatColor::MakeColor( char a_Color )
{
return cChatColor::Color + a_Color;
}

View File

@ -29,15 +29,14 @@ public:
static const std::string Yellow; static const std::string Yellow;
static const std::string White; static const std::string White;
// Styles ( source: http://wiki.vg/Chat ) // Styles ( source: http://wiki.vg/Chat )
static const std::string Random; static const std::string Random;
static const std::string Bold; static const std::string Bold;
static const std::string Strikethrough; static const std::string Strikethrough;
static const std::string Underlined; static const std::string Underlined;
static const std::string Italic; static const std::string Italic;
static const std::string Plain; static const std::string Plain;
static const std::string MakeColor( char a_Color );
}; };
// tolua_end // tolua_end

View File

@ -1294,7 +1294,7 @@ AString cPlayer::GetColor(void) const
{ {
if ( m_Color != '-' ) if ( m_Color != '-' )
{ {
return cChatColor::MakeColor( m_Color ); return cChatColor::Color + m_Color;
} }
if ( m_Groups.size() < 1 ) if ( m_Groups.size() < 1 )

View File

@ -79,11 +79,11 @@ cGroupManager::cGroupManager()
Group->SetName( KeyName ); Group->SetName( KeyName );
char Color = IniFile.GetValue( KeyName, "Color", "-" )[0]; char Color = IniFile.GetValue( KeyName, "Color", "-" )[0];
if( Color != '-' ) if( Color != '-' )
Group->SetColor( cChatColor::MakeColor(Color) ); Group->SetColor( cChatColor::Color + Color );
else else
Group->SetColor( cChatColor::White ); Group->SetColor( cChatColor::White );
std::string Commands = IniFile.GetValue( KeyName, "Commands", "" ); AString Commands = IniFile.GetValue( KeyName, "Commands", "" );
if( Commands.size() > 0 ) if( Commands.size() > 0 )
{ {
AStringVector Split = StringSplit( Commands, "," ); AStringVector Split = StringSplit( Commands, "," );
@ -93,7 +93,7 @@ cGroupManager::cGroupManager()
} }
} }
std::string Permissions = IniFile.GetValue( KeyName, "Permissions", "" ); AString Permissions = IniFile.GetValue( KeyName, "Permissions", "" );
if( Permissions.size() > 0 ) if( Permissions.size() > 0 )
{ {
AStringVector Split = StringSplit( Permissions, "," ); AStringVector Split = StringSplit( Permissions, "," );