示例#1
0
        static ItemFreshnessConstants()
        {
            if (Api.IsClient)
            {
                return;
            }

            const double minValue     = 0.01,
                         maxValue     = 100,
                         defaultValue = 1.0;
            var key         = "FreshnessDecaySpeedMultiplier";
            var description = $@"Adjusts the speed at which the food and some other items lose their freshness.
                                 (allowed range: from {minValue:0.0###} to {maxValue:0.0###})";

            SharedFreshnessDecaySpeedMultiplier = ServerRates.Get(
                key,
                defaultValue: defaultValue,
                description);

            var clampedValue = MathHelper.Clamp(SharedFreshnessDecaySpeedMultiplier, minValue, maxValue);

            // ReSharper disable once CompareOfFloatsByEqualityOperator
            if (SharedFreshnessDecaySpeedMultiplier != clampedValue)
            {
                // incorrect value, reset to the vanilla value
                clampedValue = defaultValue;
                ServerRates.Reset(key, defaultValue, description);
            }

            SharedFreshnessDecaySpeedMultiplier = clampedValue;
        }
示例#2
0
        static ItemStackSize()
        {
            if (Api.IsClient)
            {
                return;
            }

            const string key          = "ItemStackSizeMultiplier";
            const double defaultValue = 1.0,
                         minValue     = 1.0,
                         maxValue     = 50;

            var description
                = $@"Item stack size multiplier.
                     For example, by default one slot can contain up to 250 stone.
                     You can increase this number by raising this multiplier.
                     (allowed range: from {minValue:0.0###} to {maxValue:0.0###}).";

            itemStackSizeMultiplier = ServerRates.Get(key,
                                                      defaultValue,
                                                      description);

            if (itemStackSizeMultiplier < minValue ||
                itemStackSizeMultiplier > maxValue)
            {
                itemStackSizeMultiplier = defaultValue;
                ServerRates.Reset(key,
                                  defaultValue,
                                  description);
            }

            SharedApplyRates();
            Logger.Important($"Item stack size multiplier from rates config: x{itemStackSizeMultiplier:0.##}");
        }
示例#3
0
        static MobPragmiumQueen()
        {
            var key          = "BossDifficultyPragmiumQueen";
            var defaultValue = 5.0; // by default the boss is balanced for 5 players
            var description  =
                @"Difficulty of the Pragmium Queen boss (and the amount of loot/reward).
                  The number is corresponding to the number of players necessary to kill the boss
                  with a reasonable challenge
                  (with mechs or without mechs but in T4 armor, machineguns, with Stimpacks).                  
                  You can setup this rate to make boss possible to kill
                  by a single player (set 1 or 1.5 for extra challenge and reward)
                  or any other number of players up to 10.
                  It's affecting the number of loot piles you get when the boss is killed.
                  The value range is from 1 to 10 (inclusive).";

            var requiredPlayersNumber = ServerRates.Get(key, defaultValue: defaultValue, description);

            {
                var clampedValue = MathHelper.Clamp(requiredPlayersNumber, 1, 10);
                if (clampedValue != requiredPlayersNumber)
                {
                    clampedValue = defaultValue;
                    ServerRates.Reset(key, defaultValue, description);
                }

                requiredPlayersNumber = clampedValue;
            }

            // coef range from 0.2 to 2.0
            ServerBossDifficultyCoef = requiredPlayersNumber / 5.0;

            MaxLootWinners = (int)Math.Ceiling(requiredPlayersNumber * 2);
            MaxLootWinners = Math.Max(MaxLootWinners, 5); // ensure at least 5 winners
        }
示例#4
0
        // This rate determines the LP rate between skill experience to learning points.
        // Example: with 0.01 conversion rate 100 EXP will result in 1 LP gained.
        // However, it's affected by LearningPointsGainMultiplier which is configured via server rates config.

        static TechConstants()
        {
            if (Api.IsClient)
            {
                return;
            }

            ServerLearningPointsGainMultiplier = ServerRates.Get(
                "LearningPointsGainMultiplier",
                defaultValue: Api.IsServer && ServerLocalModeHelper.IsLocalServer
                                  ? 2.0
                                  : 1.0,
                @"This rate determines the learning points rate
                  from skills experience and neural enhancer consumable item.");

            ServerSkillExperienceGainMultiplier = ServerRates.Get(
                "SkillExperienceGainMultiplier",
                defaultValue: Api.IsServer && ServerLocalModeHelper.IsLocalServer
                                  ? 2.0
                                  : 1.0,
                @"This rate determines the skill experience gain multiplier.                
                If you want to make faster or slower skill progression (and so faster LP gain as well)
                you can modify this multiplier to a higher value.");

            ServerSkillExperienceToLearningPointsConversionMultiplier = 0.01 * ServerLearningPointsGainMultiplier;

            {
                var key          = "PvP.TimeGating";
                var defaultValue = "24,72,120,168,216,216";

                var description =
                    @"This rate determines the time-gating values for Tier 3-5 technologies on PvP servers.
                  Please configure a sequence in hours for Tier 3-5 technologies in the following format:
                  T3 basic, T3 specialized, T4 basic, T4 advanced, T5 basic, T5 advanced
                  If you want to disable time-gating completely please use: 0,0,0,0,0,0";

                var currentValue = ServerRates.Get(key, defaultValue, description);

                try
                {
                    ParseTimeGating(currentValue);
                }
                catch
                {
                    Api.Logger.Error($"Incorrect format for server rate: {key} current value {currentValue}");
                    ServerRates.Reset(key, defaultValue, description);
                    currentValue = defaultValue;
                    ParseTimeGating(currentValue);
                }
示例#5
0
        static FarmingConstants()
        {
            if (Api.IsClient)
            {
                ServerFarmPlantsGrowthSpeedMultiplier = 1.0;
                SharedFarmPlantsSpoilSpeedMultiplier  = 1.0;
                return;
            }

            ServerFarmPlantsGrowthSpeedMultiplier = ServerRates.Get(
                "FarmPlantsGrowthSpeedMultiplier",
                defaultValue: 1.0,
                @"This rate determines how fast the farm plants grow.
                  (it doesn't apply to the already planted plants until harvested, watered, or fertilizer applied)");

            const double minValue     = 0.01,
                         maxValue     = 100,
                         defaultValue = 1.0;
            var key         = "FarmPlantsSpoilSpeedMultiplier";
            var description = $@"This rate determines how fast the farm plants spoil.
                                 To make plants spoil twice as slow set it 0.5, to make them spoil twice as fast set it to 2.0.
                                 (allowed range: from {minValue:0.0###} to {maxValue:0.0###})
                                 (it doesn't apply to the already planted plants until harvested, watered, or fertilizer applied)";

            SharedFarmPlantsSpoilSpeedMultiplier = ServerRates.Get(
                key,
                defaultValue: defaultValue,
                description);

            var clampedValue = MathHelper.Clamp(SharedFarmPlantsSpoilSpeedMultiplier, minValue, maxValue);

            // ReSharper disable once CompareOfFloatsByEqualityOperator
            if (SharedFarmPlantsSpoilSpeedMultiplier != clampedValue)
            {
                // incorrect value, reset to the vanilla value
                clampedValue = defaultValue;
                ServerRates.Reset(key, defaultValue, description);
            }

            SharedFarmPlantsSpoilSpeedMultiplier = clampedValue;

            Api.Logger.Important("Farm plants growth speed multiplier: "
                                 + ServerFarmPlantsGrowthSpeedMultiplier.ToString("0.###")
                                 + Environment.NewLine
                                 + "Farm plants spoil speed multiplier: "
                                 + SharedFarmPlantsSpoilSpeedMultiplier.ToString("0.###"));
        }
示例#6
0
        static FactionConstants()
        {
            if (Api.IsClient)
            {
                return;
            }

            sharedPublicFactionMembersMax
                = (ushort)MathHelper.Clamp(
                      ServerRates.Get(
                          "Faction.MembersMax.PublicFaction",
                          defaultValue: 100,
                          @"How many faction members are allowed for a public faction
                          (that anyone can join freely at any time).
                          IMPORTANT: You can set this to 0 to disable public factions altogether.
                          The value should be within 0-250 range."),
                      min: 0,
                      max: 250);

            sharedPrivateFactionMembersMax
                = (ushort)MathHelper.Clamp(
                      ServerRates.Get(
                          "Faction.MembersMax.PrivateFaction",
                          defaultValue: 10,
                          @"How many faction members are allowed for a private faction
                          (that players can join only by submitting an application or receiving an invite).
                          The value should be within 1-250 range."),
                      min: 1,
                      max: 250);

            SharedCreateFactionLearningPointsCost
                = (ushort)MathHelper.Clamp(
                      ServerRates.Get(
                          "Faction.CreateCostLearningPoints",
                          defaultValue: PveSystem.ServerIsPvE
                                          ? 100
                                          : 200,
                          @"How many learning points are required in order to create a faction.
                          The default value is 100 for PvE and 200 for PvP servers.
                          The value should be within 1-65000 range."),
                      min: 1,
                      max: 65000);

            SharedFactionJoinCooldownDuration
                = (uint)MathHelper.Clamp(
                      ServerRates.Get(
                          "Faction.JoinCooldownDuration",
                          defaultValue: 6 * 60 * 60,
                          @"Faction switch cooldown duration (in seconds).
                          Applied when leaving a faction so player cannot join or create another faction quickly.                          
                          Default value: 6 hours or 21600 seconds.
                          Min duration: 60 seconds. Max duration: 7 days (604800 seconds)."),
                      min: 60,
                      max: 7 * 24 * 60 * 60);

            SharedFactionJoinReturnBackCooldownDuration
                = (uint)MathHelper.Clamp(
                      ServerRates.Get(
                          "Faction.JoinReturnCooldownDuration",
                          defaultValue: 24 * 60 * 60,
                          @"Faction join-return cooldown duration (in seconds).
                          Applied when player attempts to join the faction back after leaving it recently.
                          Please note: this value cannot be lower than Faction.JoinCooldownDuration.
                          Default value: 24 hours or 86400 seconds.
                          Min duration: 60 seconds. Max duration: 7 days (604800 seconds)."),
                      min: 60,
                      max: 7 * 24 * 60 * 60);

            if (SharedFactionJoinReturnBackCooldownDuration < SharedFactionJoinCooldownDuration)
            {
                SharedFactionJoinReturnBackCooldownDuration = SharedFactionJoinCooldownDuration;
            }

            SharedFactionLandClaimsPerLevel
                = (float)MathHelper.Clamp(
                      ServerRates.Get(
                          "Faction.LandClaimsPerLevel",
                          defaultValue: 1.2,
                          @"Determines how many land claims each faction level provides.
                          Total number is calculated as a faction level multiplied by this rate,
                          then rounded to the nearest integer number."),
                      min: 1,
                      max: 20);

            SharedPvpAlliancesEnabled
                = ServerRates.Get(
                      "Faction.PvP.AlliancesEnabled",
                      defaultValue: 1,
                      @"Determines whether the alliances list is available for PvP servers.
                        By default PvP alliances are allowed.
                        Change to 0 to disable alliances. Please note: already existing alliance will remain.")
                  == 1;

            {
                var key = "Faction.UpgradeCostPerLevel";
                var defaultValue
                    = ServerLocalModeHelper.IsLocalServer
                          ? "100,200,350,500,700,1000,1500,2500,5000" // cheaper for local server
                          : "200,500,1000,1700,2500,3500,5000,7000,10000";
                var description =
                    @"This rate determines the faction upgrade Learning Points cost for each faction level.
                      Please note: the max faction level is 10 and the first one is received automatically,
                      so this setting contains 9 comma-separated values.";

                var currentValue = ServerRates.Get(key, defaultValue, description);

                try
                {
                    SharedFactionUpgradeCosts = ParseFactionUpgradeCosts(currentValue);
                }
                catch
                {
                    Api.Logger.Error($"Incorrect format for server rate: {key} current value {currentValue}");
                    ServerRates.Reset(key, defaultValue, description);
                    currentValue = defaultValue;
                    SharedFactionUpgradeCosts = ParseFactionUpgradeCosts(currentValue);
                }