public ConfigEntry GetEntry(string name, int order)
        {
            ConfigEntry tempEntry = new ConfigEntry(name, order);
            ConfigEntry entry = Entries.FirstOrDefault(x => x.key.Equals(tempEntry.key));

            return entry;
        }
        public void AddEntry(string name, string value, string commentString)
        {
            ConfigEntry newEntry = new ConfigEntry(name, 0, value, commentString);
            while (Entries.Contains(newEntry))
            {
                newEntry.key.order++;
            }

            Entries.Add(newEntry);
        }
        public void RemoveEntry(string name, int order)
        {
            ConfigEntry tempEntry = new ConfigEntry(name, order);
            ConfigEntry entry = Entries.FirstOrDefault(x => x.key.Equals(tempEntry.key));

            if (entry != null)
            {
                Entries.Remove(entry);
            }
        }
예제 #4
0
	public void load() {
		//Debug.Log("loading serialized data, it has " + entryNames.Length + " entries");
		// Load from serialized properties
		entries.Clear();
		ConfigEntry entry;
		for (int i = 0; i < entryNames.Length; i++) {
			entry = new ConfigEntry();
			entry.name = entryNames[i];
			entry.type = (ConfigEntry.Types)entryTypes[i];
			entry.valueString = entryValuesString[i];
			entry.valueBool = entryValuesBool[i];
			entries.Add(entry);
		}
	}
예제 #5
0
        private static void GenerateConfigPaths(JToken token, Config newConfig)
        {
            //If it has a child it might be the actual value of the
            //property so only register it if it's at the end of the
            //tree and has no child nodes
            if (token.HasValues)
            {
                //Explicitly add arrays to the config entries as well
                if (token.Type == JTokenType.Array)
                {
                    //Instantiate a new config entry
                    var entry = new ConfigEntry();

                    //Explicitly set it as being in an array
                    entry.IsInArray = true;

                    //Set the path
                    entry.Path = token.Path;

                    //Add it to the dictionary
                    newConfig.ConfigEntries.Add(entry.Path, entry);
                }

                //It has children so don't register this, register the child
                foreach (var child in token.Children())
                {
                    //Recursively continue through the child nodes until we hit an array or JValue
                    GenerateConfigPaths(child, newConfig);
                }
            }
            else
            {
                //Initialize a new config entry
                var entry = new ConfigEntry
                {
                    //Set the value (which is stored as a string and converted by the user)
                    Value = token.Value<string>(),
                    //Store the path of the entry in the entry as well so it's aware of its key
                    Path = token.Path
                };

                //Register the config entry
                newConfig.ConfigEntries.Add(token.Path, entry);
            }
        }
예제 #6
0
 internal static bool SetIfEnabled(this ConfigEntry <ToggleableFloat> entry, ref float value)
 {
     return(entry.Value.SetIfEnabled(ref value));
 }
예제 #7
0
        public void SetupConfig()
        {
            var bodyBaseDamage             = "Base Damage";
            var bodyLevelDamage            = "Level Damage";
            var skillNameDamageCoefficient = "Damage Coefficient";
            var loreOverride     = "Lore Override";
            var loreOverrideDesc = "If true, replaces the lore with the one from \"Risk of Rain 1\"";

            var localizeKey  = "Current Config Language:";
            var localizeDesc = "If you want this config to become localized:" +
                               "\n1. In-game, select your language to either: English, Spanish, Japanese, or Russian." +
                               "\n2. Close the game, and delete your config file for this mod." +
                               "\n3. Start the game.";

            var allowHitstun       = "Allow hitstun";
            var allowHitstunDesc   = "Sufficiently strong hits can temporarily stun this enemy.";
            var allowStun          = "Allow stuns";
            var allowStunDesc      = "Allow attacks like Commando's Suppressive Fire or items like Stun Grenade to stun this enemy.";
            var allowCollision     = "Enable Collision";
            var allowCollisionDesc = "Prevents the jellyfish from passing through walls.";
            var allowKnockback     = "Allow Knockback";

            var currentLanguageIsNull = Language.currentLanguage == null;

            var currentLanguage = currentLanguageIsNull ? "en" : Language.currentLanguageName;
            var realName        = currentLanguageIsNull ? "English" : Language.currentLanguage.selfName;

            var commandoSpecialLocalize = Language.GetString("COMMANDO_SPECIAL_NAME", currentLanguage);
            var stunGrenadeLocalize     = Language.GetString("ITEM_STUNCHANCEONHIT_NAME", currentLanguage);

            switch (currentLanguage)
            {
            case "es-419":
                localizeKey  = "Idioma de configuración actual:";
                localizeDesc = "Si quieres que esta configuración se localice:" +
                               "\n1. En el juego, seleccione su idioma a cualquiera: Inglés, español, japonés o ruso" +
                               "\n2. Cierra el juego, y borra tu archivo de configuración para este mod" +
                               "\n3. Inicie el juego";
                bodyBaseDamage             = "Daño de base";
                bodyLevelDamage            = "Daño por nivel";
                skillNameDamageCoefficient = "Coeficiente de daños";
                loreOverride       = "Anulación de Lore";
                loreOverrideDesc   = "Si es cierto, sustituye el lore por el de \"Risk of Rain 1\"";
                allowHitstun       = "Permitir hitstun";
                allowHitstunDesc   = "Los golpes suficientemente fuertes pueden aturdir temporalmente a este enemigo.";
                allowStun          = "Permitir aturdimiento";
                allowStunDesc      = $"Permite que ataques como el \"{commandoSpecialLocalize}\" del Comando u objetos como la \"{stunGrenadeLocalize}\" aturdan a este enemigo.";
                allowCollision     = "Permitir colisión";
                allowCollisionDesc = "Evita que la medusa atraviese las paredes.";
                allowKnockback     = "Permitir contragolpe";
                break;

            case "ja":
                localizeKey  = "現在の設定言語。";
                localizeDesc = "このコンフィグを翻訳させたい場合には" +
                               "\n1. ゲーム内では、言語を次のいずれかに選択します。英語」「スペイン語」「日本語」「ロシア語」のいずれかを選択します。" +
                               "\n2. ゲームを終了して、このMODの設定ファイルを削除してください。" +
                               "\n3. ゲームを開始する。";
                bodyBaseDamage             = "ベースダメージ";
                bodyLevelDamage            = "レベルダメージ";
                skillNameDamageCoefficient = "ダメージ係数";
                loreOverride       = "伝承の上書き";
                loreOverrideDesc   = "本当ならば、「Risk of Rain 1」に登場する伝承者と入れ替わる。";
                allowHitstun       = "ヒットスタン";
                allowHitstunDesc   = "十分に強いヒットはこの敵を一時的にスタンさせることができる。";
                allowStun          = "スタンを許可する";
                allowStunDesc      = $"コマンドーの 「{commandoSpecialLocalize}」のような攻撃や、「{stunGrenadeLocalize}」のようなアイテムで、この敵をスタンさせることができる。衝突を許可する";
                allowCollision     = "衝突を許可する";
                allowCollisionDesc = "クラゲが壁を通過するのを防ぎます。";
                allowKnockback     = "ノックバックを許可する";
                break;

            case "RU":
                localizeKey  = "Текущий язык конфигурации:";
                localizeDesc = "Если вы хотите, чтобы этот конфиг стал локализованным:" +
                               "\n1. В игре выберите язык: Английский, Испанский, Японский или Русский." +
                               "\n2. Закройте игру и удалите ваш файл конфигурации для этого мода." +
                               "\n3. Запустите игру.";
                bodyBaseDamage             = "Базовое повреждение";
                bodyLevelDamage            = "Уровневое повреждение";
                skillNameDamageCoefficient = "Коэффициент повреждения";
                loreOverride       = "Переопределение знаний";
                loreOverrideDesc   = "Если верно, заменяет историю на историю из \"Risk of Rain 1\".";
                allowHitstun       = "Разрешить оглушение ударом";
                allowHitstunDesc   = "Достаточно сильные удары могут временно оглушить этого противника.";
                allowStun          = "Разрешить оглушение";
                allowStunDesc      = $"Позволяет атакам типа \"{commandoSpecialLocalize}\" или предметам типа \"{stunGrenadeLocalize}\" оглушать этого врага.";
                allowCollision     = "Разрешить столкновение";
                allowCollisionDesc = "Предотвращает прохождение медузы сквозь стены.";
                allowKnockback     = "Разрешить отталкивание";
                break;
            }

            Config.Bind("0", localizeKey, realName, localizeDesc);
            JellyfishBaseDamage  = Config.Bind(string.Empty, bodyBaseDamage, 10f, string.Empty);
            JellyfishLevelDamage = Config.Bind(string.Empty, bodyLevelDamage, 2f, string.Empty);
            JellyfishDischargeDamageCoefficient = Config.Bind(string.Empty, skillNameDamageCoefficient, 1f, string.Empty);
            JellyfishLoreChange = Config.Bind(string.Empty, loreOverride, true, loreOverrideDesc);

            JellyfishHitstun   = Config.Bind(string.Empty, allowHitstun, false, allowHitstunDesc);
            JellyfishStun      = Config.Bind(string.Empty, allowStun, false, allowStunDesc);
            JellyfishCollision = Config.Bind(string.Empty, allowCollision, false, allowCollisionDesc);
            JellyfishKnockback = Config.Bind(string.Empty, allowKnockback, false, string.Empty);
        }
예제 #8
0
        public override GameFile[] Unpack()
        {
            this.file.BaseStream.Position = this.file.Position;
            BinaryReaderBE reader = new BinaryReaderBE(this.file.BaseStream);

            /** PART 1 **/
            // Read header
            uint numEntries   = reader.ReadUInt32();
            uint strSecOffset = reader.ReadUInt32();
            uint strSecSize   = reader.ReadUInt32();
            uint numStr       = reader.ReadUInt32();

            /** PART 2 **/
            reader.BaseStream.Position = this.file.Position + strSecOffset + strSecSize;
            if ((reader.BaseStream.Position - this.file.Position) % 0x10 != 0)
            {
                reader.BaseStream.Position += 0x10 - ((reader.BaseStream.Position - this.file.Position) % 0x10);
            }

            long part2Offset = reader.BaseStream.Position;

            // Read header
            uint signSecOffset  = reader.ReadUInt32();
            uint numNames       = reader.ReadUInt32();
            uint namesSecOffset = reader.ReadUInt32();
            uint namesSecSize   = reader.ReadUInt32();

            // Read names
            Dictionary <uint, string> entriesName = new Dictionary <uint, string>();

            for (int i = 0; i < numNames; i++)
            {
                reader.BaseStream.Position = part2Offset + 0x10 + i * 8;
                uint id = reader.ReadUInt32();

                reader.BaseStream.Position = part2Offset + namesSecOffset + reader.ReadUInt32();
                entriesName.Add(id, reader.ReadString());
            }

            // Read signature
            // Specially, the contextuality
            reader.BaseStream.Position = part2Offset + signSecOffset + 6;
            byte context = reader.ReadByte();

            /** PART 1 **/
            // At last, read config entries
            reader.BaseStream.Position = this.file.Position + 0x10;
            ConfigEntry[] entries = new ConfigEntry[numEntries];
            for (int i = 0; i < numEntries; i++)
            {
                entries[i].Id   = reader.ReadUInt32();
                entries[i].Name = entriesName[entries[i].Id];

                byte numValues = reader.ReadByte();
                reader.BaseStream.Position--;

                uint[] types = reader.ReadUInt32s(1 + (numValues + 3) / 16);
                types[0] <<= 8;        // Remove numValues data


                // Get the data
                entries[i].Data = new ConfigValue[numValues];
                long dataOffset = reader.BaseStream.Position;
                for (int j = 0; j < numValues; j++)
                {
                    reader.BaseStream.Position = dataOffset + j * 4;
                    entries[i].Data[j]         = this.GetValue(j, types, strSecOffset);
                }

                // Offset to next entry.
                reader.BaseStream.Position = dataOffset + numValues * 4;
            }

            // Write everything to a text file.
            //Stream txtStream = WriteText(entries, (context == 0));
            Stream txtStream = WriteInfo(entries);

            if (txtStream == null)
            {
                txtStream = WriteText(entries, (context == 0));
            }

            // Create the virtual file
            GameFile textFile = new GameFile(txtStream);

            textFile.Position = 0;
            textFile.Size     = txtStream.Length;
            textFile.FileName = this.file.FileName + ".txt";
            textFile.FilePath = this.file.FilePath;
            textFile.Parent   = null;

            reader = null;
            return(new GameFile[] { textFile });
        }
