Пример #1
0
        private void On(CoinEvent e)
        {
            var p = e.Player;

            p.GoldCoins = e.GoldCoins;
            p.BlueCoins = e.BlueCoins;

            var x      = (int)e.X;
            var y      = (int)e.Y;
            var blocks = Blocks.Of(this.BotBits);

            if (!blocks.Area.Contains(new Point(x, y)))
            {
                return;
            }
            var block = blocks.Foreground[x, y].Block.Id;

            switch (block)
            {
            case Foreground.Coin.Gold:
                p.AddGoldCoin(new Point(x, y));
                new GoldCoinEvent(p, e.GoldCoins, x, y)
                .RaiseIn(this.BotBits);
                break;

            case Foreground.Coin.Blue:
                p.AddBlueCoin(new Point(x, y));
                new BlueCoinEvent(p, e.BlueCoins, x, y)
                .RaiseIn(this.BotBits);
                break;
            }
        }
Пример #2
0
        private bool ShouldSend(PlaceSendMessage b, Point3D p)
        {
            if (b.SendCount > 10)
            {
                return(false);
            }
            if (b.NoChecks)
            {
                return(true);
            }
            if (!Actions.Of(this.BotBits).CanEdit)
            {
                return(false);
            }

            var playerData      = ConnectionManager.Of(this.BotBits).PlayerData;
            var blocks          = Blocks.Of(this.BotBits);
            var isAdministrator = playerData.PlayerObject.IsAdministrator;

            if (!WorldUtils.IsPlaceable(b, blocks, !isAdministrator))
            {
                return(false);
            }
            if (!playerData.HasBlock(b.Id))
            {
                return(false);
            }

            CheckHandle handle;

            return(!(this._sentLocations.TryGetValue(p, out handle)
                ? WorldUtils.AreSame(b, handle.Message)
                : WorldUtils.IsAlreadyPlaced(b, blocks)));
        }
Пример #3
0
 private void BlockChecker_InitializeFinish(object sender, EventArgs e)
 {
     this._connectionManager = ConnectionManager.Of(this.BotBits);
     this._room                  = Room.Of(this.BotBits);
     this._world                 = Blocks.Of(this.BotBits);
     this._messageQueue          = PlaceSendMessage.Of(this.BotBits);
     this._messageQueue.Sending += this.OnSendingPlace;
     this._messageQueue.Send    += this.OnSendPlace;
 }