Example #1
0
 public static IHumbleStream Create(
     Framing framing, 
     TcpClient tcpClient, 
     string delimiter)
 {
     return framing == Framing.LengthPrefixed ?
         (IHumbleStream)new FixedLengthStream(tcpClient) :
         new DelimitedStream(tcpClient, delimiter);
 }
Example #2
0
        public Session NewSession(HumbleServer humbleServer, TcpClient client, Framing framing, string delimiter)
        {
            var session = new Session(this, humbleServer, client, framing, delimiter);

            lock (_locker)
            {
                _sessions.Add(session);
            }

            return session;
        }
Example #3
0
 /// <summary>
 /// Create a instance of HumbleClient
 /// </summary>
 /// <param name="framing">Type of framing</param>
 /// <param name="delimiter">Demiliter character if framing is Framing.LengthPrefixed</param>
 /// <param name="receiveTimeOut">Receive timeout in miliseconds</param>
 /// <param name="sendTimeOut">Send timeout in miliseconds</param>
 public HumbleClient(
     Framing framing = Framing.LengthPrefixed, 
     string delimiter = MessageFraming.DefaultDelimiter,
     int receiveTimeOut = -1,
     int sendTimeOut = -1)
 {
     _framing = framing;
     _delimiter = delimiter;
     ReceiveTimeOut = receiveTimeOut;
     SendTimeOut = sendTimeOut;
 }