예제 #9
0
 private void Awake()
 {
     AutoStart        = Config.Bind(SECTION_GENERAL, "Automatic start mode", AutoStartOption.Disabled, new ConfigDescription(DESCRIPTION_AUTOSTART));
     StartFemaleMaker = Config.Bind(SECTION_HOTKEYS, "Female maker", new KeyboardShortcut(KeyCode.F));
     StartMaleMaker   = Config.Bind(SECTION_HOTKEYS, "Male maker", new KeyboardShortcut(KeyCode.M));
 }
예제 #10
0
        private void InitConfig()
        {
            ModIsEnabled = Config.Bind(
                "Settings",
                "ModEnabled",
                true,
                "Toggles whether or not the mod is enabled. If turned off while in-game, it will unhook " +
                "everything and reset the game to it's default behaviors."
                );
            ModIsEnabled.SettingChanged += ReloadHooks;

            MoneyIsShared = Config.Bind(
                "Settings",
                "MoneyShared",
                true,
                "Toggles money sharing between teammates. Every player gains money together and spends it " +
                "from one central pool of money."
                );

            WhiteItemsShared = Config.Bind(
                "Settings",
                "WhiteItemsShared",
                true,
                "Toggles item sharing for common (white color) items."
                );

            GreenItemsShared = Config.Bind(
                "Settings",
                "GreenItemsShared",
                true,
                "Toggles item sharing for rare (green color) items."
                );

            RedItemsShared = Config.Bind(
                "Settings",
                "RedItemsShared",
                true,
                "Toggles item sharing for legendary (red color) items."
                );

            EquipmentShared = Config.Bind(
                "Settings",
                "EquipmentShared",
                false,
                "Toggles item sharing for equipment."
                );

            LunarItemsShared = Config.Bind(
                "Settings",
                "LunarItemsShared",
                false,
                "Toggles item sharing for Lunar (blue color) items."
                );

            BossItemsShared = Config.Bind(
                "Settings",
                "BossItemsShared",
                true,
                "Toggles item sharing for boss (yellow color) items."
                );

            RichMessagesEnabled = Config.Bind(
                "Settings",
                "RichMessagesEnabled",
                true,
                "Toggles detailed item pickup messages with information on who picked the item up and" +
                " who all received the item."
                );

            DropBlacklistedEquipmentOnShare = Config.Bind(
                "Balance",
                "DropBlacklistedEquipmentOnShare",
                false,
                "Changes the way shared equipment handles blacklisted equipment. If true," +
                " blacklisted equipment will be dropped on the ground once a new equipment is shared" +
                ". If false, blacklisted equipment is left untouched when new equipment is shared."
                );

            RandomizeSharedPickups = Config.Bind(
                "Balance",
                "RandomizeSharedPickups",
                false,
                "When enabled each player (except the player who picked up the item) will get a randomized item of the same rarity."
                );

            LunarItemsRandomized = Config.Bind(
                "Balance",
                "LunarItemsRandomized",
                true,
                "Toggles randomizing Lunar items in RandomizeSharedPickups mode."
                );

            BossItemsRandomized = Config.Bind(
                "Balance",
                "BossItemsRandomized",
                false,
                "Toggles randomizing Boss items in RandomizeSharedPickups mode."
                );

            PrinterCauldronFixEnabled = Config.Bind(
                "Balance",
                "PrinterCauldronFix",
                true,
                "Toggles 3D printer and Cauldron item dupe fix by giving the item directly instead of" +
                " dropping it on the ground."
                );

            DeadPlayersGetItems = Config.Bind(
                "Balance",
                "DeadPlayersGetItems",
                false,
                "Toggles whether or not dead players should get copies of picked up items."
                );

            OverridePlayerScalingEnabled = Config.Bind(
                "Balance",
                "OverridePlayerScaling",
                true,
                "Toggles override of the scalar of interactables (chests, shrines, etc) that spawn in the world to your configured credit."
                );

            InteractablesCredit = Config.Bind(
                "Balance",
                "InteractablesCredit",
                1d,
                "If player scaling via this mod is enabled, the amount of players the game should think are playing in terms of chest spawns."
                );

            InteractablesOffset = Config.Bind(
                "Balance",
                "InteractablesOffset",
                0,
                "If player scaling via this mod is enabled, the offset from base scaling for interactables credit (e.g. 100 would add 100 interactables credit (not 100 interactables), can also be negative)."
                );

            OverrideBossLootScalingEnabled = Config.Bind(
                "Balance",
                "OverrideBossLootScaling",
                true,
                "Toggles override of the scalar of boss loot drops to your configured balance."
                );

            BossLootCredit = Config.Bind(
                "Balance",
                "BossLootCredit",
                1,
                "Specifies the amount of boss items dropped when the boss drop override is true."
                );

            OverrideVoidFieldLootScalingEnabled = Config.Bind(
                "Balance",
                "OverrideVoidLootScaling",
                true,
                "Toggles override of the scalar of Void Field loot drops to your configured balance."
                );

            OverrideMultiplayerCheck = Config.Bind(
                "Debug",
                "OverrideMultiplayerCheck",
                false,
                "Forces ShareSuite to think that the game is running in a multiplayer instance."
                );

            VoidFieldLootCredit = Config.Bind(
                "Balance",
                "VoidFieldLootCredit",
                1,
                "Specifies the amount of Void Fields items dropped when the Void Field scaling override is true."
                );

            SacrificeFixEnabled = Config.Bind(
                "Balance",
                "SacrificeFixEnabled",
                true,
                "Toggles the reduction in sacrifice loot drops to be balanced with shared items enabled."
                );

            MoneyScalarEnabled = Config.Bind(
                "Settings",
                "MoneyScalarEnabled",
                false,
                "Toggles the money scalar, set MoneyScalar to an amount to fine-tune the amount of gold " +
                "you recieve."
                );

            MoneyScalar = Config.Bind(
                "Settings",
                "MoneyScalar",
                1D,
                "Modifies player count used in calculations of gold earned when money sharing is on."
                );

            ItemBlacklist = Config.Bind(
                "Settings",
                "ItemBlacklist",
                "BeetleGland,TreasureCache,TitanGoldDuringTP,TPHealingNova,ArtifactKey",
                "Items (by internal name) that you do not want to share, comma separated. Please find the item \"Code Names\" at: https://github.com/risk-of-thunder/R2Wiki/wiki/Item-&-Equipment-IDs-and-Names"
                );
            ItemBlacklist.SettingChanged += (o, e) => Blacklist.Recalculate();

            EquipmentBlacklist = Config.Bind(
                "Settings",
                "EquipmentBlacklist",
                "",
                "Equipment (by internal name) that you do not want to share, comma separated. Please find the \"Code Names\"s at: https://github.com/risk-of-thunder/R2Wiki/wiki/Item-&-Equipment-IDs-and-Names"
                );
            EquipmentBlacklist.SettingChanged += (o, e) => Blacklist.Recalculate();
        }
예제 #11
0
        private void InitConfig()
        {
            ModIsEnabled = Config.Bind(
                "Settings",
                "ModEnabled",
                true,
                "Toggles whether or not the mod is enabled. If turned off while in-game, it will unhook " +
                "everything and reset the game to it's default behaviors."
                );
            ModIsEnabled.SettingChanged += ReloadHooks;

            MoneyIsShared = Config.Bind(
                "Settings",
                "MoneyShared",
                true,
                "Toggles money sharing between teammates. Every player gains money together and spends it " +
                "from one central pool of money."
                );

            WhiteItemsShared = Config.Bind(
                "Settings",
                "WhiteItemsShared",
                true,
                "Toggles item sharing for common (white color) items."
                );

            GreenItemsShared = Config.Bind(
                "Settings",
                "GreenItemsShared",
                true,
                "Toggles item sharing for rare (green color) items."
                );

            RedItemsShared = Config.Bind(
                "Settings",
                "RedItemsShared",
                true,
                "Toggles item sharing for legendary (red color) items."
                );

            EquipmentShared = Config.Bind(
                "Settings",
                "EquipmentShared",
                false,
                "Toggles item sharing for equipment."
                );

            LunarItemsShared = Config.Bind(
                "Settings",
                "LunarItemsShared",
                false,
                "Toggles item sharing for Lunar (blue color) items."
                );

            BossItemsShared = Config.Bind(
                "Settings",
                "BossItemsShared",
                true,
                "Toggles item sharing for boss (yellow color) items."
                );

            RichMessagesEnabled = Config.Bind(
                "Settings",
                "RichMessagesEnabled",
                true,
                "Toggles detailed item pickup messages with information on who picked the item up and" +
                " who all received the item."
                );

            RandomizeSharedPickups = Config.Bind(
                "Balance",
                "RandomizeSharedPickups",
                false,
                "When enabled each player (except the player who picked up the item) will get a randomized item of the same rarity."
                );

            LunarItemsRandomized = Config.Bind(
                "Balance",
                "LunarItemsRandomized",
                true,
                "Toggles randomizing Lunar items in RandomizeSharedPickups mode."
                );

            BossItemsRandomized = Config.Bind(
                "Balance",
                "BossItemsRandomized",
                false,
                "Toggles randomizing Boss items in RandomizeSharedPickups mode."
                );

            PrinterCauldronFixEnabled = Config.Bind(
                "Balance",
                "PrinterCauldronFix",
                true,
                "Toggles 3D printer and Cauldron item dupe fix by giving the item directly instead of" +
                " dropping it on the ground."
                );

            DeadPlayersGetItems = Config.Bind(
                "Balance",
                "DeadPlayersGetItems",
                false,
                "Toggles whether or not dead players should get copies of picked up items."
                );

            OverridePlayerScalingEnabled = Config.Bind(
                "Balance",
                "OverridePlayerScaling",
                true,
                "Toggles override of the scalar of interactables (chests, shrines, etc) that spawn in the world to your configured credit."
                );

            InteractablesCredit = Config.Bind(
                "Balance",
                "InteractablesCredit",
                1d,
                "If player scaling via this mod is enabled, the amount of players the game should think are playing in terms of chest spawns."
                );

            OverrideBossLootScalingEnabled = Config.Bind(
                "Balance",
                "OverrideBossLootScaling",
                true,
                "Toggles override of the scalar of boss loot drops to your configured balance."
                );

            BossLootCredit = Config.Bind(
                "Balance",
                "BossLootCredit",
                1,
                "Specifies the amount of boss items dropped when the boss drop override is true."
                );

            OverrideVoidFieldLootScalingEnabled = Config.Bind(
                "Balance",
                "OverrideVoidLootScaling",
                true,
                "Toggles override of the scalar of Void Field loot drops to your configured balance."
                );

            VoidFieldLootCredit = Config.Bind(
                "Balance",
                "VoidFieldLootCredit",
                1,
                "Specifies the amount of Void Fields items dropped when the Void Field scaling override is true."
                );

            MoneyScalarEnabled = Config.Bind(
                "Settings",
                "MoneyScalarEnabled",
                false,
                "Toggles the money scalar, set MoneyScalar to an amount to fine-tune the amount of gold " +
                "you recieve."
                );

            MoneyScalar = Config.Bind(
                "Settings",
                "MoneyScalar",
                1D,
                "Modifies player count used in calculations of gold earned when money sharing is on."
                );

            ItemBlacklist = Config.Bind(
                "Settings",
                "ItemBlacklist",
                "53,60,82,86",
                "Items (by index) that you do not want to share, comma separated. Please find the item indices at: https://github.com/risk-of-thunder/R2Wiki/wiki/Item-&-Equipment-IDs-and-Names"
                );
            ItemBlacklist.SettingChanged += (o, e) => BlackList.Recalculate();

            EquipmentBlacklist = Config.Bind(
                "Settings",
                "EquipmentBlacklist",
                "",
                "Equipment (by index) that you do not want to share, comma separated. Please find the indices at: https://github.com/risk-of-thunder/R2Wiki/wiki/Item-&-Equipment-IDs-and-Names"
                );
            EquipmentBlacklist.SettingChanged += (o, e) => BlackList.Recalculate();
        }
