Beispiel #1
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;
         }
     }
 }
Beispiel #2
0
 void Chat(Fougerite.Player p, ref ChatString text)
 {
 }
Beispiel #3
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;
                            }
                        }
                    }
                }
            }
        }
Beispiel #4
0
 public void OnPlayerTeleport(Fougerite.Player player, Vector3 from, Vector3 to)
 {
     Invoke("On_PlayerTeleport", player, from, to);
 }
Beispiel #5
0
 public void OnShowTalker(uLink.NetworkPlayer np, Fougerite.Player player)
 {
     Invoke("On_VoiceChat", np, player);
 }
Beispiel #6
0
        private void OnCommand(Fougerite.Player player, string cmd, string[] args)
        {
            if (cmd == "authme")
            {
                if (args.Length == 0)
                {
                    player.MessageFrom("AuthMe", orange + "AuthMe V" + Version + " By " + Author);
                    player.MessageFrom("AuthMe", yellow + "-- Passwords are stored using SHA1 hashes --");
                    player.MessageFrom("AuthMe", yellow + "-- Always use a different password than your emails, etc. --");
                    player.MessageFrom("AuthMe", orange + "/authme register username password");
                    player.MessageFrom("AuthMe", orange + "/authme login username password");
                    player.MessageFrom("AuthMe", orange + "/authme changepw username newpassword");
                    if (player.Admin || player.Moderator)
                    {
                        player.MessageFrom("AuthMe", orange + "/authme resetuser ingamename");
                        player.MessageFrom("AuthMe", orange + "/authme reload");
                    }
                }
                else if (args.Length == 1)
                {
                    string subcmd = args[0];
                    switch (subcmd)
                    {
                    case "reload":
                        if (player.Admin || player.Moderator)
                        {
                            ReloadConfig();
                            player.MessageFrom("AuthMe", green + "Config reloaded!");
                        }

                        break;
                    }
                }
                else if (args.Length == 2)
                {
                    string subcmd = args[0];
                    switch (subcmd)
                    {
                    case "resetuser":
                        if (player.Admin || player.Moderator)
                        {
                            Fougerite.Player plr = Fougerite.Server.GetServer().FindPlayer(args[1]);
                            if (plr != null)
                            {
                                if (Auths.GetSetting("Login", plr.SteamID) != null)
                                {
                                    Auths.DeleteSetting("Login", plr.SteamID);
                                    Auths.Save();
                                }

                                if (Credentials.ContainsKey(plr.UID))
                                {
                                    Credentials.Remove(plr.UID);
                                }

                                player.MessageFrom("AuthMe", green + "User: "******" reset! He can now register a new account for that steamid.");
                                plr.MessageFrom("AuthMe", green + CredsReset);
                                AuthLogger.Log("[USER RESET] " + player.Name + " - " + player.SteamID
                                               + " - " + player.IP + " reset credetials for: " + plr.Name + " - " + plr.SteamID + " - " + plr.IP);
                            }
                        }

                        break;
                    }
                }
                else if (args.Length == 3)
                {
                    string subcmd = args[0];
                    switch (subcmd)
                    {
                    case "register":
                        if (Credentials.ContainsKey(player.UID))
                        {
                            player.MessageFrom("AuthMe", red + "This STEAMID is already protected using password authentication!");
                            return;
                        }

                        string username = args[1];
                        string password = args[2];

                        if (username.ToLower() == "username" || password.ToLower() == "password")
                        {
                            player.MessageFrom("AuthMe", orange + "Type /authme register username password");
                            return;
                        }

                        bool b  = Regex.IsMatch(username, @"^[a-zA-Z0-9_&@%!+<>]+$");
                        bool b2 = Regex.IsMatch(password, @"^[a-zA-Z0-9_&@%!+<>]+$");

                        if (!b || !b2)
                        {
                            player.MessageFrom("AuthMe", orange + "Sorry, no special characters or space! Only: a-zA-Z0-9_&@%!+<>");
                            return;
                        }

                        if (username.Length > 25 || password.Length > 25)
                        {
                            player.MessageFrom("AuthMe", orange + "Sorry, username and password length must be below 25.");
                            return;
                        }

                        string hash = SHA1Hash(password);
                        Auths.AddSetting("Login", player.SteamID, username.ToLower() + "---##---" + hash);
                        Auths.Save();
                        Credentials.Add(player.UID, new Credential(username.ToLower(), hash));
                        player.MessageFrom("AuthMe", orange + "You have registered with: " + username + " - " + password + " (Your console has this info now too.)");
                        player.SendConsoleMessage(orange + "You have registered with: " + username + " - " + password);

                        WaitingUsers.Remove(player.UID);
                        DataStore.GetInstance().Remove("AuthMeLogin", player.UID);
                        uLink.NetworkView.Get(player.PlayerClient.networkView)
                        .RPC("DestroyFreezeAuthMe", player.NetworkPlayer);

                        foreach (var x in RestrictedCommands)
                        {
                            player.UnRestrictCommand(x);
                        }

                        AuthLogger.Log(player.Name + " - " + player.SteamID + " - " + player.IP + " registered an account: " + username);
                        break;

                    case "login":
                        if (!WaitingUsers.ContainsKey(player.UID))
                        {
                            player.MessageFrom("AuthMe", orange + "You are logged in already.");
                            return;
                        }

                        string username2 = args[1];
                        string password2 = args[2];

                        if (username2.Length > 25 || password2.Length > 25)
                        {
                            player.MessageFrom("AuthMe", orange + "Sorry, username and password length must be below 25.");
                            return;
                        }

                        if (!Credentials.ContainsKey(player.UID))
                        {
                            player.MessageFrom("AuthMe", orange + "This steamid is not registered yet!");
                            player.MessageFrom("AuthMe", orange + "Type /authme register username password");
                            return;
                        }

                        Credential cred = Credentials[player.UID];
                        if (cred.Username.ToLower() != username2.ToLower())
                        {
                            player.MessageFrom("AuthMe", orange + "Invalid username!");
                            AuthLogger.Log(player.Name + " - " + player.SteamID + " - " + player.IP + " tried to login using: " + username2);
                            return;
                        }

                        if (cred.HashedPassword != SHA1Hash(password2))
                        {
                            AuthLogger.Log(player.Name + " - " + player.SteamID + " - " + player.IP + " tried to login using: " + username2);
                            player.MessageFrom("AuthMe", orange + "Invalid password! Seek admin for help on their social site.");
                        }
                        else
                        {
                            PrivilegeStorage storage = WaitingUsers[player.UID];
                            if (storage.WasAdmin)
                            {
                                player.ForceAdminOff(false);
                                player.PlayerClient.netUser.SetAdmin(true);
                            }

                            if (storage.WasModerator)
                            {
                                player.ForceModeratorOff(false);
                            }

                            WaitingUsers.Remove(player.UID);
                            DataStore.GetInstance().Remove("AuthMeLogin", player.UID);
                            uLink.NetworkView.Get(player.PlayerClient.networkView)
                            .RPC("DestroyFreezeAuthMe", player.NetworkPlayer);

                            foreach (var x in RestrictedCommands)
                            {
                                player.UnRestrictCommand(x);
                            }
                            AuthLogger.Log(player.Name + " - " + player.SteamID + " - " + player.IP + " logged in using: " + username2);
                            player.MessageFrom("AuthMe", green + "Successfully logged in!");
                        }
                        break;

                    case "changepw":
                        if (WaitingUsers.ContainsKey(player.UID))
                        {
                            player.MessageFrom("AuthMe", orange + "Nice try. You need to be logged in to do that.");
                            return;
                        }

                        string username3 = args[1];
                        string password3 = args[2];
                        if (!Credentials.ContainsKey(player.UID))
                        {
                            player.MessageFrom("AuthMe", orange + "This steamid is not registered yet!");
                            return;
                        }

                        Credential cred2 = Credentials[player.UID];
                        if (!string.Equals(cred2.Username, username3, StringComparison.CurrentCultureIgnoreCase))
                        {
                            player.MessageFrom("AuthMe", orange + "Invalid username!");
                            return;
                        }

                        if (username3.Length > 25 || password3.Length > 25)
                        {
                            player.MessageFrom("AuthMe", orange + "Sorry, username and password length must be below 25.");
                            return;
                        }

                        Credentials.Remove(player.UID);

                        string hash3 = SHA1Hash(password3);
                        Auths.SetSetting("Login", player.SteamID, username3.ToLower() + "---##---" + hash3);
                        Auths.Save();
                        Credentials.Add(player.UID, new Credential(username3.ToLower(), hash3));
                        AuthLogger.Log(player.Name + " - " + player.SteamID + " - " + player.IP + " changed password using: " + username3);

                        player.MessageFrom("AuthMe", green + "Password successfully changed!");
                        break;

                    default:
                        player.MessageFrom("AuthMe", orange + "Invalid command. Type /authme for help.");
                        break;
                    }
                }
            }
        }
