From 3017412cc16c7dc54addd69d1ca73f5f4687ba7d Mon Sep 17 00:00:00 2001 From: developomp Date: Thu, 9 Sep 2021 12:31:04 +0900 Subject: [PATCH] v1.4 --- README.md | 25 ++++-- WBM/Data.cs | 14 ---- WBM/WBM.cs | 196 ++++++++++++++++++++------------------------- WBM/WBMVariable.cs | 90 +++++++++++++++------ scripts/debug.sh | 1 + scripts/release.sh | 2 + 6 files changed, 176 insertions(+), 152 deletions(-) diff --git a/README.md b/README.md index d6b68e8..972dea3 100644 --- a/README.md +++ b/README.md @@ -80,12 +80,17 @@ Simply go through the installation process again and replace existing files. You ## Usage -- Hold down LCtrl or RShift to show shortcuts in-game. +### Default shortcuts -| Function | Shortcut | +- Hold down LCtrl or RShift to show shortcuts in-game. +- Press F1 to show menu. Press outside the menu to close. + +| Function | Default Shortcut | | ------------------------------------ | --------------------------------------------------- | -| Move GUI by one pixel at a time | LCtrl+Arrow | -| Move GUI (long press) | LCtrl+LShift+Arrow | +| Show Menu | F1 | +|
| | +| Move GUI | LCtrl+LShift+Arrow | +| Move GUI by one pixel | LCtrl+Arrow | | Reset GUI position | LCtrl+R | |
| | | Toggle All GUI visibility | RShift+A | @@ -95,10 +100,13 @@ Simply go through the installation process again and replace existing files. You | Toggle Elo visibility on leaderboard | RShift+E | | Squad server visibility | RShift+S | | Testing servers visibility | RShift+T | +| Kill streak sound effect | RShift+F | |
| | | Toggle shift to crouch | RShift+C | -|
| | -| Reset everything | RShift+R | + +#### Warning + +The order of keystroke matter. For example, pressing RShift+A is different from pressing A+RShift. This is to prevent situation where RShift+A fires when the user intended to press LCtrl+RShift+A. ## Features @@ -178,7 +186,8 @@ If you are a casual user, this is completely unnecessary. **This is only recomme 1. Install .NET sdk. 2. Clone this repository. 3. Copy all DLL files from `/war_brokers_Data/Managed/` to `./WBM/dll/`. Create directory if it does not exist. -4. Create `scripts/config.sh`. +4. Download [BepInEx configuration manager v16](https://github.com/BepInEx/BepInEx.ConfigurationManager/releases) and put the dll file in `WBM/dll` directory. Other file(s) in the zip file can be deleted. +5. Create `scripts/config.sh`. ```bash #!/bin/bash @@ -186,7 +195,7 @@ If you are a casual user, this is completely unnecessary. **This is only recomme WB_PLUGINS_DIR="" ``` -5. Now you can run the scripts. +6. Now you can run the scripts. - `scripts/debug.sh`: Build WBM in debug mode and copy the files to the plugins directory. - `scripts/release.sh`: Create a zip file that can be uploaded in the gh release section. diff --git a/WBM/Data.cs b/WBM/Data.cs index 4d284bf..d1c37fc 100644 --- a/WBM/Data.cs +++ b/WBM/Data.cs @@ -68,19 +68,6 @@ namespace WBM Results } - [DataContract] - public class WBMConfig - { - [DataMember] public bool showSquadServer = true; - [DataMember] public bool showTestingServer = true; - [DataMember] public bool showGUI = true; - [DataMember] public bool showPlayerStats = true; - [DataMember] public bool showWeaponStats = true; - [DataMember] public bool showTeammateStats = true; - [DataMember] public bool showEloOnLeaderboard = true; - [DataMember] public bool shiftToCrouch = true; - } - [DataContract] public class SerializableData { @@ -92,7 +79,6 @@ namespace WBM [DataMember] public int localPlayerIndex = -1; [DataMember] public string[] nickList = new string[] { }; [DataMember] public PlayerStatsStruct[] playerStatsArray = new PlayerStatsStruct[] { }; - [DataMember] public WBMConfig config = new WBMConfig(); [DataMember] public Data.GameStateEnum gameState; } } diff --git a/WBM/WBM.cs b/WBM/WBM.cs index 55497b4..94cce37 100644 --- a/WBM/WBM.cs +++ b/WBM/WBM.cs @@ -1,4 +1,5 @@ using BepInEx; +using BepInEx.Configuration; using UnityEngine; using UnityEngine.Networking; @@ -7,16 +8,14 @@ using System.IO; using System.Collections; using System.Threading.Tasks; -using WebSocketSharp.Server; - namespace WBM { - [BepInPlugin("com.developomp.wbm", "War Brokers Mods", "1.3.1.0")] + [BepInPlugin("com.developomp.wbm", "War Brokers Mods", "1.4.0.0")] public partial class WBM : BaseUnityPlugin { private async void Start() { - Logger.LogDebug("WBM: Initializing"); + Logger.LogDebug("Initializing"); this.webguy = FindObjectOfType(); System.Type webguyType = typeof(webguy); @@ -33,17 +32,40 @@ namespace WBM this.gameStateRef = webguyType.GetField("MCGMEPGBCKK", bindFlags); this.addMessageFuncRef = webguyType.GetMethod("NBPKLIOLLEI", bindFlags); - // Load configurations - this.showSquadServerRaw = Convert.ToBoolean(PlayerPrefs.GetInt(PrefNames.showSquadServer, 1)); - this.showTestingServerRaw = Convert.ToBoolean(PlayerPrefs.GetInt(PrefNames.showTestingServer, 1)); - this.GUIOffsetX = PlayerPrefs.GetInt(PrefNames.GUIOffsetX, this.DefaultGUIOffsetX); - this.GUIOffsetY = PlayerPrefs.GetInt(PrefNames.GUIOffsetY, this.DefaultGUIOffsetY); - this.data.config.showGUI = Convert.ToBoolean(PlayerPrefs.GetInt(PrefNames.showGUI, 1)); - this.data.config.showPlayerStats = Convert.ToBoolean(PlayerPrefs.GetInt(PrefNames.showPlayerStats, 1)); - this.data.config.showWeaponStats = Convert.ToBoolean(PlayerPrefs.GetInt(PrefNames.showWeaponStats, 1)); - this.data.config.showTeammateStats = Convert.ToBoolean(PlayerPrefs.GetInt(PrefNames.showTeammateStats, 1)); - this.showEloOnLeaderboardRaw = Convert.ToBoolean(PlayerPrefs.GetInt(PrefNames.showElo, 1)); - this.data.config.shiftToCrouch = Convert.ToBoolean(PlayerPrefs.GetInt(PrefNames.shiftToCrouch, 1)); + // Configurations + this.showGUI = Config.Bind("Config", "show GUI", true); + this.showGUIShortcut = Config.Bind("Hotkeys", "show GUI Shortcut", new KeyboardShortcut(KeyCode.A, KeyCode.RightShift)); + + this.GUIOffsetX = Config.Bind("Config", "GUI Horizontal position", 38, new ConfigDescription("WBM GUI Horizontal position", new AcceptableValueRange(0, Screen.width))); + this.GUIOffsetY = Config.Bind("Config", "GUI Vertical position", 325, new ConfigDescription("WBM GUI Vertical position", new AcceptableValueRange(0, Screen.height))); + this.resetGUIShortcut = Config.Bind("Hotkeys", "reset GUI position", new KeyboardShortcut(KeyCode.R, KeyCode.LeftControl)); + + this.shiftToCrouch = Config.Bind("Config", "shift to crouch", true); + this.shiftToCrouchShortcut = Config.Bind("Hotkeys", "shift to crouch", new KeyboardShortcut(KeyCode.C, KeyCode.RightShift)); + + this.killStreakSFX = Config.Bind("Config", "kill streak sound effect", true); + this.killStreakSFXShortcut = Config.Bind("Hotkeys", "kill streak sound effect", new KeyboardShortcut(KeyCode.F, KeyCode.RightShift)); + + this.showPlayerStats = Config.Bind("Config", "show player statistics", true); + this.showPlayerStatsShortcut = Config.Bind("Hotkeys", "show player statistics", new KeyboardShortcut(KeyCode.P, KeyCode.RightShift)); + + this.showWeaponStats = Config.Bind("Config", "show weapon statistics", true); + this.showWeaponStatsShortcut = Config.Bind("Hotkeys", "show weapon statistics", new KeyboardShortcut(KeyCode.W, KeyCode.RightShift)); + + this.showTeamStats = Config.Bind("Config", "show team statistics", true); + this.showTeamStatsShortcut = Config.Bind("Hotkeys", "show team statistics", new KeyboardShortcut(KeyCode.L, KeyCode.RightShift)); + + this.showEloOnLeaderboard = Config.Bind("Config", "show Elo on leaderboard", true); + this.showEloOnLeaderboard.SettingChanged += this.showEloOnLeaderboardChanged; + this.showEloOnLeaderboardShortcut = Config.Bind("Hotkeys", "show Elo on leaderboard", new KeyboardShortcut(KeyCode.E, KeyCode.RightShift)); + + this.showSquadServer = Config.Bind("Config", "show squad server", true); + this.showSquadServer.SettingChanged += this.showSquadServerChanged; + this.showSquadServerShortcut = Config.Bind("Hotkeys", "show squad server", new KeyboardShortcut(KeyCode.S, KeyCode.RightShift)); + + this.showTestingServer = Config.Bind("Config", "show testing server", true); + this.showTestingServer.SettingChanged += this.showTestingServerChanged; + this.showTestingServerShortcut = Config.Bind("Hotkeys", "show testing server", new KeyboardShortcut(KeyCode.T, KeyCode.RightShift)); this.killStreakAudioSource = this.gameObject.AddComponent(); @@ -82,13 +104,13 @@ namespace WBM } } - server = new WebSocketServer($"ws://127.0.0.1:{this.serverPort}"); + server = new WebSocketSharp.Server.WebSocketServer($"ws://127.0.0.1:{this.serverPort}"); server.AddWebSocketService("/json"); server.Start(); StartCoroutine(UpdateValuesFunction()); - Logger.LogDebug("WBM: Ready!"); + Logger.LogDebug("Ready!"); } private void Update() @@ -99,62 +121,43 @@ namespace WBM // move GUI if (Input.GetKey(KeyCode.LeftShift)) { - if (Input.GetKey(KeyCode.UpArrow)) this.GUIOffsetY -= 1; - if (Input.GetKey(KeyCode.DownArrow)) this.GUIOffsetY += 1; - if (Input.GetKey(KeyCode.LeftArrow)) this.GUIOffsetX -= 1; - if (Input.GetKey(KeyCode.RightArrow)) this.GUIOffsetX += 1; + if (Input.GetKey(KeyCode.UpArrow)) this.GUIOffsetY.Value -= 1; + if (Input.GetKey(KeyCode.DownArrow)) this.GUIOffsetY.Value += 1; + if (Input.GetKey(KeyCode.LeftArrow)) this.GUIOffsetX.Value -= 1; + if (Input.GetKey(KeyCode.RightArrow)) this.GUIOffsetX.Value += 1; } else { - if (Input.GetKeyDown(KeyCode.UpArrow)) this.GUIOffsetY -= 1; - if (Input.GetKeyDown(KeyCode.DownArrow)) this.GUIOffsetY += 1; - if (Input.GetKeyDown(KeyCode.LeftArrow)) this.GUIOffsetX -= 1; - if (Input.GetKeyDown(KeyCode.RightArrow)) this.GUIOffsetX += 1; + if (Input.GetKeyDown(KeyCode.UpArrow)) this.GUIOffsetY.Value -= 1; + if (Input.GetKeyDown(KeyCode.DownArrow)) this.GUIOffsetY.Value += 1; + if (Input.GetKeyDown(KeyCode.LeftArrow)) this.GUIOffsetX.Value -= 1; + if (Input.GetKeyDown(KeyCode.RightArrow)) this.GUIOffsetX.Value += 1; } - - // reset GUI location - if (Input.GetKeyDown(KeyCode.R)) - { - this.GUIOffsetX = this.DefaultGUIOffsetX; - this.GUIOffsetY = this.DefaultGUIOffsetY; - } - this.showConfig = true; } - // Configuration shortbut - if (Input.GetKey(KeyCode.RightShift)) + // reset GUI position + if (this.resetGUIShortcut.Value.IsDown()) { - if (Input.GetKeyDown(KeyCode.A)) this.data.config.showGUI = !this.data.config.showGUI; - if (Input.GetKeyDown(KeyCode.P)) this.data.config.showPlayerStats = !this.data.config.showPlayerStats; - if (Input.GetKeyDown(KeyCode.W)) this.data.config.showWeaponStats = !this.data.config.showWeaponStats; - if (Input.GetKeyDown(KeyCode.L)) this.data.config.showTeammateStats = !this.data.config.showTeammateStats; - if (Input.GetKeyDown(KeyCode.E)) this.showEloOnLeaderboardRaw = !this.showEloOnLeaderboardRaw; - if (Input.GetKeyDown(KeyCode.S)) this.showSquadServerRaw = !this.showSquadServerRaw; - if (Input.GetKeyDown(KeyCode.T)) this.showTestingServerRaw = !this.showTestingServerRaw; - if (Input.GetKeyDown(KeyCode.C)) this.data.config.shiftToCrouch = !this.data.config.shiftToCrouch; - if (Input.GetKeyDown(KeyCode.R)) - { - this.GUIOffsetX = this.DefaultGUIOffsetX; - this.GUIOffsetY = this.DefaultGUIOffsetY; - - this.data.config.showGUI = true; - this.data.config.showPlayerStats = true; - this.data.config.showWeaponStats = true; - this.data.config.showTeammateStats = true; - this.showEloOnLeaderboardRaw = true; - this.showSquadServerRaw = true; - this.showTestingServerRaw = true; - this.data.config.shiftToCrouch = true; - } - - this.showConfig = true; + this.GUIOffsetX.Value = (int)this.GUIOffsetX.DefaultValue; + this.GUIOffsetY.Value = (int)this.GUIOffsetY.DefaultValue; } - // hide config - if (!Input.GetKey(KeyCode.LeftControl) && !Input.GetKey(KeyCode.RightShift)) this.showConfig = false; + if (this.showGUIShortcut.Value.IsDown()) this.showGUI.Value = !this.showGUI.Value; + if (this.shiftToCrouchShortcut.Value.IsDown()) this.shiftToCrouch.Value = !this.shiftToCrouch.Value; + if (this.killStreakSFXShortcut.Value.IsDown()) this.killStreakSFX.Value = !this.killStreakSFX.Value; + if (this.showPlayerStatsShortcut.Value.IsDown()) this.showPlayerStats.Value = !this.showPlayerStats.Value; + if (this.showWeaponStatsShortcut.Value.IsDown()) this.showWeaponStats.Value = !this.showWeaponStats.Value; + if (this.showTeamStatsShortcut.Value.IsDown()) this.showTeamStats.Value = !this.showTeamStats.Value; + if (this.showEloOnLeaderboardShortcut.Value.IsDown()) this.showEloOnLeaderboard.Value = !this.showEloOnLeaderboard.Value; + if (this.showSquadServerShortcut.Value.IsDown()) this.showSquadServer.Value = !this.showSquadServer.Value; + if (this.showTestingServerShortcut.Value.IsDown()) this.showTestingServer.Value = !this.showTestingServer.Value; + + // config visibility + if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightShift)) this._showConfig = true; + if (!Input.GetKey(KeyCode.LeftControl) && !Input.GetKey(KeyCode.RightShift)) this._showConfig = false; // only if right buttton is not held - if (this.data.config.shiftToCrouch && !Input.GetMouseButton(1)) + if (this.shiftToCrouch.Value && !Input.GetMouseButton(1)) { if (Input.GetKeyDown(KeyCode.LeftShift)) OMOJPGNNKFN.NEELEHFDKBP.EGACOOOGDDC = true; if (Input.GetKeyUp(KeyCode.LeftShift)) OMOJPGNNKFN.NEELEHFDKBP.EGACOOOGDDC = false; @@ -167,42 +170,42 @@ namespace WBM GUI.skin.label.fontSize = 15; GUI.skin.label.wordWrap = false; - if (this.showConfig) + if (this._showConfig) { GUI.Box( new Rect(Screen.width - 340, 80, 320, 300), $@"Configuration -(LCtrl+Arrow) to move GUI one step at a time -(LCtrl+LShift+Arrow) to move long distance -(LCtrl+R) to reset GUI position +move GUI: LCtrl+LShift+Arrow +move GUI by pixel: LCtrl+Arrow +reset GUI position: {this.resetGUIShortcut.Value} -GUI X offset: {this.GUIOffsetX} -GUI Y offset: {this.GUIOffsetY} -Show WBM GUI: {this.data.config.showGUI} (RShift+A) -Show Elo on leaderboard: {this.showEloOnLeaderboardRaw} (RShift+E) -Show player stats: {this.data.config.showPlayerStats} (RShift+P) -Show weapon stats: {this.data.config.showWeaponStats} (RShift+W) -Show teammate stats: {this.data.config.showTeammateStats} (RShift+L) -show squad server: {this.showSquadServerRaw} (RShift+S) -show testing server: {this.showTestingServerRaw} (RShift+T) -shift to crouch: {this.data.config.shiftToCrouch} (RShift+C) -Reset Everything: (RShift+R)" +GUI X offset: {this.GUIOffsetX.Value} +GUI Y offset: {this.GUIOffsetY.Value} +Show WBM GUI: {this.showGUI.Value} ({this.showGUIShortcut.Value}) +Show Elo on leaderboard: {this.showEloOnLeaderboard.Value} ({this.showEloOnLeaderboardShortcut.Value}) +Show player stats: {this.showPlayerStats.Value} ({this.showPlayerStatsShortcut.Value}) +Show weapon stats: {this.showWeaponStats.Value} ({this.showWeaponStatsShortcut.Value}) +Show teammate stats: {this.showTeamStats.Value} ({this.showTeamStatsShortcut.Value}) +show squad server: {this.showSquadServer.Value} ({this.showSquadServerShortcut.Value}) +show testing server: {this.showTestingServer.Value} ({this.showTestingServerShortcut.Value}) +shift to crouch: {this.shiftToCrouch.Value} ({this.shiftToCrouchShortcut.Value}) +kill streak SFX: {this.killStreakSFX.Value} ({this.killStreakSFXShortcut.Value})" ); } - if (!this.data.config.showGUI) return; + if (!this.showGUI.Value) return; GUI.Box( - new Rect(this.GUIOffsetX, this.GUIOffsetY, 220, 60), + new Rect(this.GUIOffsetX.Value, this.GUIOffsetY.Value, 220, 60), @"War Brokers Mods Made by [LP] POMP -v1.3.1.0" +v1.4.0.0" ); if (this.data.localPlayerIndex >= 0) { - if (this.data.config.showPlayerStats) + if (this.showPlayerStats.Value) { try { @@ -210,7 +213,7 @@ v1.3.1.0" string gamesEloDeltaSign = this.myPlayerStats.gamesEloDelta >= 0 ? "+" : ""; GUI.Box( - new Rect(this.GUIOffsetX, this.GUIOffsetY + 65, 220, 180), + new Rect(this.GUIOffsetX.Value, this.GUIOffsetY.Value + 65, 220, 180), $@"Player stats KDR: {Util.formatKDR(this.myPlayerStats.kills, this.myPlayerStats.deaths)} @@ -229,12 +232,12 @@ Kill streak: {this.killStreak}" } } - if (this.data.config.showWeaponStats) + if (this.showWeaponStats.Value) { try { GUI.Box( - new Rect(this.GUIOffsetX, this.GUIOffsetY + 250, 230, 130), + new Rect(this.GUIOffsetX.Value, this.GUIOffsetY.Value + 250, 230, 130), $@"Weapon stats fire Timer: {String.Format("{0:0.00}", Util.getGunFireTimer(this.personGun))}s (max: {String.Format("{0:0.00}", Util.getGunFireRate(this.personGun))}s) @@ -250,7 +253,7 @@ zoom: {Util.getGunZoom(this.personGun)}" } } - if (this.data.config.showTeammateStats) + if (this.showTeamStats.Value) { try { @@ -328,7 +331,7 @@ total kills: {teamTotalKills}" { Logger.LogDebug(this.killStreakAudioDict); - if (this.killStreakSFXDictionary.ContainsKey(this.killStreak)) + if (this.killStreakSFX.Value && this.killStreakSFXDictionary.ContainsKey(this.killStreak)) { this.killStreakAudioSource.clip = this.killStreakAudioDict[this.killStreakSFXDictionary[this.killStreak]]; this.killStreakAudioSource.Play(); @@ -348,10 +351,6 @@ total kills: {teamTotalKills}" this.prevKills = this.myPlayerStats.kills; } - this.data.config.showSquadServer = this.showSquadServerRaw; - this.data.config.showTestingServer = this.showTestingServerRaw; - this.data.config.showEloOnLeaderboard = this.showEloOnLeaderboardRaw; - this.server.WebSocketServices["/json"].Sessions.Broadcast(Util.data2JSON(data)); } catch (Exception e) @@ -364,22 +363,5 @@ total kills: {teamTotalKills}" this.UpdateValues = UpdateValuesFunction(); StartCoroutine(this.UpdateValues); } - - private void OnDestroy() - { - // save Configuration - PlayerPrefs.SetInt(PrefNames.showSquadServer, Convert.ToInt32(this.showSquadServerRaw)); - PlayerPrefs.SetInt(PrefNames.showTestingServer, Convert.ToInt32(this.showTestingServerRaw)); - PlayerPrefs.SetInt(PrefNames.GUIOffsetX, this.GUIOffsetX); - PlayerPrefs.SetInt(PrefNames.GUIOffsetY, this.GUIOffsetY); - PlayerPrefs.SetInt(PrefNames.showGUI, Convert.ToInt32(this.data.config.showGUI)); - PlayerPrefs.SetInt(PrefNames.showPlayerStats, Convert.ToInt32(this.data.config.showPlayerStats)); - PlayerPrefs.SetInt(PrefNames.showWeaponStats, Convert.ToInt32(this.data.config.showWeaponStats)); - PlayerPrefs.SetInt(PrefNames.showTeammateStats, Convert.ToInt32(this.data.config.showTeammateStats)); - PlayerPrefs.SetInt(PrefNames.showElo, Convert.ToInt32(this.showEloOnLeaderboardRaw)); - PlayerPrefs.SetInt(PrefNames.shiftToCrouch, Convert.ToInt32(this.data.config.shiftToCrouch)); - - PlayerPrefs.Save(); - } } } diff --git a/WBM/WBMVariable.cs b/WBM/WBMVariable.cs index 9893787..bba24d8 100644 --- a/WBM/WBMVariable.cs +++ b/WBM/WBMVariable.cs @@ -1,30 +1,71 @@ +using BepInEx.Configuration; using UnityEngine; +using System; using System.IO; using System.Reflection; using System.Collections; using System.Collections.Generic; -using WebSocketSharp.Server; - namespace WBM { public partial class WBM { - private static BindingFlags bindFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static; + // important boy private webguy webguy; private IEnumerator UpdateValues; - private WebSocketServer server; + + // websocket data stuff + private WebSocketSharp.Server.WebSocketServer server; private ushort serverPort = 24601; + private Data.SerializableData data = new Data.SerializableData(); - public Data.SerializableData data = new Data.SerializableData(); + // internal or temporary + private bool _showConfig; - private bool showConfig = false; - private int GUIOffsetX; - private int DefaultGUIOffsetX = 38; - private int GUIOffsetY; - private int DefaultGUIOffsetY = 325; + // Configurations + private ConfigEntry showGUI; + private ConfigEntry showGUIShortcut; + private ConfigEntry GUIOffsetX; + private ConfigEntry GUIOffsetY; + private ConfigEntry resetGUIShortcut; + + private ConfigEntry shiftToCrouch; + private ConfigEntry shiftToCrouchShortcut; + + private ConfigEntry killStreakSFX; + private ConfigEntry killStreakSFXShortcut; + + private ConfigEntry showPlayerStats; + private ConfigEntry showPlayerStatsShortcut; + private ConfigEntry showWeaponStats; + private ConfigEntry showWeaponStatsShortcut; + private ConfigEntry showTeamStats; + private ConfigEntry showTeamStatsShortcut; + + private ConfigEntry showEloOnLeaderboard; + private void showEloOnLeaderboardChanged(object sender, EventArgs e) + { + this.showEloOnLeaderboardRaw = this.showEloOnLeaderboard.Value; + } + private ConfigEntry showEloOnLeaderboardShortcut; + + private ConfigEntry showSquadServer; + private void showSquadServerChanged(object sender, EventArgs e) + { + this.showSquadServerRaw = this.showSquadServer.Value; + } + private ConfigEntry showSquadServerShortcut; + + private ConfigEntry showTestingServer; + private void showTestingServerChanged(object sender, EventArgs e) + { + this.showTestingServerRaw = this.showTestingServer.Value; + } + private ConfigEntry showTestingServerShortcut; + + // Audio private Dictionary killStreakAudioDict = new Dictionary(); private string audioPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "assets/audio"); private AudioSource killStreakAudioSource; @@ -37,16 +78,19 @@ namespace WBM {69, "nice"}, }; + // memory stuff + private static BindingFlags bindFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static; + private FieldInfo showEloOnLeaderboardRef; private bool showEloOnLeaderboardRaw { get { - return (bool)showEloOnLeaderboardRef.GetValue(this.webguy); + return (bool)this.showEloOnLeaderboardRef.GetValue(this.webguy); } set { - showEloOnLeaderboardRef.SetValue(this.webguy, value); + this.showEloOnLeaderboardRef.SetValue(this.webguy, value); } } @@ -55,11 +99,11 @@ namespace WBM { get { - return (bool)showSquadServerRef.GetValue(this.webguy); + return (bool)this.showSquadServerRef.GetValue(this.webguy); } set { - showSquadServerRef.SetValue(this.webguy, value); + this.showSquadServerRef.SetValue(this.webguy, value); } } @@ -68,11 +112,11 @@ namespace WBM { get { - return (bool)showTestingServerRef.GetValue(this.webguy); + return (bool)this.showTestingServerRef.GetValue(this.webguy); } set { - showTestingServerRef.SetValue(this.webguy, value); + this.showTestingServerRef.SetValue(this.webguy, value); } } @@ -81,7 +125,7 @@ namespace WBM { get { - PDEMAFHPNBD[] rawPlayerStatsArray = (PDEMAFHPNBD[])playerStatsArrayRef.GetValue(this.webguy); + PDEMAFHPNBD[] rawPlayerStatsArray = (PDEMAFHPNBD[])this.playerStatsArrayRef.GetValue(this.webguy); Data.PlayerStatsStruct[] result = new Data.PlayerStatsStruct[rawPlayerStatsArray.Length]; for (int i = 0; i < rawPlayerStatsArray.Length; i++) @@ -119,7 +163,7 @@ namespace WBM { get { - return (int)currentAreaRef.GetValue(this.webguy); + return (int)this.currentAreaRef.GetValue(this.webguy); } } @@ -128,7 +172,7 @@ namespace WBM { get { - return (Data.TeamEnum[])teamListRef.GetValue(this.webguy); + return (Data.TeamEnum[])this.teamListRef.GetValue(this.webguy); } } private Data.TeamEnum[] teamList; @@ -139,7 +183,7 @@ namespace WBM { get { - return (int)localPlayerIndexRef.GetValue(this.webguy); + return (int)this.localPlayerIndexRef.GetValue(this.webguy); } } @@ -148,7 +192,7 @@ namespace WBM { get { - return (NGNJNHEFLHB)personGunRef.GetValue(this.webguy); + return (NGNJNHEFLHB)this.personGunRef.GetValue(this.webguy); } } private NGNJNHEFLHB personGun; @@ -158,7 +202,7 @@ namespace WBM { get { - return (string[])nickListRef.GetValue(this.webguy); + return (string[])this.nickListRef.GetValue(this.webguy); } } @@ -167,7 +211,7 @@ namespace WBM { get { - return (Data.GameStateEnum)gameStateRef.GetValue(this.webguy); + return (Data.GameStateEnum)this.gameStateRef.GetValue(this.webguy); } } diff --git a/scripts/debug.sh b/scripts/debug.sh index 99a5c00..f78b908 100755 --- a/scripts/debug.sh +++ b/scripts/debug.sh @@ -13,4 +13,5 @@ dotnet build rm "$WB_PLUGINS_DIR/WBM/WBM.dll" mkdir -p "$WB_PLUGINS_DIR/WBM" cp ./WBM/bin/Debug/net48/WBM.dll "$WB_PLUGINS_DIR/WBM/WBM.dll" +cp ./WBM/dll/ConfigurationManager.dll "$WB_PLUGINS_DIR/WBM/ConfigurationManager.dll" cp -R ./assets "$WB_PLUGINS_DIR/WBM" diff --git a/scripts/release.sh b/scripts/release.sh index 3acbae7..2ac376b 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -13,8 +13,10 @@ dotnet build --configuration Release [ -e ./dist ] && rm -rf ./dist mkdir ./dist cp ./WBM/bin/Release/net48/WBM.dll ./dist/WBM.dll +cp ./WBM/dll/ConfigurationManager.dll ./dist/ConfigurationManager.dll cp -R ./assets ./dist/assets +# create new zip file [ -e ./WBM.zip ] && rm ./WBM.zip cd ./dist zip -r WBM.zip ./*