Skip to content

Commit

Permalink
added DGn trolling mode
Browse files Browse the repository at this point in the history
  • Loading branch information
othello777 committed Sep 28, 2022
1 parent 8fe71a1 commit df10659
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 105 deletions.
57 changes: 54 additions & 3 deletions build/src/DuckGnomeMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using System.Linq;
using System.Text;
using DuckGame;
using DuckGame.src;
using othello7_mod.src;

namespace DuckGame.othello7_mod
{
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -163,10 +169,51 @@ public void Update()
this.give_scp = false;
}
}
}
if (remixtimer < 180)
remixtimer++;
if (this.sussyimpotor && remixtimer == 180)
{
remixtimer++;

void swapweapon<T>(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<DuelingPistol>(new SDP(0, 0));
swapweapon<NetGun>(new ShootySelf(0, 0));
swapweapon<DartGun>(new RivalGun(0, 0));
swapweapon<Sword>(new FakeSword(0, 0));
swapweapon<FlareGun>(new FlareSniper(0, 0));
swapweapon<ChestPlate>(new BombDuck(0, 0));
swapweapon<HugeLaser>(new DeathPistol(0, 0));
swapweapon<Phaser>(new OPlaser(0, 0));
swapweapon<CampingRifle>(new RockLauncher(0, 0));
swapweapon<Sniper>(new RockSniper(0, 0));
swapweapon<Shotgun>(new ShotGrenade(0, 0));
swapweapon<Bazooka>(new SuperBazooka(0, 0));
swapweapon<GrenadeLauncher>(new SmokeBlaster(0, 0));
swapweapon<Blunderbuss>(new SmokeBlaster(0, 0));
swapweapon<ChestPlate>(new SCP(0, 0));
swapweapon<AK47>(new TurboAk47(0, 0));
swapweapon<Rock>(new susej(0, 0));
swapweapon<PewPewLaser>(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",
Expand All @@ -189,6 +236,10 @@ public void Update()

private bool chaosmode;

private bool sussyimpotor;

private int remixtimer;

// Token: 0x04000057 RID: 87
private List<Duck> doneDucks1;

Expand Down
134 changes: 32 additions & 102 deletions build/src/othello7_mod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
/*
Expand Down Expand Up @@ -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)
{
Expand All @@ -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()
{
Expand Down Expand Up @@ -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<T>
{
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<UnlockData>)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<DuckGame.othello7_mod.DuckGnome>().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;
}
*/
}

0 comments on commit df10659

Please sign in to comment.