summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-12-13 20:21:44 +0300
committerAndrei Karas <akaras@inbox.ru>2018-12-14 01:23:00 +0300
commitc34b4fbb432350c3632800b53a143a8f54ab7dbc (patch)
tree570fd3ce739af4cd364fd8880146f25300cfae60
parent8e1e7ee7fbf3785d77768ea36e63d4008293b0d0 (diff)
downloadhercules-c34b4fbb432350c3632800b53a143a8f54ab7dbc.tar.gz
hercules-c34b4fbb432350c3632800b53a143a8f54ab7dbc.tar.bz2
hercules-c34b4fbb432350c3632800b53a143a8f54ab7dbc.tar.xz
hercules-c34b4fbb432350c3632800b53a143a8f54ab7dbc.zip
Add packt ZC_INVENTORY_EXPANSION_INFO
-rw-r--r--src/common/mmo.h11
-rw-r--r--src/map/clif.c15
-rw-r--r--src/map/clif.h1
-rw-r--r--src/map/packets_struct.h8
-rw-r--r--src/map/pc.c2
-rw-r--r--src/map/pc.h1
6 files changed, 38 insertions, 0 deletions
diff --git a/src/common/mmo.h b/src/common/mmo.h
index 9bcf82cc7..8b6bef431 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -165,7 +165,18 @@
#endif
#define MAX_CARTS (MAX_BASE_CARTS + MAX_CARTDECORATION_CARTS)
+#ifndef MAX_INVENTORY
#define MAX_INVENTORY 100
+#endif
+
+#ifndef FIXED_INVENTORY_SIZE
+#define FIXED_INVENTORY_SIZE 100
+#endif
+
+#if FIXED_INVENTORY_SIZE > MAX_INVENTORY
+#error FIXED_INVENTORY_SIZE must be same or smaller than MAX_INVENTORY
+#endif
+
//Max number of characters per account. Note that changing this setting alone is not enough if the client is not hexed to support more characters as well.
#if PACKETVER >= 20100413
#ifndef MAX_CHARS
diff --git a/src/map/clif.c b/src/map/clif.c
index 45f029487..e1e06d890 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -3064,6 +3064,20 @@ static void clif_cartItems(struct map_session_data *sd, enum inventory_type type
}
}
+static void clif_inventoryExpansionInfo(struct map_session_data *sd)
+{
+#if PACKETVER_ZERO_NUM >= 20181212
+ nullpo_retv(sd);
+
+ const int fd = sd->fd;
+ WFIFOHEAD(fd, sizeof(struct PACKET_ZC_INVENTORY_EXPANSION_INFO));
+ struct PACKET_ZC_INVENTORY_EXPANSION_INFO *p = WFIFOP(fd, 0);
+ p->packetType = HEADER_ZC_INVENTORY_EXPANSION_INFO;
+ p->expansionSize = sd->inventorySize - FIXED_INVENTORY_SIZE;
+ WFIFOSET(fd, sizeof(struct PACKET_ZC_INVENTORY_EXPANSION_INFO));
+#endif
+}
+
/// Removes cart (ZC_CARTOFF).
/// 012b
/// Client behavior:
@@ -22529,6 +22543,7 @@ void clif_defaults(void)
clif->equipItems = clif_equipItems;
clif->cartList = clif_cartList;
clif->cartItems = clif_cartItems;
+ clif->inventoryExpansionInfo = clif_inventoryExpansionInfo;
clif->favorite_item = clif_favorite_item;
clif->clearcart = clif_clearcart;
clif->item_identify_list = clif_item_identify_list;
diff --git a/src/map/clif.h b/src/map/clif.h
index 147dcfee3..de1d2b593 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -851,6 +851,7 @@ struct clif_interface {
void (*equipItems) (struct map_session_data *sd, enum inventory_type type);
void (*cartList) (struct map_session_data *sd);
void (*cartItems) (struct map_session_data *sd, enum inventory_type type);
+ void (*inventoryExpansionInfo) (struct map_session_data *sd);
void (*favorite_item) (struct map_session_data* sd, unsigned short index);
void (*clearcart) (int fd);
void (*item_identify_list) (struct map_session_data *sd);
diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h
index f6b1a61fb..78ed1a83b 100644
--- a/src/map/packets_struct.h
+++ b/src/map/packets_struct.h
@@ -2981,6 +2981,14 @@ struct PACKET_CZ_STOP_USE_SKILL {
DEFINE_PACKET_HEADER(CZ_STOP_USE_SKILL, 0x0b11);
#endif
+#if PACKETVER_ZERO_NUM >= 20181212
+struct PACKET_ZC_INVENTORY_EXPANSION_INFO {
+ int16 packetType;
+ int16 expansionSize;
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(ZC_INVENTORY_EXPANSION_INFO, 0x0b18);
+#endif
+
#if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute
#pragma pack(pop)
#endif // not NetBSD < 6 / Solaris
diff --git a/src/map/pc.c b/src/map/pc.c
index d9e297e84..39358adf4 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -773,6 +773,7 @@ static int pc_setnewpc(struct map_session_data *sd, int account_id, int char_id,
sd->battle_status.speed = sd->base_status.speed = DEFAULT_WALK_SPEED;
sd->state.warp_clean = 1;
sd->catch_target_class = -1;
+ sd->inventorySize = 100;
return 0;
}
@@ -1380,6 +1381,7 @@ static bool pc_authok(struct map_session_data *sd, int login_id2, time_t expirat
pc->setpos(sd,sd->status.last_point.map,0,0,CLR_OUTSIGHT);
}
+ clif->inventoryExpansionInfo(sd);
clif->overweight_percent(sd);
clif->authok(sd);
diff --git a/src/map/pc.h b/src/map/pc.h
index cca15e829..20b995519 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -260,6 +260,7 @@ struct map_session_data {
struct mmo_charstatus status;
struct item_data *inventory_data[MAX_INVENTORY]; // direct pointers to itemdb entries (faster than doing item_id lookups)
+ int inventorySize;
struct storage_data storage; ///< Account Storage
enum pc_checkitem_types itemcheck;
short equip_index[EQI_MAX];