From 8e0dc4465bb4bf1010237b5df428d2ff76905647 Mon Sep 17 00:00:00 2001 From: developomp Date: Wed, 15 Sep 2021 15:34:13 +0900 Subject: [PATCH] fixed WBM not working on newest update --- README.md | 9 +++++---- WBM/WBM.cs | 20 +++++++++++++++++--- WBM/WBM.csproj | 7 ++++--- WBM/WBMVariable.cs | 13 +++---------- scripts/debug.sh | 1 + scripts/release.sh | 1 + 6 files changed, 31 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index fe703bf..b2a8eaa 100644 --- a/README.md +++ b/README.md @@ -192,9 +192,10 @@ 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. 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`. +3. Copy all DLL files from `/war_brokers_Data/Managed/` to `WBM/dll/`. Create directory if it does not exist. +4. Copy `BepInEx.dll` from `/BepInEx/core` to `WBM/dll/`. Create directory if it does not exist. +5. 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. +6. Create `scripts/config.sh`. ```bash #!/bin/bash @@ -202,7 +203,7 @@ If you are a casual user, this is completely unnecessary. **This is only recomme WB_PLUGINS_DIR="" ``` -6. Now you can run the scripts. +7. 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/WBM.cs b/WBM/WBM.cs index 30e31db..eb82ed2 100644 --- a/WBM/WBM.cs +++ b/WBM/WBM.cs @@ -6,15 +6,29 @@ using UnityEngine.Networking; using System; using System.IO; using System.Threading.Tasks; +using System.Collections.Generic; namespace WBM { - [BepInPlugin("com.developomp.wbm", "War Brokers Mods", "1.5.0.0")] + [BepInPlugin("com.developomp.wbm", "War Brokers Mods", "1.5.1.0")] public partial class WBM : BaseUnityPlugin { private async void Start() { Logger.LogDebug("Initializing"); + + // Initialization moved to Start() because of BepInEx error + this.data = new Data.SerializableData(); + this.killStreakAudioDict = new Dictionary(); + this.killStreakSFXDictionary = new Dictionary() + { + {10, "rampage"}, + {20, "killing spree"}, + {30, "unstoppable"}, + {50, "godlike"}, + {69, "nice"}, + }; + this.webguy = FindObjectOfType(); System.Type webguyType = typeof(webguy); @@ -217,7 +231,7 @@ kill streak SFX: {this.killStreakSFX.Value} ({this.killStreakSFXShortcut.Value}) new Rect(this.GUIOffsetX.Value, this.GUIOffsetY.Value, 220, 60), @"War Brokers Mods Made by [LP] POMP -v1.5.0.0" +v1.5.1.0" ); if (this.data.localPlayerIndex >= 0) @@ -309,7 +323,7 @@ zoom: {Util.getGunZoom(this.personGun)}" GUI.Label(new Rect(Screen.width - 100, 440 + teamStatOffset, 70, 190), teamDamage); GUI.Label( - new Rect(Screen.width - 315, 595 + teamStatOffset, 300, 55), + new Rect(Screen.width - 315, 620 + teamStatOffset, 300, 55), $@"total damage: {teamTotalDamage} total deaths: {teamTotalDeaths} total kills: {teamTotalKills}" diff --git a/WBM/WBM.csproj b/WBM/WBM.csproj index 3a9ec65..11a80f4 100644 --- a/WBM/WBM.csproj +++ b/WBM/WBM.csproj @@ -28,9 +28,6 @@ dll\BepInEx.dll - - dll\websocket-sharp.dll - dll\Assembly-CSharp.dll @@ -56,4 +53,8 @@ dll\UnityEngine.UnityWebRequestModule.dll + + + + diff --git a/WBM/WBMVariable.cs b/WBM/WBMVariable.cs index 61e2587..7b0730e 100644 --- a/WBM/WBMVariable.cs +++ b/WBM/WBMVariable.cs @@ -18,7 +18,7 @@ namespace WBM // websocket data stuff private WebSocketSharp.Server.WebSocketServer server; private ushort serverPort = 24601; - private Data.SerializableData data = new Data.SerializableData(); + private Data.SerializableData data; // internal or temporary private bool _showConfig; @@ -69,17 +69,10 @@ namespace WBM private ConfigEntry clearDeathLogShortcut; // Audio - private Dictionary killStreakAudioDict = new Dictionary(); + private Dictionary killStreakAudioDict; private string audioPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "assets/audio"); private AudioSource killStreakAudioSource; - private Dictionary killStreakSFXDictionary = new Dictionary() - { - {10, "rampage"}, - {20, "killing spree"}, - {30, "unstoppable"}, - {50, "godlike"}, - {69, "nice"}, - }; + private Dictionary killStreakSFXDictionary; // memory stuff private static BindingFlags bindFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static; diff --git a/scripts/debug.sh b/scripts/debug.sh index f78b908..cec37c4 100755 --- a/scripts/debug.sh +++ b/scripts/debug.sh @@ -13,5 +13,6 @@ 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/bin/Debug/net48/websocket-sharp.dll "$WB_PLUGINS_DIR/WBM/websocket-sharp.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 2ac376b..c2bdeb4 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -13,6 +13,7 @@ dotnet build --configuration Release [ -e ./dist ] && rm -rf ./dist mkdir ./dist cp ./WBM/bin/Release/net48/WBM.dll ./dist/WBM.dll +cp ./WBM/bin/Release/net48/websocket-sharp.dll ./dist/websocket-sharp.dll cp ./WBM/dll/ConfigurationManager.dll ./dist/ConfigurationManager.dll cp -R ./assets ./dist/assets