Example #4
0
        public void GenerateGohanStructureWithByteArrays(bool isFirstPass)
        {
            if (!isGohanHouseOffsetSet)
            {
                gohanHouseStartPositionY -= _gohanHouseTiles.GetLength(0);
                isGohanHouseOffsetSet     = true;
            }

            // if we're here it means we are ready to generate our structure

            // tiles
            for (var x = 0; x < _gohanHouseTiles.GetLength(1); x++)
            {
                for (var y = 0; y < _gohanHouseTiles.GetLength(0); y++)
                {
                    var offsetX = gohanHouseStartPositionX + x;
                    var offsetY = gohanHouseStartPositionY + y;
                    var tile    = Framing.GetTileSafely(offsetX, offsetY);
                    if (_gohanHouseTiles[y, x] == 0)
                    {
                        if (!isFirstPass)
                        {
                            continue;
                        }
                        tile.type = 0;
                        tile.active(false);
                    }
                    else if (_gohanHouseTiles[y, x] == 1)
                    {
                        tile.type = TileID.GrayStucco;
                        tile.active(true);
                    }
                    else if (_gohanHouseTiles[y, x] == 2)
                    {
                        tile.type = TileID.BlueDynastyShingles;
                        tile.active(true);
                    }
                    else if (_gohanHouseTiles[y, x] == 3)
                    {
                        tile.type = TileID.MarbleBlock;
                        tile.active(true);
                    }
                    else if (_gohanHouseTiles[y, x] == 4)
                    {
                        tile.type = TileID.DynastyWood;
                        tile.active(true);
                    }
                    else if (_gohanHouseTiles[y, x] == 5)
                    {
                        tile.type = TileID.Grass;
                        tile.active(true);
                    }
                }
            }
            for (var x = 0; x < _gohanHouseSlopes.GetLength(1); x++)
            {
                for (var y = 0; y < _gohanHouseSlopes.GetLength(0); y++)
                {
                    var offsetX = gohanHouseStartPositionX + x;
                    var offsetY = gohanHouseStartPositionY + y;
                    var tile    = Framing.GetTileSafely(offsetX, offsetY);
                    tile.slope(_gohanHouseSlopes[y, x]);
                    tile.halfBrick(false);
                }
            }
            // walls
            for (var x = 0; x < _gohanHouseWalls.GetLength(1); x++)
            {
                for (var y = 0; y < _gohanHouseWalls.GetLength(0); y++)
                {
                    var offsetX = gohanHouseStartPositionX + x;
                    var offsetY = gohanHouseStartPositionY + y;
                    var tile    = Framing.GetTileSafely(offsetX, offsetY);
                    if (_gohanHouseWalls[y, x] == 0)
                    {
                        tile.wall = 0;
                    }
                    else if (_gohanHouseWalls[y, x] == 1)
                    {
                        tile.wall = WallID.Wood;
                    }
                    else if (_gohanHouseWalls[y, x] == 2)
                    {
                        tile.wall = WallID.LivingWood;
                    }
                    else if (_gohanHouseWalls[y, x] == 3)
                    {
                        tile.wall = WallID.Gray;
                    }
                    else if (_gohanHouseWalls[y, x] == 4)
                    {
                        tile.wall = WallID.Glass;
                    }
                }
            }
            // Objects
            for (var x = 0; x < _gohanHouseObjects.GetLength(1); x++)
            {
                // house objects are different.. they go in reverse (ground up) so that the bottle placement actually works.
                for (var y = _gohanHouseObjects.GetLength(0) - 1; y >= 0; y--)
                {
                    var offsetX = gohanHouseStartPositionX + x;
                    var offsetY = gohanHouseStartPositionY + y;
                    var tile    = Framing.GetTileSafely(offsetX, offsetY);
                    // break rocks!
                    if (tile.type == TileID.SmallPiles || tile.type == TileID.LargePiles || tile.type == TileID.LargePiles2 || tile.type == TileID.Dirt || tile.type == TileID.Stone)
                    {
                        // nullify tiles?
                        WorldGen.KillTile(offsetX, offsetY);
                        tile = Framing.GetTileSafely(offsetX, offsetY);
                    }

                    if (_gohanHouseObjects[y, x] == 0)
                    {
                    }
                    else if (_gohanHouseObjects[y, x] == 1)
                    {
                        WorldGen.PlaceObject(offsetX, offsetY, TileID.ClosedDoor, true, 28); // confirmed dynasty door
                    }
                    else if (_gohanHouseObjects[y, x] == 2)
                    {
                        WorldGen.PlaceObject(offsetX, offsetY, TileID.Tables, true, 25); // confirmed dynasty table
                    }
                    else if (_gohanHouseObjects[y, x] == 3)
                    {
                        WorldGen.PlaceObject(offsetX, offsetY, TileID.Bottles, true, 5); // confirmed dynasty cup
                    }
                    else if (_gohanHouseObjects[y, x] == 4)
                    {
                        WorldGen.PlaceObject(offsetX, offsetY, TileID.Chandeliers, true,
                                             22); // confirmed large dynasty lantern
                        tile.color(28);
                    }
                    else if (_gohanHouseObjects[y, x] == 5)
                    {
                        WorldGen.PlaceObject(offsetX, offsetY, TileID.HangingLanterns, true,
                                             26); // confirmed dynasty hanging lantern (small one)
                    }
                    else if (_gohanHouseObjects[y, x] == 6)
                    {
                        // WorldGen.PlaceObject(offsetX, offsetY, TileID.Dressers, true, 4); // confirmed shadewood dresser
                        WorldGen.PlaceChest(offsetX, offsetY, TileID.Dressers, false, 4);
                    }
                    else if (_gohanHouseObjects[y, x] == 7)
                    {
                        if (!isFirstPass)
                        {
                            TryPlacingDragonBall(4, offsetX, offsetY);
                        }
                    }
                }
            }

            // sample tiles at the origin (it's to the right, this isn't perfect)
            var sampleTile  = Framing.GetTileSafely(gohanHouseStartPositionX, gohanHouseStartPositionY + 1);
            var isSnowBiome = sampleTile.type == TileID.SnowBlock || sampleTile.type == TileID.IceBlock;


            // experimental, also doesn't work when the tiles below are snow... which happens at spawn sometimes.
            // put dirt under the house and make sure gaps are filled. this might look weird.
            for (var y = 0; y < 5; y++)
            {
                for (var x = -1 - (y * 2); x < _gohanHouseTiles.GetLength(1) + 1 + (y * 2); x++)
                {
                    var offsetX = gohanHouseStartPositionX + x;
                    var offsetY = gohanHouseStartPositionY + _gohanHouseTiles.GetLength(0) + y;
                    var tile    = Framing.GetTileSafely(offsetX, offsetY);
                    var isEdge  = IsAnySideExposed(offsetX, offsetY);
                    tile.type = isSnowBiome ? TileID.SnowBlock : (isEdge ? TileID.Grass : TileID.Dirt);
                    // if it's a slope, remove slope. quit putting gaps in the ground terraria.
                    tile.slope(0);
                    tile.halfBrick(false);
                    tile.active(true);
                }
            }
        }
        public static void Spread(string biome, int i, int j)
        {
            if (biome == "The 404 Realm")
            {
                int        direction = Main.rand.Next(8);
                int        block     = 0;
                bool       found     = false;
                Vector2Int position  = new Vector2Int(i, j);
                if (direction == 0)
                {
                    position = new Vector2Int(i + 1, j);
                }
                else if (direction == 1)
                {
                    position = new Vector2Int(i - 1, j);
                }
                else if (direction == 2)
                {
                    position = new Vector2Int(i, j + 1);
                }
                else if (direction == 3)
                {
                    position = new Vector2Int(i, j - 1);
                }
                else if (direction == 4)
                {
                    position = new Vector2Int(i + 1, j + 1);
                }
                else if (direction == 5)
                {
                    position = new Vector2Int(i + 1, j - 1);
                }
                else if (direction == 6)
                {
                    position = new Vector2Int(i - 1, j + 1);
                }
                else if (direction == 7)
                {
                    position = new Vector2Int(i - 1, j - 1);
                }
                var type = Main.tile[position.X, position.Y].type;
                var wall = Main.tile[position.X, position.Y].wall;

                if (wall != 0)
                {
                    Main.tile[position.X, position.Y].wall = (ushort)WallType <The404Wall>();
                    WorldGen.SquareWallFrame(position.X, position.Y, true);
                    NetMessage.SendTileSquare(-1, position.X, position.Y, 1);

                    WorldGen.PlaceWall(position.X, position.Y, WallType <The404Wall>());

                    return;
                }

                //If the tile is stone, convert to The404Block
                if (TileID.Sets.Conversion.Stone[type])
                {
                    Main.tile[position.X, position.Y].type = (ushort)TileType <The404Block>();
                    WorldGen.SquareTileFrame(position.X, position.Y, true);
                    NetMessage.SendTileSquare(-1, position.X, position.Y, 1);

                    block = TileType <The404Block>();
                    found = true;
                }
                //If the tile is sand, convert to The404Sand
                else if (TileID.Sets.Conversion.Sand[type])
                {
                    Main.tile[position.X, position.Y].type = (ushort)TileType <The404Sand>();
                    WorldGen.SquareTileFrame(position.X, position.Y, true);
                    NetMessage.SendTileSquare(-1, position.X, position.Y, 1);

                    block = TileType <The404Sand>();
                    found = true;
                }
                //If the tile is hardened sand, convert to The404HardenedSand
                else if (TileID.Sets.Conversion.HardenedSand[type])
                {
                    Main.tile[position.X, position.Y].type = (ushort)TileType <The404HardenedSand>();
                    WorldGen.SquareTileFrame(position.X, position.Y, true);
                    NetMessage.SendTileSquare(-1, position.X, position.Y, 1);

                    block = TileType <The404HardenedSand>();
                }
                //If the tile is ice, convert to The404Ice
                else if (TileID.Sets.Conversion.Ice[type])
                {
                    Main.tile[position.X, position.Y].type = (ushort)TileType <The404Ice>();
                    WorldGen.SquareTileFrame(position.X, position.Y, true);
                    NetMessage.SendTileSquare(-1, position.X, position.Y, 1);

                    block = TileType <The404Ice>();
                    found = true;
                }
                //If the tile is snow, convert to The404Snow
                else if (type == TileID.SnowBlock)
                {
                    Main.tile[position.X, position.Y].type = (ushort)TileType <The404Snow>();
                    WorldGen.SquareTileFrame(position.X, position.Y, true);
                    NetMessage.SendTileSquare(-1, position.X, position.Y, 1);

                    block = TileType <The404Snow>();
                    found = true;
                }
                //If the tile is sandstone, convert to The404Sandstone
                else if (TileID.Sets.Conversion.Sandstone[type])
                {
                    Main.tile[position.X, position.Y].type = (ushort)TileType <The404Sandstone>();
                    WorldGen.SquareTileFrame(position.X, position.Y, true);
                    NetMessage.SendTileSquare(-1, position.X, position.Y, 1);

                    block = TileType <The404Sandstone>();
                    found = true;
                }
                //If the tile is dirt, convert to The404Dirt
                else if (TileID.Sets.Conversion.Grass[type] || type == TileID.Dirt)
                {
                    Main.tile[position.X, position.Y].type = (ushort)TileType <The404Dirt>();
                    WorldGen.SquareTileFrame(position.X, position.Y, true);
                    NetMessage.SendTileSquare(-1, position.X, position.Y, 1);

                    block = TileType <The404Dirt>();
                    found = true;
                }
                //If the tile is clay, convert to The404Clay
                else if (type == TileID.ClayBlock)
                {
                    Main.tile[position.X, position.Y].type = (ushort)TileType <The404Clay>();
                    WorldGen.SquareTileFrame(position.X, position.Y, true);
                    NetMessage.SendTileSquare(-1, position.X, position.Y, 1);

                    block = TileType <The404Clay>();
                    found = true;
                }
                //If the tile is mud, convert to The404Mud
                else if (type == TileID.Mud)
                {
                    Main.tile[position.X, position.Y].type = (ushort)TileType <The404Mud>();
                    WorldGen.SquareTileFrame(position.X, position.Y, true);
                    NetMessage.SendTileSquare(-1, position.X, position.Y, 1);

                    block = TileType <The404Mud>();
                    found = true;
                }
                //If the tile is a chair, convert to The404Chair
                else if (type == TileID.Chairs && Main.tile[position.X, position.Y - 1].type == TileID.Chairs)
                {
                    Main.tile[position.X, position.Y].type     = (ushort)TileType <The404Chair>();
                    Main.tile[position.X, position.Y - 1].type = (ushort)TileType <The404Chair>();
                    WorldGen.SquareTileFrame(position.X, position.Y, true);
                    NetMessage.SendTileSquare(-1, position.X, position.Y, 1);

                    block = TileType <The404Chair>();
                    found = true;
                }
                //If the tile is a workbench, convert to The404Workbench
                else if (type == TileID.WorkBenches && Main.tile[position.X - 1, position.Y].type == TileID.WorkBenches)
                {
                    Main.tile[position.X, position.Y].type     = (ushort)TileType <The404Workbench>();
                    Main.tile[position.X - 1, position.Y].type = (ushort)TileType <The404Workbench>();
                    WorldGen.SquareTileFrame(position.X, position.Y, true);
                    NetMessage.SendTileSquare(-1, position.X, position.Y, 1);

                    block = TileType <The404Workbench>();
                    found = true;
                }
                //If the tile is a chest, convert to The404Chest
                else if (type == TileID.Containers && Main.tile[position.X - 1, position.Y].type == TileID.Containers && Main.tile[position.X, position.Y - 1].type == TileID.Containers && Main.tile[position.X - 1, position.Y - 1].type == TileID.Containers)
                {
                    Main.tile[position.X, position.Y].type         = (ushort)TileType <The404Chest>();
                    Main.tile[position.X - 1, position.Y].type     = (ushort)TileType <The404Chest>();
                    Main.tile[position.X, position.Y - 1].type     = (ushort)TileType <The404Chest>();
                    Main.tile[position.X - 1, position.Y - 1].type = (ushort)TileType <The404Chest>();
                    WorldGen.SquareTileFrame(position.X, position.Y, true);
                    NetMessage.SendTileSquare(-1, position.X, position.Y, 1);

                    block = TileType <The404Chest>();
                    found = true;
                }
                //If the tile is a platform, convert to The404Platform
                else if (type == TileID.Platforms)
                {
                    Main.tile[position.X, position.Y].type = (ushort)TileType <The404Platform>();
                    WorldGen.SquareTileFrame(position.X, position.Y, true);
                    NetMessage.SendTileSquare(-1, position.X, position.Y, 1);

                    block = TileType <The404Platform>();
                    found = true;
                }
                //If the tile is a platform, convert to The404Platform
                else if (type == TileID.Trees)
                {
                    Tile tile = Framing.GetTileSafely(position.X, position.Y);                     // Safely get the tile at the given coordinates
                    if (tile.frameX < 54)
                    {
                        WorldGen.GrowTree(position.X, position.Y);
                    }
                    else
                    {
                        WorldGen.GrowPalmTree(position.X, position.Y);
                    }
                    WorldGen.SquareTileFrame(position.X, position.Y, true);
                    NetMessage.SendTileSquare(-1, position.X, position.Y, 1);
                }
                //If the tile is a platform, convert to The404Platform
                else if (type == TileID.PalmTree)
                {
                    Tile tile = Framing.GetTileSafely(position.X, position.Y);                     // Safely get the tile at the given coordinates
                    if (tile.frameX < 54)
                    {
                        WorldGen.GrowTree(position.X, position.Y);
                    }
                    else
                    {
                        WorldGen.GrowPalmTree(position.X, position.Y);
                    }
                    WorldGen.SquareTileFrame(position.X, position.Y, true);
                    NetMessage.SendTileSquare(-1, position.X, position.Y, 1);
                }
                else
                {
                    found = false;
                }

                Tile tile2 = Framing.GetTileSafely(position.X, position.Y);
                if (found && tile2.active())
                {
                    WorldGen.PlaceTile(position.X, position.Y, block);
                    //Main.NewText(position.X);
                    //Main.NewText(position.Y);
                    //Main.NewText(Main.tile[position.X, position.Y]);
                }
            }
        }
