private void SendItems(NecClient client, int[] itemIds) { ItemSpawnParams[] spawmParams = new ItemSpawnParams[itemIds.Length]; for (int i = 0; i < itemIds.Length; i++) { spawmParams[i] = new ItemSpawnParams(); spawmParams[i].itemStatuses = ItemStatuses.Identified; } ItemService itemService = new ItemService(client.character); List <ItemInstance> items = itemService.SpawnItemInstances(ItemZoneType.AdventureBag, itemIds, spawmParams); RecvSituationStart recvSituationStart = new RecvSituationStart(2); router.Send(client, recvSituationStart.ToPacket()); foreach (ItemInstance itemInstance in items) { _Logger.Debug(itemInstance.type.ToString()); RecvItemInstance recvItemInstance = new RecvItemInstance(client, itemInstance); router.Send(client, recvItemInstance.ToPacket()); } RecvSituationEnd recvSituationEnd = new RecvSituationEnd(); router.Send(client, recvSituationEnd.ToPacket()); }
public override void Handle(NecClient client, NecPacket packet) { byte index = packet.data.ReadByte(); ulong price = packet.data.ReadUInt64(); byte count = packet.data.ReadByte(); client.character.adventureBagGold -= count * price; server.database.UpdateCharacter(client.character); RecvSelfMoneyNotify recvSelfMoneyNotify = new RecvSelfMoneyNotify(client, client.character.adventureBagGold); router.Send(recvSelfMoneyNotify, client); if (client.character.shopItemIndex != null) { int itemId = client.character.shopItemIndex[index]; ItemSpawnParams spawmParam = new ItemSpawnParams(); spawmParam.itemStatuses = ItemStatuses.Identified; spawmParam.quantity = count; ItemService itemService = new ItemService(client.character); ItemInstance itemInstance = itemService.SpawnItemInstance(ItemZoneType.AdventureBag, itemId, spawmParam); RecvSituationStart recvSituationStart = new RecvSituationStart(2); router.Send(client, recvSituationStart.ToPacket()); RecvItemInstance recvItemInstance = new RecvItemInstance(client, itemInstance); router.Send(client, recvItemInstance.ToPacket()); RecvSituationEnd recvSituationEnd = new RecvSituationEnd(); router.Send(client, recvSituationEnd.ToPacket()); } IBuffer res = BufferProvider.Provide(); res.WriteInt32(0); router.Send(client, (ushort)AreaPacketId.recv_shop_buy_r, res, ServerType.Area); }