Ejemplo n.º 1
0
        public void Test_Wear_SpInLoading()
        {
            _session.Character.HeroLevel = 1;
            var items = new List <Item>
            {
                new Item {
                    Type          = PocketType.Equipment, VNum = 1,
                    EquipmentSlot = EquipmentType.Sp
                },
                new Item {
                    Type          = PocketType.Equipment, VNum = 2,
                    EquipmentSlot = EquipmentType.Sp
                },
            };

            _itemBuilder = new ItemBuilderService(items, new List <IHandler <Item, Tuple <IItemInstance, UseItemPacket> > > {
                new WearHandler()
            });
            _session.Character.Inventory.AddItemToPocket(_itemBuilder.Create(1, 1));
            _session.Character.Inventory.AddItemToPocket(_itemBuilder.Create(2, 1));
            _handler.Wear(new WearPacket {
                InventorySlot = 0, Type = PocketType.Equipment
            });
            _session.Character.SpCooldown = 30;
            _handler.Wear(new WearPacket {
                InventorySlot = 1, Type = PocketType.Equipment
            });
            Assert.IsTrue(_session.Character.Inventory.Any(s => s.Value.ItemVNum == 2 && s.Value.Type == PocketType.Equipment));
            var packet = (MsgPacket)_session.LastPacket;

            Assert.IsTrue(packet.Message == string.Format(Language.Instance.GetMessageFromKey(LanguageKey.SP_INLOADING,
                                                                                              _session.Account.Language), 30));
        }
Ejemplo n.º 2
0
        public void UserCanShopReput()
        {
            _session.Character.Reput = 500000;

            var items = new List <Item>
            {
                new Item {
                    Type = PocketType.Etc, VNum = 1, IsSoldable = true, ReputPrice = 1
                },
            };
            var itemBuilder = new ItemBuilderService(items, new List <IHandler <Item, Tuple <IItemInstance, UseItemPacket> > >());

            _session.Character.ItemBuilderService = itemBuilder;
            var list = new ConcurrentDictionary <int, ShopItem>();

            list.TryAdd(0, new ShopItem {
                Slot = 0, ItemInstance = itemBuilder.Create(1, -1), Type = 0
            });
            var shop = new Shop
            {
                ShopItems = list
            };

            _session.Character.Inventory.AddItemToPocket(itemBuilder.Create(1, 1, 999), PocketType.Etc, 0);
            _session.Character.Inventory.AddItemToPocket(itemBuilder.Create(1, 2, 999), PocketType.Etc, 1);
            _session.Character.Inventory.AddItemToPocket(itemBuilder.Create(1, 3, 1), PocketType.Etc, 2);

            _session.Character.Buy(shop, 0, 998);
            Assert.IsTrue(_session.Character.Inventory.All(s => s.Value.Amount == 999));
            Assert.IsTrue(_session.Character.Reput == 499002);
        }
Ejemplo n.º 3
0
        public void Test_Wear_WearFairy_SpUseBadElement()
        {
            var items = new List <Item>
            {
                new Item {
                    Type = PocketType.Equipment, VNum = 1, EquipmentSlot = EquipmentType.Fairy, Element = 3
                },
                new Item {
                    Type = PocketType.Equipment, VNum = 2, EquipmentSlot = EquipmentType.Sp, Element = 1, SecondaryElement = 2
                }
            };

            _itemBuilder = new ItemBuilderService(items, new List <IHandler <Item, Tuple <IItemInstance, UseItemPacket> > > {
                new WearHandler()
            });

            _session.Character.Inventory.AddItemToPocket(_itemBuilder.Create(1, 1));
            _session.Character.Inventory.AddItemToPocket(_itemBuilder.Create(2, 1));
            _handler.Wear(new WearPacket {
                InventorySlot = 1, Type = PocketType.Equipment
            });
            _session.Character.UseSp = true;
            _handler.Wear(new WearPacket {
                InventorySlot = 0, Type = PocketType.Equipment
            });
            Assert.IsTrue(_session.Character.Inventory.Any(s => s.Value.ItemVNum == 1 && s.Value.Type == PocketType.Equipment));
            var packet = (MsgPacket)_session.LastPacket;

            Assert.IsTrue(packet.Message == Language.Instance.GetMessageFromKey(LanguageKey.BAD_FAIRY,
                                                                                _session.Account.Language));
        }
