com.planet_ink.coffee_mud.Libraries
Class CMColor

java.lang.Object
  extended by com.planet_ink.coffee_mud.Libraries.StdLibrary
      extended by com.planet_ink.coffee_mud.Libraries.CMColor
All Implemented Interfaces:
CMObject, Tickable, CMLibrary, ColorLibrary, java.lang.Cloneable, java.lang.Comparable<CMObject>

public class CMColor
extends StdLibrary
implements ColorLibrary


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.planet_ink.coffee_mud.Libraries.interfaces.ColorLibrary
ColorLibrary.Color, ColorLibrary.ColorState, ColorLibrary.SpecialColor
 
Field Summary
 java.lang.String[] clookup
           
 java.lang.String[] htlookup
           
 
Fields inherited from class com.planet_ink.coffee_mud.Libraries.StdLibrary
isDebugging, name, serviceClient, tickStatus
 
Fields inherited from interface com.planet_ink.coffee_mud.Libraries.interfaces.ColorLibrary
COLORCODE_BACKGROUND, COLORCODE_BANSI256, COLORCODE_FANSI256, COLORS_INCARDINALORDER, MAP_ANSICOLOR_TO_ANSIBGCOLOR
 
Fields inherited from interface com.planet_ink.coffee_mud.core.interfaces.Tickable
STATUS_AFFECT, STATUS_ALIVE, STATUS_BEHAVIOR, STATUS_CLASS, STATUS_DEAD, STATUS_END, STATUS_FIGHT, STATUS_MISC, STATUS_MISC2, STATUS_MISC3, STATUS_MISC4, STATUS_MISC5, STATUS_MISC6, STATUS_MISC7, STATUS_NOT, STATUS_OTHER, STATUS_RACE, STATUS_REBIRTH, STATUS_SCRIPT, STATUS_START, STATUS_WEATHER, TICKID_AREA, TICKID_BEAMWEAPON, TICKID_CLAN, TICKID_CLANITEM, TICKID_DEADBODY_DECAY, TICKID_ELECTRONICS, TICKID_EMAIL, TICKID_EXIT_BEHAVIOR, TICKID_EXIT_REOPEN, TICKID_ITEM_BEHAVIOR, TICKID_ITEM_BOUNCEBACK, TICKID_LIGHT_FLICKERS, TICKID_LIVEAUCTION, TICKID_LONGERMASK, TICKID_MISCELLANEOUS, TICKID_MOB, TICKID_PROPERTY_SPECIAL, TICKID_QUEST, TICKID_READYTOSTOP, TICKID_ROOM_BEHAVIOR, TICKID_ROOM_ITEM_REJUV, TICKID_SOLITARYMASK, TICKID_SPECIALCOMBAT, TICKID_SPECIALMANEUVER, TICKID_SPELL_AFFECT, TICKID_SUPPORT, TICKID_TIMEAUCTION, TICKID_TRAP_DESTRUCTION, TICKID_TRAP_RESET
 
Constructor Summary
CMColor()
           
 
Method Summary
 void clearLookups()
          Clears the color code lookup tables so that the next translations will come from the properties.
protected  char findCodeChar(java.lang.String name)
           
protected  ColorLibrary.SpecialColor findCodeColor(java.lang.String name)
           
 CMMsg fixSourceFightColor(CMMsg msg)
          Does nothing more impressive than adding the color codes for combat to the source and target messages if possible.
 ColorLibrary.ColorState getNormalColor()
          A ColorState object that represents the basic normal color, typically grey with no background.
 java.lang.String ID()
          The CoffeeMud Java Class ID shared by all instances of this object.
 java.lang.String mixColorCodes(java.lang.String code1, java.lang.String code2)
          Given a foreground and background set of ansi escape codes, this method generates a single useable ansi escape code from the two.
 java.lang.String mixHTMLCodes(java.lang.String code1, java.lang.String code2)
          Given a foreground and background set of html tags, this method generates a single useable html tag from the two.
 java.lang.String[] standardColorLookups()
          Returns the standard ansi escape color lookup table, which maps an array indexed by the ^ color codes to an ansi escape color
 java.lang.String[] standardHTMLlookups()
          Returns the standard html tag lookup table, which maps an array indexed by the ^ color codes to an html tag.
 java.lang.String translateANSItoCMCode(java.lang.String code)
          Translates an ansi escape sequence to a basic 16 or special color code, anything that starts with ^ to the .
 java.lang.String translateCMCodeToANSI(java.lang.String code)
          Translates a basic 16 or special color code, anything that starts with ^ to the ansi escape sequence.
 java.lang.String translateCMCodeToFGNumber(java.lang.String code)
           
protected  int translateSingleCMCodeToANSIOffSet(java.lang.String code)
           
 ColorLibrary.ColorState valueOf(char fg, char bg)
          Generates a new ColorState object from the given foreground and background basic 16 ^ color codes.
 
Methods inherited from class com.planet_ink.coffee_mud.Libraries.StdLibrary
activate, checkDatabase, compareTo, copyOf, getServiceClient, getTickStatus, initializeClass, L, name, newInstance, propertiesLoaded, setThreadStatus, shutdown, tick
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.planet_ink.coffee_mud.Libraries.interfaces.CMLibrary
activate, getServiceClient, L, propertiesLoaded, shutdown
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.CMObject
copyOf, initializeClass, name, newInstance
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

