v1.6 update. Extended fps cap.

This commit is contained in:
Kim, Jimin 2021-09-17 08:59:21 +09:00
parent 933825ab34
commit 8e24964cd2
5 changed files with 82 additions and 18 deletions

View file

@ -116,6 +116,7 @@ The order of keystroke matter. For example, pressing <kbd>RShift</kbd>+<kbd>A</k
- reconfigure shortcut keys
- clear chat
- clear game messages (kills, deaths, missile launch, bomb diffuse, etc.)
- Extended fps limit (5~240 => disabled~1000)
### in-game overlays

40
WBM/Patches.cs Normal file
View file

@ -0,0 +1,40 @@
using HarmonyLib;
using UnityEngine;
using UnityEngine.UI;
namespace WBM
{
[HarmonyPatch(typeof(webguy))]
[HarmonyPatch("FHBMKCDMGII")]
class FPSSliderPatch
{
private static int defaultTargetFrameRate = -1;
private static int maxTargetFrameRate = 1000;
private static GameObject fpsSliderTextObj = GameObject.Find("fpsSlideFuckText");
private static Slider slider = GameObject.Find("fpsSlider").GetComponent<Slider>();
private static AccessTools.FieldRef<webguy, float> fpsValueRef = AccessTools.FieldRefAccess<webguy, float>("CLLNACDIPHE");
static bool Prefix(webguy __instance, float JKNNNLEEIAO)
{
fpsValueRef(__instance) = JKNNNLEEIAO;
int targetFrameRate = (int)(JKNNNLEEIAO * maxTargetFrameRate);
if (targetFrameRate == 0)
{
((InfernalBehaviour)__instance).KKFJBNFGKEP(fpsSliderTextObj, __instance.HNDAMJPNGAE("Disabled"));
targetFrameRate = defaultTargetFrameRate;
}
else
{
((InfernalBehaviour)__instance).KKFJBNFGKEP(fpsSliderTextObj, targetFrameRate.ToString());
}
if (targetFrameRate > 0 && targetFrameRate < 5) targetFrameRate = 5;
Application.targetFrameRate = targetFrameRate;
return false;
}
}
}

View file

@ -1,5 +1,8 @@
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine;
using UnityEngine.Networking;
@ -9,9 +12,15 @@ using System.Threading.Tasks;
namespace WBM
{
[BepInPlugin("com.developomp.wbm", "War Brokers Mods", "1.5.1.0")]
[BepInPlugin("com.developomp.wbm", "War Brokers Mods", "1.6.0.0")]
public partial class WBM : BaseUnityPlugin
{
private void Awake()
{
this.harmony = new Harmony("com.developomp.wbm");
this.harmony.PatchAll();
}
private async void Start()
{
Logger.LogDebug("Initializing");
@ -189,8 +198,7 @@ namespace WBM
if (this._showConfig)
{
GUI.Box(
new Rect(Screen.width - 340, 70, 320, 340),
$@"Configuration
new Rect(Screen.width - 370, 60, 360, 370), $@"Configuration
move GUI: LCtrl+LShift+Arrow
move GUI by pixel: LCtrl+Arrow
@ -209,7 +217,7 @@ show squad server: {this.showSquadServer.Value} ({this.showSquadServerShortcut.V
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.showGUI.Value) return;
@ -218,7 +226,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.1.0"
v1.6.0.0"
);
if (this.data.localPlayerIndex >= 0)
@ -303,14 +311,14 @@ zoom: {Util.getGunZoom(this.personGun)}"
}
int teamStatOffset = (this.data.gameState == Data.GameStateEnum.Results) ? 310 : 0;
GUI.Box(new Rect(Screen.width - 320, 415 + teamStatOffset, 300, 270), "Team Stats");
GUI.Label(new Rect(Screen.width - 315, 440 + teamStatOffset, 105, 190), teamNames);
GUI.Label(new Rect(Screen.width - 200, 440 + teamStatOffset, 40, 190), teamKDR);
GUI.Label(new Rect(Screen.width - 150, 440 + teamStatOffset, 40, 190), teamPoints);
GUI.Label(new Rect(Screen.width - 100, 440 + teamStatOffset, 70, 190), teamDamage);
GUI.Box(new Rect(Screen.width - 320, 445 + teamStatOffset, 300, 270), "Team Stats");
GUI.Label(new Rect(Screen.width - 315, 470 + teamStatOffset, 105, 190), teamNames);
GUI.Label(new Rect(Screen.width - 200, 470 + teamStatOffset, 40, 190), teamKDR);
GUI.Label(new Rect(Screen.width - 150, 470 + teamStatOffset, 40, 190), teamPoints);
GUI.Label(new Rect(Screen.width - 100, 470 + teamStatOffset, 70, 190), teamDamage);
GUI.Label(
new Rect(Screen.width - 315, 625 + teamStatOffset, 300, 55),
new Rect(Screen.width - 315, 655 + teamStatOffset, 300, 55),
$@"total damage: {teamTotalDamage}
total deaths: {teamTotalDeaths}
total kills: {teamTotalKills}"
@ -323,5 +331,10 @@ total kills: {teamTotalKills}"
}
}
}
private void onDestroy()
{
this.server.Stop();
}
}
}

View file

@ -28,6 +28,9 @@
<Reference Include="BepInEx">
<HintPath>dll\BepInEx.dll</HintPath>
</Reference>
<Reference Include="HarmonyLib">
<HintPath>dll\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>dll\Assembly-CSharp.dll</HintPath>
</Reference>
@ -46,6 +49,9 @@
<Reference Include="UnityEngine.InputLegacyModule">
<HintPath>dll\UnityEngine.InputLegacyModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>dll\UnityEngine.UI.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UnityWebRequestAudioModule">
<HintPath>dll\UnityEngine.UnityWebRequestAudioModule.dll</HintPath>
</Reference>

View file

@ -1,4 +1,7 @@
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine;
using System;
@ -13,6 +16,7 @@ namespace WBM
{
// important boy
private webguy webguy;
private Harmony harmony;
private IEnumerator UpdateValues;
// websocket data stuff
@ -73,13 +77,13 @@ namespace WBM
private string audioPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "assets/audio");
private AudioSource killStreakAudioSource;
private Dictionary<int, string> killStreakSFXDictionary = new Dictionary<int, string>()
{
{10, "rampage"},
{20, "killing spree"},
{30, "unstoppable"},
{50, "godlike"},
{69, "nice"},
};
{
{10, "rampage"},
{20, "killing spree"},
{30, "unstoppable"},
{50, "godlike"},
{69, "nice"},
};
// memory stuff
private static BindingFlags bindFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static;