Exemplo n.º 1
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);
                }
            }
        }
Exemplo n.º 2
0
        public static string svspawn(string name, Vector3 pos, Vector3 dir)
        {
            BasePlayer arg = ArgEx.Player(ConsoleSystem.CurrentArgs);

            if (string.IsNullOrEmpty(name))
            {
                return("No entity name provided");
            }
            string[] array = (from x in GameManifest.Current.entities
                              where Path.GetFileNameWithoutExtension(x).Contains(name, CompareOptions.IgnoreCase)
                              select x.ToLower()).ToArray();
            if (array.Length == 0)
            {
                return("Entity type not found");
            }
            if (array.Length > 1)
            {
                string text = array.FirstOrDefault((string x) => string.Compare(Path.GetFileNameWithoutExtension(x), name, StringComparison.OrdinalIgnoreCase) == 0);
                if (text == null)
                {
                    Debug.Log($"{arg} failed to spawn \"{name}\"");
                    return("Unknown entity - could be:\n\n" + string.Join("\n", array.Select(Path.GetFileNameWithoutExtension).ToArray()));
                }
                array[0] = text;
            }
            BaseEntity baseEntity = GameManager.server.CreateEntity(array[0], pos, Quaternion.LookRotation(dir, Vector3.up));

            if (baseEntity == null)
            {
                Debug.Log($"{arg} failed to spawn \"{array[0]}\" (tried to spawn \"{name}\")");
                return("Couldn't spawn " + name);
            }
            BasePlayer basePlayer = baseEntity as BasePlayer;

            if (basePlayer != null)
            {
                basePlayer.OverrideViewAngles(Quaternion.LookRotation(dir, Vector3.up).eulerAngles);
            }
            baseEntity.Spawn();
            Debug.Log($"{arg} spawned \"{baseEntity}\" at {pos}");
            return(string.Concat("spawned ", baseEntity, " at ", pos));
        }
Exemplo n.º 3
0
        public static void wakeupall(Arg arg)
        {
            BasePlayer basePlayer = ArgEx.Player(arg);

            if (!basePlayer.IsAdmin && !basePlayer.IsDeveloper && !Server.cinematic)
            {
                return;
            }
            List <BasePlayer> obj = Facepunch.Pool.GetList <BasePlayer>();

            foreach (BasePlayer sleepingPlayer in BasePlayer.sleepingPlayerList)
            {
                obj.Add(sleepingPlayer);
            }
            foreach (BasePlayer item in obj)
            {
                item.EndSleeping();
            }
            Facepunch.Pool.FreeList(ref obj);
        }
Exemplo n.º 4
0
        public static void quickrespawn(Arg arg)
        {
            if (!ArgEx.Player(arg))
            {
                return;
            }
            BradleySpawner singleton = BradleySpawner.singleton;

            if (singleton == null)
            {
                Debug.LogWarning("No Spawner");
                return;
            }
            if ((bool)singleton.spawned)
            {
                singleton.spawned.Kill();
            }
            singleton.spawned = null;
            singleton.DoRespawn();
        }
Exemplo n.º 5
0
    public static void GrowAll(ConsoleSystem.Arg arg)
    {
        BasePlayer basePlayer = ArgEx.Player(arg);

        if (!basePlayer.IsAdmin)
        {
            return;
        }
        List <GrowableEntity> obj = Facepunch.Pool.GetList <GrowableEntity>();

        Vis.Entities(basePlayer.ServerPosition, 6f, obj);
        foreach (GrowableEntity item in obj)
        {
            if (item.isServer)
            {
                item.ChangeState(item.currentStage.nextState, false);
            }
        }
        Facepunch.Pool.FreeList(ref obj);
    }
Exemplo n.º 6
0
        public static void teleport2me(Arg args)
        {
            BasePlayer playerOrSleeperOrBot = ArgEx.GetPlayerOrSleeperOrBot(args, 0);

            if (playerOrSleeperOrBot == null)
            {
                args.ReplyWith("Player or bot not found");
                return;
            }
            if (!playerOrSleeperOrBot.IsAlive())
            {
                args.ReplyWith("Target is not alive");
                return;
            }
            BasePlayer basePlayer = ArgEx.Player(args);

            if ((bool)basePlayer && basePlayer.IsAlive())
            {
                playerOrSleeperOrBot.Teleport(basePlayer);
            }
        }
Exemplo n.º 7
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();
                }
            }
        }
Exemplo n.º 8
0
        public static void fillwater(Arg arg)
        {
            bool           num        = arg.GetString(0).ToLower() == "salt";
            BasePlayer     basePlayer = ArgEx.Player(arg);
            ItemDefinition liquidType = ItemManager.FindItemDefinition(num ? "water.salt" : "water");

            for (int i = 0; i < PlayerBelt.MaxBeltSlots; i++)
            {
                Item             itemInSlot = basePlayer.Belt.GetItemInSlot(i);
                BaseLiquidVessel baseLiquidVessel;
                if (itemInSlot != null && (object)(baseLiquidVessel = itemInSlot.GetHeldEntity() as BaseLiquidVessel) != null && baseLiquidVessel.hasLid)
                {
                    int amount = 999;
                    ItemModContainer component;
                    if (baseLiquidVessel.GetItem().info.TryGetComponent <ItemModContainer>(out component))
                    {
                        amount = component.maxStackSize;
                    }
                    baseLiquidVessel.AddLiquid(liquidType, amount);
                }
            }
        }
