Exemplo n.º 1
0
        public GangManager()
        {
            instance = this;

            enemyGangs = new List <GangAI>();

            //classes below are all singletons, so no need to hold their ref here
            new ModOptions();
            new SpawnManager();

            gangData = PersistenceHandler.LoadFromFile <GangData>("GangData");
            if (gangData == null)
            {
                gangData = new GangData();

                //setup initial gangs... the player's and an enemy
                CreateNewPlayerGang();

                CreateNewEnemyGang();
            }
            else
            {
                PlayerGang.AdjustStatsToModOptions();
            }

            if (gangData.gangs.Count == 1 && ModOptions.instance.maxCoexistingGangs > 1)
            {
                //we're alone.. add an enemy!
                CreateNewEnemyGang();
            }

            SetUpAllGangs();

            timeLastReward = ModCore.curGameTime;
        }
Exemplo n.º 2
0
        /// <summary>
        /// adds the gang to a xml file that contains a list of gangs that have been wiped out,
        ///  so that the player can reuse their data in the future
        /// </summary>
        /// <param name="gangToAdd"></param>
        public void AddGangToWipedOutList(Gang gangToAdd)
        {
            List <Gang> WOList = PersistenceHandler.LoadFromFile <List <Gang> >("wipedOutGangsList");

            if (WOList == null)
            {
                WOList = new List <Gang>();
            }
            WOList.Add(gangToAdd);
            PersistenceHandler.SaveToFile(WOList, "wipedOutGangsList");
        }
Exemplo n.º 3
0
        public ZoneManager()
        {
            instance = this;

            zoneData = PersistenceHandler.LoadFromFile <TurfZoneData>("TurfZoneData");
            if (zoneData == null)
            {
                zoneData = new TurfZoneData();
            }

            for (int i = 0; i < zoneData.zoneList.Count; i++)
            {
                List <AreaBlip> zoneCircleList = zoneData.zoneList[i].zoneCircles;
                for (int j = 0; j < zoneCircleList.Count; j++)
                {
                    Blip circleBlip = World.CreateBlip(zoneCircleList[j].position, zoneCircleList[j].radius);
                    circleBlip.Alpha = 50; //TODO add mod option to control alpha!
                    zoneData.zoneList[i].myCircleBlips.Add(circleBlip);
                }
            }
        }
Exemplo n.º 4
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");
            }
        }