Beispiel #7
0
 public void OnBlueprintUse(Player player, BPUseEvent evt)
 {
     Invoke("On_BlueprintUse", player, evt);
 }
 public void OnDoorUse(Fougerite.Player player, DoorEvent evt)
 {
     this.Invoke("On_DoorUse", new object[] { player, evt });
 }
Beispiel #9
0
 public void OnPlayerSpawned(Player player, SpawnEvent evt)
 {
     Invoke("On_PlayerSpawned", player, evt);
 }
Beispiel #10
0
 public void OnPlayerGathering(Player player, GatherEvent evt)
 {
     Invoke("On_PlayerGathering", player, evt);
 }
Beispiel #11
0
 public void OnPlayerDisconnected(Player player)
 {
     Invoke("On_PlayerDisconnected", player);
 }
Beispiel #12
0
 public void OnEntityDeployed(Player player, Entity entity)
 {
     Invoke("On_EntityDeployed", player, entity);
 }
Beispiel #13
0
 public void OnDoorUse(Player player, DoorEvent evt)
 {
     Invoke("On_DoorUse", player, evt);
 }
Beispiel #14
0
 public void OnCommand(Player player, string command, string[] args)
 {
     Invoke("On_Command", player, command, args);
 }
Beispiel #15
0
 public void OnChat(Player player, ref ChatString text)
 {
     Invoke("On_Chat", player, text);
 }
Beispiel #16
0
 void PlayerDisconnect(Fougerite.Player player)
 {
 }
Beispiel #17
0
 public void Disconnected(User pl)
 {
     list.AddSetting(pl.SteamID, "LastLeft", DateTime.Now.ToString());
     list.AddSetting(pl.SteamID, "Online", "no");
     list.Save();
 }
Beispiel #18
0
 public void SetTarget(Fougerite.Player target, bool inRange)
 {
     _target  = !inRange ? null : target;
     _inRange = inRange;
 }
Beispiel #19
0
 public void OnPlayerGathering(Fougerite.Player player, GatherEvent evt)
 {
     this.Invoke("On_PlayerGathering", new object[] { player, evt });
 }
Beispiel #20
0
        void ChatReceived(ref ConsoleSystem.Arg arg)
        {
            Fougerite.Player pl = Fougerite.Server.Cache[arg.argUser.userID];
            var command         = ChatCommand.GetCommand("tpto") as TeleportToCommand;

            if (command.GetTPWaitList().Contains(pl.UID))
            {
                command.PartialNameTP(ref arg, arg.GetInt(0));
                arg.ArgsStr = string.Empty;
            }
            else if (Core.friendWaitList.Contains(arg.argUser.userID))
            {
                (ChatCommand.GetCommand("addfriend") as AddFriendCommand).PartialNameAddFriend(ref arg, arg.GetInt(0));
                Core.friendWaitList.Remove(arg.argUser.userID);
                arg.ArgsStr = string.Empty;
            }
            else if (Core.shareWaitList.Contains(pl.UID))
            {
                (ChatCommand.GetCommand("share") as ShareCommand).PartialNameDoorShare(ref arg, arg.GetInt(0));
                Core.shareWaitList.Remove(pl.UID);
                arg.ArgsStr = string.Empty;
            }
            else if (Core.banWaitList.Contains(pl.UID))
            {
                (ChatCommand.GetCommand("ban") as BanCommand).PartialNameBan(ref arg, arg.GetInt(0));
                Core.banWaitList.Remove(pl.UID);
                arg.ArgsStr = string.Empty;
            }
            else if (Core.kickWaitList.Contains(pl.UID))
            {
                (ChatCommand.GetCommand("kick") as KickCommand).PartialNameKick(ref arg, arg.GetInt(0));
                Core.kickWaitList.Remove(pl.UID);
                arg.ArgsStr = string.Empty;
            }
            else if (Core.killWaitList.Contains(pl.UID))
            {
                (ChatCommand.GetCommand("kill") as KillCommand).PartialNameKill(ref arg, arg.GetInt(0));
                Core.killWaitList.Remove(pl.UID);
                arg.ArgsStr = string.Empty;
            }
            else if (Core.unfriendWaitList.Contains(pl.UID))
            {
                (ChatCommand.GetCommand("unfriend") as UnfriendCommand).PartialNameUnfriend(ref arg, arg.GetInt(0));
                Core.unfriendWaitList.Remove(pl.UID);
                arg.ArgsStr = string.Empty;
            }
            else if (Core.unshareWaitList.Contains(pl.UID))
            {
                (ChatCommand.GetCommand("unshare") as UnshareCommand).PartialNameUnshareDoors(ref arg, arg.GetInt(0));
                Core.unshareWaitList.Remove(pl.UID);
                arg.ArgsStr = string.Empty;
            }
            else if (Core.whiteWaitList.Contains(pl.UID))
            {
                (ChatCommand.GetCommand("addwl") as WhiteListAddCommand).PartialNameWhitelist(ref arg, arg.GetInt(0));
                Core.whiteWaitList.Remove(pl.UID);
                arg.ArgsStr = string.Empty;
            }
            else if (Core.adminAddWaitList.Contains(arg.argUser.userID))
            {
                (ChatCommand.GetCommand("addadmin") as AddAdminCommand).PartialNameNewAdmin(ref arg, arg.GetInt(0));
                Core.adminAddWaitList.Remove(arg.argUser.userID);
                arg.ArgsStr = string.Empty;
            }
            else if (Core.adminRemoveWaitList.Contains(pl.UID))
            {
                (ChatCommand.GetCommand("unadmin") as RemoveAdminCommand).PartialNameRemoveAdmin(ref arg, arg.GetInt(0));
                Core.adminRemoveWaitList.Remove(pl.UID);
                arg.ArgsStr = string.Empty;
            }
            else if (Core.adminFlagsWaitList.Contains(pl.UID))
            {
                (ChatCommand.GetCommand("getflags") as GetFlagsCommand).PartialNameGetFlags(ref arg, arg.GetInt(0));
                Core.adminFlagsWaitList.Remove(pl.UID);
                arg.ArgsStr = string.Empty;
            }
            else if (Core.muteWaitList.Contains(pl.UID))
            {
                (ChatCommand.GetCommand("mute") as MuteCommand).PartialNameMute(ref arg, arg.GetInt(0));
                Core.muteWaitList.Remove(pl.UID);
                arg.ArgsStr = string.Empty;
            }
            else if (Core.unmuteWaitList.Contains(pl.UID))
            {
                (ChatCommand.GetCommand("unmute") as UnmuteCommand).PartialNameUnmute(ref arg, arg.GetInt(0));
                Core.unmuteWaitList.Remove(pl.UID);
                arg.ArgsStr = string.Empty;
            }
            else if (Core.adminFlagWaitList.Contains(pl.UID))
            {
                (ChatCommand.GetCommand("addflag") as AddFlagCommand).PartialNameAddFlags(ref arg, arg.GetInt(0));
                Core.adminFlagWaitList.Remove(pl.UID);
                arg.ArgsStr = string.Empty;
            }
            else if (Core.adminUnflagWaitList.Contains(pl.UID))
            {
                (ChatCommand.GetCommand("unflag") as RemoveFlagsCommand).PartialNameRemoveFlags(ref arg, arg.GetInt(0));
                Core.adminUnflagWaitList.Remove(pl.UID);
                arg.ArgsStr = string.Empty;
            }
            else if (Core.unbanWaitList.Contains(pl.UID))
            {
                (ChatCommand.GetCommand("unban") as UnbanCommand).PartialNameUnban(ref arg, arg.GetInt(0));
                Core.unbanWaitList.Remove(pl.UID);
                arg.ArgsStr = string.Empty;
            }

            if (Core.IsEnabled())
            {
                Core.handleCommand(ref arg);
            }
        }
