public void HandlePopoverNeedsInventoryRefresh(WTPopoverDialogue popover) { ImNode node = (ImNode)popover.correspondingEntity; bool hasTitle = false; bool hasDone = false; foreach (ImTableCell cell in popover.tableCells) { if (cell.tableCellType == TableCellType.Done) { hasDone = true; } if (cell.tableCellType == TableCellType.Title) { hasTitle = true; } } if (!hasTitle) { popover.AddTableCell(ImConfig.NameForNodePlacement(node.nodePlacement), TableCellType.Title); } foreach (ImAbstractItem item in inventory) { ImTableCell cellWithItem = null; foreach (ImTableCell itemCell in popover.tableCells) { if (itemCell.item == item) { cellWithItem = itemCell; } } if (cellWithItem == null && item.CanBeUsedOnEntity(popover.correspondingEntity)) { popover.AddTableCell(item.Description(), "Futile_White", item, TableCellType.Item); } if (cellWithItem != null && !item.CanBeUsedOnEntity(popover.correspondingEntity)) { popover.RemoveTableCell(cellWithItem); } } if (!hasDone) { popover.AddTableCell("Done", TableCellType.Done); } }
public void HandlePopoverNeedsInventoryRefresh(WTPopoverDialogue popover) { ImNode node = (ImNode)popover.correspondingEntity; bool hasTitle = false; bool hasDone = false; foreach (ImTableCell cell in popover.tableCells) { if (cell.tableCellType == TableCellType.Done) hasDone = true; if (cell.tableCellType == TableCellType.Title) hasTitle = true; } if (!hasTitle) popover.AddTableCell(ImConfig.NameForNodePlacement(node.nodePlacement), TableCellType.Title); foreach (ImAbstractItem item in inventory) { ImTableCell cellWithItem = null; foreach (ImTableCell itemCell in popover.tableCells) { if (itemCell.item == item) cellWithItem = itemCell; } if (cellWithItem == null && item.CanBeUsedOnEntity(popover.correspondingEntity)) popover.AddTableCell(item.Description(), "Futile_White", item, TableCellType.Item); if (cellWithItem != null && !item.CanBeUsedOnEntity(popover.correspondingEntity)) popover.RemoveTableCell(cellWithItem); } if (!hasDone) popover.AddTableCell("Done", TableCellType.Done); }