Example #1
0
        public void PartialNameTP(Fougerite.Player p, int choice)
        {
            if (!tpWaitList.Contains(p.PlayerClient.userID)) return;

            List<string> list = (List<string>)tpWaitList[p.PlayerClient.userID];
            string str = list[choice];
            if (choice == 0)
            {
                Util.sayUser(p.PlayerClient.netPlayer, Core.Name, "Cancelled!");
                tpWaitList.Remove(p.PlayerClient.userID);
            }
            else
            {
                ConsoleSystem.Arg arg;
                if (list[0] == "ToTarget")
                {
                    arg = new ConsoleSystem.Arg("teleport.toplayer " + Facepunch.Utility.String.QuoteSafe(p.Name) + " " + Facepunch.Utility.String.QuoteSafe(str));
                }
                else
                {
                    arg = new ConsoleSystem.Arg("teleport.toplayer " + Facepunch.Utility.String.QuoteSafe(str) + " " + Facepunch.Utility.String.QuoteSafe(p.Name));
                }
                teleport.toplayer(ref arg);
                tpWaitList.Remove(p.PlayerClient.userID);
            }
        }
Example #2
0
 public void PartialNameBan(Fougerite.Player p, int id)
 {
     if (Core.banWaitList.Contains(p.PlayerClient.userID))
     {
         List<string> list = (List<string>)Core.banWaitList[p.PlayerClient.userID];
         string str = list[id];
         if (id == 0)
         {
             Util.sayUser(p.PlayerClient.netPlayer, Core.Name, "Cancelled!");
             Core.banWaitList.Remove(p.PlayerClient.userID);
         }
         else
         {
             foreach (PlayerClient client in PlayerClient.All)
             {
                 if (client.netUser.displayName == str)
                 {
                     Core.banWaitList.Remove(p.PlayerClient.userID);
                     if (Administrator.IsAdmin(client.userID) && !Administrator.GetAdmin(p.PlayerClient.userID).HasPermission("RCON"))
                     {
                         Util.sayUser(p.PlayerClient.netPlayer, Core.Name, "You cannot ban an administrator!");
                     }
                     else
                     {
                         Core.blackList.Add(client.netUser.userID, client.netUser.displayName);
                         Administrator.NotifyAdmins(client.netUser.displayName + " has been banned.");
                         client.netUser.Kick(NetError.Facepunch_Connector_VAC_Banned, true);
                     }
                     break;
                 }
             }
         }
     }
 }
Example #3
0
        public void AirdropAtPlayer(Fougerite.Player p, int rep)
        {
            Contract.Requires(p != null);
            Contract.Requires(rep >= 0);

            for (int i = 0; i < rep; i++)
            {
                SupplyDropZone.CallAirDropAt(p.Location);
            }
        }
Example #4
0
        void EntityDeployed(Fougerite.Player Player, Fougerite.Entity Entity)
        {
            if (Config.GetSetting("Settings", "enabled").ToLower() == "true" && Entity != null)
                if (Entity.Name == "WoodFoundation" || Entity.Name == "MetalFoundation" || Entity.Name == "WoodRamp" || Entity.Name == "MetalRamp")
                {
                    var name = Entity.Name;
                    bool GiveBack = Config.GetSetting("Settings", "giveback").ToLower() == "true";
                    var two = Util.GetUtil().CreateVector(Entity.X, Entity.Y, Entity.Z);
                    foreach (Entity ent in World.GetWorld().Entities)
                    {
                        var one = Util.GetUtil().CreateVector(ent.X, ent.Y, ent.Z);
                        var dist = Util.GetUtil().GetVectorsDistance(one, two);

                        if (ent.Name == "WoodRamp" || ent.Name == "MetalRamp")
                        {
                            if (Entity != ent && Entity.InstanceID != ent.InstanceID && dist == 0)
                            {
                                if (GiveBack && Player != null)
                                {
                                    if (name == "WoodRamp")
                                        name = "Wood Ramp";
                                    else if (name == "MetalRamp")
                                        name = "Metal Ramp";
                                    Player.Inventory.AddItem(name, 1);

                                }
                                Entity.Destroy();
                                return;
                            }
                        }
                        else if (ent.Name != "WoodRamp" && ent.Name != "MetalRamp" && ent.Name != "WoodFoundation" && ent.Name != "WoodDoorFrame" && ent.Name != "WoodWall" && ent.Name != "WoodPillar" && ent.Name != "WoodCeiling" && ent.Name != "MetalDoor" && ent.Name != "WoodStairs" && ent.Name != "WoodWindowFrame" && ent.Name != "MetalFoundation" && ent.Name != "MetalDoorFrame" && ent.Name != "MetalWall" && ent.Name != "MetalPillar" && ent.Name != "MetalCeiling" && ent.Name != "MetalStairs" && ent.Name != "MetalWindowFrame" && ent.Name != "Wood_Shelter" && ent.Name != "Barricade_Fence_Deployable" && ent.Name != "Wood Box" && ent.Name != "Metal Bars Window" && ent.Name != "CampFire" && ent.Name != "Wood Spike Wall" && ent.Name != "Large Wood Spike Wall")
                        {

                            if (Entity != ent && Entity.InstanceID != ent.InstanceID && dist <= 2.5)
                            {
                                if (Player != null)
                                {
                                    Player.Notice("Ya can't place chest under foundation bitch!");
                                    if (GiveBack)
                                    {
                                        if (name == "WoodFoundation")
                                            name = "Wood Foundation";
                                        else if (name == "MetalFoundation")
                                            name = "Metal Foundation";
                                        Player.Inventory.AddItem(name, 1);
                                    }
                                }
                                Entity.Destroy();
                                return;
                            }
                        }
                    }
                }
        }