Ejemplo n.º 4
0
        public void Test_Wear_WearFairy_SpUseGoodSecondElement()
        {
            var items = new List <Item>
            {
                new Item {
                    Type = PocketType.Equipment, VNum = 1, EquipmentSlot = EquipmentType.Fairy, Element = 2
                },
                new Item {
                    Type = PocketType.Equipment, VNum = 2, EquipmentSlot = EquipmentType.Sp, Element = 1, SecondaryElement = 2
                }
            };

            _itemBuilder = new ItemBuilderService(items, new List <IHandler <Item, Tuple <IItemInstance, UseItemPacket> > > {
                new WearHandler()
            });

            _session.Character.Inventory.AddItemToPocket(_itemBuilder.Create(1, 1));
            _session.Character.Inventory.AddItemToPocket(_itemBuilder.Create(2, 1));
            _handler.Wear(new WearPacket {
                InventorySlot = 1, Type = PocketType.Equipment
            });
            _session.Character.UseSp = true;
            _handler.Wear(new WearPacket {
                InventorySlot = 0, Type = PocketType.Equipment
            });
            Assert.IsTrue(_session.Character.Inventory.Any(s => s.Value.ItemVNum == 1 && s.Value.Type == PocketType.Wear));
        }
Ejemplo n.º 5
0
        public void Test_Wear_SpInUse()
        {
            _session.Character.HeroLevel = 1;
            var items = new List <Item>
            {
                new Item {
                    Type          = PocketType.Equipment, VNum = 1,
                    EquipmentSlot = EquipmentType.Sp
                },
                new Item {
                    Type          = PocketType.Equipment, VNum = 2,
                    EquipmentSlot = EquipmentType.Sp
                },
            };

            _itemBuilder = new ItemBuilderService(items, new List <IHandler <Item, Tuple <IItemInstance, UseItemPacket> > > {
                new WearHandler()
            });
            _session.Character.Inventory.AddItemToPocket(_itemBuilder.Create(1, 1));
            _session.Character.Inventory.AddItemToPocket(_itemBuilder.Create(2, 1));
            _handler.Wear(new WearPacket {
                InventorySlot = 0, Type = PocketType.Equipment
            });
            _session.Character.UseSp = true;
            _handler.Wear(new WearPacket {
                InventorySlot = 1, Type = PocketType.Equipment
            });
            Assert.IsTrue(_session.Character.Inventory.Any(s => s.Value.ItemVNum == 2 && s.Value.Type == PocketType.Equipment));
            var packet = (SayPacket)_session.LastPacket;

            Assert.IsTrue(packet.Message == Language.Instance.GetMessageFromKey(LanguageKey.SP_BLOCKED,
                                                                                _session.Account.Language) && packet.Type == SayColorType.Yellow);
        }
