/
com/planet_ink/coffee_mud/Abilities/Common/
com/planet_ink/coffee_mud/Abilities/Diseases/
com/planet_ink/coffee_mud/Abilities/Druid/
com/planet_ink/coffee_mud/Abilities/Fighter/
com/planet_ink/coffee_mud/Abilities/Languages/
com/planet_ink/coffee_mud/Abilities/Misc/
com/planet_ink/coffee_mud/Abilities/Prayers/
com/planet_ink/coffee_mud/Abilities/Properties/
com/planet_ink/coffee_mud/Abilities/Skills/
com/planet_ink/coffee_mud/Abilities/Songs/
com/planet_ink/coffee_mud/Abilities/Spells/
com/planet_ink/coffee_mud/Abilities/Thief/
com/planet_ink/coffee_mud/Abilities/Traps/
com/planet_ink/coffee_mud/Behaviors/
com/planet_ink/coffee_mud/CharClasses/interfaces/
com/planet_ink/coffee_mud/Commands/
com/planet_ink/coffee_mud/Commands/interfaces/
com/planet_ink/coffee_mud/Common/
com/planet_ink/coffee_mud/Common/interfaces/
com/planet_ink/coffee_mud/Exits/interfaces/
com/planet_ink/coffee_mud/Items/Armor/
com/planet_ink/coffee_mud/Items/Basic/
com/planet_ink/coffee_mud/Items/CompTech/
com/planet_ink/coffee_mud/Items/MiscMagic/
com/planet_ink/coffee_mud/Items/Weapons/
com/planet_ink/coffee_mud/Items/interfaces/
com/planet_ink/coffee_mud/Libraries/
com/planet_ink/coffee_mud/Libraries/interfaces/
com/planet_ink/coffee_mud/Locales/
com/planet_ink/coffee_mud/MOBS/
com/planet_ink/coffee_mud/Races/
com/planet_ink/coffee_mud/Races/interfaces/
com/planet_ink/coffee_mud/WebMacros/
com/planet_ink/coffee_mud/WebMacros/interfaces/
com/planet_ink/coffee_mud/core/
com/planet_ink/coffee_mud/core/collections/
com/planet_ink/coffee_mud/core/interfaces/
com/planet_ink/coffee_mud/core/intermud/
com/planet_ink/coffee_mud/core/intermud/i3/
com/planet_ink/coffee_web/server/
com/planet_ink/siplet/applet/
lib/
resources/factions/
resources/fakedb/
resources/progs/autoplayer/
resources/quests/holidays/
web/
web/admin.templates/
web/admin/grinder/
web/admin/images/
web/clan.templates/
web/pub.templates/
web/pub/images/mxp/
web/pub/sounds/
web/pub/textedit/
<HTML>
<HEAD>
<LINK REL=StyleSheet HREF="term.css" TYPE="text/css">
	<link rel="coffeemud icon" href="../images/coffeemud.ico" >
<SCRIPT LANGUAGE=JavaScript src="dropdown.js"></SCRIPT>
<SCRIPT LANGUAGE=JavaScript src="siplet.js"></SCRIPT>
</HEAD>
<BODY BGCOLOR=BLACK ONCLICK="top.term.front(myname,mynum);">
<script language=JavaScript>
var mynum = top.term.currentWindow;
var myname='dwindow'+top.term.currentWindow;
var mydivname='ewindow'+top.term.currentWindow;
var gauges=new Array();
var theSiplet = null;
var lastReceived = new Date().getTime();

var limit=50000;
var pingDelay=1000;
var halflimit=limit/2;
var tenthlimit=limit/10;
var errorState=false;

function connectChecker()
{
	if((theSiplet!=null)&&(!errorState))
	{
		var ellapsed=new Date().getTime() - lastReceived;
		if(ellapsed>30000)
		{
			setTimeout(displayData,pingDelay);
		}
	}
	else
		lastReceived = new Date().getTime()
	setTimeout(connectChecker,10001);
}

setTimeout(connectChecker,10001);

function closeWindow()
{
	if(theSiplet)
		theSiplet.disconnectFromURL();
	top.document.location.href='/index.cmvp';
}

function reconnect()
{
	if(theSiplet)
	{
		if(!theSiplet.isConnecting())
			theSiplet.disconnectFromURL();
	}
	if((!theSiplet) || (!theSiplet.isConnecting()))
		setTimeout('connect("@MudInfo?DOMAIN@",@MudInfo?PORT@);',500);
}

