summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-12-14 06:52:34 +0300
committerAndrei Karas <akaras@inbox.ru>2018-12-14 23:52:47 +0300
commit16f3fe4fd1eeaa27ad093ea70b0a26054096bdb0 (patch)
tree71d5692dd6a9251ffcbdf05e1db9e6b737d653a4
parentd17b51770830d9e9e395d1b87b26572d8434fd57 (diff)
downloadhercules-16f3fe4fd1eeaa27ad093ea70b0a26054096bdb0.tar.gz
hercules-16f3fe4fd1eeaa27ad093ea70b0a26054096bdb0.tar.bz2
hercules-16f3fe4fd1eeaa27ad093ea70b0a26054096bdb0.tar.xz
hercules-16f3fe4fd1eeaa27ad093ea70b0a26054096bdb0.zip
Add script command expandInventoryResult.
This function send to client final expand status.
-rw-r--r--doc/script_commands.txt20
-rw-r--r--src/map/script.c18
2 files changed, 38 insertions, 0 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index 5fad09c9f..d2f945719 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -10247,6 +10247,7 @@ card_id - any card item id.
returns true if all parameters correct
false in other case.
Works for 20160831 main, 20151118 RE, any zero version
+
---------------------------------------
*servicemessage("<message>", <color>{, <account_id>})
@@ -10257,6 +10258,7 @@ specified by account ID or name, or to connected to npc player.
It will not be seen by anyone else.
Works for 20170830 RE and main and for any zero clients
+
---------------------------------------
*expandInventoryAck(<result>{, <itemId>})
@@ -10274,4 +10276,22 @@ Valid result statuses:
ItemId make sense only if result is EXPAND_INVENTORY_ASK_CONFIRMATION
Works for 20181212 zero clients
+
+---------------------------------------
+
+*expandInventoryResult(<result>)
+
+Send final inventory expansion result.
+Normally this function should be called from script label
+inventory_expansion::OnInventoryExpandConfirmed.
+
+Valid result values:
+ EXPAND_INVENTORY_RESULT_SUCCESS - success message
+ EXPAND_INVENTORY_RESULT_FAILED - other failed reason
+ EXPAND_INVENTORY_RESULT_OTHER_WORK - failed because player busy with other work
+ EXPAND_INVENTORY_RESULT_MISSING_ITEM - failed because missing item
+ EXPAND_INVENTORY_RESULT_MAX_SIZE - failed because inventory size already maximum
+
+Works for 20181212 zero clients
+
---------------------------------------
diff --git a/src/map/script.c b/src/map/script.c
index cf192fce8..36b316320 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -24874,6 +24874,16 @@ static BUILDIN(expandInventoryAck)
return true;
}
+// send final ack to inventory expand request
+static BUILDIN(expandInventoryResult)
+{
+ struct map_session_data *sd = script_rid2sd(st);
+ if (sd == NULL)
+ return false;
+ clif->inventoryExpandResult(sd, script_getnum(st, 2));
+ return true;
+}
+
/**
* Adds a built-in script function.
*
@@ -25615,6 +25625,7 @@ static void script_parse_builtin(void)
BUILDIN_DEF(itempreview, "i"),
BUILDIN_DEF(enchantitem, "iii"),
BUILDIN_DEF(expandInventoryAck, "i?"),
+ BUILDIN_DEF(expandInventoryResult, "i"),
};
int i, len = ARRAYLENGTH(BUILDIN);
RECREATE(script->buildin, char *, script->buildin_count + len); // Pre-alloc to speed up
@@ -26045,6 +26056,13 @@ static void script_hardcoded_constants(void)
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("inventory expand final responds");
+ script->set_constant("EXPAND_INV_RESULT_SUCCESS", EXPAND_INVENTORY_RESULT_SUCCESS, false, false);
+ script->set_constant("EXPAND_INV_RESULT_FAILED", EXPAND_INVENTORY_RESULT_FAILED, false, false);
+ script->set_constant("EXPAND_INV_RESULT_OTHER_WORK", EXPAND_INVENTORY_RESULT_OTHER_WORK, false, false);
+ script->set_constant("EXPAND_INV_RESULT_MISSING_ITEM", EXPAND_INVENTORY_RESULT_MISSING_ITEM, false, false);
+ script->set_constant("EXPAND_INV_RESULT_MAX_SIZE", EXPAND_INVENTORY_RESULT_MAX_SIZE, false, false);
+
script->constdb_comment("Renewal");
#ifdef RENEWAL
script->set_constant("RENEWAL", 1, false, false);