Example #5
0
        public PlayerInv(Fougerite.Player player)
        {
            Contract.Requires(player != null);

            this.player = player;
            this._inv = player.PlayerClient.controllable.GetComponent<Inventory>();
            if (_inv == null)
                throw new InvalidOperationException("Player's inventory component is null.");
            Contract.Assert(_inv != null);

            this._items = new PlayerItem[30];
            this._armorItems = new PlayerItem[4];
            this._barItems = new PlayerItem[6];

            for (int i = 0; i < this._inv.slotCount; i++)
            {
                if (i < 30) this.Items[i] = new PlayerItem(this._inv, i);
                else if (i < 0x24) this.BarItems[i - 30] = new PlayerItem(this._inv, i);
                else if (i < 40) this.ArmorItems[i - 0x24] = new PlayerItem(this._inv, i);
            }
        }
Example #6
0
 private void Command(Fougerite.Player player, string cmd, string[] args)
 {
     if (cmd == "test" && args.Length == 1 && player.Admin)
     {
         TesterPlayer = player;
         switch (args[0].ToLower())
         {
             case "all":
                 TestAll();
                 break;
             case "dump":
                 ObjectsDump();
                 break;
             case "target":
                 Target_Test();
                 break;
             case "ground":
                 GetGround_Test();
                 break;
             case "help":
                 player.Message("Use in only on test server!");
                 player.Message("/test dump - dump info about all objects to log");
                 player.Message("/test target - info about targeted object");
                 player.Message("/test ground - testing Z coord");
                 player.Message("/test all - testing all");
                 player.Message("/test save - saving world");
                 break;
             case "save":
                 Server.GetServer().Save();
                 break;
             default:
                 player.Message("Enter valid arg!");
                 break;
         }
     }
 }
Example #7
0
 public DecayEvent(Fougerite.Entity en, ref float dmg)
 {
     this.Entity = en;
     this.DamageAmount = dmg;
 }
Example #8
0
 private void PlayerDisconnect(Fougerite.Player player)
 {
     try
     {
         if (RelogCooldown)
             if (!player.Admin)
             {
                 var Time = System.Environment.TickCount;
                 if (Cooldown == 0)
                     DS.Add("loginCooldown", player.SteamID.ToString(), Time);
             }
     }
     catch (Exception ex)
     {
         Logger.LogException(ex);
     }
 }
