Ejemplo n.º 1
0
        public static void givearm(Arg arg)
        {
            BasePlayer basePlayer = ArgEx.Player(arg);

            if (!basePlayer)
            {
                return;
            }
            Item item = ItemManager.CreateByItemID(arg.GetInt(0), 1, 0uL);

            if (item == null)
            {
                arg.ReplyWith("Invalid Item!");
                return;
            }
            item.amount = arg.GetInt(1, 1);
            item.OnVirginSpawn();
            if (!basePlayer.inventory.GiveItem(item, basePlayer.inventory.containerBelt))
            {
                item.Remove();
                arg.ReplyWith("Couldn't give item (inventory full?)");
                return;
            }
            basePlayer.Command("note.inv", item.info.itemid, item.amount);
            Debug.Log(" [ServerVar] giving " + basePlayer.displayName + " " + item.amount + " x " + item.info.displayName.english);
            if (basePlayer.IsDeveloper)
            {
                basePlayer.ChatMessage("you silently gave yourself " + item.amount + " x " + item.info.displayName.english);
            }
            else
            {
                Chat.Broadcast(basePlayer.displayName + " gave themselves " + item.amount + " x " + item.info.displayName.english, "SERVER", "#eee", 0uL);
            }
        }
Ejemplo n.º 2
0
        public static void add(Arg args)
        {
            BasePlayer basePlayer = ArgEx.Player(args);

            if (!basePlayer || basePlayer.IsDead())
            {
                return;
            }
            int @int = args.GetInt(0);
            int int2 = args.GetInt(1, 1);
            int num  = (int)args.GetUInt64(2, 0uL);

            if (int2 < 1)
            {
                return;
            }
            ItemDefinition itemDefinition = ItemManager.FindItemDefinition(@int);

            if (itemDefinition == null)
            {
                args.ReplyWith("Item not found");
                return;
            }
            ItemBlueprint itemBlueprint = ItemManager.FindBlueprint(itemDefinition);

            if (!itemBlueprint)
            {
                args.ReplyWith("Blueprint not found");
                return;
            }
            if (!itemBlueprint.userCraftable)
            {
                args.ReplyWith("Item is not craftable");
                return;
            }
            if (!basePlayer.blueprints.CanCraft(@int, num, basePlayer.userID))
            {
                num = 0;
                if (!basePlayer.blueprints.CanCraft(@int, num, basePlayer.userID))
                {
                    args.ReplyWith("You can't craft this item");
                    return;
                }
                args.ReplyWith("You don't have permission to use this skin, so crafting unskinned");
            }
            if (!basePlayer.inventory.crafting.CraftItem(itemBlueprint, basePlayer, null, int2, num))
            {
                args.ReplyWith("Couldn't craft!");
            }
        }
Ejemplo n.º 3
0
        public static void equipslot(Arg arg)
        {
            BasePlayer basePlayer = ArgEx.Player(arg);

            if ((!basePlayer.IsAdmin && !basePlayer.IsDeveloper && !Server.cinematic) || basePlayer == null)
            {
                return;
            }
            BasePlayer basePlayer2 = null;

            if (arg.HasArgs(2))
            {
                basePlayer2 = ArgEx.GetPlayer(arg, 1);
                if (basePlayer2 == null)
                {
                    uint uInt = arg.GetUInt(1);
                    basePlayer2 = BasePlayer.FindByID(uInt);
                    if (basePlayer2 == null)
                    {
                        basePlayer2 = BasePlayer.FindBot(uInt);
                    }
                }
            }
            if (!(basePlayer2 == null))
            {
                int @int = arg.GetInt(0);
                EquipItemInSlot(basePlayer2, @int);
                Debug.Log($"Equipped slot {@int} on player {basePlayer2.displayName}");
            }
        }