Example #6
0
        public override void AI()
        {
            float num624 = 6800f;
            float num625 = 900f;
            float num626 = 1900f;
            float num627 = 160f;

            if (Main.player[projectile.owner].dead)
            {
                projectile.Kill();
            }

            float num628 = 0.2f;
            int   num3;

            for (int num629 = 0; num629 < 1000; num629 = num3 + 1)
            {
                bool flag22 = true;
                if (((num629 != projectile.whoAmI && Main.projectile[num629].active && Main.projectile[num629].owner == projectile.owner) & flag22) && Math.Abs(projectile.position.X - Main.projectile[num629].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num629].position.Y) < (float)projectile.width)
                {
                    if (projectile.position.X < Main.projectile[num629].position.X)
                    {
                        projectile.velocity.X = projectile.velocity.X - num628;
                    }
                    else
                    {
                        projectile.velocity.X = projectile.velocity.X + num628;
                    }
                    if (projectile.position.Y < Main.projectile[num629].position.Y)
                    {
                        projectile.velocity.Y = projectile.velocity.Y - num628;
                    }
                    else
                    {
                        projectile.velocity.Y = projectile.velocity.Y + num628;
                    }
                }
                num3 = num629;
            }

            Vector2 vector49 = projectile.position;
            bool    flag24   = false;

            if (projectile.ai[0] != 1f && (projectile.type == 387 || projectile.type == 388))
            {
                projectile.tileCollide = true;
            }

            if (projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16)))
            {
                projectile.tileCollide = false;
            }
            NPC ownerMinionAttackTargetNPC3 = projectile.OwnerMinionAttackTargetNPC;

            if (ownerMinionAttackTargetNPC3 != null && ownerMinionAttackTargetNPC3.CanBeChasedBy(projectile, false))
            {
                float num636 = Vector2.Distance(ownerMinionAttackTargetNPC3.Center, projectile.Center);
                if (((Vector2.Distance(projectile.Center, vector49) > num636 && num636 < num624) || !flag24) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, ownerMinionAttackTargetNPC3.position, ownerMinionAttackTargetNPC3.width, ownerMinionAttackTargetNPC3.height))
                {
                    num624   = num636;
                    vector49 = ownerMinionAttackTargetNPC3.Center;
                    flag24   = true;
                }
            }
            if (!flag24)
            {
                for (int num637 = 0; num637 < 200; num637 = num3 + 1)
                {
                    NPC nPC2 = Main.npc[num637];
                    if (nPC2.CanBeChasedBy(projectile, false))
                    {
                        float num638 = Vector2.Distance(nPC2.Center, projectile.Center);
                        if (((Vector2.Distance(projectile.Center, vector49) > num638 && num638 < num624) || !flag24) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height))
                        {
                            num624   = num638;
                            vector49 = nPC2.Center;
                            flag24   = true;
                        }
                    }
                    num3 = num637;
                }
            }
            float num639 = num625;

            if (flag24)
            {
                num639 = num626;
            }
            Player player2 = Main.player[projectile.owner];

            if (Vector2.Distance(player2.Center, projectile.Center) > num639)
            {
                projectile.ai[0] = 1f;


                projectile.tileCollide = false;
                projectile.netUpdate   = true;
            }
            if (flag24 && projectile.ai[0] == 0f)
            {
                Vector2 vector50 = vector49 - projectile.Center;
                float   num640   = vector50.Length();
                vector50.Normalize();
                if (num640 > 200f)
                {
                    float scaleFactor2 = 6f;

                    scaleFactor2 = 8f;

                    vector50           *= scaleFactor2;
                    projectile.velocity = (projectile.velocity * 40f + vector50) / 41f;
                }
                else
                {
                    float num641 = 4f;
                    vector50           *= -num641;
                    projectile.velocity = (projectile.velocity * 40f + vector50) / 41f;
                }
            }
            else
            {
                bool flag25 = false;
                if (!flag25)
                {
                    flag25 = (projectile.ai[0] == 1f && (projectile.type == 387 || projectile.type == 388));
                }
                if (!flag25)
                {
                    flag25 = (projectile.ai[0] >= 9f && projectile.type == 533);
                }
                float num642 = 6f;

                if (flag25)
                {
                    num642 = 15f;
                }
                Vector2 center2  = projectile.Center;
                Vector2 vector51 = player2.Center - center2 + new Vector2(0f, -60f);
                float   num643   = vector51.Length();
                if (num643 > 200f && num642 < 8f)
                {
                    num642 = 8f;
                }
                if ((num643 < num627 & flag25) && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height))
                {
                    projectile.ai[0] = 0f;


                    projectile.netUpdate = true;
                }
                if (num643 > 2000f)
                {
                    projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2);
                    projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2);
                    projectile.netUpdate  = true;
                }
                if (num643 > 70f)
                {
                    vector51.Normalize();
                    vector51           *= num642;
                    projectile.velocity = (projectile.velocity * 40f + vector51) / 41f;
                }
                else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f)
                {
                    projectile.velocity.X = -0.15f;
                    projectile.velocity.Y = -0.05f;
                }
            }



            if (projectile.ai[1] > 0f && (projectile.type == 387 || projectile.type == 388))
            {
                projectile.ai[1] += (float)Main.rand.Next(1, 4);
            }
            if (projectile.ai[1] > 90f && projectile.type == 387)
            {
                projectile.ai[1]     = 0f;
                projectile.netUpdate = true;
            }
            if (projectile.ai[1] > 40f && projectile.type == 388)
            {
                projectile.ai[1]     = 0f;
                projectile.netUpdate = true;
            }
            if (projectile.ai[1] > 0f && projectile.type == 533)
            {
                projectile.ai[1] += 1f;
                int num649 = 10;
                if (projectile.ai[1] > (float)num649)
                {
                    projectile.ai[1]     = 0f;
                    projectile.netUpdate = true;
                }
            }
            if (projectile.ai[0] == 0f)
            {
                if (projectile.ai[1] == 0f && flag24 && num624 < 500f)
                {
                    projectile.ai[1] += 1f;
                    if (Main.myPlayer == projectile.owner)
                    {
                        projectile.ai[0] = 2f;
                        Vector2 value14 = vector49 - projectile.Center;
                        value14.Normalize();
                        projectile.velocity  = value14 * 8f;
                        projectile.netUpdate = true;
                        return;
                    }
                }
            }

            int num2323;

            for (int num20 = 0; num20 < 4; num20 = num2323 + 1)
            {
                float num21 = projectile.velocity.X / 4f * (float)num20;
                float num22 = projectile.velocity.Y / 4f * (float)num20;
                int   num23 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 156, 0f, 0f, 0, default(Color), 1.6f);
                Main.dust[num23].position.X = projectile.Center.X - num21;
                Main.dust[num23].position.Y = projectile.Center.Y - num22;
                Dust dust3 = Main.dust[num23];
                dust3.velocity        *= 0f;
                Main.dust[num23].scale = 0.5f;
                num2323 = num20;
            }
        }
 public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak)
 {
     Framing.SelfFrame8Way(i, j, Main.tile[i, j], resetFrame);
     return(false);
 }
 internal void InternalEndProcessAuthentication(LazyAsyncResult lazyResult)
 {
     lazyResult.InternalWaitForCompletion();
     Exception result = lazyResult.Result as Exception;
     if (result != null)
     {
         this._Framing = Framing.None;
         this._HandshakeCompleted = false;
         throw this.SetException(result);
     }
 }
        public override bool OnTileCollide(Vector2 oldVelocity)
        {
            Main.PlaySound(SoundID.NPCHit13, projectile.position);
            Point     tilePosition    = projectile.Center.ToTileCoordinates();
            const int size            = 5;
            const int difference      = 5 / 2;
            Rectangle effectRectangle = new Rectangle(tilePosition.X - difference, tilePosition.Y - difference, size * 16, size * 16);

            for (int k = 0; k < 40; k++)
            {
                Dust.NewDust(new Vector2(effectRectangle.X * 16, effectRectangle.Y * 16), size * 16, size * 16, DustID.Fire);
            }
            for (int k = 0; k < 20; k++)
            {
                Dust.NewDust(projectile.Center, projectile.width, projectile.height, DustID.Fire);
            }
            for (int k = 0; k < 10; k++)
            {
                Dust.NewDust(projectile.Center, projectile.width, projectile.height, DustID.FlameBurst);
            }
            for (int i = effectRectangle.X; i < effectRectangle.X + size; i++)
            {
                for (int j = effectRectangle.Y; j < effectRectangle.Y + size; j++)
                {
                    Tile     tile           = Framing.GetTileSafely(i, j);
                    int      oldType        = tile.type;
                    bool     changed        = false;
                    ushort   emberGrassTile = (ushort)ModContent.TileType <EmberGrass>();
                    ushort[] toEmberGrass   =
                    {
                        TileID.Grass,
                        TileID.CorruptGrass,
                        TileID.FleshGrass,
                        TileID.JungleGrass,
                        TileID.HallowedGrass,
                        TileID.MushroomGrass,
                    };
                    for (int k = 0; k < toEmberGrass.Length; k++)
                    {
                        if (tile.active() && tile.type == toEmberGrass[k])
                        {
                            tile.ResetToType(emberGrassTile);
                            WorldGen.TileFrame(i, j);
                            changed = true;
                        }
                    }
                    if (!changed)
                    {
                        ushort[] toAsh =
                        {
                            TileID.Dirt,
                            TileID.ClayBlock,
                            TileID.Sand,
                            TileID.Ebonsand,
                            TileID.Crimsand,
                            TileID.Pearlsand,
                        };
                        for (int k = 0; k < toAsh.Length; k++)
                        {
                            if (tile.active() && tile.type == toAsh[k])
                            {
                                tile.ResetToType(TileID.Ash);
                                WorldGen.TileFrame(i, j);
                                changed = true;
                            }
                        }
                    }
                    if (!changed)
                    {
                        ushort[] toHellstone =
                        {
                            TileID.Stone,
                            TileID.Ebonstone,
                            TileID.Crimstone,
                            TileID.Pearlstone,
                            TileID.Copper,
                            TileID.Tin,
                            TileID.Iron,
                            TileID.Lead,
                        };
                        for (int k = 0; k < toHellstone.Length; k++)
                        {
                            if (tile.active() && tile.type == toHellstone[k])
                            {
                                tile.ResetToType(TileID.Hellstone);
                                WorldGen.TileFrame(i, j);
                                changed = true;
                            }
                        }
                    }
                    if (changed && Main.netMode != NetmodeID.SinglePlayer)
                    {
                        NetMessage.SendData(MessageID.TileChange, -1, -1, null, 0, i, j, 0f, 0, 0, 0);
                    }
                    Tile aboveTile = Framing.GetTileSafely(i, j - 1);
                    if (aboveTile.active())
                    {
                        if (aboveTile.type == TileID.Trees)
                        {
                            WorldGen.CheckTree(i, j - 1);
                        }
                    }
                    if (tile.active())
                    {
                        WorldGen.TileFrame(i, j, true);
                    }
                }
            }
            projectile.active = false;
            return(false);
        }
