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

WormbotHandlerJailbreak.WIR_GameHandler_Jailbreak


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
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
/******************************************************************************
Copyright (c) 2005-2007 by Wormbo <wormbo@online.de>
$Id$

Handler for Jailbreak.
******************************************************************************/


class WIR_GameHandler_Jailbreak extends WIR_GameHandler;


//=============================================================================
// Localization
//=============================================================================

var localized string MsgTeamCaptured;
var localized string MsgTeamCapturedBoth;
var localized string MsgTeamReleased;
var localized string MsgArenaMatchStarted;
var localized string MsgArenaMatchCanceled;
var localized string MsgArenaMatchEnded;
var localized string MsgArenaMatchEndedTied;

var localized string MsgLlamaStart;
var localized string MsgLlamaKilled;
var localized string MsgLlamaSuicided;
var localized string MsgLlamaDisconnect;

var localized string MsgOvertimeLockdown;

var localized string StringPrefixLlama;


//=============================================================================
// Variables
//=============================================================================

var JBAddonLlama LlamaAddon;


//== PostBeginPlay ============================================================
/**
Initialize the handler.
*/
//=============================================================================

event PostBeginPlay()
{
	Super.PostBeginPlay();

	foreach DynamicActors(class'JBAddonLlama', LlamaAddon) {
		log("Llama Hunt Add-On is available", Name);
		break;
	}
	Spawn(class'WIR_JBGameRules', Owner);
}


//== HandleKill ===============================================================
/**
Prevent suicide messages during executions.
*/
//=============================================================================

function bool HandleKill(out Controller Killer, out Controller Killed, out class<DamageType> DamageType, out string MsgSuffix)
{
	if ( Super.HandleKill(Killer, Killed, DamageType, MsgSuffix) || Level.Game.IsInState('Executing') )
		return true;

	return false;
}


//== HandleLocalizedMessage ===================================================
/**
Return True if the message should not be reported through the default event.
*/
//=============================================================================

function bool HandleLocalizedMessage(class<LocalMessage> Message, int Switch, PlayerReplicationInfo RelatedPRI_1, PlayerReplicationInfo RelatedPRI_2, Object OptionalObject)
{
	local string Msg;

	if ( MyMutator != None && MyMutator.ReportConnection != None ) {
		if ( class<JBLocalMessage>(Message) != None ) {
			switch (Switch) {
				case 100: // team captured
					Msg = Repl(MsgTeamCaptured, "%t", class'WIR_Util'.static.FormatTeamName(TeamInfo(OptionalObject), False), True);
					MyMutator.bReportScoreboard = True;
					break;

				case 200: // team released by PRI1
					Msg = Repl(MsgTeamReleased, "%t", class'WIR_Util'.static.FormatTeamName(TeamInfo(OptionalObject), False), True);
					Msg = Repl(Msg, "%p", FormatPlayerName(RelatedPRI_1, True), True);
					break;

				case 300: // both captured
					Msg = MsgTeamCapturedBoth;
					break;

				case 400: // arena match between PRI1 & 2 in OptObj started
					Msg = MsgArenaMatchStarted;
					Msg = Repl(Msg, "%p1", FormatPlayerName(RelatedPRI_1, True), True);
					Msg = Repl(Msg, "%p2", FormatPlayerName(RelatedPRI_2, True), True);
					break;

				case 410: // arena match between PRI1 & 2 in OptObj canceled
					Msg = MsgArenaMatchCanceled;
					Msg = Repl(Msg, "%p1", FormatPlayerName(RelatedPRI_1, True), True);
					Msg = Repl(Msg, "%p2", FormatPlayerName(RelatedPRI_2, True), True);
					break;

				case 420: // arena match between PRI1 & 2 in OptObj tied
					Msg = MsgArenaMatchEndedTied;
					Msg = Repl(Msg, "%p1", FormatPlayerName(RelatedPRI_1, True), True);
					Msg = Repl(Msg, "%p2", FormatPlayerName(RelatedPRI_2, True), True);
					break;

				case 430: // PRI1 wins arena match vs PRI2 in OptObj
					Msg = MsgArenaMatchEnded;
					Msg = Repl(Msg, "%p", FormatPlayerName(RelatedPRI_1, True), True);
					Msg = Repl(Msg, "%o", FormatPlayerName(RelatedPRI_2, True), True);
					break;

				case 900: // game started
					break;

				case 910: // overtime
					Msg = MsgGameOvertime;
					break;

				case 920: // game ended (winner)
					break;
			}

			if ( Msg != "" )
				MyMutator.ReportConnection.SendMessage(Repl(Msg, "%r", GetRemainingTime(), True));

			return true;
		}

		if ( Message.Name == 'JBLlamaMessage' ) {
			switch (Switch) {
				case 1: // player became llama
					Msg = MsgLlamaStart;
					break;

				case 2: // llama was killed by a player
					Msg = Repl(MsgLlamaKilled, "%p", FormatPlayerName(RelatedPRI_2, True), True);
					break;

				case 3: // llama suicided
					Msg = MsgLlamaSuicided;
					break;

				case 4: // llama disconnected (not used here)
					break;
			}

			if ( Msg != "" ) {
				Msg = Repl(Msg, "%l", FormatPlayerName(RelatedPRI_1), True);
				Msg = Repl(Msg, "%r", GetRemainingTime(), True);
				MyMutator.ReportConnection.SendMessage(Msg);
			}
			return true;
		}

		if ( Message.Name == 'JBLocalMessageOvertimeLockdown' ) {
			MyMutator.ReportConnection.SendMessage(Repl(Msg, "%r", GetRemainingTime(), True));
			return true;
		}
	}
	return Super.HandleLocalizedMessage(Message, Switch, RelatedPRI_1, RelatedPRI_2, OptionalObject);
}


