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

DruidsRPGcvs.ScoreFix


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
class ScoreFix extends Mutator
      config(ScoreFix);

struct ScoreConfig
{
    var String GameType;
    var int EXPForWin;
    var bool IronMan;
    var float MonsterScoreMultiplier;
    var float LevelDiffExpGainDiv;
    var float WeaponModifierChance;
};

var RPGRules rules;
var config Array<ScoreConfig> ScoreConfigs;
var int gameType;

function PreBeginPlay()
{
    setup();
    if(rules != None)
        Log("Warning: Looks like ScoreFix was loaded before RPG. Magic Weapon Settings might not take effect.");
    
    class'MutUT2004RPG'.default.LevelDiffExpGainDiv = ScoreConfigs[gameType].LevelDiffExpGainDiv;
    class'MutUT2004RPG'.default.EXPForWin=ScoreConfigs[gameType].EXPForWin;
    class'MutUT2004RPG'.default.bIronmanMode=ScoreConfigs[gameType].IronMan;
    class'MutUT2004RPG'.default.WeaponModifierChance=ScoreConfigs[gameType].WeaponModifierChance;
    if(ScoreConfigs[gameType].WeaponModifierChance == 0)
        class'MutUT2004RPG'.default.bMagicalStartingWeapons = False;
    else
        class'MutUT2004RPG'.default.bMagicalStartingWeapons = True;

    class'MutUT2004RPG'.static.StaticSaveConfig();
}

function PostBeginPlay()
{
    setup();
}

function bool CheckReplacement (Actor Other, out byte bSuperRelevant)
{
    local Monster m;
    local int score;

    setup();

    if(Other != None && Other.isA('Monster'))
    {
        m = Monster(Other);
        score = int(float(m.getPropertyText("ScoringValue")) *  ScoreConfigs[gameType].MonsterScoreMultiplier);
        if(score == 0 && ScoreConfigs[gameType].MonsterScoreMultiplier > 0)
            score = 1;
        m.ScoringValue = score;
    }
    return(super.CheckReplacement(Other, bSuperRelevant));
}

function setup()
{
    local int x;
    local GameRules G;

    if(rules != None)
        return; //already initialized

    for(x = 0; x < ScoreConfigs.Length; x++)
    {
        if(string(Level.Game.class) == ScoreConfigs[x].GameType)
            break;
    }
    if(x == ScoreConfigs.Length)
    {
        x = 0; //When in doubt, use the default
        Log("Game type" @ Level.Game.class @ "was not in the list of score fix game types Using the default of" @ ScoreConfigs[0].GameType @ "instead.");
    }
    gameType = x;

    Log("ScoreFix for Game type" @ ScoreConfigs[gameType].GameType @ "selected.");

    if ( Level.Game.GameRulesModifiers == None )
        return; //we'll try again later.
    else
    {
        for(G = Level.Game.GameRulesModifiers; G != None; G = G.NextGameRules)
        {
            if(G.isA('RPGRules'))
                break;
            if(G.NextGameRules == None)
                return; //we'll try again later
        }
    }
    rules = RPGRules(G);

    rules.LevelDiffExpGainDiv = ScoreConfigs[gameType].LevelDiffExpGainDiv;
    rules.RPGMut.LevelDiffExpGainDiv = ScoreConfigs[gameType].LevelDiffExpGainDiv;
    rules.RPGMut.default.LevelDiffExpGainDiv = ScoreConfigs[gameType].LevelDiffExpGainDiv;

    rules.RPGMut.EXPForWin=ScoreConfigs[gameType].EXPForWin;
    rules.RPGMut.default.EXPForWin=ScoreConfigs[gameType].EXPForWin;
    rules.RPGMut.bIronmanMode=ScoreConfigs[gameType].IronMan;
    rules.RPGMut.default.bIronmanMode=ScoreConfigs[gameType].IronMan;
    rules.RPGMut.WeaponModifierChance=ScoreConfigs[gameType].WeaponModifierChance;
    rules.RPGMut.default.WeaponModifierChance=ScoreConfigs[gameType].WeaponModifierChance;
    if(ScoreConfigs[gameType].WeaponModifierChance == 0)
    {
        rules.RPGMut.bMagicalStartingWeapons = False;
        rules.RPGMut.default.bMagicalStartingWeapons = False;
    }
    else
    {
        rules.RPGMut.bMagicalStartingWeapons = True;
        rules.RPGMut.default.bMagicalStartingWeapons = True;

    }
}

defaultproperties
{
     ScoreConfigs(0)=(GameType="Default",LevelDiffExpGainDiv=1000.000000)
     ScoreConfigs(1)=(GameType="XGame.xDeathMatch",EXPForWin=20,MonsterScoreMultiplier=0.250000,LevelDiffExpGainDiv=100.000000,WeaponModifierChance=0.333333)
     ScoreConfigs(2)=(GameType="XGame.xTeamGame",EXPForWin=30,MonsterScoreMultiplier=0.250000,LevelDiffExpGainDiv=100.000000,WeaponModifierChance=0.333333)
     ScoreConfigs(3)=(GameType="XGame.xCTFGame",EXPForWin=30,MonsterScoreMultiplier=0.050000,LevelDiffExpGainDiv=100.000000,WeaponModifierChance=0.333333)
     ScoreConfigs(4)=(GameType="XGame.xDoubleDom",EXPForWin=30,MonsterScoreMultiplier=0.050000,LevelDiffExpGainDiv=100.000000,WeaponModifierChance=0.333333)
     ScoreConfigs(5)=(GameType="XGame.xBombingRun",EXPForWin=30,MonsterScoreMultiplier=0.050000,LevelDiffExpGainDiv=100.000000,WeaponModifierChance=0.333333)
     ScoreConfigs(6)=(GameType="XGame.xVehicleCTFGame",EXPForWin=30,MonsterScoreMultiplier=0.050000,LevelDiffExpGainDiv=100.000000,WeaponModifierChance=0.333333)
     ScoreConfigs(7)=(GameType="BonusPack.xMutantGame",EXPForWin=40,MonsterScoreMultiplier=0.050000,LevelDiffExpGainDiv=100.000000,WeaponModifierChance=0.333333)
     ScoreConfigs(8)=(GameType="BonusPack.xLastManStandingGame",EXPForWin=30,MonsterScoreMultiplier=0.500000,LevelDiffExpGainDiv=100.000000,WeaponModifierChance=0.333333)
     ScoreConfigs(9)=(GameType="SkaarjPack.Invasion",EXPForWin=80,MonsterScoreMultiplier=1.000000,LevelDiffExpGainDiv=100.000000,WeaponModifierChance=0.333333)
     ScoreConfigs(10)=(GameType="UT2K4Assault.ASGameInfo",EXPForWin=30,MonsterScoreMultiplier=0.050000,LevelDiffExpGainDiv=100.000000,WeaponModifierChance=0.333333)
     ScoreConfigs(11)=(GameType="Onslaught.ONSOnslaughtGame",EXPForWin=30,MonsterScoreMultiplier=0.050000,LevelDiffExpGainDiv=100.000000,WeaponModifierChance=0.333333)
     GroupName="ScoreFix"
     FriendlyName="Score Fix"
     Description="Changes scoring and RPG Points for various game types."
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Sat 4/6/2005 13:56:00.000 - Creation time: Wed 7/2/2007 19:16:50.953 - Created with UnCodeX