clookup

public java.lang.String[] clookup

htlookup

public java.lang.String[] htlookup
Constructor Detail

CMColor

public CMColor()
Method Detail

ID

public java.lang.String ID()
Description copied from interface: CMObject
The CoffeeMud Java Class ID shared by all instances of this object. Unlike the Java Class name, this method does not include package information. However, it must return a String value unique to its class category in the ClassLoader. Class categories include Libraries, Common, Areas, Abilities, Behaviors, CharClasses, Commands, Exits Locales, MOBS, Races, WebMacros, Basic Items, Armor, Weapons, ClanItems, Tech. The name is typically identical to the class name.

Specified by:
ID in interface CMObject
Overrides:
ID in class StdLibrary
Returns:
the name of this class

getNormalColor

public final ColorLibrary.ColorState getNormalColor()
Description copied from interface: ColorLibrary
A ColorState object that represents the basic normal color, typically grey with no background.

Specified by:
getNormalColor in interface ColorLibrary
Returns:
the normal color ColorState
See Also:
ColorLibrary.ColorState

valueOf

public final ColorLibrary.ColorState valueOf(char fg,
                                             char bg)
Description copied from interface: ColorLibrary
Generates a new ColorState object from the given foreground and background basic 16 ^ color codes.

Specified by:
valueOf in interface ColorLibrary
Parameters:
fg - the foreground color code char
bg - the background color code char
Returns:
the new ColorState object
See Also:
ColorLibrary.ColorState

translateSingleCMCodeToANSIOffSet

protected int translateSingleCMCodeToANSIOffSet(java.lang.String code)

translateCMCodeToFGNumber

public java.lang.String translateCMCodeToFGNumber(java.lang.String code)

translateCMCodeToANSI

public java.lang.String translateCMCodeToANSI(java.lang.String code)
Description copied from interface: ColorLibrary
Translates a basic 16 or special color code, anything that starts with ^ to the ansi escape sequence.

Specified by:
translateCMCodeToANSI in interface ColorLibrary
Parameters:
code - the ^ code
Returns:
the ansi escape sequence
See Also:
ColorLibrary.translateANSItoCMCode(String)

translateANSItoCMCode

public java.lang.String translateANSItoCMCode(java.lang.String code)
Description copied from interface: ColorLibrary
Translates an ansi escape sequence to a basic 16 or special color code, anything that starts with ^ to the .

Specified by:
translateANSItoCMCode in interface ColorLibrary
Parameters:
code - ansi escape sequence
Returns:
the ^ code
See Also:
ColorLibrary.translateCMCodeToANSI(String)

mixHTMLCodes

public java.lang.String mixHTMLCodes(java.lang.String code1,
                                     java.lang.String code2)
Description copied from interface: ColorLibrary
Given a foreground and background set of html tags, this method generates a single useable html tag from the two.

Specified by:
mixHTMLCodes in interface ColorLibrary
Parameters:
code1 - the first html tag
code2 - the other html tag, or null
Returns:
the combined html tag
See Also:
ColorLibrary.mixColorCodes(String, String)

mixColorCodes

public java.lang.String mixColorCodes(java.lang.String code1,
                                      java.lang.String code2)
Description copied from interface: ColorLibrary
Given a foreground and background set of ansi escape codes, this method generates a single useable ansi escape code from the two.

Specified by:
mixColorCodes in interface ColorLibrary
Parameters:
code1 - the first ansi escape code
code2 - the other ansi escape code, or null
Returns:
the combined ansi escape code
See Also:
ColorLibrary.mixHTMLCodes(String, String)

fixSourceFightColor

public CMMsg fixSourceFightColor(CMMsg msg)
Description copied from interface: ColorLibrary
Does nothing more impressive than adding the color codes for combat to the source and target messages if possible.

Specified by:
fixSourceFightColor in interface ColorLibrary
Parameters:
msg - the message to colorize
Returns:
the same CMMsg sent, returned.

findCodeColor

protected final ColorLibrary.SpecialColor findCodeColor(java.lang.String name)

findCodeChar

protected final char findCodeChar(java.lang.String name)

standardHTMLlookups

public java.lang.String[] standardHTMLlookups()
Description copied from interface: ColorLibrary
Returns the standard html tag lookup table, which maps an array indexed by the ^ color codes to an html tag.

Specified by:
standardHTMLlookups in interface ColorLibrary
Returns:
the html tag lookup table
See Also:
ColorLibrary.standardColorLookups()

clearLookups

public void clearLookups()
Description copied from interface: ColorLibrary
Clears the color code lookup tables so that the next translations will come from the properties.

Specified by:
clearLookups in interface ColorLibrary

standardColorLookups

public java.lang.String[] standardColorLookups()
Description copied from interface: ColorLibrary
Returns the standard ansi escape color lookup table, which maps an array indexed by the ^ color codes to an ansi escape color

Specified by:
standardColorLookups in interface ColorLibrary
Returns:
the ansi escape color lookup table
See Also:
ColorLibrary.standardHTMLlookups()