Example #9
0
        private void PlayerConnect(Fougerite.Player player)
        {
            try
            {
                try
                {
                    if (AntiSpeedHack_Enabled)
                    {
                        DS.Add("lastCoords", player.SteamID.ToString(), player.Location);
                        DS.Add("AntiSpeedHack", player.SteamID.ToString(), 0);
                    }
                }
                catch (Exception ex)
                {
                    Logger.LogError(ConsolePrefix + " DS fill fail");
                    Logger.LogException(ex);
                }

                try
                {
                    IniParser iniBansIP;
                    string ConfigFile = Path.Combine(ModuleFolder, "BansIP.ini");
                    if (File.Exists(ConfigFile))
                        iniBansIP = new IniParser(ConfigFile);
                    else
                    {
                        Logger.LogError("BansIP.ini does not exist!");
                        return;
                    }
                    string IpBanned = iniBansIP.GetSetting("Ips", player.IP);
                    if (!string.IsNullOrEmpty(IpBanned))
                    {
                        player.MessageFrom(EchoBotName, "[color#FF2222]You have been banned.");
                        Logger.LogDebug(ConsolePrefix + " " + player.Name + " banned by IP!");
                        player.Disconnect();
                        return;
                    }

                    IniParser iniBansID;
                    ConfigFile = Path.Combine(ModuleFolder, "BansID.ini");
                    if (File.Exists(ConfigFile))
                        iniBansID = new IniParser(ConfigFile);
                    else
                    {
                        Logger.LogError("BansID.ini does not exist!");
                        return;
                    }
                    string IdBanned = iniBansID.GetSetting("Ids", player.SteamID);
                    if (!string.IsNullOrEmpty(IdBanned))
                    {
                        player.MessageFrom(EchoBotName, "[color#FF2222]You have been banned.");
                        Logger.LogDebug(ConsolePrefix + " " + player.Name + " banned by ID!");
                        player.Disconnect();
                        return;
                    }
                }
                catch (Exception ex)
                {
                    Logger.LogError(ConsolePrefix + " Bans check fail");
                    Logger.LogException(ex);
                }
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }

                try
                {
                    if (NamesRestrict_Enabled)
                    {
                        var name = player.Name;
                        var len = player.Name.Length;

                        try
                        {
                            if (len > NamesRestrict_MaxLength)
                            {
                                player.MessageFrom(EchoBotName,
                                    "[color#FF2222]You have too many characters in your name. Please Change it. Maximum is " +
                                    NamesRestrict_MaxLength);
                                Log("Nick: " + player.Name + ". Too many chars in name.");
                                player.Disconnect();
                                return;
                            }

                            if (len < NamesRestrict_MinLength)
                            {
                                player.MessageFrom(EchoBotName,
                                    "[color#FF2222]You have not enough characters in your name. Please Change it. Minimum is " +
                                    NamesRestrict_MinLength);
                                Log("Nick: " + player.Name + ". Low length of name.");
                                player.Disconnect();
                                return;
                            }
                        }
                        catch (Exception ex)
                        {
                            Logger.LogError(ConsolePrefix + " NameLenght fail");
                            Logger.LogException(ex);
                        }

                        try
                        {
                            foreach (char Symbol in player.Name)
                                if (NamesRestrict_AllowedChars.IndexOf(Symbol) == -1)
                                {
                                    player.MessageFrom(EchoBotName,
                                        "[color#FF2222]You have invalid characters in your name");
                                    Log("Nick: " + player.Name + ". Banned chars in name.");
                                    player.Disconnect();
                                    return;
                                }
                        }
                        catch (Exception ex)
                        {
                            Logger.LogError(ConsolePrefix + " Name Symbols fail");
                            Logger.LogException(ex);
                        }

                        try
                        {
                            for (var i = 0; i < BannedNames.Length; i++)
                            {
                                if (player.Name.ToLower() == BannedNames[i].ToLower())
                                {
                                    player.MessageFrom(EchoBotName,
                                        "[color#FF2222]This name isn't allowed. Please change your name.");
                                    Log("Nick: " + player.Name + ". Banned name.");
                                    player.Disconnect();
                                    return;
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            Logger.LogError(ConsolePrefix + " BannedNames fail");
                            Logger.LogException(ex);
                        }

                        try
                        {
                            if (NamesRestrict_BindName)
                            {
                                IniParser BoundNames;
                                if (File.Exists(Path.Combine(ModuleFolder, "BoundNames.ini")))
                                    BoundNames = new IniParser(Path.Combine(ModuleFolder, "BoundNames.ini"));
                                else
                                {
                                    Logger.LogError(Path.Combine(ModuleFolder, "BoundNames.ini") + " does not exist!");
                                    return;
                                }

                                var Name = player.Name.ToLower(); 
                                string ID = BoundNames.GetSetting("Names", Name);
                                if ((player.Admin && NamesRestrict_AdminsOnly) || !NamesRestrict_AdminsOnly)
                                {
                                    if (string.IsNullOrEmpty(ID))
                                    {
                                        player.MessageFrom(EchoBotName,
                                            "[color#22AAFF]Nick " + player.Name + " was bound to your SteamID.");
                                        BoundNames.AddSetting("Names", Name, player.SteamID);
                                        BoundNames.Save();
                                    }
                                    else if (ID != player.SteamID)
                                    {
                                        player.MessageFrom(EchoBotName, "[color#FF2222]This nickname doesn't belong to you.");
                                        Log("Nick: " + player.Name + ". Nick stealer.");
                                        player.Disconnect();
                                        return;
                                    }
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            Logger.LogError(ConsolePrefix + " BindName fail");
                            Logger.LogException(ex);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Logger.LogError(ConsolePrefix + " NickRestrict check fail");
                    Logger.LogException(ex);
                }

                try
                {
                    if (RelogCooldown)
                    {
                        var Time = Environment.TickCount;

                        object ObjCooldown = DS.Get("loginCooldown", player.SteamID.ToString());
                        if (ObjCooldown == null)
                            return;
                        int Disconnected = (int) ObjCooldown;
                        if (Time <= Cooldown * 1000 + Disconnected)
                        {
                            var Remaining = ((Cooldown * 1000 - (Time - Disconnected)) / 1000).ToString("F2");
                            player.MessageFrom(EchoBotName,
                                "[color#FF2222]You must wait " + Cooldown + " seconds before reconnecting. Remaining: " +
                                Remaining +
                                " seconds.");
                            Logger.LogDebug(ConsolePrefix + " " + player.Name + " connect cooldown " + Cooldown + " sec!");
                            player.Disconnect();
                            return;
                        }
                        if (Time > Cooldown * 1000 + Disconnected)
                            DS.Remove("loginCooldown", player.SteamID.ToString());
                    }
                }
                catch (Exception ex)
                {
                    Logger.LogError(ConsolePrefix + " Cooldown check fail");
                    Logger.LogException(ex);
                }

            Logger.LogDebug(ConsolePrefix + " " + player.Name + " Connected!");
        }
Example #10
0
        private void PlayerPingCheck(Fougerite.Player player)
        {
            try
            {
                if (player.Ping < HighPingKicking_MaxPing)
                {
                    DS.Add("ping", player.SteamID.ToString(), 0);
                    return;
                }

                int Warned = (int)DS.Get("ping", player.SteamID.ToString());
                if (Warned == 0)
                {
                    player.MessageFrom(EchoBotName,
                        "[color#FF2222]Fix your ping (" + player.Ping + ") or you will be kicked!");
                    DS.Add("ping", player.SteamID.ToString(), 1);
                }
                else if (Warned == 1)
                {
                    player.MessageFrom(EchoBotName,
                        "[color#FF2222]Your ping is " + player.Ping + " but maximum allowed is " +
                        HighPingKicking_MaxPing);
                    Log("Kick: " + player.Name + ". Lagger");
                    player.Disconnect();
                }
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }
        }
Example #11
0
 private void PlayerSpawned(Fougerite.Player player, SpawnEvent se)
 {
     DS.Add("lastCoords", player.SteamID.ToString(), player.Location);
     DS.Add("AntiSpeedHack", player.SteamID.ToString(), 0);
 }
Example #12
0
 void PlayerConnect(Fougerite.Player player)
 {
     if (Core.IsEnabled())
         RustPP.Hooks.loginNotice(player.PlayerClient.netUser);
 }
Example #13
0
        public object SpawnAtPlayer(string prefab, Fougerite.Player p, int rep)
        {
            Contract.Requires(!string.IsNullOrEmpty(prefab));
            Contract.Requires(p != null);
            Contract.Requires(rep >= 0);

            return this.Spawn(prefab, p.Location, p.PlayerClient.transform.rotation, rep);
        }
Example #14
0
 void DoorUse(Fougerite.Player p, DoorEvent de)
 {
 }
Example #15
0
 void PlayerConnect(Fougerite.Player player)
 {
 }
Example #16
0
        public void TeleportTo(Fougerite.Player p)
        {
            Contract.Requires(p.Location != null);

            if (this == p) // lol
                return;
                
            this.TeleportTo(p.Location);
        }
Example #17
0
 public StructureMaster CreateSM(Fougerite.Player p)
 {
     Contract.Requires(p != null);
     return this.CreateSM(p, p.X, p.Y, p.Z, p.PlayerClient.transform.rotation);
 }
Example #18
0
        public void TeleportToAndFace(Fougerite.Player p, float distance = 1.5f)
        { 
            Contract.Requires(p.PlayerClient.controllable.transform != null);

            if (this == p) // lol
                return;

            Transform transform = p.PlayerClient.controllable.transform;                                            // get the target player's transform
            Vector3 target = transform.TransformPoint(new Vector3(0f, 0f, (this.Admin ? -distance : distance)));    // rcon admin teleports behind target player
            this.TeleportTo(target);
            this.ourPlayer.controllable.transform.LookAt(transform);                                                // turn towards the target player's transform
        }
Example #19
0
 public StructureMaster CreateSM(Fougerite.Player p, float x, float y, float z)
 {
     Contract.Requires(p != null);
     return this.CreateSM(p, x, y, z, Quaternion.identity);
 }
Example #20
0
        public void AirdropAtPlayer(Fougerite.Player p)
        {
            Contract.Requires(p != null);

            this.AirdropAtPlayer(p, 1);
        }
Example #21
0
        public bool Contains(Fougerite.Player p)
        {
            Contract.Requires(p != null);

            return this.Contains(p.Location);
        }
Example #22
0
 void DoorUse(Fougerite.Player p, DoorEvent de)
 {
     if (Core.IsEnabled() && !de.Open)
     {
         ShareCommand command = ChatCommand.GetCommand("share") as ShareCommand;
         ArrayList list = (ArrayList)command.GetSharedDoors()[de.Entity.OwnerID];
         if (list == null)
             de.Open = false;
         else if (list.Contains(p.PlayerClient.userID))
             de.Open = true;
         else
             de.Open = false;
     }
 }
Example #23
0
        public static Zone3D GlobalContains(Fougerite.Player p)
        {
            Contract.Requires(p != null);

            Hashtable table = DataStore.GetInstance().GetTable("3DZonesList");
            if (table != null)
            {
                foreach (object obj2 in table.Values)
                {
                    Zone3D zoned = obj2 as Zone3D;
                    if (zoned.Contains(p))
                    {
                        return zoned;
                    }
                }
            }
            return null;
        }
Example #24
0
        private void BanCheater(Fougerite.Player player, string StringLog)
        {
            try
            {
                IniParser iniBansIP;
                string ConfigFile = Path.Combine(ModuleFolder, "BansIP.ini");
                if (File.Exists(ConfigFile))
                    iniBansIP = new IniParser(ConfigFile);
                else
                {
                    Logger.LogError("BansIP.ini does not exist!");
                    return;
                }

                IniParser iniBansID;
                ConfigFile = Path.Combine(ModuleFolder,  "BansID.ini");
                if (File.Exists(ConfigFile))
                    iniBansID = new IniParser(ConfigFile);
                else
                {
                    Logger.LogError("BansID.ini does not exist!");
                    return;
                }

                string Date = DateTime.Now.ToShortDateString();
                string Time = DateTime.Now.ToShortTimeString();
                
                string BanMessage = 
                    "Nickname: " + player.Name + ", Date: " + Date + ", Time: " + Time + 
                        ", Reason: " + StringLog + ", Ping: " + player.Ping;

                iniBansIP.AddSetting("Ips", player.IP, BanMessage);
                iniBansID.AddSetting("Ids", player.SteamID, BanMessage);

                iniBansIP.Save();
                iniBansID.Save();
                player.MessageFrom(EchoBotName, "[color#FF2222]You have been banned.");
                Log("BAN: " + player.Name + " " + ". " + StringLog + ". Ping: " + player.Ping);
                player.Disconnect();
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }
        }
Example #25
0
        //

        void Chat(Fougerite.Player p, ref ChatString text)
        {
        }
Example #26
0
 public StructureMaster CreateSM(Fougerite.Player p, float x, float y, float z, Quaternion rot)
 {
     Contract.Requires(p != null);
     StructureMaster master = NetCull.InstantiateClassic<StructureMaster>(Bundling.Load<StructureMaster>("content/structures/StructureMasterPrefab"), new Vector3(x, y, z), rot, 0);
     master.SetupCreator(p.PlayerClient.controllable);
     return master;
 }
Example #27
0
 void PlayerDisconnect(Fougerite.Player player)
 {
 }
Example #28
0
 public HurtEvent(ref DamageEvent d, Fougerite.Entity en)
     : this(ref d)
 {
     this.Entity = en;
 }
Example #29
0
 public DoorEvent(Fougerite.Entity e)
 {
     this.Open = false;
     this.Entity = e;
 }
Example #30
0
        public Vector3 Infront(Fougerite.Player p, float length)
        {
            Contract.Requires(p != null);
            Contract.Requires(!float.IsInfinity(length));
            Contract.Requires(!float.IsNaN(length));

            return (p.PlayerClient.controllable.transform.position + ((Vector3)(p.PlayerClient.controllable.transform.forward * length)));
        }