Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

WormbotHandler3SPNv3.WIR_GameHandler_AMv3


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
/******************************************************************************
Copyright (c) 2005-2007 by Wormbo <wormbo@online.de>
$Id$

Handler for Arena Master.
******************************************************************************/


class WIR_GameHandler_AMv3 extends WIR_GameHandler_TAMv3;


//== AddRow ==================================================================
/**
Adds data in a row on the left or right side of the scoreboard table.
*/
//=============================================================================

function AddRow(out array<WIR_Util.TAlignedTable> Table, int row, PlayerReplicationInfo PRI, bool bRightSide)
{
  local int col, coloffset;
  
  if ( bRightSide )
    coloffset = (Table.Length + 1) / 2;
  
  if ( Table[col+coloffset].Rows.Length <= row )
    Table[col+coloffset].Rows.Length = row + 1;
  Table[col+coloffset].Rows[row].Content = Repl(FormatPlayerName(PRI, True), "[^B]", "", True); // strip code for bold
  ++col;
  
  if ( Table[col+coloffset].Rows.Length <= row )
    Table[col+coloffset].Rows.Length = row + 1;
  Table[col+coloffset].Rows[row].Content = string(int(PRI.GetPropertyText("RoundsWon")));
  ++col;
  
  if ( Table[col+coloffset].Rows.Length <= row )
    Table[col+coloffset].Rows.Length = row + 1;
  Table[col+coloffset].Rows[row].Content = string(int(PRI.Score % 10000));
  ++col;
  
  if ( Table[col+coloffset].Rows.Length <= row )
    Table[col+coloffset].Rows.Length = row + 1;
  Table[col+coloffset].Rows[row].Content = int(PRI.GetPropertyText("AveragePercent")) $ "%";
  ++col;
  
  if ( Table[col+coloffset].Rows.Length <= row )
    Table[col+coloffset].Rows.Length = row + 1;
  Table[col+coloffset].Rows[row].Content = string(int(PRI.GetPropertyText("EnemyDamage")));
  ++col;
}


//== InOrder ==================================================================
/**
Returns True if player 1 ranks higher than player 2.
*/
//=============================================================================

function bool InOrder(PlayerReplicationInfo PRI1, PlayerReplicationInfo PRI2)
{
  if ( PRI1 == None || PRI2 == None )
    return PRI1 != None;
  
  if ( PRI1.Score % 10000 > PRI2.Score % 10000 )
    return true;
  if ( PRI1.Score % 10000 < PRI2.Score % 10000 )
    return false;
  
  if ( PRI1.Score > PRI2.Score )
    return true;
  if ( PRI1.Score < PRI2.Score )
    return false;
  
  if ( PRI1.Deaths < PRI2.Deaths )
    return true;
  if ( PRI1.Deaths > PRI2.Deaths )
    return false;
  
  return PRI1.PlayerName > PRI2.PlayerName;
}


//== FormatPlayerName =========================================================
/**
Returns a formatted player name for IRC.
*/
//============================================================================= 

function string FormatPlayerName(Actor Player, optional bool bOnlyName, optional string StringScoreTemplate, optional out string CustomPrefix)
{
  local PlayerReplicationInfo PRI;
  local Controller C;
  local Pawn P;
  
  class'WIR_Util'.static.GetPlayerActors(Player, C, P, PRI);
  
  StringScoreTemplate = Repl(StringScoreTemplate, "[score]", string(int(PRI.Score % 10000)));
  StringScoreTemplate = Repl(StringScoreTemplate, "[roundswon]", string(int(PRI.Score / 10000)));
  return Super.FormatPlayerName(Player, bOnlyName, StringScoreTemplate, CustomPrefix);
}


//=============================================================================
// Default properties
//=============================================================================

defaultproperties
{
  StringTableHeader(0)  = "[^U]Name"
  StringTableHeader(1)  = "Wins"
  StringTableHeader(2)  = "Score"
  StringTableHeader(3)  = "Acc."
  StringTableHeader(4)  = "Dam.[^O]"
  StringTableHeader(5)  = " "
  StringTableHeader(6)  = "[^U]Name"
  StringTableHeader(7)  = "Wins"
  StringTableHeader(8)  = "Score"
  StringTableHeader(9)  = "Acc."
  StringTableHeader(10) = "Dam.[^O]"
  
  ColumnAlign(0)  = TXTA_Left
  ColumnAlign(1)  = TXTA_Right
  ColumnAlign(2)  = TXTA_Right
  ColumnAlign(3)  = TXTA_Right
  ColumnAlign(4)  = TXTA_Right
  ColumnAlign(5)  = TXTA_Center
  ColumnAlign(6)  = TXTA_Left
  ColumnAlign(7)  = TXTA_Right
  ColumnAlign(8)  = TXTA_Right
  ColumnAlign(9)  = TXTA_Right
  ColumnAlign(10) = TXTA_Right
  
  HandlerGroup = "Wormbot (AMv3)"
  StringScoreTemplate = "[roundswon]/[score]/[EnemyDamage]/[ping]ms"
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Mo 12.3.2007 10:46:18.000 - Creation time: Do 14.8.2014 09:58:55.487 - Created with UnCodeX