Ejemplo n.º 6
0
        public void UserCantShopWithoutPlace()
        {
            _session.Character.Gold = 500000;

            var items = new List <Item>
            {
                new Item {
                    Type = PocketType.Etc, VNum = 1, IsSoldable = true, Price = 1
                },
            };
            var itemBuilder = new ItemBuilderService(items, new List <IHandler <Item, Tuple <IItemInstance, UseItemPacket> > >());

            _session.Character.ItemBuilderService = itemBuilder;
            var list = new ConcurrentDictionary <int, ShopItem>();

            list.TryAdd(0, new ShopItem {
                Slot = 0, ItemInstance = itemBuilder.Create(1, -1), Type = 0
            });
            var shop = new Shop
            {
                ShopItems = list
            };

            _session.Character.Inventory.AddItemToPocket(itemBuilder.Create(1, 1, 999), PocketType.Etc, 0);
            _session.Character.Inventory.AddItemToPocket(itemBuilder.Create(1, 2, 999), PocketType.Etc, 1);
            _session.Character.Inventory.AddItemToPocket(itemBuilder.Create(1, 3, 999), PocketType.Etc, 2);

            _session.Character.Buy(shop, 0, 999);
            var packet = (MsgPacket)_session.LastPacket;

            Assert.IsTrue(packet.Message == Language.Instance.GetMessageFromKey(LanguageKey.NOT_ENOUGH_PLACE, _session.Account.Language));
        }
        public void Test_Delete_FromSlot()
        {
            _session.Character.Inventory.AddItemToPocket(_itemBuilder.Create(1012, 1, 999));
            _handler.AskToDelete(new BiPacket {
                Option = RequestDeletionType.Confirmed, Slot = 0, PocketType = PocketType.Main
            });
            var packet = (IvnPacket)_session.LastPacket;

            Assert.IsTrue(packet.IvnSubPackets.All(iv => iv.Slot == 0 && iv.VNum == -1));
        }
Ejemplo n.º 8
0
        public void Test_Wear_DestroyedSp()
        {
            _session.Character.HeroLevel = 1;
            var items = new List <Item>
            {
                new Item {
                    Type          = PocketType.Equipment, VNum = 1,
                    EquipmentSlot = EquipmentType.Sp
                },
            };

            _itemBuilder = new ItemBuilderService(items, new List <IHandler <Item, Tuple <IItemInstance, UseItemPacket> > > {
                new WearHandler()
            });
            _session.Character.Inventory.AddItemToPocket(_itemBuilder.Create(1, 1, 1, -2));
            _handler.Wear(new WearPacket {
                InventorySlot = 0, Type = PocketType.Equipment
            });

            Assert.IsTrue(_session.Character.Inventory.Any(s => s.Value.Type == PocketType.Equipment));
            var packet = (MsgPacket)_session.LastPacket;

            Assert.IsTrue(packet.Message == Language.Instance.GetMessageFromKey(LanguageKey.CANT_EQUIP_DESTROYED_SP,
                                                                                _session.Account.Language));
        }
Ejemplo n.º 9
0
        public void Test_Wear_BadHeroLevel()
        {
            _session.Character.HeroLevel = 1;
            var items = new List <Item>
            {
                new Item {
                    Type          = PocketType.Equipment, VNum = 1,
                    EquipmentSlot = EquipmentType.MainWeapon,
                    IsHeroic      = true,
                    LevelMinimum  = 3
                },
            };

            _itemBuilder = new ItemBuilderService(items, new List <IHandler <Item, Tuple <IItemInstance, UseItemPacket> > > {
                new WearHandler()
            });
            _session.Character.Inventory.AddItemToPocket(_itemBuilder.Create(1, 1));
            _handler.Wear(new WearPacket {
                InventorySlot = 0, Type = PocketType.Equipment
            });
            Assert.IsTrue(_session.Character.Inventory.All(s => s.Value.Type == PocketType.Equipment));
            var packet = (SayPacket)_session.LastPacket;

            Assert.IsTrue(packet.Message == Language.Instance.GetMessageFromKey(LanguageKey.BAD_EQUIPMENT,
                                                                                _session.Account.Language) && packet.Type == SayColorType.Yellow);
        }