function addToWindow(s)
{
	if(s.length>0)
	{
		var theSpan=document.getElementById("DISPLAYSPAN");
		var theend=document.getElementById("NODISPLAY");
		if(theSpan.innerHTML.length>(limit+halflimit))
		{
			var x=theSpan.innerHTML;
			var xcess=x.length-limit;
			var br='<BR>';
			var y=x.indexOf(br,xcess);
			if(y<0) 
			{
				br='<BR >';
				y=x.indexOf(br,xcess);
			}
			if(y<0) 
			{
				br='<br>';
				y=x.indexOf(br,xcess);
			}
			if(y<0) 
			{
				br='<br >';
				y=x.indexOf(br,xcess);
			}
			if((y<0)||(y>xcess+tenthlimit))
				y=x.indexOf(br,xcess/2);
			if(y>=0)
				x=x.substring(y+br.length);
			else
			while(x.length>limit)
			{
				var y=x.indexOf(br);
				if(y<0) break;
				x=x.substring(y+br.length);
			}
			theSpan.innerHTML=x;
		}
		theSpan.innerHTML+=s;
		theend.scrollIntoView(false);
		if(mynum != top.term.currentWindow)
			top.bar.lightgreenColor(mynum);
	}
}

function goCaution()
{
	var theSpan=top.term.document.getElementById(myname+'namer');
	theSpan.style.backgroundColor='yellow'
	theSpan=top.term.document.getElementById(myname+'bar');
	theSpan.style.backgroundColor='yellow'
	top.bar.yellowColor(mynum);
}

function goGreen()
{
	var theSpan=top.term.document.getElementById(myname+'namer');
	theSpan.style.backgroundColor='green'
	theSpan=top.term.document.getElementById(myname+'bar');
	theSpan.style.backgroundColor='green'
	top.bar.greenColor(mynum);
}

function goRed()
{
	var theSpan=top.term.document.getElementById(myname+'bar');
	theSpan.style.backgroundColor='red'
	theSpan=top.term.document.getElementById(myname+'namer');
	theSpan.style.backgroundColor='red'
	top.bar.redColor(mynum);
}

function goOffline()
{
	theSiplet.disconnectFromURL();
	theSiplet=new Siplet();
	goRed();
}

function BoxFocus()
{
	top.entry.boxFocus();
}

var sounders=[];
var soundDates=[];
var soundPriorities=[];
function PlaySound(key,playerName,url,repeats,volume,priority)
{
	var theSoundPlayer = sounders[playerName];  
	if(theSoundPlayer)
	{
		var now=new Date();
		var ellapsed=Math.abs(now.getTime() - soundDates[playerName].getTime());
		if((ellapsed < 1500) && (priority <= soundPriorities[playerName]))
			return;
		if(theSoundPlayer.stop)
			theSoundPlayer.stop();
		document.childNodes[0].removeChild(theSoundPlayer);
	}
	theSoundPlayer=document.createElement('embed');
	if(!theSoundPlayer) return;
	sounders[playerName]=theSoundPlayer;
	soundDates[playerName]=new Date();
	soundPriorities[playerName]=priority;
	document.childNodes[0].appendChild(theSoundPlayer);
	theSoundPlayer.setAttribute('src', url+key);
	theSoundPlayer.setAttribute('type','audio/wav');
	theSoundPlayer.setAttribute('hidden','true');
	theSoundPlayer.setAttribute('volume', volume);
	if(theSoundPlayer.play)
		theSoundPlayer.play();
}

function StopSound(key,playerName)
{
	var theSoundPlayer=document.getElementById(playerName);
	theSoundPlayer.src='';
	theSoundPlayer.Play();
	theSoundPlayer.innerHTML='';
}

function displayData()
{
	if(!theSiplet.isConnectedToURL())
		goOffline();
	else
	{
		theSiplet.getURLData(function(connected, txt){
			if(!connected || (!txt) || (txt.substr(0,5)!='true;'))
				goOffline();
			else
			{
				txt=txt.substr(5);
				var tk=theSiplet.token+";";
				var x=txt.indexOf(tk);
				if(x<0)
					goOffline();
				else
				{
					var data=txt.substr(0,x);
					var s="";
					s=s+data;
					addToWindow(s);
					
					txt=txt.substr(x+tk.length);
					x=txt.indexOf(tk);
					if(x>0)
					{
						data=txt.substr(0,x);
						s="";
						s=s+data;
						if(s.length>0)
							eval(s);
					}
					lastReceived = new Date().getTime();
					setTimeout(displayData,pingDelay);
				}
			}
		});
	}
}

function sendData(me)
{
	var s=''+me;
	theSiplet.sendData(s,function(success,txt) {
		if(!success || (!txt) || (txt.substr(0,5)!='true;'))
			goOffline();
		else
		{
			txt=txt.substr(5);
			var tk=theSiplet.token+";";
			var x=txt.indexOf(tk);
			if(x<0)
				goOffline();
			else
			{
				var data=txt.substr(0,x);
				var s="";
				s=s+data;
				addToWindow(s);
				
				txt=txt.substr(x+tk.length);
				x=txt.indexOf(tk);
				if(x>0)
				{
					data=txt.substr(0,x);
					s="";
					s=s+data;
					if(s.length>0)
						eval(s);
				}
				lastReceived = new Date().getTime();
				setTimeout(displayData,pingDelay);
			}
		}
	});
}

