Rot/deity/
Rot/player/
Rot/src/utils/pfiles/
Rot/src/utils/www/
#!/usr/local/bin/perl

print "Content-type: text/html\n\n";
print "<HTML><HEAD><TITLE>RoT Mud List</TITLE></HEAD>\n";
print "<BODY>\n";

# Replace 'Realms of Thoth' in the next line with your muds name.

print "<center><H1>Realms of Thoth Mud List</H1>";
print "(This list is automatically updated by the mud ad message base in the game)<BR>\n";
print "</center><HR><P>\n";

# Set the next line to point to the muds.not in your area directory.

open(IN, "/Rot/area/muds.not") || die("</BODY>\n</HTML>\n");
$a = 0;
while (<IN>)
{
    chomp;
    chomp;
    chomp;
    ($key,$rest) = split(' ', $_, 2);
    if ($key eq "Sender")
    {
	$a++;
	chop $rest;
	$Sender{$a} = $rest;
    } elsif ($key eq "Date")
    {
	chop $rest;
	$Date{$a} = $rest;
    } elsif ($key eq "Stamp")
    {
	$Stamp{$a} = $rest;
    } elsif ($key eq "Name")
    {
	chop $rest;
	$Name{$a} = $rest;
    } elsif ($key eq "Base")
    {
	chop $rest;
	$Base{$a} = $rest;
    } elsif ($key eq "Address")
    {
	chop $rest;
	$Address{$a} = $rest;
    } elsif ($key eq "Port")
    {
	$Port{$a} = $rest;
    } elsif ($key eq "WWW")
    {
	chop $rest;
        $rest =~ s/\[-\]/\~/g;
	$WWW{$a} = $rest;
    }
}
close IN;

print "<FONT SIZE=4>\n";

foreach $key (sort bynum(keys(%Sender)))
{
    $out = sprintf("<FONT COLOR=\"#FF0000\">Name:</FONT> %s<BR>\n", &color($Name{$key}));
    print $out;
    $out = sprintf("<FONT COLOR=\"#FF0000\">Code Base:</FONT> %s<BR>\n", &color($Base{$key}));
    print $out;
    ($newadd)=split(' ', $Address{$key});
    $out = sprintf("<FONT COLOR=\"#FF0000\">Telnet:</FONT> <A HREF=\"telnet://%s:%s\">%s port %s</A>\n", &nocolor($newadd), $Port{$key}, &nocolor($Address{$key}), $Port{$key});
    print $out;
    if (&nocolor($WWW{$key}) =~ /\./)
    {
	$out = sprintf("<BR>\n<FONT COLOR=\"#FF0000\">WWW:</FONT> <A HREF=\"%s\">%s</A>\n", &nocolor($WWW{$key}), &nocolor($WWW{$key}));
	print $out;
    }
    print "<P><HR><P>\n";
}

print "</FONT>\n";
print "Return to <A HREF=\"http://www.rot.com/rot\">Realms of Thoth</A> home page.<BR>\n";
print "</BODY>\n</HTML>\n";
exit;

