예제 #1
0
 public ModOptions()
 {
     if (instance == null)
     {
         instance = this;
         LoadOptions();
         SetupPrimaryWeapons();
     }
 }
예제 #2
0
        public void LoadOptions()
        {
            ModOptions loadedOptions = PersistenceHandler.LoadFromFile <ModOptions>("ModOptions");

            if (loadedOptions != null)
            {
                //get the loaded options
                this.msAutoSaveInterval = loadedOptions.msAutoSaveInterval;

                this.gangMemberAggressiveness = loadedOptions.gangMemberAggressiveness;

                this.addToGroupKey   = loadedOptions.addToGroupKey;
                this.mindControlKey  = loadedOptions.mindControlKey;
                this.openGangMenuKey = loadedOptions.openGangMenuKey;
                this.openZoneMenuKey = loadedOptions.openZoneMenuKey;

                this.possibleGangFirstNames     = loadedOptions.possibleGangFirstNames;
                this.possibleGangLastNames      = loadedOptions.possibleGangLastNames;
                this.buyableWeapons             = loadedOptions.buyableWeapons;
                this.similarColors              = loadedOptions.similarColors;
                this.extraPlayerExclusiveColors = loadedOptions.extraPlayerExclusiveColors;

                this.startingGangMemberHealth = loadedOptions.startingGangMemberHealth;
                this.maxGangMemberHealth      = loadedOptions.maxGangMemberHealth;
                this.maxGangMemberArmor       = loadedOptions.maxGangMemberArmor;
                this.maxGangMemberAccuracy    = loadedOptions.maxGangMemberAccuracy;

                this.emptyZoneDuringWar = loadedOptions.emptyZoneDuringWar;
                this.maxDistToWarBlipBeforePlayerLeavesWar = loadedOptions.maxDistToWarBlipBeforePlayerLeavesWar;
                this.ticksBeforeWarEndWithPlayerAway       = loadedOptions.ticksBeforeWarEndWithPlayerAway;
                this.postWarBackupsAmount              = loadedOptions.postWarBackupsAmount;
                this.baseNumKillsBeforeWarVictory      = loadedOptions.baseNumKillsBeforeWarVictory;
                this.extraKillsPerTurfValue            = loadedOptions.extraKillsPerTurfValue;
                this.killsBetweenEnemySpawnReplacement = loadedOptions.killsBetweenEnemySpawnReplacement;
                this.ticksBetweenEnemySpawnReplacement = loadedOptions.ticksBetweenEnemySpawnReplacement;

                this.msTimeBetweenTurfRewards            = loadedOptions.msTimeBetweenTurfRewards;
                this.ticksBetweenGangAIUpdates           = loadedOptions.ticksBetweenGangAIUpdates;
                this.minMsTimeBetweenAttacksOnPlayerTurf = loadedOptions.minMsTimeBetweenAttacksOnPlayerTurf;
                this.ticksBetweenGangMemberAIUpdates     = loadedOptions.ticksBetweenGangMemberAIUpdates;
                this.baseRewardPerZoneOwned = loadedOptions.baseRewardPerZoneOwned;
                this.maxRewardPerZoneOwned  = loadedOptions.maxRewardPerZoneOwned;
                this.maxTurfValue           = loadedOptions.maxTurfValue;

                this.rewardMultiplierPerZone = loadedOptions.rewardMultiplierPerZone;

                this.baseCostToTakeTurf       = loadedOptions.baseCostToTakeTurf;
                this.rewardForTakingEnemyTurf = loadedOptions.rewardForTakingEnemyTurf;

                this.baseCostToUpgradeGeneralGangTurfValue = loadedOptions.baseCostToUpgradeGeneralGangTurfValue;
                this.baseCostToUpgradeSingleTurfValue      = loadedOptions.baseCostToUpgradeSingleTurfValue;
                this.baseCostToUpgradeArmor    = loadedOptions.baseCostToUpgradeArmor;
                this.baseCostToUpgradeHealth   = loadedOptions.baseCostToUpgradeHealth;
                this.baseCostToUpgradeAccuracy = loadedOptions.baseCostToUpgradeAccuracy;

                this.wanderingDriverDrivingStyle       = loadedOptions.wanderingDriverDrivingStyle;
                this.driverWithDestinationDrivingStyle = loadedOptions.driverWithDestinationDrivingStyle;

                this.numUpgradesUntilMaxMemberAttribute = loadedOptions.numUpgradesUntilMaxMemberAttribute;
                this.costToCallBackupCar            = loadedOptions.costToCallBackupCar;
                this.costToCallParachutingMember    = loadedOptions.costToCallParachutingMember;
                this.ticksCooldownBackupCar         = loadedOptions.ticksCooldownBackupCar;
                this.ticksCooldownParachutingMember = loadedOptions.ticksCooldownParachutingMember;

                this.minWantedFactorWhenInGangTurf = loadedOptions.minWantedFactorWhenInGangTurf;
                this.maxWantedLevelInMaxedGangTurf = loadedOptions.maxWantedLevelInMaxedGangTurf;
                this.freezeWantedLevelDuringWars   = loadedOptions.freezeWantedLevelDuringWars;

                this.notificationsEnabled      = loadedOptions.notificationsEnabled;
                this.loggerLevel               = loadedOptions.loggerLevel;
                this.preventAIExpansion        = loadedOptions.preventAIExpansion;
                this.membersSpawnWithMeleeOnly = loadedOptions.membersSpawnWithMeleeOnly;
                this.warAgainstPlayerEnabled   = loadedOptions.warAgainstPlayerEnabled;
                this.ambientSpawningEnabled    = loadedOptions.ambientSpawningEnabled;
                this.forceSpawnCars            = loadedOptions.forceSpawnCars;
                this.joypadControls            = loadedOptions.joypadControls;

                this.showGangMemberBlips = loadedOptions.showGangMemberBlips;

                this.gangsStartWithPistols               = loadedOptions.gangsStartWithPistols;
                this.gangsCanBeWipedOut                  = loadedOptions.gangsCanBeWipedOut;
                this.maxCoexistingGangs                  = loadedOptions.maxCoexistingGangs;
                this.extraProfitForAIGangsFactor         = loadedOptions.extraProfitForAIGangsFactor;
                this.spawnedMembersBeforeAmbientGenStops = loadedOptions.spawnedMembersBeforeAmbientGenStops;
                this.msBaseIntervalBetweenAmbientSpawns  = loadedOptions.msBaseIntervalBetweenAmbientSpawns;
                this.spawnedMemberLimit                  = loadedOptions.spawnedMemberLimit;
                this.numSpawnsReservedForCarsDuringWars  = loadedOptions.numSpawnsReservedForCarsDuringWars;
                this.minDistanceCarSpawnFromPlayer       = loadedOptions.minDistanceCarSpawnFromPlayer;
                this.minDistanceMemberSpawnFromPlayer    = loadedOptions.minDistanceMemberSpawnFromPlayer;
                this.maxDistanceCarSpawnFromPlayer       = loadedOptions.maxDistanceCarSpawnFromPlayer;
                this.maxDistanceMemberSpawnFromPlayer    = loadedOptions.maxDistanceMemberSpawnFromPlayer;

                if (similarColors.Count == 0)
                {
                    SetColorTranslationDefaultValues();
                }
                else
                {
                    if (similarColors[0].blipColors == null)
                    {
                        SetColorTranslationDefaultValues();
                    }
                }

                SaveOptions();
            }
            else
            {
                SetAllValuesToDefault();
                SetNameListsDefaultValues();
                SetColorTranslationDefaultValues();
                PersistenceHandler.SaveToFile(this, "ModOptions");
            }
        }