Ejemplo n.º 10
0
        public void UserCantShopWithoutReput()
        {
            _session.Character.Reput = 500000;
            var items = new List <Item>
            {
                new Item {
                    Type = PocketType.Etc, VNum = 1, IsSoldable = true, ReputPrice = 500000
                },
            };
            var itemBuilder = new ItemBuilderService(items, new List <IHandler <Item, Tuple <IItemInstance, UseItemPacket> > >());

            var list = new ConcurrentDictionary <int, ShopItem>();

            list.TryAdd(0, new ShopItem {
                Slot = 0, ItemInstance = itemBuilder.Create(1, -1), Type = 0
            });
            var shop = new Shop
            {
                ShopItems = list
            };

            _session.Character.Buy(shop, 0, 99);

            var packet = (SMemoPacket)_session.LastPacket;

            Assert.IsTrue(packet.Message == Language.Instance.GetMessageFromKey(LanguageKey.NOT_ENOUGH_REPUT, _session.Account.Language));
        }
Ejemplo n.º 11
0
        public void Test_Binding_Required()
        {
            var items = new List <Item>
            {
                new Item {
                    Type = PocketType.Equipment, VNum = 1, RequireBinding = true
                },
            };

            _itemBuilder = new ItemBuilderService(items, new List <IHandler <Item, Tuple <IItemInstance, UseItemPacket> > > {
                new WearHandler()
            });

            _session.Character.Inventory.AddItemToPocket(_itemBuilder.Create(1, 1));
            _handler.Wear(new WearPacket {
                InventorySlot = 0, Type = PocketType.Equipment
            });

            var packet = (QnaPacket)_session.LastPacket;

            Assert.IsTrue(packet.YesPacket is UseItemPacket yespacket &&
                          yespacket.Slot == 0 &&
                          yespacket.Type == PocketType.Equipment &&
                          packet.Question == _session.GetMessageFromKey(LanguageKey.ASK_BIND));
            Assert.IsTrue(_session.Character.Inventory.Any(s => s.Value.ItemVNum == 1 && s.Value.Type == PocketType.Equipment));
        }
Ejemplo n.º 12
0
        public void UserCanCreateShop()
        {
            var items = new List <Item>
            {
                new Item {
                    Type = PocketType.Etc, VNum = 1, IsTradable = true
                },
            };
            var itemBuilder = new ItemBuilderService(items, new List <IHandler <Item, Tuple <IItemInstance, UseItemPacket> > >());

            _session.Character.Inventory.AddItemToPocket(itemBuilder.Create(1, 1), PocketType.Etc, 0);
            _session.Character.Inventory.AddItemToPocket(itemBuilder.Create(1, 2), PocketType.Etc, 1);
            _session.Character.Inventory.AddItemToPocket(itemBuilder.Create(1, 3), PocketType.Etc, 2);

            _session.Character.MapInstance = _instanceAccessService.GetBaseMapById(1);
            _handler.CreateShop(shopPacket);
            Assert.IsNotNull(_session.Character.Shop);
        }
Ejemplo n.º 13
0
        public void UserCanSell()
        {
            var items = new List <Item>
            {
                new Item {
                    Type = PocketType.Etc, VNum = 1, IsSoldable = true, Price = 500000
                },
            };
            var itemBuilder = new ItemBuilderService(items, new List <IHandler <Item, Tuple <IItemInstance, UseItemPacket> > >());

            _session.Character.Inventory.AddItemToPocket(itemBuilder.Create(1, 1), PocketType.Etc, 0);
            _session.Character.Inventory.AddItemToPocket(itemBuilder.Create(1, 2), PocketType.Etc, 1);
            _session.Character.Inventory.AddItemToPocket(itemBuilder.Create(1, 3), PocketType.Etc, 2);

            _session.Character.MapInstance = _instanceAccessService.GetBaseMapById(1);
            _handler.SellShop(new SellPacket {
                Slot = 0, Amount = 1, Data = (short)PocketType.Etc
            });
            Assert.IsTrue(_session.Character.Gold > 0);
            Assert.IsNull(_session.Character.Inventory.LoadBySlotAndType <IItemInstance>(0, PocketType.Etc));
        }