예제 #12
0
	public void addEntry(ConfigEntry entry) {
		entries.Add(entry);
	}
        public void SetEntryComment(string name, int order, string commentString)
        {
            ConfigEntry tempEntry = new ConfigEntry(name, order);
            ConfigEntry entry = Entries.FirstOrDefault(x => x.key.Equals(tempEntry.key));

            if (entry != null)
            {
                entry.commentString = commentString;
            }
            else
            {
                throw new InvalidOperationException("Entry not found");
            }
        }
 public void RemoveEntry(ConfigEntry entry)
 {
     Entries.Remove(entry);
 }
예제 #15
0
 protected void Start()
 {
     UseMakerLoadPreferences = Config.AddSetting("General", "useMakerPrefs", true,
                                                 "Enables partial character loading using the options in the character maker's \"Load character\" menu.");
 }
예제 #16
0
        public List<ConfigEntry> GetSpecificConfiguration(ConfigEntry request)
        {
            List<ConfigEntry> response = GetAllConfigurations ();

            return FilterConfigurationList(request, response);
        }
예제 #17
0
        public void Start()
        {
            WhiteRandomItemChance = Config.Bind(
                "Balance",
                "WhiteRandomItemChance",
                0.05f,
                GetChanceDescription("white", "white")
                );

            GreenRandomItemChance = Config.Bind(
                "Balance",
                "GreenRandomItemChance",
                0.05f,
                GetChanceDescription("green", "green")
                );

            RedRandomItemChance = Config.Bind(
                "Balance",
                "RedRandomItemChance",
                0.05f,
                GetChanceDescription("red", "red")
                );

            LunarRandomItemChance = Config.Bind(
                "Balance",
                "LunarRandomItemChance",
                0.05f,
                GetChanceDescription("lunar", "GREEN")
                );

            BossRandomItemChance = Config.Bind(
                "Balance",
                "BossRandomItemChance",
                0.05f,
                GetChanceDescription("boss", "boss")
                );

            for (int i = 0; i < (int)ItemIndex.Count; i++)
            {
                ItemIndex itemIndex  = (ItemIndex)i;
                ItemDef   definition = ItemCatalog.GetItemDef(itemIndex);

                if (
                    itemIndex.Equals(ItemIndex.ArtifactKey) ||
                    itemIndex.Equals(ItemIndex.CaptainDefenseMatrix) ||
                    itemIndex.Equals(ItemIndex.ScrapWhite) ||
                    itemIndex.Equals(ItemIndex.ScrapGreen) ||
                    itemIndex.Equals(ItemIndex.ScrapRed) ||
                    itemIndex.Equals(ItemIndex.ScrapYellow) ||
                    definition.tier.Equals(ItemTier.NoTier)
                    )
                {
                    continue;
                }

                string displayName = Language.GetString(definition.nameToken);

                PreventPickupConfigEntries[itemIndex] = Config.Bind(
                    "PreventPickup",
                    itemIndex.ToString(),
                    false,
                    $"Item index: {(int)itemIndex} | Name: {displayName} | Tier: {definition.tier}"
                    );
            }
        }
예제 #18
0
        private List<ConfigEntry> FilterConfigurationList(ConfigEntry request, List<ConfigEntry> items)
        {
            if (request.ID.HasValue)
            {
                items = (from i in items where i.ID.Value == request.ID.Value
                         select i).ToList();
            }
            else
            {
                items = (from i in items
                         where TrimAndUpper(i.Name) == TrimAndUpper(request.Name)
                         select i).ToList();
            }

            return items;
        }
예제 #19
0
 public void Awake()
 {
     focusPause = Config.Bind <bool>("Settings", "Pause when game is not focused", true, "If window you focused ojn is not the game the game will pause");
     Harmony.CreateAndPatchAll(typeof(TruePause), null);
 }
예제 #20
0
 public static void AddValue(string name, Type type, object defaultValue)
 {
     m_Entries[name] = new ConfigEntry(name, type, defaultValue);
 }
        private void InitializeSettings()
        {
            KeyCapture = Config.Bind(
                "Keyboard shortcuts", "Take UI screenshot",
                new KeyboardShortcut(KeyCode.F9),
                new ConfigDescription("Capture a simple \"as you see it\" screenshot of the game. Not affected by settings for rendered screenshots."));

            KeyCaptureAlpha = Config.Bind(
                "Keyboard shortcuts", "Take rendered screenshot",
                new KeyboardShortcut(KeyCode.F11),
                new ConfigDescription("Take a screenshot with no interface. Can be configured by other settings to increase quality and turn on transparency."));

            KeyCapture360 = Config.Bind(
                "Keyboard shortcuts",
                "Take 360 screenshot",
                new KeyboardShortcut(KeyCode.F11, KeyCode.LeftControl),
                new ConfigDescription("Captures a 360 screenshot around current camera. The created image is in equirectangular format and can be viewed by most 360 image viewers (e.g. Google Cardboard)."));

            KeyGui = Config.Bind(
                "Keyboard shortcuts", "Open settings window",
                new KeyboardShortcut(KeyCode.F11, KeyCode.LeftShift),
                new ConfigDescription("Open a quick access window with the most common settings."));

            KeyCaptureAlphaIn3D = Config.Bind(
                "Keyboard shortcuts", "Take rendered 3D screenshot",
                new KeyboardShortcut(KeyCode.F11, KeyCode.LeftAlt),
                new ConfigDescription("Capture a high quality screenshot without UI in stereoscopic 3D (2 captures for each eye in one image). These images can be viewed by crossing your eyes or any stereoscopic image viewer."));

            KeyCapture360in3D = Config.Bind(
                "Keyboard shortcuts", "Take 360 3D screenshot",
                new KeyboardShortcut(KeyCode.F11, KeyCode.LeftControl, KeyCode.LeftShift),
                new ConfigDescription("Captures a 360 screenshot around current camera in stereoscopic 3D (2 captures for each eye in one image). These images can be viewed by image viewers supporting 3D stereo format (e.g. VR Media Player - 360° Viewer)."));

            Resolution360 = Config.Bind(
                "360 Screenshots", "360 screenshot resolution",
                4096,
                new ConfigDescription("Horizontal resolution (width) of 360 degree/panorama screenshots. Decrease if you have issues. WARNING: Memory usage can get VERY high - 4096 needs around 4GB of free RAM/VRAM to create, 8192 will need much more.", new AcceptableValueList <int>(1024, 2048, 4096, 8192)));

            DownscalingRate = Config.Bind(
                "Render Settings", "Screenshot upsampling ratio",
                2,
                new ConfigDescription("Capture screenshots in a higher resolution and then downscale them to desired size. Prevents aliasing, perserves small details and gives a smoother result, but takes longer to create.", new AcceptableValueRange <int>(1, 4)));

            CardDownscalingRate = Config.Bind(
                "Render Settings", "Card image upsampling ratio",
                3,
                new ConfigDescription("Capture character card images in a higher resolution and then downscale them to desired size. Prevents aliasing, perserves small details and gives a smoother result, but takes longer to create.", new AcceptableValueRange <int>(1, 4)));

            CaptureAlpha = Config.Bind(
                "Render Settings", "Transparency in rendered screenshots",
                true,
                new ConfigDescription("Replaces background with transparency in rendered image. Works only if there are no 3D objects covering the background (e.g. the map). Works well in character creator and studio."));

            ScreenshotMessage = Config.Bind(
                "General", "Show messages on screen",
                true,
                new ConfigDescription("Whether screenshot messages will be displayed on screen. Messages will still be written to the log."));

            ResolutionAllowExtreme = Config.Bind(
                "Render Output Resolution", "Allow extreme resolutions",
                false,
                new ConfigDescription("Raise maximum rendered screenshot resolution cap to 16k. Trying to take a screenshot too high above 4k WILL CRASH YOUR GAME. ALWAYS SAVE BEFORE ATTEMPTING A SCREENSHOT AND MONITOR RAM USAGE AT ALL TIMES. Changes take effect after restarting the game."));

            ResolutionX = Config.Bind(
                "Render Output Resolution", "Horizontal",
                Screen.width,
                new ConfigDescription("Horizontal size (width) of rendered screenshots in pixels. Doesn't affect UI and 360 screenshots.", new AcceptableValueRange <int>(ScreenshotSizeMin, ScreenshotSizeMax)));

            ResolutionY = Config.Bind(
                "Render Output Resolution", "Vertical",
                Screen.height,
                new ConfigDescription("Vertical size (height) of rendered screenshots in pixels. Doesn't affect UI and 360 screenshots.", new AcceptableValueRange <int>(ScreenshotSizeMin, ScreenshotSizeMax)));

            EyeSeparation = Config.Bind(
                "3D Settings", "3D screenshot eye separation",
                0.18f,
                new ConfigDescription("Distance between the two captured stereoscopic screenshots in arbitrary units.", new AcceptableValueRange <float>(0.01f, 0.5f)));

            ImageSeparationOffset = Config.Bind(
                "3D Settings", "3D screenshot image separation offset",
                0.25f,
                new ConfigDescription("Move images in stereoscopic screenshots closer together by this percentage (discards overlapping parts). Useful for viewing with crossed eyes. Does not affect 360 stereoscopic screenshots.", new AcceptableValueRange <float>(0f, 1f)));

            UseJpg = Config.Bind(
                "JPG Settings", "Save screenshots as .jpg instead of .png",
                false,
                new ConfigDescription("Save screenshots in lower quality in return for smaller file sizes. Transparency is NOT supported in .jpg screenshots. Strongly consider not using this option if you want to share your work."));

            JpgQuality = Config.Bind(
                "3D Settings", "Quality of .jpg files",
                100,
                new ConfigDescription("Lower quality = lower file sizes. Even 100 is worse than a .png file.", new AcceptableValueRange <int>(1, 100)));

            ScreenshotNameFormat = Config.Bind(
                "General", "Screenshot filename format",
                NameFormat.NameDateType,
                new ConfigDescription("Screenshots will be saved with names of the selected format. Name stands for the current game name (CharaStudio, Koikatu, etc.)"));

            ScreenshotNameOverride = Config.Bind(
                "General", "Screenshot filename Name override",
                "",
                new ConfigDescription("Forces the Name part of the filename to always be this instead of varying depending on the name of the current game. Use \"Koikatsu\" to get the old filename behaviour.", null, "Advanced"));

            UIShotUpscale = Config.Bind(
                "UI Screenshots", "Screenshot resolution multiplier",
                1,
                new ConfigDescription("Multiplies the UI screenshot resolution from the current game resolution by this amount.\nWarning: Some elements will still be rendered at the original resolution (most notably the interface).", new AcceptableValueRange <int>(1, 8), "Advanced"));
        }
예제 #22
0
 public static void Save()
 {
     using (StreamWriter writer = new StreamWriter("Client.cfg", false))
     {
         ConfigEntry[] array = new ConfigEntry[m_Entries.Values.Count];
         m_Entries.Values.CopyTo(array, 0);
         Array.Sort(array);
         for (int i = 0; i < array.Length; i++)
         {
             ConfigEntry entry = array[i];
             writer.WriteLine("{0}={1}", entry.Name, entry.Value);
         }
     }
 }