Example #10
0
 bool checkIce(int x, int y) => Framing.GetTileSafely(x, y).type == TileType <PermafrostIce>();
Example #11
0
        public void Simple_server_must_initial_server_banner_echo_server()
        {
            var connections = Sys.TcpStream().Bind("127.0.0.1", 8888);
            var serverProbe = CreateTestProbe();

            #region welcome-banner-chat-server
            connections.RunForeach(connection =>
            {
                // server logic, parses incoming commands
                var commandParser = Flow.Create <string>().TakeWhile(c => c != "BYE").Select(c => c + "!");

                var welcomeMessage = $"Welcome to: {connection.LocalAddress}, you are: {connection.RemoteAddress}!";
                var welcome        = Source.Single(welcomeMessage);

                var serverLogic = Flow.Create <ByteString>()
                                  .Via(Framing.Delimiter(
                                           ByteString.FromString("\n"),
                                           maximumFrameLength: 256,
                                           allowTruncation: true))
                                  .Select(c => c.ToString())
                                  .Select(command =>
                {
                    serverProbe.Tell(command);
                    return(command);
                })
                                  .Via(commandParser)
                                  .Merge(welcome)
                                  .Select(c => c + "\n")
                                  .Select(ByteString.FromString);

                connection.HandleWith(serverLogic, Materializer);
            }, Materializer);
            #endregion

            var input = new ConcurrentQueue <string>(new[] { "Hello world", "What a lovely day" });

            string ReadLine(string prompt) => input.TryDequeue(out var cmd) ? cmd : "q";

            {
                var connection = Sys.TcpStream().OutgoingConnection("127.0.0.1", 8888);
            }

            {
                #region repl-client
                var connection = Sys.TcpStream().OutgoingConnection("127.0.0.1", 8888);

                var replParser = Flow.Create <string>().TakeWhile(c => c != "q")
                                 .Concat(Source.Single("BYE"))
                                 .Select(elem => ByteString.FromString($"{elem}\n"));

                var repl = Flow.Create <ByteString>()
                           .Via(Framing.Delimiter(
                                    ByteString.FromString("\n"),
                                    maximumFrameLength: 256,
                                    allowTruncation: true))
                           .Select(c => c.ToString())
                           .Select(text =>
                {
                    Output.WriteLine($"Server: {text}");
                    return(text);
                })
                           .Select(text => ReadLine("> "))
                           .Via(replParser);

                connection.Join(repl).Run(Materializer);
                #endregion
            }

            serverProbe.ExpectMsg("Hello world", TimeSpan.FromSeconds(20));
            serverProbe.ExpectMsg("What a lovely day");
            serverProbe.ExpectMsg("BYE");
        }
