Exemplo n.º 1
0
        private void OnPlayerUpdate(object sender, GetDataHandlers.PlayerUpdateEventArgs args)
        {
            TSPlayer tsplayer = TShock.Players[args.PlayerId];

            if (tsplayer == null)
            {
                return;
            }
            BTPlayer player = BTPlayers[args.PlayerId];

            if (player == null)
            {
                return;
            }
            if ((args.Control & 32) == 32)
            {
                try
                {
                    var BT = player.GetBindTool(Main.player[args.PlayerId].inventory[args.Item]);
                    if (BT != null)
                    {
                        BT.DoCommand(tsplayer);
                    }
                }
                catch (Exception ex)
                {
                    TShock.Log.ConsoleError(ex.ToString());
                }
            }
        }
Exemplo n.º 2
0
        private void OnPlayerUpdate(object sender, GetDataHandlers.PlayerUpdateEventArgs args)
        {
            BTPlayer player = BTPlayers[args.PlayerId];

            if ((player == null) || (player.tsPlayer == null) ||
                ((player.bindTools.Count == 0) && (GlobalBinds.Count == 0)))
            {
                return;
            }
            if ((args.Control & 32) == 32)
            {
                try
                {
                    Item Selected = Main.player[args.PlayerId].inventory[args.Item];
                    var  GB       = BTExtensions.GetGlobalBind(Selected, args.Item);
                    var  BT       = player.GetBindTool(Selected, args.Item);

                    if ((GB.Name != null) && (player.tsPlayer.HasPermission(GB.Permission)) && (BT == null))
                    {
                        GB.DoCommand(player.tsPlayer);
                    }

                    else if (BT != null)
                    {
                        BT.DoCommand(player.tsPlayer);
                    }
                }
                catch (Exception ex) { TShock.Log.ConsoleError(ex.ToString()); }
            }
        }
Exemplo n.º 3
0
        private void OnPlayerUpdate(object sender, GetDataHandlers.PlayerUpdateEventArgs args)
        {
            BTPlayer player = BTPlayers[args.PlayerId];

            if ((player == null) || (player.TSPlayer == null))
            {
                return;
            }
            if ((args.Control & 32) == 32)
            {
                try
                {
                    Item Selected = Main.player[args.PlayerId].inventory[args.Item];
                    var  BT       = player.GetBindTool(Selected, args.Item);
                    if ((BT != null) && ((BT.slot == -1) || (BT.slot == player.TSPlayer.TPlayer.selectedItem)) && ((BT.prefix == -1) || (BT.prefix == Selected.prefix)))
                    {
                        BT.DoCommand(player.TSPlayer);
                    }
                }
                catch (Exception ex) { TShock.Log.ConsoleError(ex.ToString()); }
            }
        }