예제 #23
0
 public void SetupConfig()
 {
     cfgModifyCharacterPosition = Config.Bind("", "Modify Character Display Positions", true, "If true, then the character positions will be modified in the lobby.");
 }
예제 #24
0
        private void updateConfig()
        {
            // this.Config.Reload(); // I do this because I saw CameraMod do it or something idk
            this.configVersion = this.Config.Bind("General.ConfigVersion", "Version", ValheimFaveServers.pluginVersion, "Compatibility for older versions of the mod. Defaults to current mod version (" + ValheimFaveServers.pluginVersion + ") on new install. Update this if you notice new settings don't take effect.").Value;
            this.configPrefix  = this.Config.Bind("General.Prefix", "Server name prefix", "! ", "Text to show before server name in browser. Defaults to ! to exploit sort order").Value;
            ConfigEntry <string> skeys = this.Config.Bind("General.ServerKeys", "Keys of enabled servers (comma separated, no spaces)", "cc", "How many servers do you want to favourite? Enter a 'key' for each. Save and launch+close Valheim to automatically generate the configuration for each, then fill them in.");

            if (skeys.Value.Trim() != "")
            {
                this.configServerKeys = skeys.Value.Split(',');
            }
            else
            {
                this.configServerKeys = new string[] { }
            };;

            this.configServers = new ValheimFaveServerData[this.configServerKeys.Length];
            int i = 0;

            foreach (string skey in this.configServerKeys)
            {
                bool error = false;
                ValheimFaveServerData vfsd = new ValheimFaveServerData();
                // key
                vfsd.Key = skey;
                // name
                ConfigEntry <string> nameEntry = this.Config.Bind("Server." + vfsd.Key + ".name", "Server name", "Comradely Conquest", "Server name to show in browser.");
                vfsd.Name = nameEntry.Value.Trim();
                // host
                ConfigEntry <string> hostEntry = this.Config.Bind("Server." + vfsd.Key + ".host", "Server host", "marxist.ca", "Hostname for the server (IPv4, IPv6, or domain names supported)");
                vfsd.Host = hostEntry.Value.Trim();

                // Is the host valid?
                bool      isDomain = false;
                bool      isIpv4   = false;
                bool      isIpv6   = false;
                IPAddress address;
                if (IPAddress.TryParse(vfsd.Host, out address))
                {
                    switch (address.AddressFamily)
                    {
                    case System.Net.Sockets.AddressFamily.InterNetwork:
                        isIpv4  = true;
                        vfsd.Ip = IPAddress.Parse(vfsd.Host).MapToIPv6();
                        break;

                    case System.Net.Sockets.AddressFamily.InterNetworkV6:
                        isIpv6  = true;
                        vfsd.Ip = IPAddress.Parse(vfsd.Host);
                        break;

                    default:
                        break;
                    }
                }
                if (!isIpv4 && !isIpv6)
                {
                    if (Uri.CheckHostName(vfsd.Host) != UriHostNameType.Unknown)
                    {
                        isDomain = true;
                        IPAddress[] ipaddress = Dns.GetHostAddresses(vfsd.Host);
                        foreach (IPAddress ip4 in ipaddress.Where(ip => ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork))
                        {
                            vfsd.Ip = ip4.MapToIPv6();
                        }
                        foreach (IPAddress ip6 in ipaddress.Where(ip => ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetworkV6))
                        {
                            vfsd.Ip = ip6;
                        }
                    }
                }
                if (!isIpv4 && !isIpv6 && !isDomain)
                {
                    this.Logger.LogError("Host for server with key '" + vfsd.Key + "' cannot be understood, please use a valid domain name or IP address");
                    error = true;
                }

                // port
                ConfigEntry <int> portEntry = this.Config.Bind("Server." + vfsd.Key + ".port", "Server port", 2456, "Server port (default 2456)");
                vfsd.Port = portEntry.Value;
                // password
                ConfigEntry <string> passEntry = this.Config.Bind("Server." + vfsd.Key + ".password", "Server password", "1917", "Prefill server password");
                vfsd.Password = passEntry.Value.Trim();
                if (!error)
                {
                    this.configServers[i] = vfsd;
                    this.Logger.LogInfo("Loaded server from config with data " + vfsd.toString());
                }
                else
                {
                    this.Logger.LogError("Did not load server from config with key '" + vfsd.Key + "', there was an error");
                }
                i++;
            }
            this.Config.Save();
        }
    }
예제 #25
0
        void InitializeConfig()
        {
            minAshlandsDist = configFile.Bind("Biomes.Ashlands", "AshlandsDistFromEdge", -4000f,
                                              "Distance from edge for ashlands to generate; negative values will generate " +
                                              "on south edge of map.");

            blackForestBiomeScaleX = configFile.Bind("Biomes.BlackForest", "BlackForestBiomeScaleX", 0.001f,
                                                     "X scale of the black forest biome; can make the biome look more \"scattered\".");

            blackForestBiomeScaleY = configFile.Bind("Biomes.BlackForest", "BlackForestBiomeScaleY", 0.001f,
                                                     "Y scale of the black forest biome; can make the biome look more \"scattered\".");

            minBlackForestNoise = configFile.Bind("Biomes.BlackForest", "MinBlackForestNoise", 0.4f,
                                                  "Minimum noise for black forest to generate in; higher number will make the biome rare or " +
                                                  "not spawn at all.");

            minBlackForestDist = configFile.Bind("Biomes.BlackForest", "MinBlackForestDist", 600f,
                                                 "Closest distance to the center of the map that black forest can generate.");

            maxBlackForestDist = configFile.Bind("Biomes.BlackForest", "MaxBlackForestDist", 6000f,
                                                 "Farthest distance from the center of the map that black forest can generate.");

            minDeepNorthDist = configFile.Bind("Biomes.DeepNorth", "DeepNorthDistFromEdge", 4000f,
                                               "Distance from edge for deep north to generate; negative values will generate " +
                                               "on south edge of map.");

            mistlandsBiomeScaleX = configFile.Bind("Biomes.Mistlands", "MistlandsBiomeScaleX", 0.001f,
                                                   "X scale of the mistlands biome; can make the biome look more \"scattered\".");

            mistlandsBiomeScaleY = configFile.Bind("Biomes.Mistlands", "MistlandsBiomeScaleY", 0.001f,
                                                   "Y scale of the mistlands biome; can make the biome look more \"scattered\".");

            minMistlandsNoise = configFile.Bind("Biomes.Mistlands", "MinMistlandsNoise", 0.5f,
                                                "Minimum noise for mistlands to generate in; higher number will make the biome rare or " +
                                                "not spawn at all.");

            minMistlandsDist = configFile.Bind("Biomes.Mistlands", "MinMistlandsDist", 6000f,
                                               "Closest distance to the center of the map that mistlands can generate.");

            maxMistlandsDist = configFile.Bind("Biomes.Mistlands", "MaxMistlandsDist", 10000f,
                                               "Farthest distance from the center of the map that mistlands can generate.");

            minMountainHeight = configFile.Bind("Biomes.Mountain", "MinMountainHeight", 0.4f,
                                                "Minimum height for mountains to spawn.");

            plainsBiomeScaleX = configFile.Bind("Biomes.Plains", "PlainsBiomeScaleX", 0.001f,
                                                "X scale of the plains biome; can make the biome look more \"scattered\".");

            plainsBiomeScaleY = configFile.Bind("Biomes.Plains", "PlainsBiomeScaleY", 0.001f,
                                                "Y scale of the plains biome; can make the biome look more \"scattered\".");

            minPlainsNoise = configFile.Bind("Biomes.Plains", "MinPlainsNoise", 0.4f,
                                             "Minimum noise for plains to generate in; higher number will make the biome rare or " +
                                             "not spawn at all.");

            minPlainsDist = configFile.Bind("Biomes.Plains", "MinPlainsDist", 3000f,
                                            "Closest distance to the center of the map that plains can generate.");

            maxPlainsDist = configFile.Bind("Biomes.Plains", "MaxPlainsDist", 8000f,
                                            "Farthest distance from the center of the map that plains can generate.");

            swampBiomeScaleX = configFile.Bind("Biomes.Swamp", "SwampBiomeScaleX", 0.001f,
                                               "X scale of the swamp biome; can make the biome look more \"scattered\".");

            swampBiomeScaleY = configFile.Bind("Biomes.Swamp", "SwampBiomeScaleY", 0.001f,
                                               "Y scale of the swamp biome; can make the biome look more \"scattered\".");

            minSwampNoise = configFile.Bind("Biomes.Swamp", "MinSwampNoise", 0.6f,
                                            "Minimum noise for swamp to generate in; higher number will make the biome rare or " +
                                            "not spawn at all.");

            minSwampDist = configFile.Bind("Biomes.Swamp", "MinSwampDist", 2000f,
                                           "Closest distance to the center of the map that swamps can generate.");

            maxSwampDist = configFile.Bind("Biomes.Swamp", "MaxSwampDist", 8000f,
                                           "Farthest distance from the center of the map that swamps can generate.");

            minSwampHeight = configFile.Bind("Biomes.Swamp", "MinSwampHeight", 0.05f,
                                             "Lowest height biomes can generate at.");

            maxSwampHeight = configFile.Bind("Biomes.Swamp", "MaxSwampHeight", 0.25f,
                                             "Highest height swamps can generate at.");

            meadowsSwitch = configFile.Bind("Switchers", "MeadowsSwitch", "meadows",
                                            "Replaces all meadows biomes with given biome.");

            blackForestSwitch = configFile.Bind("Switchers", "BlackForestSwitch", "blackforest",
                                                "Replaces all black forest biomes with given biome.");

            swampSwitch = configFile.Bind("Switchers", "SwampSwitch", "swamp",
                                          "Replaces all swamp biomes with given biome.");

            mountainSwitch = configFile.Bind("Switchers", "MountainSwitch", "mountain",
                                             "Replaces all mountain biomes with given biome.");

            plainsSwitch = configFile.Bind("Switchers", "PlainsSwitch", "plains",
                                           "Replaces all plains biomes with given biome.");

            mistlandsSwitch = configFile.Bind("Switchers", "MistlandsSwitch", "mistlands",
                                              "Replaces all mistlands biomes with given biome.");

            ashlandsSwitch = configFile.Bind("Switchers", "AshlandsSwitch", "ashlands",
                                             "Replaces all ashlands biomes with given biome.");

            deepNorthSwitch = configFile.Bind("Switchers", "DeepNorthSwitch", "deepnorth",
                                              "Replaces all deep north biomes with given biome.");


            riverMultipleMaxDistance = configFile.Bind("Rivers", "RiverNormalMaxDistance", 2000f,
                                                       "Maximum length of common rivers; lakes can have multiple rivers of this length.");

            riverExtremeMaxDistance = configFile.Bind("Rivers", "RiverAbsoluteMaxDistance", 5000f,
                                                      "Absolute maximum distance a river can be; lakes will have no more than one river of this " +
                                                      "length.");

            riverMaxHeight = configFile.Bind("Rivers", "RiverMaxHeight", 0.4f,
                                             "Maximum height of terrain that rivers can pass through.");

            riverWidthMaxUpperRange = configFile.Bind("Rivers", "RiverWidthMaxUpperRange", 100f,
                                                      "Upper range of the randomly chosen max width of a river.");

            riverWidthMaxLowerRange = configFile.Bind("Rivers", "RiverWidthMaxLowerRange", 60f,
                                                      "Lower range of the randomly chosen max width of a river.");

            riverWidthMinLowerRange = configFile.Bind("Rivers", "RiverWidthMinLowerRange", 60f,
                                                      "Lower range of the randomly chosen minimum width of a river, where the max width of the " +
                                                      "river is the upper range of the minimum width.");

            riverCurveWidth = configFile.Bind("Rivers", "RiverCurveWidth", 15f,
                                              "Size of river curve width.");

            riverWaveLength = configFile.Bind("Rivers", "RiverWaveLength", 20f,
                                              "Size of river wave length.");
        }
