Skip to content

Commit

Permalink
默认角色和自动准备
Browse files Browse the repository at this point in the history
  • Loading branch information
Gunly committed Jan 16, 2025
1 parent ac4b3a5 commit 06433bc
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 16 deletions.
27 changes: 27 additions & 0 deletions LiarsBarEnhance/Features/AutoReadyPatch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using HarmonyLib;

namespace LiarsBarEnhance.Features;

[HarmonyPatch]
public class AutoReadyPatch
{
[HarmonyPatch(typeof(PlayerObjectController), nameof(PlayerObjectController.Start))]
[HarmonyPostfix]
public static void StartPostfix(PlayerObjectController __instance)
{
if (__instance.isOwned && Plugin.BooleanGameAutoReady.Value)
{
__instance.SetReady(true);
}
}

[HarmonyPatch(typeof(PlayerObjectController), nameof(PlayerObjectController.Update))]
[HarmonyPostfix]
public static void SetLoadedPostfix(PlayerObjectController __instance)
{
if (__instance.isOwned && Plugin.BooleanGameAutoReady.Value && !__instance.Loaded && !__instance.NetworkReady)
{
__instance.SetReady(true);
}
}
}
27 changes: 27 additions & 0 deletions LiarsBarEnhance/Features/DefaultSkinPatch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using HarmonyLib;

namespace LiarsBarEnhance.Features;

[HarmonyPatch]
public class DefaultSkinPatch
{
[HarmonyPatch(typeof(PlayerObjectController), nameof(PlayerObjectController.Start))]
[HarmonyPostfix]
public static void StartPostfix(PlayerObjectController __instance)
{
if (__instance.isOwned && Plugin.DefaultSkin.Value != 0)
{
if (__instance.isServer)
{
__instance.NetworkPlayerSkin = (int)Plugin.DefaultSkin.Value;
}
else
{
for (var i = 0; i < (int)Plugin.DefaultSkin.Value; i++)
{
__instance.SetSkin();
}
}
}
}
}
2 changes: 1 addition & 1 deletion LiarsBarEnhance/LiarsBarEnhance.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net6.0</TargetFramework>
<AssemblyName>com.github.gunly.LiarsBarEnhance</AssemblyName>
<Product>LiarsBarEnhance</Product>
<Version>1.1.0</Version>
<Version>1.1.2</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
<RestoreAdditionalProjectSources>
Expand Down
26 changes: 20 additions & 6 deletions LiarsBarEnhance/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@ public class Plugin : BasePlugin
public static ConfigEntry<float> FloatJumpHeight, FloatGravity, FloatMoveSpeed, FloatMoveHorizontalBodyRotate, FloatViewSpeed, FloatViewField,
FloatAutoRotateSpeed, FloatCustomPlayerScale, FloatBigMouthAngle;
public static ConfigEntry<bool> BooleanMoveFollowHead, BooleanViewRemoveRotationLimit, BooleanViewField,
BooleanTestGiraffe, BooleanCustomShowSelfInfo;
BooleanTestGiraffe, BooleanCustomShowSelfInfo, BooleanGameAutoReady;
public static ConfigEntry<string> StringCustomName, StringGameLobbyFilterWords;
public static ConfigEntry<string>[] StringAnims;
public static ConfigEntry<RotateDirection> DirectionRotateState;
public static ConfigEntry<HintType> HintTypeSelect;
public static ConfigEntry<SkinName> DefaultSkin;
#if CHEATRELEASE
public static ConfigEntry<bool> BooleanCheatDeck, BooleanCheatDice, BooleanCheatDeckHealth, BooleanCheatBlorfLastRoundCard, BooleanCheatDiceTotalDice;
public static ConfigEntry<KeyboardShortcut> KeyCheatBlorfFlip, KeyCheatDiceShow, KeyAnimRouletType;
Expand Down Expand Up @@ -92,6 +93,8 @@ private void Start()
//Harmony.CreateAndPatchAll(typeof(GiraffePatch), nameof(GiraffePatch));//TODO
Harmony.CreateAndPatchAll(typeof(LobbyFilterPatch), nameof(LobbyFilterPatch));
Harmony.CreateAndPatchAll(typeof(HintPatch), nameof(HintPatch));
Harmony.CreateAndPatchAll(typeof(DefaultSkinPatch), nameof(DefaultSkinPatch));
Harmony.CreateAndPatchAll(typeof(AutoReadyPatch), nameof(AutoReadyPatch));

#if CHEATRELEASE
Harmony.CreateAndPatchAll(typeof(BlorfCheatPatch), nameof(BlorfCheatPatch));
Expand All @@ -118,7 +121,8 @@ private void OnGUI()

