Skip to content

Instantly share code, notes, and snippets.

@DamianDominoDavis
Last active January 22, 2024 18:18
Show Gist options
  • Save DamianDominoDavis/8946035e3f5c0de546b2b6af44bc2719 to your computer and use it in GitHub Desktop.
Save DamianDominoDavis/8946035e3f5c0de546b2b6af44bc2719 to your computer and use it in GitHub Desktop.
# itemguard -- un/closet pvpables by value, with managed exceptions
# configuration
int closet_value_higher_than = 1000;
boolean[item] always_bag = $items[Freddy Kruegerand]; # list "none" rather than empty!
boolean[item] always_closet = $items[sand dollar, hobo nickel, bowling ball];
# donfiguration
boolean pvpable(item it) {
return it.tradeable && it.discardable && !it.gift; # && !it.quest
}
void protecc(int pricelimit, boolean[item] keep_bag, boolean[item] keep_closet) {
batch_open();
foreach it in $items[] {
if (it.item_amount() > 0 && !(keep_bag contains it))
if (((keep_closet contains it) || (it.pvpable() && (it.historical_price() <= 0 || it.historical_price() >= pricelimit)))) {
print(`You closet {it.to_string()} ({it.item_amount()})`, 'red');
it.put_closet(it.item_amount());
}
if ((it.closet_amount() > 0 && !(keep_closet contains it)))
if (keep_bag contains it || !pvpable(it) || (it.historical_price()>0 && it.historical_price() < pricelimit))
it.take_closet(it.closet_amount());
}
batch_close();
}
void main() {
protecc(closet_value_higher_than, always_bag, always_closet);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment