private void OnLeaveInventory(UnloadInventoryBasicIntegrationMessage message) { int connectionId = message.ConnectionId; if (!IsCanMakeDMarketOperation(connectionId)) { return; } PlayerInfo playerInfo = GetPlayer(connectionId); PlayerInventoryInfo inventory = playerInfo.Inventory; List <ItemInfo> movingItems = new List <ItemInfo>(); foreach (var playerItemInfo in inventory.Items) { if (inventory.IsEquipped(playerItemInfo.WorldId)) { continue; } movingItems.Add(new ItemInfo(playerItemInfo.WorldId, playerItemInfo.ItemType)); } ApplyCommand(new ServerBulkTransferInventoryBasicIntegrationCommand(movingItems, ItemActionType.ToMarket, connectionId)); }
public void Update(PlayerInventoryInfo inventory) { //TODO need optimization _items.Clear(); foreach (PlayerItemInfo gameItem in inventory.Items) { if (!gameItem.IsInMarket && !inventory.IsEquipped(gameItem.WorldId)) { var newItem = new InGameItemInfo { Title = _infoCatalog.GetInfo(gameItem.ItemType).Name, Sprite = _imageCatalog.GetInventoryItemSprite(gameItem.ItemType), AssetId = _dMarketConverter.GetAssetId(gameItem.WorldId), ClassId = _dMarketConverter.GetClassId(gameItem.ItemType) }; _items.Add(newItem); } } ItemsChanged.SafeRaise(); }
public bool IsEquipped(long worldId) { return(_inventory.IsEquipped(worldId)); }