Ejemplo n.º 14
0
        public void UserCanNotCreateShopWithMissingAmountItem()
        {
            var items = new List <Item>
            {
                new Item {
                    Type = PocketType.Etc, VNum = 1
                },
            };
            var itemBuilder = new ItemBuilderService(items, new List <IHandler <Item, Tuple <IItemInstance, UseItemPacket> > >());

            _session.Character.Inventory.AddItemToPocket(itemBuilder.Create(1, 1), PocketType.Etc, 0);
            _session.Character.Inventory.AddItemToPocket(itemBuilder.Create(1, 1), PocketType.Etc, 1);
            _session.Character.Inventory.AddItemToPocket(itemBuilder.Create(1, 1), PocketType.Etc, 2);

            _session.Character.MapInstance = _instanceAccessService.GetBaseMapById(1);
            _handler.CreateShop(shopPacket);
            Assert.IsNull(_session.Character.Shop);
            var packet = (SayPacket)_session.LastPacket;

            Assert.IsTrue(packet.Message == Language.Instance.GetMessageFromKey(LanguageKey.SHOP_ONLY_TRADABLE_ITEMS, _session.Account.Language));
        }
Ejemplo n.º 15
0
        public void Test_Process_Exchange()
        {
            IInventoryService inventory1 = new InventoryService(new List <Item> {
                new Item {
                    VNum = 1012, Type = PocketType.Main
                }
            }, _worldConfiguration);
            IInventoryService inventory2 = new InventoryService(new List <Item> {
                new Item {
                    VNum = 1013, Type = PocketType.Main
                }
            }, _worldConfiguration);
            var item1 = inventory1.AddItemToPocket(_itemBuilderService.Create(1012, 1)).First();
            var item2 = inventory2.AddItemToPocket(_itemBuilderService.Create(1013, 1)).First();

            _exchangeService.OpenExchange(1, 2);
            _exchangeService.AddItems(1, item1, 1);
            _exchangeService.AddItems(2, item2, 1);
            var itemList = _exchangeService.ProcessExchange(1, 2, inventory1, inventory2);

            Assert.IsTrue(itemList.Count(s => s.Key == 1) == 2 && itemList.Count(s => s.Key == 2) == 2);
        }
Ejemplo n.º 16
0
        public void UserCanNotSellNotSoldable()
        {
            var items = new List <Item>
            {
                new Item {
                    Type = PocketType.Etc, VNum = 1, IsSoldable = false
                },
            };
            var itemBuilder = new ItemBuilderService(items, new List <IHandler <Item, Tuple <IItemInstance, UseItemPacket> > >());

            _session.Character.Inventory.AddItemToPocket(itemBuilder.Create(1, 1), PocketType.Etc, 0);
            _session.Character.Inventory.AddItemToPocket(itemBuilder.Create(1, 2), PocketType.Etc, 1);
            _session.Character.Inventory.AddItemToPocket(itemBuilder.Create(1, 3), PocketType.Etc, 2);

            _session.Character.MapInstance = _instanceAccessService.GetBaseMapById(1);
            _handler.SellShop(new SellPacket {
                Slot = 0, Amount = 1, Data = (short)PocketType.Etc
            });
            var packet = (SMemoPacket)_session.LastPacket;

            Assert.IsTrue(packet.Message == Language.Instance.GetMessageFromKey(LanguageKey.ITEM_NOT_SOLDABLE, _session.Account.Language));
            Assert.IsTrue(_session.Character.Gold == 0);
            Assert.IsNotNull(_session.Character.Inventory.LoadBySlotAndType <IItemInstance>(0, PocketType.Etc));
        }