예제 #26
0
        public static void InitializeConfiguration(ConfigFile config)
        {
            vrModEnabled = config.Bind("General",
                                       "ModEnabled",
                                       true,
                                       "Used to toggle the mod on and off.");
            mirrorMode = config.Bind("General",
                                     "MirrorMode",
                                     "Right",
                                     new ConfigDescription("The VR mirror mode.Legal values: OpenVR, Right, Left, None. Note: OpenVR is" +
                                                           " required if you want to see the Overlay-type GUI in the mirror image. However, I've found that OpenVR" +
                                                           " mirror mode causes some issue that requires SteamVR to be restarted after closing the game, so unless you" +
                                                           " need it for some specific reason, I recommend using another mirror mode or None.",
                                                           new AcceptableValueList <string>(new string[] { "Right", "Left", "OpenVR", "None" })));
            useOverlayGui = config.Bind("General",
                                        "UseOverlayGui",
                                        true,
                                        "Whether or not to use OpenVR overlay for the GUI. This produces a" +
                                        " cleaner GUI but will only be compatible with M&K or Gamepad controls.");
            preferredHand = config.Bind("General",
                                        "PreferredHand",
                                        "Right",
                                        new ConfigDescription("Which hand do you want to use for the main laser pointer input? If" +
                                                              " only one hand is active, it will be used automatically regardless of this setting.",
                                                              new AcceptableValueList <string>(new string[] { "Right", "Left" })));
            useAmplifyOcclusion = config.Bind("Graphics",
                                              "UseAmplifyOcclusion",
                                              true,
                                              "RECOMMENDED - Determines whether or not to use the Amplify Occlusion post processing effect." +
                                              " This implements an effect similar to SSAO but with much less performance" +
                                              " cost. While you can enable SSAO and UseAmplifyOcclusion simultaneously, it is" +
                                              " not recommended. SSAO impacts performance significantly, which is bad for VR especially. Therefore" +
                                              " you should disable SSAO in the graphics settings of the game when using this.");
            overlayCurvature = config.Bind("General",
                                           "OverlayCurvature",
                                           0.25f,
                                           new ConfigDescription("The amount of curvature to use for the GUI overlay. Only used when UseOverlayGui is true. " +
                                                                 "Valid values are  0.0 - 1.0. Use the -/= keys to adjust in game (setting will be remembered).",
                                                                 new AcceptableValueRange <float>(0f, 1f)));
            headOffsetX = config.Bind("General",
                                      "FirstPersonHeadOffsetX",
                                      0.0f,
                                      new ConfigDescription("This is an offset you can adjust, if needed, to center the camera position over the player model in first person mode. " +
                                                            "I haven't found a way to programatically fully determine the exact right spot at runtime, so I need to use an offset, and based on tracking, it" +
                                                            " might be different for different players. It shouldn't need to be adjusted much.",
                                                            new AcceptableValueRange <float>(-2.0f, 2.0f)));
            headOffsetZ = config.Bind("General",
                                      "FirstPersonHeadOffsetZ",
                                      0.0f,
                                      new ConfigDescription("See FirstPersonHeadOffsetX description.",
                                                            new AcceptableValueRange <float>(-2.0f, 2.0f)));
            headOffsetY = config.Bind("General",
                                      "FirstPersonHeadOffsetY",
                                      0.0f,
                                      new ConfigDescription("See FirstPersonHeadOffsetX description.",
                                                            new AcceptableValueRange <float>(-2.0f, 2.0f)));
            enableHeadReposition = config.Bind("General",
                                               "EnableHeadRepositioning",
                                               true,
                                               "Set to this true enable using the arrow keys to position the camera when in first person mode. You can use this to set the values of FirstPersonHeadOffsetX/Z while in game " +
                                               "rather than having to edit them manually in the config file. Your settings will be remembered between gameplay sessions via this config file."
                                               );
            enableHands = config.Bind("General",
                                      "EnableHands",
                                      true,
                                      "Set this true to allow hands and laser pointers to be rendered in game. Note: motion controls are only minimally enabled, so right now this is just for fun.");

            useLookLocomotion = config.Bind("General",
                                            "UseLookLocomotion",
                                            false,
                                            "Setting this to true ties the direction you are looking to the walk direction while in first person mode. Set this to false if you prefer to disconnect these so you can look" +
                                            " look by turning your head without affecting movement direction.");
        }
 void Start()
 {
     configDropCount = Config.Bind("Config", "DropCount", 2, "掉落数量");
     configRandom    = Config.Bind("Config", "RandomDrop", true, "是否随机掉落");
     new Harmony("me.xiaoye97.plugin.MoreDrops").PatchAll();
 }
        public void Awake()
        {
            MaxDistance = Config.Bind <float>("Stats", "MaxDistance", 200f, "Max Distance Bullets can travel. Default is 200");
            Radius      = Config.Bind <float>("Stats", "Radius", 1f, "Bullet Radius Multiplier. Default is 1");
            Damage      = Config.Bind <float>("Stats", "Damage", 1f, "Damage Multiplier. Default is 1");
            Recoil      = Config.Bind <bool>("Misc", "Disable Recoil", true, "Set to true if you want to disable recoil/muzzle spread");
            Falloff     = Config.Bind <bool>("Misc", "Disable Damage Fall off", false, "Set to true if you want to disable damage fall off over distance");
            IFrame      = Config.Bind <float>("Misc", "IFrame duration", 0.1f, "Duration of Invincibility after using utility skill in seconds. Default is 0.1");
            On.RoR2.BulletAttack.Fire += (orig, self) =>
            {
                if (self.owner.name == "CommandoBody(Clone)")
                {
                    self.maxDistance = MaxDistance.Value;
                    self.damage      = self.damage * Damage.Value;
                    self.radius      = self.radius * Radius.Value;
                    if (Falloff.Value)
                    {
                        self.falloffModel = BulletAttack.FalloffModel.None;
                    }
                    if (Recoil.Value)
                    {
                        self.minSpread = 0.0f;
                        self.maxSpread = 0.0f;
                        self.owner.GetComponent <CharacterBody>().SetSpreadBloom(0.0f, false);
                    }
                }
                orig(self);
            };

            // Copied & Fixed from Wordam, don't even ask me how that works
            IL.EntityStates.Commando.DodgeState.OnEnter += (il1) =>
            {
                if (IFrame.Value == 0f)
                {
                    return;
                }
                var c2 = new ILCursor(il1);
                c2.Emit(OpCodes.Ldarg_0);

                c2.EmitDelegate <Action <EntityStates.Commando.DodgeState> >((d) =>
                {
                    if (d.outer)
                    {
                        if (d.outer.commonComponents.characterBody)
                        {
                            d.outer.commonComponents.characterBody.AddTimedBuff(RoR2Content.Buffs.Immune, IFrame.Value);
                        }
                    }
                });
            };

            IL.EntityStates.Commando.SlideState.OnEnter += (il1) =>
            {
                if (IFrame.Value == 0f)
                {
                    return;
                }
                var c2 = new ILCursor(il1);
                c2.Emit(OpCodes.Ldarg_0);

                c2.EmitDelegate <Action <EntityStates.Commando.SlideState> >((d) =>
                {
                    if (d.outer)
                    {
                        if (d.outer.commonComponents.characterBody)
                        {
                            d.outer.commonComponents.characterBody.AddTimedBuff(RoR2Content.Buffs.Immune, IFrame.Value);
                        }
                    }
                });
            };
        }
예제 #29
0
        private static void AddWatermark(bool doWatermarkFlag, ref byte[] basePng, string wmFileName, ConfigEntry <float> times)
        {
            if (!doWatermarkFlag && !KK_PNGCaptureSizeModifier.ResolutionWaterMark.Value)
            {
                return;
            }

            Texture2D screenshot = new Texture2D(2, 2);

            screenshot.LoadImage(basePng);

            //圖片分辨率
            if (KK_PNGCaptureSizeModifier.ResolutionWaterMark.Value || doWatermarkFlag)
            {
                string    text         = $"{screenshot.width}x{screenshot.height}";
                int       textureWidth = TextToTexture.CalcTextWidthPlusTrailingBuffer(text, KK_PNGCaptureSizeModifier.CharacterSize.Value);
                Texture2D capsize      = TextToTexture.CreateTextToTexture(text, 0, 0, textureWidth, KK_PNGCaptureSizeModifier.CharacterSize.Value);
                capsize    = Extension.Extension.Scale(capsize, (int)(capsize.width * times.Value / (float)times.DefaultValue), (int)(capsize.height * times.Value / (float)times.DefaultValue));
                screenshot = Extension.Extension.OverwriteTexture(
                    screenshot,
                    capsize,
                    screenshot.width * KK_PNGCaptureSizeModifier.PositionX.Value / 100 - capsize.width,
                    screenshot.height * KK_PNGCaptureSizeModifier.PositionY.Value / 100
                    );
                KK_PNGCaptureSizeModifier.Logger.LogDebug($"Add Resolution: {text}");
            }

            //浮水印
            if (doWatermarkFlag)
            {
                Texture2D watermark = Extension.Extension.LoadDllResource($"KK_PNGCaptureSizeModifier.Resources.{wmFileName}");
                watermark  = Extension.Extension.Scale(watermark, (int)(watermark.width * times.Value / (float)times.DefaultValue), (int)(watermark.height * times.Value / (float)times.DefaultValue));
                screenshot = Extension.Extension.OverwriteTexture(
                    screenshot,
                    watermark,
                    0,
                    screenshot.height - watermark.height
                    );
                KK_PNGCaptureSizeModifier.Logger.LogDebug($"Add Watermark: {wmFileName}");
            }

            basePng = screenshot.EncodeToPNG();
        }
