private static void appendFaceLocationUpdate(Player p, PacketBuilder updateBlock) { int x = p.getFaceLocation().getX(); int y = p.getFaceLocation().getY(); updateBlock.addUShort(x = 2 * x + 1); updateBlock.addUShortA(y = 2 * y + 1); }
private static void appendFaceLocationUpdate(Player p, PacketBuilder updateBlock) { int x = p.getFaceLocation().getX(); int y = p.getFaceLocation().getY(); updateBlock.addUShort(x = 2 * x + 1); updateBlock.addUShortA(y = 2 * y + 1); }
public void sendFightCaveMapdata() { lastX = lastX == 0 ? 2413 : (player.getLocation().getX() - (20000 + (200 * player.getIndex()))); lastY = lastY == 0 ? 5116 : (player.getLocation().getY() - 20000); PacketBuilder pb = new PacketBuilder().setId(214).setSize(Packet.Size.VariableShort); pb.addUShortA(player.getLocation().getLocalX()); pb.addUShortA(player.getLocation().getRegionX()); pb.addByteS(player.getLocation().getZ()); pb.addUShortA(player.getLocation().getLocalY()); pb.initBitAccess(); for (int height = 0; height < 4; height++) { for (int xCalc = ((lastX >> 3) - 6); xCalc <= ((lastX >> 3) + 6); xCalc++) { for (int yCalc = ((lastY >> 3) - 6); yCalc <= ((lastY >> 3) + 6); yCalc++) { int region = yCalc / 8 + (xCalc / 8 << 8); if (height == player.getLocation().getZ() && region == 9551) { pb.addBits(1, 1); pb.addBits(26, (xCalc << 14) | (yCalc << 3) | (0 << 1) | (0 << 24)); } else { pb.addBits(1, 0); } } } } pb.finishBitAccess(); int[] sent = new int[4 * 13 * 13]; int sentIndex = 0; for (int xCalc = (((lastX >> 3) - 6) / 8); xCalc <= (((lastX >> 3) + 6) / 8); xCalc++) { outer: for (int yCalc = (((lastY >> 3) - 6) / 8); yCalc <= (((lastY >> 3) + 6) / 8); yCalc++) { int region = yCalc + (xCalc << 8); if (region != 9551) { continue; } for (int i = 0; i < sentIndex; i++) { if (sent[i] == region) { goto outer; } } sent[sentIndex] = region; sentIndex++; 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.addUShort(player.getLocation().getRegionY()); connection.SendPacket(pb.toPacket()); }