def UpdateInventoryWindow(Window=None): """Redraws the inventory window and resets TopIndex.""" global SlotMap if Window == None: Window = GemRB.GetView("WIN_INV") GUICommonWindows.UpdateAnimation() pc = GemRB.GameGetSelectedPCSingle() Container = GemRB.GetContainer(pc, 1) ScrollBar = Window.GetControl(45) Count = Container['ItemCount'] if Count < 1: Count = 1 ScrollBar.SetVarAssoc("TopIndex", Count) RefreshInventoryWindow(Window) # PST uses unhardcoded/avslots.2da to decide which slots do what per character row = GemRB.GetPlayerStat(pc, IE_SPECIFIC) SlotMap = list(map(int, AvSlotsTable.GetValue(row, 1, GTV_STR).split(','))) InventoryCommon.SlotMap = SlotMap # populate inventory slot controls for i in range(46): InventoryCommon.UpdateSlot(pc, i)
def UpdateInventoryWindow(): """Redraws the inventory window and resets TopIndex.""" global ItemHash global slot_list Window = InventoryWindow GUICommonWindows.UpdateAnimation() pc = GemRB.GameGetSelectedPCSingle() Container = GemRB.GetContainer(pc, 1) ScrollBar = Window.GetControl(45) Count = Container['ItemCount'] if Count < 1: Count = 1 ScrollBar.SetVarAssoc("TopIndex", Count) RefreshInventoryWindow() # And now for the items .... ItemHash = {} # get a list which maps slot number to slot type/icon/tooltip row = GemRB.GetPlayerStat(pc, IE_SPECIFIC) slot_list = map(int, AvSlotsTable.GetValue(row, 1, GTV_STR).split(',')) # populate inventory slot controls for i in range(46): UpdateSlot(pc, i)