예제 #30
0
 private void Init()
 {
     // Init config file
     srConfig = new ConfigFile(configFilePath, true);
     // Developer
     ModuleVersion = srConfig.Bind <string>(SectionDeveloper,
                                            "Version", SacrificeRemix.Version,
                                            "The configuration file version. Do not modify.");
     IsDeveloperMode = srConfig.Bind <bool>(SectionDeveloper,
                                            "IsDeveloperMode", false,
                                            "Enable custom logs for debugging.");
     // General
     IsModuleEnabled = srConfig.Bind <bool>(SectionGeneral,
                                            "IsModuleEnabled", true,
                                            "Enable or disable the module.");
     BoostSpawnRates = srConfig.Bind <bool>(SectionGeneral,
                                            "BoostSpawnRates", true,
                                            "Monsters spawn faster than usual; this is influenced by the SpawnIntensity multiplier.");
     SpawnIntensity = srConfig.Bind <float>(SectionGeneral,
                                            "SpawnIntensity", 1.25f,
                                            "A multiplier for the rate at which more difficult monsters spawn; 1 is the default rate.");
     SpawnIntensityPerPlayer = srConfig.Bind <float>(SectionGeneral,
                                                     "SpawnIntensityPerPlayer", 0,
                                                     "Scale SpawnIntensity for each additional player (0 to disable). " +
                                                     "Example: SpawnIntensity 1 + 0.25 PerPlayer = 100%/125%/150%/175% with 1/2/3/4 players.");
     // Summoner
     SummonDroneChance = srConfig.Bind <float>(SectionSummoner,
                                               "SummonDroneChance", 0.5f,
                                               "The chance to spawn a temporary drone on kill. 0 to disable.");
     // Drops
     NormalDropChance = srConfig.Bind <float>(SectionDrops,
                                              "NormalDropChance", 1,
                                              "Percent chance for normal monsters to drop an item. 0 to disable.");
     EliteDropChance = srConfig.Bind <float>(SectionDrops,
                                             "EliteDropChance", 2,
                                             "Percent chance for elite monsters to drop an item. 0 to disable.");
     BossDropChance = srConfig.Bind <float>(SectionDrops,
                                            "BossDropChance", 4,
                                            "Percent chance for bosses to drop an item. 0 to disable.");
     CloversRerollDrops = srConfig.Bind <bool>(SectionDrops,
                                               "CloversRerollDrops", false,
                                               "Can clovers reroll the chance of an item dropping.");
     CloversRerollRarity = srConfig.Bind <bool>(SectionDrops,
                                                "CloversRerollRarity", true,
                                                "Can clovers reroll the rarity of an item that's dropping (e.g. increased chance for red or green).");
     DropOnMonsterPos = srConfig.Bind <bool>(SectionDrops,
                                             "DropOnMonsterPos", false,
                                             "If enabled, drops will spawn on the monster position. If disabled, drops will spawn on the player position.");
     // Drops.Normal
     NormalGreenItemChance = srConfig.Bind <float>(SectionDropsNormal,
                                                   "GreenItem", 27,
                                                   "Percent chance for normal monsters to roll uncommon item.");
     NormalRedItemChance = srConfig.Bind <float>(SectionDropsNormal,
                                                 "RedItem", 3,
                                                 "Percent chance for normal monsters to roll legendary item.");
     NormalBossItemChance = srConfig.Bind <float>(SectionDropsNormal,
                                                  "BossItem", 0,
                                                  "Percent chance for normal monsters to roll boss item.");
     NormalEquipmentChance = srConfig.Bind <float>(SectionDropsNormal,
                                                   "Equipment", 0,
                                                   "Percent chance for normal monsters to roll equipment.");
     // Drops.Elite
     EliteGreenItemChance = srConfig.Bind <float>(SectionDropsElite,
                                                  "GreenItem", 45,
                                                  "Percent chance for elite monsters to roll uncommon item.");
     EliteRedItemChance = srConfig.Bind <float>(SectionDropsElite,
                                                "RedItem", 5,
                                                "Percent chance for elite monsters to roll legendary item.");
     EliteBossItemChance = srConfig.Bind <float>(SectionDropsElite,
                                                 "BossItem", 0,
                                                 "Percent chance for elite monsters to roll boss item.");
     EliteEquipmentChance = srConfig.Bind <float>(SectionDropsElite,
                                                  "Equipment", 0,
                                                  "Percent chance for elite monsters to roll equipment.");
     // Drops.Boss
     BossGreenItemChance = srConfig.Bind <float>(SectionDropsBoss,
                                                 "GreenItem", 62,
                                                 "Percent chance for bosses to roll uncommon item.");
     BossRedItemChance = srConfig.Bind <float>(SectionDropsBoss,
                                               "RedItem", 8,
                                               "Percent chance for bosses to roll legendary item.");
     BossBossItemChance = srConfig.Bind <float>(SectionDropsBoss,
                                                "BossItem", 0,
                                                "Percent chance for bosses to roll boss item.");
     BossEquipmentChance = srConfig.Bind <float>(SectionDropsBoss,
                                                 "Equipment", 0,
                                                 "Percent chance for bosses to roll equipment.");
 }
 private void CreateConfig(ConfigFile config)
 {
     cooldown = config.Bind <float>("Equipment: " + EquipmentName, "Cooldown duration", 60f, "How long should the cooldown be? (seconds)");
 }
        void Awake()
        {
            enableMod = Config.Bind("1 - Global", "Enable Mod", true, "Enable or disable this mod");
            if (!enableMod.Value)
            {
                return;
            }

            stationHoverLevel       = Config.Bind("2 - Toggles", "Show Bench Level On Hover", true, "Show the bench level on hover");
            stationHoverChildLevel  = Config.Bind("2 - Toggles", "Hide Hover Level On Child Stations", true, "Hides the level hover on Artisan Stations, Stonecutters and Cauldrons since they can't go past level 1 (Left this as an option incase these stations get levels in the future)");
            stationRequireRoofLevel = Config.Bind("2 - Toggles", "Require Crafting Station Roof", true, "Whether or not to require Crafting Stations to have roofs");
            stationExtendedRanges   = Config.Bind("2 - Toggles", "Extended Crafting Station Ranges", false, "Define custom build ranges for crafting stations");
            customUseRange          = Config.Bind("2 - Toggles", "Custom Use Ranges", false, "Define custom use ranges for crafting stations");
            customExtensionRange    = Config.Bind("2 - Toggles", "Custom Extension Ranges", false, "Define custom extension ranges for connecting to crafting stations");
            cauldronFire            = Config.Bind("2 - Toggles", "Allow No Fire For Cauldron", true, "Allows a Cauldron to work with no fire");

            stationWorkbenchRange   = Config.Bind("3 - Extended Crafting Station Ranges", "Workbench", 20.0, "Workbench build range");
            stationForgeRange       = Config.Bind("3 - Extended Crafting Station Ranges", "Forge", 20.0, "Forge build range");
            stationStonecutterRange = Config.Bind("3 - Extended Crafting Station Ranges", "Stonecutter", 20.0, "Stonecutter build range");
            stationArtisanRange     = Config.Bind("3 - Extended Crafting Station Ranges", "Artisan Table", 20.0, "Artisan Table build range");

            workbenchRange   = Config.Bind("4 - Custom Use Ranges", "Workbench", 2.0, "Workbench use range");
            forgeRange       = Config.Bind("4 - Custom Use Ranges", "Forge", 1.7, "Forge use range");
            stonecutterRange = Config.Bind("4 - Custom Use Ranges", "Stonecutter", 2.0, "Stonecutter use range");
            artisanRange     = Config.Bind("4 - Custom Use Ranges", "Artisan Table", 2.0, "Artisan Table use range");
            cauldronRange    = Config.Bind("4 - Custom Use Ranges", "Cauldron", 1.9, "Cauldron use range");

            choppingBlockRange = Config.Bind("5 - Custom Extension Ranges", "Workbench Chopping Block", 5.0, "Chopping Block connection range");
            tanningRackRange   = Config.Bind("5 - Custom Extension Ranges", "Workbench Tanning Rack", 5.0, "Tanning Rack connection range");
            AdzeRange          = Config.Bind("5 - Custom Extension Ranges", "Workbench Adze", 5.0, "Adze connection range");
            toolShelfRange     = Config.Bind("5 - Custom Extension Ranges", "Workbench Tool Shelf", 5.0, "Tool Shelf connection range");
            forgeBellowsRange  = Config.Bind("5 - Custom Extension Ranges", "Forge Bellows", 2.0, "Forge Bellows connection range");
            anvilRange         = Config.Bind("5 - Custom Extension Ranges", "Forge Anvil", 5.0, "Anvil connection range");
            grindingWheelRange = Config.Bind("5 - Custom Extension Ranges", "Forge Grinding Wheel", 5.0, "Grinding Wheel connection range");
            smithsAnvilRange   = Config.Bind("5 - Custom Extension Ranges", "Forge Smiths Anvil", 5.0, "Smiths Anvil connection range");
            forgeCoolerRange   = Config.Bind("5 - Custom Extension Ranges", "Forge Cooler", 5.0, "Forge Cooler connection range");
            forgeToolrackRange = Config.Bind("5 - Custom Extension Ranges", "Forge Toolrack", 5.0, "Forge Toolrack connection range");

            if (stationExtendedRanges.Value)
            {
                customStationRanges.Add("$piece_workbench", (float)stationWorkbenchRange.Value);
                customStationRanges.Add("$piece_forge", (float)stationForgeRange.Value);
                customStationRanges.Add("$piece_stonecutter", (float)stationStonecutterRange.Value);
                customStationRanges.Add("$piece_artisanstation", (float)stationArtisanRange.Value);
            }

            if (customUseRange.Value)
            {
                customRanges.Add("$piece_workbench", (float)workbenchRange.Value);
                customRanges.Add("$piece_forge", (float)forgeRange.Value);
                customRanges.Add("$piece_stonecutter", (float)stonecutterRange.Value);
                customRanges.Add("$piece_artisanstation", (float)artisanRange.Value);
                customRanges.Add("$piece_cauldron", (float)cauldronRange.Value);
            }

            if (customExtensionRange.Value)
            {
                customExtRanges.Add("$piece_workbench_ext1", (float)choppingBlockRange.Value);
                customExtRanges.Add("$piece_workbench_ext2", (float)tanningRackRange.Value);
                customExtRanges.Add("$piece_workbench_ext3", (float)AdzeRange.Value);
                customExtRanges.Add("$piece_workbench_ext4", (float)toolShelfRange.Value);
                customExtRanges.Add("$piece_forge_ext1", (float)forgeBellowsRange.Value);
                customExtRanges.Add("$piece_forge_ext2", (float)anvilRange.Value);
                customExtRanges.Add("$piece_forge_ext3", (float)grindingWheelRange.Value);
                customExtRanges.Add("$piece_forge_ext4", (float)smithsAnvilRange.Value);
                customExtRanges.Add("$piece_forge_ext5", (float)forgeCoolerRange.Value);
                customExtRanges.Add("$piece_forge_ext6", (float)forgeToolrackRange.Value);
            }

            Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), null);
        }
예제 #33
0
        private void InitUncensorConfigs <T>(string sex, string part, Dictionary <string, T> uncensorDictionary, string[] defaultChoices, int order, out ConfigEntry <string> defaultConf, out ConfigEntry <string> excludeConf) where T : IUncensorData
        {
            byte sexValue = (byte)(sex == "Male" ? 0 : 1);

            if (!RandomExcludedSets.TryGetValue(sexValue, out var sexExcluded))
            {
                sexExcluded = RandomExcludedSets[sexValue] = new Dictionary <string, HashSet <string> >(StringComparer.OrdinalIgnoreCase);
            }

            if (!sexExcluded.TryGetValue(part, out var partExcluded))
            {
                partExcluded = sexExcluded[part] = new HashSet <string>(StringComparer.OrdinalIgnoreCase);
            }

            var defaultDescAttrs = new ConfigurationManagerAttributes {
                Order = order
            };
            var defaultDesc = new ConfigDescription($"{part} to use if the character does not have one set. The {(part == "Body" ? "censored" : "mosaic")} {part.ToLower()} will not be selected randomly if there are any alternatives.", new AcceptableValueList <string>(defaultChoices), defaultDescAttrs);

            defaultConf = Config.Bind("Config", $"Default {sex} {part}", "Random", defaultDesc);

            var settingsGUI = new SettingsGUI <T>(uncensorDictionary, sexValue, part);

            SettingsGUIs.Add(settingsGUI);
            var excludedDescAttrs = new ConfigurationManagerAttributes {
                HideDefaultButton = true, CustomDrawer = settingsGUI.DrawSettingsGUI, Order = order
            };
            var excludedDesc = new ConfigDescription($"{part} uncensors to exclude from random selection for {sex.ToLower()}s", null, excludedDescAttrs);

            excludeConf = Config.Bind("Random Excluded", $"{sex} {part}", string.Empty, excludedDesc);

            //Apply initial config file value now
            UpdateGuidSet(excludeConf.Value, partExcluded);

            //Update on change
            excludeConf.SettingChanged += (s, a) =>
            {
                if (!(a is SettingChangedEventArgs args) || !(args.ChangedSetting is ConfigEntry <string> conf))
                {
                    Logger.LogError("Unexpected error, unable to handle changed settings.");
                    return;
                }
                UpdateGuidSet(conf.Value, partExcluded);
            };
        }
예제 #34
0
 public void OnRegister(BaseUnityPlugin plugin)
 {
     moveSpeed = plugin.Config.Bind("游戏设定", "移动速度", 1f, "修改玩家在大地图的移动速度 如果太快可能会穿模");
 }
예제 #35
0
 private KeyCode?GetKey(ConfigEntry <string> param)
 {
     return(Enum.TryParse(param.Value, out KeyCode result) ? (KeyCode?)result : null);
 }
