public void InitTechMatrixList(ref List <TechTypeData>[] TechnologyMatrix) { int i = 0; foreach (KeyValuePair <CATEGORY, TechType[]> kvp in baseTechMatrix) { if (Enum.IsDefined(typeof(Categories), (int)kvp.Key)) { TechnologyMatrix[i] = new List <TechTypeData>(); for (int j = 0; j < kvp.Value.Length; j++) { string name; TechType techType = kvp.Value[j]; switch (techType) { case TechType.SeaEmperorBaby: name = Language.main.Get(TechTypeExtensions.AsString(TechType.SeaEmperorJuvenile, false)); break; case TechType.SeaEmperorJuvenile: name = Language.main.Get(TechTypeExtensions.AsString(TechType.SeaEmperorBaby, false)); break; default: name = Language.main.Get(TechTypeExtensions.AsString(kvp.Value[j], false)); break; } TechnologyMatrix[i].Add(new TechTypeData(techType, name)); } i++; } } }
/// <summary> /// Populates a new ModCraftTreeRoot from a CraftNode tree. /// </summary> /// <param name="tree">The tree to create the ModCraftTreeRoot from.</param> /// <param name="root"></param> internal static void CreateFromExistingTree(CraftNode tree, ref ModCraftTreeLinkingNode root) { foreach (CraftNode node in tree) { if (node.action == TreeAction.Expand) { ModCraftTreeTab tab = root.AddTabNode(node.id); var thing = (ModCraftTreeLinkingNode)tab; CreateFromExistingTree(node, ref thing); } if (node.action == TreeAction.Craft) { var techType = TechType.None; TechTypeExtensions.FromString(node.id, out techType, false); if (node.id == "SeamothHullModule2") { techType = TechType.VehicleHullModule2; } else if (node.id == "SeamothHullModule3") { techType = TechType.VehicleHullModule3; } root.AddCraftingNode(techType); } } }
public static void InitTechMatrixList(ref List <TechTypeData>[] TechnologyMatrix) { for (int i = 0; i < techMatrix.Length; i++) { TechnologyMatrix[i] = new List <TechTypeData>(); for (int j = 0; j < techMatrix[i].Length; j++) { string name; TechType techType = techMatrix[i][j]; if (techType == TechType.SeaEmperorBaby) { name = Language.main.Get(TechTypeExtensions.AsString(TechType.SeaEmperorJuvenile, false)); } else if (techType == TechType.SeaEmperorJuvenile) { name = Language.main.Get(TechTypeExtensions.AsString(TechType.SeaEmperorBaby, false)); } else { name = Language.main.Get(TechTypeExtensions.AsString(techMatrix[i][j], false)); } TechnologyMatrix[i].Add(new TechTypeData(techType, name)); } } }
public static void Postfix(ref TechType __result) { if (__result == TechType.None) { return; } RecipeData recipeData; TechType techType2; bool eggCheck; while (!(eggCheck = TechTypeExtensions.FromString(__result.AsString() + "Egg", out techType2, true)) && (recipeData = CraftDataHandler.GetTechData(__result)) != null && recipeData.ingredientCount > 0) { try{ __result = recipeData.Ingredients.GetRandom().techType; } catch { // ignored } } if (eggCheck) { __result = techType2; } }
public override TechType ConvertFromSerial(string value) { if (TechTypeExtensions.FromString(value, out var tType, true)) { //SetNameAsComment(value, tType); return(tType); }
public void Start() { TechTypeExtensions.FromString("SpeedModule", out SpeedModule, true); ThisEquipment = ThisExosuit.modules; ThisEquipment.onAddItem += OnAddItem; ThisEquipment.onRemoveItem += OnRemoveItem; Main.Instance.onExosuitSpeedValueChanged.AddHandler(this, new Event <object> .HandleFunction(OnExosuitSpeedValueChanged)); Main.Instance.onPlayerMotorModeChanged.AddHandler(this, new Event <Player.MotorMode> .HandleFunction(OnPlayerMotorModeChanged)); }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { var tt = (string)serializer.Deserialize(reader, typeof(string)); return(TechTypeExtensions.FromString(tt, out var techType, true) ? techType : TechTypeHandler.TryGetModdedTechType(tt, out techType) ? techType : throw new Exception($"Failed to parse {tt} into a TechType.")); }
public void Start() { TechTypeExtensions.FromString("SpeedModule", out SpeedModule, true); ThisEquipment = ThisSeamoth.modules; ThisEquipment.onAddItem += OnAddItem; ThisEquipment.onRemoveItem += OnRemoveItem; Main.Instance.isSeamothCanFly.changedEvent.AddHandler(this, new Event <Utils.MonitoredValue <bool> > .HandleFunction(OnSeamothCanFlyChanged)); Main.Instance.onSeamothSpeedValueChanged.AddHandler(this, new Event <object> .HandleFunction(OnSeamothSpeedValueChanged)); Main.Instance.onPlayerMotorModeChanged.AddHandler(this, new Event <Player.MotorMode> .HandleFunction(OnPlayerMotorModeChanged)); }
private static void CreateDataboxesAndLoadFiles() { foreach (FileInfo file in DataboxFolder.GetFiles().Where((x) => x.Extension.ToLower() == ".json")) { try { DataboxInfo databox; using (var reader = new StreamReader(file.FullName)) { var serializer = new JsonSerializer(); databox = JsonConvert.DeserializeObject <DataboxInfo>(reader.ReadToEnd(), new JsonConverter[] { new StringEnumConverter() { #if SN1 CamelCaseText = true, #elif BZ NamingStrategy = new CamelCaseNamingStrategy(), #endif AllowIntegerValues = true }, new TechTypeConverter(), new Vector3Converter() }); } if (databox != null) { var tt = TechTypeExtensions.FromString(databox.ItemToUnlock, out var techType, true) ? techType : TechTypeHandler.TryGetModdedTechType(databox.ItemToUnlock, out techType) ? techType : TechType.None; if (tt != TechType.None) { var customDatabox = new DataboxPrefab(databox.DataboxID, databox.AlreadyUnlockedDescription, databox.PrimaryDescription, databox.SecondaryDescription, tt, databox.BiomesToSpawnIn, databox.CoordinatedSpawns); customDatabox.Patch(); } else { throw new Exception($"Couldn't parse {databox.ItemToUnlock} to TechType."); } } else { QModManager.Utility.Logger.Log(QModManager.Utility.Logger.Level.Error, $"Unable to load Custom Databox from {Path.GetDirectoryName(file.FullName)}!"); } } catch (Exception e) { QModManager.Utility.Logger.Log(QModManager.Utility.Logger.Level.Error, $"Unable to load Custom Databox from {Path.GetDirectoryName(file.FullName)}!", e); } } }
public void InitFullTechMatrixList(ref List <TechTypeData> TechMatrix) { int[] techTypeArray = (int[])Enum.GetValues(typeof(TechType)); for (int i = 0; i < techTypeArray.Length; i++) { TechType techType = (TechType)techTypeArray[i]; string name = Language.main.Get(TechTypeExtensions.AsString((TechType)techTypeArray[i], false)); TechMatrix.Add(new TechTypeData(techType, name)); } }
private static void LoadChangeFiles() { Dictionary <TechType, List <BiomeData> > modifiedDistributions = new Dictionary <TechType, List <BiomeData> >(); foreach (FileInfo file in ChangesPath.GetFiles().Where((x) => x.Extension.ToLower() == ".json")) { try { if (!file.Name.ToLower().Contains("disabled")) { SortedDictionary <string, List <BiomeData> > pairs; using (StreamReader reader = new StreamReader(file.FullName)) { pairs = JsonConvert.DeserializeObject <SortedDictionary <string, List <BiomeData> > >(reader.ReadToEnd(), new JsonConverter[] { new StringEnumConverter() { #if SUBNAUTICA_STABLE CamelCaseText = true, #else NamingStrategy = new CamelCaseNamingStrategy(), #endif AllowIntegerValues = true }, new TechTypeConverter() }) ?? new SortedDictionary <string, List <BiomeData> >(); } int Succeded = 0; foreach (KeyValuePair <string, List <BiomeData> > pair in pairs) { if (TechTypeExtensions.FromString(pair.Key, out TechType techType, true)) { if (modifiedDistributions.ContainsKey(techType)) { List <BiomeData> datas = modifiedDistributions[techType]; pair.Value.ForEach((x) => datas.Add(x)); datas.Distinct(); Succeded++; } else { modifiedDistributions[techType] = pair.Value; Succeded++; } } else { Logger.Log(Logger.Level.Debug, $"TechType: {pair.Key} not found --- do you have its mod installed?"); } } Logger.Log(Logger.Level.Debug, $"Successfully loaded file: {file.Name} with {Succeded} TechTypes being altered."); }
public void RegisterNewArm(CraftableSeaTruckArm armPrefab, ISeaTruckArmHandlerRequest armHandlerRequest) { if (ArmTechTypes.ContainsKey(armPrefab.TechType)) { return; } ArmTechTypes.Add(armPrefab.TechType, armPrefab.ArmTemplate); ArmHandlers.Add(armPrefab.TechType, armHandlerRequest); string techName = TechTypeExtensions.AsString(armPrefab.TechType); BZLogger.Log($"API message: New arm techtype registered, ID:[{(int)armPrefab.TechType}], name:[{techName}]"); }
private void CloneTopLevelModTab(string scheme, ref Dictionary <string, string> languageLines, ref Dictionary <string, Atlas.Sprite> group) { string clonedLangKey = string.Format(DisplayNameFormat, AioFabScheme, scheme); if (!languageLines.ContainsKey(clonedLangKey) && languageLines.TryGetValue(scheme, out string origString)) { languageLines[clonedLangKey] = origString; } string clonedSpriteKey = string.Format(TabSpriteFormat, AioFabScheme, scheme); if (TechTypeExtensions.FromString(scheme, out TechType techType, true)) { group[clonedSpriteKey] = SpriteManager.Get(techType); } }
public void Start() { TechTypeExtensions.FromString("SpeedModule", out SpeedModule, true); #if DEBUG_SEAMOTH_OVERDRIVE seamothID = gameObject.GetId(); Logger.Log($"[CheatManager]\nSeamothOverDrive.Start(): {seamothID}\nForwardForce: {seamoth.forwardForce}\nBackWardForce: {seamoth.backwardForce}\nVerticalForce: {seamoth.verticalForce}\nSidewardForce: {seamoth.sidewardForce}\nSidewaysTorque: {seamoth.sidewaysTorque}"); #endif Seamoth_forwardForce = seamoth.forwardForce; Seamoth_backwardForce = seamoth.backwardForce; Seamoth_sidewardForce = seamoth.sidewardForce; Seamoth_verticalForce = seamoth.verticalForce; seamothEquipment = seamoth.modules; seamothEquipment.onAddItem += SpeedModuleAddListener; seamothEquipment.onRemoveItem += SpeedModuleRemoveListener; }
public void IsExistsModdersTechTypes(ref List <TechTypeData>[] TechnologyMatrix, Dictionary <string, CATEGORY> dictionary) { foreach (KeyValuePair <string, CATEGORY> pair in dictionary) { if (pair.Value == CATEGORY.BaseModule) { continue; } if (TechTypeHandler.TryGetModdedTechType(pair.Key, out TechType techType)) { if (TechTypeExtensions.AsString(techType, false) == pair.Key) { TechnologyMatrix[(int)pair.Value].Add(new TechTypeData(techType, Language.main.Get(TechTypeExtensions.AsString(techType, false)))); } } } }
/// <summary> /// Populates a new ModCraftTreeRoot from a CraftNode tree. /// </summary> /// <param name="tree">The tree to create the ModCraftTreeRoot from.</param> /// <param name="root"></param> internal static void CreateFromExistingTree(CraftNode tree, ref ModCraftTreeLinkingNode root) { foreach (CraftNode node in tree) { if (node.action == TreeAction.Expand) { ModCraftTreeTab tab = root.AddTabNode(node.id); var thing = (ModCraftTreeLinkingNode)tab; CreateFromExistingTree(node, ref thing); } if (node.action == TreeAction.Craft) { TechTypeExtensions.FromString(node.id, out TechType techType, false); root.AddCraftingNode(techType); } } }
public void InitFullTechTypeList(ref List <TechTypeData> TechTypeList) { int[] techTypeArray = (int[])Enum.GetValues(typeof(TechType)); for (int i = 0; i < techTypeArray.Length; ++i) { TechType techType = (TechType)techTypeArray[i]; if (TechType_Blacklist.Contains(techType)) { continue; } string name = Language.main.Get(TechTypeExtensions.AsString((TechType)techTypeArray[i], false)); TechTypeList.Add(new TechTypeData(techType, name)); } TechTypeList.Sort(); }
public void Start() { TechTypeExtensions.FromString("SpeedModule", out SpeedModule, true); #if DEBUG_EXOSUIT_OVERDRIVE exosuitID = gameObject.GetId(); Logger.Log($"ExosuitOverDrive.Start(): {exosuitID}\nForwardForce: {exosuit.forwardForce}\nBackWardForce: {exosuit.backwardForce}\nVerticalForce: {exosuit.verticalForce}\nSidewardForce: {exosuit.sidewardForce}\nSidewaysTorque: {exosuit.sidewaysTorque}"); #endif Exosuit_forwardForce = exosuit.forwardForce; Exosuit_backwardForce = exosuit.backwardForce; Exosuit_sidewardForce = exosuit.sidewardForce; Exosuit_verticalForce = exosuit.verticalForce; prev_multiplier = 1; exosuitEquipment = exosuit.modules; exosuitEquipment.onAddItem += SpeedModuleAddListener; exosuitEquipment.onRemoveItem += SpeedModuleRemoveListener; }
internal static TechType ToTechType(this string value) { if (string.IsNullOrEmpty(value)) { return(TechType.None); } // Look for a known TechType if (TechTypeExtensions.FromString(value, out TechType tType, true)) { return(tType); } // Not one of the known TechTypes - is it registered with SMLHelper? if (TechTypeHandler.TryGetModdedTechType(value, out TechType custom)) { return(custom); } return(TechType.None); }
private static void ReplaceNodeTech(uGUI_CraftNode node) { if (node.action != TreeAction.Craft) { return; } if (!node.techType0.ToString().StartsWith("Defabricated") && RecyclingData.TryGet(node.techType0, out TechType recyclingTech)) { node.techType0 = recyclingTech; } else if (node.techType0.ToString().StartsWith("Defabricated")) { TechTypeExtensions.FromString(node.techType0.ToString().Replace("Defabricated", ""), out TechType original, true); node.techType0 = original; } else { ErrorMessage.AddMessage($"Failed to change {node.techType0}"); } }
private void CloneTopLevelModTab(string scheme, ref Dictionary <string, string> languageLines, ref Dictionary <string, Sprite> group) { string clonedLangKey = string.Format(DisplayNameFormat, AioFabScheme, scheme); if (!languageLines.ContainsKey(clonedLangKey) && languageLines.TryGetValue(scheme, out string origString)) { LanguageHandler.SetLanguageLine(clonedLangKey, origString); languageLines[clonedLangKey] = origString; } else { Console.WriteLine($"[AIOFabricator][WARN] Problem cloning language line for '{scheme}:root'{Environment.NewLine}Language resource not found"); } string clonedSpriteKey = string.Format(TabSpriteFormat, AioFabScheme, scheme); if (TechTypeExtensions.FromString(scheme, out TechType techType, true)) { var rootSprite = SpriteManager.Get(techType); SpriteHandler.RegisterSprite(SpriteManager.Group.Category, clonedSpriteKey, rootSprite); group[clonedSpriteKey] = rootSprite; }
private void SearchForModdedTechTypes() { int i = 0; int[] techTypeArray = (int[])Enum.GetValues(typeof(TechType)); for (int j = 0; j < techTypeArray.Length; j++) { if (techTypeArray[j] >= 11000) { TechType techType = (TechType)techTypeArray[j]; string techName = TechTypeExtensions.AsString(techType); EquipmentType equipmentType = TechData.GetEquipmentType(techType); FoundModdedTechTypes.Add(techName, techType); TypeDefCache.Add(techType, equipmentType); BZLogger.Log($"Modded techtype found! Name: [{techName}], ID: [{(int)techType}], Type: [{equipmentType}]"); i++; } } BZLogger.Log($"Found [{i}] modded TechType(s)."); }
internal void RegisterNewArm(CraftableModdedArm armPrefab, IArmModdingRequest armModdingRequest) { if (ModdedArmPrefabs.ContainsKey(armPrefab.TechType)) { return; } string techName = TechTypeExtensions.AsString(armPrefab.TechType); GameObject clonedArm = Instantiate(ArmsTemplateCache[armPrefab.ArmTemplate], InactiveCache.transform); clonedArm.name = techName; clonedArm.SetActive(false); SetupHelper graphicsHelper = clonedArm.AddComponent <SetupHelper>(); ArmTag armTag = clonedArm.AddComponent <ArmTag>(); armTag.armType = armPrefab.ArmType; armTag.armTemplate = armPrefab.ArmTemplate; armTag.techType = armPrefab.TechType; armModdingRequest.SetUpArm(clonedArm, graphicsHelper); if (armPrefab.ArmType == ArmType.ExosuitArm) { armModdingRequest.GetExosuitArmHandler(clonedArm); } else { armModdingRequest.GetSeamothArmHandler(clonedArm); } ModdedArmPrefabs.Add(armPrefab.TechType, clonedArm); SNLogger.Log($"New {armPrefab.ArmType} registered: TechType ID: [{(int)armPrefab.TechType}], TechType name: [{techName}]"); }
public void InitTechMatrixList(ref List <TechTypeData>[] TechnologyMatrix) { int i = 0; foreach (KeyValuePair <TechCategory, TechType[]> kvp in baseTechMatrix) { if (Enum.IsDefined(typeof(Categories), (int)kvp.Key)) { TechnologyMatrix[i] = new List <TechTypeData>(); for (int j = 0; j < kvp.Value.Length; j++) { string name; TechType techType = kvp.Value[j]; name = Language.main.Get(TechTypeExtensions.AsString(kvp.Value[j], false)); TechnologyMatrix[i].Add(new TechTypeData(techType, name)); } i++; } } }
public static bool Prefix(LootDistributionData __instance, BiomeType biome, ref bool __result, out LootDistributionData.DstData data) { if (customDSTDistribution.Count == 0 || Config.RegenSpawns) { Config.techProbability = new SortedList <string, float>(); customDSTDistribution = new SortedDictionary <BiomeType, LootDistributionData.DstData>(); foreach (BiomeType bio in Enum.GetValues(typeof(BiomeType))) { string x = bio.AsString().Split('_').GetLast <string>(); techs = new SortedDictionary <TechType, LootDistributionData.PrefabData>(); if (__instance.dstDistribution.ContainsKey(bio)) { if (!Config.resetDefaults) { foreach (TechType type in Enum.GetValues(typeof(TechType))) { string tech0 = TechTypeExtensions.GetOrFallback(Language.main, type, type) + "| " + bio.AsString().Split('_')[0]; if (PlayerPrefs.HasKey(tech0 + ":TechProbability")) { Config.techProbability[tech0] = PlayerPrefs.GetFloat(tech0 + ":TechProbability"); } } } customDSTDistribution[bio] = new LootDistributionData.DstData(); customDSTDistribution[bio].prefabs = new List <LootDistributionData.PrefabData>(); foreach (BiomeType b in Enum.GetValues(typeof(BiomeType))) { if (Config.Randomization && __instance.dstDistribution.TryGetValue(b, out var d)) { foreach (LootDistributionData.PrefabData prefabData in d.prefabs) { if (prefabData.classId.ToLower() != "none") { WorldEntityInfo wei; if (WorldEntityDatabase.TryGetInfo(prefabData.classId, out wei) && prefabData.probability > 0 && prefabData.probability < 1) { if (!bio.AsString().Contains("Fragment") && wei.slotType == EntitySlot.Type.Creature) { if (wei.techType == TechType.ReaperLeviathan) { bool check = false; foreach (LootDistributionData.PrefabData prefab in __instance.dstDistribution[bio].prefabs) { WorldEntityInfo wei2; if (WorldEntityDatabase.TryGetInfo(prefab.classId, out wei2)) { if (wei2.techType == TechType.Sandshark || wei2.techType == TechType.BoneShark || wei2.techType == TechType.SpineEel || wei2.techType == TechType.Shocker || wei2.techType == TechType.CrabSquid || wei2.techType == TechType.LavaLizard || wei2.techType == TechType.WarperSpawner) { check = true; } } } if (check) { if (!techs.ContainsKey(wei.techType)) { if (Config.techProbability.ContainsKey(TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0])) { prefabData.probability = Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] / 1000; techs[wei.techType] = prefabData; customDSTDistribution[bio].prefabs.Add(prefabData); continue; } else { techs[wei.techType] = prefabData; prefabData.probability = 0.0025f; Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 1000; customDSTDistribution[bio].prefabs.Add(prefabData); continue; } } } } if (wei.techType == TechType.Shocker || wei.techType == TechType.CrabSquid || wei.techType == TechType.WarperSpawner) { bool check = false; foreach (LootDistributionData.PrefabData prefab in __instance.dstDistribution[bio].prefabs) { WorldEntityInfo wei2; if (WorldEntityDatabase.TryGetInfo(prefab.classId, out wei2)) { if (wei2.techType == TechType.Sandshark || wei2.techType == TechType.BoneShark || wei2.techType == TechType.SpineEel || wei2.techType == TechType.Shocker || wei2.techType == TechType.CrabSquid || wei2.techType == TechType.Crabsnake || wei2.techType == TechType.LavaLizard) { check = true; } } } if (check) { if (!techs.ContainsKey(wei.techType)) { if (Config.techProbability.ContainsKey(TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0])) { prefabData.probability = Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] / 100; techs[wei.techType] = prefabData; customDSTDistribution[bio].prefabs.Add(prefabData); continue; } else { Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100; techs[wei.techType] = prefabData; customDSTDistribution[bio].prefabs.Add(prefabData); continue; } } else { if (((techs[wei.techType].probability > prefabData.probability && prefabData.count >= techs[wei.techType].count) || (techs[wei.techType].probability >= prefabData.probability && prefabData.count > techs[wei.techType].count)) && prefabData.probability > 0 && prefabData.probability < 1 && prefabData.count > 0) { Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100; techs[wei.techType] = prefabData; customDSTDistribution[bio].prefabs.Add(prefabData); continue; } } } } if (wei.techType == TechType.Mesmer) { bool check = false; foreach (LootDistributionData.PrefabData prefab in __instance.dstDistribution[bio].prefabs) { WorldEntityInfo wei2; if (WorldEntityDatabase.TryGetInfo(prefabData.classId, out wei2)) { if (BehaviourData.GetBehaviourType(wei2.techType) == BehaviourType.SmallFish || wei2.techType == TechType.Peeper || wei2.techType == TechType.Mesmer) { check = true; break; } } } if (check) { if (!techs.ContainsKey(wei.techType)) { if (Config.techProbability.ContainsKey(TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0])) { prefabData.probability = Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] / 100; techs[wei.techType] = prefabData; customDSTDistribution[bio].prefabs.Add(prefabData); continue; } else { Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100; techs[wei.techType] = prefabData; customDSTDistribution[bio].prefabs.Add(prefabData); continue; } } else { if (((techs[wei.techType].probability > prefabData.probability && prefabData.count >= techs[wei.techType].count) || (techs[wei.techType].probability >= prefabData.probability && prefabData.count > techs[wei.techType].count)) && prefabData.probability > 0 && prefabData.probability < 1 && prefabData.count > 0) { Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100; techs[wei.techType] = prefabData; customDSTDistribution[bio].prefabs.Add(prefabData); continue; } } } } } else if (wei.techType != TechType.None && !bio.AsString().Contains("Fragment") && wei.techType.AsString().Contains("Chunk")) { bool check = false; foreach (LootDistributionData.PrefabData prefab in __instance.dstDistribution[bio].prefabs) { WorldEntityInfo wei2; if (WorldEntityDatabase.TryGetInfo(prefab.classId, out wei2)) { if (wei2.techType == TechType.LimestoneChunk || wei2.techType == TechType.SandstoneChunk || wei2.techType == TechType.ShaleChunk) { check = true; break; } } } if (check) { if (!techs.ContainsKey(wei.techType)) { if (Config.techProbability.ContainsKey(TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0])) { prefabData.probability = Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] / 100; techs[wei.techType] = prefabData; customDSTDistribution[bio].prefabs.Add(prefabData); continue; } else { Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100; techs[wei.techType] = prefabData; customDSTDistribution[bio].prefabs.Add(prefabData); continue; } } else { if (((techs[wei.techType].probability > prefabData.probability && prefabData.count >= techs[wei.techType].count) || (techs[wei.techType].probability >= prefabData.probability && prefabData.count > techs[wei.techType].count)) && prefabData.probability > 0 && prefabData.probability < 1 && prefabData.count > 0) { Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100; techs[wei.techType] = prefabData; customDSTDistribution[bio].prefabs.Add(prefabData); continue; } } } } else if (wei.techType != TechType.None && !bio.AsString().Contains("Fragment") && (wei.techType == TechType.AluminumOxide || wei.techType == TechType.BloodOil || wei.techType == TechType.Sulphur || wei.techType == TechType.Diamond || wei.techType == TechType.Kyanite || wei.techType == TechType.Lead || wei.techType == TechType.Lithium || wei.techType == TechType.Magnetite || wei.techType == TechType.Nickel || wei.techType == TechType.Quartz || wei.techType == TechType.Silver)) { bool check = false; foreach (LootDistributionData.PrefabData prefab in __instance.dstDistribution[bio].prefabs) { WorldEntityInfo wei2; if (WorldEntityDatabase.TryGetInfo(prefab.classId, out wei2)) { if (wei2.techType == TechType.AluminumOxide || wei2.techType == TechType.BloodOil || wei2.techType == TechType.Sulphur || wei2.techType == TechType.Diamond || wei2.techType == TechType.Kyanite || wei2.techType == TechType.Lead || wei2.techType == TechType.Lithium || wei2.techType == TechType.Magnetite || wei2.techType == TechType.Nickel || wei2.techType == TechType.Salt || wei2.techType == TechType.Silver) { check = true; break; } } } if (check) { if (!techs.ContainsKey(wei.techType)) { if (Config.techProbability.ContainsKey(TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0])) { prefabData.probability = Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] / 100; techs[wei.techType] = prefabData; customDSTDistribution[bio].prefabs.Add(prefabData); continue; } else { Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100; techs[wei.techType] = prefabData; customDSTDistribution[bio].prefabs.Add(prefabData); continue; } } else { if (((techs[wei.techType].probability > prefabData.probability && prefabData.count >= techs[wei.techType].count) || (techs[wei.techType].probability >= prefabData.probability && prefabData.count > techs[wei.techType].count)) && prefabData.probability > 0 && prefabData.probability < 1 && prefabData.count > 0) { Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100; techs[wei.techType] = prefabData; customDSTDistribution[bio].prefabs.Add(prefabData); continue; } } } } else if (wei.techType != TechType.None && !bio.AsString().Contains("Fragment") && wei.techType.AsString().Contains("Drillable")) { bool check = false; foreach (LootDistributionData.PrefabData prefab in __instance.dstDistribution[bio].prefabs) { WorldEntityInfo wei2; if (WorldEntityDatabase.TryGetInfo(prefab.classId, out wei2)) { if (wei2.techType.AsString().Contains("Drillable")) { check = true; break; } } } if (check) { if (!techs.ContainsKey(wei.techType)) { if (Config.techProbability.ContainsKey(TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0])) { prefabData.probability = Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] / 100; techs[wei.techType] = prefabData; customDSTDistribution[bio].prefabs.Add(prefabData); continue; } else { Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100; techs[wei.techType] = prefabData; customDSTDistribution[bio].prefabs.Add(prefabData); continue; } } else { if (((techs[wei.techType].probability > prefabData.probability && prefabData.count >= techs[wei.techType].count) || (techs[wei.techType].probability >= prefabData.probability && prefabData.count > techs[wei.techType].count)) && prefabData.probability > 0 && prefabData.probability < 1 && prefabData.count > 0) { Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100; techs[wei.techType] = prefabData; customDSTDistribution[bio].prefabs.Add(prefabData); continue; } } } } else if (((!bio.AsString().Contains("Fragment") && !b.AsString().Contains("Fragment")) || (bio.AsString().Contains("Fragment") && b.AsString().Contains("Fragment"))) && wei.techType.AsString().Contains("Fragment")) { bool check = false; foreach (LootDistributionData.PrefabData prefab in __instance.dstDistribution[bio].prefabs) { WorldEntityInfo wei2; if (WorldEntityDatabase.TryGetInfo(prefab.classId, out wei2)) { if (wei2.techType.AsString().Contains("Fragment")) { check = true; break; } } } if (check) { if (!techs.ContainsKey(wei.techType)) { if (Config.techProbability.ContainsKey(TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0])) { prefabData.probability = Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] / 100; techs[wei.techType] = prefabData; customDSTDistribution[bio].prefabs.Add(prefabData); continue; } else { Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100; techs[wei.techType] = prefabData; customDSTDistribution[bio].prefabs.Add(prefabData); continue; } } else { if (((techs[wei.techType].probability > prefabData.probability && prefabData.count >= techs[wei.techType].count) || (techs[wei.techType].probability >= prefabData.probability && prefabData.count > techs[wei.techType].count)) && prefabData.probability > 0 && prefabData.probability < 1 && prefabData.count > 0 && !bio.AsString().Contains("Fragment") && !b.AsString().Contains("Fragment")) { Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100; techs[wei.techType] = prefabData; customDSTDistribution[bio].prefabs.Add(prefabData); continue; } } } } else if (!bio.AsString().Contains("Fragment") && wei.techType == TechType.TimeCapsule) { bool check = false; foreach (LootDistributionData.PrefabData prefab in __instance.dstDistribution[b].prefabs) { WorldEntityInfo wei2; if (WorldEntityDatabase.TryGetInfo(prefab.classId, out wei2)) { if (wei2.techType.AsString().Contains("Fragment")) { check = true; break; } } } if (check) { if (!techs.ContainsKey(wei.techType)) { if (Config.techProbability.ContainsKey(TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0])) { prefabData.probability = Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] / 1000; techs[wei.techType] = prefabData; customDSTDistribution[bio].prefabs.Add(prefabData); continue; } else { Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 1000; techs[wei.techType] = prefabData; customDSTDistribution[bio].prefabs.Add(prefabData); continue; } } else { if (((techs[wei.techType].probability > prefabData.probability && prefabData.count >= techs[wei.techType].count) || (techs[wei.techType].probability >= prefabData.probability && prefabData.count > techs[wei.techType].count)) && prefabData.probability > 0 && prefabData.probability < 1 && prefabData.count > 0) { Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 1000; techs[wei.techType] = prefabData; customDSTDistribution[bio].prefabs.Add(prefabData); continue; } } } } } } } } } foreach (LootDistributionData.PrefabData prefabData in __instance.dstDistribution[bio].prefabs) { WorldEntityInfo wei; if (WorldEntityDatabase.TryGetInfo(prefabData.classId, out wei) && prefabData.probability > 0 && prefabData.probability < 1) { if (wei.techType != TechType.None) { if (!Config.techProbability.ContainsKey(TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0])) { Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100; techs[wei.techType] = prefabData; customDSTDistribution[bio].prefabs.Add(prefabData); continue; } else { prefabData.probability = Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] / 100; techs[wei.techType] = prefabData; customDSTDistribution[bio].prefabs.Add(prefabData); continue; } } else { customDSTDistribution[bio].prefabs.Add(prefabData); continue; } } else { customDSTDistribution[bio].prefabs.Add(prefabData); } } } } if (Config.RegenSpawns) { Config.resetDefaults = false; Config.RegenSpawns = false; IngameMenu.main.Open(); IngameMenu.main.ChangeSubscreen("Options"); } } __result = customDSTDistribution.TryGetValue(biome, out data); return(!(__result)); }
private void OnLoadFilterGrid(DisplayData data) { try { if (_isBeingDestroyed) { return; } QuickLogger.Debug($"OnLoadFilterGrid : {data.ItemsGrid}", true); //_filterGrid.ClearPage(); if (_trackedFilterState.Count <= 0) { var grouped = _mono.OreGenerator.AllowedOres; for (int i = 0; i < grouped.Count; i++) { GameObject buttonPrefab = Instantiate(data.ItemsPrefab); if (buttonPrefab == null || data.ItemsGrid == null) { if (buttonPrefab != null) { Destroy(buttonPrefab); } return; } buttonPrefab.transform.SetParent(data.ItemsGrid.transform, false); var toggle = buttonPrefab.GetComponent <Toggle>(); toggle.isOn = false; buttonPrefab.SetActive(false); var oreIndex = i; toggle.onValueChanged.AddListener(delegate { OnButtonClick("FilterToggleBTN", new FilterBtnData { TechType = grouped.ElementAt(oreIndex), Toggle = toggle }); }); var itemName = buttonPrefab.GetComponentInChildren <Text>(); itemName.text = TechTypeExtensions.Get(Language.main, grouped.ElementAt(i)); if (_trackedFilterState.ContainsKey(grouped.ElementAt(i))) { toggle.isOn = _trackedFilterState[grouped.ElementAt(i)].isOn; } else { _trackedFilterState.Add(grouped.ElementAt(i), toggle); } } } foreach (KeyValuePair <TechType, Toggle> toggle in _trackedFilterState) { toggle.Value.gameObject.SetActive(false); } var trackedFilterState = _trackedFilterState; if (data.EndPosition > trackedFilterState.Count) { data.EndPosition = trackedFilterState.Count; } for (int i = data.StartPosition; i < data.EndPosition; i++) { _trackedFilterState.ElementAt(i).Value.gameObject.SetActive(true); } _filterGrid.UpdaterPaginator(_trackedFilterState.Count); } catch (Exception e) { QuickLogger.Error("Error Caught"); QuickLogger.Error($"Error Message: {e.Message}"); QuickLogger.Error($"Error StackTrace: {e.StackTrace}"); } }
public void GetModdedTechTypes(ref List <TechTypeData>[] TechnologyMatrix) { ModdedTechTypeHelper mHelper = new ModdedTechTypeHelper(); foreach (KeyValuePair <string, TechType> kvp in mHelper.FoundModdedTechTypes) { EquipmentType equipmentType = mHelper.TypeDefCache[kvp.Value]; switch (equipmentType) { case EquipmentType.CyclopsModule: case EquipmentType.ExosuitArm: case EquipmentType.ExosuitModule: case EquipmentType.SeamothModule: case EquipmentType.VehicleModule: case (EquipmentType)100: TechnologyMatrix[(int)TechCategory.Upgrades].Add(new TechTypeData(kvp.Value, Language.main.Get(TechTypeExtensions.AsString(kvp.Value, false)))); break; } } SNLogger.Debug("CheatManager", "Modded TechTypes checked and added."); }
public static TechType GetTechType(string value) { if (TechTypeExtensions.FromString(value, out TechType tType, true)) { return(tType); }
public static void OnGameStart() { LoadConfig(); warpCannonTechType = TechTypePatcher.AddTechType(WARP_CANNON_CLASS_ID, "Warp Cannon", "A tool that allows you to warp 30 meters using Warper technology."); warpScalesTechType = TechTypePatcher.AddTechType(WARP_SCALE_CLASS_ID, "Warp Scale", "A resource obtained from warpers that can be used to craft Warp Batteries."); warpBatteryTechType = TechTypePatcher.AddTechType(WARP_BATTERY_CLASS_ID, "Warp Battery", "A battery that powers Warp Cannons."); customTechTypes.Add(WARP_CANNON_CLASS_ID, warpCannonTechType); customTechTypes.Add(WARP_BATTERY_CLASS_ID, warpBatteryTechType); customTechTypes.Add(WARP_SCALE_CLASS_ID, warpScalesTechType); var warpCannonData = new TechDataHelper(); var warpBatteryData = new TechDataHelper(); foreach (var techType in IngredientsConfig) { if (techType.Key == "WarpCannon") { warpCannonData._craftAmount = techType.Value.CraftAmount; warpCannonData._techType = warpCannonTechType; warpCannonData._ingredients = new List <IngredientHelper>(); foreach (var ingredient in techType.Value.Ingredients) { var ingredientTech = default(TechType); if (TechTypeExtensions.FromString(ingredient.ItemName, out ingredientTech, false)) { warpCannonData._ingredients.Add(new IngredientHelper(ingredientTech, ingredient.Amount)); } else if (customTechTypes.TryGetValue(ingredient.ItemName, out ingredientTech)) { warpCannonData._ingredients.Add(new IngredientHelper(ingredientTech, ingredient.Amount)); } } } if (techType.Key == "WarpBattery") { warpBatteryData._craftAmount = techType.Value.CraftAmount; warpBatteryData._techType = warpBatteryTechType; warpBatteryData._ingredients = new List <IngredientHelper>(); foreach (var ingredient in techType.Value.Ingredients) { var ingredientTech = default(TechType); if (TechTypeExtensions.FromString(ingredient.ItemName, out ingredientTech, false)) { warpBatteryData._ingredients.Add(new IngredientHelper(ingredientTech, ingredient.Amount)); } else if (customTechTypes.TryGetValue(ingredient.ItemName, out ingredientTech)) { warpBatteryData._ingredients.Add(new IngredientHelper(ingredientTech, ingredient.Amount)); } } } } CraftDataPatcher.customTechData.Add(warpCannonTechType, warpCannonData); CraftDataPatcher.customTechData.Add(warpBatteryTechType, warpBatteryData); CraftDataPatcher.customEquipmentTypes.Add(warpCannonTechType, EquipmentType.Hand); CraftDataPatcher.customItemSizes.Add(warpCannonTechType, new Vector2int(2, 2)); CraftDataPatcher.customHarvestTypeList.Add(TechType.Warper, HarvestType.DamageAlive); CraftDataPatcher.customHarvestOutputList.Add(TechType.Warper, warpScalesTechType); CraftTreePatcher.customCraftNodes.Add("Personal/Tools/WarpCannon", warpCannonTechType); CraftTreePatcher.customCraftNodes.Add("Resources/Electronics/WarpBattery", warpBatteryTechType); // Load AssetBundle AssetBundle = AssetBundle.LoadFromFile(Path.Combine("./QMods/WarpCannon/", "warpcannon.assets")); if (AssetBundle == null) { return; } // Load GameObjects // Load Battery var warpCannonBattery = AssetBundle.LoadAsset <GameObject>("WarpBattery") as GameObject; Utility.AddBasicComponents(ref warpCannonBattery, "WarpBattery"); warpCannonBattery.AddComponent <Pickupable>(); warpCannonBattery.AddComponent <Battery>(); warpCannonBattery.AddComponent <TechTag>().type = warpBatteryTechType; CustomPrefabHandler.customPrefabs.Add(new CustomPrefab("WarpBattery", "WorldEntities/Tools/WarpBattery", warpCannonBattery, warpBatteryTechType)); // Load Warp Cannon var warpCannon = AssetBundle.LoadAsset <GameObject>("WarpCannon"); Utility.AddBasicComponents(ref warpCannon, WARP_CANNON_CLASS_ID); warpCannon.AddComponent <Pickupable>(); warpCannon.AddComponent <TechTag>().type = warpCannonTechType; var fabricating = warpCannon.FindChild("3rd person model").AddComponent <VFXFabricating>(); fabricating.localMinY = -0.4f; fabricating.localMaxY = 0.2f; fabricating.posOffset = new Vector3(-0.054f, 0.223f, -0.06f); fabricating.eulerOffset = new Vector3(-44.86f, 90f, 0f); fabricating.scaleFactor = 1; var energyMixin = warpCannon.AddComponent <EnergyMixin>(); energyMixin.defaultBattery = warpBatteryTechType; energyMixin.storageRoot = warpCannon.FindChild("3rd person model").AddComponent <ChildObjectIdentifier>(); energyMixin.compatibleBatteries = new List <TechType> { warpBatteryTechType }; energyMixin.allowBatteryReplacement = true; energyMixin.batteryModels = (new List <EnergyMixin.BatteryModels>() { new EnergyMixin.BatteryModels() { techType = warpBatteryTechType, model = warpCannonBattery } }).ToArray(); var warpCannonComponent = warpCannon.AddComponent <WarpCannon>(); warpCannonComponent.Init(); warpCannonComponent.mainCollider = warpCannon.AddComponent <BoxCollider>(); warpCannonComponent.ikAimRightArm = true; warpCannonComponent.useLeftAimTargetOnPlayer = true; CustomPrefabHandler.customPrefabs.Add(new CustomPrefab(WARP_CANNON_CLASS_ID, "WorldEntities/Tools/WarpCannon", warpCannon, warpCannonTechType)); // Load Sprites var warpCannonSprite = AssetBundle.LoadAsset <Sprite>("Warp_Cannon"); var warpScalesSprite = AssetBundle.LoadAsset <Sprite>("Warp_Scale"); var warpBatterySprite = AssetBundle.LoadAsset <Sprite>("Warp_Battery"); CustomSpriteHandler.customSprites.Add(new CustomSprite(warpCannonTechType, warpCannonSprite)); CustomSpriteHandler.customSprites.Add(new CustomSprite(warpScalesTechType, warpScalesSprite)); CustomSpriteHandler.customSprites.Add(new CustomSprite(warpBatteryTechType, warpBatterySprite)); }
// Loads configuration from Config.txt file. public static void LoadConfiguration() { // Get config file path string codeBase = Assembly.GetExecutingAssembly().CodeBase; UriBuilder uri = new UriBuilder(codeBase); string path = Uri.UnescapeDataString(uri.Path); string currentDir = Path.GetDirectoryName(path); string configFilePath = currentDir + "/Config.txt"; Logger.Log("Loading configuration from \"" + configFilePath + "\"..."); // Retrieve config if (File.Exists(configFilePath)) { string configFile = File.ReadAllText(configFilePath); string[] configLines = configFile.Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); foreach (string configStr in configLines) { if (!configStr.StartsWith("#") && configStr.Contains("=")) { string[] configElem = configStr.Split("=".ToCharArray(), StringSplitOptions.None); if (configElem != null && configElem.Length == 2) { string configKey = configElem[0].Trim(); string configValueStr = configElem[1].Trim(); bool configValue = (configValueStr.CompareTo("true") == 0); switch (configKey) { case "enablePlaceItems": ConfigSwitcher.EnablePlaceItems = configValue; break; case "enablePlaceBatteries": ConfigSwitcher.EnablePlaceBatteries = configValue; break; case "enableSpecialItems": ConfigSwitcher.EnableSpecialItems = configValue; break; case "enableNutrientBlock": ConfigSwitcher.EnableNutrientBlock = configValue; break; case "asBuildable_SpecimenAnalyzer": ConfigSwitcher.SpecimenAnalyzer_asBuildable = configValue; break; case "asBuildable_MarkiplierDoll1": ConfigSwitcher.MarkiDoll1_asBuildable = configValue; break; case "asBuildable_MarkiplierDoll2": ConfigSwitcher.MarkiDoll2_asBuildable = configValue; break; case "asBuildable_JackSepticEyeDoll": ConfigSwitcher.JackSepticEye_asBuildable = configValue; break; case "asBuildable_EatMyDictionDoll": ConfigSwitcher.EatMyDiction_asBuidable = configValue; break; case "asBuildable_ForkliftToy": ConfigSwitcher.Forklift_asBuidable = configValue; break; case "asBuildable_SofaSmall": ConfigSwitcher.SofaStr1_asBuidable = configValue; break; case "asBuildable_SofaMedium": ConfigSwitcher.SofaStr2_asBuidable = configValue; break; case "asBuildable_SofaBig": ConfigSwitcher.SofaStr3_asBuidable = configValue; break; case "asBuildable_SofaCorner": ConfigSwitcher.SofaCorner2_asBuidable = configValue; break; case "asBuildable_LabCart": ConfigSwitcher.LabCart_asBuildable = configValue; break; case "asBuildable_EmptyDesk": ConfigSwitcher.EmptyDesk_asBuildable = configValue; break; case "flora_RecipiesResource": TechType tmpresource = TechType.None; if (TechTypeExtensions.FromString(configValueStr, out tmpresource, true) && tmpresource != TechType.None) { ConfigSwitcher.FloraRecipiesResource = tmpresource; } else { Logger.Log("Warning: \"" + configValueStr + "\" is not a valid resource type for flora recipies. Default resource will be set."); } break; case "config_LandTree": GetFloraConfig(ConfigSwitcher.config_LandTree1, configValueStr); break; case "config_JungleTreeA": GetFloraConfig(ConfigSwitcher.config_JungleTree1, configValueStr); break; case "config_JungleTreeB": GetFloraConfig(ConfigSwitcher.config_JungleTree2, configValueStr); break; case "config_TropicalTreeA": GetFloraConfig(ConfigSwitcher.config_TropicalTreeA, configValueStr); break; case "config_TropicalTreeB": GetFloraConfig(ConfigSwitcher.config_TropicalTreeB, configValueStr); break; case "config_TropicalTreeC": GetFloraConfig(ConfigSwitcher.config_TropicalTreeC, configValueStr); break; case "config_TropicalTreeD": GetFloraConfig(ConfigSwitcher.config_TropicalTreeD, configValueStr); break; case "config_LandPlantRedA": GetFloraConfig(ConfigSwitcher.config_LandPlant1, configValueStr); break; case "config_LandPlantRedB": GetFloraConfig(ConfigSwitcher.config_LandPlant2, configValueStr); break; case "config_LandPlantA": GetFloraConfig(ConfigSwitcher.config_LandPlant3, configValueStr); break; case "config_LandPlantB": GetFloraConfig(ConfigSwitcher.config_LandPlant4, configValueStr); break; case "config_LandPlantC": GetFloraConfig(ConfigSwitcher.config_LandPlant5, configValueStr); break; case "config_FernA": GetFloraConfig(ConfigSwitcher.config_Fern2, configValueStr); break; case "config_FernB": GetFloraConfig(ConfigSwitcher.config_Fern4, configValueStr); break; case "config_TropicalPlantA": GetFloraConfig(ConfigSwitcher.config_TropicalPlantA, configValueStr); break; case "config_TropicalPlantB": GetFloraConfig(ConfigSwitcher.config_TropicalPlantB, configValueStr); break; case "config_TropicalPlantC": GetFloraConfig(ConfigSwitcher.config_TropicalPlantC, configValueStr); break; case "config_TropicalPlantD": GetFloraConfig(ConfigSwitcher.config_TropicalPlantD, configValueStr); break; case "config_TropicalPlantE": GetFloraConfig(ConfigSwitcher.config_TropicalPlantE, configValueStr); break; case "config_TropicalPlantF": GetFloraConfig(ConfigSwitcher.config_TropicalPlantF, configValueStr); break; case "config_TropicalPlantG": GetFloraConfig(ConfigSwitcher.config_TropicalPlantG, configValueStr); break; case "config_TropicalPlantH": GetFloraConfig(ConfigSwitcher.config_TropicalPlantH, configValueStr); break; case "config_CrabClawKelpA": GetFloraConfig(ConfigSwitcher.config_CrabClawKelp2, configValueStr); break; case "config_CrabClawKelpB": GetFloraConfig(ConfigSwitcher.config_CrabClawKelp1, configValueStr); break; case "config_CrabClawKelpC": GetFloraConfig(ConfigSwitcher.config_CrabClawKelp3, configValueStr); break; case "config_PyroCoralA": GetFloraConfig(ConfigSwitcher.config_PyroCoral1, configValueStr); break; case "config_PyroCoralB": GetFloraConfig(ConfigSwitcher.config_PyroCoral2, configValueStr); break; case "config_PyroCoralC": GetFloraConfig(ConfigSwitcher.config_PyroCoral3, configValueStr); break; case "config_CoveTree": GetFloraConfig(ConfigSwitcher.config_CoveTree1, configValueStr); break; case "config_SpottedReedsA": GetFloraConfig(ConfigSwitcher.config_GreenReeds1, configValueStr); break; case "config_SpottedReedsB": GetFloraConfig(ConfigSwitcher.config_GreenReeds6, configValueStr); break; case "config_BrineLily": GetFloraConfig(ConfigSwitcher.config_LostRiverPlant2, configValueStr); break; case "config_LostRiverPlant": GetFloraConfig(ConfigSwitcher.config_LostRiverPlant4, configValueStr); break; case "config_CoralReefPlantMiddle": GetFloraConfig(ConfigSwitcher.config_PlantMiddle11, configValueStr); break; case "config_SmallMushroomsDeco": GetFloraConfig(ConfigSwitcher.config_SmallDeco3, configValueStr); break; case "config_FloatingStone": GetFloraConfig(ConfigSwitcher.config_FloatingStone1, configValueStr); break; case "config_BrownCoralTubesA": GetFloraConfig(ConfigSwitcher.config_BrownCoralTubes1, configValueStr); break; case "config_BrownCoralTubesB": GetFloraConfig(ConfigSwitcher.config_BrownCoralTubes2, configValueStr); break; case "config_BrownCoralTubesC": GetFloraConfig(ConfigSwitcher.config_BrownCoralTubes3, configValueStr); break; case "config_BlueCoralTubes": GetFloraConfig(ConfigSwitcher.config_BlueCoralTubes1, configValueStr); break; case "config_PurplePinecone": GetFloraConfig(ConfigSwitcher.config_SmallDeco10, configValueStr); break; case "config_CoralPlantYellow": GetFloraConfig(ConfigSwitcher.config_SmallDeco11, configValueStr); break; case "config_CoralPlantGreen": GetFloraConfig(ConfigSwitcher.config_SmallDeco13, configValueStr); break; case "config_CoralPlantBlue": GetFloraConfig(ConfigSwitcher.config_SmallDeco14, configValueStr); break; case "config_CoralPlantRed": GetFloraConfig(ConfigSwitcher.config_SmallDeco15Red, configValueStr); break; case "config_CoralPlantPurple": GetFloraConfig(ConfigSwitcher.config_SmallDeco17Purple, configValueStr); break; case "addRegularAirSeeds": ConfigSwitcher.EnableRegularAirSeeds = configValue; break; case "addRegularWaterSeeds": ConfigSwitcher.EnableRegularWaterSeeds = configValue; break; case "GhostLeviatan_enable": GhostLeviatan_enable = configValue; break; case "GhostLeviatan_maxSpawns": int.TryParse(configValueStr, out ConfigSwitcher.GhostLeviatan_maxSpawns); break; case "GhostLeviatan_timeBeforeFirstSpawn": float.TryParse(configValueStr, out ConfigSwitcher.GhostLeviatan_timeBeforeFirstSpawn); break; case "GhostLeviatan_spawnTimeRatio": float.TryParse(configValueStr, out ConfigSwitcher.GhostLeviatan_spawnTimeRatio); break; case "GhostLeviatan_health": float.TryParse(configValueStr, out ConfigSwitcher.GhostLeviatan_health); break; case "language": if (configValueStr.CompareTo("fr") == 0) { LanguageHelper.UserLanguage = RegionHelper.CountryCode.FR; } else if (configValueStr.CompareTo("es") == 0) { LanguageHelper.UserLanguage = RegionHelper.CountryCode.ES; } else if (configValueStr.CompareTo("tr") == 0) { LanguageHelper.UserLanguage = RegionHelper.CountryCode.TR; } else if (configValueStr.CompareTo("en") == 0) { LanguageHelper.UserLanguage = RegionHelper.CountryCode.EN; } // else, do nothing (uses default language from Windows current Culture) break; default: break; } } } } } else { Logger.Log("Warning: Cannot find config file. Default options will be set."); } }