Example #1
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);
            }
        }