예제 #36
0
        private void Start()
        {
            Logger = base.Logger;

            ConfigEnablePushup = Config.Bind("Config", "Enable Pushup By Default", false, new ConfigDescription("Whether the pushup effect is enabled by default when a bra is worn.", null, new ConfigurationManagerAttributes {
                Order = 10
            }));
            ConfigFirmnessDefault = Config.Bind("Config", "Firmness Default Value", 0.9f, new ConfigDescription("Firmness of the breasts. More firm means less bounce.", new AcceptableValueRange <float>(0f, 1f), new ConfigurationManagerAttributes {
                Order = 9
            }));
            ConfigLiftDefault = Config.Bind("Config", "Lift Default Value", 0.6f, new ConfigDescription("Lift of the breasts. Lift is the minimum height position of the breasts when a bra is worn.", new AcceptableValueRange <float>(0f, 1f), new ConfigurationManagerAttributes {
                Order = 8
            }));
            ConfigPushTogetherDefault = Config.Bind("Config", "Push Together Default Value", 0.55f, new ConfigDescription("How much the breasts will be pushed together when a bra is worn, if they are set far apart.", new AcceptableValueRange <float>(0f, 1f), new ConfigurationManagerAttributes {
                Order = 7
            }));
            ConfigSqueezeDefault = Config.Bind("Config", "Squeeze Default Value", 0.6f, new ConfigDescription("Long breasts will be flattened by this amount.", new AcceptableValueRange <float>(0f, 1f), new ConfigurationManagerAttributes {
                Order = 6
            }));
            ConfigNippleCenteringDefault = Config.Bind("Config", "Nipple Centering Default Value", 0.5f, new ConfigDescription("If the nipples point up or down, wearing a bra will make them point forwards.", new AcceptableValueRange <float>(0f, 1f), new ConfigurationManagerAttributes {
                Order = 5
            }));
            ConfigFlattenNipplesDefault = Config.Bind("Config", "Flatten Nipples Default", true, new ConfigDescription("Flatten nipples while a bra is worn.", null, new ConfigurationManagerAttributes {
                Order = 4
            }));
            ConfigSliderMin = Config.Bind("Config", "Advanced Mode Slider Minimum", -100, new ConfigDescription("Minimum value of advanced mode sliders.", new AcceptableValueRange <int>(-500, 0), new ConfigurationManagerAttributes {
                Order = 3
            }));
            ConfigSliderMax = Config.Bind("Config", "Advanced Mode Slider Maximum", 200, new ConfigDescription("Maximum value of advanced mode sliders.", new AcceptableValueRange <int>(100, 500), new ConfigurationManagerAttributes {
                Order = 2
            }));

            CharacterApi.RegisterExtraBehaviour <PushupController>(GUID);
            MakerAPI.RegisterCustomSubCategories += RegisterCustomSubCategories;
            MakerAPI.ReloadCustomInterface       += ReloadCustomInterface;
            MakerAPI.MakerExiting         += MakerExiting;
            MakerAPI.MakerFinishedLoading += MakerFinishedLoading;
#if KK
            //No studio for EC
            RegisterStudioControls();
#endif
            var harmony = Harmony.CreateAndPatchAll(typeof(Hooks));

            //Patch all the slider onValueChanged events to return false and cancel original code
            //Pushup adds its own onValueChanged event that manages this stuff
            for (var i = 0; i < typeof(ChaCustom.CvsBreast).GetNestedTypes(AccessTools.all).Length; i++)
            {
                var anonType = typeof(ChaCustom.CvsBreast).GetNestedTypes(AccessTools.all)[i];
                if (anonType.Name.Contains("<Start>"))
                {
                    for (var index = 0; index < anonType.GetMethods(AccessTools.all).Length; index++)
                    {
                        var anonTypeMethod = anonType.GetMethods(AccessTools.all)[index];
                        if (anonTypeMethod.Name.Contains("<>m"))
                        {
                            if (anonTypeMethod.GetParameters().Any(x => x.ParameterType == typeof(float)))
                            {
                                harmony.Patch(anonTypeMethod, new HarmonyMethod(typeof(Hooks).GetMethod(nameof(Hooks.SliderHook), AccessTools.all)));
                            }
                        }
                    }
                }
            }

            var sliders = typeof(ChaCustom.CvsBreast).GetMethods(AccessTools.all).Where(x => x.Name.Contains("<Start>") && x.GetParameters().Any(y => y.ParameterType == typeof(float)));
            //Don't patch areola size or nipple gloss since they are not managed by this plugin
            foreach (var slider in sliders)
            {
                if (Application.productName == Constants.MainGameProcessName)
                {
                    if (slider.Name == "<Start>m__E")
                    {
                    }                                    //areola size
                    else if (slider.Name == "<Start>m__14")
                    {
                    }                                          //nipple gloss
                    else
                    {
                        harmony.Patch(slider, new HarmonyMethod(typeof(Hooks).GetMethod(nameof(Hooks.SliderHook), AccessTools.all)));
                    }
                }
#if KK
                //EC sliders match non-Steam version of KK
                else if (Application.productName == Constants.MainGameProcessNameSteam)
                {
                    if (slider.Name == "<Start>m__10")
                    {
                    }                                     //areola size
                    else if (slider.Name == "<Start>m__17")
                    {
                    }                                          //nipple gloss
                    else
                    {
                        harmony.Patch(slider, new HarmonyMethod(typeof(Hooks).GetMethod(nameof(Hooks.SliderHook), AccessTools.all)));
                    }
                }
#endif
            }
        }
        private void Awake()
        {
            for (int index = 0; index < _dan_length.Length; index++)
            {
                _dan_collider_headlength[index] = Config.Bind <float>("Male " + (index + 1) + " Options", "Collider: Length of Head", 0.2f, "Distance from the center of the head bone to the tip, used for collision purposes.");
                _dan_collider_radius[index]     = Config.Bind <float>("Male " + (index + 1) + " Options", "Collider: Radius of Shaft", 0.25f, "Radius of the shaft collider.");
                _dan_length[index]              = Config.Bind <float>("Male " + (index + 1) + " Options", "Penis: Length", 1.8f, "Set the length of the penis.  Apparent Length is about 0.2 larget than this, depending on uncensor.  2.0 is about 8 inches or 20 cm.");
                _dan_girth[index]               = Config.Bind <float>("Male " + (index + 1) + " Options", "Penis: Girth", 1.0f, "Set the scale of the circumference of the penis.");
                _dan_sack_size[index]           = Config.Bind <float>("Male " + (index + 1) + " Options", "Penis: Sack Size", 1.0f, "Set the scale (size) of the sack");
                _dan_softness[index]            = Config.Bind <float>("Male " + (index + 1) + " Options", "Penis: Softness", 0.1f, "Set the softness of the penis.  A value of 0 means maximum hardness, the penis will remain the same length at all times.  A value greater than 0 will cause the penis to begin to telescope after penetration.  A small value can make it appear there is friction during penetration.");
                _allow_telescope_percent[index] = Config.Bind <float>("Male " + (index + 1) + " Options", "Limiter: Telescope Threshold", 0.4f, "Allow the penis to begin telescoping after it has penetrated a certain amount. 0 = never telescope, 0.5 = allow telescoping after the halfway point, 1 = always allow telescoping.");
                _force_telescope[index]         = Config.Bind <bool>("Male " + (index + 1) + " Options", "Limiter: Telescope Always", true, "Force the penis to always telescope at the threshold point, instead of only doing it when it prevents clipping.");
                _dan_move_limit[index]          = Config.Bind <float>("Male " + (index + 1) + " Options", "Limiter: Length Limiter", 1.0f, "Sets a limit for how suddenly the penis can change length, preventing the penis from suddenly shifting and creating unrealistic looking physics.");
                _dan_angle_limit[index]         = Config.Bind <float>("Male " + (index + 1) + " Options", "Limiter: Angle Limiter", 120.0f, "Sets a limit for how suddenly the penis can change angles, preventing the penis from suddenly shifting and creating unrealistic looking physics.");
            }

            _clipping_depth = Config.Bind <float>("Female Options", "Clipping Depth", 0.25f, "Set how close to body surface to limit penis for clipping purposes. Smaller values will result in more clipping through the body, larger values will make the shaft wander further away from the intended penetration point.");
            for (int index = 0; index < frontOffsets.Length; index++)
            {
                _front_collision_point_offset.Add(Config.Bind <float>("Female Options", "Clipping Offset: Front Collision " + index, frontOffsets[index], "Individual offset on colision point, to improve clipping"));
            }
            for (int index = 0; index < backOffsets.Length; index++)
            {
                _back_collision_point_offset.Add(Config.Bind <float>("Female Options", "Clipping Offset: Back Collision " + index, backOffsets[index], "Individual offset on colision point, to improve clipping"));
            }
            _kokanForwardOffset = Config.Bind <float>("Female Options", "Target Offset: V****a Vertical", -0.025f, "Vertical offset of the v****a target");
            _kokanUpOffset      = Config.Bind <float>("Female Options", "Target Offset: V****a Depth", -0.05f, "Depth offset of the v****a target");
            _headForwardOffset  = Config.Bind <float>("Female Options", "Target Offset: Mouth Depth", 0.00f, "Depth offset of the mouth target");
            _headUpOffset       = Config.Bind <float>("Female Options", "Target Offset: Mouth Vertical", 0.05f, "Vertical offset of the mouth target");

            for (int index = 0; index < _dan_length.Length; index++)
            {
                _dan_length[index].SettingChanged += delegate
                {
                    if (inHScene && danCollider[index] != null)
                    {
                        danCollider[index].m_Center = new Vector3(0, 0, _dan_length[index].Value / 2);
                        danCollider[index].m_Height = _dan_length[index].Value + (_dan_collider_headlength[index].Value * 2);
                    }
                };

                _dan_girth[index].SettingChanged += delegate
                {
                    if (inHScene && bDansFound[index])
                    {
                        danPoints[index].danStart.localScale = new Vector3(_dan_girth[index].Value, _dan_girth[index].Value, 1);
                    }
                };

                _dan_sack_size[index].SettingChanged += delegate
                {
                    if (inHScene && danPoints[index].danTop != null)
                    {
                        danPoints[index].danTop.localScale = new Vector3(_dan_sack_size[index].Value, _dan_sack_size[index].Value, _dan_sack_size[index].Value);
                    }
                };

                _dan_collider_radius[index].SettingChanged += delegate
                {
                    if (inHScene)
                    {
                        danCollider[index].m_Radius = _dan_collider_radius[index].Value;
                    }
                };

                _dan_collider_headlength[index].SettingChanged += delegate
                {
                    if (inHScene)
                    {
                        danCollider[index].m_Height = _dan_length[index].Value + (_dan_collider_headlength[index].Value * 2);
                    }
                };
            }
            harmony = new Harmony("HS2_BetterPenetration");
            SceneManager.sceneLoaded += SceneManager_sceneLoaded;
        }