Beispiel #21
0
        private void OnRustBusterUserMessage(API.RustBusterUserAPI user, Message msgc)
        {
            if (msgc.PluginSender == "AuthMe")
            {
                Fougerite.Player player = user.Player;

                string[] spl = msgc.MessageByClient.Split('-');
                if (spl.Length != 3)
                {
                    return;
                }

                string evt      = spl[0];
                string username = spl[1];
                string password = spl[2];
                if (evt == "AuthMeLogin")
                {
                    if (!WaitingUsers.ContainsKey(player.UID))
                    {
                        player.MessageFrom("AuthMe", orange + "You are logged in already.");
                        msgc.ReturnMessage = "DisApproved";
                        return;
                    }

                    if (!Credentials.ContainsKey(player.UID))
                    {
                        player.MessageFrom("AuthMe", orange + "This steamid is not registered yet!");
                        player.MessageFrom("AuthMe", orange + "Type /authme register username password");
                        msgc.ReturnMessage = "DisApproved";
                        return;
                    }

                    Credential cred = Credentials[player.UID];
                    if (!string.Equals(cred.Username, username, StringComparison.CurrentCultureIgnoreCase))
                    {
                        player.MessageFrom("AuthMe", orange + "Invalid username!");
                        AuthLogger.Log(player.Name + " - " + player.SteamID + " - " + player.IP +
                                       " tried to login using: " + username);
                        msgc.ReturnMessage = "DisApproved";
                        return;
                    }

                    if (username.Length > 25 || password.Length > 25)
                    {
                        player.MessageFrom("AuthMe", orange + "Sorry, username and password length must be below 25.");
                        msgc.ReturnMessage = "DisApproved";
                        return;
                    }

                    if (cred.HashedPassword != SHA1Hash(password))
                    {
                        AuthLogger.Log(player.Name + " - " + player.SteamID + " - " + player.IP +
                                       " tried to login using: " + username);
                        player.MessageFrom("AuthMe", red + "Invalid password! Seek help here: " + yellow + " " + SocialSiteForHelp);
                        msgc.ReturnMessage = "DisApproved";
                    }
                    else
                    {
                        PrivilegeStorage storage = WaitingUsers[player.UID];
                        if (storage.WasAdmin)
                        {
                            player.ForceAdminOff(false);
                            player.PlayerClient.netUser.SetAdmin(true);
                        }

                        if (storage.WasModerator)
                        {
                            player.ForceModeratorOff(false);
                        }

                        WaitingUsers.Remove(player.UID);
                        DataStore.GetInstance().Remove("AuthMeLogin", player.UID);
                        uLink.NetworkView.Get(player.PlayerClient.networkView)
                        .RPC("DestroyFreezeAuthMe", player.NetworkPlayer);

                        foreach (var x in RestrictedCommands)
                        {
                            player.UnRestrictCommand(x);
                        }

                        AuthLogger.Log(player.Name + " - " + player.SteamID + " - " + player.IP + " logged in using: " +
                                       username);
                        player.MessageFrom("AuthMe", green + "Successfully logged in!");
                        msgc.ReturnMessage = "Approved";
                    }
                }
                else if (evt == "AuthMeRegister")
                {
                    if (Credentials.ContainsKey(player.UID))
                    {
                        player.MessageFrom("AuthMe",
                                           red + "This STEAMID is already protected using password authentication!");
                        msgc.ReturnMessage = "InvalidRegistration";
                        return;
                    }

                    if (username.ToLower() == "username" || password.ToLower() == "password")
                    {
                        player.MessageFrom("AuthMe", orange + "Type /authme register username password");
                        msgc.ReturnMessage = "InvalidRegistration";
                        return;
                    }

                    bool b  = Regex.IsMatch(username, @"^[a-zA-Z0-9_&@%!+<>]+$");
                    bool b2 = Regex.IsMatch(password, @"^[a-zA-Z0-9_&@%!+<>]+$");

                    if (!b || !b2)
                    {
                        player.MessageFrom("AuthMe", orange + "Sorry, no special characters or space! Only: a-zA-Z0-9_&@%!+<>");
                        msgc.ReturnMessage = "InvalidRegistration";
                        return;
                    }

                    if (username.Length > 25 || password.Length > 25)
                    {
                        player.MessageFrom("AuthMe", orange + "Sorry, username and password length must be below 25.");
                        msgc.ReturnMessage = "InvalidRegistration";
                        return;
                    }

                    string hash = SHA1Hash(password);
                    Auths.AddSetting("Login", player.SteamID, username.ToLower() + "---##---" + hash);
                    Auths.Save();
                    Credentials.Add(player.UID, new Credential(username.ToLower(), hash));
                    player.MessageFrom("AuthMe",
                                       orange + "You have registered with: " + username + " - " + password +
                                       " (Your console has this info now too.)");
                    player.SendConsoleMessage(orange + "You have registered with: " + username + " - " + password);

                    WaitingUsers.Remove(player.UID);
                    DataStore.GetInstance().Remove("AuthMeLogin", player.UID);
                    uLink.NetworkView.Get(player.PlayerClient.networkView)
                    .RPC("DestroyFreezeAuthMe", player.NetworkPlayer);

                    foreach (var x in RestrictedCommands)
                    {
                        player.UnRestrictCommand(x);
                    }

                    AuthLogger.Log(player.Name + " - " + player.SteamID + " - " + player.IP +
                                   " registered an account: " + username);
                    msgc.ReturnMessage = "ValidRegistration";
                }
            }
        }
