v1.4
This commit is contained in:
parent
22df8556ff
commit
3017412cc1
6 changed files with 176 additions and 152 deletions
25
README.md
25
README.md
|
@ -80,12 +80,17 @@ Simply go through the installation process again and replace existing files. You
|
|||
|
||||
## Usage
|
||||
|
||||
- Hold down <kbd>LCtrl</kbd> or <kbd>RShift</kbd> to show shortcuts in-game.
|
||||
### Default shortcuts
|
||||
|
||||
| Function | Shortcut |
|
||||
- Hold down <kbd>LCtrl</kbd> or <kbd>RShift</kbd> 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 | <kbd>LCtrl</kbd>+<kbd>Arrow</kbd> |
|
||||
| Move GUI (long press) | <kbd>LCtrl</kbd>+<kbd>LShift</kbd>+<kbd>Arrow</kbd> |
|
||||
| Show Menu | <kbd>F1</kbd> |
|
||||
| <br /> | |
|
||||
| Move GUI | <kbd>LCtrl</kbd>+<kbd>LShift</kbd>+<kbd>Arrow</kbd> |
|
||||
| Move GUI by one pixel | <kbd>LCtrl</kbd>+<kbd>Arrow</kbd> |
|
||||
| Reset GUI position | <kbd>LCtrl</kbd>+<kbd>R</kbd> |
|
||||
| <br /> | |
|
||||
| Toggle All GUI visibility | <kbd>RShift</kbd>+<kbd>A</kbd> |
|
||||
|
@ -95,10 +100,13 @@ Simply go through the installation process again and replace existing files. You
|
|||
| Toggle Elo visibility on leaderboard | <kbd>RShift</kbd>+<kbd>E</kbd> |
|
||||
| Squad server visibility | <kbd>RShift</kbd>+<kbd>S</kbd> |
|
||||
| Testing servers visibility | <kbd>RShift</kbd>+<kbd>T</kbd> |
|
||||
| Kill streak sound effect | <kbd>RShift</kbd>+<kbd>F</kbd> |
|
||||
| <br /> | |
|
||||
| Toggle shift to crouch | <kbd>RShift</kbd>+<kbd>C</kbd> |
|
||||
| <br /> | |
|
||||
| Reset everything | <kbd>RShift</kbd>+<kbd>R</kbd> |
|
||||
|
||||
#### Warning
|
||||
|
||||
The order of keystroke matter. For example, pressing <kbd>RShift</kbd>+<kbd>A</kbd> is different from pressing <kbd>A</kbd>+<kbd>RShift</kbd>. This is to prevent situation where <kbd>RShift</kbd>+<kbd>A</kbd> fires when the user intended to press <kbd>LCtrl</kbd>+<kbd>RShift</kbd>+<kbd>A</kbd>.
|
||||
|
||||
## 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 `<WB install path>/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="<PATH_TO_PLUGINS_DIRECTORY_HERE>"
|
||||
```
|
||||
|
||||
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.
|
||||
|
|
14
WBM/Data.cs
14
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;
|
||||
}
|
||||
}
|
||||
|
|
196
WBM/WBM.cs
196
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<webguy>();
|
||||
|
||||
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<int>(0, Screen.width)));
|
||||
this.GUIOffsetY = Config.Bind("Config", "GUI Vertical position", 325, new ConfigDescription("WBM GUI Vertical position", new AcceptableValueRange<int>(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<AudioSource>();
|
||||
|
||||
|
@ -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<WSJSONService>("/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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<bool> showGUI;
|
||||
private ConfigEntry<KeyboardShortcut> showGUIShortcut;
|
||||
|
||||
private ConfigEntry<int> GUIOffsetX;
|
||||
private ConfigEntry<int> GUIOffsetY;
|
||||
private ConfigEntry<KeyboardShortcut> resetGUIShortcut;
|
||||
|
||||
private ConfigEntry<bool> shiftToCrouch;
|
||||
private ConfigEntry<KeyboardShortcut> shiftToCrouchShortcut;
|
||||
|
||||
private ConfigEntry<bool> killStreakSFX;
|
||||
private ConfigEntry<KeyboardShortcut> killStreakSFXShortcut;
|
||||
|
||||
private ConfigEntry<bool> showPlayerStats;
|
||||
private ConfigEntry<KeyboardShortcut> showPlayerStatsShortcut;
|
||||
private ConfigEntry<bool> showWeaponStats;
|
||||
private ConfigEntry<KeyboardShortcut> showWeaponStatsShortcut;
|
||||
private ConfigEntry<bool> showTeamStats;
|
||||
private ConfigEntry<KeyboardShortcut> showTeamStatsShortcut;
|
||||
|
||||
private ConfigEntry<bool> showEloOnLeaderboard;
|
||||
private void showEloOnLeaderboardChanged(object sender, EventArgs e)
|
||||
{
|
||||
this.showEloOnLeaderboardRaw = this.showEloOnLeaderboard.Value;
|
||||
}
|
||||
private ConfigEntry<KeyboardShortcut> showEloOnLeaderboardShortcut;
|
||||
|
||||
private ConfigEntry<bool> showSquadServer;
|
||||
private void showSquadServerChanged(object sender, EventArgs e)
|
||||
{
|
||||
this.showSquadServerRaw = this.showSquadServer.Value;
|
||||
}
|
||||
private ConfigEntry<KeyboardShortcut> showSquadServerShortcut;
|
||||
|
||||
private ConfigEntry<bool> showTestingServer;
|
||||
private void showTestingServerChanged(object sender, EventArgs e)
|
||||
{
|
||||
this.showTestingServerRaw = this.showTestingServer.Value;
|
||||
}
|
||||
private ConfigEntry<KeyboardShortcut> showTestingServerShortcut;
|
||||
|
||||
// Audio
|
||||
private Dictionary<string, AudioClip> killStreakAudioDict = new Dictionary<string, AudioClip>();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 ./*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue