Иконка ресурса

FREE BlockRustPlus : 0.0.20 0.0.20

Нет прав для скачивания
C#:
//Reference: 0Harmony
using System.Collections.Generic;
using CompanionServer.Handlers;
using System.Reflection.Emit;
using System.Reflection;
using System.Linq;
using UnityEngine;
using System;
using Oxide.Core.Plugins;
using HarmonyLib;

namespace Oxide.Plugins
{
    [Info("Block Rust Plus", "Aspect.dev", "0.0.20")]
    [Description("Blocks the exploitation of Rust+ Functionality")]
    class BlockRustPlus : RustPlugin
    {
        internal const bool BlockMapMarkers = true;
        internal const bool BlockTeamChat = true;

        // Below are toggles if using the BlockMarkers option
        internal const bool ShowPlayerMarkers = true;
        internal const bool ShowExplosionMarkers = false;
        internal const bool ShowVendingMachines = true;
        internal const bool ShowCH47 = false;
        internal const bool ShowCargoShip = false;
        internal const bool ShowCrates = false;
        internal const bool ShowPatrolHelicopter = false;

        internal const bool ShowGenericRadius = true;

        [HarmonyPatch(typeof(SendTeamChat), "Execute"), AutoPatch]
        internal static class NoAppChatsPatch
        {
            [HarmonyPrefix]
            internal static void Prefix(ref SendTeamChat __instance)
            {
                if (!BlockTeamChat) return;
                __instance.Proto.message = null;
            }
        }

        [HarmonyPatch(typeof(MapMarkers), "Execute"), AutoPatch]
        internal static class MapMarkersRemovalPatch
        {
            [HarmonyTranspiler]
            internal static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
            {
                List<CodeInstruction> list = instructions.ToList();

                int index = list.FindIndex(i => i.opcode == OpCodes.Ldsfld && ((FieldInfo)i.operand)?.Name == "serverMapMarkers");

                if (index == -1)
                {
                    Debug.Log("Transpiler Failed: MapMarkersRemovalPatch");
                    return list;
                }

                index += 8;
                list.RemoveRange(index, 1);

                list.Insert(index, new CodeInstruction(OpCodes.Callvirt, AccessTools.Method(typeof(MapMarkersRemovalPatch), nameof(MapMarkersRemovalPatch.InternalChecks))));

                return list;
            }

            private static bool InternalChecks(MapMarker marker)
            {
                if (!BlockMapMarkers) return true;

                ProtoBuf.AppMarkerType markerType = marker.appType;

                switch (markerType)
                {
                    case ProtoBuf.AppMarkerType.Player:
                        return ShowPlayerMarkers;
                    case ProtoBuf.AppMarkerType.Explosion:
                        return ShowExplosionMarkers;
                    case ProtoBuf.AppMarkerType.VendingMachine:
                        return ShowVendingMachines;
                    case ProtoBuf.AppMarkerType.CH47:
                        return ShowCH47;
                    case ProtoBuf.AppMarkerType.CargoShip:
                        return ShowCargoShip;
                    case ProtoBuf.AppMarkerType.Crate:
                        return ShowCrates;
                    case ProtoBuf.AppMarkerType.PatrolHelicopter:
                        return ShowPatrolHelicopter;
                    case ProtoBuf.AppMarkerType.GenericRadius:
                        return ShowGenericRadius;
                    default:
                        return true;
                }
            }
        }
    }
}

Автор
15FPS
Скачиваний
0
Просмотры
1
Первый выпуск
Обновление
Оценка
0.00 звёзд 0 оценок
Сверху