Exemplo n.º 1
0
        private bool ShouldSend(PlaceSendMessage b, Point3D p)
        {
            if (b.SendCount > 15)
            {
                return(false);
            }
            if (b.NoChecks)
            {
                return(true);
            }
            if (this._room.AccessRight < AccessRight.Edit)
            {
                return(false);
            }

            // TODO: Count blocks
            var isAdministrator = this._connectionManager.PlayerObject.IsAdministrator;
            var isClubMember    = this._connectionManager.PlayerObject.ClubMember;

            if (!WorldUtils.IsPlaceable(b, this._world, !isAdministrator))
            {
                return(false);
            }
            if (!this._connectionManager.ShopData.HasBlock(b.Id, 0, isClubMember, isAdministrator))
            {
                return(false);
            }

            CheckHandle handle;

            return(!(this._sentLocations.TryGetValue(p, out handle)
                ? WorldUtils.AreSame(b, handle.Message)
                : WorldUtils.IsAlreadyPlaced(b, this._world)));
        }
Exemplo n.º 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)));
        }