Beispiel #22
0
 void EntityHurt(HurtEvent he)
 {
     if (Core.IsEnabled())
     {
         if (!he.AttackerIsPlayer || he.Attacker == null)
         {
             return;
         }
         InstaKOCommand    command  = ChatCommand.GetCommand("instako") as InstaKOCommand;
         InstaKOAllCommand command2 = ChatCommand.GetCommand("instakoall") as InstaKOAllCommand;
         Fougerite.Player  pl       = (Fougerite.Player)he.Attacker;
         if (command != null)
         {
             if (command.IsOn(pl.UID))
             {
                 if (he.Entity != null)
                 {
                     try
                     {
                         if (!he.IsDecay)
                         {
                             he.Entity.Destroy();
                         }
                         else if (Fougerite.Hooks.decayList.Contains(he.Entity))
                         {
                             Fougerite.Hooks.decayList.Remove(he.Entity);
                         }
                     }
                     catch (Exception ex)
                     {
                         Logger.LogDebug("EntityHurt EX: " + ex);
                     }
                 }
                 else
                 {
                     Logger.LogDebug("he.Entity is null!");
                 }
             }
         }
         if (command2 != null)
         {
             if (command2.IsOn(pl.UID))
             {
                 if (he.Entity != null)
                 {
                     var list = he.Entity.GetLinkedStructs();
                     foreach (var x in list)
                     {
                         try
                         {
                             x.Destroy();
                             if (Fougerite.Hooks.decayList.Contains(x))
                             {
                                 Fougerite.Hooks.decayList.Remove(x);
                             }
                         }
                         catch
                         {
                         }
                     }
                     try
                     {
                         he.Entity.Destroy();
                         if (Fougerite.Hooks.decayList.Contains(he.Entity))
                         {
                             Fougerite.Hooks.decayList.Remove(he.Entity);
                         }
                     }
                     catch (Exception ex)
                     {
                         Logger.LogDebug("EntityHurt EX: " + ex);
                     }
                 }
                 else
                 {
                     Logger.LogDebug("he.Entity is null!");
                 }
             }
         }
     }
 }
Beispiel #23
0
 public void OnEntityDeployed2(Player player, Entity entity, Fougerite.Player actualplacer)
 {
     Invoke("On_EntityDeployed", player, entity, actualplacer);
 }
Beispiel #24
0
        public void Connected(RoyaleUser pl)
        {
            string msg = JoinMessage.Replace("{0}", pl.Name);

            server.BroadcastFrom("BattleRoyale", msg);
        }
Beispiel #25
0
 public void OnPlayerConnected(Fougerite.Player pl)
 {
     pl.MessageFrom(Name, "Use [color #e0b0b0]/fps[color white] to increase your FPS!");
 }
Beispiel #26
0
        public void Disconnect(RoyaleUser pl)
        {
            string msg = LeaveMessage.Replace("{0}", pl.Name);

            server.BroadcastFrom("BattleRoyale", msg);
        }
Beispiel #27
0
        private void Hooks_OnConsoleReceived(ref ConsoleSystem.Arg arg, bool external1)
        {
            StringComparison ic          = StringComparison.InvariantCultureIgnoreCase;
            bool             external    = arg.argUser == null;
            bool             adminRights = (arg.argUser != null && arg.argUser.admin) || external;
            string           userid      = "[external][external]";

            if (adminRights && !external)
            {
                userid = string.Format("[{0}][{1}]", arg.argUser.displayName, arg.argUser.userID.ToString());
            }
            string text   = "";
            string text2  = text;
            string logmsg = string.Format("[ConsoleReceived] userid={0} adminRights={1} command={2}.{3} args={4}", userid, adminRights.ToString(), arg.Class, arg.Function, (arg.HasArgs(1) ? arg.ArgsStr : "none"));

            if (arg.Class.Equals("JianxianS", ic) && arg.Function.Equals("users", ic))
            {
                if (adminRights)
                {
                    if (arg.HasArgs(1))
                    {
                        arg.ReplyWith("您多输入了参数了");
                    }
                    else
                    {
                        int num = 0;

                        foreach (uLink.NetworkPlayer networkPlayer in NetCull.connections)
                        {
                            text2 = "[Player]||\n";
                            object localData = networkPlayer.GetLocalData();
                            if (localData is NetUser)
                            {
                                NetUser netUser = (NetUser)localData;
                                text = string.Concat(new object[]
                                {
                                    text2,
                                    netUser.networkPlayer.id,
                                    ":\"",
                                    netUser.displayName,
                                    "\"||\n"
                                });
                                num++;
                            }
                        }
                        text = text + num.ToString() + "users\n";
                        arg.ReplyWith(text);
                    }
                }
            }
            else if (arg.Class.Equals("JianxianS", ic) && arg.Function.Equals("kick", ic))
            {
                if (adminRights)
                {
                    if (arg.HasArgs(1))
                    {
                        global::PlayerClient[] playerClients = arg.GetPlayerClients(0);
                        foreach (global::PlayerClient playerClient in playerClients)
                        {
                            global::NetUser netUser = playerClient.netUser;
                            if (netUser != null)
                            {
                                netUser.Kick(global::NetError.Facepunch_Kick_RCON, true);
                            }
                        }
                        if (playerClients.Length > 0)
                        {
                            arg.ReplyWith("Kicked " + playerClients.Length + " users!");
                            return;
                        }
                        arg.ReplyWith("Couldn't find anyone!");
                    }
                    else
                    {
                        text = "您少输入参数了";
                        arg.ReplyWith(text);
                    }
                }
            }
            else if (arg.Class.Equals("JianxianS", ic) && arg.Function.Equals("money", ic))
            {
                if (adminRights)
                {
                    string[]         args    = arg.Args;
                    Fougerite.Player jogador = Fougerite.Player.FindByName(args[1]);
                    switch (args[0])
                    {
                    case "+qian":
                        if (jogador != null)
                        {
                            int valor = int.Parse(args[2]);
                            Money.AddMoney(jogador, valor);
                            Fougerite.Server.GetServer().Broadcast("[color#99CC]剑客[ " + jogador.Name + " ][color#FF6633] 充值了 [color#99FF]" + valor + " [color#FF6633]斩仙币  -  !尽情的享受购物吧!");
                            arg.ReplyWith("充值成功");
                        }
                        else
                        {
                            arg.ReplyWith("[color#99FF]剑客 " + args[0] + "查无此人!");
                        }
                        break;

                    case "zero":
                        if (jogador != null)
                        {
                            int valor = 0;
                            Money.SetMoney(jogador, valor);
                            arg.ReplyWith("[color#99FF]剑客: " + jogador.Name + " 斩仙币被系统归零!");
                        }
                        else
                        {
                            arg.ReplyWith("[color#99CC]剑客 " + args[0] + "查无此人!");
                        }
                        break;

                    case "-qian":
                        if (jogador != null)
                        {
                            int valor = int.Parse(args[2]);
                            Money.RemoveMoney(jogador, valor);
                            arg.ReplyWith("[color#99FF]剑客" + jogador.Name + "被系统扣除了  " + valor + "  斩仙币");
                        }
                        else
                        {
                            arg.ReplyWith("[color#99FF]剑客 " + args[0] + "沒找到哦");
                        }
                        break;
                    }
                }
            }
        }
