generated from Stick_Mods/stick.plugins.tmpl
Compare commits
16 Commits
bd0365dd11
...
v1.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b428f58a68 | ||
|
|
0e0c0e8412 | ||
|
|
9139433175 | ||
|
|
05aac8ff04 | ||
|
|
0c5b3fd3ec | ||
|
|
d5af94a0ec | ||
|
|
01352a878f | ||
|
|
10cd3daf79 | ||
|
|
90cfd7e764 | ||
|
|
2269ae5b51 | ||
|
|
499f4e68ba | ||
|
|
afc70118eb | ||
|
|
fffffad6a3 | ||
|
|
ffb978885e | ||
|
|
1385832981 | ||
|
|
c628478eec |
2
LICENSE
2
LICENSE
@@ -219,7 +219,7 @@ If you develop a new program, and you want it to be of the greatest possible use
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
stick.plugins.tmpl
|
||||
stick.plugins.xhighws
|
||||
Copyright (C) 2026 Stick_Mods
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
32
Patches/AddWSOptions.cs
Normal file
32
Patches/AddWSOptions.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using HarmonyLib;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
namespace stick.plugins.xhighws.Patches;
|
||||
|
||||
[HarmonyPatch(typeof(OptionsButton), "Start")]
|
||||
class AddWSOptions
|
||||
{
|
||||
static void Postfix(OptionsButton __instance, ref int ___currentIndex, ref TextMeshProUGUI ___text)
|
||||
{
|
||||
// Debug.Log("parent: " + __instance.transform.parent.name);
|
||||
if (__instance.transform.parent.name == "weaponSpawns")
|
||||
{
|
||||
__instance.values = [
|
||||
"NONE",
|
||||
"LOW",
|
||||
"NORMAL",
|
||||
"HIGH",
|
||||
"XHIGH",
|
||||
"MAX"
|
||||
];
|
||||
// 再读一遍防止clamp到旧的范围
|
||||
if (PlayerPrefs.HasKey(__instance.transform.parent.name))
|
||||
{
|
||||
___currentIndex = PlayerPrefs.GetInt(__instance.transform.parent.name);
|
||||
}
|
||||
___currentIndex = Mathf.Clamp(___currentIndex, 0, __instance.values.Length - 1);
|
||||
___text.text = __instance.values[___currentIndex];
|
||||
}
|
||||
}
|
||||
}
|
||||
38
Patches/Apply2StartMatch.cs
Normal file
38
Patches/Apply2StartMatch.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
|
||||
namespace stick.plugins.xhighws.Patches;
|
||||
|
||||
[HarmonyPatch(typeof(GameManager), "StartMatch")]
|
||||
class Apply2StartMatch
|
||||
{
|
||||
static void Postfix(
|
||||
ref float ___randomWeaponCounter,
|
||||
float ___extraSpawnWeaponTime
|
||||
)
|
||||
{
|
||||
switch (OptionsHolder.weaponsSpawn)
|
||||
{
|
||||
case 0: // NONE
|
||||
break;
|
||||
case 1: // LOW
|
||||
___randomWeaponCounter = UnityEngine.Random.Range(4f, 8f);
|
||||
break;
|
||||
case 2: // NORMAL
|
||||
___randomWeaponCounter = UnityEngine.Random.Range(2f, 4f);
|
||||
break;
|
||||
case 3: // HIGH
|
||||
___randomWeaponCounter = UnityEngine.Random.Range(0.5f, 1f);
|
||||
break;
|
||||
case 4: // XHIGH
|
||||
___randomWeaponCounter = 0.3f;
|
||||
break;
|
||||
case 5: // MAX
|
||||
___randomWeaponCounter = 0f;
|
||||
break;
|
||||
}
|
||||
___randomWeaponCounter += ___extraSpawnWeaponTime;
|
||||
}
|
||||
}
|
||||
94
Patches/ApplyExtraWS.cs
Normal file
94
Patches/ApplyExtraWS.cs
Normal file
@@ -0,0 +1,94 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
|
||||
namespace stick.plugins.xhighws.Patches;
|
||||
|
||||
[HarmonyPatch(typeof(GameManager), "SpawnRandomWeapon")]
|
||||
class ApplyExtraWS
|
||||
{
|
||||
static bool Prefix(
|
||||
bool ___dontSpawnItems,
|
||||
ref float ___randomWeaponCounter,
|
||||
float ___extraSpawnWeaponTime,
|
||||
ref bool ___spawnedLastWeaponOnLeftSide,
|
||||
WeaponSelectionHandler ___m_WeaponSelectionHandler,
|
||||
MapWrapper ___lastMapNumber,
|
||||
MultiplayerManager ___mNetworkManager,
|
||||
List<Rigidbody> ___mSpawnedWeapons
|
||||
)
|
||||
{
|
||||
if (___dontSpawnItems)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (MatchmakingHandler.IsNetworkMatch && !MultiplayerManager.IsServer)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// 用 do-while 替代递归
|
||||
do
|
||||
{
|
||||
switch (OptionsHolder.weaponsSpawn)
|
||||
{
|
||||
case 0: // NONE
|
||||
return false;
|
||||
case 1: // LOW
|
||||
___randomWeaponCounter = UnityEngine.Random.Range(8f, 12f);
|
||||
break;
|
||||
case 2: // NORMAL
|
||||
___randomWeaponCounter = UnityEngine.Random.Range(5f, 8f);
|
||||
break;
|
||||
case 3: // HIGH
|
||||
___randomWeaponCounter = UnityEngine.Random.Range(3f, 5f);
|
||||
break;
|
||||
case 4: // XHIGH
|
||||
___randomWeaponCounter = UnityEngine.Random.Range(1f, 3f);
|
||||
break;
|
||||
case 5: // MAX
|
||||
___randomWeaponCounter = UnityEngine.Random.Range(0.5f, 1f);
|
||||
break;
|
||||
}
|
||||
___randomWeaponCounter += ___extraSpawnWeaponTime;
|
||||
float spawnRange = UnityEngine.Random.Range(0f, 8f);
|
||||
if (___spawnedLastWeaponOnLeftSide)
|
||||
{
|
||||
spawnRange *= -1f;
|
||||
}
|
||||
___spawnedLastWeaponOnLeftSide = !___spawnedLastWeaponOnLeftSide;
|
||||
float scaleMultipler = 11f;
|
||||
if (GameManager.Instance)
|
||||
{
|
||||
scaleMultipler *= GameManager.Instance.LastAppliedScale;
|
||||
}
|
||||
Vector3 spawnPos = Vector3.up * scaleMultipler + Vector3.forward * spawnRange;
|
||||
GameObject gameObject;
|
||||
int randomWeaponIndex = ___m_WeaponSelectionHandler.GetRandomWeaponIndex(true, out gameObject);
|
||||
if (randomWeaponIndex < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bool shouldSpawnWeaponInCurMap = false;
|
||||
if (___lastMapNumber.MapType == 0)
|
||||
{
|
||||
int mapId = BitConverter.ToInt32(___lastMapNumber.MapData, 0);
|
||||
shouldSpawnWeaponInCurMap = mapId >= 104 && mapId <= 124;
|
||||
}
|
||||
if (MatchmakingHandler.IsNetworkMatch)
|
||||
{
|
||||
___mNetworkManager.SpawnWeapon(randomWeaponIndex, spawnPos, shouldSpawnWeaponInCurMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
GameObject gameObject2 = UnityEngine.Object.Instantiate<GameObject>(gameObject, spawnPos, Quaternion.identity);
|
||||
if (shouldSpawnWeaponInCurMap)
|
||||
{
|
||||
gameObject2.GetComponent<WeaponPickUp>().ChangeToPresent();
|
||||
}
|
||||
___mSpawnedWeapons.Add(gameObject2.GetComponent<Rigidbody>());
|
||||
}
|
||||
} while (UnityEngine.Random.value > 0.9f);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
|
||||
[HarmonyPatch(typeof(MultiplayerManager), "OnKicked")]
|
||||
class IgnoreKick
|
||||
{
|
||||
public static bool Prefix(ref byte[] data)
|
||||
{
|
||||
MultiplayerManager.KickResponse kickResponse = (MultiplayerManager.KickResponse)data[0];
|
||||
Debug.LogWarning("Received Kick Message, the reason is: " + kickResponse.ToString());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
27
Patches/PatchGetOptionsData.cs
Normal file
27
Patches/PatchGetOptionsData.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System.IO;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
|
||||
namespace stick.plugins.xhighws.Patches;
|
||||
|
||||
[HarmonyPatch(typeof(OptionsHolder), "GetOptionsData")]
|
||||
class PatchGetOptionsData
|
||||
{
|
||||
static bool Prefix(ref byte[] __result)
|
||||
{
|
||||
byte[] array = new byte[4];
|
||||
using (MemoryStream memoryStream = new MemoryStream(array))
|
||||
{
|
||||
using (BinaryWriter binaryWriter = new BinaryWriter(memoryStream))
|
||||
{
|
||||
binaryWriter.Write((byte)OptionsHolder.maps);
|
||||
binaryWriter.Write((byte)PlayerPrefs.GetInt("HP"));
|
||||
binaryWriter.Write((byte)OptionsHolder.regen);
|
||||
// Convert to ori options
|
||||
binaryWriter.Write((byte)XHighWeaponSpawn.ToOriWSOptions[OptionsHolder.weaponsSpawn]);
|
||||
}
|
||||
}
|
||||
__result = array;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
114
Plugin.cs
114
Plugin.cs
@@ -3,8 +3,10 @@ using BepInEx.Configuration;
|
||||
using UnityEngine;
|
||||
using Steamworks;
|
||||
using HarmonyLib;
|
||||
using System.Reflection;
|
||||
using stick.plugins.xhighws.Patches;
|
||||
|
||||
namespace stick.plugins.tmpl;
|
||||
namespace stick.plugins.xhighws;
|
||||
|
||||
/// <summary>
|
||||
/// 玩家管理器插件主类
|
||||
@@ -12,94 +14,44 @@ namespace stick.plugins.tmpl;
|
||||
/// </summary>
|
||||
[BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]
|
||||
[BepInProcess("StickFight.exe")]
|
||||
public class Tmpl : BaseUnityPlugin
|
||||
public class XHighWeaponSpawn : BaseUnityPlugin
|
||||
{
|
||||
#region 配置项
|
||||
|
||||
/// <summary>
|
||||
/// 是否屏蔽来自其他玩家的踢出请求
|
||||
/// </summary>
|
||||
private static ConfigEntry<bool> _blockKicks;
|
||||
|
||||
/// <summary>
|
||||
/// 大厅信息开关快捷键
|
||||
/// </summary>
|
||||
private static ConfigEntry<KeyCode> _lobbyInfoToggleKeyCode;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 生命周期方法
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
InitializeConfiguration();
|
||||
ApplyPatches();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
HandleInput();
|
||||
}
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
if (PlayerManagerGUI.ShowLobbyInfo)
|
||||
{
|
||||
PlayerManagerGUI.DrawLobbyInfoGUI();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 私有方法
|
||||
|
||||
/// <summary>
|
||||
/// 初始化配置项
|
||||
/// </summary>
|
||||
private void InitializeConfiguration()
|
||||
{
|
||||
_blockKicks = Config.Bind(
|
||||
"General",
|
||||
"BlockKicks",
|
||||
true,
|
||||
"是否屏蔽来自其他玩家的踢出请求"
|
||||
);
|
||||
|
||||
_lobbyInfoToggleKeyCode = Config.Bind(
|
||||
"LobbyInfo",
|
||||
"ToggleKeyCode",
|
||||
KeyCode.F2,
|
||||
"Lobby信息开关快捷键"
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用Harmony补丁
|
||||
/// </summary>
|
||||
private void ApplyPatches()
|
||||
{
|
||||
if (_blockKicks.Value)
|
||||
{
|
||||
Harmony.CreateAndPatchAll(typeof(IgnoreKick));
|
||||
}
|
||||
Harmony.CreateAndPatchAll(typeof(AddWSOptions));
|
||||
Harmony.CreateAndPatchAll(typeof(Apply2StartMatch));
|
||||
Harmony.CreateAndPatchAll(typeof(ApplyExtraWS));
|
||||
Harmony.CreateAndPatchAll(typeof(PatchGetOptionsData));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理输入
|
||||
/// </summary>
|
||||
private void HandleInput()
|
||||
{
|
||||
if (Input.GetKeyDown(_lobbyInfoToggleKeyCode.Value))
|
||||
{
|
||||
ToggleLobbyInfoGUI();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 公共方法
|
||||
|
||||
|
||||
#endregion
|
||||
// oh fuck u landfall
|
||||
/*
|
||||
Convert maps
|
||||
Ori,New,Name
|
||||
2,0,NONE
|
||||
3,1,LOW
|
||||
0,2,NORMAL
|
||||
1,3,HIGH
|
||||
1,4,XHIGH
|
||||
1,5,MAX
|
||||
*/
|
||||
public static int[] FromOriWSOptions = [
|
||||
2, // NORMAL
|
||||
3, // HIGH
|
||||
0, // NONE
|
||||
1, // LOW
|
||||
];
|
||||
public static int[] ToOriWSOptions = [
|
||||
2, // NONE
|
||||
3, // LOW
|
||||
0, // NORMAL
|
||||
1, // HIGH
|
||||
1, // XHIGH
|
||||
1, // MAX
|
||||
];
|
||||
}
|
||||
|
||||
16
README.md
16
README.md
@@ -1,19 +1,13 @@
|
||||
# stick.plugins.tmpl
|
||||
# stick.plugins.xhighws
|
||||
|
||||
简要描述
|
||||
嫌high刷枪频率刷的不够快?
|
||||
|
||||
## 功能
|
||||
|
||||
* ablity1
|
||||
* ablity2
|
||||
* 添加xhigh和max两档更高的刷枪频率
|
||||
|
||||
## 更新日志
|
||||
|
||||
### v0.0.3
|
||||
### v1.0.0
|
||||
|
||||
1. 修复了xxx问题
|
||||
|
||||
### v0.0.1
|
||||
|
||||
1. 新增xxx功能
|
||||
2. 添加工作流
|
||||
1. 能用了
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net35</TargetFramework>
|
||||
<AssemblyName>stick.plugins.tmpl</AssemblyName>
|
||||
<Product>Tmpl</Product>
|
||||
<Version>0.0.1</Version>
|
||||
<AssemblyName>stick.plugins.xhighws</AssemblyName>
|
||||
<Product>XHighWeaponSpawn</Product>
|
||||
<Version>1.0.0</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<RestoreAdditionalProjectSources>
|
||||
@@ -12,7 +12,7 @@
|
||||
https://nuget.bepinex.dev/v3/index.json;
|
||||
https://nuget.samboy.dev/v3/index.json
|
||||
</RestoreAdditionalProjectSources>
|
||||
<RootNamespace>stick.plugins.playermanager</RootNamespace>
|
||||
<RootNamespace>stick.plugins.xhighws</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -46,4 +46,10 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="TextMeshPro-1.0.55.56.0b9">
|
||||
<HintPath>lib\TextMeshPro-1.0.55.56.0b9.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user