-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fe4566b
commit 1977f41
Showing
18 changed files
with
341 additions
and
121 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace HelpSense.ConfigSystem | ||
{ | ||
public class SSSSTranslateConfig | ||
{ | ||
[Description("穿门技能")] | ||
public string DoorPiercingAbility { get; set; } = "穿门技能"; | ||
[Description("穿门技能按键")] | ||
public string DoorPiercingAbilityKey { get; set; } = "穿门技能按键"; | ||
[Description("穿门技能按键说明")] | ||
public string DoorPiercingAbilityKeyDescription { get; set; } = "按一下或长按就可以穿门了"; | ||
[Description("穿门技能发动模式")] | ||
public string PiercingSkillActivationMode { get; set; } = "穿门技能发动模式"; | ||
[Description("长按")] | ||
public string Hold { get; set; } = "长按"; | ||
[Description("开关")] | ||
public string Toggle { get; set; } = "开关"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
using HarmonyLib; | ||
using HelpSense.ConfigSystem; | ||
using InventorySystem.Items.Autosync; | ||
using InventorySystem.Items.Firearms; | ||
using InventorySystem.Items.Firearms.Modules; | ||
using MEC; | ||
using Mirror; | ||
using PluginAPI.Core; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using static InventorySystem.Items.Firearms.Modules.AnimatorReloaderModuleBase; | ||
|
||
namespace HelpSense.Patches | ||
{ | ||
[HarmonyPatch(typeof(AnimatorReloaderModuleBase) , nameof(AnimatorReloaderModuleBase.ServerProcessCmd))] | ||
public static class ReloaderModulePatch | ||
{ | ||
public static bool Prefix(AnimatorReloaderModuleBase __instance , NetworkReader reader) | ||
{ | ||
if (!Plugin.Instance.Config.InfiniteAmmo) return true; | ||
|
||
ReloaderMessageHeader header = (ReloaderMessageHeader)reader.ReadByte(); | ||
Firearm Firearm = __instance.Firearm; | ||
Player Player = Player.Get(Firearm.Owner); | ||
|
||
if (!__instance.TryContinueDeserialization(reader, Firearm.ItemSerial, header, AutosyncMessageType.Cmd)) | ||
{ | ||
return true; | ||
} | ||
|
||
if (header is ReloaderMessageHeader.Reload && IReloadUnloadValidatorModule.ValidateReload(Firearm)) | ||
{ | ||
if (Firearm.ItemTypeId is ItemType.ParticleDisruptor) return true; | ||
if (Firearm.TryGetModule<MagazineModule>(out var MagazineModule)) | ||
{ | ||
switch (Plugin.Instance.Config.InfiniteAmmoType) | ||
{ | ||
case InfiniteAmmoType.Normal: | ||
Player.SetAmmo(MagazineModule.AmmoType, (ushort)(MagazineModule.AmmoMax - MagazineModule.AmmoStored + 1)); | ||
break; | ||
case InfiniteAmmoType.Moment: | ||
MagazineModule.ServerSetInstanceAmmo(Firearm.ItemSerial, MagazineModule.AmmoMax); | ||
break; | ||
} | ||
} | ||
else if (Firearm.ItemTypeId is ItemType.GunRevolver && Firearm.TryGetModule<CylinderAmmoModule>(out var CylinderAmmoModule)) | ||
{ | ||
Player.SetAmmo(CylinderAmmoModule.AmmoType, (ushort)(CylinderAmmoModule.AmmoMax - CylinderAmmoModule.AmmoStored + 1)); | ||
} | ||
} | ||
|
||
reader.Position -= sizeof(byte); | ||
|
||
return true; | ||
} | ||
} | ||
} |
Oops, something went wrong.