Ejemplo n.º 4
0
        public static void giveall(Arg arg)
        {
            Item   item = null;
            string text = "SERVER";

            if (ArgEx.Player(arg) != null)
            {
                text = ArgEx.Player(arg).displayName;
            }
            foreach (BasePlayer activePlayer in BasePlayer.activePlayerList)
            {
                item = ItemManager.CreateByPartialName(arg.GetString(0), 1, 0uL);
                if (item == null)
                {
                    arg.ReplyWith("Invalid Item!");
                    return;
                }
                item.amount = arg.GetInt(1, 1);
                item.OnVirginSpawn();
                if (!activePlayer.inventory.GiveItem(item))
                {
                    item.Remove();
                    arg.ReplyWith("Couldn't give item (inventory full?)");
                    continue;
                }
                activePlayer.Command("note.inv", item.info.itemid, item.amount);
                Debug.Log(" [ServerVar] giving " + activePlayer.displayName + " " + item.amount + " x " + item.info.displayName.english);
            }
            if (item != null)
            {
                Chat.Broadcast(text + " gave everyone " + item.amount + " x " + item.info.displayName.english, "SERVER", "#eee", 0uL);
            }
        }
Ejemplo n.º 5
0
        public static void giveto(Arg arg)
        {
            string text = "SERVER";

            if (ArgEx.Player(arg) != null)
            {
                text = ArgEx.Player(arg).displayName;
            }
            BasePlayer basePlayer = BasePlayer.Find(arg.GetString(0));

            if (basePlayer == null)
            {
                arg.ReplyWith("Couldn't find player!");
                return;
            }
            Item item = ItemManager.CreateByPartialName(arg.GetString(1), 1, arg.GetULong(3, 0uL));

            if (item == null)
            {
                arg.ReplyWith("Invalid Item!");
                return;
            }
            item.amount = arg.GetInt(2, 1);
            item.OnVirginSpawn();
            if (!basePlayer.inventory.GiveItem(item))
            {
                item.Remove();
                arg.ReplyWith("Couldn't give item (inventory full?)");
                return;
            }
            basePlayer.Command("note.inv", item.info.itemid, item.amount);
            Debug.Log(" [ServerVar] giving " + basePlayer.displayName + " " + item.amount + " x " + item.info.displayName.english);
            Chat.Broadcast(text + " gave " + basePlayer.displayName + " " + item.amount + " x " + item.info.displayName.english, "SERVER", "#eee", 0uL);
        }
Ejemplo n.º 6
0
        public static void spawnlootfrom(Arg args)
        {
            BasePlayer basePlayer = ArgEx.Player(args);
            string     @string    = args.GetString(0, string.Empty);
            int        @int       = args.GetInt(1, 1);
            Vector3    vector     = args.GetVector3(1, basePlayer ? basePlayer.CenterPoint() : Vector3.zero);

            if (string.IsNullOrEmpty(@string))
            {
                return;
            }
            BaseEntity baseEntity = GameManager.server.CreateEntity(@string, vector);

            if (baseEntity == null)
            {
                return;
            }
            baseEntity.Spawn();
            basePlayer.ChatMessage("Contents of " + @string + " spawned " + @int + " times");
            LootContainer component = baseEntity.GetComponent <LootContainer>();

            if (component != null)
            {
                for (int i = 0; i < @int * component.maxDefinitionsToSpawn; i++)
                {
                    component.lootDefinition.SpawnIntoContainer(basePlayer.inventory.containerMain);
                }
            }
            baseEntity.Kill();
        }
Ejemplo n.º 7
0
        public static void fixcars(Arg arg)
        {
            BasePlayer basePlayer = ArgEx.Player(arg);

            if (basePlayer == null)
            {
                arg.ReplyWith("Null player.");
                return;
            }
            if (!basePlayer.IsAdmin)
            {
                arg.ReplyWith("Must be an admin to use fixcars.");
                return;
            }
            int @int = arg.GetInt(0, 2);

            @int = Mathf.Clamp(@int, 1, 3);
            ModularCar[] array = Object.FindObjectsOfType <ModularCar>();
            int          num   = 0;

            ModularCar[] array2 = array;
            foreach (ModularCar modularCar in array2)
            {
                if (modularCar.isServer && Vector3.Distance(modularCar.transform.position, basePlayer.transform.position) <= 5f && modularCar.AdminFixUp(@int))
                {
                    num++;
                }
            }
            arg.ReplyWith($"Fixed up {num} cars.");
        }
