示例#1
0
 private void OnCheckValid(ValidateAuthTicketResponse_t callback, ref bool isValid)
 {
     if (isValid)
     {
         isValid = UnturnedPermissions.CheckValid(callback);
     }
 }
示例#2
0
        private void bindDelegates()
        {
            CommandWindow.onCommandWindowInputted += (string text, ref bool shouldExecuteCommand) =>
            {
                if (text.StartsWith("/"))
                {
                    text.Substring(1);
                }
                if (R.Commands != null)
                {
                    R.Commands.Execute(new ConsolePlayer(), text);
                }
                shouldExecuteCommand = false;
            };

            CommandWindow.onCommandWindowOutputted += (object text, ConsoleColor color) =>
            {
                /* Message dupe at logs */

                //Core.Logging.Logger.ExternalLog(text, color);
            };

            /*
             * SteamChannel.onTriggerReceive += (SteamChannel channel, CSteamID steamID, byte[] packet, int offset, int size) =>
             * {
             *   UnturnedPlayerEvents.TriggerReceive(channel, steamID, packet, offset, size);
             * };
             */

            SteamChannel.onTriggerSend += (SteamPlayer player, string name, ESteamCall mode, ESteamPacket type, object[] arguments) =>
            {
                UnturnedPlayerEvents.TriggerSend(player, name, mode, type, arguments);
            };

            ChatManager.onCheckPermissions += (SteamPlayer player, string text, ref bool shouldExecuteCommand, ref bool shouldList) =>
            {
                if (text.StartsWith("/"))
                {
                    text.Substring(1);
                    if (R.Commands != null && UnturnedPermissions.CheckPermissions(player, text))
                    {
                        R.Commands.Execute(UnturnedPlayer.FromSteamPlayer(player), text);
                    }
                    shouldList = false;
                }
                shouldExecuteCommand = false;
            };

            Provider.onCheckValid += (ValidateAuthTicketResponse_t callback, ref bool isValid) =>
            {
                if (isValid)
                {
                    isValid = UnturnedPermissions.CheckValid(callback);
                }
            };
        }
示例#3
0
        private void bindDelegates()
        {
            CommandWindow.onCommandWindowInputted += (string text, ref bool shouldExecuteCommand) =>
            {
                if (text.StartsWith("/"))
                {
                    text.Substring(1);
                }
                if (R.Commands != null)
                {
                    R.Commands.Execute(new ConsolePlayer(), text);
                }
                shouldExecuteCommand = false;
            };

            CommandWindow.onCommandWindowOutputted += (object text, ConsoleColor color) =>
            {
                Core.Logging.Logger.ExternalLog(text, color);
            };

            /*
             * SteamChannel.onTriggerReceive += (SteamChannel channel, CSteamID steamID, byte[] packet, int offset, int size) =>
             * {
             *   UnturnedPlayerEvents.TriggerReceive(channel, steamID, packet, offset, size);
             * };
             */

            // Replacements for Rocket usage of onTriggerSend:
            SDG.Unturned.Player.onPlayerStatIncremented += UnturnedPlayerEvents.InternalOnPlayerStatIncremented;
            PlayerClothing.OnShirtChanged_Global        += UnturnedPlayerEvents.InternalOnShirtChanged;
            PlayerClothing.OnPantsChanged_Global        += UnturnedPlayerEvents.InternalOnPantsChanged;
            PlayerClothing.OnHatChanged_Global          += UnturnedPlayerEvents.InternalOnHatChanged;
            PlayerClothing.OnBackpackChanged_Global     += UnturnedPlayerEvents.InternalOnBackpackChanged;
            PlayerClothing.OnVestChanged_Global         += UnturnedPlayerEvents.InternalOnVestChanged;
            PlayerClothing.OnMaskChanged_Global         += UnturnedPlayerEvents.InternalOnMaskChanged;
            PlayerClothing.OnGlassesChanged_Global      += UnturnedPlayerEvents.InternalOnGlassesChanged;
            PlayerAnimator.OnGestureChanged_Global      += UnturnedPlayerEvents.InternalOnGestureChanged;
            PlayerLife.OnTellHealth_Global          += UnturnedPlayerEvents.InternalOnTellHealth;
            PlayerLife.OnTellFood_Global            += UnturnedPlayerEvents.InternalOnTellFood;
            PlayerLife.OnTellWater_Global           += UnturnedPlayerEvents.InternalOnTellWater;
            PlayerLife.OnTellVirus_Global           += UnturnedPlayerEvents.InternalOnTellVirus;
            PlayerLife.OnTellBleeding_Global        += UnturnedPlayerEvents.InternalOnTellBleeding;
            PlayerLife.OnTellBroken_Global          += UnturnedPlayerEvents.InternalOnTellBroken;
            PlayerLife.OnRevived_Global             += UnturnedPlayerEvents.InternalOnRevived;
            PlayerLife.RocketLegacyOnDeath          += UnturnedPlayerEvents.InternalOnPlayerDeath;
            PlayerLife.onPlayerDied                 += UnturnedPlayerEvents.InternalOnPlayerDied;
            PlayerSkills.OnExperienceChanged_Global += UnturnedPlayerEvents.InternalOnExperienceChanged;
            PlayerStance.OnStanceChanged_Global     += UnturnedPlayerEvents.InternalOnStanceChanged;

            ChatManager.onCheckPermissions += (SteamPlayer player, string text, ref bool shouldExecuteCommand, ref bool shouldList) =>
            {
                if (text.StartsWith("/"))
                {
                    text.Substring(1);
                    if (R.Commands != null && UnturnedPermissions.CheckPermissions(player, text))
                    {
                        R.Commands.Execute(UnturnedPlayer.FromSteamPlayer(player), text);
                    }
                    shouldList = false;
                }
                shouldExecuteCommand = false;
            };

            Provider.onCheckValidWithExplanation += (ValidateAuthTicketResponse_t callback, ref bool isValid, ref string explanation) =>
            {
                if (isValid)
                {
                    isValid = UnturnedPermissions.CheckValid(callback);
                }
            };
        }
示例#4
0
 public static bool CheckValid(ValidateAuthTicketResponse_t r)
 {
     return(UnturnedPermissions.CheckValid(r));
 }