Add removeitem(item_id, quantity) to Perl/Lua. (#1156)

- Perl: quest::removeitem(item_id, quantity);
- Lua: eq.remove_item(item_id, quantity);
This commit is contained in:
Alex
2020-12-29 19:21:47 -05:00
committed by GitHub
parent 21a1a7bed7
commit a920d449ff
4 changed files with 65 additions and 0 deletions
+17
View File
@@ -2926,6 +2926,22 @@ XS(XS__countitem) {
XSRETURN_IV(quantity);
}
XS(XS__removeitem);
XS(XS__removeitem) {
dXSARGS;
if (items < 1 || items > 2)
Perl_croak(aTHX_ "Usage: quest::removeitem(int item_id, [int quantity = 1])");
uint32 item_id = (int) SvIV(ST(0));
uint32 quantity = 1;
if (items > 1)
quantity = (int) SvIV(ST(1));
quest_manager.removeitem(item_id, quantity);
XSRETURN_EMPTY;
}
XS(XS__getitemname);
XS(XS__getitemname) {
dXSARGS;
@@ -6312,6 +6328,7 @@ EXTERN_C XS(boot_quest) {
newXS(strcpy(buf, "rain"), XS__rain, file);
newXS(strcpy(buf, "rebind"), XS__rebind, file);
newXS(strcpy(buf, "reloadzonestaticdata"), XS__reloadzonestaticdata, file);
newXS(strcpy(buf, "removeitem"), XS__removeitem, file);
newXS(strcpy(buf, "removetitle"), XS__removetitle, file);
newXS(strcpy(buf, "repopzone"), XS__repopzone, file);
newXS(strcpy(buf, "resettaskactivity"), XS__resettaskactivity, file);