Ejemplo n.º 17
0
        public void Test_Wear_Put_Item_CorrectSlot(EquipmentType type)
        {
            var items = new List <Item>
            {
                new Item {
                    Type  = PocketType.Equipment, VNum = 1, EquipmentSlot = type,
                    Class = 31 //sum of all 2^class
                },
            };

            _itemBuilder = new ItemBuilderService(items, new List <IHandler <Item, Tuple <IItemInstance, UseItemPacket> > > {
                new WearHandler()
            });

            _session.Character.Inventory.AddItemToPocket(_itemBuilder.Create(1, 1));
            _handler.Wear(new WearPacket {
                InventorySlot = 0, Type = PocketType.Equipment
            });
            Assert.IsTrue(_session.Character.Inventory.All(s => s.Value.Slot == (short)type && s.Value.Type == PocketType.Wear));
        }
Ejemplo n.º 18
0
        public void Test_Binding()
        {
            var items = new List <Item>
            {
                new Item {
                    Type = PocketType.Equipment, VNum = 1, RequireBinding = true
                },
            };

            _itemBuilder = new ItemBuilderService(items, new List <IHandler <Item, Tuple <IItemInstance, UseItemPacket> > > {
                new WearHandler()
            });

            _session.Character.Inventory.AddItemToPocket(_itemBuilder.Create(1, 1));
            _handler.UseItem(new UseItemPacket {
                Slot = 0, Type = PocketType.Equipment, Mode = 1
            });

            Assert.IsTrue(_session.Character.Inventory.Any(s => s.Value.ItemVNum == 1 && s.Value.Type == PocketType.Wear && s.Value.BoundCharacterId == _session.Character.VisualId));
        }
Ejemplo n.º 19
0
        public void Test_Wear_GoodLevel()
        {
            _session.Character.Level = 3;
            var items = new List <Item>
            {
                new Item {
                    Type          = PocketType.Equipment, VNum = 1,
                    EquipmentSlot = EquipmentType.MainWeapon,
                    LevelMinimum  = 3
                },
            };

            _itemBuilder = new ItemBuilderService(items, new List <IHandler <Item, Tuple <IItemInstance, UseItemPacket> > > {
                new WearHandler()
            });
            _session.Character.Inventory.AddItemToPocket(_itemBuilder.Create(1, 1));
            _handler.Wear(new WearPacket {
                InventorySlot = 0, Type = PocketType.Equipment
            });
            Assert.IsTrue(_session.Character.Inventory.All(s => s.Value.Type == PocketType.Wear));
        }
Ejemplo n.º 20
0
        public void Test_Wear_Put_Item_BadGender(GenderType genderToTest)
        {
            _session.Character.Gender = genderToTest;
            var items = new List <Item>
            {
                new Item {
                    Type = PocketType.Equipment, VNum = 1, EquipmentSlot = EquipmentType.MainWeapon,
                    Sex  = (byte)(3 - Math.Pow(2, (byte)genderToTest))
                },
            };

            _itemBuilder = new ItemBuilderService(items, new List <IHandler <Item, Tuple <IItemInstance, UseItemPacket> > > {
                new WearHandler()
            });

            _session.Character.Inventory.AddItemToPocket(_itemBuilder.Create(1, 1));
            _handler.Wear(new WearPacket {
                InventorySlot = 0, Type = PocketType.Equipment
            });
            Assert.IsTrue(_session.Character.Inventory.All(s => s.Value.Type == PocketType.Equipment));
            var packet = (SayPacket)_session.LastPacket;

            Assert.IsTrue(packet.Message == Language.Instance.GetMessageFromKey(LanguageKey.BAD_EQUIPMENT,
                                                                                _session.Account.Language) && packet.Type == SayColorType.Yellow);

            foreach (var validClass in Enum.GetValues(typeof(GenderType)).OfType <GenderType>().Where(s => s != genderToTest).ToList())
            {
                _session.Character.Gender = validClass;
                var item = _session.Character.Inventory.First();
                _handler.Wear(new WearPacket {
                    InventorySlot = 0, Type = PocketType.Equipment
                });
                Assert.IsTrue(item.Value.Type == PocketType.Wear);
                item.Value.Type = PocketType.Equipment;
                item.Value.Slot = 0;
            }
        }
