diff --git a/build/src/DuckGnomeMain.cs b/build/src/DuckGnomeMain.cs index f6ab7b7..f6fdeea 100644 --- a/build/src/DuckGnomeMain.cs +++ b/build/src/DuckGnomeMain.cs @@ -3,6 +3,8 @@ using System.Linq; using System.Text; using DuckGame; +using DuckGame.src; +using othello7_mod.src; namespace DuckGame.othello7_mod { @@ -64,9 +66,13 @@ public void Update() if (TeamSelect2.Enabled("CHAOSMODE", false) && validLevel) { this.chaosmode = true; - doneDucks2.Clear(); + } + if (TeamSelect2.Enabled("IMPOSTORMODE", false) && validLevel) + { + this.sussyimpotor = true; } this.lastlevel = Level.current; + remixtimer = 0; } if (this.give_scp) { @@ -163,10 +169,51 @@ public void Update() this.give_scp = false; } } - } + if (remixtimer < 180) + remixtimer++; + if (this.sussyimpotor && remixtimer == 180) + { + remixtimer++; + void swapweapon(Thing replace) + { + foreach (Thing thing in Level.current.things[typeof(T)]) + { + if (Rando.Int(3) == 0) + { + replace.x = thing.x; + replace.y = thing.y; + Level.Add(replace); + Level.Remove(thing); + } + } + } + swapweapon(new SDP(0, 0)); + swapweapon(new ShootySelf(0, 0)); + swapweapon(new RivalGun(0, 0)); + swapweapon(new FakeSword(0, 0)); + swapweapon(new FlareSniper(0, 0)); + swapweapon(new BombDuck(0, 0)); + swapweapon(new DeathPistol(0, 0)); + swapweapon(new OPlaser(0, 0)); + swapweapon(new RockLauncher(0, 0)); + swapweapon(new RockSniper(0, 0)); + swapweapon(new ShotGrenade(0, 0)); + swapweapon(new SuperBazooka(0, 0)); + swapweapon(new SmokeBlaster(0, 0)); + swapweapon(new SmokeBlaster(0, 0)); + swapweapon(new SCP(0, 0)); + swapweapon(new TurboAk47(0, 0)); + swapweapon(new susej(0, 0)); + swapweapon(new SuperLaser(0, 0)); + } - // Token: 0x04000053 RID: 83 + /*give_scp = false; + give_nade = false; + chaosmode = false; + sussyimpotor = false;*/ + } + // Token: 0x04000053 RID: 83 private static string[] blacklist_levels = new string[] { "DuckGame.TitleScreen", @@ -189,6 +236,10 @@ public void Update() private bool chaosmode; + private bool sussyimpotor; + + private int remixtimer; + // Token: 0x04000057 RID: 87 private List doneDucks1; diff --git a/build/src/othello7_mod.cs b/build/src/othello7_mod.cs index 7bae2f2..a9d6ef1 100644 --- a/build/src/othello7_mod.cs +++ b/build/src/othello7_mod.cs @@ -16,18 +16,18 @@ [assembly: AssemblyCompany("othello7")] // The description of the mod -[assembly: AssemblyDescription("Adds a few guns")] +[assembly: AssemblyDescription("Adds a few guns (a little trolling)")] // The mod's version -[assembly: AssemblyVersion("1.1.7.0")] +[assembly: AssemblyVersion("1.1.7.1")] namespace DuckGame.othello7_mod { - + public class DuckGnome : Mod { - + //public static bool activateConsole = true; //public static HarmonyInstance harmony = HarmonyInstance.Create("othello7_mod.DuckGame"); /* @@ -66,7 +66,7 @@ internal static void PerformMethodInjection() harmony.Patch(original, harmonymethodprefix); DevConsole.Log("Granted command permissions", Color.Green); - //injector.Inject(GnomeGlobals.GetMethod("DevConsole", "RunCommand", true), GnomeGlobals.GetMethod(typeof(GnomeConsole), "RunCommand", true)); + } catch (System.NullReferenceException) { @@ -79,29 +79,28 @@ internal static void PerformMethodInjection() // The mod's priority; this property controls the load order of the mod. public override Priority priority - { - get { return base.priority; } - } + { + get { return base.priority; } + } - // This function is run before all mods are finished loading. - protected override void OnPreInitialize() + // This function is run before all mods are finished loading. + protected override void OnPreInitialize() { MonoMain.loadMessage = "Loading DuckGnome"; Program.LogLine(string.Format("-- DuckGnome initialized on {1} at {0} --", (object)DateTime.Now.ToLongTimeString(), (object)DateTime.Now.ToShortDateString())); Program.main.Window.Title = "DuckGnome"; - base.OnPreInitialize(); } - // This function is run after all mods are loaded. - protected override void OnPostInitialize() { - base.OnPostInitialize(); + // This function is run after all mods are loaded. + protected override void OnPostInitialize() + { + base.OnPostInitialize(); Thread thread = new Thread(new ThreadStart(this.ExecuteOnceLoaded)); thread.Start(); - //PerformMethodInjection(); } - + //bimmod stuff private void ExecuteOnceLoaded() { @@ -161,97 +160,28 @@ private void ExecuteOnceLoaded() if (!Unlocks.IsUnlocked("CHAOSMODE", universalProfile)) universalProfile.unlocks.Add("CHAOSMODE"); } - DuckGnome.mm = new DuckGnomeMain((Mod)this); - } - - - internal static DuckGnomeMain mm; - } - - - /* - public class PlugInFactory - { - public T CreatePlugin(string path) + UnlockData ImpostorMode = new UnlockData() { - foreach (string file in Directory.GetFiles(path, "*.dll")) - { - foreach (Type assemblyType in Assembly.LoadFrom(file).GetTypes()) - { - Type interfaceType = assemblyType.GetInterface(typeof(T).FullName); - - if (interfaceType != null) - { - return (T)Activator.CreateInstance(assemblyType); - } - } - } - - return default(T); - } - } - - - //mser stuff - //suupor - - internal sealed class Injector - { - private readonly MethodInfo _injectorMethod; - - internal static string InjectorPath - { - get + name = "Sus weapon switching", + id = "IMPOSTORMODE", + type = UnlockType.Modifier, + cost = 0, + description = "random guns are switched out with DGn weapons", + longDescription = "...", + icon = 3, + priceTier = UnlockPrice.Cheap + }; + ((List)typeof(Unlocks).GetField("_allUnlocks", BindingFlags.Static | BindingFlags.NonPublic).GetValue((object)null)).Add(ImpostorMode); + Unlocks.modifierToByte[ImpostorMode.id] = (byte)Unlocks.allUnlocks.Count; + foreach (Profile universalProfile in Profiles.universalProfileList) { - return ModLoader.GetMod().configuration.directory.Replace('/', Path.DirectorySeparatorChar) + "\\MethodInjector.dll"; + if (!Unlocks.IsUnlocked("IMPOSTORMODE", universalProfile)) + universalProfile.unlocks.Add("IMPOSTORMODE"); } + DuckGnome.mm = new DuckGnomeMain((Mod)this); } - internal Injector() - { - try - { - this._injectorMethod = Assembly.LoadFrom(DuckGame.othello7_mod.Injector.InjectorPath).GetType("MethodInjector.Injection").GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)[0]; - if (this._injectorMethod == (MethodInfo)null) - throw new NullReferenceException("InjectorMethod is null."); - } - catch (FileNotFoundException ex) - { - Program.LogLine("INJECTION ERROR: Unable to initialize injector. Missing " + "/MethodInjector.dll"); - Program.LogLine(ex.Message + ex.StackTrace); - } - catch (NullReferenceException ex) - { - Program.LogLine("INJECTION ERROR: Unable to initialize injector. Could not get injector method, probably due to incompatible DLL format."); - Program.LogLine(ex.Message + ex.StackTrace); - } - catch (Exception ex) - { - Program.LogLine("INJECTION ERROR: Unable to initialize injector. Unknown error."); - Program.LogLine(ex.Message + ex.StackTrace); - } - } - internal void Inject(MethodInfo original, MethodInfo replacement) - { - try - { - if (original == (MethodInfo)null) - Program.LogLine("INJECTION ERROR: Original method is null! Replacement: "); - else if (replacement == (MethodInfo)null) - Program.LogLine("INJECTION ERROR: Replacement method is null! Original: "); - else - this._injectorMethod.Invoke((object)null, new object[2] - { - (object) original, - (object) replacement - }); - } - catch(System.NullReferenceException) - { - MessageBox.Show("THERE YA GO"); - } - } + internal static DuckGnomeMain mm; } - */ }