protected void PlayerItemShop(GPlayer player, Packet packet) { var ItemCount = packet.ReadInt32(); for (int i = 0; i < ItemCount; i++) { var itens = (ShopItem)packet.Read(new ShopItem()); foreach (var Data in GameShopData.Where(c => c.UID == player.GetUID)) { Data.Items.Add(itens); } player.GameInfo.GameShop.Add(itens); } player.SendResponse(ShowShopItems(player, ItemCount, GameShopData.Where(c => c.UID == player.GetUID).ToList())); }
protected void PlayerEditShopName(GPlayer player, Packet packet) { if (!packet.ReadPStr(out string ShopName)) { player.Response.Write(new byte[] { 0xE8, 0x00 }); player.Response.Write(1); player.SendResponse(); return; } player.GameInfo.GameShop.Name = ShopName; Send(ShowEditShopName(ShopName, player.GetUID, player.GetNickname)); foreach (var item in GameShopData.Where(c => c.UID == player.GetUID)) { item.Name = ShopName; } }
protected void PlayerShopBuyItem(GPlayer player, Packet packet) { if (!packet.ReadUInt32(out uint ShopID)) { return; } var itens = (ShopItem)packet.Read(new ShopItem()); foreach (var Data in GameShopData.Where(c => c.ShopOwnerID == ShopID && c.Items.Any(b => b.TypeID == itens.TypeID))) { if (Data.Remove(itens)) { player.Send(ShowShopItemBuy(1, itens)); player.Send(ShowShopItemBuyResult(Data.NickName, Data.ShopOwnerID, itens)); } } }
protected void PlayerCreateVisitorsCount(GPlayer player, Packet packet) { if (!packet.ReadUInt32(out uint ShopID)) { return; } if (GameShopData.Any(c => c.ShopOwnerID == ShopID) == false) { player.Response.Write(new byte[] { 0xE7, 0x00 }); player.Response.Write(0);//UNKNOWN player.SendResponse(); return; } foreach (var Data in GameShopData.Where(c => c.ShopOwnerID == ShopID)) { Data.CountVisit++; player.Response.Write(new byte[] { 0xE7, 0x00 }); player.Response.Write(player.ConnectionID);//UNKNOWN player.SendResponse(); } }