From 0068222d8794854c441f276e6dd4ebdf8f7a5333 Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 12 Nov 2018 19:28:25 -0800 Subject: [PATCH] All have Separate DLLs now, just need to remove the combo mod :) --- .../CustomHero-Mod/CustomHero-Mod.csproj | 92 +++++++ .../CustomHero-Mod/CustomHeroMod.cs | 260 ++++++++++++++++++ .../CustomHero-Mod/Properties/AssemblyInfo.cs | 36 +++ DotE_Patch_Mod/DotE_Patch_Mod.sln | 30 ++ .../DustGenerator-Mod.csproj | 92 +++++++ .../DustGenerator-Mod/DustGeneratorMod.cs | 67 +++++ .../Properties/AssemblyInfo.cs | 36 +++ .../AllowDustChangingWithCrystalMod.cs | 59 ++++ .../DustWithCrystal-Mod.csproj | 92 +++++++ .../Properties/AssemblyInfo.cs | 36 +++ .../ExitFinder-Mod/ExitFinder-Mod.csproj | 92 +++++++ .../ExitFinder-Mod/ExitFinderMod.cs | 187 +++++++++++++ .../ExitFinder-Mod/Properties/AssemblyInfo.cs | 36 +++ .../HomogenyPod-Mod/HomogenyPod-Mod.csproj | 93 +++++++ DotE_Patch_Mod/HomogenyPod-Mod/HomogenyPod.cs | 85 ++++++ .../HomogenyPod-Mod/HomogenyPodConfig.cs | 69 +++++ .../Properties/AssemblyInfo.cs | 36 +++ 17 files changed, 1398 insertions(+) create mode 100644 DotE_Patch_Mod/CustomHero-Mod/CustomHero-Mod.csproj create mode 100644 DotE_Patch_Mod/CustomHero-Mod/CustomHeroMod.cs create mode 100644 DotE_Patch_Mod/CustomHero-Mod/Properties/AssemblyInfo.cs create mode 100644 DotE_Patch_Mod/DustGenerator-Mod/DustGenerator-Mod.csproj create mode 100644 DotE_Patch_Mod/DustGenerator-Mod/DustGeneratorMod.cs create mode 100644 DotE_Patch_Mod/DustGenerator-Mod/Properties/AssemblyInfo.cs create mode 100644 DotE_Patch_Mod/DustWithCrystal-Mod/AllowDustChangingWithCrystalMod.cs create mode 100644 DotE_Patch_Mod/DustWithCrystal-Mod/DustWithCrystal-Mod.csproj create mode 100644 DotE_Patch_Mod/DustWithCrystal-Mod/Properties/AssemblyInfo.cs create mode 100644 DotE_Patch_Mod/ExitFinder-Mod/ExitFinder-Mod.csproj create mode 100644 DotE_Patch_Mod/ExitFinder-Mod/ExitFinderMod.cs create mode 100644 DotE_Patch_Mod/ExitFinder-Mod/Properties/AssemblyInfo.cs create mode 100644 DotE_Patch_Mod/HomogenyPod-Mod/HomogenyPod-Mod.csproj create mode 100644 DotE_Patch_Mod/HomogenyPod-Mod/HomogenyPod.cs create mode 100644 DotE_Patch_Mod/HomogenyPod-Mod/HomogenyPodConfig.cs create mode 100644 DotE_Patch_Mod/HomogenyPod-Mod/Properties/AssemblyInfo.cs diff --git a/DotE_Patch_Mod/CustomHero-Mod/CustomHero-Mod.csproj b/DotE_Patch_Mod/CustomHero-Mod/CustomHero-Mod.csproj new file mode 100644 index 0000000..5a8c3d7 --- /dev/null +++ b/DotE_Patch_Mod/CustomHero-Mod/CustomHero-Mod.csproj @@ -0,0 +1,92 @@ + + + + + Debug + AnyCPU + {9602B7D5-32B6-4571-9EA2-8C27058AF287} + Library + Properties + CustomHero_Mod + CustomHero_Mod + v4.5.2 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Dungeon of the Endless\DungeonoftheEndless_Data\Managed\Amplitude.dll + False + + + ..\..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Dungeon of the Endless\DungeonoftheEndless_Data\Managed\Assembly-CSharp.dll + False + + + ..\..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Dungeon of the Endless\DungeonoftheEndless_Data\Managed\Assembly-CSharp-firstpass.dll + False + + + ..\DustDevilFramework\bin\Debug\DustDevilFramework.dll + False + + + ..\..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Dungeon of the Endless\DungeonoftheEndless_Data\Managed\HOOKS-Assembly-CSharp.dll + False + + + ..\..\..\..\..\Partiality\bin\MonoMod.exe + False + + + ..\..\..\..\..\Partiality\bin\MonoMod.RuntimeDetour.dll + False + + + ..\..\..\..\..\Partiality\bin\MonoMod.RuntimeDetour.HookGen.exe + False + + + ..\..\..\..\..\Partiality\bin\MonoMod.Utils.dll + False + + + ..\..\..\..\..\Partiality\bin\Partiality.dll + False + + + + + + + + + + + ..\..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Dungeon of the Endless\DungeonoftheEndless_Data\Managed\UnityEngine.dll + False + + + + + + + + \ No newline at end of file diff --git a/DotE_Patch_Mod/CustomHero-Mod/CustomHeroMod.cs b/DotE_Patch_Mod/CustomHero-Mod/CustomHeroMod.cs new file mode 100644 index 0000000..b03e684 --- /dev/null +++ b/DotE_Patch_Mod/CustomHero-Mod/CustomHeroMod.cs @@ -0,0 +1,260 @@ +using Amplitude.Unity.Framework; +using Amplitude.Unity.Gui; +using Amplitude.Unity.Simulation; +using DustDevilFramework; +using MonoMod.Utils; +using Partiality.Modloader; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CustomHero_Mod +{ + class CustomHeroMod : PartialityMod + { + ScadMod mod = new ScadMod(); + + Dictionary Ranks = new Dictionary(); + + public override void Init() + { + mod.path = @"CustomHero_log.txt"; + mod.config = @"CustomHero_config.txt"; + mod.default_config = "# Modify this file to change various settings of the CustomHero Mod for DotE.\n" + mod.default_config; + mod.Initialize(); + + // Setup default values for config + mod.Values.Add("HeroToReplace", "Skroig"); + mod.Values.Add("HeroName", "Skrog"); + mod.Values.Add("Hero HP", "1000"); + mod.Values.Add("Speed", "80"); + mod.Values.Add("LogHeroData", "True"); + mod.Values.Add("Path to Ranks.txt", "Ranks.txt"); + + mod.ReadConfig(); + ReadRanks(); + + mod.Log("Initialized!"); + } + public override void OnLoad() + { + mod.Load(); + if (Convert.ToBoolean(mod.Values["Enabled"])) + { + On.Hero.Init += Hero_Init; + On.Hero.ModifyLocalActiveHeroes += Hero_ModifyLocalActiveHeroes; + } + } + + private void Hero_ModifyLocalActiveHeroes(On.Hero.orig_ModifyLocalActiveHeroes orig, bool add, Hero hero) + { + // This should be called every time a hero is given/taken + orig(add, hero); + if (Convert.ToBoolean(mod.Values["Enabled"])) + { + if (mod.Values["HeroToReplace"] == hero.LocalizedName) + { + // We are matching Heroes! Start to change data! + SetHeroStats(hero); + //self.HealthCpnt.SetHealth((float)Convert.ToDouble(mod.Values["Hero HP"])); + } + SetHeroRankName(hero); + } + } + + private void ReadRanks() + { + if (System.IO.File.Exists(mod.Values["Path to Ranks.txt"])) + { + mod.Log("Reading Ranks.txt..."); + string[] lines = System.IO.File.ReadAllLines(mod.Values["Path to Ranks.txt"]); + + foreach (string line in lines) + { + if (line.StartsWith("#") || line.IndexOf(": ") == -1) + { + continue; + } + string[] spl = line.Split(new string[] { ": " }, StringSplitOptions.None); + string value = spl[1].Trim(); + Ranks[spl[0]] = value; + mod.Log("Read hero: " + spl[0] + " with rank: " + value + " from " + mod.Values["Path to Ranks.txt"]); + } + } else + { + mod.Log("Could not find Ranks.txt... Continuing!"); + } + } + + private void Hero_Init(On.Hero.orig_Init orig, Hero self, ulong ownerPlayerID, Amplitude.StaticString heroDescName, Room spawnRoom, bool isRecruited, bool registerRecruitment, int initLevel, int unlockLevel, bool hasOperatingBonus, Dictionary> initItemsByCategory, bool displayRecruitmentDialog, bool consumeLevelUpFood, bool updateDiscoverableHeroPool, int floorRecruited, Amplitude.StaticString[] permanentDescriptors, bool isStartingHero, int currentRespawnRoomCount, bool recruitable) + { + orig(self, ownerPlayerID, heroDescName, spawnRoom, isRecruited, registerRecruitment, initLevel, unlockLevel, hasOperatingBonus, initItemsByCategory, displayRecruitmentDialog, consumeLevelUpFood, updateDiscoverableHeroPool, floorRecruited, permanentDescriptors, isStartingHero, currentRespawnRoomCount, recruitable); + if (Convert.ToBoolean(mod.Values["LogHeroData"])) + { + LogHeroData(self, heroDescName); + } + if (mod.Values["HeroToReplace"] == self.LocalizedName) + { + // We are matching Heroes! Start to change data! + SetHeroStats(self); + //self.HealthCpnt.SetHealth((float)Convert.ToDouble(mod.Values["Hero HP"])); + } + SetHeroRankName(self); + } + + private void SetHeroStats(Hero self) + { + mod.Log("Found hero with name: " + self.LocalizedName + " Attempting to change data!"); + new DynData(self).Set("LocalizedName", mod.Values["HeroName"]); + //self.HealthCpnt.PermanantHealthMalus = (float)Convert.ToDouble(mod.Values["Hero HP"]); + self.GetSimObj().SetPropertyBaseValue("MaxHealth", (float)Convert.ToDouble(mod.Values["Hero HP"]) - self.GetSimObj().GetPropertyValue("MaxHealth")); + self.GetSimObj().SetPropertyBaseValue("MoveSpeed", (float)Convert.ToDouble(mod.Values["Speed"]) - self.GetSimObj().GetPropertyValue("MoveSpeed")); + //self.RemoveSimDescriptor(SimMonoBehaviour.GetDBDescriptorByName(self.Config.Name), true); + // Okay so now that I removed the actual SMB, I need to create a new one where the max health is mine + self.HealthCpnt.SetHealth((float)Convert.ToDouble(mod.Values["Hero HP"])); + mod.Log("New Name: " + self.LocalizedName + " and HP: " + self.HealthCpnt.GetHealth()); + } + + private void SetHeroRankName(Hero self) + { + if (Ranks.Keys.Count > 0) + { + foreach (string hero in Ranks.Keys) + { + if (self.LocalizedName == hero) + { + new DynData(self).Set("LocalizedName", self.LocalizedName + " Rank: " + Ranks[hero]); + mod.Log("Changed LocalizedName to: " + self.LocalizedName); + } + } + } + } + + private string GetSkillNameFromConfig(SkillConfig s) + { + IGuiService service = Services.GetService(); + GuiElement guiElement; + if (!service.GuiPanelHelper.TryGetGuiElement(s.BaseName, out guiElement)) + { + mod.Log("Attempted to find a GuiElement, but couldn't find one with name: " + s.BaseName); + return null; + } + return AgeLocalizer.Instance.LocalizeString(guiElement.Title); + } + + private string GetSkillNameFromSkill(Skill s) + { + return GetSkillNameFromConfig(s.Config); + } + + private string GetSkillNameFromSkillKey(string skillKey) + { + SkillConfig skc = Databases.GetDatabase(false).GetValue(skillKey); + skc.Init(); + return GetSkillNameFromConfig(skc); + } + + private void LogHeroData(Hero self, Amplitude.StaticString heroDescName) + { + mod.Log("HeroDescName: " + heroDescName + " with real name: " + self.LocalizedName); + mod.Log("Current Level: " + self.Level); + // Possibly important information below: + /* + * activeSkills, passiveSkills: Lists + * FilteredActiveSkills: List of ActiveSkills + * FilteredPassiveSkills: List of PassiveSkills + * Config: Database of HeroConfig, found by using heroDescName + * SituationDialogCount seems like dialogs that the hero says during the game + * spriteAnim, tacticalMapElementAnim, crystalSprite: All seem to be animations/graphics + * self.transform.position: Real position + * heroAttackTargetCpnt: The attacker componenet, init is called on this with Config.AITargetType passed in (if it is recruited by a player) + * mobsAggroAttackTargetCpnt: Seems to be something that determines aggro of mobs + * levelConfigs: List + * levelUpModifiersByLevel: List>() + * GetLevelDescriptorName: returns a name for a given level, used to populate the above dict + * levelConfigs contains a list of data (including passive/active skills with unique naming) + * leveUpModifiersByLevel contains Dictionaries created by: + * 1. Finding a SimulationDescriptor from a SimMonoBehavior (found by using levelDescriptorName) + * 2. Finding a simObj (self.GetSimObj()) + * 3. Iterating over each SimulationModifierDescriptor in the SimulationDescriptor.SimulationModifierDescriptors list + * - And adding to the dictionary: TargetPropertyName of the current SimulationModifierDescriptor, current.ComputeValue(simObj, simObj, SimulationPropertyRefreshContext.GetContext(-1)) + * permanentDescriptors contain SimulationDescriptors + * + */ + mod.Log("Active Skills:"); + foreach (ActiveSkill a in self.FilteredActiveSkills) + { + mod.Log("- " + GetSkillNameFromSkill(a) + " with desc name: " + a.name); + + } + mod.Log("Passive Skills:"); + foreach (PassiveSkill p in self.FilteredPassiveSkills) + { + string label = GetSkillNameFromSkill(p); + mod.Log("GUI Label: " + label + " with desc name: " + p.name); + if (p.OwnerSimDesc == null) + { + continue; + } + if (p.OwnerSimDesc.SimulationModifierDescriptors != null) + { + mod.Log("- All ModifierDescriptors:"); + foreach (SimulationModifierDescriptor d in p.OwnerSimDesc.SimulationModifierDescriptors) + { + if (d != null) + mod.Log("-- " + d.TargetPropertyName); + } + } + if (p.OwnerSimDesc.SimulationPropertyDescriptors != null) + { + mod.Log("- All PropertyDescriptors:"); + foreach (SimulationPropertyDescriptor d in p.OwnerSimDesc.SimulationPropertyDescriptors) + { + if (d != null) + mod.Log("-- " + d.Name); + } + } + } + mod.Log("Level Configs:"); + foreach (HeroLevelConfig h in new DynData(self).Get>("levelConfigs")) + { + if (h == null) + { + continue; + } + mod.Log("Food Cost: " + h.FoodCost + " Skills:"); + try + { + foreach (string s in h.Skills) + { + //SkillConfig skc = Databases.GetDatabase(false).GetValue(s); + //skc.Init(); + string label = GetSkillNameFromSkillKey(s); + mod.Log("- " + label + " with desc name: " + s); + } + } + catch (NullReferenceException e) + { + // There are no Skills from this levelConfig + } + } + mod.Log("Level Up Modifiers By Level:"); + List> list = new DynData(self).Get>>("levelUpModifiersByLevel"); + foreach (Dictionary d in list) + { + if (d == null) + { + continue; + } + mod.Log("Dictionary:"); + foreach (Amplitude.StaticString s in d.Keys) + { + mod.Log("- Key: " + s + ", Value: " + d[s]); + } + } + mod.Log("======================================================================="); + } + } +} diff --git a/DotE_Patch_Mod/CustomHero-Mod/Properties/AssemblyInfo.cs b/DotE_Patch_Mod/CustomHero-Mod/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..ad3946d --- /dev/null +++ b/DotE_Patch_Mod/CustomHero-Mod/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CustomHero-Mod")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CustomHero-Mod")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("9602b7d5-32b6-4571-9ea2-8c27058af287")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/DotE_Patch_Mod/DotE_Patch_Mod.sln b/DotE_Patch_Mod/DotE_Patch_Mod.sln index 42404b1..0424299 100644 --- a/DotE_Patch_Mod/DotE_Patch_Mod.sln +++ b/DotE_Patch_Mod/DotE_Patch_Mod.sln @@ -9,6 +9,16 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DustDevilFramework", "DustD EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DustlessPod-Mod", "DustlessPod-Mod\DustlessPod-Mod.csproj", "{C53BE1C5-3C99-4BF4-ACE8-37EC4A745011}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HomogenyPod-Mod", "HomogenyPod-Mod\HomogenyPod-Mod.csproj", "{5B07F1F9-4373-41F3-B48E-EFA5AC9E04F5}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExitFinder-Mod", "ExitFinder-Mod\ExitFinder-Mod.csproj", "{F51E3114-7C7A-4C89-9EA2-16F674F0DCF4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DustGenerator-Mod", "DustGenerator-Mod\DustGenerator-Mod.csproj", "{3D9203BE-5FA4-4307-94A6-5F2E6ACB78E2}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DustWithCrystal-Mod", "DustWithCrystal-Mod\DustWithCrystal-Mod.csproj", "{C3B103ED-985B-4A6C-BECB-E41A05A0FEAC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomHero-Mod", "CustomHero-Mod\CustomHero-Mod.csproj", "{9602B7D5-32B6-4571-9EA2-8C27058AF287}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -27,6 +37,26 @@ Global {C53BE1C5-3C99-4BF4-ACE8-37EC4A745011}.Debug|Any CPU.Build.0 = Debug|Any CPU {C53BE1C5-3C99-4BF4-ACE8-37EC4A745011}.Release|Any CPU.ActiveCfg = Release|Any CPU {C53BE1C5-3C99-4BF4-ACE8-37EC4A745011}.Release|Any CPU.Build.0 = Release|Any CPU + {5B07F1F9-4373-41F3-B48E-EFA5AC9E04F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5B07F1F9-4373-41F3-B48E-EFA5AC9E04F5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5B07F1F9-4373-41F3-B48E-EFA5AC9E04F5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5B07F1F9-4373-41F3-B48E-EFA5AC9E04F5}.Release|Any CPU.Build.0 = Release|Any CPU + {F51E3114-7C7A-4C89-9EA2-16F674F0DCF4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F51E3114-7C7A-4C89-9EA2-16F674F0DCF4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F51E3114-7C7A-4C89-9EA2-16F674F0DCF4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F51E3114-7C7A-4C89-9EA2-16F674F0DCF4}.Release|Any CPU.Build.0 = Release|Any CPU + {3D9203BE-5FA4-4307-94A6-5F2E6ACB78E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3D9203BE-5FA4-4307-94A6-5F2E6ACB78E2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3D9203BE-5FA4-4307-94A6-5F2E6ACB78E2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3D9203BE-5FA4-4307-94A6-5F2E6ACB78E2}.Release|Any CPU.Build.0 = Release|Any CPU + {C3B103ED-985B-4A6C-BECB-E41A05A0FEAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C3B103ED-985B-4A6C-BECB-E41A05A0FEAC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C3B103ED-985B-4A6C-BECB-E41A05A0FEAC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C3B103ED-985B-4A6C-BECB-E41A05A0FEAC}.Release|Any CPU.Build.0 = Release|Any CPU + {9602B7D5-32B6-4571-9EA2-8C27058AF287}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9602B7D5-32B6-4571-9EA2-8C27058AF287}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9602B7D5-32B6-4571-9EA2-8C27058AF287}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9602B7D5-32B6-4571-9EA2-8C27058AF287}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/DotE_Patch_Mod/DustGenerator-Mod/DustGenerator-Mod.csproj b/DotE_Patch_Mod/DustGenerator-Mod/DustGenerator-Mod.csproj new file mode 100644 index 0000000..370fb37 --- /dev/null +++ b/DotE_Patch_Mod/DustGenerator-Mod/DustGenerator-Mod.csproj @@ -0,0 +1,92 @@ + + + + + Debug + AnyCPU + {3D9203BE-5FA4-4307-94A6-5F2E6ACB78E2} + Library + Properties + DustGenerator_Mod + DustGenerator_Mod + v4.5.2 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Dungeon of the Endless\DungeonoftheEndless_Data\Managed\Amplitude.dll + False + + + ..\..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Dungeon of the Endless\DungeonoftheEndless_Data\Managed\Assembly-CSharp.dll + False + + + ..\..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Dungeon of the Endless\DungeonoftheEndless_Data\Managed\Assembly-CSharp-firstpass.dll + False + + + ..\DustDevilFramework\bin\Debug\DustDevilFramework.dll + False + + + ..\..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Dungeon of the Endless\DungeonoftheEndless_Data\Managed\HOOKS-Assembly-CSharp.dll + False + + + ..\..\..\..\..\Partiality\bin\MonoMod.exe + False + + + ..\..\..\..\..\Partiality\bin\MonoMod.RuntimeDetour.dll + False + + + ..\..\..\..\..\Partiality\bin\MonoMod.RuntimeDetour.HookGen.exe + False + + + ..\..\..\..\..\Partiality\bin\MonoMod.Utils.dll + False + + + ..\..\..\..\..\Partiality\bin\Partiality.dll + False + + + + + + + + + + + ..\..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Dungeon of the Endless\DungeonoftheEndless_Data\Managed\UnityEngine.dll + False + + + + + + + + \ No newline at end of file diff --git a/DotE_Patch_Mod/DustGenerator-Mod/DustGeneratorMod.cs b/DotE_Patch_Mod/DustGenerator-Mod/DustGeneratorMod.cs new file mode 100644 index 0000000..ab95961 --- /dev/null +++ b/DotE_Patch_Mod/DustGenerator-Mod/DustGeneratorMod.cs @@ -0,0 +1,67 @@ +using DustDevilFramework; +using MonoMod.Utils; +using Partiality.Modloader; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DustGenerator_Mod +{ + class DustGeneratorMod : PartialityMod + { + ScadMod mod = new ScadMod(); + public override void Init() + { + mod.path = @"DustGenerator_log.txt"; + mod.config = @"DustGenerator_config.txt"; + mod.default_config = "# Modify this file to change various settings of the DustGenerator Mod for DotE.\n" + mod.default_config; + mod.Initialize(); + + // Setup default values for config + mod.Values.Add("DustPerDoor", "10.0"); + mod.Values.Add("DustFromProducing", "False"); + mod.Values.Add("DustFromRoom", "False"); + + mod.ReadConfig(); + + mod.Log("Initialized!"); + } + public override void OnLoad() + { + mod.Load(); + if (Convert.ToBoolean(mod.Values["Enabled"])) + { + On.Dungeon.GetDustProd += Dungeon_GetDustProd; + On.Room.Open += Room_Open; + } + } + + private void Room_Open(On.Room.orig_Open orig, Room self, Door openingDoor, bool ignoreVisibility) + { + if (Convert.ToBoolean(mod.Values["DustFromRoom"])) + { + // You can reuse a DynData wrapper for multiple get / set operations on the same object + new DynData(self).Set("DustLootAmount", (int)Convert.ToDouble(mod.Values["DustPerDoor"])); // Sets the dust value of this room to 10 + mod.Log("Attempting to spawn: " + self.DustLootAmount + " dust in room!"); + orig(self, openingDoor, ignoreVisibility); + return; + } + orig(self, openingDoor, ignoreVisibility); + mod.Log("Using default room collection: " + self.DustLootAmount); + } + + private float Dungeon_GetDustProd(On.Dungeon.orig_GetDustProd orig, Dungeon self) + { + if (Convert.ToBoolean(mod.Values["DustFromProducing"])) + { + mod.Log("Attempting to Produce: " + Convert.ToDouble(mod.Values["DustPerDoor"]) + " dust!"); + orig(self); + return (float)Convert.ToDouble(mod.Values["DustPerDoor"]); + } + mod.Log("Using default dust production..." + orig(self)); + return orig(self); + } + } +} diff --git a/DotE_Patch_Mod/DustGenerator-Mod/Properties/AssemblyInfo.cs b/DotE_Patch_Mod/DustGenerator-Mod/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..2a609c6 --- /dev/null +++ b/DotE_Patch_Mod/DustGenerator-Mod/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("DustGenerator-Mod")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("DustGenerator-Mod")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("3d9203be-5fa4-4307-94a6-5f2e6acb78e2")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/DotE_Patch_Mod/DustWithCrystal-Mod/AllowDustChangingWithCrystalMod.cs b/DotE_Patch_Mod/DustWithCrystal-Mod/AllowDustChangingWithCrystalMod.cs new file mode 100644 index 0000000..d76dfbc --- /dev/null +++ b/DotE_Patch_Mod/DustWithCrystal-Mod/AllowDustChangingWithCrystalMod.cs @@ -0,0 +1,59 @@ +using DustDevilFramework; +using Partiality.Modloader; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DustWithCrystal_Mod +{ + class AllowDustChangingWithCrystalMod : PartialityMod + { + ScadMod mod = new ScadMod(); + public override void Init() + { + mod.path = @"DustAfterCrystal_log.txt"; + mod.config = @"DustAfterCrystal_config.txt"; + mod.default_config = "# Modify this file to change various settings of the DustAfterCrystal Mod for DotE.\n" + mod.default_config; + mod.Initialize(); + + // Setup default values for config + + + mod.ReadConfig(); + + mod.Log("Initialized!"); + } + public override void OnLoad() + { + mod.Load(); + if (Convert.ToBoolean(mod.Values["Enabled"])) + { + On.Room.CanBePowered_refString_bool_bool_bool_bool_bool += Room_CanBePowered; + On.Room.CanBeUnpowered += Room_CanBeUnpowered; + } + } + + private bool Room_CanBeUnpowered(On.Room.orig_CanBeUnpowered orig, Room self, bool checkCrystalState, bool checkPoweringPlayer, bool checkPowerChangeCooldown, bool ignoreShipConfig, bool displayError) + { + if (checkCrystalState) + { + mod.Log("Making sure checkCrystalState is false..."); + return orig(self, false, checkPoweringPlayer, checkPowerChangeCooldown, ignoreShipConfig, displayError); + } + return orig(self, checkCrystalState, checkPoweringPlayer, checkPowerChangeCooldown, ignoreShipConfig, displayError); + } + + private bool Room_CanBePowered(On.Room.orig_CanBePowered_refString_bool_bool_bool_bool_bool orig, Room self, out string errorNotif, bool displayErrorNotif, bool checkCrystalState, bool checkInitialization, bool ignoreOpeningDoorsForPowerChainCheck, bool checkPowerChain) + { + errorNotif = null; + if (checkCrystalState) + { + mod.Log("Making sure checkCrystalState is false..."); + return orig(self, out errorNotif, displayErrorNotif, false, checkInitialization, ignoreOpeningDoorsForPowerChainCheck, checkPowerChain); + } + return orig(self, out errorNotif, displayErrorNotif, checkCrystalState, checkInitialization, ignoreOpeningDoorsForPowerChainCheck, checkPowerChain); + } + } +} diff --git a/DotE_Patch_Mod/DustWithCrystal-Mod/DustWithCrystal-Mod.csproj b/DotE_Patch_Mod/DustWithCrystal-Mod/DustWithCrystal-Mod.csproj new file mode 100644 index 0000000..fc7f19a --- /dev/null +++ b/DotE_Patch_Mod/DustWithCrystal-Mod/DustWithCrystal-Mod.csproj @@ -0,0 +1,92 @@ + + + + + Debug + AnyCPU + {C3B103ED-985B-4A6C-BECB-E41A05A0FEAC} + Library + Properties + DustWithCrystal_Mod + DustWithCrystal_Mod + v4.5.2 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Dungeon of the Endless\DungeonoftheEndless_Data\Managed\Amplitude.dll + False + + + ..\..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Dungeon of the Endless\DungeonoftheEndless_Data\Managed\Assembly-CSharp.dll + False + + + ..\..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Dungeon of the Endless\DungeonoftheEndless_Data\Managed\Assembly-CSharp-firstpass.dll + False + + + ..\DustDevilFramework\bin\Debug\DustDevilFramework.dll + False + + + ..\..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Dungeon of the Endless\DungeonoftheEndless_Data\Managed\HOOKS-Assembly-CSharp.dll + False + + + ..\..\..\..\..\Partiality\bin\MonoMod.exe + False + + + ..\..\..\..\..\Partiality\bin\MonoMod.RuntimeDetour.dll + False + + + ..\..\..\..\..\Partiality\bin\MonoMod.RuntimeDetour.HookGen.exe + False + + + ..\..\..\..\..\Partiality\bin\MonoMod.Utils.dll + False + + + ..\..\..\..\..\Partiality\bin\Partiality.dll + False + + + + + + + + + + + ..\..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Dungeon of the Endless\DungeonoftheEndless_Data\Managed\UnityEngine.dll + False + + + + + + + + \ No newline at end of file diff --git a/DotE_Patch_Mod/DustWithCrystal-Mod/Properties/AssemblyInfo.cs b/DotE_Patch_Mod/DustWithCrystal-Mod/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..58f3ee2 --- /dev/null +++ b/DotE_Patch_Mod/DustWithCrystal-Mod/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("DustWithCrystal-Mod")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("DustWithCrystal-Mod")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("c3b103ed-985b-4a6c-becb-e41a05a0feac")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/DotE_Patch_Mod/ExitFinder-Mod/ExitFinder-Mod.csproj b/DotE_Patch_Mod/ExitFinder-Mod/ExitFinder-Mod.csproj new file mode 100644 index 0000000..1352597 --- /dev/null +++ b/DotE_Patch_Mod/ExitFinder-Mod/ExitFinder-Mod.csproj @@ -0,0 +1,92 @@ + + + + + Debug + AnyCPU + {F51E3114-7C7A-4C89-9EA2-16F674F0DCF4} + Library + Properties + ExitFinder_Mod + ExitFinder_Mod + v4.5.2 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Dungeon of the Endless\DungeonoftheEndless_Data\Managed\Amplitude.dll + False + + + ..\..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Dungeon of the Endless\DungeonoftheEndless_Data\Managed\Assembly-CSharp.dll + False + + + ..\..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Dungeon of the Endless\DungeonoftheEndless_Data\Managed\Assembly-CSharp-firstpass.dll + False + + + ..\DustDevilFramework\bin\Debug\DustDevilFramework.dll + False + + + ..\..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Dungeon of the Endless\DungeonoftheEndless_Data\Managed\HOOKS-Assembly-CSharp.dll + False + + + ..\..\..\..\..\Partiality\bin\MonoMod.exe + False + + + ..\..\..\..\..\Partiality\bin\MonoMod.RuntimeDetour.dll + False + + + ..\..\..\..\..\Partiality\bin\MonoMod.RuntimeDetour.HookGen.exe + False + + + ..\..\..\..\..\Partiality\bin\MonoMod.Utils.dll + False + + + ..\..\..\..\..\Partiality\bin\Partiality.dll + False + + + + + + + + + + + ..\..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Dungeon of the Endless\DungeonoftheEndless_Data\Managed\UnityEngine.dll + False + + + + + + + + \ No newline at end of file diff --git a/DotE_Patch_Mod/ExitFinder-Mod/ExitFinderMod.cs b/DotE_Patch_Mod/ExitFinder-Mod/ExitFinderMod.cs new file mode 100644 index 0000000..fb4929d --- /dev/null +++ b/DotE_Patch_Mod/ExitFinder-Mod/ExitFinderMod.cs @@ -0,0 +1,187 @@ +using DustDevilFramework; +using Partiality.Modloader; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Input; +using UnityEngine; + +namespace ExitFinder_Mod +{ + public class ExitFinderMod : PartialityMod + { + ScadMod mod = new ScadMod(); + private static bool DisplayExit = true; + + private static Room ExitRoom; + + public override void Init() + { + mod.path = @"ExitFinder_log.txt"; + mod.config = @"ExitFinder_config.txt"; + mod.default_config = "# Modify this file to change various settings of the ExitFinder Mod for DotE.\n" + mod.default_config; + mod.Initialize(); + + // Setup default values for config + mod.Values.Add("DisplayExit", "True"); + mod.Values.Add("Key", @"Backslash"); + + mod.ReadConfig(); + + mod.Log("Initialized!"); + } + public override void OnLoad() + { + mod.Load(); + if (Convert.ToBoolean(mod.Values["Enabled"])) + { + On.Session.Update += Session_Update; + On.Dungeon.SpawnExit += Dungeon_SpawnExit; + } + } + + private void Dungeon_SpawnExit(On.Dungeon.orig_SpawnExit orig, Dungeon self, Room spawnRoom) + { + orig(self, spawnRoom); + mod.Log("Called a SpawnExit function!"); + } + + private void Session_Update(On.Session.orig_Update orig, Session self) + { + orig(self); + KeyCode key = (KeyCode)Enum.Parse(typeof(KeyCode), mod.Values["Key"]); + if (Input.GetKeyDown(key)) + { + try + { + Dungeon d = SingletonManager.Get(false); + mod.Log("Attempting to find exit in Dungeon..."); + d.EnqueueNotification(GetExit(d)); + if (ExitRoom.CrystalModuleSlots.Count > 0) + { + // The exit already exists, don't make another one! + return; + } + if (DisplayExit) + { + mod.Log("Attemping to display exit..."); + ExitRoom.AddCrystalSlot(true); + d.DisplayCrystalAndExitOffscreenMarkers(ExitRoom.CrystalModuleSlots[0].transform).Show(true); + } + } catch (NullReferenceException e) + { + // The Dungeon/GUI has yet to be setup! + // Let's just wait a bit and log it. + mod.Log("Dungeon/GUI Not yet initialized!"); + } + } + } + + private string GetExit(Dungeon d) + { + + //List path = FindPathToExit(new List(), d.StartRoom, d.ExitRoom); + string pa = GetPathToExit("", d.StartRoom); + List path = new List(); + mod.Log("Path to exit (before instructions): " + pa); + string[] splits = pa.Split(new string[] { "R: [(" }, StringSplitOptions.None); + foreach (string s in splits) + { + if (s.IndexOf(")]") == -1) + { + continue; + } + string q = s.Substring(0, s.IndexOf(")]") - 1); + string[] vec = q.Split(new string[] { ", " }, StringSplitOptions.None); + path.Add(new Vector3((float)Convert.ToDouble(vec[0]), (float)Convert.ToDouble(vec[1]), (float)Convert.ToDouble(vec[2]))); + } + mod.Log("Exit Vectors:\n============================"); + foreach (Vector3 v in path) + { + mod.Log("Vector: " + v); + } + mod.Log("============================"); + string instructions = "Path to exit: "; + for (int i = 1; i < path.Count; i++) + { + Vector3 delta = path[i] - path[i - 1]; + if (Math.Abs(delta.z) > Math.Abs(delta.x)) + { + // The next step should be either up or down + if (delta.z < 0) + { + instructions += "U "; + } else if (delta.z > 0) + { + instructions += "D "; + } + } else if (Math.Abs(delta.x) > Math.Abs(delta.z)) + { + // The next step should be either left or right + if (delta.x < 0) + { + // Yes, this is backwards. It is just how the coordinate system works... + instructions += "R "; + } else if (delta.x > 0) + { + instructions += "L "; + } + } + } + mod.Log("Instructions: " + instructions); + return instructions; + } + + private List FindPathToExit(List pathSoFar, Room Current, Room Exit) + { + if (Current == Exit) + { + pathSoFar.Add(Current); + return pathSoFar; + } + List outp = new List(); + outp.AddRange(pathSoFar); + outp.Add(Current); + foreach (Room r in Current.AdjacentRooms) + { + if (pathSoFar.Contains(r)) + { + continue; + } + List p = FindPathToExit(outp, r, Exit); + if (p.Contains(Exit)) + { + return p; + } + } + return outp; + } + + private static string GetPathToExit(string outp, Room current) + { + if (current.StaticRoomEvent == RoomEvent.Exit) + { + ExitRoom = current; + return outp + "ExitR: [" + current.CenterPosition + "]"; + } + string o = outp + "R: [" + current.CenterPosition + "] "; + //Log(o); + foreach (Room r in current.AdjacentRooms) + { + if (o.IndexOf("R: [" + r.CenterPosition + "]") != -1) + { + // Already have this within the string + continue; + } + string o2 = GetPathToExit(o, r); + if (o2.IndexOf("ExitR") != -1) + { + return o2; + } + } + return o; + } + } +} diff --git a/DotE_Patch_Mod/ExitFinder-Mod/Properties/AssemblyInfo.cs b/DotE_Patch_Mod/ExitFinder-Mod/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..d5dc259 --- /dev/null +++ b/DotE_Patch_Mod/ExitFinder-Mod/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ExitFinder-Mod")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ExitFinder-Mod")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("f51e3114-7c7a-4c89-9ea2-16f674f0dcf4")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/DotE_Patch_Mod/HomogenyPod-Mod/HomogenyPod-Mod.csproj b/DotE_Patch_Mod/HomogenyPod-Mod/HomogenyPod-Mod.csproj new file mode 100644 index 0000000..67fbecc --- /dev/null +++ b/DotE_Patch_Mod/HomogenyPod-Mod/HomogenyPod-Mod.csproj @@ -0,0 +1,93 @@ + + + + + Debug + AnyCPU + {5B07F1F9-4373-41F3-B48E-EFA5AC9E04F5} + Library + Properties + HomogenyPod_Mod + HomogenyPod_Mod + v4.5.2 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Dungeon of the Endless\DungeonoftheEndless_Data\Managed\Amplitude.dll + False + + + ..\..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Dungeon of the Endless\DungeonoftheEndless_Data\Managed\Assembly-CSharp.dll + False + + + ..\..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Dungeon of the Endless\DungeonoftheEndless_Data\Managed\Assembly-CSharp-firstpass.dll + False + + + ..\DustDevilFramework\bin\Debug\DustDevilFramework.dll + False + + + ..\..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Dungeon of the Endless\DungeonoftheEndless_Data\Managed\HOOKS-Assembly-CSharp.dll + False + + + ..\..\..\..\..\Partiality\bin\MonoMod.exe + False + + + ..\..\..\..\..\Partiality\bin\MonoMod.RuntimeDetour.dll + False + + + ..\..\..\..\..\Partiality\bin\MonoMod.RuntimeDetour.HookGen.exe + False + + + ..\..\..\..\..\Partiality\bin\MonoMod.Utils.dll + False + + + ..\..\..\..\..\Partiality\bin\Partiality.dll + False + + + + + + + + + + + ..\..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Dungeon of the Endless\DungeonoftheEndless_Data\Managed\UnityEngine.dll + False + + + + + + + + + \ No newline at end of file diff --git a/DotE_Patch_Mod/HomogenyPod-Mod/HomogenyPod.cs b/DotE_Patch_Mod/HomogenyPod-Mod/HomogenyPod.cs new file mode 100644 index 0000000..4c6e09f --- /dev/null +++ b/DotE_Patch_Mod/HomogenyPod-Mod/HomogenyPod.cs @@ -0,0 +1,85 @@ +using Amplitude; +using Amplitude.Unity.Framework; +using Amplitude.Unity.Gui; +using MonoMod.Utils; +using Partiality.Modloader; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HomogenyPod_Mod +{ + class HomogenyPod : PartialityMod + { + HomogenyPodConfig mod = new HomogenyPodConfig(); + + private int CurrentFloor = -1; + private List CurrentMobs = new List(); + + public override void Init() + { + mod.Initialize(); + } + public override void OnLoad() + { + mod.Load(); + + if (Convert.ToBoolean(mod.Values["Enabled"])) + { + On.Dungeon.SpawnMobs += Dungeon_SpawnMobs; + } + } + + private System.Collections.IEnumerator Dungeon_SpawnMobs(On.Dungeon.orig_SpawnMobs orig, Dungeon self, Room spawnRoom, float roomDifficultyValue, MobSpawnType spawnType, StaticString eventType, List elligibleMobs, Action spawnCountSetter) + { + if (self.ShipName == mod.GetName()) + { + if (CurrentFloor != self.Level && spawnRoom.OpeningIndex >= 1) + { + List mobs = new List(); + for (int i = 0; i < elligibleMobs.Count; i++) + { + MobClassConfig config = Databases.GetDatabase(false).GetValue(elligibleMobs[i].MobCfg.Name); + + int index = (!elligibleMobs[i].IsNew) ? config.MinRoomOpeningIndex : config.MinRoomOpeningIndexIfNew; + if (spawnRoom.OpeningIndex > index) + { + mobs.Add(elligibleMobs[i]); + } + } + mod.Log("mobs.Count check!"); + if (mobs.Count < 1) + { + return orig(self, spawnRoom, roomDifficultyValue, spawnType, eventType, elligibleMobs, spawnCountSetter); + } + + SelectedMob s = mobs.GetWeightedRandom((SelectedMob m) => m.MobCfg.SpawnProbWeight.GetValue(spawnRoom)); + + mod.Log("Logging s: "+s); + + CurrentMobs = new List(); + CurrentMobs.Add(s); + mod.Log("Currently Selected mobs for floor: " + self.Level); + foreach (SelectedMob q in CurrentMobs) + { + mod.Log(q.MobCfg.Name); + } + mod.Log("Out of:"); + foreach (SelectedMob q in mobs) + { + mod.Log(q.MobCfg.Name); + } + CurrentFloor = self.Level; + } + if (CurrentMobs.Count > 0) + { + mod.Log("Attempting to spawn: " + CurrentMobs[0].MobCfg.Name); + return orig(self, spawnRoom, roomDifficultyValue, spawnType, eventType, CurrentMobs, spawnCountSetter); + } + } + return orig(self, spawnRoom, roomDifficultyValue, spawnType, eventType, elligibleMobs, spawnCountSetter); + } + } +} diff --git a/DotE_Patch_Mod/HomogenyPod-Mod/HomogenyPodConfig.cs b/DotE_Patch_Mod/HomogenyPod-Mod/HomogenyPodConfig.cs new file mode 100644 index 0000000..a365aff --- /dev/null +++ b/DotE_Patch_Mod/HomogenyPod-Mod/HomogenyPodConfig.cs @@ -0,0 +1,69 @@ +using DustDevilFramework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HomogenyPod_Mod +{ + class HomogenyPodConfig : PodMod + { + public override string GetAnimationPod() + { + return "Armory"; + } + + public override string GetDescription() + { + return "#D0B499#Note from sales brochure: ''This pod comes with a spawn jammer. It only spawns one type of mob per floor. We hope it's occupants make it out alive.'' #REVERT#"; + } + + public override string GetDungeonPod() + { + return "Pod"; + } + + public override string GetName() + { + return "HomogenyPod"; + } + + public override string GetSpecialText() + { + return "\n- Only one type of mob will spawn per floor."; + } + + public override string[] GetInitialBlueprints() + { + return new string[] + { + "SpecialModule_Artifact", "SpecialModule_Stele", "SpecialModule_DustFactory", "SpecialModule_CryoCapsule", + "MajorModule_Major0001_LVL1", "MajorModule_Major0002_LVL1", "MajorModule_Major0003_LVL1", "MinorModule_Minor0004_LVL1" + }; + } + + public override int GetIndex() + { + return 9; + } + + public override int GetLevelCount() + { + return 12; + } + + public override string[] GetUnavailableBlueprints() + { + return new string[0]; + } + + public override string[] GetUnavailableItems() + { + return new string[] + { + "Special022", "Special023", "Special024", "Special025", "Special028", "Special029", "Special030", "Special031" + }; + } + } +} diff --git a/DotE_Patch_Mod/HomogenyPod-Mod/Properties/AssemblyInfo.cs b/DotE_Patch_Mod/HomogenyPod-Mod/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..2017333 --- /dev/null +++ b/DotE_Patch_Mod/HomogenyPod-Mod/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("HomogenyPod-Mod")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("HomogenyPod-Mod")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("5b07f1f9-4373-41f3-b48e-efa5ac9e04f5")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")]