Example #12
0
        public override void AI()
        {
            Player   player    = Main.player[projectile.owner];
            AAPlayer modPlayer = player.GetModPlayer <AAPlayer>();

            if (player.dead)
            {
                modPlayer.Searcher = false;
            }
            if (modPlayer.doomite)
            {
                projectile.timeLeft = 2;
            }

            float num633 = 700f;
            float num634 = 800f;
            float num635 = 1200f;
            float num636 = 150f;
            float num637 = 0.05f;

            for (int num638 = 0; num638 < 1000; num638++)
            {
                bool flag23 = Main.projectile[num638].type == mod.ProjectileType("Searcher");
                if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < projectile.width)
                {
                    if (projectile.position.X < Main.projectile[num638].position.X)
                    {
                        projectile.velocity.X = projectile.velocity.X - num637;
                    }
                    else
                    {
                        projectile.velocity.X = projectile.velocity.X + num637;
                    }
                    if (projectile.position.Y < Main.projectile[num638].position.Y)
                    {
                        projectile.velocity.Y = projectile.velocity.Y - num637;
                    }
                    else
                    {
                        projectile.velocity.Y = projectile.velocity.Y + num637;
                    }
                }
            }
            bool flag24 = false;

            if (flag24)
            {
                return;
            }
            Vector2 vector46 = projectile.position;
            bool    flag25   = false;

            if (projectile.ai[0] != 1f)
            {
                projectile.tileCollide = false;
            }
            if (projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16)))
            {
                projectile.tileCollide = false;
            }
            for (int num645 = 0; num645 < 200; num645++)
            {
                NPC nPC2 = Main.npc[num645];
                if (nPC2.CanBeChasedBy(projectile, false))
                {
                    float num646 = Vector2.Distance(nPC2.Center, projectile.Center);
                    if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height))
                    {
                        num633   = num646;
                        vector46 = nPC2.Center;
                        flag25   = true;
                    }
                }
            }
            float num647 = num634;

            if (flag25)
            {
                num647 = num635;
            }
            if (Vector2.Distance(player.Center, projectile.Center) > num647)
            {
                projectile.ai[0]       = 1f;
                projectile.tileCollide = false;
                projectile.netUpdate   = true;
            }
            if (flag25 && projectile.ai[0] == 0f)
            {
                Vector2 vector47 = vector46 - projectile.Center;
                float   num648   = vector47.Length();
                vector47.Normalize();
                if (num648 > 200f)
                {
                    float scaleFactor2 = 6f;
                    vector47           *= scaleFactor2;
                    projectile.velocity = (projectile.velocity * 40f + vector47) / 41f;
                }
                else
                {
                    float num649 = 4f;
                    vector47           *= -num649;
                    projectile.velocity = (projectile.velocity * 40f + vector47) / 41f;
                }
            }
            else
            {
                bool flag26 = false;
                if (!flag26)
                {
                    flag26 = projectile.ai[0] == 1f;
                }
                float num650 = 6f;
                if (flag26)
                {
                    num650 = 15f;
                }
                Vector2 center2  = projectile.Center;
                Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f);
                float   num651   = vector48.Length();
                if (num651 > 200f && num650 < 8f)
                {
                    num650 = 8f;
                }
                if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height))
                {
                    projectile.ai[0]     = 0f;
                    projectile.netUpdate = true;
                }
                if (num651 > 2000f)
                {
                    projectile.position.X = Main.player[projectile.owner].Center.X - projectile.width / 2;
                    projectile.position.Y = Main.player[projectile.owner].Center.Y - projectile.height / 2;
                    projectile.netUpdate  = true;
                }
                if (num651 > 70f)
                {
                    vector48.Normalize();
                    vector48           *= num650;
                    projectile.velocity = (projectile.velocity * 40f + vector48) / 41f;
                }
                else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f)
                {
                    projectile.velocity.X = -0.15f;
                    projectile.velocity.Y = -0.05f;
                }
            }
            if (flag25)
            {
                projectile.rotation = (vector46 - projectile.Center).ToRotation() + 3.14159274f;
            }
            else
            {
                projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f;
            }

            projectile.frameCounter++;
            if (projectile.frameCounter >= 10)
            {
                projectile.frameCounter = 0;
                projectile.frame++;
            }
            if (projectile.frame > 4)
            {
                projectile.frame = 0;
            }
            if (projectile.ai[1] > 0f)
            {
                projectile.ai[1] += Main.rand.Next(1, 4);
            }
            if (projectile.ai[1] > 30f)
            {
                projectile.ai[1]     = 0f;
                projectile.netUpdate = true;
            }
            if (projectile.ai[0] == 0f)
            {
                float scaleFactor3 = 8f;
                int   num658       = ModContent.ProjectileType <Summoning.Minions.ProbeShot>();
                if (flag25 && projectile.ai[1] == 0f)
                {
                    projectile.ai[1] += 1f;
                    if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, vector46, 0, 0))
                    {
                        Vector2 value19 = vector46 - projectile.Center;
                        value19.Normalize();
                        value19 *= scaleFactor3;
                        int num659 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f);
                        Main.projectile[num659].timeLeft = 300;
                        Main.projectile[num659].hostile  = false;
                        Main.projectile[num659].friendly = true;
                        projectile.netUpdate             = true;
                    }
                }
            }
        }
 private void StartSendBlob(byte[] incoming, int count, AsyncProtocolRequest asyncRequest)
 {
     ProtocolToken message = this.Context.NextMessage(incoming, 0, count);
     this._SecurityStatus = message.Status;
     if (message.Size != 0)
     {
         if (this.Context.IsServer && (this._CachedSession == CachedSessionStatus.Unknown))
         {
             this._CachedSession = (message.Size < 200) ? CachedSessionStatus.IsCached : CachedSessionStatus.IsNotCached;
         }
         if (this._Framing == Framing.Unified)
         {
             this._Framing = this.DetectFraming(message.Payload, message.Payload.Length);
         }
         if (((message.Done && this._ForceBufferingLastHandshakePayload) && ((this.InnerStream.GetType() == typeof(NetworkStream)) && !this._PendingReHandshake)) && !this.CheckWin9xCachedSession())
         {
             this._LastPayload = message.Payload;
         }
         else if (asyncRequest == null)
         {
             this.InnerStream.Write(message.Payload, 0, message.Size);
         }
         else
         {
             asyncRequest.AsyncState = message;
             IAsyncResult asyncResult = this.InnerStream.BeginWrite(message.Payload, 0, message.Size, _WriteCallback, asyncRequest);
             if (!asyncResult.CompletedSynchronously)
             {
                 return;
             }
             this.InnerStream.EndWrite(asyncResult);
         }
     }
     this.CheckCompletionBeforeNextReceive(message, asyncRequest);
 }
 private void StartReadFrame(byte[] buffer, int readBytes, AsyncProtocolRequest asyncRequest)
 {
     if (readBytes == 0)
     {
         throw new IOException(SR.GetString("net_auth_eof"));
     }
     if (this._Framing == Framing.None)
     {
         this._Framing = this.DetectFraming(buffer, readBytes);
     }
     int remainingFrameSize = this.GetRemainingFrameSize(buffer, readBytes);
     if (remainingFrameSize < 0)
     {
         throw new IOException(SR.GetString("net_ssl_io_frame"));
     }
     if (remainingFrameSize == 0)
     {
         throw new AuthenticationException(SR.GetString("net_auth_eof"), null);
     }
     buffer = EnsureBufferSize(buffer, readBytes, readBytes + remainingFrameSize);
     if (asyncRequest == null)
     {
         remainingFrameSize = this._Reader.ReadPacket(buffer, readBytes, remainingFrameSize);
     }
     else
     {
         asyncRequest.SetNextRequest(buffer, readBytes, remainingFrameSize, _ReadFrameCallback);
         this._Reader.AsyncReadPacket(asyncRequest);
         if (!asyncRequest.MustCompleteSynchronously)
         {
             return;
         }
         remainingFrameSize = asyncRequest.Result;
         if (remainingFrameSize == 0)
         {
             readBytes = 0;
         }
     }
     this.ProcessReceivedBlob(buffer, readBytes + remainingFrameSize, asyncRequest);
 }
 private void ProcessReceivedBlob(byte[] buffer, int count, AsyncProtocolRequest asyncRequest)
 {
     if (count == 0)
     {
         throw new AuthenticationException(SR.GetString("net_auth_eof"), null);
     }
     if (this._PendingReHandshake)
     {
         int offset = 0;
         SecurityStatus errorCode = this.PrivateDecryptData(buffer, ref offset, ref count);
         if (errorCode == SecurityStatus.OK)
         {
             Exception exception = this.EnqueueOldKeyDecryptedData(buffer, offset, count);
             if (exception != null)
             {
                 this.StartSendAuthResetSignal(null, asyncRequest, exception);
                 return;
             }
             this._Framing = Framing.None;
             this.StartReceiveBlob(buffer, asyncRequest);
             return;
         }
         if (errorCode != SecurityStatus.Renegotiate)
         {
             ProtocolToken token = new ProtocolToken(null, errorCode);
             this.StartSendAuthResetSignal(null, asyncRequest, new AuthenticationException(SR.GetString("net_auth_SSPI"), token.GetException()));
             return;
         }
         this._PendingReHandshake = false;
         if (offset != 0)
         {
             Buffer.BlockCopy(buffer, offset, buffer, 0, count);
         }
     }
     this.StartSendBlob(buffer, count, asyncRequest);
 }
