public void Handle(int opcode, JagexBuffer buffer)
        {
            var index = buffer.ReadUShort();
            var size  = buffer.ReadUShort();
            var desc  = GameContext.Cache.GetWidgetConfig(index);

            if (desc == null)
            {
                return;
            }

            if (desc.ItemIndices == null)
            {
                return;
            }

            for (var i = 0; i < size; i++)
            {
                var count = buffer.ReadUByte();
                if (count == IntId)
                {
                    count = buffer.ReadImeInt();
                }
                desc.ItemIndices[i] = buffer.ReadLEUShortA();
                desc.ItemAmounts[i] = count;
                GameContext.InvalidateItemTexture(index, i);
            }
        }
Esempio n. 2
0
        public GraphicConfig(JagexBuffer s)
        {
            SetDefaults();

            var opcode = s.ReadUByte();

            while (opcode != 0)
            {
                if (opcode == 1)
                {
                    ModelIndex = s.ReadUShort();
                }
                else if (opcode == 2)
                {
                    SequenceIndex = s.ReadUShort();
                    Sequence      = GameContext.Cache.GetSeq(SequenceIndex);
                }
                else if (opcode == 4)
                {
                    Scale = s.ReadUShort();
                }
                else if (opcode == 5)
                {
                    Height = s.ReadUShort();
                }
                else if (opcode == 6)
                {
                    Rotation = s.ReadUByte();
                }
                else if (opcode == 7)
                {
                    Brightness = s.ReadUByte();
                }
                else if (opcode == 8)
                {
                    Specular = s.ReadUByte();
                }

                opcode = s.ReadUByte();
            }

            int colorCumulative = 0;

            if (OldColors != null && OldColors.Length > 0)
            {
                foreach (var j in NewColors)
                {
                    colorCumulative += j;
                }
            }

            UniqueId  = (ModelIndex << 16) | (SequenceIndex << 8);
            UniqueId += colorCumulative;
        }
        public void Handle(int opcode, JagexBuffer buffer)
        {
            var index    = buffer.ReadUByte();
            var exp      = buffer.ReadMeInt();
            var level    = buffer.ReadUShort();
            var maxLevel = buffer.ReadUShort();

            GameContext.SkillExperiences[index]   = exp;
            GameContext.SkillCurrentLevels[index] = level;
            GameContext.SkillMaxLevels[index]     = 1;
            for (int i = 0; i < 98; i++)
            {
                if (exp >= GameConstants.SkillXPTable[i])
                {
                    GameContext.SkillMaxLevels[index] = i + 2;
                }
            }
        }
        public void Handle(int opcode, JagexBuffer buffer)
        {
            var widgetId = buffer.ReadUShort();

            if (widgetId == InvalidId)
            {
                widgetId = 0;
            }

            int tabIndex = buffer.ReadUByteA();

            GameContext.TabArea.Tabs[tabIndex].WidgetId = widgetId;
        }