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

JBAddonSpoils.JBAddonSpoils


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
// ============================================================================
// JBAddonSpoils - original by TheForgotten
//
// Copyright 2004 by TheForgotten
//
// $Id: JBAddonSpoils.uc,v 1.3 2007-05-12 23:11:54 wormbo Exp $
//
// This add-on give a weapon to arena winner.
// ============================================================================


class JBAddonSpoils extends JBAddon config cacheexempt;


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

const DEFAULT_MAX_AMMO  = False;
const DEFAULT_CAN_THROW = False;


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

var() const editconst string Build;
var() config string SpoilsWeapon;     // type of weapon awarded
var() config bool bMaxAmmo;
var() config bool bCanThrow;


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

var localized string WeaponComboText, WeaponComboDesc;
var localized string MaxAmmoText,     MaxAmmoCheckDesc;
var localized string CanThrowText,    CanThrowCheckDesc;


// ============================================================================
// PostBeginPlay
//
// Register the additional rules.
// ============================================================================

function PostBeginPlay()
{
  local JBGameRulesSpoils SpoilsRules;

  Super.PostBeginPlay();

  SpoilsRules = Spawn(class'JBGameRulesSpoils');

  if (SpoilsRules != None)
  {
    if (Level.Game.GameRulesModifiers == None)
      Level.Game.GameRulesModifiers = SpoilsRules;
    else
      Level.Game.GameRulesModifiers.AddGameRules(SpoilsRules);
  }
  else
  {
    LOG("!!!!!"@name$".PostBeginPlay() : Fail to register the JBGameRulesSpoils !!!!!");
    Destroy();
  }
}


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

static function FillPlayInfo(PlayInfo PlayInfo)
{
  local array<CacheManager.WeaponRecord> Recs;
  local string WeaponOptions;
  local int i;

  // add current class to stack
  PlayInfo.AddClass(default.Class);

  class'CacheManager'.static.GetWeaponList(Recs);

  for (i = 0; i < Recs.Length; i++)
  {
    if (WeaponOptions != "")
      WeaponOptions $= ";";

    WeaponOptions $= Recs[i].ClassName $ ";" $ Recs[i].FriendlyName;
  }

  WeaponOptions $= ";XWeapons.SuperShockRifle;Super Shock Rifle";
  WeaponOptions $= ";XWeapons.ZoomSuperShockRifle;Zoom Super Shock Rifle";

  // now register any mutator settings
  PlayInfo.AddSetting(PlayInfoGroup(), "SpoilsWeapon", default.WeaponComboText, 0, 0, "Select", WeaponOptions);
  PlayInfo.AddSetting(PlayInfoGroup(), "bMaxAmmo",     default.MaxAmmoText,     0, 1, "Check");
  PlayInfo.AddSetting(PlayInfoGroup(), "bCanThrow",    default.CanThrowText,    0, 2, "Check");

  // remove mutator class from class stack
  PlayInfo.PopClass();
}


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

static event string GetDescriptionText(string PropName)
{
  Switch (PropName) {
    Case "SpoilsWeapon": return default.WeaponComboDesc;
    Case "bMaxAmmo":     return default.MaxAmmoCheckDesc;
    Case "bCanThrow":    return default.CanThrowCheckDesc;
  }
}


//=============================================================================
// ResetConfiguration
//
// Resets the Spoils configuration.
//=============================================================================

static function ResetConfiguration()
{
  default.SpoilsWeapon = "XWeapons.AssaultRifle";
  default.bMaxAmmo     = DEFAULT_MAX_AMMO;
  default.bCanThrow    = DEFAULT_CAN_THROW;

  StaticSaveConfig();
}


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

defaultproperties
{
  Build = "%%%%-%%-%% %%:%%"

  SpoilsWeapon = "XWeapons.AssaultRifle"

  WeaponComboText   = "Avenger weapon"
  WeaponComboDesc   = "The weapon which is awarded to the avenger."
  MaxAmmoText       = "Max out ammo"
  MaxAmmoCheckDesc  = "Maximize the ammunition of the Avenger's weapon."
  CanThrowText      = "Allow weapon drop"
  CanThrowCheckDesc = "Allow the weapon to be thrown by the Avenger or dropped when he dies."

  ConfigMenuClassName = "JBAddonSpoils.JBGUIPanelConfigSpoils"
  FriendlyName        = "Arena Spoils"
  Description         = "Rewards the winner of an Arena Match with a weapon to use against those who imprisioned him!"
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: So 13.5.2007 01:11:54.000 - Creation time: Do 14.8.2014 09:58:41.727 - Created with UnCodeX