Ejemplo n.º 8
0
        public static void cancel(Arg args)
        {
            BasePlayer basePlayer = ArgEx.Player(args);

            if ((bool)basePlayer && !basePlayer.IsDead())
            {
                int @int = args.GetInt(0);
                basePlayer.inventory.crafting.CancelBlueprint(@int);
            }
        }
Ejemplo n.º 9
0
        public static IEnumerable <Output.Entry> tail(Arg arg)
        {
            int @int = arg.GetInt(0, 200);
            int num  = Output.HistoryOutput.Count - @int;

            if (num < 0)
            {
                num = 0;
            }
            return(Output.HistoryOutput.Skip(num));
        }
Ejemplo n.º 10
0
        public static IEnumerable <ChatEntry> tail(Arg arg)
        {
            int @int = arg.GetInt(0, 200);
            int num  = History.Count - @int;

            if (num < 0)
            {
                num = 0;
            }
            return(History.Skip(num));
        }
Ejemplo n.º 11
0
        public static void canceltask(Arg args)
        {
            BasePlayer basePlayer = ArgEx.Player(args);

            if ((bool)basePlayer && !basePlayer.IsDead())
            {
                int @int = args.GetInt(0);
                if (!basePlayer.inventory.crafting.CancelTask(@int, true))
                {
                    args.ReplyWith("Couldn't cancel task!");
                }
            }
        }
Ejemplo n.º 12
0
        public static void fasttracktask(Arg args)
        {
            BasePlayer basePlayer = ArgEx.Player(args);

            if ((bool)basePlayer && !basePlayer.IsDead())
            {
                int @int = args.GetInt(0);
                if (!basePlayer.inventory.crafting.FastTrackTask(@int))
                {
                    args.ReplyWith("Couldn't fast track task!");
                }
            }
        }
Ejemplo n.º 13
0
        public static void equipslottarget(Arg arg)
        {
            BasePlayer basePlayer = ArgEx.Player(arg);

            if ((basePlayer.IsAdmin || basePlayer.IsDeveloper || Server.cinematic) && !(basePlayer == null))
            {
                BasePlayer lookingAtPlayer = RelationshipManager.GetLookingAtPlayer(basePlayer);
                if (!(lookingAtPlayer == null))
                {
                    int @int = arg.GetInt(0);
                    EquipItemInSlot(lookingAtPlayer, @int);
                    arg.ReplyWith($"Equipped slot {@int} on player {lookingAtPlayer.displayName}");
                }
            }
        }
Ejemplo n.º 14
0
        public static void teleportlos(Arg args)
        {
            BasePlayer basePlayer = ArgEx.Player(args);

            if ((bool)basePlayer && basePlayer.IsAlive())
            {
                Ray        ray  = basePlayer.eyes.HeadRay();
                int        @int = args.GetInt(0, 1000);
                RaycastHit hitInfo;
                if (UnityEngine.Physics.Raycast(ray, out hitInfo, @int, 1218652417))
                {
                    basePlayer.Teleport(hitInfo.point);
                }
                else
                {
                    basePlayer.Teleport(ray.origin + ray.direction * @int);
                }
            }
        }
