Feature - Implemented exposing use limiter via function (patch inside)

taltamir

Member
Some items cannot be used right now because of some limiter that prevents their use. for example $item[M-242] is only useable on dependence day.

This is checked internally by mafia when you try to use the item. as per UseItemRequest.java's
Code:
private static int maximumUses( final int itemId, final String itemName, final int consumptionType, final boolean allowOverDrink )

there does not appear to be a function that exposes the limiter. which means there is no simple way to check for such limiters.
Would be great if the limiters were exposed somehow via a function so they could be checked.
 

fredg1

Member
There.

Adds
Code:
string can_use(    item )
string can_use(    item, int )
string can_use(    int, item )

They return the error message gathered, to allow checking what the issue was. An empty string means the item is usable (in the quantity desired).
 

Attachments

  • can_use.patch
    2 KB · Views: 2

taltamir

Member
It has been a week without any comment. has anyone seen that a patch is available here by fredg1 that does this?
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
This needs to be fixed by changing the dailyusesleft value on the item record, not with a new function in the RuntimeLibrary. I'll see if I can get round to it this week.
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
Ok in r20696 $item.dailyusesleft is now even smarter
 
Top