Get storage
Function Syntax
int [item] get_storage()
Returns a map where each key is an item stored in Hangk's, with the integer value its quantity.
Example
This example displays the five most powerful hats in Hangk's that you can equip and use.
code=
int i = 1;
item [int] hats;
batch_open();
// We're using a batch here to minimize server hits.
foreach it in get_storage() {
if ( !can_equip(it) ) continue;
if ( !is_unrestricted(it) ) continue;
if ( to_slot(it) != $slot[hat] ) continue;
hats[i] = it;
i += 1;
}
batch_close();
sort hats by -get_power(value);
print("Hats in Hangk's:");
for j from 1 to 5 {
print(hats[j] + " (" + get_power(hats[j]) + ").");
}
{{{code}}}