Skip to content

Commit b3b8ab6

Browse files
authored
feat: add getItemsByFunction and getItemsByFunctionAtSlot (#323)
1 parent 016d1fb commit b3b8ab6

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

msu/hooks/items/item_container.nut

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,19 @@
9292

9393
return __original(_item);
9494
}
95+
96+
q.getItemsByFunction <- function( _function )
97+
{
98+
local ret = [];
99+
foreach (slot, _ in ::Const.ItemSlotSpaces)
100+
{
101+
ret.extend(this.getItemsByFunctionAtSlot(slot, _function));
102+
}
103+
return ret;
104+
}
105+
106+
q.getItemsByFunctionAtSlot <- function( _slot, _function )
107+
{
108+
return this.m.Items[_slot].filter(@(_, _item) _item != null && _item != -1 && _function(_item));
109+
}
95110
});

0 commit comments

Comments
 (0)