Example #16
0
        public void Update2()
        {
            Player player = Main.LocalPlayer;

            if (selected && (EyeDropperActive || StampToolActive))
            {
                //			player.mouseInterface = true;
                //			player.showItemIcon = true;
                if (EyeDropperActive)
                {
                    //		Main.LocalPlayer.showItemIconText = "Click to select pallete";
                    player.showItemIcon2 = ItemID.EmptyDropper;
                    if (leftMouseDown)
                    {
                        Point point = (Main.MouseWorld).ToTileCoordinates();
                        //Point point = (Main.MouseWorld + (brushSize % 2 == 0 ? Vector2.One * 8 : Vector2.Zero)).ToTileCoordinates();
                        //point.X -= brushSize / 2;
                        //point.Y -= brushSize / 2;
                        if (startTileX == -1)
                        {
                            startTileX     = point.X;
                            startTileY     = point.Y;
                            lastMouseTileX = -1;
                            lastMouseTileY = -1;
                        }

                        //if (lastMouseTileX != point.X && lastMouseTileY != point.Y)
                        {
                            //for (int x = 0; x < brushSize; x++)
                            //{
                            //	for (int y = 0; y < brushSize; y++)
                            //	{
                            //		if (WorldGen.InWorld(x + point.X, y + point.Y))
                            //		{
                            //			Tile target = Framing.GetTileSafely(x + point.X, y + point.Y);
                            //			BrushTiles[x, y].CopyFrom(target);
                            //			//	Main.NewText("{x}, {y}");
                            //		}
                            //	}
                            //}
                            lastMouseTileX = point.X;
                            lastMouseTileY = point.Y;
                        }
                    }
                    if (justLeftMouseDown)
                    {
                        if (startTileX != -1 && startTileY != -1 && lastMouseTileX != -1 && lastMouseTileY != -1)
                        {
                            Vector2 upperLeft  = new Vector2(Math.Min(startTileX, lastMouseTileX), Math.Min(startTileY, lastMouseTileY));
                            Vector2 lowerRight = new Vector2(Math.Max(startTileX, lastMouseTileX), Math.Max(startTileY, lastMouseTileY));

                            int minX = (int)upperLeft.X;
                            int maxX = (int)lowerRight.X + 1;
                            int minY = (int)upperLeft.Y;
                            int maxY = (int)lowerRight.Y + 1;

                            //ErrorLogger.Log(string.Format("JustDown2 {0} {1} {2} {3}", minX, minY, maxX, maxY));

                            StampTiles = new Tile[maxX - minX, maxY - minY];

                            for (int i = 0; i < maxX - minX; i++)
                            {
                                for (int j = 0; j < maxY - minY; j++)
                                {
                                    StampTiles[i, j] = new Tile();
                                }
                            }

                            for (int x = minX; x < maxX; x++)
                            {
                                for (int y = minY; y < maxY; y++)
                                {
                                    if (WorldGen.InWorld(x, y))
                                    //if (WorldGen.InWorld(x + point.X, y + point.Y))
                                    {
                                        Tile target = Framing.GetTileSafely(x, y);
                                        StampTiles[x - minX, y - minY].CopyFrom(target);
                                        //	Main.NewText("{x}, {y}");
                                    }
                                }
                            }
                            //Main.NewText("EyeDropper: width height" + (maxX - minX) + " " + (maxY - minY));
                            CheatSheet.instance.paintToolsUI.AddSlot(PaintToolsEx.GetStampInfo(StampTiles));
                        }
                        //Main.NewText("EyeDropper: x,y,min max " + minX + " " + maxX + " " + minY + " " + maxY);

                        startTileX        = -1;
                        startTileY        = -1;
                        lastMouseTileX    = -1;
                        lastMouseTileY    = -1;
                        justLeftMouseDown = false;
                    }
                }
                if (StampToolActive)
                {
                    player.showItemIcon2 = ItemID.Paintbrush;
                    //		Main.LocalPlayer.showItemIconText = "Click to paint";
                    if (leftMouseDown && stampInfo != null)
                    {
                        int width  = StampTiles.GetLength(0);
                        int height = StampTiles.GetLength(1);
                        //Vector2 brushsize = new Vector2(width, height);
                        //Vector2 evenOffset = Vector2.Zero;
                        //if (width % 2 == 0)
                        //{
                        //	evenOffset.X = 1;
                        //}
                        //if (height % 2 == 0)
                        //{
                        //	evenOffset.Y = 1;
                        //}
                        //Point point = (Main.MouseWorld + evenOffset * 8).ToTileCoordinates();
                        ////Point point = (Main.MouseWorld + (brushSize % 2 == 0 ? Vector2.One * 8 : Vector2.Zero)).ToTileCoordinates();
                        //point.X -= width / 2;
                        //point.Y -= height / 2;
                        ////Vector2 vector = new Vector2(point.X, point.Y) * 16f;
                        ////vector -= Main.screenPosition;
                        ////if (Main.LocalPlayer.gravDir == -1f)
                        ////{
                        ////	vector.Y = (float)Main.screenHeight - vector.Y - 16f;
                        ////}

                        Point point = Snap.GetSnapPosition(CheatSheet.instance.paintToolsUI.SnapType, width, height, constrainToAxis, constrainedX, constrainedY, true).ToPoint();

                        if (startTileX == -1)
                        {
                            startTileX     = point.X;
                            startTileY     = point.Y;
                            lastMouseTileX = -1;
                            lastMouseTileY = -1;
                        }

                        if (Main.keyState.IsKeyDown(Keys.LeftShift))
                        {
                            constrainToAxis = true;
                            if (constrainedStartX == -1 && constrainedStartY == -1)
                            {
                                constrainedStartX = point.X;
                                constrainedStartY = point.Y;
                            }

                            if (constrainedX == -1 && constrainedY == -1)
                            {
                                if (constrainedStartX != point.X)
                                {
                                    constrainedY = point.Y;
                                }
                                else if (constrainedStartY != point.Y)
                                {
                                    constrainedX = point.X;
                                }
                            }
                            if (constrainedX != -1)
                            {
                                point.X = constrainedX;
                            }
                            if (constrainedY != -1)
                            {
                                point.Y = constrainedY;
                            }
                        }
                        else
                        {
                            constrainToAxis   = false;
                            constrainedX      = -1;
                            constrainedY      = -1;
                            constrainedStartX = -1;
                            constrainedStartY = -1;
                        }

                        if (lastMouseTileX != point.X || lastMouseTileY != point.Y)
                        {
                            lastMouseTileX = point.X;
                            lastMouseTileY = point.Y;
                            //Main.NewText("StartTileX " + startTileX);
                            UndoHistory.Push(Tuple.Create(point, new Tile[width, height]));
                            UpdateUndoTooltip();
                            for (int x = 0; x < width; x++)
                            {
                                for (int y = 0; y < height; y++)
                                {
                                    if (WorldGen.InWorld(x + point.X, y + point.Y) && StampTiles[x, y] != null)
                                    {
                                        Tile target = Framing.GetTileSafely(x + point.X, y + point.Y);
                                        UndoHistory.Peek().Item2[x, y] = new Tile(target);
                                        int cycledX = ((x + point.X - startTileX) % width + width) % width;
                                        int cycledY = ((y + point.Y - startTileY) % height + height) % height;
                                        if (TransparentSelectionEnabled)                                         // What about just walls?
                                        {
                                            if (StampTiles[cycledX, cycledY].active())
                                            {
                                                target.CopyFrom(StampTiles[cycledX, cycledY]);
                                            }
                                        }
                                        else
                                        {
                                            target.CopyFrom(StampTiles[cycledX, cycledY]);
                                        }
                                    }
                                }
                            }
                            if (Main.netMode == 1)
                            {
                                NetMessage.SendTileSquare(-1, point.X + width / 2, point.Y + height / 2, Math.Max(width, height));
                            }
                        }
                    }
                    else
                    {
                        startTileX        = -1;
                        startTileY        = -1;
                        constrainToAxis   = false;
                        constrainedX      = -1;
                        constrainedY      = -1;
                        constrainedStartX = -1;
                        constrainedStartY = -1;
                    }
                }
                Main.LocalPlayer.showItemIcon = true;
            }
        }
Example #17
0
File: SymDef.cs Project: jonc/carto
 public void SetFraming(Framing framing)
 {
     CheckModifiable();
     this.framing = framing;
 }
 private void ForceAuthentication(bool receiveFirst, byte[] buffer, AsyncProtocolRequest asyncRequest)
 {
     if (!this.CheckEnqueueHandshake(buffer, asyncRequest))
     {
         this._Framing = Framing.None;
         try
         {
             if (receiveFirst)
             {
                 this.StartReceiveBlob(buffer, asyncRequest);
             }
             else
             {
                 this.StartSendBlob(buffer, (buffer == null) ? 0 : buffer.Length, asyncRequest);
             }
         }
         catch (Exception exception)
         {
             this._Framing = Framing.None;
             this._HandshakeCompleted = false;
             if (this.SetException(exception) == exception)
             {
                 throw;
             }
             throw this._Exception;
         }
         finally
         {
             if (this._Exception != null)
             {
                 this.FinishHandshake(null, null);
             }
         }
     }
 }