Ejemplo n.º 15
0
        public static void debug_toggle(Arg args)
        {
            int @int = args.GetInt(0);

            if (@int == 0)
            {
                return;
            }
            BaseEntity baseEntity = BaseNetworkable.serverEntities.Find((uint)@int) as BaseEntity;

            if (!(baseEntity == null))
            {
                baseEntity.SetFlag(BaseEntity.Flags.Debugging, !baseEntity.IsDebugging());
                if (baseEntity.IsDebugging())
                {
                    baseEntity.OnDebugStart();
                }
                args.ReplyWith("Debugging for " + baseEntity.net.ID + " " + (baseEntity.IsDebugging() ? "enabled" : "disabled"));
            }
        }
Ejemplo n.º 16
0
        public static void setteam(Arg arg)
        {
            BasePlayer basePlayer = ArgEx.Player(arg);

            if (basePlayer == null)
            {
                return;
            }
            BaseGameMode activeGameMode = BaseGameMode.GetActiveGameMode(true);

            if ((bool)activeGameMode)
            {
                int @int = arg.GetInt(0);
                if (@int >= 0 && @int < activeGameMode.GetNumTeams())
                {
                    activeGameMode.ResetPlayerScores(basePlayer);
                    activeGameMode.SetPlayerTeam(basePlayer, @int);
                    basePlayer.Respawn();
                }
            }
        }
Ejemplo n.º 17
0
        public static void give(Arg arg)
        {
            BasePlayer basePlayer = ArgEx.Player(arg);

            if (!basePlayer)
            {
                return;
            }
            Item item = ItemManager.CreateByPartialName(arg.GetString(0), 1, arg.GetULong(3, 0uL));

            if (item == null)
            {
                arg.ReplyWith("Invalid Item!");
                return;
            }
            int   num  = (item.amount = arg.GetInt(1, 1));
            float num2 = (item.conditionNormalized = arg.GetFloat(2, 1f));

            item.OnVirginSpawn();
            if (!basePlayer.inventory.GiveItem(item))
            {
                item.Remove();
                arg.ReplyWith("Couldn't give item (inventory full?)");
                return;
            }
            basePlayer.Command("note.inv", item.info.itemid, num);
            Debug.Log("giving " + basePlayer.displayName + " " + num + " x " + item.info.displayName.english);
            if (basePlayer.IsDeveloper)
            {
                basePlayer.ChatMessage("you silently gave yourself " + num + " x " + item.info.displayName.english);
            }
            else
            {
                Chat.Broadcast(basePlayer.displayName + " gave themselves " + num + " x " + item.info.displayName.english, "SERVER", "#eee", 0uL);
            }
        }
Ejemplo n.º 18
0
        public static void swapseat(Arg arg)
        {
            BasePlayer basePlayer = ArgEx.Player(arg);

            if (!basePlayer.IsAdmin && !basePlayer.IsDeveloper && !Server.cinematic)
            {
                return;
            }
            uint       uInt        = arg.GetUInt(0);
            BasePlayer basePlayer2 = BasePlayer.FindByID(uInt);

            if (basePlayer2 == null)
            {
                basePlayer2 = BasePlayer.FindBot(uInt);
            }
            if ((bool)basePlayer2)
            {
                int @int = arg.GetInt(1);
                if ((bool)basePlayer2 && basePlayer2.isMounted && (bool)basePlayer2.GetMounted().VehicleParent())
                {
                    basePlayer2.GetMounted().VehicleParent().SwapSeats(basePlayer2, @int);
                }
            }
        }
Ejemplo n.º 19
0
 public static void alloc(Arg args)
 {
     byte[] array = new byte[args.GetInt(0, 1048576)];
     args.ReplyWith("Allocated " + array.Length + " bytes");
 }
