public static void HandleRegularEquipScroll(MapleClient c, PacketReader pr)
        {
            MapleCharacter chr = c.Account.Character;

            if (!chr.DisableActions())
            {
                return;
            }

            //[BC E0 27 09] [09 00] [05 00] [01 00] [00]
            int   tickCount       = pr.ReadInt();
            short useSlot         = pr.ReadShort();
            short equipSlot       = pr.ReadShort();
            short whiteScrollMask = pr.ReadShort();
            bool  whiteScroll     = (whiteScrollMask & 0x2) > 0;
            //1 byte left, don't know what it is
            MapleEquip equip;
            MapleItem  scroll;

            if (GetAndCheckItemsFromInventory(chr.Inventory, equipSlot, useSlot, out equip, out scroll))
            {
                if (scroll.ItemType == MapleItemType.RegularEquipScroll)
                {
                    MapleEquipEnhancer.UseRegularEquipScroll(chr, equip, scroll, whiteScroll);
                }
            }
            chr.EnableActions(false);
        }
Esempio n. 2
0
        public override bool CubeAndRevealEquip(dynamic dEquip, int cubeIndex)
        {
            MapleEquip equip = dEquip as MapleEquip;

            if (equip == null)
            {
                return(false);
            }
            CubeType cubeType = (CubeType)cubeIndex;

            return(MapleEquipEnhancer.CubeItem(equip, cubeType, Character, true));
        }
        public static void HandlePotentialScroll(MapleClient c, PacketReader pr)
        {
            MapleCharacter chr = c.Account.Character;

            if (!chr.DisableActions())
            {
                return;
            }

            int        tickCount = pr.ReadInt();
            short      useSlot   = pr.ReadShort();
            short      equipSlot = pr.ReadShort();
            MapleEquip equip;
            MapleItem  scroll;

            if (GetAndCheckItemsFromInventory(chr.Inventory, equipSlot, useSlot, out equip, out scroll))
            {
                MapleEquipEnhancer.UsePotentialScroll(equip, scroll, chr);
            }
            chr.EnableActions(false);
        }
        public static void Handle(MapleClient c, PacketReader pr)
        {
            MapleCharacter chr = c.Account.Character;

            if (!chr.DisableActions())
            {
                return;
            }
            int       tickCount  = pr.ReadInt();
            short     slot       = pr.ReadShort();
            int       itemId     = pr.ReadInt();
            MapleItem item       = chr.Inventory.GetItemSlotFromInventory(ItemConstants.GetInventoryType(itemId), slot);
            bool      removeItem = true;

            if (item == null || item.ItemId != itemId)
            {
                return;
            }


            switch (itemId)
            {
            case 5062006:     //Platinum Miracle Cube
            {
                int equipSlot = pr.ReadInt();
                if (equipSlot < 0)
                {
                    return;
                }
                MapleEquip equip = chr.Inventory.GetItemSlotFromInventory(MapleInventoryType.Equip, (short)equipSlot) as MapleEquip;
                if (equip == null)
                {
                    return;
                }
                if (!MapleEquipEnhancer.CubeItem(equip, CubeType.PlatinumMiracle, chr))
                {
                    removeItem = false;
                }
                break;
            }

            case 5072000:     //Super Megaphone
            case 5072001:     //Super Megaphone
            {
                if (!CanMegaPhone(c.Account.Character))
                {
                    chr.EnableActions();
                    break;
                }
                string message = pr.ReadMapleString();
                if (message.Length > 60)
                {
                    return;
                }
                bool whisperIcon = pr.ReadBool();
                message = string.Format("{0} : {1}", c.Account.Character.Name, message);
                Program.BroadCastWorldPacket(MapleCharacter.ServerNotice(message, 3, c.Channel, whisperIcon));
                break;
            }

            case 5570000:           //Vicious hammer
            {
                removeItem = false; //Handled in UseGoldenHammerHandler
                pr.Skip(4);
                short      equipSlot = (short)pr.ReadInt();
                MapleEquip equip     = chr.Inventory.GetItemSlotFromInventory(MapleInventoryType.Equip, equipSlot) as MapleEquip;
                if (equip != null)
                {
                    UseGoldenHammerHandler.DoHammer(item, equip, chr);
                }
                break;
            }

            default:
            {
                ServerConsole.Warning("Unhandled UseSpecialItem: {0}", itemId);
                removeItem = false;
                chr.SendPopUpMessage("You cannot use this item");
                chr.EnableActions();
                break;
            }
            }
            if (removeItem)
            {
                chr.Inventory.RemoveItemsFromSlot(item.InventoryType, item.Position, 1);
            }
            chr.EnableActions(false);
        }
        public static void HandleCube(MapleClient c, PacketReader pr)
        {
            MapleCharacter chr = c.Account.Character;

            if (!chr.DisableActions())
            {
                return;
            }

            int        tickCount = pr.ReadInt();
            short      useSlot   = pr.ReadShort();
            short      equipSlot = pr.ReadShort();
            MapleEquip equip;
            MapleItem  cube;

            if (GetAndCheckItemsFromInventory(chr.Inventory, equipSlot, useSlot, out equip, out cube))
            {
                CubeType cubeType;
                switch (cube.ItemId)
                {
                //Occult:
                case 2710000:
                case 2711000:
                case 2710001:
                {
                    cubeType = CubeType.Occult;
                    break;
                }

                //Master craftsman:
                case 2710002:
                case 2710007:
                case 2711003:
                case 2711005:
                {
                    cubeType = CubeType.MasterCraftsman;
                    break;
                }

                //Meister:
                case 2710003:
                case 2711004:
                case 2711006:
                {
                    cubeType = CubeType.Meister;
                    break;
                }

                default:
                {
                    chr.SendPopUpMessage("You cannot use this item");
                    chr.EnableActions();
                    return;
                }
                }
                if (MapleEquipEnhancer.CubeItem(equip, cubeType, chr))
                {
                    chr.Inventory.RemoveItemsFromSlot(MapleInventoryType.Use, cube.Position, 1);
                    chr.EnableActions(false);
                }
            }
        }