Пример #1
0
        public void sendMapRegion()
        {
            player.getUpdateFlags().setLastRegion((Location)player.getLocation().Clone());
            if (player.getLocation().getX() >= 19000)
            {
                sendFightCaveMapdata();
                return;
            }
            PacketBuilder pb        = new PacketBuilder().setId(162).setSize(Packet.Size.VariableShort);
            bool          forceSend = true;

            if (((((player.getLocation().getRegionX() / 8) == 48) || ((player.getLocation().getRegionX() / 8) == 49)) && ((player.getLocation().getRegionY() / 8) == 48)) ||
                (((player.getLocation().getRegionX() / 8) == 48) && ((player.getLocation().getRegionY() / 8) == 148)))
            {
                forceSend = false;
            }
            pb.addShortA(player.getLocation().getLocalX());

            for (int xCalc = (player.getLocation().getRegionX() - 6) / 8; xCalc <= ((player.getLocation().getRegionX() + 6) / 8); xCalc++)
            {
                for (int yCalc = (player.getLocation().getRegionY() - 6) / 8; yCalc <= ((player.getLocation().getRegionY() + 6) / 8); yCalc++)
                {
                    int region = yCalc + (xCalc << 8);
                    if (forceSend || ((yCalc != 49) && (yCalc != 149) && (yCalc != 147) && (xCalc != 50) && ((xCalc != 49) || (yCalc != 47))))
                    {
                        int[] mapData = MapData.getData(region);
                        if (mapData == null)
                        {
                            pb.addInt2(0);
                            pb.addInt2(0);
                            pb.addInt2(0);
                            pb.addInt2(0);
                        }
                        else
                        {
                            pb.addInt2(mapData[0]);
                            pb.addInt2(mapData[1]);
                            pb.addInt2(mapData[2]);
                            pb.addInt2(mapData[3]);
                        }
                    }
                }
            }
            pb.addByteS(player.getLocation().getZ());
            pb.addUShort(player.getLocation().getRegionX());
            pb.addShortA(player.getLocation().getRegionY());
            pb.addShortA(player.getLocation().getLocalY());
            connection.SendPacket(pb.toPacket());
            Server.getGroundItems().refreshGlobalItems(player);
            Server.getGlobalObjects().refreshGlobalObjects(player);
        }
Пример #2
0
        private static void appendEntityFocusUdate(Npc Npc, PacketBuilder updateBlock)
        {
            int entityFocus = Npc.getEntityFocus();

            if (entityFocus != -1)
            {
                updateBlock.addShortA(entityFocus);
            }
        }
Пример #3
0
        private static void appendFaceLocationUpdate(Npc Npc, PacketBuilder updateBlock)
        {
            Location loc = Npc.getFaceLocation();
            int      x   = loc.getX();
            int      y   = loc.getY();

            updateBlock.addShortA(x = 2 * x + 1);
            updateBlock.addUShort(y = 2 * y + 1);
        }
Пример #4
0
        private static void appendGraphicsUpdate(Npc Npc, PacketBuilder updateBlock)
        {
            Graphics gfx = Npc.getLastGraphics();

            if (gfx != null)
            {
                updateBlock.addShortA(gfx.getId());
                updateBlock.addLEInt(gfx.getHeight() << 16 + gfx.getDelay());
            }
        }
Пример #5
0
        public void sendMapRegion()
        {
            player.getUpdateFlags().setLastRegion((Location)player.getLocation().Clone());
            if (player.getLocation().getX() >= 19000) {
                sendFightCaveMapdata();
                return;
            }
            PacketBuilder pb = new PacketBuilder().setId(162).setSize(Packet.Size.VariableShort);
            bool forceSend = true;
            if (((((player.getLocation().getRegionX() / 8) == 48) || ((player.getLocation().getRegionX() / 8) == 49)) && ((player.getLocation().getRegionY() / 8) == 48))
                || (((player.getLocation().getRegionX() / 8) == 48) && ((player.getLocation().getRegionY() / 8) == 148)))
            {
                forceSend = false;
            }
            pb.addShortA(player.getLocation().getLocalX());

            for (int xCalc = (player.getLocation().getRegionX() - 6) / 8; xCalc <= ((player.getLocation().getRegionX() + 6) / 8); xCalc++)
            {
                for (int yCalc = (player.getLocation().getRegionY() - 6) / 8; yCalc <= ((player.getLocation().getRegionY() + 6) / 8); yCalc++)
                {
                    int region = yCalc + (xCalc << 8);
                    if (forceSend || ((yCalc != 49) && (yCalc != 149) && (yCalc != 147) && (xCalc != 50) && ((xCalc != 49) || (yCalc != 47))))
                    {
                        int[] mapData = MapData.getData(region);
                        if (mapData == null)
                        {
                            pb.addInt2(0);
                            pb.addInt2(0);
                            pb.addInt2(0);
                            pb.addInt2(0);
                        }
                        else
                        {
                            pb.addInt2(mapData[0]);
                            pb.addInt2(mapData[1]);
                            pb.addInt2(mapData[2]);
                            pb.addInt2(mapData[3]);
                        }
                    }
                }
            }
            pb.addByteS(player.getLocation().getZ());
            pb.addUShort(player.getLocation().getRegionX());
            pb.addShortA(player.getLocation().getRegionY());
            pb.addShortA(player.getLocation().getLocalY());
            connection.SendPacket(pb.toPacket());
            Server.getGroundItems().refreshGlobalItems(player);
            Server.getGlobalObjects().refreshGlobalObjects(player);
        }
Пример #6
0
 private static void appendEntityFocusUdate(Npc Npc, PacketBuilder updateBlock)
 {
     int entityFocus = Npc.getEntityFocus();
     if (entityFocus != -1)
         updateBlock.addShortA(entityFocus);
 }
Пример #7
0
 private static void appendGraphicsUpdate(Npc Npc, PacketBuilder updateBlock)
 {
     Graphics gfx = Npc.getLastGraphics();
     if (gfx != null)
     {
         updateBlock.addShortA(gfx.getId());
         updateBlock.addLEInt(gfx.getHeight() << 16 + gfx.getDelay());
     }
 }
Пример #8
0
 private static void appendFaceLocationUpdate(Npc Npc, PacketBuilder updateBlock)
 {
     Location loc = Npc.getFaceLocation();
     int x = loc.getX();
     int y = loc.getY();
     updateBlock.addShortA(x = 2 * x + 1);
     updateBlock.addUShort(y = 2 * y + 1);
 }
 private static void appendFaceEntityUpdate(Player p, PacketBuilder updateBlock)
 {
     updateBlock.addShortA(p.getEntityFocus());
 }
 private static void appendFaceEntityUpdate(Player p, PacketBuilder updateBlock)
 {
     updateBlock.addShortA(p.getEntityFocus());
 }