예제 #38
0
        public static void SetConfig(string name, ConfigFile config)
        {
            var minConfigDescription = new ConfigDescription(
                "Dungeons will generate with at least this many rooms placed. \n" +
                "In vanilla Valheim, this value is 3.",
                new AcceptableValueRange <int>(0, 200));

            minimumDungeonSize = config.Bind(name + ".Global", "min_rooms", 15, minConfigDescription);

            var maxConfigDescription = new ConfigDescription(
                "Dungeons will attempt to place this many rooms. \n" +
                "In vanilla Valheim, this value varies based on dungeon type but tends to be 30 or 40." +
                "Expect fps drops in dungeons if this is over 100.",
                new AcceptableValueRange <int>(0, 200));

            maximumDungeonSize = config.Bind(name + ".Global", "max_rooms", 60, maxConfigDescription);

            var minCampDescription = new ConfigDescription(
                "Camps will generate with at least this many components placed. \n",
                new AcceptableValueRange <int>(0, 80));

            minimumCampSize = config.Bind(name + ".Global", "camp_min", 25, minCampDescription);

            var maxCampDescription = new ConfigDescription(
                "Camps will attempt to place this many components.",
                new AcceptableValueRange <int>(0, 80));

            maximumCampSize = config.Bind(name + ".Global", "camp_max", 40, maxCampDescription);

            var mobMinLvlDescription = new ConfigDescription(
                "Minimum level of dungeon/point of interest mobs. Level 1 (default) means Zero stars.",
                new AcceptableValueRange <int>(0, 10));

            minMobLevel = config.Bind(name + ".Global", "mob_min_lvl", 1, mobMinLvlDescription);

            var mobMaxLvlDescription = new ConfigDescription(
                "Maximum level of dungeon/point of interest mobs. Level 3 (default) means 2 Stars.",
                new AcceptableValueRange <int>(0, 10));

            maxMobLevel = config.Bind(name + ".Global", "mob_max_lvl", 3, mobMaxLvlDescription);

            var mobLevelChanceDescription = new ConfigDescription(
                "Chance for dungeon/point of interest mobs to spawn higher than the minimum level.",
                new AcceptableValueRange <int>(0, 100));

            mobLevelChance = config.Bind(name + ".Global", "mob_lvl_chance", 15, mobLevelChanceDescription);

            var mobScaleDescription = new ConfigDescription(
                "How much bigger are higher level mobs?" +
                "Percentage, per level",
                new AcceptableValueRange <int>(0, 500));

            mobScale = config.Bind(name + ".Global", "mob_scale", 10, mobScaleDescription);

            var newWorldDescription = new ConfigDescription(
                "If you're running this on a world that existed before the mod was installed, change the value to false");

            isNewWorld = config.Bind(name + ".Global", "new_world", true, newWorldDescription);

            isDefaultDifficulty = minMobLevel.Value == 1 && maxMobLevel.Value == 3 && mobLevelChance.Value == 15;
        }
예제 #39
0
        private void Awake()
        {
            context    = this;
            modEnabled = Config.Bind <bool>("Config", "Enabled", true, "Enable this mod");
            nexusID    = Config.Bind <int>("Config", "NexusID", 1105, "Nexus mod ID for updates");

            buttonAttack       = Config.Bind <string>("KeysCombat", "Attack", "Mouse0", "Attack button");
            buttonSecondAttack = Config.Bind <string>("KeysCombat", "SecondAttack", "Mouse2", "SecondAttack button");
            buttonBlock        = Config.Bind <string>("KeysCombat", "Block", "Mouse1", "Block button");
            buttonUse          = Config.Bind <string>("KeysMisc", "Use", "E", "Use button");
            buttonHide         = Config.Bind <string>("KeysMisc", "Hide", "R", "Hide button");
            buttonJump         = Config.Bind <string>("KeysMovement", "Jump", "Space", "Jump button");
            buttonCrouch       = Config.Bind <string>("KeysMovement", "Crouch", "LeftControl", "Crouch button");
            buttonRun          = Config.Bind <string>("KeysMovement", "Run", "LeftShift", "Run button");
            buttonToggleWalk   = Config.Bind <string>("KeysMovement", "ToggleWalk", "C", "ToggleWalk button");
            buttonAutoRun      = Config.Bind <string>("KeysMovement", "AutoRun", "Q", "AutoRun button");
            buttonSit          = Config.Bind <string>("KeysMovement", "Sit", "X", "Sit button");
            buttonGPower       = Config.Bind <string>("KeysMisc", "GPower", "F", "GPower button");
            buttonAltPlace     = Config.Bind <string>("KeysBuild", "AltPlace", "LeftShift", "AltPlace button");
            buttonForward      = Config.Bind <string>("KeysDirection", "Forward", "W,0.3,0.1", "Forward button");
            buttonLeft         = Config.Bind <string>("KeysDirection", "Left", "A,0.3,0.1", "Left button");
            buttonBackward     = Config.Bind <string>("KeysDirection", "Backward", "S,0.3,0.1", "Backward button");
            buttonRight        = Config.Bind <string>("KeysDirection", "Right", "D,0.3,0.1", "Right button");
            buttonInventory    = Config.Bind <string>("KeysMisc", "Inventory", "Tab", "Inventory button");
            buttonMap          = Config.Bind <string>("KeysMap", "Map", "M", "Map button");
            buttonMapZoomOut   = Config.Bind <string>("KeysMap", "MapZoomOut", "Comma", "MapZoomOut button");
            buttonMapZoomIn    = Config.Bind <string>("KeysMap", "MapZoomIn", "Period", "MapZoomIn button");
            buttonBuildPrev    = Config.Bind <string>("KeysBuild", "BuildPrev", "Q", "BuildPrev button");
            buttonBuildNext    = Config.Bind <string>("KeysBuild", "BuildNext", "E", "BuildNext button");
            buttonBuildMenu    = Config.Bind <string>("KeysBuild", "BuildMenu", "Mouse1", "BuildMenu button");
            buttonRemove       = Config.Bind <string>("KeysBuild", "Remove", "Mouse2", "Remove button");

            buttonJoyUse          = Config.Bind <string>("JoystickMisc", "JoyUse", "JoystickButton0", "JoyUse button");
            buttonJoyHide         = Config.Bind <string>("JoystickMisc", "JoyHide", "JoystickButton9", "JoyHide button");
            buttonJoyJump         = Config.Bind <string>("JoystickMovement", "JoyJump", "JoystickButton1", "JoyJump button");
            buttonJoySit          = Config.Bind <string>("JoystickMovement", "JoySit", "JoystickButton2", "JoySit button");
            buttonJoyInventory    = Config.Bind <string>("JoystickMisc", "JoyInventory", "JoystickButton3", "JoyInventory button");
            buttonJoyRun          = Config.Bind <string>("JoystickMovement", "JoyRun", "JoystickButton4", "JoyRun button");
            buttonJoyCrouch       = Config.Bind <string>("JoystickMovement", "JoyCrouch", "JoystickButton8", "JoyCrouch button");
            buttonJoyMap          = Config.Bind <string>("JoystickUI", "JoyMap", "JoystickButton6", "JoyMap button");
            buttonJoyMenu         = Config.Bind <string>("JoystickUI", "JoyMenu", "JoystickButton7", "JoyMenu button");
            buttonJoySecondAttack = Config.Bind <string>("JoystickCombat", "JoySecondAttack", "JoystickButton5", "JoySecondAttack button");
            buttonJoyAltPlace     = Config.Bind <string>("JoystickBuild", "JoyAltPlace", "JoystickButton4", "JoyAltPlace button");
            buttonJoyRemove       = Config.Bind <string>("JoystickBuild", "JoyRemove", "JoystickButton5", "JoyRemove button");
            buttonJoyTabLeft      = Config.Bind <string>("JoystickUI", "JoyTabLeft", "JoystickButton4", "JoyTabLeft button");
            buttonJoyTabRight     = Config.Bind <string>("JoystickUI", "JoyTabRight", "JoystickButton5", "JoyTabRight button");
            buttonJoyButtonA      = Config.Bind <string>("JoystickButtons", "JoyButtonA", "JoystickButton0", "JoyButtonA button");
            buttonJoyButtonB      = Config.Bind <string>("JoystickButtons", "JoyButtonB", "JoystickButton1", "JoyButtonB button");
            buttonJoyButtonX      = Config.Bind <string>("JoystickButtons", "JoyButtonX", "JoystickButton2", "JoyButtonX button");
            buttonJoyButtonY      = Config.Bind <string>("JoystickButtons", "JoyButtonY", "JoystickButton3", "JoyButtonY button");
            buttonJoyLStick       = Config.Bind <string>("JoystickButtons", "JoyLStick", "JoystickButton8", "JoyLStick button");
            buttonJoyRStick       = Config.Bind <string>("JoystickButtons", "JoyRStick", "JoystickButton9", "JoyRStick button");

            buttonJoyGPower      = Config.Bind <string>("JoystickMisc", "JoyGPower", "JoyAxis 7,0,0,true", "JoyGPower button");
            buttonJoyBlock       = Config.Bind <string>("JoystickCombat", "JoyBlock", "JoyAxis 3,0,0,true", "JoyBlock button");
            buttonJoyAttack      = Config.Bind <string>("JoystickCombat", "JoyAttack", "JoyAxis 3,0,0,false", "JoyAttack button");
            buttonJoyRotate      = Config.Bind <string>("JoystickBuild", "JoyRotate", "JoyAxis 3,0,0,true", "JoyRotate button");
            buttonJoyPlace       = Config.Bind <string>("JoystickBuild", "JoyPlace", "JoyAxis 10,0,0,false", "JoyPlace button");
            buttonJoyLStickLeft  = Config.Bind <string>("JoystickPads", "JoyLStickLeft", "JoyAxis 1,0.3,0.1,true", "JoyLStickLeft button");
            buttonJoyLStickRight = Config.Bind <string>("JoystickPads", "JoyLStickRight", "JoyAxis 1,0.3,0.1,false", "JoyLStickRight button");
            buttonJoyLStickUp    = Config.Bind <string>("JoystickPads", "JoyLStickUp", "JoyAxis 2,0.3,0.1,true", "JoyLStickUp button");
            buttonJoyLStickDown  = Config.Bind <string>("JoystickPads", "JoyLStickDown", "JoyAxis 2,0.3,0.1,false", "JoyLStickDown button");
            buttonJoyDPadLeft    = Config.Bind <string>("JoystickPads", "JoyDPadLeft", "JoyAxis 6,0.3,0.1,true", "JoyDPadLeft button");
            buttonJoyDPadRight   = Config.Bind <string>("JoystickPads", "JoyDPadRight", "JoyAxis 6,0.3,0.1,false", "JoyDPadRight button");
            buttonJoyDPadUp      = Config.Bind <string>("JoystickPads", "JoyDPadUp", "JoyAxis 7,0.3,0.1,true", "JoyDPadUp button");
            buttonJoyDPadDown    = Config.Bind <string>("JoystickPads", "JoyDPadDown", "JoyAxis 7,0.3,0.1,false", "JoyDPadDown button");
            buttonJoyLTrigger    = Config.Bind <string>("JoystickButtons", "JoyLTrigger", "JoyAxis 3,0,0,true", "JoyLTrigger button");
            buttonJoyRTrigger    = Config.Bind <string>("JoystickButtons", "JoyRTrigger", "JoyAxis 3,0,0,false", "JoyRTrigger button");

            harmony = new Harmony(Info.Metadata.GUID);
            harmony.PatchAll();
        }
예제 #40
0
 public T Get <T>(ConfigEntry entry)
 {
     lock (_lockingObject)
         return(this.Get <T>(entry.Name, entry.Default <T>()));
 }
예제 #41
0
 private void Awake()
 {
     sprintUntil = Config.Bind("General", "sprintUntil", .5f, "The 0 to 1 percentage of your stamina that you will stop auto sprinting at. Set to 1 to disable. (float)");
 }
예제 #42
0
 internal void Start()
 {
     Harmony.CreateAndPatchAll(typeof(DownloadRenamer));
     EnambleRenaming = Config.Bind(Utilities.ConfigSectionTweaks, "Rename downloads", true,
                                   new ConfigDescription("When enabled, maps, scenes, poses, and characters downloaded in game will have their file names changed to match the ones on the Illusion website."));
 }
        public void DeleteSetting(String sectionName, ConfigEntry entry)
        {
            ConfigSection section = configSections[sectionName];

            if (section != null)
            {
                section.Entries.Remove(entry);
            }
        }
        public void SetEntryValue(string name, int order, string value)
        {
            ConfigEntry tempEntry = new ConfigEntry(name, order, value);
            ConfigEntry entry = Entries.FirstOrDefault(x => x.key.Equals(tempEntry.key));

            if (entry != null)
            {
                entry.value = value;
            }
            else
            {
                throw new InvalidOperationException("Entry not found");
            }
        }