//== HandleEndGame ============================================================
/**
Return True if the handler wants to override the mutator's default behavior.
*/
//=============================================================================

function bool HandleEndGame(out string Reason)
{
	local string Msg;

	if ( !Super.HandleEndGame(Reason) ) {
		// handle sending the "game ended" message without displaying the scoreboard the scores
		Msg = Repl(MyMutator.MsgGameEnded, "%r", GetRemainingTime(), True);
		if ( Reason != "" )
			Msg $= Repl(MyMutator.StringMsgSuffix, "%m", Reason, True);
		MyMutator.ReportConnection.SendMessage(Msg, True);
	}
	return true;
}


//== 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;

	if ( LlamaAddon != None ) {
		class'WIR_Util'.static.GetPlayerActors(Player, C, P, PRI);

		if ( PRI != None && !PRI.bOnlySpectator && (PRI.bOutOfLives || P != None) && LlamaAddon.IsLlama(C) )
			CustomPrefix $= StringPrefixLlama;
	}
	return Super.FormatPlayerName(Player, bOnlyName, StringScoreTemplate, CustomPrefix);
}


//== 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;
	local JBTagPlayer Player;

	Player = class'JBTagPlayer'.static.FindFor(PRI);

	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.Score));
	++col;

	if ( Table[col+coloffset].Rows.Length <= row )
		Table[col+coloffset].Rows.Length = row + 1;
	Table[col+coloffset].Rows[row].Content = string(Player.ScorePartialAttack);
	++col;

	if ( Table[col+coloffset].Rows.Length <= row )
		Table[col+coloffset].Rows.Length = row + 1;
	Table[col+coloffset].Rows[row].Content = string(Player.ScorePartialDefense);
	++col;

	if ( Table[col+coloffset].Rows.Length <= row )
		Table[col+coloffset].Rows.Length = row + 1;
	Table[col+coloffset].Rows[row].Content = string(Player.ScorePartialRelease);
	++col;
}


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

defaultproperties
{
	MsgTeamCaptured         = "[^B][%r][^B] - %t [^B]was captured[^B]"
	MsgTeamCapturedBoth     = "[^B][%r] - Both teams captured - No Score.[^B]"
	MsgTeamReleased         = "[%r] - %t [^B]was released[^B] by %p[^O]"
	MsgArenaMatchStarted    = "[%r] - %p1[^O] and %p2[^O] fight for their freedom in the arena"
	MsgArenaMatchCanceled   = "[%r] - Arena match between %p1[^O] and %p2[^O] was canceled"
	MsgArenaMatchEnded      = "[%r] - %p[^O] has won the arena match - %o[^O] goes back to jail"
	MsgArenaMatchEndedTied  = "[%r] - Arena match between %p1[^O] and %p2[^O] ended with a tie"

	MsgLlamaStart       = "[%r] - The Hunt on %l[^O] has started"
	MsgLlamaKilled      = "[%r] - %l[^O] was caught by %p[^O]"
	MsgLlamaSuicided    = "[%r] - %l[^O] was busted!"

	MsgOvertimeLockdown = "[^B][%r] Overtime Lockdown - Release switches disabled![^B]"

	StringPrefixLlama = "Llama "

	StringTableHeader(0)  = "[^U]Name"
	StringTableHeader(1)  = "Score"
	StringTableHeader(2)  = "Attk."
	StringTableHeader(3)  = "Def."
	StringTableHeader(4)  = "Rel.[^O]"
	StringTableHeader(5)  = " "
	StringTableHeader(6)  = "[^U]Name"
	StringTableHeader(7)  = "Score"
	StringTableHeader(8)  = "Attk."
	StringTableHeader(9)  = "Def."
	StringTableHeader(10) = "Rel.[^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 (Jailbreak)"
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Sa 6.4.2013 10:51:56.000 - Creation time: Do 14.8.2014 09:58:55.570 - Created with UnCodeX