summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-12-14 19:35:17 +0300
committerAndrei Karas <akaras@inbox.ru>2018-12-14 23:52:47 +0300
commitc79927b6879f07784ceb19a606483acc791dea80 (patch)
treeed6a8d860fafbc15874364b5765bbc81acdd0d80 /src/map/pc.c
parent16f3fe4fd1eeaa27ad093ea70b0a26054096bdb0 (diff)
downloadhercules-c79927b6879f07784ceb19a606483acc791dea80.tar.gz
hercules-c79927b6879f07784ceb19a606483acc791dea80.tar.bz2
hercules-c79927b6879f07784ceb19a606483acc791dea80.tar.xz
hercules-c79927b6879f07784ceb19a606483acc791dea80.zip
Add script command expandInventory
This command allow adjust inventory size to positive or negative value.
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index ad8cf2a94..94d8cd0c6 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -12338,6 +12338,23 @@ static bool pc_has_second_costume(struct map_session_data *sd)
return false;
}
+static bool pc_expandInventory(struct map_session_data *sd, int adjustSize)
+{
+ nullpo_retr(false, sd);
+ const int invSize = sd->status.inventorySize;
+ if (adjustSize > MAX_INVENTORY || invSize + adjustSize <= FIXED_INVENTORY_SIZE || invSize + adjustSize > MAX_INVENTORY) {
+ clif->inventoryExpandResult(sd, EXPAND_INVENTORY_RESULT_MAX_SIZE);
+ return false;
+ }
+ if (pc_isdead(sd) || sd->state.vending || sd->state.buyingstore || sd->chat_id != 0 || sd->state.trading || sd->state.storage_flag || sd->state.prevend) {
+ clif->inventoryExpandResult(sd, EXPAND_INVENTORY_RESULT_OTHER_WORK);
+ return false;
+ }
+ sd->status.inventorySize += adjustSize;
+ clif->inventoryExpansionInfo(sd);
+ return true;
+}
+
static void do_final_pc(void)
{
@@ -12740,4 +12757,5 @@ void pc_defaults(void)
pc->isDeathPenaltyJob = pc_isDeathPenaltyJob;
pc->has_second_costume = pc_has_second_costume;
+ pc->expandInventory = pc_expandInventory;
}