diff options
-rw-r--r-- | doc/script_commands.txt | 19 | ||||
-rw-r--r-- | src/map/script.c | 21 |
2 files changed, 39 insertions, 1 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 0096cedfd..5fad09c9f 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -10256,5 +10256,22 @@ That command will send a service message to the chat window of the character specified by account ID or name, or to connected to npc player. It will not be seen by anyone else. -Works fro 20170830 RE and main and for any zero clients +Works for 20170830 RE and main and for any zero clients +--------------------------------------- + +*expandInventoryAck(<result>{, <itemId>}) + +Send initial inventory expansion result. +Normally this function should be called from script label +inventory_expansion::OnInventoryExpandRequest. + +Valid result statuses: + EXPAND_INVENTORY_ASK_CONFIRMATION - force client to ask player about inventory expansion + EXPAND_INVENTORY_FAILED - other failed reason + EXPAND_INVENTORY_OTHER_WORK - failed because player busy with other work + EXPAND_INVENTORY_MISSING_ITEM - failed because missing item + EXPAND_INVENTORY_MAX_SIZE - failed because inventory size already maximum + +ItemId make sense only if result is EXPAND_INVENTORY_ASK_CONFIRMATION +Works for 20181212 zero clients --------------------------------------- diff --git a/src/map/script.c b/src/map/script.c index 8d3de56a5..cf192fce8 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -24860,6 +24860,20 @@ static BUILDIN(enchantitem) return true; } +// send ack to inventory expand request +static BUILDIN(expandInventoryAck) +{ + struct map_session_data *sd = script_rid2sd(st); + if (sd == NULL) + return false; + int itemId = 0; + if (script_hasdata(st, 3)) { + itemId = script_getnum(st, 3); + } + clif->inventoryExpandAck(sd, script_getnum(st, 2), itemId); + return true; +} + /** * Adds a built-in script function. * @@ -25600,6 +25614,7 @@ static void script_parse_builtin(void) BUILDIN_DEF(itempreview, "i"), BUILDIN_DEF(enchantitem, "iii"), + BUILDIN_DEF(expandInventoryAck, "i?"), }; int i, len = ARRAYLENGTH(BUILDIN); RECREATE(script->buildin, char *, script->buildin_count + len); // Pre-alloc to speed up @@ -26023,6 +26038,12 @@ static void script_hardcoded_constants(void) script->set_constant("ITR_NOAUCTION", ITR_NOAUCTION, false, false); script->set_constant("ITR_ALL", ITR_ALL, false, false); + script->constdb_comment("inventory expand ack responds"); + script->set_constant("EXPAND_INV_ASK_CONFIRMATION", EXPAND_INVENTORY_ASK_CONFIRMATION, false, false); + script->set_constant("EXPAND_INV_FAILED", EXPAND_INVENTORY_FAILED, false, false); + script->set_constant("EXPAND_INV_OTHER_WORK", EXPAND_INVENTORY_OTHER_WORK, false, false); + script->set_constant("EXPAND_INV_MISSING_ITEM", EXPAND_INVENTORY_MISSING_ITEM, false, false); + script->set_constant("EXPAND_INV_MAX_SIZE", EXPAND_INVENTORY_MAX_SIZE, false, false); script->constdb_comment("Renewal"); #ifdef RENEWAL |