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

JBAddonProtection.JBAddonProtection


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
// ============================================================================
// JBAddonProtection
// Copyright 2003 by Christophe "Crokx" Cros <crokx@beyondunreal.com>
// $Id: JBAddonProtection.uc,v 1.15 2007-05-12 22:48:50 wormbo Exp $
//
// This add-on protects players released from jail.
// ============================================================================


class JBAddonProtection extends JBAddon config cacheexempt;


//=============================================================================
// Constants
//=============================================================================

//const DEFAULT_PROTECTION_TIME = 3;
//const DEFAULT_PROTECTION_TYPE = 1;
//const DEFAULT_PROTECT_ARENA   = True;
//const DEFAULT_LLAMAIZE_CAMPERS= True;


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

var() const editconst string Build;
var() config int  ProtectionTime;      // how long protection lasts for
var() config byte ProtectionType;       // 0: can't damage while protected
                                        // 1: protection drops when damage done
var() config bool bProtectArenaWinner;  // protect the arena winner
var() config bool bLlamaizeCampers;     // if killing damage to protectee

var PlayerReplicationInfo LastRestartedPRI;
var localized string caption_ProtectionType;
var localized string caption_ProtectionTime;
var localized string caption_ProtectArenaWinner;
var localized string caption_LlamaizeCampers;

var localized string desc_ProtectionType;
var localized string desc_ProtectionTime;
var localized string desc_ProtectArenaWinner;
var localized string desc_LlamaizeCampers;

var localized string options_ProtectionType;


// ============================================================================
// PostBeginPlay
//
// Spawn and register the additional rules.
// ============================================================================

function PostBeginPlay()
{
    local JBGameRulesProtection ProtectionRules;

    Super.PostBeginPlay();

    ProtectionRules = Spawn(class'JBGameRulesProtection');
    if(ProtectionRules != None)
    {
        ProtectionRules.MyAddon = SELF;
        if(Level.Game.GameRulesModifiers == None)
            Level.Game.GameRulesModifiers = ProtectionRules;
        else Level.Game.GameRulesModifiers.AddGameRules(ProtectionRules);
    }
    else
    {
        LOG("!!!!!"@name$".PostBeginPlay() : Fail to spawn JBGameRulesProtection !!!!!");
        Destroy();
    }
}


// ============================================================================
// ModifyPlayer
//
// When a player restart, save his PRI.
// ============================================================================

function ModifyPlayer(Pawn P)
{
    LastRestartedPRI = P.PlayerReplicationInfo;

    Super.ModifyPlayer(P);
}


// ============================================================================
// FillPlayInfo
//
// Adds configurable addon properties to the web admin interface.
// ============================================================================

static function FillPlayInfo(PlayInfo PlayInfo)
{
    PlayInfo.AddClass(default.class);
    PlayInfo.AddSetting(PlayInfoGroup(), "ProtectionTime", default.caption_ProtectionTime, 0, 1, "Text", "2;0:10");
    PlayInfo.AddSetting(PlayInfoGroup(), "ProtectionType", default.caption_ProtectionType, 0, 2, "Select", default.options_ProtectionType);
    PlayInfo.AddSetting(PlayInfoGroup(), "bProtectArenaWinner", default.caption_ProtectArenaWinner , 0, 3, "Check");
    PlayInfo.AddSetting(PlayInfoGroup(), "bLlamaizeCampers", default.caption_LlamaizeCampers , 0, 4, "Check");
    PlayInfo.PopClass();
}


//=============================================================================
// GetDescriptionText
//
// Returns the description text for a configurable property.
//=============================================================================

static event string GetDescriptionText(string PropName)
{
  switch (PropName) {
    case "ProtectionType":      return default.desc_ProtectionType;
    case "ProtectionTime":      return default.desc_ProtectionTime;
    case "bProtectArenaWinner": return default.desc_ProtectArenaWinner;
    case "bLlamaizeCampers":    return default.desc_LlamaizeCampers;
  }
  
  return Super.GetDescriptionText(PropName);
}


//=============================================================================
// ResetConfiguration
//
// Resets the Avenger configuration.
//=============================================================================

/*static function ResetConfiguration()
{
  default.ProtectionTime      = DEFAULT_PROTECTION_TIME;
  default.ProtectionType      = DEFAULT_PROTECTION_TYPE;
  default.bProtectArenaWinner = DEFAULT_PROTECT_ARENA;
  default.bLlamaizeCampers    = DEFAULT_LLAMAIZE_CAMPERS;
  StaticSaveConfig();
}*/


// ============================================================================
// Default properties
// ============================================================================
defaultproperties
{
    Build = "%%%%-%%-%% %%:%%";
    ProtectionTime      =3
    ProtectionType      =0
    bProtectArenaWinner =True
    bLlamaizeCampers    =True
    FriendlyName="Release Protection"
    Description="Players released from jail are protected from enemy fire."
    ConfigMenuClassName="JBAddonProtection.JBGUIPanelConfigProtection"
    caption_ProtectionTime    ="Protection time"
    caption_ProtectionType    ="Protection type"
    caption_ProtectArenaWinner="Protect the arena winner"
    caption_LlamaizeCampers   ="Make jail campers llamas"
    desc_ProtectionTime    ="Duration of protection in seconds."
    desc_ProtectionType    ="Whether your weapons do no damage while you are protected or protection is removed when you hit a player."
    desc_ProtectArenaWinner="When enabled, the arena winner gains protection."
    desc_LlamaizeCampers   ="When enabled, players causing lethal damage to protected players are made llamas."
    options_ProtectionType="0;You can't inflict damage;1;Drop when you inflict damage"
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: So 13.5.2007 00:48:50.000 - Creation time: Do 14.8.2014 09:58:41.687 - Created with UnCodeX