| 12345678910111213141516171819202122232425262728293031323334353637 |
- using GadgetCore.API;
- using HarmonyLib;
- using System;
- using UnityEngine;
- namespace VanitySlots.Patches
- {
- [HarmonyPatch(typeof(NetworkView))]
- [HarmonyPatch("RPC", new Type[] { typeof(string), typeof(RPCMode), typeof(object[]) })]
- [HarmonyGadget("VanitySlots")]
- public static class Patch_NetworkView_RPC
- {
- [HarmonyPrefix]
- [HarmonyPriority(Priority.High)]
- public static void Prefix(NetworkView __instance, ref string name, RPCMode mode, object[] args)
- {
- if (name == "UA" && args[0] is int[] a && a.Length > 6)
- {
- if (Core.itemStore.Items[0].id != 0)
- if (ItemRegistry.GetItem(GadgetNetwork.ConvertIDToLocal(ItemRegistry.Singleton, Core.itemStore.Items[0].id)).GetName().StartsWith("Original "))
- a[1] = 0;
- else
- a[1] = GadgetNetwork.ConvertIDToHost(ItemRegistry.Singleton, Core.itemStore.Items[0].id);
- if (Core.itemStore.Items[1].id != 0)
- if (ItemRegistry.GetItem(GadgetNetwork.ConvertIDToLocal(ItemRegistry.Singleton, Core.itemStore.Items[1].id)).GetName().StartsWith("Original "))
- a[2] = 0;
- else
- a[2] = GadgetNetwork.ConvertIDToHost(ItemRegistry.Singleton, Core.itemStore.Items[1].id);
- if (Core.itemStore.Items[2].id != 0)
- if (ItemRegistry.GetItem(GadgetNetwork.ConvertIDToLocal(ItemRegistry.Singleton, Core.itemStore.Items[2].id)).GetName().StartsWith("Original "))
- a[3] = 0;
- else
- a[3] = GadgetNetwork.ConvertIDToHost(ItemRegistry.Singleton, Core.itemStore.Items[2].id);
- }
- }
- }
- }
|