private void BindConfig()
{
TomlTypeConverter.AddConverter(typeof(Vector3), new TypeConverter {
TomlTypeConverter.AddConverter(typeof(Vector3), new BepInEx.Configuration.TypeConverter
{
ConvertToString = (o, type) => ((Vector3)o).ToString(),
ConvertToObject = (s, type) =>
{
Expand Down Expand Up @@ -157,6 +161,7 @@ private void BindConfig()
StringCustomName = Config.Bind("Custom", "CustomName", "", "自定义名称");
BooleanCustomShowSelfInfo = Config.Bind("Custom", "ShowSelfInfo", true, "显示自身头顶信息");
FloatCustomPlayerScale = Config.Bind("Custom", "PlayerScale", 0.5f, new ConfigDescription("玩家缩放", new AcceptableValueRange<float>(0f, 1f)));
DefaultSkin = Config.Bind("Custom", "DefaultSkin", SkinName.Scubby, "默认角色,进入房间时自动选择");

KeyGameShowHint = Config.Bind("Game", "HintShow", new KeyboardShortcut(KeyCode.Tab), "启用提示");
KeyMoveResetPosition = Config.Bind("Game", "ResetPosition", new KeyboardShortcut(KeyCode.R), "重置坐标");
Expand All @@ -170,6 +175,7 @@ private void BindConfig()
"@[Qq]\\d{5,}|@[a-zA-Z0-9]{3,}\\.[a-zA-Z]{2,}", "大厅过滤词");
LobbyFilterPatch.FilterWords = () => StringGameLobbyFilterWords.Value;
StringGameLobbyFilterWords.SettingChanged += (_, _) => LobbyFilterPatch.FilterWordsChanged();
BooleanGameAutoReady = Config.Bind("Game", "AutoReady", false, "自动准备");

BooleanMoveFollowHead = Config.Bind("Move", "MoveFollowHead", true, "移动方向跟随头部视角");
KeyMoveFollowHeadShortcut = Config.Bind("Move", "MoveFollowHeadShortcut", new KeyboardShortcut(KeyCode.H), "切换移动方向跟随头部视角快捷键");
Expand Down Expand Up @@ -311,11 +317,19 @@ public enum HintType
#if CHEATRELEASE
public enum RouletType
{
//[Description("仅动画")]
AnimOnly,
//[Description("开枪")]
Roulet,
//[Description("自杀")]
Suicide
}
#endif
#endif

public enum SkinName
{
Scubby = 0,
Foxy = 1,
Bristle = 2,
Toar = 3,
Cupcake = 4,
Gerk = 5,
Kudo = 6
}
2 changes: 1 addition & 1 deletion LiarsBarEnhanceOnlyFix/LiarsBarEnhanceOnlyFix.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net6.0</TargetFramework>
<AssemblyName>com.github.gunly.LiarsBarEnhanceOnlyFix</AssemblyName>
<Product>LiarsBarEnhanceOnlyFix</Product>
<Version>1.1.0</Version>
<Version>1.1.2</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
<RestoreAdditionalProjectSources>
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
- 回到主菜单(解决卡死)

#### 按键列表
大多数按键可以更改,建议使用[ConfigurationManager](https://github.com/Gunly/LiarsBarEnhance/releases/download/1.1.1/ConfigurationManager.dll)
大多数按键可以更改,建议使用[ConfigurationManager](https://github.com/Gunly/LiarsBarEnhance/releases/download/1.1.2/ConfigurationManager.dll)
传送坐标和快捷键可编辑,默认4个,最高9个
动画快捷键默认未设置,可编辑`BepInEx\config\com.github.gunly.LiarsBarEnhance.cfg`后启动游戏,或使用`ConfigurationManager`在游戏内修改快捷键

Expand Down Expand Up @@ -76,10 +76,10 @@

1. 下载[BepInEx](https://github.com/BepInEx/BepInEx/releases/download/v6.0.0-pre.2/BepInEx-Unity.IL2CPP-win-x64-6.0.0-pre.2.zip)
2.`BepInEx`解压至游戏根目录([官方安装教程](https://docs.bepinex.dev/articles/user_guide/installation/index.html)
3.[Release](https://github.com/gunly/LiarsBarEnhance/releases)下载[最新Dll本体](https://github.com/gunly/LiarsBarEnhance/releases/download/1.1.1/com.github.gunly.LiarsBarEnhance.dll)以及[BepInEx.KeyboardShortcut](https://github.com/gunly/LiarsBarEnhance/releases/download/1.1.1/BepInEx.KeyboardShortcut.dll)
4. 如果仅需要被动技(修复中文、过滤大厅等,不包含移除视角限制)请下载[LiarsBarEnhanceOnlyFix](https://github.com/gunly/LiarsBarEnhance/releases/download/1.1.1/com.github.gunly.LiarsBarEnhanceOnlyFix.dll),无需`BepInEx.KeyboardShortcut`
3.[Release](https://github.com/gunly/LiarsBarEnhance/releases)下载[最新Dll本体](https://github.com/gunly/LiarsBarEnhance/releases/download/1.1.2/com.github.gunly.LiarsBarEnhance.dll)以及[BepInEx.KeyboardShortcut](https://github.com/gunly/LiarsBarEnhance/releases/download/1.1.2/BepInEx.KeyboardShortcut.dll)
4. 如果仅需要被动技(修复中文、过滤大厅等,不包含移除视角限制)请下载[LiarsBarEnhanceOnlyFix](https://github.com/gunly/LiarsBarEnhance/releases/download/1.1.2/com.github.gunly.LiarsBarEnhanceOnlyFix.dll),无需`BepInEx.KeyboardShortcut`
5. 将插件本体(`com.github.gunly.LiarsBarEnhance.dll``com.github.gunly.LiarsBarEnhanceOnlyFix.dll`)和`BepInEx.KeyboardShortcut.dll`(如果需要)放置在插件文件夹(即`<游戏根目录>/BepInEx/plugins`)(没有`plugins`文件夹请手动创建)
6. 可选,下载[ConfigurationManager](https://github.com/Gunly/LiarsBarEnhance/releases/download/1.1.1/ConfigurationManager.dll)放置在插件文件夹
6. 可选,下载[ConfigurationManager](https://github.com/Gunly/LiarsBarEnhance/releases/download/1.1.2/ConfigurationManager.dll)放置在插件文件夹

## 自行构建插件

Expand Down
8 changes: 4 additions & 4 deletions README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
- Return to main menu (resolve stuck)

#### Key Bindings
Key Bindings is configurable. Suggest using [ConfigurationManager](https://github.com/Gunly/LiarsBarEnhance/releases/download/1.1.1/ConfigurationManager.dll)
Key Bindings is configurable. Suggest using [ConfigurationManager](https://github.com/Gunly/LiarsBarEnhance/releases/download/1.1.2/ConfigurationManager.dll)

| Key | Function |
| :---------------------: | :-----------------: |
Expand Down Expand Up @@ -70,10 +70,10 @@ Key Bindings is configurable. Suggest using [ConfigurationManager](https://githu

1. Download [BepInEx](https://github.com/BepInEx/BepInEx/releases/download/v6.0.0-pre.2/BepInEx-Unity.IL2CPP-win-x64-6.0.0-pre.2.zip)
2. Extract `BepInEx` to the game root directory ([official installation tutorial](https://docs.bepinex.dev/articles/user_guide/installation/index.html))
3. Download the latest DLL from [Release](https://github.com/gunly/LiarsBarEnhance/releases)[latest DLL](https://github.com/gunly/LiarsBarEnhance/releases/download/1.1.1/com.github.gunly.LiarsBarEnhance.dll) and [BepInEx.KeyboardShortcut](https://github.com/gunly/LiarsBarEnhance/releases/download/1.1.1/BepInEx.KeyboardShortcut.dll)
4. If only need Passive(Chinese Fix, Lobby Filter, etc. Not contains Remove camera angle restrictions), Download[com.github.gunly.LiarsBarEnhanceOnlyFix.dll](https://github.com/gunly/LiarsBarEnhance/releases/download/1.1.1/com.github.gunly.LiarsBarEnhanceOnlyFix.dll), No need for `BepInEx.KeyboardShortcut`
3. Download the latest DLL from [Release](https://github.com/gunly/LiarsBarEnhance/releases)[latest DLL](https://github.com/gunly/LiarsBarEnhance/releases/download/1.1.2/com.github.gunly.LiarsBarEnhance.dll) and [BepInEx.KeyboardShortcut](https://github.com/gunly/LiarsBarEnhance/releases/download/1.1.2/BepInEx.KeyboardShortcut.dll)
4. If only need Passive(Chinese Fix, Lobby Filter, etc. Not contains Remove camera angle restrictions), Download[com.github.gunly.LiarsBarEnhanceOnlyFix.dll](https://github.com/gunly/LiarsBarEnhance/releases/download/1.1.2/com.github.gunly.LiarsBarEnhanceOnlyFix.dll), No need for `BepInEx.KeyboardShortcut`
5. Place the plugin DLL (`com.github.gunly.LiarsBarEnhance.dll` or `com.github.gunly.LiarsBarEnhanceOnlyFix.dll`) and `BepInEx.KeyboardShortcut.dll`(if need) in the plugin folder (i.e., `<game root directory>/BepInEx/plugins`), create the `plugins` folder if it doesn't exist
6. Optional,Download [ConfigurationManager](https://github.com/Gunly/LiarsBarEnhance/releases/download/1.1.1/ConfigurationManager.dll)
6. Optional,Download [ConfigurationManager](https://github.com/Gunly/LiarsBarEnhance/releases/download/1.1.2/ConfigurationManager.dll)

## Building the Plugin Yourself

Expand Down

0 comments on commit 06433bc

Please sign in to comment.