Пример #1
0
        public IActionResult DoAction(Guid instanceId, string actionName)
        {
            IBoxHostAction action = null;

            switch (actionName)
            {
            case "Maximize":
                action = new MaximizeBoxAction();
                break;

            case "Minimize":
                action = new MinimizeBoxAction();
                break;

            case "Normalize":
                action = new NormalizeBoxAction();
                break;

            case "Close":
                action = new CloseBoxAction();
                break;
            }

            BoxInstance instance = _boxHostController.Instances[instanceId];

            action.PerformAction(instance.Host, instance.Box, _boxHostController);

            return(Ok());
        }
Пример #2
0
        public string GenerateRCBList(CBListPacket packet)
        {
            string itembazar = string.Empty;

            List <string>         itemssearch = packet.ItemVNumFilter == "0" ? new List <string>() : packet.ItemVNumFilter.Split(' ').ToList();
            List <BazaarItemLink> bzlist      = new List <BazaarItemLink>();

            BazaarItemLink[] billist = new BazaarItemLink[ServerManager.Instance.BazaarList.Count + 20];
            ServerManager.Instance.BazaarList.CopyTo(billist);
            foreach (BazaarItemLink bz in billist)
            {
                if (bz?.Item == null)
                {
                    continue;
                }

                switch (packet.TypeFilter)
                {
                case 1:                                                                                                                                                                                                              //weapon
                    if (bz.Item.Item.Type == InventoryType.Equipment && bz.Item.Item.ItemType == ItemType.Weapon)                                                                                                                    //WeaponFilter
                    {
                        if (packet.SubTypeFilter == 0 || ((bz.Item.Item.Class + 1 >> packet.SubTypeFilter) & 1) == 1)                                                                                                                //Class Filter
                        {
                            if (packet.LevelFilter == 0 || packet.LevelFilter == 11 && bz.Item.Item.IsHeroic || bz.Item.Item.LevelMinimum < packet.LevelFilter * 10 + 1 && bz.Item.Item.LevelMinimum >= packet.LevelFilter * 10 - 9) //Level filter
                            {
                                if (packet.RareFilter == 0 || packet.RareFilter == bz.Item.Rare + 1)                                                                                                                                 //rare filter
                                {
                                    if (packet.UpgradeFilter == 0 || packet.UpgradeFilter == bz.Item.Upgrade + 1)                                                                                                                    //upgrade filter
                                    {
                                        bzlist.Add(bz);
                                    }
                                }
                            }
                        }
                    }
                    break;

                case 2:    //armor
                    if (bz.Item.Item.Type == InventoryType.Equipment && bz.Item.Item.ItemType == ItemType.Armor)
                    {
                        if (packet.SubTypeFilter == 0 || ((bz.Item.Item.Class + 1 >> packet.SubTypeFilter) & 1) == 1)                                                                                                                //Class Filter
                        {
                            if (packet.LevelFilter == 0 || packet.LevelFilter == 11 && bz.Item.Item.IsHeroic || bz.Item.Item.LevelMinimum < packet.LevelFilter * 10 + 1 && bz.Item.Item.LevelMinimum >= packet.LevelFilter * 10 - 9) //Level filter
                            {
                                if (packet.RareFilter == 0 || packet.RareFilter == bz.Item.Rare + 1)                                                                                                                                 //rare filter
                                {
                                    if (packet.UpgradeFilter == 0 || packet.UpgradeFilter == bz.Item.Upgrade + 1)                                                                                                                    //upgrade filter
                                    {
                                        bzlist.Add(bz);
                                    }
                                }
                            }
                        }
                    }
                    break;

                case 3:    //Equipment
                    if (bz.Item.Item.Type == InventoryType.Equipment && bz.Item.Item.ItemType == ItemType.Fashion)
                    {
                        if (packet.SubTypeFilter == 0 || packet.SubTypeFilter == 2 && bz.Item.Item.EquipmentSlot == EquipmentType.Mask || packet.SubTypeFilter == 1 && bz.Item.Item.EquipmentSlot == EquipmentType.Hat || packet.SubTypeFilter == 6 && bz.Item.Item.EquipmentSlot == EquipmentType.CostumeHat || packet.SubTypeFilter == 5 && bz.Item.Item.EquipmentSlot == EquipmentType.CostumeSuit || packet.SubTypeFilter == 3 && bz.Item.Item.EquipmentSlot == EquipmentType.Gloves || packet.SubTypeFilter == 4 && bz.Item.Item.EquipmentSlot == EquipmentType.Boots)
                        {
                            if (packet.LevelFilter == 0 || packet.LevelFilter == 11 && bz.Item.Item.IsHeroic || bz.Item.Item.LevelMinimum < packet.LevelFilter * 10 + 1 && bz.Item.Item.LevelMinimum >= packet.LevelFilter * 10 - 9)    //Level filter
                            {
                                bzlist.Add(bz);
                            }
                        }
                    }
                    break;

                case 4:    //Access
                    if (bz.Item.Item.Type == InventoryType.Equipment && bz.Item.Item.ItemType == ItemType.Jewelery)
                    {
                        if (packet.SubTypeFilter == 0 || packet.SubTypeFilter == 2 && bz.Item.Item.EquipmentSlot == EquipmentType.Ring || packet.SubTypeFilter == 1 && bz.Item.Item.EquipmentSlot == EquipmentType.Necklace || packet.SubTypeFilter == 5 && bz.Item.Item.EquipmentSlot == EquipmentType.Amulet || packet.SubTypeFilter == 3 && bz.Item.Item.EquipmentSlot == EquipmentType.Bracelet || packet.SubTypeFilter == 4 && (bz.Item.Item.EquipmentSlot == EquipmentType.Fairy || bz.Item.Item.ItemType == ItemType.Box && bz.Item.Item.ItemSubType == 5))
                        {
                            if (packet.LevelFilter == 0 || packet.LevelFilter == 11 && bz.Item.Item.IsHeroic || bz.Item.Item.LevelMinimum < packet.LevelFilter * 10 + 1 && bz.Item.Item.LevelMinimum >= packet.LevelFilter * 10 - 9)    //Level filter
                            {
                                bzlist.Add(bz);
                            }
                        }
                    }
                    break;

                case 5:    //Specialist
                    if (bz.Item.Item.Type == InventoryType.Equipment)
                    {
                        if (bz.Item.Item.ItemType == ItemType.Box && bz.Item.Item.ItemSubType == 2)
                        {
                            BoxInstance boxInstance = bz.Item as BoxInstance;
                            if (boxInstance != null)
                            {
                                if (packet.SubTypeFilter == 0)
                                {
                                    if (packet.LevelFilter == 0 || ((BoxInstance)bz.Item).SpLevel < packet.LevelFilter * 10 + 1 && ((BoxInstance)bz.Item).SpLevel >= packet.LevelFilter * 10 - 9)
                                    {
                                        if (packet.UpgradeFilter == 0 || packet.UpgradeFilter == bz.Item.Upgrade + 1)
                                        {
                                            if (packet.SubTypeFilter == 0 || packet.SubTypeFilter == 1 && ((BoxInstance)bz.Item).HoldingVNum == 0 || packet.SubTypeFilter == 2 && ((BoxInstance)bz.Item).HoldingVNum != 0)
                                            {
                                                bzlist.Add(bz);
                                            }
                                        }
                                    }
                                }
                                else if (boxInstance.HoldingVNum == 0)
                                {
                                    if (packet.SubTypeFilter == 1)
                                    {
                                        if (packet.LevelFilter == 0 || ((BoxInstance)bz.Item).SpLevel < packet.LevelFilter * 10 + 1 && ((BoxInstance)bz.Item).SpLevel >= packet.LevelFilter * 10 - 9)
                                        {
                                            if (packet.UpgradeFilter == 0 || packet.UpgradeFilter == bz.Item.Upgrade + 1)
                                            {
                                                if (packet.SubTypeFilter == 0 || packet.SubTypeFilter == 1 && ((BoxInstance)bz.Item).HoldingVNum == 0 || packet.SubTypeFilter == 2 && ((BoxInstance)bz.Item).HoldingVNum != 0)
                                                {
                                                    bzlist.Add(bz);
                                                }
                                            }
                                        }
                                    }
                                }
                                else if (packet.SubTypeFilter == 2 && ServerManager.Instance.GetItem(boxInstance.HoldingVNum).Morph == 10 ||
                                         packet.SubTypeFilter == 3 && ServerManager.Instance.GetItem(boxInstance.HoldingVNum).Morph == 11 ||
                                         packet.SubTypeFilter == 4 && ServerManager.Instance.GetItem(boxInstance.HoldingVNum).Morph == 2 ||
                                         packet.SubTypeFilter == 5 && ServerManager.Instance.GetItem(boxInstance.HoldingVNum).Morph == 3 ||
                                         packet.SubTypeFilter == 6 && ServerManager.Instance.GetItem(boxInstance.HoldingVNum).Morph == 13 ||
                                         packet.SubTypeFilter == 7 && ServerManager.Instance.GetItem(boxInstance.HoldingVNum).Morph == 5 ||
                                         packet.SubTypeFilter == 8 && ServerManager.Instance.GetItem(boxInstance.HoldingVNum).Morph == 12 ||
                                         packet.SubTypeFilter == 9 && ServerManager.Instance.GetItem(boxInstance.HoldingVNum).Morph == 4 ||
                                         packet.SubTypeFilter == 10 && ServerManager.Instance.GetItem(boxInstance.HoldingVNum).Morph == 7 ||
                                         packet.SubTypeFilter == 11 && ServerManager.Instance.GetItem(boxInstance.HoldingVNum).Morph == 15 ||
                                         packet.SubTypeFilter == 12 && ServerManager.Instance.GetItem(boxInstance.HoldingVNum).Morph == 6 ||
                                         packet.SubTypeFilter == 13 && ServerManager.Instance.GetItem(boxInstance.HoldingVNum).Morph == 14 ||
                                         packet.SubTypeFilter == 14 && ServerManager.Instance.GetItem(boxInstance.HoldingVNum).Morph == 9 ||
                                         packet.SubTypeFilter == 15 && ServerManager.Instance.GetItem(boxInstance.HoldingVNum).Morph == 8 ||
                                         packet.SubTypeFilter == 16 && ServerManager.Instance.GetItem(boxInstance.HoldingVNum).Morph == 1 ||
                                         packet.SubTypeFilter == 17 && ServerManager.Instance.GetItem(boxInstance.HoldingVNum).Morph == 16 ||
                                         packet.SubTypeFilter == 18 && ServerManager.Instance.GetItem(boxInstance.HoldingVNum).Morph == 17 ||
                                         packet.SubTypeFilter == 19 && ServerManager.Instance.GetItem(boxInstance.HoldingVNum).Morph == 18 ||
                                         packet.SubTypeFilter == 20 && ServerManager.Instance.GetItem(boxInstance.HoldingVNum).Morph == 19 ||
                                         packet.SubTypeFilter == 21 && ServerManager.Instance.GetItem(boxInstance.HoldingVNum).Morph == 20 ||
                                         packet.SubTypeFilter == 22 && ServerManager.Instance.GetItem(boxInstance.HoldingVNum).Morph == 21 ||
                                         packet.SubTypeFilter == 23 && ServerManager.Instance.GetItem(boxInstance.HoldingVNum).Morph == 22 ||
                                         packet.SubTypeFilter == 24 && ServerManager.Instance.GetItem(boxInstance.HoldingVNum).Morph == 23 ||
                                         packet.SubTypeFilter == 25 && ServerManager.Instance.GetItem(boxInstance.HoldingVNum).Morph == 24 ||
                                         packet.SubTypeFilter == 26 && ServerManager.Instance.GetItem(boxInstance.HoldingVNum).Morph == 25 ||
                                         packet.SubTypeFilter == 27 && ServerManager.Instance.GetItem(boxInstance.HoldingVNum).Morph == 26 ||
                                         packet.SubTypeFilter == 28 && ServerManager.Instance.GetItem(boxInstance.HoldingVNum).Morph == 27 ||
                                         packet.SubTypeFilter == 29 && ServerManager.Instance.GetItem(boxInstance.HoldingVNum).Morph == 28)
                                {
                                    if (packet.LevelFilter == 0 || ((BoxInstance)bz.Item).SpLevel < packet.LevelFilter * 10 + 1 && ((BoxInstance)bz.Item).SpLevel >= packet.LevelFilter * 10 - 9)
                                    {
                                        if (packet.UpgradeFilter == 0 || packet.UpgradeFilter == bz.Item.Upgrade + 1)
                                        {
                                            if (packet.SubTypeFilter == 0 || packet.SubTypeFilter == 1 && ((BoxInstance)bz.Item).HoldingVNum == 0 || packet.SubTypeFilter >= 2 && ((BoxInstance)bz.Item).HoldingVNum != 0)
                                            {
                                                bzlist.Add(bz);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    break;

                case 6:    //Pet
                    if (bz.Item.Item.Type == InventoryType.Equipment)
                    {
                        if (bz.Item.Item.ItemType == ItemType.Box && bz.Item.Item.ItemSubType == 0)
                        {
                            BoxInstance instance = bz.Item as BoxInstance;
                            if (instance != null && (packet.LevelFilter == 0 || instance.SpLevel < packet.LevelFilter * 10 + 1 && instance.SpLevel >= packet.LevelFilter * 10 - 9))    //Level filter
                            {
                                if (packet.SubTypeFilter == 0 || packet.SubTypeFilter == 1 && ((BoxInstance)bz.Item).HoldingVNum == 0 || packet.SubTypeFilter == 2 && ((BoxInstance)bz.Item).HoldingVNum != 0)
                                {
                                    bzlist.Add(bz);
                                }
                            }
                        }
                    }
                    break;

                case 7:    //Npc
                    if (bz.Item.Item.Type == InventoryType.Equipment)
                    {
                        if (bz.Item.Item.ItemType == ItemType.Box && bz.Item.Item.ItemSubType == 1)
                        {
                            BoxInstance box = bz.Item as BoxInstance;
                            if (box != null && (packet.LevelFilter == 0 || box.SpLevel < packet.LevelFilter * 10 + 1 && box.SpLevel >= packet.LevelFilter * 10 - 9))    //Level filter
                            {
                                if (packet.SubTypeFilter == 0 || packet.SubTypeFilter == 1 && ((BoxInstance)bz.Item).HoldingVNum == 0 || packet.SubTypeFilter == 2 && ((BoxInstance)bz.Item).HoldingVNum != 0)
                                {
                                    bzlist.Add(bz);
                                }
                            }
                        }
                    }
                    break;

                case 12:    //Vehicle
                    if (bz.Item.Item.ItemType == ItemType.Box && bz.Item.Item.ItemSubType == 4)
                    {
                        BoxInstance box = bz.Item as BoxInstance;
                        if (box != null && (packet.SubTypeFilter == 0 || packet.SubTypeFilter == 1 && box.HoldingVNum == 0 || packet.SubTypeFilter == 2 && box.HoldingVNum != 0))
                        {
                            bzlist.Add(bz);
                        }
                    }
                    break;

                case 8:    //Shell
                    if (bz.Item.Item.Type == InventoryType.Equipment)
                    {
                        if (bz.Item.Item.ItemType == ItemType.Shell)
                        {
                            if (packet.SubTypeFilter == 0 || bz.Item.Item.ItemSubType == bz.Item.Item.ItemSubType + 1)
                            {
                                if (packet.RareFilter == 0 || packet.RareFilter == bz.Item.Rare + 1)     //rare filter
                                {
                                    BoxInstance box = bz.Item as BoxInstance;
                                    if (box != null && (packet.LevelFilter == 0 || box.SpLevel < packet.LevelFilter * 10 + 1 && box.SpLevel >= packet.LevelFilter * 10 - 9))    //Level filter
                                    {
                                        bzlist.Add(bz);
                                    }
                                }
                            }
                        }
                    }
                    break;

                case 9:    //Main
                    if (bz.Item.Item.Type == InventoryType.Main)
                    {
                        if (packet.SubTypeFilter == 0 || packet.SubTypeFilter == 1 && bz.Item.Item.ItemType == ItemType.Main || packet.SubTypeFilter == 2 && bz.Item.Item.ItemType == ItemType.Upgrade || packet.SubTypeFilter == 3 && bz.Item.Item.ItemType == ItemType.Production || packet.SubTypeFilter == 4 && bz.Item.Item.ItemType == ItemType.Special || packet.SubTypeFilter == 5 && bz.Item.Item.ItemType == ItemType.Potion || packet.SubTypeFilter == 6 && bz.Item.Item.ItemType == ItemType.Event)
                        {
                            bzlist.Add(bz);
                        }
                    }
                    break;

                case 10:    //Usable
                    if (bz.Item.Item.Type == InventoryType.Etc)
                    {
                        if (packet.SubTypeFilter == 0 || packet.SubTypeFilter == 1 && bz.Item.Item.ItemType == ItemType.Food || packet.SubTypeFilter == 2 && bz.Item.Item.ItemType == ItemType.Snack || packet.SubTypeFilter == 3 && bz.Item.Item.ItemType == ItemType.Magical || packet.SubTypeFilter == 4 && bz.Item.Item.ItemType == ItemType.Part || packet.SubTypeFilter == 5 && bz.Item.Item.ItemType == ItemType.Teacher || packet.SubTypeFilter == 6 && bz.Item.Item.ItemType == ItemType.Sell)
                        {
                            bzlist.Add(bz);
                        }
                    }
                    break;

                case 11:    //Others
                    if (bz.Item.Item.Type == InventoryType.Equipment)
                    {
                        if (bz.Item.Item.ItemType == ItemType.Box && !bz.Item.Item.IsHolder)
                        {
                            bzlist.Add(bz);
                        }
                    }
                    break;

                default:
                    bzlist.Add(bz);
                    break;
                }
            }
            List <BazaarItemLink> bzlistsearched = bzlist.Where(s => itemssearch.Contains(s.Item.ItemVNum.ToString())).ToList();

            //price up price down quantity up quantity down
            List <BazaarItemLink> definitivelist = itemssearch.Any() ? bzlistsearched : bzlist;

            switch (packet.OrderFilter)
            {
            case 0:
                definitivelist = definitivelist.OrderBy(s => s.Item.Item.Name).ThenBy(s => s.BazaarItem.Price).ToList();
                break;

            case 1:
                definitivelist = definitivelist.OrderBy(s => s.Item.Item.Name).ThenByDescending(s => s.BazaarItem.Price).ToList();
                break;

            case 2:
                definitivelist = definitivelist.OrderBy(s => s.Item.Item.Name).ThenBy(s => s.BazaarItem.Amount).ToList();
                break;

            case 3:
                definitivelist = definitivelist.OrderBy(s => s.Item.Item.Name).ThenByDescending(s => s.BazaarItem.Amount).ToList();
                break;

            default:
                definitivelist = definitivelist.OrderBy(s => s.Item.Item.Name).ToList();
                break;
            }
            foreach (BazaarItemLink bzlink in definitivelist.Where(s => (s.BazaarItem.DateStart.AddHours(s.BazaarItem.Duration) - DateTime.Now).TotalMinutes > 0 && s.Item.Amount > 0).Skip(packet.Index * 50).Take(50))
            {
                long   time = (long)(bzlink.BazaarItem.DateStart.AddHours(bzlink.BazaarItem.Duration) - DateTime.Now).TotalMinutes;
                string info = string.Empty;
                if (bzlink.Item.Item.Type == InventoryType.Equipment)
                {
                    info = (bzlink.Item.Item.EquipmentSlot != EquipmentType.Sp ?
                            (bzlink.Item as WearableInstance).GenerateEInfo() : bzlink.Item.Item.SpType == 0 && bzlink.Item.Item.ItemSubType == 4 ?
                            (bzlink.Item as SpecialistInstance).GeneratePslInfo() : (bzlink.Item as SpecialistInstance).GenerateSlInfo()).Replace(' ', '^').Replace("slinfo^", "").Replace("e_info^", "");
                }

                itembazar += $"{bzlink.BazaarItem.BazaarItemId}|{bzlink.BazaarItem.SellerId}|{bzlink.Owner}|{bzlink.Item.Item.VNum}|{bzlink.Item.Amount}|{(bzlink.BazaarItem.IsPackage ? 1 : 0)}|{bzlink.BazaarItem.Price}|{time}|2|0|{bzlink.Item.Rare}|{bzlink.Item.Upgrade}|{info} ";
            }

            return($"rc_blist {packet.Index} {itembazar} ");
        }
Пример #3
0
        /// <summary>
        ///  guri packet
        /// </summary>
        /// <param name="guriPacket"></param>
        public void Guri(GuriPacket guriPacket)
        {
            if (guriPacket == null)
            {
                return;
            }
            if (guriPacket.Type == 10 && guriPacket.Data >= 973 && guriPacket.Data <= 999 && !Session.Character.EmoticonsBlocked)
            {
                if (guriPacket.User != null && Convert.ToInt64(guriPacket.User.Value) == Session.Character.CharacterId)
                {
                    Session.CurrentMapInstance?.Broadcast(Session, Session.Character.GenerateEff(guriPacket.Data + 4099), ReceiverType.AllNoEmoBlocked);
                }
                else
                {
                    Mate mate = Session.Character.Mates.FirstOrDefault(s => guriPacket.User != null && s.MateTransportId == Convert.ToInt32(guriPacket.User.Value));
                    if (mate != null)
                    {
                        Session.CurrentMapInstance?.Broadcast(Session, mate.GenerateEff(guriPacket.Data + 4099), ReceiverType.AllNoEmoBlocked);
                    }
                }
            }
            else
            {
                switch (guriPacket.Type)
                {
                // SHELL IDENTIFYING
                case 204:
                    if (guriPacket.User == null)
                    {
                        // WRONG PACKET
                        return;
                    }

                    InventoryType    inventoryType = (InventoryType)guriPacket.Argument;
                    ItemInstance     pearls        = Session.Character.Inventory.FirstOrDefault(s => s.Value.ItemVNum == 1429).Value;
                    WearableInstance shell         = (WearableInstance)Session.Character.Inventory.LoadBySlotAndType((short)guriPacket.User.Value, inventoryType);

                    if (pearls == null)
                    {
                        // USING PACKET LOGGER
                        return;
                    }

                    if (shell.EquipmentOptions.Any())
                    {
                        // ALREADY IDENTIFIED
                        Session.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(Language.Instance.GetMessageFromKey("SHELL_ALREADY_IDENTIFIED"), 0));
                        return;
                    }

                    if (!ShellGeneratorHelper.Instance.ShellTypes.TryGetValue(shell.ItemVNum, out byte shellType))
                    {
                        // SHELL TYPE NOT IMPLEMENTED
                        return;
                    }

                    if (shellType != 8 && shellType != 9)
                    {
                        if (shell.Upgrade < 50 || shell.Upgrade > 90)
                        {
                            return;
                        }
                    }

                    if (shellType == 8 || shellType == 9)
                    {
                        switch (shell.Upgrade)
                        {
                        case 25:
                        case 30:
                        case 40:
                        case 55:
                        case 60:
                        case 65:
                        case 70:
                        case 75:
                        case 80:
                        case 85:
                            break;

                        default:
                            Session.Character.Inventory.RemoveItemAmountFromInventory(1, shell.Id);
                            Session.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(Language.Instance.GetMessageFromKey("STOP_SPAWNING_BROKEN_SHELL"), 0));
                            return;
                        }
                    }

                    int perlsNeeded = shell.Upgrade / 10 + shell.Rare;

                    if (Session.Character.Inventory.CountItem(pearls.ItemVNum) < perlsNeeded)
                    {
                        // NOT ENOUGH PEARLS
                        return;
                    }

                    List <EquipmentOptionDTO> shellOptions = ShellGeneratorHelper.Instance.GenerateShell(shellType, shell.Rare, shell.Upgrade);

                    if (!shellOptions.Any())
                    {
                        Session.Character.Inventory.RemoveItemAmountFromInventory(1, shell.Id);
                        Session.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(Language.Instance.GetMessageFromKey("STOP_SPAWNING_BROKEN_SHELL"), 0));
                        return;
                    }

                    shell.EquipmentOptions.AddRange(shellOptions);

                    Session.Character.Inventory.RemoveItemAmount(pearls.ItemVNum, perlsNeeded);
                    Session.CurrentMapInstance?.Broadcast(Session, Session.Character.GenerateEff(3006));
                    Session.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(Language.Instance.GetMessageFromKey("SHELL_IDENTIFIED"), 0));
                    break;

                case 205:
                    if (guriPacket.User == null)
                    {
                        return;
                    }
                    const int        perfumeVnum          = 1428;
                    InventoryType    perfumeInventoryType = (InventoryType)guriPacket.Argument;
                    WearableInstance eq = (WearableInstance)Session.Character.Inventory.LoadBySlotAndType((short)guriPacket.User.Value, perfumeInventoryType);

                    if (eq.BoundCharacterId == Session.Character.CharacterId)
                    {
                        // ALREADY YOURS
                        return;
                    }
                    if (eq.ShellRarity == null)
                    {
                        // NO SHELL APPLIED
                        return;
                    }

                    int perfumesNeeded = ShellGeneratorHelper.Instance.PerfumeFromItemLevelAndShellRarity(eq.Item.LevelMinimum, (byte)eq.ShellRarity.Value);
                    if (Session.Character.Inventory.CountItem(perfumeVnum) < perfumesNeeded)
                    {
                        // NOT ENOUGH PEARLS
                        return;
                    }

                    Session.Character.Inventory.RemoveItemAmount(perfumeVnum, perfumesNeeded);
                    eq.BoundCharacterId = Session.Character.CharacterId;
                    break;

                case 300:
                    if (guriPacket.Argument == 8023)
                    {
                        if (guriPacket.User == null)
                        {
                            return;
                        }
                        short        slot = (short)guriPacket.User.Value;
                        ItemInstance box  = Session.Character.Inventory.LoadBySlotAndType <BoxInstance>(slot, InventoryType.Equipment);
                        if (box != null)
                        {
                            if (guriPacket.Data > 0)
                            {
                                box.Item.Use(Session, ref box, 1, new[] { guriPacket.Data.ToString() });
                            }
                            else
                            {
                                box.Item.Use(Session, ref box, 1);
                            }
                        }
                    }
                    break;

                case 501:
                    if (ServerManager.Instance.IceBreakerInWaiting && IceBreaker.Map.Sessions.Count() < IceBreaker.MaxAllowedPlayers)
                    {
                        ServerManager.Instance.TeleportOnRandomPlaceInMap(Session, IceBreaker.Map.MapInstanceId);
                    }
                    break;

                case 502:
                    long?charid = guriPacket.User;
                    if (charid == null)
                    {
                        return;
                    }
                    ClientSession target = ServerManager.Instance.GetSessionByCharacterId(charid.Value);
                    IceBreaker.FrozenPlayers.Remove(target);
                    IceBreaker.AlreadyFrozenPlayers.Add(target);
                    target?.CurrentMapInstance?.Broadcast(
                        UserInterfaceHelper.Instance.GenerateMsg(string.Format(Language.Instance.GetMessageFromKey("ICEBREAKER_PLAYER_UNFROZEN"), target.Character?.Name), 0));
                    break;

                case 506:
                    if (ServerManager.Instance.EventInWaiting)
                    {
                        Session.Character.IsWaitingForEvent = true;
                    }
                    break;

                default:
                    if (guriPacket.Type == 199 && guriPacket.Argument == 2)
                    {
                        short[] listWingOfFriendship = { 2160, 2312, 10048 };
                        short   vnumToUse            = -1;
                        foreach (short vnum in listWingOfFriendship)
                        {
                            if (Session.Character.Inventory.CountItem(vnum) > 0)
                            {
                                vnumToUse = vnum;
                            }
                        }
                        if (vnumToUse != -1)
                        {
                            if (guriPacket.User == null)
                            {
                                return;
                            }
                            if (!long.TryParse(guriPacket.User.Value.ToString(), out long charId))
                            {
                                return;
                            }
                            ClientSession session = ServerManager.Instance.GetSessionByCharacterId(charId);
                            if (session != null)
                            {
                                if (Session.Character.IsFriendOfCharacter(charId))
                                {
                                    if (session.CurrentMapInstance.MapInstanceType == MapInstanceType.BaseMapInstance)
                                    {
                                        if (Session.Character.MapInstance.MapInstanceType != MapInstanceType.BaseMapInstance)
                                        {
                                            Session.SendPacket(Session.Character.GenerateSay(Language.Instance.GetMessageFromKey("CANT_USE_THAT"), 10));
                                            return;
                                        }
                                        short mapy  = session.Character.PositionY;
                                        short mapx  = session.Character.PositionX;
                                        short mapId = session.Character.MapInstance.Map.MapId;

                                        ServerManager.Instance.ChangeMap(Session.Character.CharacterId, mapId, mapx, mapy);
                                        Session.Character.Inventory.RemoveItemAmount(vnumToUse);
                                    }
                                    else
                                    {
                                        if (Session.Character.MapInstance.MapInstanceType == MapInstanceType.Act4Instance && session.Character.Faction == Session.Character.Faction)
                                        {
                                            short mapy  = session.Character.PositionY;
                                            short mapx  = session.Character.PositionX;
                                            Guid  mapId = session.CurrentMapInstance.MapInstanceId;

                                            ServerManager.Instance.ChangeMapInstance(Session.Character.CharacterId, mapId, mapx, mapy);
                                            Session.Character.Inventory.RemoveItemAmount(vnumToUse);
                                        }
                                        else
                                        {
                                            Session.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(Language.Instance.GetMessageFromKey("USER_ON_INSTANCEMAP"), 0));
                                        }
                                    }
                                }
                            }
                            else
                            {
                                Session.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(Language.Instance.GetMessageFromKey("USER_NOT_CONNECTED"), 0));
                            }
                        }
                        else
                        {
                            Session.SendPacket(Session.Character.GenerateSay(Language.Instance.GetMessageFromKey("NO_WINGS"), 10));
                        }
                    }
                    else
                    {
                        switch (guriPacket.Type)
                        {
                        case 400:
                            if (guriPacket.Argument != 0)
                            {
                                if (!Session.HasCurrentMapInstance)
                                {
                                    return;
                                }
                                MapNpc npc = Session.CurrentMapInstance.Npcs.FirstOrDefault(n => n.MapNpcId.Equals(guriPacket.Argument));
                                if (npc != null)
                                {
                                    NpcMonster mapobject = ServerManager.Instance.GetNpc(npc.NpcVNum);

                                    int rateDrop = ServerManager.Instance.DropRate;
                                    int delay    = (int)Math.Round((3 + mapobject.RespawnTime / 1000d) * Session.Character.TimesUsed);
                                    delay = delay > 11 ? 8 : delay;
                                    if (Session.Character.LastMapObject.AddSeconds(delay) < DateTime.Now)
                                    {
                                        if (mapobject.Drops.Any(s => s.MonsterVNum != null))
                                        {
                                            if (mapobject.VNumRequired > 10 && Session.Character.Inventory.CountItem(mapobject.VNumRequired) < mapobject.AmountRequired)
                                            {
                                                Session.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(Language.Instance.GetMessageFromKey("NOT_ENOUGH_ITEM"), 0));
                                                return;
                                            }
                                        }
                                        Random  random       = new Random();
                                        double  randomAmount = ServerManager.Instance.RandomNumber() * random.NextDouble();
                                        DropDTO drop         = mapobject.Drops.FirstOrDefault(s => s.MonsterVNum == npc.NpcVNum);
                                        if (drop != null)
                                        {
                                            if (npc.NpcVNum == 2004 && npc.IsOut == false)
                                            {
                                                ItemInstance newInv = Session.Character.Inventory.AddNewToInventory(drop.ItemVNum).FirstOrDefault();
                                                if (newInv == null)
                                                {
                                                    return;
                                                }
                                                Session.CurrentMapInstance.Broadcast(npc.GenerateOut());
                                                Session.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(
                                                                       string.Format(Language.Instance.GetMessageFromKey("RECEIVED_ITEM"), newInv.Item.Name), 0));
                                                Session.SendPacket(Session.Character.GenerateSay(string.Format(Language.Instance.GetMessageFromKey("RECEIVED_ITEM"), newInv.Item.Name), 11));
                                                return;
                                            }
                                            int dropChance = drop.DropChance;
                                            if (randomAmount <= (double)dropChance * rateDrop / 5000.000)
                                            {
                                                short        vnum   = drop.ItemVNum;
                                                ItemInstance newInv = Session.Character.Inventory.AddNewToInventory(vnum).FirstOrDefault();
                                                Session.Character.LastMapObject = DateTime.Now;
                                                Session.Character.TimesUsed++;
                                                if (Session.Character.TimesUsed >= 4)
                                                {
                                                    Session.Character.TimesUsed = 0;
                                                }
                                                if (newInv != null)
                                                {
                                                    Session.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(
                                                                           string.Format(Language.Instance.GetMessageFromKey("RECEIVED_ITEM"), newInv.Item.Name), 0));
                                                    Session.SendPacket(Session.Character.GenerateSay(string.Format(Language.Instance.GetMessageFromKey("RECEIVED_ITEM"), newInv.Item.Name),
                                                                                                     11));
                                                }
                                                else
                                                {
                                                    Session.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(Language.Instance.GetMessageFromKey("NOT_ENOUGH_PLACE"), 0));
                                                }
                                            }
                                            else
                                            {
                                                Session.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(Language.Instance.GetMessageFromKey("TRY_FAILED"), 0));
                                            }
                                        }
                                    }
                                    else
                                    {
                                        Session.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(
                                                               string.Format(Language.Instance.GetMessageFromKey("TRY_FAILED_WAIT"),
                                                                             (int)(Session.Character.LastMapObject.AddSeconds(delay) - DateTime.Now).TotalSeconds), 0));
                                    }
                                }
                            }
                            break;

                        case 710:
                            if (guriPacket.Value != null)
                            {
                                // MapNpc npc = Session.CurrentMapInstance.Npcs.FirstOrDefault(n =>
                                // n.MapNpcId.Equals(Convert.ToInt16(guriPacket.Data)); NpcMonster mapObject
                                // = ServerManager.Instance.GetNpc(npc.NpcVNum); teleport free
                            }
                            break;

                        case 750:
                            if (!guriPacket.User.HasValue)
                            {
                                const short baseVnum = 1623;
                                if (short.TryParse(guriPacket.Argument.ToString(), out short faction))
                                {
                                    if (Session.Character.Inventory.CountItem(baseVnum + faction) > 0)
                                    {
                                        Session.Character.Faction = (FactionType)faction;
                                        Session.Character.Inventory.RemoveItemAmount(baseVnum + faction);
                                        Session.SendPacket("scr 0 0 0 0 0 0 0");
                                        Session.SendPacket(Session.Character.GenerateFaction());
                                        Session.SendPacket(Session.Character.GenerateEff(4799 + faction));
                                        Session.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(Language.Instance.GetMessageFromKey($"GET_PROTECTION_POWER_{faction}"), 0));
                                    }
                                }
                            }
                            break;

                        case 2:
                            Session.CurrentMapInstance?.Broadcast(UserInterfaceHelper.Instance.GenerateGuri(2, 1, Session.Character.CharacterId), Session.Character.PositionX,
                                                                  Session.Character.PositionY);
                            break;

                        case 4:
                            const int speakerVNum = 2173;
                            const int petnameVNum = 2157;
                            switch (guriPacket.Argument)
                            {
                            case 1:
                                Mate mate = Session.Character.Mates.FirstOrDefault(s => s.MateTransportId == guriPacket.Data);
                                if (guriPacket.Value.Length > 15)
                                {
                                    Session.SendPacket(UserInterfaceHelper.Instance.GenerateInfo(Language.Instance.GetMessageFromKey("NEW_NAME_PET_MAX_LENGTH")));
                                    return;
                                }
                                if (mate != null)
                                {
                                    mate.Name = guriPacket.Value;
                                    Session.CurrentMapInstance.Broadcast(mate.GenerateOut());
                                    Session.CurrentMapInstance.Broadcast(mate.GenerateIn());
                                    Session.SendPacket(UserInterfaceHelper.Instance.GenerateInfo(Language.Instance.GetMessageFromKey("NEW_NAME_PET")));
                                    Session.SendPacket(Session.Character.GeneratePinit());
                                    Session.SendPackets(Session.Character.GeneratePst());
                                    Session.SendPackets(Session.Character.GenerateScP());
                                    Session.Character.Inventory.RemoveItemAmount(petnameVNum);
                                }
                                break;

                            case 2:
                                int presentationVNum = Session.Character.Inventory.CountItem(1117) > 0 ? 1117 : (Session.Character.Inventory.CountItem(9013) > 0 ? 9013 : -1);
                                if (presentationVNum != -1)
                                {
                                    string message = string.Empty;

                                    // message = $" ";
                                    string[] valuesplit = guriPacket.Value.Split(' ');
                                    message = valuesplit.Aggregate(message, (current, t) => current + t + "^");
                                    message = message.Substring(0, message.Length - 1);             // Remove the last ^
                                    message = message.Trim();
                                    if (message.Length > 60)
                                    {
                                        message = message.Substring(0, 60);
                                    }

                                    Session.Character.Biography = message;
                                    Session.SendPacket(Session.Character.GenerateSay(Language.Instance.GetMessageFromKey("INTRODUCTION_SET"), 10));
                                    Session.Character.Inventory.RemoveItemAmount(presentationVNum);
                                }
                                break;

                            case 3:
                                if (Session.Character.Inventory.CountItem(speakerVNum) > 0)
                                {
                                    if (Session.Character == null || guriPacket.Value == null)
                                    {
                                        return;
                                    }
                                    string   message    = $"<{Language.Instance.GetMessageFromKey("SPEAKER")}> [{Session.Character.Name}]:";
                                    string[] valuesplit = guriPacket.Value.Split(' ');
                                    message = valuesplit.Aggregate(message, (current, t) => current + t + " ");
                                    if (message.Length > 120)
                                    {
                                        message = message.Substring(0, 120);
                                    }

                                    message = message.Trim();

                                    if (Session.Character.IsMuted())
                                    {
                                        Session.SendPacket(Session.Character.GenerateSay(Language.Instance.GetMessageFromKey("SPEAKER_CANT_BE_USED"), 10));
                                        return;
                                    }
                                    Session.Character.Inventory.RemoveItemAmount(speakerVNum);
                                    ServerManager.Instance.Broadcast(Session.Character.GenerateSay(message, 13));
                                    LogHelper.Instance.InsertChatLog(ChatType.Speaker, Session.Character.CharacterId, message, Session.IpAddress);
                                }
                                break;
                            }

                            // presentation message

                            // Speaker
                            break;

                        default:
                            if (guriPacket.Type == 199 && guriPacket.Argument == 1)
                            {
                                if (guriPacket.User != null && long.TryParse(guriPacket.User.Value.ToString(), out long charId))
                                {
                                    if (!Session.Character.IsFriendOfCharacter(charId))
                                    {
                                        Session.SendPacket(Language.Instance.GetMessageFromKey("CHARACTER_NOT_IN_FRIENDLIST"));
                                        return;
                                    }
                                    Session.SendPacket(UserInterfaceHelper.Instance.GenerateDelay(3000, 4, $"#guri^199^2^{guriPacket.User.Value}"));
                                }
                            }
                            else
                            {
                                switch (guriPacket.Type)
                                {
                                case 201:
                                    if (Session.Character.StaticBonusList.Any(s => s.StaticBonusType == StaticBonusType.PetBasket))
                                    {
                                        Session.SendPacket(Session.Character.GenerateStashAll());
                                    }
                                    break;

                                case 202:
                                    Session.SendPacket(Session.Character.GenerateSay(Language.Instance.GetMessageFromKey("PARTNER_BACKPACK"), 10));
                                    Session.SendPacket(Session.Character.GeneratePStashAll());
                                    break;

                                default:
                                    if (guriPacket.Type == 208 && guriPacket.Argument == 0)
                                    {
                                        if (guriPacket.User != null && short.TryParse(guriPacket.User.Value.ToString(), out short pearlSlot) &&
                                            short.TryParse(guriPacket.Value, out short mountSlot))
                                        {
                                            ItemInstance mount = Session.Character.Inventory.LoadBySlotAndType <ItemInstance>(mountSlot, InventoryType.Main);
                                            BoxInstance  pearl = Session.Character.Inventory.LoadBySlotAndType <BoxInstance>(pearlSlot, InventoryType.Equipment);
                                            if (mount != null && pearl != null)
                                            {
                                                pearl.HoldingVNum = mount.ItemVNum;
                                                Session.Character.Inventory.RemoveItemAmountFromInventory(1, mount.Id);
                                            }
                                        }
                                    }
                                    else if (guriPacket.Type == 209 && guriPacket.Argument == 0)
                                    {
                                        if (guriPacket.User != null && short.TryParse(guriPacket.User.Value.ToString(), out short pearlSlot) &&
                                            short.TryParse(guriPacket.Value, out short mountSlot))
                                        {
                                            WearableInstance fairy = Session.Character.Inventory.LoadBySlotAndType <WearableInstance>(mountSlot, InventoryType.Equipment);
                                            BoxInstance      pearl = Session.Character.Inventory.LoadBySlotAndType <BoxInstance>(pearlSlot, InventoryType.Equipment);
                                            if (fairy != null && pearl != null)
                                            {
                                                pearl.HoldingVNum = fairy.ItemVNum;
                                                pearl.ElementRate = fairy.ElementRate;
                                                Session.Character.Inventory.RemoveItemAmountFromInventory(1, fairy.Id);
                                            }
                                        }
                                    }
                                    else if (guriPacket.Type == 203 && guriPacket.Argument == 0)
                                    {
                                        // SP points initialization
                                        int[] listPotionResetVNums = { 1366, 1427, 5115, 9040 };
                                        int   vnumToUse            = -1;
                                        foreach (int vnum in listPotionResetVNums)
                                        {
                                            if (Session.Character.Inventory.CountItem(vnum) > 0)
                                            {
                                                vnumToUse = vnum;
                                            }
                                        }
                                        if (vnumToUse != -1)
                                        {
                                            if (Session.Character.UseSp)
                                            {
                                                SpecialistInstance specialistInstance =
                                                    Session.Character.Inventory.LoadBySlotAndType <SpecialistInstance>((byte)EquipmentType.Sp, InventoryType.Wear);
                                                if (specialistInstance != null)
                                                {
                                                    specialistInstance.SlDamage  = 0;
                                                    specialistInstance.SlDefence = 0;
                                                    specialistInstance.SlElement = 0;
                                                    specialistInstance.SlHP      = 0;

                                                    specialistInstance.DamageMinimum        = 0;
                                                    specialistInstance.DamageMaximum        = 0;
                                                    specialistInstance.HitRate              = 0;
                                                    specialistInstance.CriticalLuckRate     = 0;
                                                    specialistInstance.CriticalRate         = 0;
                                                    specialistInstance.DefenceDodge         = 0;
                                                    specialistInstance.DistanceDefenceDodge = 0;
                                                    specialistInstance.ElementRate          = 0;
                                                    specialistInstance.DarkResistance       = 0;
                                                    specialistInstance.LightResistance      = 0;
                                                    specialistInstance.FireResistance       = 0;
                                                    specialistInstance.WaterResistance      = 0;
                                                    specialistInstance.CriticalDodge        = 0;
                                                    specialistInstance.CloseDefence         = 0;
                                                    specialistInstance.DistanceDefence      = 0;
                                                    specialistInstance.MagicDefence         = 0;
                                                    specialistInstance.HP = 0;
                                                    specialistInstance.MP = 0;

                                                    Session.Character.Inventory.RemoveItemAmount(vnumToUse);
                                                    Session.Character.Inventory.DeleteFromSlotAndType((byte)EquipmentType.Sp, InventoryType.Wear);
                                                    Session.Character.Inventory.AddToInventoryWithSlotAndType(specialistInstance, InventoryType.Wear, (byte)EquipmentType.Sp);
                                                    Session.SendPacket(Session.Character.GenerateCond());
                                                    Session.SendPacket(specialistInstance.GenerateSlInfo());
                                                    Session.SendPacket(Session.Character.GenerateLev());
                                                    Session.SendPacket(Session.Character.GenerateStatChar());
                                                    Session.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(Language.Instance.GetMessageFromKey("POINTS_RESET"), 0));
                                                }
                                            }
                                            else
                                            {
                                                Session.SendPacket(Session.Character.GenerateSay(Language.Instance.GetMessageFromKey("TRANSFORMATION_NEEDED"), 10));
                                            }
                                        }
                                        else
                                        {
                                            Session.SendPacket(Session.Character.GenerateSay(Language.Instance.GetMessageFromKey("NOT_ENOUGH_POINTS"), 10));
                                        }
                                    }
                                    break;
                                }
                            }
                            break;
                        }
                    }
                    break;
                }
            }
        }