Beispiel #28
0
 public void Command(RoyaleUser pl, string cmd, string[] args)
 {
     if (cmd == "battleroyale")
     {
         pl.MessageFrom("BattleRoyale", "[color #bf3eff]************************************************************************************************************");
         pl.MessageFrom("BattleRoyale", "[color #bcee68] BATTLE ROYALE 1 BETA by ice cold ");
         pl.MessageFrom("BattleRoyale", "[color #b4eeb4]1: You spawn on the spawn point of the initial playable area with a torch, bandage and map at sunrise. Find loot as you make your way to the center of the map.");
         pl.MessageFrom("BattleRoyale", "[color #b4eeb4]2: Loot spawns on random places around the map. Supply drops contain rare loot.");
         pl.MessageFrom("BattleRoyale", "[color #b4eeb4]3: You are surviving. Continue moving across the map and remember do not get killed");
         pl.MessageFrom("BattleRoyale", "[color #bf3eff]************************************************************************************************************");
         if (pl.Admin)
         {
             pl.MessageFrom("BattleRoyale", "[color #a4d3ee]/battle_restart = restarts the plugin and teleports all the players to lobby");
             pl.MessageFrom("BattleRoyale", "[color #a4d3ee]/battle_on = enables plugin");
             pl.MessageFrom("BattleRoyale", "[color #a4d3ee]/battle_addlobby = adds the spawn for lobby (required)");
             pl.MessageFrom("BattleRoyale", "[color #a4d3ee]/battle_addspawn = adds the spawn for battle (required)");
             pl.MessageFrom("BattleRoyale", "[color #a4d3ee]/battle_entity = Turns on/off entity mode");
             //   pl.MessageFrom("BattleRoyale", "[color #a4d3ee]/spawn_box1 = adds location for weaponbox");
             //   pl.MessageFrom("BattleRoyale", "[color #a4d3ee]/spawn_box2 = adds location for medicalbox");
             //   pl.MessageFrom("BattleRoyale", "[color #a4d3ee]/spawn_box3 = adds location for junkbox");
             //    pl.MessageFrom("BattleRoyale", "[color #a4d3ee]/spawn_box4 = adds location for SupplyCrate");
             //   pl.MessageFrom("BattleRoyale", "[color #a4d3ee]/spawn_box5 = adds location for AmmoBox");
         }
     }
     else if (cmd == "battle_restarts")
     {
         if (pl.Admin)
         {
             foreach (RoyaleUser player in server.Players)
             {
                 if (ds.ContainsKey("LobbySpawn", "spawn"))
                 {
                     Vector3 lobby = (Vector3)ds.Get("LobbySpawn", "spawn");
                     inroyale.Remove(player.UID);
                     inlobby.Add(player.UID);
                     player.TeleportTo(lobby);
                     //testing if kit works
                     //  GiveLoadout(pl);
                 }
                 else
                 {
                     pl.MessageFrom("ERROR", "[color red]Please make a lobby");
                 }
             }
         }
     }
     else if (cmd == "battle_entity")
     {
         if (pl.Admin)
         {
             if (entitymode.Contains(pl.UID))
             {
                 entitymode.Remove(pl.UID);
                 pl.MessageFrom("BattleRoyale", "EntityMode disabled");
             }
             else
             {
                 entitymode.Add(pl.UID);
                 pl.MessageFrom("BattleRoyale", "Entitymode enabled hit a box to add it");
             }
         }
     }
     else if (cmd == "battle_addlobby")
     {
         if (pl.Admin)
         {
             ds.Add("LobbySpawn", "spawn", pl.Location);
             ds.Save();
             pl.MessageFrom("BattleRoyale", "Lobby spawn has been added");
         }
     }
     else if (cmd == "battle_addspawn")
     {
         if (pl.Admin)
         {
             ds.Add("BattleSpawn", "spawn", pl.Location);
             ds.Save();
             pl.MessageFrom("BattleRoyale", "Master spawn has been added");
         }
     }
 }
Beispiel #29
0
        public HurtEvent(ref DamageEvent d)
        {
            Fougerite.Player player = Fougerite.Player.FindByPlayerClient(d.attacker.client);
            if (player != null)
            {
                this.Attacker = player;
            }
            else
            {
                this.Attacker = new NPC(d.attacker.character);
            }
            Fougerite.Player player2 = Fougerite.Player.FindByPlayerClient(d.victim.client);
            if (player2 != null)
            {
                this.Victim = player2;
            }
            else
            {
                this.Victim = new NPC(d.victim.character);
            }
            this.DamageEvent = d;
            this.WeaponData  = null;
            this.IsDecay     = false;
            string weaponName = "Unknown";

            if (d.extraData != null)
            {
                WeaponImpact extraData = d.extraData as WeaponImpact;
                this.WeaponData = extraData;
                if (extraData.dataBlock != null)
                {
                    weaponName = extraData.dataBlock.name;
                }
            }
            else
            {
                if (d.attacker.id is TimedExplosive)
                {
                    weaponName = "Explosive Charge";
                }
                else if (d.attacker.id is TimedGrenade)
                {
                    weaponName = "F1 Grenade";
                }
                else if (d.attacker.id.ToString().Contains("MutantBear"))
                {
                    weaponName = "Mutant Bear Claw";
                }
                else if (d.attacker.id.ToString().Contains("Bear"))
                {
                    weaponName = "Bear Claw";
                }
                else if (d.attacker.id.ToString().Contains("MutantWolf"))
                {
                    weaponName = "Mutant Wolf Claw";
                }
                else if (d.attacker.id.ToString().Contains("Wolf"))
                {
                    weaponName = "Wolf Claw";
                }
                else if (d.attacker.id.Equals(d.victim.id))
                {
                    weaponName = String.Format("Self ({0})", DamageType);
                }
                else
                {
                    weaponName = "Hunting Bow";
                }
            }
            this.WeaponName = weaponName;
        }
Beispiel #30
0
 void ShowTalker(uLink.NetworkPlayer player, Fougerite.Player p)
 {
 }
