private void UpdateEquipmentLists() { try { fPackList.Items.Clear(); fEquipList.Items.Clear(); fOutList.Items.Clear(); bool onlyIcons = GlobalVars.nwrWin.InventoryOnlyIcons; Player player = GlobalVars.nwrGame.Player; NWField fld = player.CurrentField; bool blindness = player.Blindness; int debt = 0; fMode = IWMODE_GROUND; if (Collocutor != null) { debt = player.GetDebt(Collocutor.Name); if (Collocutor.IsTrader) { Building house = (Building)Collocutor.FindHouse(); if (house.Area.Contains(player.PosX, player.PosY)) { fMode = IWMODE_INSHOP; } else { fMode = IWMODE_TRADER; } } else { if (Collocutor.Mercenary) { fMode = IWMODE_MERCENARY; } } } fPayBtn.Enabled = (fMode != IWMODE_GROUND && debt != 0); switch (fMode) { case IWMODE_GROUND: { EntityList items = player.Items; int num5 = items.Count; for (int i = 0; i < num5; i++) { Item item = (Item)items.GetItem(i); if (!item.Identified && player.Memory.Find(item.Entry.Sign) != null) { item.Identified = true; } if (item.Equipment && item.InUse && fContainer == null) { AddListItem(fEquipList, item.GetName(blindness), item, onlyIcons); } else { AddListItem(fPackList, item.GetName(blindness), item, onlyIcons); } } ExtList <LocatedEntity> groundItems = fld.Items.SearchListByPos(player.PosX, player.PosY); int num6 = groundItems.Count; for (int i = 0; i < num6; i++) { Item item = (Item)groundItems[i]; if (!item.Identified && player.Memory.Find(item.Entry.Sign) != null) { item.Identified = true; } AddListItem(fOutList, item.GetName(blindness), item, onlyIcons); } groundItems.Dispose(); } break; case IWMODE_TRADER: case IWMODE_INSHOP: { EntityList items = player.Items; int num3 = items.Count; for (int i = 0; i < num3; i++) { Item item = (Item)items.GetItem(i); if (!item.Identified && player.Memory.Find(item.Entry.Sign) != null) { item.Identified = true; } if (item.Equipment && item.InUse && fContainer == null) { AddListItem(fEquipList, item.GetName(blindness), item, onlyIcons); } else { if (item.Ware) { AddListItem(fPackList, item.GetName(blindness) + " (" + Convert.ToString((int)item.GetTradePrice(Collocutor, player)) + "$)", item, onlyIcons); } else { AddListItem(fPackList, item.GetName(blindness), item, onlyIcons); } } } Building house = fld.FindBuilding(player.PosX, player.PosY); if (house != null) { if (debt > 0) { house.SwitchDoors(DoorState.Closed); } else { house.SwitchDoors(DoorState.Opened); } ExtList <LocatedEntity> groundItems = fld.Items.SearchListByArea(house.Area); int num4 = groundItems.Count; for (int i = 0; i < num4; i++) { Item item = (Item)groundItems[i]; item.Identified = true; AddListItem(fOutList, item.GetName(blindness) + " (" + Convert.ToString((int)item.GetTradePrice(player, Collocutor)) + "$)", item, onlyIcons); } groundItems.Dispose(); } } break; case IWMODE_MERCENARY: { EntityList items = player.Items; int num = items.Count; for (int i = 0; i < num; i++) { Item item = (Item)items.GetItem(i); if (!item.Identified && player.Memory.Find(item.Entry.Sign) != null) { item.Identified = true; } if (item.Equipment && item.InUse && fContainer == null) { AddListItem(fEquipList, item.GetName(blindness), item, onlyIcons); } else { if (item.Ware) { AddListItem(fPackList, item.GetName(blindness) + " (" + Convert.ToString(item.Price) + "$)", item, onlyIcons); } else { AddListItem(fPackList, item.GetName(blindness), item, onlyIcons); } } } items = Collocutor.Items; int num2 = items.Count; for (int i = 0; i < num2; i++) { Item item = (Item)items.GetItem(i); AddListItem(fOutList, item.GetName(blindness) + " (" + Convert.ToString(item.Price) + "$)", item, onlyIcons); } } break; } if (fContainer != null) { EntityList items = fContainer.Contents; int num7 = items.Count; for (int i = 0; i < num7; i++) { Item item = (Item)items.GetItem(i); if (!item.Identified && player.Memory.Find(item.Entry.Sign) != null) { item.Identified = true; } AddListItem(fEquipList, item.GetName(blindness), item, onlyIcons); } } } catch (Exception ex) { Logger.Write("InventoryWindow.updateEquipmentLists(): " + ex.Message); throw ex; } }