Пример #4
0
        public override void Use(ClientSession session, ref ItemInstance inv, byte option = 0, string[] packetsplit = null)
        {
            if (session == null)
            {
                return;
            }
            switch (Effect)
            {
            case 0:
            case 999:
                if (option == 0)
                {
                    if (packetsplit != null && packetsplit.Length == 9)
                    {
                        BoxInstance box = session.Character.Inventory.LoadBySlotAndType <BoxInstance>(inv.Slot, InventoryType.Equipment);
                        if (box != null)
                        {
                            if (box.Item.ItemSubType == 3)
                            {
                                session.SendPacket($"qna #guri^300^8023^{inv.Slot} {Language.Instance.GetMessageFromKey("ASK_OPEN_BOX")}");
                            }
                            else if (box.HoldingVNum == 0)
                            {
                                session.SendPacket($"qna #guri^300^8023^{inv.Slot}^{packetsplit[3]} {Language.Instance.GetMessageFromKey("ASK_STORE_PET")}");
                            }
                            else
                            {
                                session.SendPacket($"qna #guri^300^8023^{inv.Slot} {Language.Instance.GetMessageFromKey("ASK_RELEASE_PET")}");
                            }
                        }
                    }
                }
                else
                {
                    //u_i 2 2000000 0 21 0 0
                    BoxInstance box = session.Character.Inventory.LoadBySlotAndType <BoxInstance>(inv.Slot, InventoryType.Equipment);
                    if (box != null)
                    {
                        if (box.Item.ItemSubType == 3)
                        {
                            List <RollGeneratedItemDTO> roll = box.Item.RollGeneratedItems.Where(s => s.MinimumOriginalItemRare <= box.Rare && s.MaximumOriginalItemRare >= box.Rare && s.OriginalItemDesign == box.Design).ToList();
                            int probabilities          = roll.Sum(s => s.Probability);
                            int rnd                    = ServerManager.Instance.RandomNumber(0, probabilities);
                            int currentrnd             = 0;
                            List <ItemInstance> newInv = null;
                            foreach (RollGeneratedItemDTO rollitem in roll)
                            {
                                Item createdItem = ServerManager.Instance.GetItem(rollitem.ItemGeneratedVNum);
                                if (newInv != null)
                                {
                                    continue;
                                }
                                currentrnd += rollitem.Probability;
                                if (currentrnd < rnd)
                                {
                                    continue;
                                }
                                if (createdItem.ItemType == ItemType.Shell)
                                {
                                    rollitem.ItemGeneratedUpgrade = (byte)ServerManager.Instance.RandomNumber();
                                    if (rollitem.ItemGeneratedUpgrade >= 95)
                                    {
                                        rollitem.ItemGeneratedUpgrade =
                                            (byte)ServerManager.Instance.RandomNumber(80, 91);
                                    }
                                    else
                                    {
                                        rollitem.ItemGeneratedUpgrade = (byte)ServerManager.Instance.RandomNumber(70, 80);
                                    }
                                }
                                newInv = session.Character.Inventory.AddNewToInventory(rollitem.ItemGeneratedVNum, rollitem.ItemGeneratedAmount, rare: box.Rare, upgrade: rollitem.ItemGeneratedUpgrade);
                                if (!newInv.Any())
                                {
                                    continue;
                                }
                                short slot = inv.Slot;
                                if (slot == -1)
                                {
                                    continue;
                                }
                                session.SendPacket(session.Character.GenerateSay($"{Language.Instance.GetMessageFromKey("ITEM_ACQUIRED")}: {newInv.FirstOrDefault()?.Item.Name ?? ""} x {rollitem.ItemGeneratedAmount})", 12));
                                session.SendPacket($"rdi {rollitem.ItemGeneratedVNum} {rollitem.ItemGeneratedAmount}");
                                newInv.ForEach(s => session.SendPacket(s?.GenerateInventoryAdd()));
                                session.Character.Inventory.RemoveItemAmountFromInventory(1, box.Id);
                            }
                        }
                        else if (box.HoldingVNum == 0)
                        {
                            if (packetsplit != null && packetsplit.Length == 1)
                            {
                                if (int.TryParse(packetsplit[0], out int petId))
                                {
                                    Mate mate = session.Character.Mates.FirstOrDefault(s => s.MateTransportId == petId);
                                    if (mate == null)
                                    {
                                        return;
                                    }
                                    box.MateType    = mate.MateType;
                                    box.HoldingVNum = mate.NpcMonsterVNum;
                                    box.SpLevel     = mate.Level;
                                    box.SpDamage    = mate.Attack;
                                    box.SpDefence   = mate.Defence;
                                    session.Character.Mates.Remove(mate);
                                    session.SendPacket(UserInterfaceHelper.Instance.GenerateInfo(Language.Instance.GetMessageFromKey("PET_STORED")));
                                    session.SendPacket(UserInterfaceHelper.Instance.GeneratePClear());
                                    session.SendPackets(session.Character.GenerateScP());
                                    session.SendPackets(session.Character.GenerateScN());
                                    session.CurrentMapInstance?.Broadcast(mate.GenerateOut());
                                }
                            }
                        }
                        else
                        {
                            NpcMonster heldMonster = ServerManager.Instance.GetNpc(box.HoldingVNum);

                            if (heldMonster != null)
                            {
                                Mate mate = new Mate(session.Character, heldMonster, (byte)(box.SpLevel == 0 ? 1 : box.SpLevel), box.MateType)
                                {
                                    Attack  = box.SpDamage,
                                    Defence = box.SpDefence
                                };
                                if (session.Character.AddPet(mate))
                                {
                                    session.Character.Inventory.RemoveItemAmountFromInventory(1, inv.Id);
                                    session.SendPacket(UserInterfaceHelper.Instance.GenerateInfo(Language.Instance.GetMessageFromKey("PET_LEAVE_BEAD")));
                                }
                            }
                        }
                    }
                }
                break;

            case 1:
                if (option == 0)
                {
                    session.SendPacket($"qna #guri^300^8023^{inv.Slot} {Language.Instance.GetMessageFromKey("ASK_RELEASE_PET")}");
                }
                else
                {
                    NpcMonster heldMonster = ServerManager.Instance.GetNpc((short)EffectValue);
                    if (session.CurrentMapInstance == session.Character.Miniland && heldMonster != null)
                    {
                        Mate mate = new Mate(session.Character, heldMonster, LevelMinimum, ItemSubType == 1 ? MateType.Partner : MateType.Pet);
                        if (session.Character.AddPet(mate))
                        {
                            session.Character.Inventory.RemoveItemAmountFromInventory(1, inv.Id);
                            session.SendPacket(UserInterfaceHelper.Instance.GenerateInfo(Language.Instance.GetMessageFromKey("PET_LEAVE_BEAD")));
                        }
                    }
                    else
                    {
                        //TODO ADD MINILAND SENDPACKET
                    }
                }

                break;

            case 69:
                if (EffectValue == 1 || EffectValue == 2)
                {
                    BoxInstance box = session.Character.Inventory.LoadBySlotAndType <BoxInstance>(inv.Slot, InventoryType.Equipment);
                    if (box != null)
                    {
                        if (box.HoldingVNum == 0)
                        {
                            session.SendPacket($"wopen 44 {inv.Slot}");
                        }
                        else
                        {
                            List <ItemInstance> newInv = session.Character.Inventory.AddNewToInventory(box.HoldingVNum);
                            if (newInv.Any())
                            {
                                ItemInstance       itemInstance = newInv.First();
                                SpecialistInstance specialist   = session.Character.Inventory.LoadBySlotAndType <SpecialistInstance>(itemInstance.Slot, itemInstance.Type);
                                if (specialist != null)
                                {
                                    specialist.SlDamage       = box.SlDamage;
                                    specialist.SlDefence      = box.SlDefence;
                                    specialist.SlElement      = box.SlElement;
                                    specialist.SlHP           = box.SlHP;
                                    specialist.SpDamage       = box.SpDamage;
                                    specialist.SpDark         = box.SpDark;
                                    specialist.SpDefence      = box.SpDefence;
                                    specialist.SpElement      = box.SpElement;
                                    specialist.SpFire         = box.SpFire;
                                    specialist.SpHP           = box.SpHP;
                                    specialist.SpLevel        = box.SpLevel;
                                    specialist.SpLight        = box.SpLight;
                                    specialist.SpStoneUpgrade = box.SpStoneUpgrade;
                                    specialist.SpWater        = box.SpWater;
                                    specialist.Upgrade        = box.Upgrade;
                                    specialist.XP             = box.XP;
                                }
                                short slot = inv.Slot;
                                if (slot != -1)
                                {
                                    if (specialist != null)
                                    {
                                        session.SendPacket(session.Character.GenerateSay($"{Language.Instance.GetMessageFromKey("ITEM_ACQUIRED")}: {specialist.Item.Name} + {specialist.Upgrade}", 12));
                                        newInv.ForEach(s => session.SendPacket(specialist.GenerateInventoryAdd()));
                                    }
                                    session.Character.Inventory.RemoveItemAmountFromInventory(1, box.Id);
                                }
                            }
                            else
                            {
                                session.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(Language.Instance.GetMessageFromKey("NOT_ENOUGH_PLACE"), 0));
                            }
                        }
                    }
                }
                if (EffectValue == 3)
                {
                    BoxInstance box = session.Character.Inventory.LoadBySlotAndType <BoxInstance>(inv.Slot, InventoryType.Equipment);
                    if (box != null)
                    {
                        if (box.HoldingVNum == 0)
                        {
                            session.SendPacket($"guri 26 0 {inv.Slot}");
                        }
                        else
                        {
                            List <ItemInstance> newInv = session.Character.Inventory.AddNewToInventory(box.HoldingVNum);
                            if (newInv.Any())
                            {
                                ItemInstance     itemInstance = newInv.First();
                                WearableInstance fairy        = session.Character.Inventory.LoadBySlotAndType <WearableInstance>(itemInstance.Slot, itemInstance.Type);
                                if (fairy != null)
                                {
                                    fairy.ElementRate = box.ElementRate;
                                }
                                short slot = inv.Slot;
                                if (slot != -1)
                                {
                                    if (fairy != null)
                                    {
                                        session.SendPacket(session.Character.GenerateSay($"{Language.Instance.GetMessageFromKey("ITEM_ACQUIRED")}: {fairy.Item.Name} ({fairy.ElementRate}%)", 12));
                                        newInv.ForEach(s => session.SendPacket(fairy.GenerateInventoryAdd()));
                                    }
                                    session.Character.Inventory.RemoveItemAmountFromInventory(1, box.Id);
                                }
                            }
                            else
                            {
                                session.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(Language.Instance.GetMessageFromKey("NOT_ENOUGH_PLACE"), 0));
                            }
                        }
                    }
                }
                if (EffectValue == 4)
                {
                    BoxInstance box = session.Character.Inventory.LoadBySlotAndType <BoxInstance>(inv.Slot, InventoryType.Equipment);
                    if (box != null)
                    {
                        if (box.HoldingVNum == 0)
                        {
                            session.SendPacket($"guri 24 0 {inv.Slot}");
                        }
                        else
                        {
                            List <ItemInstance> newInv = session.Character.Inventory.AddNewToInventory(box.HoldingVNum);
                            if (newInv.Any())
                            {
                                short slot = inv.Slot;
                                if (slot != -1)
                                {
                                    session.SendPacket(session.Character.GenerateSay($"{Language.Instance.GetMessageFromKey("ITEM_ACQUIRED")}: {newInv.First().Item.Name} x 1)", 12));
                                    newInv.ForEach(s => session.SendPacket(s.GenerateInventoryAdd()));
                                    session.Character.Inventory.RemoveItemAmountFromInventory(1, box.Id);
                                }
                            }
                            else
                            {
                                session.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(Language.Instance.GetMessageFromKey("NOT_ENOUGH_PLACE"), 0));
                            }
                        }
                    }
                }
                break;

            default:
                Logger.Log.Warn(string.Format(Language.Instance.GetMessageFromKey("NO_HANDLER_ITEM"), GetType()));
                break;
            }
        }