Beispiel #31
0
 void DoorUse(Fougerite.Player p, DoorEvent de)
 {
 }
        public void EntityDeployed(Fougerite.Player Player, Fougerite.Entity Entity, Fougerite.Player actualplacer)
        {
            try
            {
                if (Entity != null)
                {
                    if (Entity.Name.Contains("Foundation") || Entity.Name.Contains("Ramp") ||
                        Entity.Name.Contains("Pillar") || Entity.Name == "WoodDoor" || Entity.Name == "MetalDoor")
                    {
                        string name     = Entity.Name;
                        var    location = Entity.Location;
                        if (Ramp && name.Contains("Ramp"))
                        {
                            RaycastHit cachedRaycast;
                            bool       cachedBoolean;
                            Facepunch.MeshBatch.MeshBatchInstance cachedhitInstance;
                            if (Facepunch.MeshBatch.MeshBatchPhysics.Raycast(location + new Vector3(0f, 0.1f, 0f), Vector3Down, out cachedRaycast, out cachedBoolean, out cachedhitInstance))
                            {
                                if (cachedhitInstance != null)
                                {
                                    var cachedComponent = cachedhitInstance.physicalColliderReferenceOnly.GetComponent <StructureComponent>();
                                    if (cachedComponent.type == StructureComponent.StructureComponentType.Foundation || cachedComponent.type == StructureComponent.StructureComponentType.Ceiling)
                                    {
                                        var weight = cachedComponent._master._weightOnMe;
                                        int ramps  = 0;
                                        if (weight != null && weight.ContainsKey(cachedComponent))
                                        {
                                            ramps += weight[cachedComponent].Count(structure => structure.type == StructureComponent.StructureComponentType.Ramp);
                                        }
                                        if (ramps > 1)
                                        {
                                            Entity.Destroy();
                                            if (GiveBack && actualplacer.IsOnline)
                                            {
                                                switch (name)
                                                {
                                                case "WoodFoundation":
                                                    name = "Wood Foundation";
                                                    break;

                                                case "MetalFoundation":
                                                    name = "Metal Foundation";
                                                    break;

                                                case "WoodRamp":
                                                    name = "Wood Ramp";
                                                    break;

                                                case "MetalRamp":
                                                    name = "Metal Ramp";
                                                    break;

                                                case "WoodPillar":
                                                    name = "Wood Pillar";
                                                    break;

                                                case "MetalPillar":
                                                    name = "Metal Pillar";
                                                    break;
                                                }
                                                actualplacer.Inventory.AddItem(name, 1);
                                            }
                                            return;
                                        }
                                    }
                                }
                            }
                        }
                        if (Struct)
                        {
                            bool  isdoor = false;
                            float d      = 4.5f;
                            if (name.Contains("Pillar"))
                            {
                                d = 0.40f;
                            }
                            else if (name.Contains("Door"))
                            {
                                isdoor = true;
                                d      = 0.40f;
                            }
                            else if (name.ToLower().Contains("smallstash"))
                            {
                                d = 0.40f;
                            }
                            else if (name.Contains("Foundation"))
                            {
                                d = 4.5f;
                            }
                            else if (name.Contains("Ramp"))
                            {
                                if (!CheckForRampLoot)
                                {
                                    return;
                                }
                                d = 3.5f;
                            }
                            var x = Physics.OverlapSphere(location, d);
                            if (
                                x.Any(
                                    l =>
                                    l.name.ToLower().Contains("woodbox") || l.name.ToLower().Contains("smallstash") ||
                                    (l.name.ToLower().Contains("door") && !isdoor)))
                            {
                                Entity.Destroy();
                                if (actualplacer.IsOnline && GiveBack)
                                {
                                    switch (name)
                                    {
                                    case "WoodFoundation":
                                        name = "Wood Foundation";
                                        break;

                                    case "MetalFoundation":
                                        name = "Metal Foundation";
                                        break;

                                    case "WoodRamp":
                                        name = "Wood Ramp";
                                        break;

                                    case "MetalRamp":
                                        name = "Metal Ramp";
                                        break;

                                    case "WoodPillar":
                                        name = "Wood Pillar";
                                        break;

                                    case "MetalPillar":
                                        name = "Metal Pillar";
                                        break;

                                    case "WoodDoor":
                                        name = "Wood Door";
                                        break;

                                    case "MetalDoor":
                                        name = "Metal Door";
                                        break;
                                    }
                                    actualplacer.Inventory.AddItem(name, 1);
                                }
                                return;
                            }
                        }
                        if (BarricadePillar)
                        {
                            if (name.Contains("Pillar"))
                            {
                                if (Physics.OverlapSphere(location, 0.34f).Where(collider => collider.GetComponent <DeployableObject>() != null).Any(collider => collider.GetComponent <DeployableObject>().name.Contains("Barricade_Fence")))
                                {
                                    actualplacer.Message("Pillar Barricade glitching no esta permitido!");
                                    Entity.Destroy();
                                    if (actualplacer.IsOnline && GiveBack)
                                    {
                                        switch (name)
                                        {
                                        case "WoodPillar":
                                            name = "Wood Pillar";
                                            break;

                                        case "MetalPillar":
                                            name = "Metal Pillar";
                                            break;
                                        }
                                        actualplacer.Inventory.AddItem(name, 1);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.LogDebug("[GlitchFix] Some error showed up. Report this. " + ex);
            }
        }
Beispiel #33
0
 void PlayerConnect(Fougerite.Player player)
 {
 }
Beispiel #34
0
        public void OnCommand(Fougerite.Player player, string cmd, string[] args)
        {
            if (player.Admin || player.Moderator)
            {
                if (cmd == "ahelp")
                {
                    player.MessageFrom(Name, "[color #42b3f5]/duty /unduty /warn /delwarn /hp ");
                    player.MessageFrom(Name, "[color #42b3f5]/mtp /mtpback /ann /wipebar /wipeshelt  ");
                    player.MessageFrom(Name, "[color #42b3f5]/kick /ban /unban /rbban /rbunban /unbanip /mute /unmute  ");
                    return;
                }
                if (cmd == "duty")
                {
                    if (!DataStore.GetInstance().ContainsKey("AdminDuty", player.SteamID))
                    {
                        DataStore.GetInstance().Add("AdminDuty", player.SteamID, 0);
                        player.Inventory.ClearArmor();
                        player.Inventory.AddItemTo("Invisible Helmet", 36, 1);
                        player.Inventory.AddItemTo("Invisible Vest", 37, 1);
                        player.Inventory.AddItemTo("Invisible Pants", 38, 1);
                        player.Inventory.AddItemTo("Invisible Boots", 39, 1);
                        player.Inventory.AddItem("Uber Hatchet", 1);
                        Server.GetServer().BroadcastFrom(Name, "[color #42b3f5]Admin [color #f5e042]" + player.Name + " [color #42b3f5]is now [color #45f542]On Duty!");
                    }
                    else
                    {
                        player.MessageFrom(Name, "[color #42b3f5]You are already OnDuty!!!");
                    }
                }
                if (cmd == "unduty")
                {
                    if (DataStore.GetInstance().ContainsKey("AdminDuty", player.SteamID))
                    {
                        DataStore.GetInstance().Remove("AdminDuty", player.SteamID);
                        player.Inventory.ClearArmor();
                        player.Inventory.RemoveItem("Invisible Helmet", 1);
                        player.Inventory.RemoveItem("Invisible Vest", 1);
                        player.Inventory.RemoveItem("Invisible Pants", 1);
                        player.Inventory.RemoveItem("Invisible Boots", 1);
                        player.Inventory.RemoveItem("Uber Hatchet", 1);
                        Server.GetServer().BroadcastFrom(Name, "[color #42b3f5]Admin [color #f5e042]" + player.Name + " [color #42b3f5]is now [color #f55142]Off Duty!");
                    }
                    else
                    {
                        player.MessageFrom(Name, "[color #42b3f5]You are [color #f55142]not [color #42b3f5]On Duty!!!");
                    }
                }
                if (cmd == "warn")
                {
                    if (args.Length == 0)
                    {
                        player.MessageFrom(Name, "[color #f55142]Syntax:[color #42b3f5] /warn PlayerName");
                        return;
                    }
                    else
                    {
                        Fougerite.Player playertor = FindSimilarPlayer(player, args);
                        if (playertor == null)
                        {
                            return;
                        }

                        if (!DataStore.GetInstance().ContainsKey("warn", playertor.SteamID))
                        {
                            DataStore.GetInstance().Add("warn", playertor.SteamID, 0);
                            Server.GetServer().Broadcast("[color #42b3f5]Admin/Mod [color #f5e042]" + player.Name + "[color #42b3f5] Warned [color #f5e042] " + playertor.Name + "![color #f5e042](1/2)");
                            string logtext = player.Name + " Warned " + playertor.Name + "!(1/2)";
                            Log(logtext, "Warn");
                            return;
                        }
                        else
                        {
                            DataStore.GetInstance().Remove("warn", playertor.SteamID);
                            Server.GetServer().Broadcast("[color #42b3f5]Admin/Mod [color #f5e042]" + player.Name + "[color #42b3f5] Warned[color #f5e042] " + playertor.Name + "![color red]Kicked (2/2)");
                            string logtext = player.Name + " Warned " + playertor.Name + "!Kicked (2/2)";
                            Log(logtext, "Warn");
                            playertor.Disconnect();
                        }
                    }
                }
                if (cmd == "delwarn")
                {
                    if (args.Length == 0)
                    {
                        player.MessageFrom(Name, "[color #f55142]Syntax:[color #42b3f5] /delwarn PlayerName");
                        return;
                    }
                    else
                    {
                        Fougerite.Player playertor = FindSimilarPlayer(player, args);
                        if (playertor == null)
                        {
                            return;
                        }
                        if (DataStore.GetInstance().ContainsKey("warn", playertor.SteamID))
                        {
                            DataStore.GetInstance().Remove("warn", playertor.SteamID);
                            Server.GetServer().Broadcast("[color #42b3f5]Admin/Mod [color #f5e042]" + player.Name + " [color #42b3f5]Deleted [color #f5e042] " + playertor.Name + " [color #42b3f5]Warns![color #f5e042](0/2)");
                            string logtext = player.Name + " Deleted " + playertor.Name + " Warns!";
                            Log(logtext, "DeleteWarn");
                            return;
                        }
                        else
                        {
                            player.MessageFrom(Name, "[color #42b3f5]This Player [color #f55142]Doesn't [color #42b3f5]have any Warn!");
                            return;
                        }
                    }
                }
                if (cmd == "hp")
                {
                    if (args.Length == 0)
                    {
                        player.MessageFrom(Name, "[color #f55142]Syntax:[color #42b3f5] /hp PlayerName");
                        return;
                    }
                    else
                    {
                        Fougerite.Player playertor = FindSimilarPlayer(player, args);
                        if (playertor == null)
                        {
                            return;
                        }
                        player.MessageFrom(Name, playertor.Name + " HP : " + playertor.Health);
                        string logtext = player.Name + " Used /HP On " + playertor.Name + "";
                        Log(logtext, "HP");
                    }
                }
                if (cmd == "mtp")
                {
                    if (args.Length == 0)
                    {
                        player.MessageFrom(Name, "[color #f55142]Syntax:[color #42b3f5] /mtp PlayerName");
                        return;
                    }
                    else
                    {
                        if (DataStore.GetInstance().ContainsKey("AdminDuty", player.SteamID))
                        {
                            Fougerite.Player playertor = FindSimilarPlayer(player, args);
                            if (playertor == null)
                            {
                                return;
                            }
                            if (playertor.Moderator)
                            {
                                player.MessageFrom("AntiAbuse", "[color #42b3f5]You [color #f55142]Can't [color #42b3f5]Teleport to another Mods!");
                                return;
                            }
                            RecuperaListaDeClanes();
                            if (SonDeElMismoClan(player.SteamID, GetClanName(playertor.SteamID)))
                            {
                                player.MessageFrom("AntiAbuse", "[color #42b3f5]You [color #f55142]Can't [color #42b3f5]Teleport to your Clanmates!");
                                return;
                            }
                            if (!DataStore.GetInstance().ContainsKey("ModeratorLastLoc", player.UID))
                            {
                                DataStore.GetInstance().Add("ModeratorLastLoc", player.UID, player.Location.ToString());
                            }
                            player.TeleportTo(playertor, 1.5f, false);
                            player.Notice("You have Teleported to " + playertor.Name + "");
                            player.InventoryNotice("Checkpoint Saved!");
                            playertor.Notice("Admin " + player.Name + " Teleported to You!");
                            string logtext = player.Name + " Teleported To " + playertor.Name + " !LOC: " + playertor.X + " " + playertor.Y + " " + playertor.Z + " ";
                            Log(logtext, "Teleports");
                        }
                        else
                        {
                            player.MessageFrom(Name, "[color #42b3f5]You are [color #f55142]not [color #42b3f5]OnDuty!!!");
                        }
                    }
                }
                if (cmd == "mtpback")
                {
                    if (DataStore.GetInstance().ContainsKey("ModeratorLastLoc", player.UID) && !DataStore.GetInstance().ContainsKey("HGIG", player.UID))
                    {
                        var location = StringToVector3(DataStore.GetInstance().Get("ModeratorLastLoc", player.UID).ToString());
                        player.SafeTeleportTo(location, false);
                        DataStore.GetInstance().Remove("ModeratorLastLoc", player.UID);
                        player.Notice("You Teleported Back to your Checkpoint!");
                        string logtext = "Admin " + player.Name + " Teleported to his Checkpoint!";
                        Log(logtext, "Teleports");
                    }
                    else
                    {
                        player.Notice("You Don't have any save Checkpoint or You Are in HungerGame!");
                    }
                }
                if (cmd == "ann")
                {
                    if (args.Length == 0)
                    {
                        player.MessageFrom(Name, "[color #f55142]Syntax:[color #42b3f5] /ann TEXT");
                    }
                    else
                    {
                        Server.GetServer().BroadcastNotice(string.Join(" ", args));
                        string logtext = player.Name + " /ann ==> : " + string.Join(" ", args);
                        Log(logtext, "Announce");
                    }
                }
                if (cmd == "wipeshelt")
                {
                    int c = 0;
                    foreach (var x in World.GetWorld().Entities)
                    {
                        if (x.Name.ToLower().Contains("shelter"))
                        {
                            x.Destroy();
                            c++;
                        }
                    }
                    Server.GetServer().BroadcastFrom("AntiLag", "[color #42b3f5]Admin/Mod [color #f5e042]" + player.Name + " [color #42b3f5]Deleted [color red] " + c + " [color #42b3f5]Shelters");
                    string logtext = player.Name + " Deleted " + c + " Shelters";
                    Log(logtext, "Shelter");
                }
                if (cmd == "wipebar")
                {
                    int c = 0;
                    foreach (var x in World.GetWorld().Entities)
                    {
                        if (x.Name.ToLower().Contains("barricade"))
                        {
                            x.Destroy();
                            c++;
                        }
                    }
                    Server.GetServer().BroadcastFrom("AntiLag", "[color #42b3f5]Admin/Mod [color #f5e042]" + player.Name + " [color #42b3f5]Deleted [color red] " + c + " [color #42b3f5]Barricades");
                    string logtext = player.Name + " Deleted " + c + " Barricades";
                    Log(logtext, "Barricade");
                }
            }
        }
Beispiel #35
0
 public void OnCommand(Fougerite.Player player, string command, string[] args)
 {
     this.Invoke("On_Command", new object[] { player, command, args });
 }
Beispiel #36
0
        public Fougerite.Player FindSimilarPlayer(Fougerite.Player Sender, object args)
        {
            int count = 0;

            Fougerite.Player Similar       = null;
            string           printablename = "";

            if (args as string[] != null)
            {
                string[] array = args as string[];
                printablename = string.Join(" ", array);
                var player = GetPlayerByName(printablename);
                if (player != null)
                {
                    return(player);
                }

                foreach (var x in Server.GetServer().Players)
                {
                    foreach (var namepart in array)
                    {
                        if (x.Name.ToLower().Contains(namepart.ToLower()))
                        {
                            Similar = x;
                            count++;
                        }
                    }
                }
            }
            else
            {
                string name = ((string)args).ToLower();
                printablename = name;
                var player = GetPlayerByName(name);
                if (player != null)
                {
                    return(player);
                }

                foreach (var x in Server.GetServer().Players)
                {
                    if (x.Name.ToLower().Contains(name))
                    {
                        Similar = x;
                        count++;
                    }
                }
            }

            if (count == 0)
            {
                Sender.MessageFrom(Name, "Couldn't find [color#00FF00]" + printablename + "[/color]!");
            }
            else if (count > 1)
            {
                Sender.MessageFrom(Name, "Found [color#FF0000]" + count
                                   + "[/color] players with similar name. [color#FF0000] Use more correct name![/color]");
            }
            else
            {
                return(Similar);
            }

            return(null);
        }
Beispiel #37
0
 public void OnPlayerDisconnected(Fougerite.Player player)
 {
     this.Invoke("On_PlayerDisconnected", new object[] { player });
 }
Beispiel #38
0
        public HurtEvent(ref DamageEvent d)
        {
            //Logger.LogDebug(string.Format("[DamageEvent] {0}", d.ToString()));
            try
            {
                this._sleeper    = false;
                this.DamageEvent = d;
                this.WeaponData  = null;
                this.IsDecay     = false;
                this._status     = d.status;
                string weaponName = "Unknown";
                if (d.victim.idMain is DeployableObject)
                {
                    if (d.victim.id.ToString().ToLower().Contains("sleeping"))
                    {
                        this._sleeper = true;
                        DeployableObject sleeper = d.victim.idMain as DeployableObject;
                        this.Victim = new Sleeper(sleeper);
                    }
                    else
                    {
                        this.Victim = new Entity(d.victim.idMain.GetComponent <DeployableObject>());
                    }
                    this._playervictim = false;
                }
                else if (d.victim.idMain is StructureComponent)
                {
                    this.Victim        = new Entity(d.victim.idMain.GetComponent <StructureComponent>());
                    this._playervictim = false;
                }
                else if (d.victim.id is SpikeWall)
                {
                    this._playerattacker = false;
                    this.Victim          = new Entity(d.victim.idMain.GetComponent <DeployableObject>());
                }
                else if (d.victim.client != null)
                {
                    this.Victim        = Fougerite.Server.Cache[d.victim.client.userID];
                    this._playervictim = true;
                }
                else if (d.victim.character != null)
                {
                    this.Victim        = new NPC(d.victim.character);
                    this._playervictim = false;
                }
                if (!(bool)d.attacker.id)
                {
                    if (d.victim.client != null)
                    {
                        weaponName           = this.DamageType;
                        this._playerattacker = false;
                        this.Attacker        = null;
                    }
                }
                else if (d.attacker.id is SpikeWall)
                {
                    this._playerattacker = false;
                    this.Attacker        = new Entity(d.attacker.idMain.GetComponent <DeployableObject>());
                    weaponName           = d.attacker.id.ToString().Contains("Large") ? "Large Spike Wall" : "Spike Wall";
                }
                else if (d.attacker.id is SupplyCrate)
                {
                    this._playerattacker = false;
                    this.Attacker        = new Entity(d.attacker.idMain.gameObject);
                    weaponName           = "Supply Crate";
                }
                else if (d.attacker.id is Metabolism && d.victim.id is Metabolism)
                {
                    //this.Attacker = Fougerite.Server.Cache[d.attacker.client.userID];
                    this.Attacker        = Fougerite.Player.FindByPlayerClient(d.attacker.client);
                    this._playerattacker = false;
                    this.Victim          = this.Attacker;
                    ICollection <string> list = new List <string>();
                    Fougerite.Player     vic  = this.Victim as Fougerite.Player;
                    if (vic.IsStarving)
                    {
                        list.Add("Starvation");
                    }
                    if (vic.IsRadPoisoned)
                    {
                        list.Add("Radiation");

                        /*if (vic.RadLevel > 5000)
                         * {
                         *  vic.AddRads(-vic.RadLevel);
                         *  d.amount = 0;
                         *  _de.amount = 0;
                         *  Logger.LogDebug("[RadiationHack] Someone tried to kill " + vic.Name + " with radiation hacks.");
                         * }*/
                    }
                    if (vic.IsPoisoned)
                    {
                        list.Add("Poison");
                    }
                    if (vic.IsBleeding)
                    {
                        list.Add("Bleeding");
                    }

                    if (list.Contains("Bleeding"))
                    {
                        if (this.DamageType != "Unknown" && !list.Contains(this.DamageType))
                        {
                            list.Add(this.DamageType);
                        }
                    }
                    if (list.Count > 0)
                    {
                        weaponName = string.Format("Self ({0})", string.Join(",", list.ToArray()));
                    }
                    else
                    {
                        weaponName = this.DamageType;
                    }
                }
                else if (d.attacker.client != null)
                {
                    this.Attacker        = Fougerite.Server.Cache[d.attacker.client.userID];
                    this._playerattacker = true;
                    if (d.extraData != null)
                    {
                        WeaponImpact extraData = d.extraData as WeaponImpact;
                        this.WeaponData = extraData;
                        if (extraData.dataBlock != null)
                        {
                            weaponName = extraData.dataBlock.name;
                        }
                    }
                    else
                    {
                        if (d.attacker.id is TimedExplosive)
                        {
                            weaponName = "Explosive Charge";
                        }
                        else if (d.attacker.id is TimedGrenade)
                        {
                            weaponName = "F1 Grenade";
                        }
                        else
                        {
                            weaponName = "Hunting Bow";
                        }
                        if (d.victim.client != null)
                        {
                            if (!d.attacker.IsDifferentPlayer(d.victim.client) && !(this.Victim is Entity))
                            {
                                weaponName = "Fall Damage";
                            }
                            else if (!d.attacker.IsDifferentPlayer(d.victim.client) && (this.Victim is Entity))
                            {
                                weaponName = "Hunting Bow";
                            }
                        }
                    }
                }
                else if (d.attacker.character != null)
                {
                    this.Attacker        = new NPC(d.attacker.character);
                    this._playerattacker = false;
                    weaponName           = string.Format("{0} Claw", (this.Attacker as NPC).Name);
                }
                this.WeaponName = weaponName;
            }
            catch (Exception ex)
            {
                Logger.LogDebug(string.Format("[HurtEvent] Error. " + ex.ToString()));
            }
        }
Beispiel #39
0
 public void UnbanPlayer(PList.Player unban, Fougerite.Player myAdmin)
 {
     Core.blackList.Remove(unban.UserID);
     Administrator.NotifyAdmins(string.Format("{0} fue desbaneado por {1}.", unban.DisplayName, myAdmin.Name));
 }
Beispiel #40
0
        void ChatReceived(ref ConsoleSystem.Arg arg)
        {
            string str = Facepunch.Utility.String.QuoteSafe(arg.GetString(0, "text"));
            Fougerite.Player p = new Fougerite.Player(arg.argUser.playerClient);

            var command = ChatCommand.GetCommand("tpto") as TeleportToCommand;
            if (command.GetTPWaitList().Contains(p.PlayerClient.userID))
            {
                int num;
                if (int.TryParse(str, out num)) command.PartialNameTP(p, num);
                else
                {
                    Util.sayUser(p.PlayerClient.netPlayer, Core.Name, "Invalid Choice!");
                    command.GetTPWaitList().Remove(p.PlayerClient.userID);
                }
                arg = null;
            }
            else if (Core.banWaitList.Contains(p.PlayerClient.userID))
            {
                int num2;
                if (int.TryParse(str, out num2))
                {
                    (ChatCommand.GetCommand("ban") as BanCommand).PartialNameBan(p, num2);
                }
                else
                {
                    Util.sayUser(p.PlayerClient.netPlayer, Core.Name, "Invalid Choice!");
                    Core.banWaitList.Remove(p.PlayerClient.userID);
                }
                arg = null;
            }
            else if (Core.kickWaitList.Contains(p.PlayerClient.userID))
            {
                int num3;
                if (int.TryParse(str, out num3))
                {
                    (ChatCommand.GetCommand("kick") as KickCommand).PartialNameKick(p, num3);
                }
                else
                {
                    Util.sayUser(p.PlayerClient.netPlayer, Core.Name, "Invalid Choice!");
                    Core.kickWaitList.Remove(p.PlayerClient.userID);
                }
                arg = null;
            }

            if (Core.IsEnabled() && Core.muteList.Contains(p.PlayerClient.netUser.userID)) // p.PlayerClient.userID
            {
                arg = null;
                Util.sayUser(p.PlayerClient.netPlayer, Core.Name, "You are muted.");
            }
        }