sub nocolor {
        local($name,$outname);
        $name = $_[0];
        undef @orig;
        @orig = split(//, $name);
        $count = @orig;
        push(@orig, " ");
        $outname = "";
        $fonts = 0;
        for ($b = 0; $b < $count; $b++) {
            $tmp = "$orig[$b]$orig[$b+1]";
            $tmp2 = $orig[$b];
            if ($tmp eq "{{"){
                $tmp2 = "{";
                $b++;
            } elsif ($tmp2 eq "{") {
                $tmp2 = "";
                $b++;
            }
            $tmp3 = "${outname}${tmp2}";
            $outname = $tmp3;
        }
        return $outname;
}


sub color {
	local($name,$outname);
	$name = $_[0];
	undef @orig;
	@orig = split(//, $name);
	$count = @orig;
	push(@orig, " ");
	$outname = "";
	$fonts = 0;
	for ($b = 0; $b < $count; $b++) {
	    $tmp = "$orig[$b]$orig[$b+1]";
	    $tmp2 = $orig[$b];
	    if ($tmp eq "{z") {
		if ($fonts == 0) {
		    $tmp2 = "<FONT COLOR=\"#000000\">";
		    $fonts = 1;
		} else {
		    $tmp2 = "</FONT><FONT COLOR=\"#000000\">";
		    $fonts = 1;
		}
		$b++;
	    } elsif (($tmp eq "{b")||($tmp eq "{4")){
		if ($fonts == 0) {
		    $tmp2 = "<FONT COLOR=\"#000099\">";
		    $fonts = 1;
		} else {
		    $tmp2 = "</FONT><FONT COLOR=\"#000099\">";
		    $fonts = 1;
		}
		$b++;
	    } elsif (($tmp eq "{c")||($tmp eq "{6")){
		if ($fonts == 0) {
		    $tmp2 = "<FONT COLOR=\"#009999\">";
		    $fonts = 1;
		} else {
		    $tmp2 = "</FONT><FONT COLOR=\"#009999\">";
		    $fonts = 1;
		}
		$b++;
	    } elsif (($tmp eq "{g")||($tmp eq "{2")){
		if ($fonts == 0) {
		    $tmp2 = "<FONT COLOR=\"#009900\">";
		    $fonts = 1;
		} else {
		    $tmp2 = "</FONT><FONT COLOR=\"#009900\">";
		    $fonts = 1;
		}
		$b++;
	    } elsif (($tmp eq "{m")||($tmp eq "{5")){
		if ($fonts == 0) {
		    $tmp2 = "<FONT COLOR=\"#990099\">";
		    $fonts = 1;
		} else {
		    $tmp2 = "</FONT><FONT COLOR=\"#990099\">";
		    $fonts = 1;
		}
		$b++;
	    } elsif (($tmp eq "{r")||($tmp eq "{1")){
		if ($fonts == 0) {
		    $tmp2 = "<FONT COLOR=\"#990000\">";
		    $fonts = 1;
		} else {
		    $tmp2 = "</FONT><FONT COLOR=\"#990000\">";
		    $fonts = 1;
		}
		$b++;
	    } elsif (($tmp eq "{w")||($tmp eq "{7")){
		if ($fonts == 0) {
		    $tmp2 = "<FONT COLOR=\"#CCCCCC\">";
		    $fonts = 1;
		} else {
		    $tmp2 = "</FONT><FONT COLOR=\"#CCCCCC\">";
		    $fonts = 1;
		}
		$b++;
	    } elsif (($tmp eq "{y")||($tmp eq "{3")){
		if ($fonts == 0) {
		    $tmp2 = "<FONT COLOR=\"#999900\">";
		    $fonts = 1;
		} else {
		    $tmp2 = "</FONT><FONT COLOR=\"#999900\">";
		    $fonts = 1;
		}
		$b++;
	    } elsif (($tmp eq "{B")||($tmp eq "{\$")){
		if ($fonts == 0) {
		    $tmp2 = "<FONT COLOR=\"#0000FF\">";
		    $fonts = 1;
		} else {
		    $tmp2 = "</FONT><FONT COLOR=\"#0000FF\">";
		    $fonts = 1;
		}
		$b++;
	    } elsif (($tmp eq "{C")||($tmp eq "{^")){
		if ($fonts == 0) {
		    $tmp2 = "<FONT COLOR=\"#00FFFF\">";
		    $fonts = 1;
		} else {
		    $tmp2 = "</FONT><FONT COLOR=\"#00FFFF\">";
		    $fonts = 1;
		}
		$b++;
	    } elsif (($tmp eq "{G")||($tmp eq "{@")){
		if ($fonts == 0) {
		    $tmp2 = "<FONT COLOR=\"#00FF00\">";
		    $fonts = 1;
		} else {
		    $tmp2 = "</FONT><FONT COLOR=\"#00FF00\">";
		    $fonts = 1;
		}
		$b++;
	    } elsif (($tmp eq "{M")||($tmp eq "{%")||($tmp eq "{-")){
		if ($fonts == 0) {
		    $tmp2 = "<FONT COLOR=\"#FF00FF\">";
		    $fonts = 1;
		} else {
		    $tmp2 = "</FONT><FONT COLOR=\"#FF00FF\">";
		    $fonts = 1;
		}
		$b++;
	    } elsif (($tmp eq "{R")||($tmp eq "{!")){
		if ($fonts == 0) {
		    $tmp2 = "<FONT COLOR=\"#FF0000\">";
		    $fonts = 1;
		} else {
		    $tmp2 = "</FONT><FONT COLOR=\"#FF0000\">";
		    $fonts = 1;
		}
		$b++;
	    } elsif (($tmp eq "{W")||($tmp eq "{&")){
		if ($fonts == 0) {
		    $tmp2 = "<FONT COLOR=\"#FFFFFF\">";
		    $fonts = 1;
		} else {
		    $tmp2 = "</FONT><FONT COLOR=\"#FFFFFF\">";
		    $fonts = 1;
		}
		$b++;
	    } elsif (($tmp eq "{Y")||($tmp eq "{#")){
		if ($fonts == 0) {
		    $tmp2 = "<FONT COLOR=\"#FFFF00\">";
		    $fonts = 1;
		} else {
		    $tmp2 = "</FONT><FONT COLOR=\"#FFFF00\">";
		    $fonts = 1;
		}
		$b++;
	    } elsif (($tmp eq "{D")||($tmp eq "{8")||($tmp eq "{*")){
		if ($fonts == 0) {
		    $tmp2 = "<FONT COLOR=\"#666666\">";
		    $fonts = 1;
		} else {
		    $tmp2 = "</FONT><FONT COLOR=\"#666666\">";
		    $fonts = 1;
		}
		$b++;
	    } elsif ($tmp eq "{{"){
		$tmp2 = "{";
		$b++;
	    } elsif (($tmp eq "{x")||($tmp eq "{X")||($tmp eq "{0")){
		if ($fonts == 1) {
		    $tmp2 = "</FONT>";
		    $fonts = 0;
		} else {
		    $tmp2 = "";
		}
		$b++;
	    } elsif ($tmp2 eq "{") {
                if ($fonts == 1) {
                    $tmp2 = "</FONT>";
                    $fonts = 0;
                } else {
                    $tmp2 = "";
                }
                $b++;
	    }
	    $tmp3 = "${outname}${tmp2}";
	    $outname = $tmp3;
	}
	return $outname;
}

sub bynum { $a <=> $b; }