Ejemplo n.º 20
0
        public static void aiDebug_toggle(Arg args)
        {
            int @int = args.GetInt(0);

            if (@int == 0)
            {
                return;
            }
            BaseEntity baseEntity = BaseNetworkable.serverEntities.Find((uint)@int) as BaseEntity;

            if (baseEntity == null)
            {
                return;
            }
            NPCPlayerApex nPCPlayerApex = baseEntity as NPCPlayerApex;

            if (nPCPlayerApex != null)
            {
                TextTable textTable = new TextTable();
                textTable.AddColumn("type");
                textTable.AddColumn("state");
                textTable.AddColumn("posSync");
                textTable.AddColumn("health");
                textTable.AddColumn("stuckTime");
                textTable.AddColumn("hasPath");
                textTable.AddColumn("hasEnemyTarget");
                textTable.AddColumn("isMounted");
                textTable.AddRow(nPCPlayerApex.Family.ToString(), nPCPlayerApex.IsDormant ? "dormant" : "awake", nPCPlayerApex.syncPosition.ToString(), nPCPlayerApex.health.ToString("N2"), nPCPlayerApex.stuckDuration.ToString("N2"), nPCPlayerApex.HasPath.ToString(), (nPCPlayerApex.AttackTarget != null).ToString(), nPCPlayerApex.isMounted ? "true" : "false");
                args.ReplyWith(textTable.ToString());
                return;
            }
            BaseAnimalNPC baseAnimalNPC = baseEntity as BaseAnimalNPC;

            if (baseAnimalNPC != null)
            {
                TextTable textTable2 = new TextTable();
                textTable2.AddColumn("type");
                textTable2.AddColumn("state");
                textTable2.AddColumn("posSync");
                textTable2.AddColumn("health");
                textTable2.AddColumn("stuckTime");
                textTable2.AddColumn("hasPath");
                textTable2.AddColumn("hasEnemyTarget");
                textTable2.AddColumn("hasFoodTarget");
                textTable2.AddRow(baseAnimalNPC.Stats.Family.ToString(), baseAnimalNPC.IsDormant ? "dormant" : "awake", baseAnimalNPC.syncPosition.ToString(), baseAnimalNPC.health.ToString("N2"), baseAnimalNPC.stuckDuration.ToString("N2"), baseAnimalNPC.HasPath.ToString(), (baseAnimalNPC.AttackTarget != null).ToString(), (baseAnimalNPC.FoodTarget != null).ToString());
                args.ReplyWith(textTable2.ToString());
            }
            else
            {
                HTNPlayer hTNPlayer = baseEntity as HTNPlayer;
                if (hTNPlayer != null)
                {
                    TextTable textTable3 = new TextTable();
                    textTable3.AddColumn("type");
                    textTable3.AddColumn("state");
                    textTable3.AddColumn("posSync");
                    textTable3.AddColumn("health");
                    textTable3.AddColumn("hasEnemyTarget");
                    textTable3.AddColumn("isMounted");
                    textTable3.AddRow(hTNPlayer.Family.ToString(), hTNPlayer.IsDormant ? "dormant" : "awake", hTNPlayer.syncPosition.ToString(), hTNPlayer.health.ToString("N2"), (hTNPlayer.MainTarget != null).ToString(), hTNPlayer.isMounted ? "true" : "false");
                    args.ReplyWith(textTable3.ToString());
                }
            }
        }
Ejemplo n.º 21
0
 public static void hurt(Arg arg)
 {
     AdjustHealth(ArgEx.Player(arg), -arg.GetInt(0, 1), arg.GetString(1, string.Empty));
 }
Ejemplo n.º 22
0
 public static void eat(Arg arg)
 {
     AdjustCalories(ArgEx.Player(arg), arg.GetInt(0, 1), arg.GetInt(1, 1));
 }
Ejemplo n.º 23
0
 public static void drink(Arg arg)
 {
     AdjustHydration(ArgEx.Player(arg), arg.GetInt(0, 1), arg.GetInt(1, 1));
 }
Ejemplo n.º 24
0
 public static void restart(Arg args)
 {
     ServerMgr.RestartServer(args.GetString(1, string.Empty), args.GetInt(0, 300));
 }
Ejemplo n.º 25
0
 public static void heal(Arg arg)
 {
     AdjustHealth(ArgEx.Player(arg), arg.GetInt(0, 1));
 }