Exemplo n.º 9
0
        public static string svspawnitem(string name, Vector3 pos)
        {
            BasePlayer arg = ArgEx.Player(ConsoleSystem.CurrentArgs);

            if (string.IsNullOrEmpty(name))
            {
                return("No entity name provided");
            }
            string[] array = (from x in ItemManager.itemList
                              select x.shortname into x
                              where x.Contains(name, CompareOptions.IgnoreCase)
                              select x).ToArray();
            if (array.Length == 0)
            {
                return("Entity type not found");
            }
            if (array.Length > 1)
            {
                string text = array.FirstOrDefault((string x) => string.Compare(x, name, StringComparison.OrdinalIgnoreCase) == 0);
                if (text == null)
                {
                    Debug.Log($"{arg} failed to spawn \"{name}\"");
                    return("Unknown entity - could be:\n\n" + string.Join("\n", array));
                }
                array[0] = text;
            }
            Item item = ItemManager.CreateByName(array[0], 1, 0uL);

            if (item == null)
            {
                Debug.Log($"{arg} failed to spawn \"{array[0]}\" (tried to spawnitem \"{name}\")");
                return("Couldn't spawn " + name);
            }
            BaseEntity arg2 = item.CreateWorldObject(pos);

            Debug.Log($"{arg} spawned \"{arg2}\" at {pos} (via spawnitem)");
            return(string.Concat("spawned ", item, " at ", pos));
        }
Exemplo n.º 10
0
        private static void sayImpl(ChatChannel targetChannel, Arg arg)
        {
            if (!enabled)
            {
                arg.ReplyWith("Chat is disabled.");
                return;
            }
            BasePlayer basePlayer = ArgEx.Player(arg);

            if (!basePlayer || basePlayer.HasPlayerFlag(BasePlayer.PlayerFlags.ChatMute))
            {
                return;
            }
            if (!basePlayer.IsAdmin && !basePlayer.IsDeveloper)
            {
                if (basePlayer.NextChatTime == 0f)
                {
                    basePlayer.NextChatTime = UnityEngine.Time.realtimeSinceStartup - 30f;
                }
                if (basePlayer.NextChatTime > UnityEngine.Time.realtimeSinceStartup)
                {
                    basePlayer.NextChatTime += 2f;
                    float num = basePlayer.NextChatTime - UnityEngine.Time.realtimeSinceStartup;
                    ConsoleNetwork.SendClientCommand(basePlayer.net.connection, "chat.add", 2, 0, "You're chatting too fast - try again in " + (num + 0.5f).ToString("0") + " seconds");
                    if (num > 120f)
                    {
                        basePlayer.Kick("Chatting too fast");
                    }
                    return;
                }
            }
            string @string = arg.GetString(0, "text");

            if (sayAs(targetChannel, basePlayer.userID, basePlayer.displayName, @string, basePlayer))
            {
                basePlayer.NextChatTime = UnityEngine.Time.realtimeSinceStartup + 1.5f;
            }
        }
Exemplo n.º 11
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);
            }
        }
Exemplo n.º 12
0
        public static void deployLoadout(Arg arg)
        {
            BasePlayer basePlayer = ArgEx.Player(arg);

            if ((basePlayer.IsAdmin || basePlayer.IsDeveloper || Server.cinematic) && !(basePlayer == null))
            {
                string       @string = arg.GetString(0);
                BasePlayer   playerOrSleeperOrBot = ArgEx.GetPlayerOrSleeperOrBot(arg, 1);
                SavedLoadout so;
                if (playerOrSleeperOrBot == null)
                {
                    arg.ReplyWith("Could not find player " + arg.GetString(1));
                }
                else if (LoadLoadout(@string, out so))
                {
                    so.LoadItemsOnTo(playerOrSleeperOrBot);
                    arg.ReplyWith("Deployed loadout " + @string + " to " + playerOrSleeperOrBot.displayName);
                }
                else
                {
                    arg.ReplyWith("Could not find loadout " + @string);
                }
            }
        }
Exemplo n.º 13
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);
                }
            }
        }
Exemplo n.º 14
0
        public static void swapseats(Arg arg)
        {
            int        targetSeat = 0;
            BasePlayer basePlayer = ArgEx.Player(arg);

            if (basePlayer == null || basePlayer.SwapSeatCooldown())
            {
                return;
            }
            BaseMountable mounted = basePlayer.GetMounted();

            if (!(mounted == null))
            {
                BaseVehicle baseVehicle = mounted.GetComponent <BaseVehicle>();
                if (baseVehicle == null)
                {
                    baseVehicle = mounted.VehicleParent();
                }
                if (!(baseVehicle == null))
                {
                    baseVehicle.SwapSeats(basePlayer, targetSeat);
                }
            }
        }
