class newUTServerAdminSpectator extends UTServerAdminSpectator;

var bool isWindows;

function InitPlayerReplicationInfo()
{
  super.InitPlayerReplicationInfo();
  PlayerReplicationInfo.bAdmin = true;
}

function string ConvertString(string msg)
{
  local int i;
  local string tmp;
  local string result;
  local int code;

  tmp=msg;
  for(i=0; i<Len(msg); i++)
  {
    code=Asc(tmp);
    if(code>1000) code-=848;
    if(i==0) result=Chr(code);
    else result=result$Chr(code);
    tmp=Mid(tmp,1);
  }
  return result;
}

function string FormatMessage(PlayerReplicationInfo PRI, String Text, name Type)
{
  local string Message;
  local string cPlayerName;

  if(PRI!=none)
    cPlayerName=PRI.PlayerName;
  if(!isWindows) 
  {
    Text=ConvertString(Text);
    if(PRI!=none)
      cPlayerName=ConvertString(PRI.PlayerName);
  }
  if(PRI != None) 
  {
    if(Type == 'Say' && PRI == PlayerReplicationInfo)
      Message = Text;
    else if(Type == 'Say')
      Message = cPlayerName$": "$Text;
    else if(Type == 'TeamSay')
      Message = "["$cPlayerName$"]: "$Text;
    else
      Message = "("$Type$") "$Text;
  }
  else if(Type == 'Console')
    Message = "WebAdmin:"@Text;
  else
    Message = "("$Type$") "$Text;

  return Message;
}

defaultproperties
{
  isWindows=true
}