Exemplo n.º 1
0
        public SkillResults CompleteRegular(MabiCreature creature, MabiPacket packet, SkillConst skillId, uint part)
        {
            var x = packet.GetShort();
            var y = packet.GetShort();

            // Map for the selected slot
            byte map = creature.Temp.SkillItem1.DataInfo.ColorMap1;
            if (part == 1)
                map = creature.Temp.SkillItem1.DataInfo.ColorMap2;
            else if (part == 2)
                map = creature.Temp.SkillItem1.DataInfo.ColorMap3;

            // Imaginary index for the map
            switch (map)
            {
                default:
                case 1: map = 0xE0; break;  // Cloth
                case 2: map = 0xE1; break;  // Leather
                case 5: map = 0xE2; break;  // Metal
                case 23: map = 0xE3; break; // Weapon
                case 24: map = 0xE4; break; // Hilt
            }

            // Random color from the available ones
            var rndNr = (byte)RandomProvider.Get().Next(5);
            x = (ushort)((x + creature.Temp.DyeCursors[rndNr * 4 + 0] - creature.Temp.DyeCursors[rndNr * 4 + 1]) & 0xFF);
            y = (ushort)((y + creature.Temp.DyeCursors[rndNr * 4 + 2] - creature.Temp.DyeCursors[rndNr * 4 + 3]) & 0xFF);
            rndNr += 1;

            // Change color
            var color = MabiData.ColorMapDb.GetAt(map, x -= 1, y -= 1);
            switch (part)
            {
                default:
                case 0: creature.Temp.SkillItem1.Info.ColorA = color; break;
                case 1: creature.Temp.SkillItem1.Info.ColorB = color; break;
                case 2: creature.Temp.SkillItem1.Info.ColorC = color; break;
            }

            this.DyeSuccess(creature);

            Send.AcquireDyedItem(creature.Client, creature, creature.Temp.SkillItem1.Id, rndNr);
            Send.DyeSkillComplete(creature.Client, creature, skillId, part, x, y);

            return SkillResults.Okay;
        }
Exemplo n.º 2
0
        public override SkillResults Use(MabiCreature creature, MabiSkill skill, MabiPacket packet)
        {
            if (creature.Temp.SkillItem1 == null || creature.Temp.SkillItem2 == null)
                return SkillResults.Failure;

            var part = packet.GetInt();

            // Regular
            if (packet.GetElementType() == ElementType.Short)
            {
                var x = packet.GetShort();
                var y = packet.GetShort();

                Send.SkillUseDye(creature.Client, creature, skill.Id, part, x, y);
            }
            // Fixed
            else if (packet.GetElementType() == ElementType.Byte)
            {
                var unk = packet.GetByte();

                Send.SkillUseDye(creature.Client, creature, skill.Id, part, unk);
            }

            return SkillResults.Okay;
        }