Exemplo n.º 1
0
            public static bool Prefix(InnerNetObject __instance, [HarmonyArgument(0)] byte callId, [HarmonyArgument(1)] MessageReader reader)
            {
                if (callId == CallId)
                {
                    var manager    = PluginSingleton <ReactorPlugin> .Instance.CustomRpcManager;
                    var customRpcs = manager.Map[__instance.GetType()];

                    var pluginNetId = reader.ReadPackedUInt32();
                    var id          = reader.ReadPackedUInt32();

                    var pluginId  = ModList.GetByNetId(pluginNetId).Id;
                    var customRpc = customRpcs.Single(x => x.PluginId == pluginId && x.Id == id);

                    customRpc.UnsafeHandle(__instance, customRpc.UnsafeRead(reader.ReadMessage()));

                    return(false);
                }

                return(true);
            }
Exemplo n.º 2
0
            public static bool Prefix(InnerNetObject __instance, [HarmonyArgument(0)] byte callId, [HarmonyArgument(1)] MessageReader reader)
            {
                if (callId == CallId)
                {
                    var manager    = PluginSingleton <ReactorPlugin> .Instance.CustomRpcManager;
                    var customRpcs = manager.Map[__instance.GetType()];

                    var lengthOrShortId = reader.ReadPackedInt32();

                    var pluginId = lengthOrShortId < 0
                        ? manager.PluginIdMapReversed[lengthOrShortId]
                        : ReadString(reader, lengthOrShortId);

                    var id = reader.ReadPackedInt32();

                    var customRpc = customRpcs.Single(x => x.PluginId == pluginId && x.Id == id);

                    customRpc.UnsafeHandle(__instance, customRpc.UnsafeRead(reader));

                    return(false);
                }

                return(true);
            }