private static void appendForceMovement(Player p, PacketBuilder updateBlock) { Location myLocation = p.getUpdateFlags().getLastRegion(); ForceMovement fm = p.getForceMovement(); updateBlock.addByteC(fm.getX1()); updateBlock.addByte((byte)(fm.getY1())); updateBlock.addByteA(fm.getX2()); updateBlock.addByte((byte)fm.getY2()); updateBlock.addLEShort(fm.getSpeed1()); updateBlock.addLEShort(fm.getSpeed2()); updateBlock.addByteC(fm.getDirection()); }
private static void appendUnknownMask(Player p, PacketBuilder updateBlock) { updateBlock.addByteC(1); updateBlock.addLEShort(65465); updateBlock.addByteA(21); updateBlock.addUShort(434454); }
private static void appendChatTextUpdate(Player p, PacketBuilder updateBlock) { updateBlock.addLEShort((p.getLastChatMessage().getColour() << 8) + p.getLastChatMessage().getEffect()); updateBlock.addByte((byte)p.getRights()); byte[] chatStr = p.getLastChatMessage().getPacked(); updateBlock.addByte((byte)(chatStr.Length)); updateBlock.addBytesReverse(chatStr, chatStr.Length, 0); //} }
private static void appendUpdateBlock(Npc Npc, PacketBuilder updateBlock) { int mask = 0x0; if (Npc.getUpdateFlags().isHit2UpdateRequired()) { mask |= 0x2; } if (Npc.getUpdateFlags().isEntityFocusUpdateRequired()) { mask |= 0x4; } if (Npc.getUpdateFlags().isAnimationUpdateRequired()) { mask |= 0x10; } if (Npc.getUpdateFlags().isForceTextUpdateRequired()) { mask |= 0x20; } if (Npc.getUpdateFlags().isHitUpdateRequired()) { mask |= 0x40; } if (Npc.getUpdateFlags().isGraphicsUpdateRequired()) { mask |= 0x80; } if (Npc.getUpdateFlags().isFaceLocationUpdateRequired()) { mask |= 0x200; } if (mask >= 0x100) { mask |= 0x8; updateBlock.addLEShort(mask); //updateBlock.addByte((byte)(mask & 0xFF)); //updateBlock.addByte((byte)(mask >> 8)); } else { updateBlock.addByte((byte)(mask & 0xFF)); } if (Npc.getUpdateFlags().isHitUpdateRequired()) { appendHitUpdate(Npc, updateBlock); } if (Npc.getUpdateFlags().isHit2UpdateRequired()) { appendHit2Update(Npc, updateBlock); } if (Npc.getUpdateFlags().isAnimationUpdateRequired()) { appendAnimationUpdate(Npc, updateBlock); } if (Npc.getUpdateFlags().isEntityFocusUpdateRequired()) { appendEntityFocusUdate(Npc, updateBlock); } if (Npc.getUpdateFlags().isGraphicsUpdateRequired()) { appendGraphicsUpdate(Npc, updateBlock); } //0x1 if (Npc.getUpdateFlags().isForceTextUpdateRequired()) { appendForceTextUpdate(Npc, updateBlock); } //0x100 if (Npc.getUpdateFlags().isFaceLocationUpdateRequired()) { appendFaceLocationUpdate(Npc, updateBlock); } }
private static void appendGraphicsUpdate(Player p, PacketBuilder updateBlock) { updateBlock.addLEShort(p.getLastGraphics().getId()); updateBlock.addInt2(p.getLastGraphics().getHeight() << 16 + p.getLastGraphics().getDelay()); }
private static void appendUpdateBlock(Player p, PacketBuilder updateBlock, bool forceAppearance) { int mask = 0x0; AppearanceUpdateFlags flags = p.getUpdateFlags(); if (flags.isHitUpdateRequired()) { mask |= 0x1; } if (flags.isEntityFocusUpdateRequired()) { mask |= 0x2; } if (flags.isAppearanceUpdateRequired() || forceAppearance) { mask |= 0x4; } if (flags.isAnimationUpdateRequired()) { mask |= 0x8; } if (flags.isForceTextUpdateRequired()) { mask |= 0x20; } if (flags.isFaceLocationUpdateRequired()) { mask |= 0x40; } if (flags.isChatTextUpdateRequired()) { mask |= 0x80; } if (flags.isGraphicsUpdateRequired()) { mask |= 0x100; } if (flags.isHit2UpdateRequired()) { mask |= 0x200; } if (flags.isForceMovementRequired()) { mask |= 0x400; //mask |= 0x800; } if (mask >= 0x100) //0x100=256 [full byte], so use two bytes. { mask |= 0x10; updateBlock.addLEShort(mask); //updateBlock.addByte((byte)(mask & 0xFF)); //updateBlock.addByte((byte)(mask >> 8)); } else { updateBlock.addByte((byte)(mask & 0xFF)); } if (flags.isChatTextUpdateRequired()) { appendChatTextUpdate(p, updateBlock); } if (flags.isHitUpdateRequired()) { appendHitUpdate(p, updateBlock); } if (flags.isAnimationUpdateRequired()) { appendAnimationUpdate(p, updateBlock); } if (flags.isAppearanceUpdateRequired() || forceAppearance) { appendAppearanceUpdate(p, updateBlock); } if (flags.isEntityFocusUpdateRequired()) { appendFaceEntityUpdate(p, updateBlock); } if (flags.isForceMovementRequired()) { appendForceMovement(p, updateBlock); } if (flags.isForceTextUpdateRequired()) { appendForceTextUpdate(p, updateBlock); } if (flags.isHit2UpdateRequired()) { appendHit2Update(p, updateBlock); } if (flags.isGraphicsUpdateRequired()) { appendGraphicsUpdate(p, updateBlock); } if (flags.isFaceLocationUpdateRequired()) { appendFaceLocationUpdate(p, updateBlock); } }