Exemplo n.º 15
0
        public static void gotosleep(Arg arg)
        {
            BasePlayer basePlayer = ArgEx.Player(arg);

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

            if (!basePlayer2)
            {
                basePlayer2 = BasePlayer.FindBotClosestMatch(uInt.ToString());
                if (basePlayer2.IsSleeping())
                {
                    basePlayer2 = null;
                }
            }
            if ((bool)basePlayer2)
            {
                basePlayer2.StartSleeping();
            }
        }
Exemplo n.º 16
0
 public static void refillvitals(Arg arg)
 {
     AdjustHealth(ArgEx.Player(arg), 1000f);
     AdjustCalories(ArgEx.Player(arg), 1000f);
     AdjustHydration(ArgEx.Player(arg), 1000f);
 }
Exemplo n.º 17
0
 public static void hurt(Arg arg)
 {
     AdjustHealth(ArgEx.Player(arg), -arg.GetInt(0, 1), arg.GetString(1, string.Empty));
 }
Exemplo n.º 18
0
 public static void eat(Arg arg)
 {
     AdjustCalories(ArgEx.Player(arg), arg.GetInt(0, 1), arg.GetInt(1, 1));
 }
        public void Collection_if_equivalency_is_not_given()
        {
            var service = Substitute.For <ISomeInterface>();

            DoSomethingElseWith(service);


            ExpectFailure(@"Expected to receive a call matching:
	UseCollection(NSubstitute.Core.Arguments.ArgumentMatcher+GenericToNonGenericMatcherProxyWithDescribe`1[System.Collections.Generic.IEnumerable`1[NSubstitute.Equivalency.Tests.ArgExTests+Person]])
Actually received no matching calls.
Received 1 non-matching call (non-matching arguments indicated with '*' characters):
	UseCollection(*Person[]*)
		arg[0]: Expected item[1].Birthday to be <1972-09-14>, but found <1972-09-13>."        , () => service.Received().UseCollection(ArgEx.IsCollectionEquivalentTo(new []
            {
                new Person()
                {
                    FirstName = "Alice", LastName = "Wonderland", Birthday = new DateTime(1968, 6, 1)
                },
                new Person()
                {
                    FirstName = "Bob", LastName = "Peanut", Birthday = new DateTime(1972, 9, 14)
                },
            })));
        }
Exemplo n.º 20
0
 public static void drink(Arg arg)
 {
     AdjustHydration(ArgEx.Player(arg), arg.GetInt(0, 1), arg.GetInt(1, 1));
 }
Exemplo n.º 21
0
        public static void breakheld(Arg arg)
        {
            Item activeItem = ArgEx.Player(arg).GetActiveItem();

            activeItem?.LoseCondition(activeItem.condition * 2f);
        }
Exemplo n.º 22
0
 public static void injure(Arg args)
 {
     InjurePlayer(ArgEx.Player(args));
 }
Exemplo n.º 23
0
 public static void recover(Arg args)
 {
     RecoverPlayer(ArgEx.Player(args));
 }
Exemplo n.º 24
0
        public static void copyTo(Arg arg)
        {
            BasePlayer basePlayer = ArgEx.Player(arg);

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

            if (arg.HasArgs() && arg.GetString(0).ToLower() != "true")
            {
                basePlayer2 = ArgEx.GetPlayer(arg, 0);
                if (basePlayer2 == null)
                {
                    uint uInt = arg.GetUInt(0);
                    basePlayer2 = BasePlayer.FindByID(uInt);
                    if (basePlayer2 == null)
                    {
                        basePlayer2 = BasePlayer.FindBot(uInt);
                    }
                }
            }
            else
            {
                basePlayer2 = RelationshipManager.GetLookingAtPlayer(basePlayer);
            }
            if (basePlayer2 == null)
            {
                return;
            }
            basePlayer2.inventory.containerBelt.Clear();
            basePlayer2.inventory.containerWear.Clear();
            int num = 0;

            foreach (Item item2 in basePlayer.inventory.containerBelt.itemList)
            {
                basePlayer2.inventory.containerBelt.AddItem(item2.info, item2.amount, item2.skin);
                if (item2.contents != null)
                {
                    Item item = basePlayer2.inventory.containerBelt.itemList[num];
                    foreach (Item item3 in item2.contents.itemList)
                    {
                        item.contents.AddItem(item3.info, item3.amount, item3.skin);
                    }
                }
                num++;
            }
            foreach (Item item4 in basePlayer.inventory.containerWear.itemList)
            {
                basePlayer2.inventory.containerWear.AddItem(item4.info, item4.amount, item4.skin);
            }
            if (basePlayer.IsDeveloper)
            {
                basePlayer.ChatMessage("you silently copied items to " + basePlayer2.displayName);
            }
            else
            {
                Chat.Broadcast(basePlayer.displayName + " copied their inventory to " + basePlayer2.displayName, "SERVER", "#eee", 0uL);
            }
        }
Exemplo n.º 25
0
 public static void heal(Arg arg)
 {
     AdjustHealth(ArgEx.Player(arg), arg.GetInt(0, 1));
 }