Hi, nothing too special here, this is just a little snippet that simply adds some flare to messages/interfaces that display combat levels. Written on a 667 base.
This method will return a HEX color code in String format based on the difference between two levels, same as how the level color changes when right clicking an NPC/Player (See media below). This is about as close to the actual formula that I could get; it has a range of 20 levels.
Code:
/**
* @ param hiddenLevel The level of the entity that is doing the checking (player)
* @ param displayedLevel The level of the entity that is going to be displayed (player2 / npc)
* @ param HEX string color code based on the level difference between two levels
*/
public String getLevelDifferenceColor(int hiddenLevel, int displayedLevel) {
int levelDifference = displayedLevel - hiddenLevel;
Row 1: Player combat level
Row 2: Right clicked NPC
Row 3: NPC displayed on interface using the getLevelDifferenceColor() [Only registered and activated users can see links. Click Here To Register...]
Alternatively, here is a utility method for converting RGB to Hex, for setting colors on the go without dealing with Hex (I prefer playing with RGB)
Spoiler for getHexFromRGB():
Code:
/**
* @ return A HEX color code in String format based on Red, Green, Blue
*/
public static String getHexFromRGB(int red, int green, int blue) {
return String.format("%02X%02X%02X", red, green, blue);
}