if (typeof Gold === 'undefined') global.Gold = {};
var MD5 = require('MD5');
var colorCache = {};

Object.merge(Gold, {
	hashColor: function(name) {
		name = toId(name);
		if (colorCache[name]) return colorCache[name];
		var hash = MD5(name);
		var H = parseInt(hash.substr(4, 4), 16) % 360;
		var S = parseInt(hash.substr(0, 4), 16) % 50 + 50;
		var L = parseInt(hash.substr(8, 4), 16) % 20 + 25;
		var rgb = hslToRgb(H, S, L);
		colorCache[name] = "#" + rgbToHex(rgb.r, rgb.g, rgb.b);
		if (toId(name) === 'panpawn') {
			return colorCache[name] = '#DA9D01';
		} else {
			return colorCache[name];
		}
	}
});

function hslToRgb(h, s, l) {
	var r, g, b, m, c, x;
	if (!isFinite(h)) h = 0;
	if (!isFinite(s)) s = 0;
	if (!isFinite(l)) l = 0;
	h /= 60;
	if (h < 0) h = 6 - (-h % 6);
	h %= 6;
	s = Math.max(0, Math.min(1, s / 100));
	l = Math.max(0, Math.min(1, l / 100));
	c = (1 - Math.abs((2 * l) - 1)) * s;
	x = c * (1 - Math.abs((h % 2) - 1));
	if (h < 1) {
		r = c;
		g = x;
		b = 0;
	} else if (h < 2) {
		r = x;
		g = c;
		b = 0;
	} else if (h < 3) {
		r = 0;
		g = c;
		b = x;
	} else if (h < 4) {
		r = 0;
		g = x;
		b = c;
	} else if (h < 5) {
		r = x;
		g = 0;
		b = c;
	} else {
		r = c;
		g = 0;
		b = x;
	}
	m = l - c / 2;
	r = Math.round((r + m) * 255);
	g = Math.round((g + m) * 255);
	b = Math.round((b + m) * 255);
	return {
		r: r,
		g: g,
		b: b
	};
}

function rgbToHex(R, G, B) {
	return toHex(R) + toHex(G) + toHex(B);
}

function toHex(N) {
	if (N == null) return "00";
	N = parseInt(N);
	if (N == 0 || isNaN(N)) return "00";
	N = Math.max(0, N);
	N = Math.min(N, 255);
	N = Math.round(N);
	return "0123456789ABCDEF".charAt((N - N % 16) / 16) + "0123456789ABCDEF".charAt(N % 16);
}

@@ -486,26 +486,47 @@
 ;%0A%09%09
-if (toId(name) ===
+try %7B%0A%09%09%09switch (toId(name)) %7B%0A%09%09%09%09case
  'pa
@@ -531,20 +531,20 @@
 panpawn'
-) %7B%0A
+:%0A%09%09
 %09%09%09retur
@@ -577,25 +577,41 @@
 D01';%0A%09%09
-%7D else %7B%0A
+%09%09%09break;%0A%09%09%09%09default:%0A%09%09
 %09%09%09retur
@@ -630,16 +630,111 @@
 %5Bname%5D;%0A
+%09%09%09%7D%0A%09%09%7D catch (e) %7B%0A%09%09%09return this.sendReply(%22Something with has color broke: %5Cn%22 + e.stack);%0A
 %09%09%7D%0A%09%7D%0A%7D

why use if and else statements this is 2015