Ejemplo n.º 21
0
        public void UserCantShopMoreThanQuantityNonExistingSlot()
        {
            _session.Character.Gold = 9999999999;
            var items = new List <Item>
            {
                new Item {
                    Type = PocketType.Etc, VNum = 1, IsSoldable = true, Price = 500000
                },
            };
            var itemBuilder = new ItemBuilderService(items, new List <IHandler <Item, Tuple <IItemInstance, UseItemPacket> > >());

            var list = new ConcurrentDictionary <int, ShopItem>();

            list.TryAdd(0, new ShopItem {
                Slot = 0, ItemInstance = itemBuilder.Create(1, -1), Type = 0, Amount = 98
            });
            var shop = new Shop
            {
                ShopItems = list
            };

            _session.Character.Buy(shop, 0, 99);
            Assert.IsNull(_session.LastPacket);
        }
Ejemplo n.º 22
0
        public void CreateItem()
        {
            var item = Inventory.AddItemToPocket(_itemBuilderService.Create(1012, 0)).First();

            Assert.IsTrue(item.Amount == 1 && item.ItemVNum == 1012 && item.Type == PocketType.Main);
        }
Ejemplo n.º 23
0
        private ClientSession prepareSessionShop()
        {
            var conf = new WorldConfiguration()
            {
                BackpackSize = 3, MaxItemAmount = 999, MaxGoldAmount = 999_999_999
            };
            var session2 = new ClientSession(conf, new List <PacketController> {
                new DefaultPacketController(null, _instanceAccessService, null)
            }, _instanceAccessService, null);
            var channelMock = new Mock <IChannel>();

            session2.RegisterChannel(channelMock.Object);
            var account = new AccountDto {
                Name = "AccountTest", Password = "******".ToSha512()
            };

            session2.InitializeAccount(account);
            session2.SessionId = 1;

            _handler = new NpcPacketController(conf,
                                               new NrunAccessService(new List <IHandler <Tuple <IAliveEntity, NrunPacket>, Tuple <IAliveEntity, NrunPacket> > >()));
            _handler.RegisterSession(session2);
            session2.SetCharacter(new CharacterDto
            {
                CharacterId = 1,
                Name        = "chara2",
                Slot        = 1,
                AccountId   = 1,
                MapId       = 1,
                State       = CharacterState.Active
            }.Adapt <Character>());
            var mapinstance = _instanceAccessService.GetBaseMapById(0);

            session2.Character.Account     = account;
            session2.Character.MapInstance = _instanceAccessService.GetBaseMapById(0);
            session2.Character.MapInstance = mapinstance;
            session2.Character.Inventory   = new InventoryService(new List <Item>(), conf);

            _session.Character.Gold = 500000;
            var items = new List <Item>
            {
                new Item {
                    Type = PocketType.Etc, VNum = 1, IsSoldable = true, Price = 1
                },
            };
            var itemBuilder = new ItemBuilderService(items, new List <IHandler <Item, Tuple <IItemInstance, UseItemPacket> > >());

            _session.Character.ItemBuilderService = itemBuilder;
            var list = new ConcurrentDictionary <int, ShopItem>();
            var it   = itemBuilder.Create(1, 1, 999);

            session2.Character.Inventory.AddItemToPocket(it, PocketType.Etc, 0);
            list.TryAdd(0, new ShopItem {
                Slot = 0, ItemInstance = it, Type = 0, Price = 1, Amount = 999
            });
            list.TryAdd(1, new ShopItem {
                Slot = 1, ItemInstance = it, Type = 0, Price = 1, Amount = 500
            });
            session2.Character.Shop = new Shop
            {
                Session   = session2,
                ShopItems = list
            };
            _session.Character.Inventory.AddItemToPocket(itemBuilder.Create(1, 1, 999), PocketType.Etc, 0);
            _session.Character.Inventory.AddItemToPocket(itemBuilder.Create(1, 2, 999), PocketType.Etc, 1);
            return(session2);
        }