function createGauge(entity,caption,color,value,max)
{
	var gaugedata=new Array(5);
	gaugedata[0]=entity;
	gaugedata[1]=caption;
	gaugedata[2]=color;
	gaugedata[3]=value;
	gaugedata[4]=max;
	gauges[gauges.length]=gaugedata;
	modifyGauge(entity,value,max);
}

function removeGauge(entity)
{
	var oldgauges=gauges;
	gauges=new Array();
	var o=0;
	var ndex=0;
	for(o=0;o<oldgauges.length;o++)
	{
		var gaugedata=oldgauges[o];
		if(gaugedata[0]!=entity)
		{
			gauges[ndex]=gaugedata;
			ndex++;
		}
	}
	modifyGauge(entity,-1,-1);
}

function modifyGauge(entity,value,max)
{
	var div=top.term.document.getElementById(myname+'extracontent');
	if(gauges.length==0)
		div.innerHTML='';
	else
	{
		var gaugewid=100;
		var s='<TABLE WIDTH=100% CELLPADDING=0 CELLSPACING=0 BORDER=1><TR>';
		var i=0;
		var cellwidth=100/gauges.length;
		for(i=0;i<gauges.length;i++)
		{
			var gaugedata=gauges[i];
			if(gaugedata[0]==entity)
			{
				gaugedata[3]=value;
				gaugedata[4]=max;
			}
		}
		for(i=0;i<gauges.length;i++)
		{
			var gaugedata=gauges[i];
			s+='<TD WIDTH='+cellwidth+'%>';
			s+='<FONT STYLE="color: '+gaugedata[2]+'" SIZE=-2>'+gaugedata[1]+'</FONT><BR>';
			var gaugedata=gauges[i];
			var fullwidth=100-gaugedata[3];
			var lesswidth=gaugedata[3];
			s+='<TABLE WIDTH=100% CELLPADDING=0 CELLSPACING=0 BORDER=0 HEIGHT=5><TR HEIGHT=5>';
			s+='<TD STYLE="background-color: '+gaugedata[2]+'" WIDTH='+lesswidth+'%></TD>';
			s+='<TD STYLE="background-color: black" WIDTH='+fullwidth+'%></TD>';
			s+='</TR></TABLE>';
			s+='</TD>';
		}
		s+='</TR></TABLE>'
		div.innerHTML=s;
	}
}
function NoJava()
{
	var theSpan=document.getElementById("DISPLAYSPAN");
	theSpan.innerHTML='<P><BR><FONT COLOR=RED SIZE=4>It does not appear that your browser has the proper version of the Java Runtime Environment installed.  Please visit <a href=http://java.sun.com>java.sun.com</a> to download the JRE.  Then restart your browser and try this page again.  If problems persist, make sure your browser has the <I>Allow Applet Installation</I> and <I>Allow Scripting</I> features enabled.</FONT><P>';
}

function connect(url,port,tries)
{
	errorState=false;
	goCaution();
	gauges=new Array(0);
	theSiplet.connectToURL(url,@WebServerPort?CURRENT@,port,function(connectWorked, txt){
		var s='';
		var x=txt.indexOf(';');
		if(x<0)
			connectWorked=false;
		else
		{
			connectWorked = connectWorked && txt.substr(0,x) == "true";
			if(connectWorked == true)
			{
				txt=txt.substr(x+1);
				x=txt.indexOf(';');
				theSiplet.token=txt.substr(0,x);
				top.term.allapplets[top.term.currentWindow] = theSiplet;
				txt=txt.substr(x+1);
				var tk=theSiplet.token+";";
				var x=txt.indexOf(tk);
				if(x<0)
					connectWorked=false;
				else
					s=txt.substr(0,x);
			}
		}
		//window.onerror=null;
		var thespan=top.term.document.getElementById(myname+'namer');
		thespan.innerHTML=s
		gauges=new Array(0);
		if(!connectWorked)
		{
			goRed();
		}
		else
		{
			goGreen();
			lastReceived = new Date().getTime();
			setTimeout('displayData(); top.entry.boxFocus();',pingDelay);
		}
	}); 
}

function addToPrompt(x,att)
{
	top.entry.document.ENTER.TEXT.value=x;
	if(!att)
		top.entry.sendText(x);
	else
		top.entry.document.ENTER.TEXT.value+=" ";
}

function goDefault(x)
{
	top.term.front('dwindow'+x,x);
}

top.term.allwindows[top.term.currentWindow]=this;
</SCRIPT>
<BR>
<DIV ID=DISPLAYSPAN NAME=DISPLAYSPAN>
</DIV>
<DIV ID=NODISPLAY NAME=NODISPLAY></DIV>
<SPAN ID=musicplayer NAME=musicplayer style="display:none"></SPAN>
<SPAN ID=soundplayer NAME=soundplayer style="display:none"></SPAN>
<script language=JavaScript>
<!--
	theSiplet=new Siplet();
	top.term.allapplets[top.term.currentWindow] = theSiplet;
	setTimeout('connect("@MudInfo?DOMAIN@",@MudInfo?PORT@);',500);
//-->
</script>
</BODY></HTML>