summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-09-13 00:43:46 +0300
committerAndrei Karas <akaras@inbox.ru>2018-09-19 22:24:50 +0300
commit135ca4ad9ecd3ee0b7f548104d92d2a8d74c77a0 (patch)
tree6a6774d06fdd2f15ad0e9e538fd9bc274ea44237
parentc479ff1aafe1765633ebdc310f86c1d9035a6a16 (diff)
downloadhercules-135ca4ad9ecd3ee0b7f548104d92d2a8d74c77a0.tar.gz
hercules-135ca4ad9ecd3ee0b7f548104d92d2a8d74c77a0.tar.bz2
hercules-135ca4ad9ecd3ee0b7f548104d92d2a8d74c77a0.tar.xz
hercules-135ca4ad9ecd3ee0b7f548104d92d2a8d74c77a0.zip
Update cart packet for 2018-09-12 RE.
-rw-r--r--src/map/clif.c38
-rw-r--r--src/map/clif.h3
-rw-r--r--src/map/packets_struct.h8
-rw-r--r--src/map/pc.c6
4 files changed, 39 insertions, 16 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index f76a76efc..03a6ba507 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -2999,7 +2999,18 @@ static void clif_storageItems(struct map_session_data *sd, enum inventory_type t
}
-static void clif_cartlist(struct map_session_data *sd)
+static void clif_cartList(struct map_session_data *sd)
+{
+#if PACKETVER_RE_NUM >= 20180912
+ clif->inventoryStart(sd, INVTYPE_CART, "");
+#endif
+ clif->cartItems(sd, INVTYPE_CART);
+#if PACKETVER_RE_NUM >= 20180912
+ clif->inventoryEnd(sd, INVTYPE_CART);
+#endif
+}
+
+static void clif_cartItems(struct map_session_data *sd, enum inventory_type type)
{
int i, normal = 0, equip = 0;
struct item_data *id;
@@ -3017,16 +3028,22 @@ static void clif_cartlist(struct map_session_data *sd)
clif->item_normal(i+2,&itemlist_normal.list[normal++],&sd->status.cart[i],id);
}
- if( normal ) {
- itemlist_normal.PacketType = cartlistnormalType;
- itemlist_normal.PacketLength = 4 + (sizeof(struct NORMALITEM_INFO) * normal);
+ if (normal) {
+ itemlist_normal.PacketType = cartlistnormalType;
+ itemlist_normal.PacketLength = (sizeof(itemlist_normal) - sizeof(itemlist_normal.list)) + (sizeof(struct NORMALITEM_INFO) * normal);
+#if PACKETVER_RE_NUM >= 20180912
+ itemlist_normal.invType = type;
+#endif
clif->send(&itemlist_normal, itemlist_normal.PacketLength, &sd->bl, SELF);
}
- if( equip ) {
- itemlist_equip.PacketType = cartlistequipType;
- itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip);
+ if (equip) {
+ itemlist_equip.PacketType = cartlistequipType;
+ itemlist_equip.PacketLength = (sizeof(itemlist_equip) - sizeof(itemlist_equip.list)) + (sizeof(struct EQUIPITEM_INFO) * equip);
+#if PACKETVER_RE_NUM >= 20180912
+ itemlist_equip.invType = type;
+#endif
clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF);
}
@@ -8939,7 +8956,7 @@ static void clif_refresh(struct map_session_data *sd)
clif->changemap(sd,sd->bl.m,sd->bl.x,sd->bl.y);
clif->inventoryList(sd);
if(pc_iscarton(sd)) {
- clif->cartlist(sd);
+ clif->cartList(sd);
clif->updatestatus(sd,SP_CARTINFO);
}
clif->updatestatus(sd,SP_WEIGHT);
@@ -9975,7 +9992,7 @@ static void clif_parse_LoadEndAck(int fd, struct map_session_data *sd)
// Send the cart inventory, counts & weight to the client.
if(pc_iscarton(sd)) {
- clif->cartlist(sd);
+ clif->cartList(sd);
clif->updatestatus(sd, SP_CARTINFO);
}
@@ -22288,7 +22305,8 @@ void clif_defaults(void)
clif->inventoryItems = clif_inventoryItems;
clif->equipList = clif_equipList;
clif->equipItems = clif_equipItems;
- clif->cartlist = clif_cartlist;
+ clif->cartList = clif_cartList;
+ clif->cartItems = clif_cartItems;
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 a5d95172b..13435e82e 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -841,7 +841,8 @@ struct clif_interface {
void (*inventoryItems) (struct map_session_data *sd, enum inventory_type type);
void (*equipList) (struct map_session_data *sd);
void (*equipItems) (struct map_session_data *sd, enum inventory_type type);
- void (*cartlist) (struct map_session_data *sd);
+ void (*cartList) (struct map_session_data *sd);
+ void (*cartItems) (struct map_session_data *sd, enum inventory_type type);
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 c94c140a1..d82a413a1 100644
--- a/src/map/packets_struct.h
+++ b/src/map/packets_struct.h
@@ -246,7 +246,9 @@ enum packet_headers {
#else
storageListEquipType = 0xa6,
#endif
-#if PACKETVER >= 20120925
+#if PACKETVER_RE_NUM >= 20180829
+ cartlistnormalType = 0xb09,
+#elif PACKETVER >= 20120925
cartlistnormalType = 0x993,
#elif PACKETVER >= 20080102
cartlistnormalType = 0x2e9,
@@ -255,7 +257,9 @@ enum packet_headers {
#else
cartlistnormalType = 0x123,
#endif
-#if PACKETVER >= 20150226
+#if PACKETVER_RE_NUM >= 20180829
+ cartlistequipType = 0xb0a,
+#elif PACKETVER >= 20150226
cartlistequipType = 0xa0f,
#elif PACKETVER >= 20120925
cartlistequipType = 0x994,
diff --git a/src/map/pc.c b/src/map/pc.c
index be28f8dad..961dda9f5 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -2075,7 +2075,7 @@ static int pc_disguise(struct map_session_data *sd, int class)
clif->spawn(&sd->bl);
if (class == sd->status.class && pc_iscarton(sd)) {
//It seems the cart info is lost on undisguise.
- clif->cartlist(sd);
+ clif->cartList(sd);
clif->updatestatus(sd,SP_CARTINFO);
}
if (sd->chat_id != 0) {
@@ -9198,7 +9198,7 @@ static int pc_setoption(struct map_session_data *sd, int type)
#ifndef NEW_CARTS
if( type&OPTION_CART && !( p_type&OPTION_CART ) ) { //Cart On
- clif->cartlist(sd);
+ clif->cartList(sd);
clif->updatestatus(sd, SP_CARTINFO);
if(pc->checkskill(sd, MC_PUSHCART) < 10)
status_calc_pc(sd,SCO_NONE); //Apply speed penalty.
@@ -9305,7 +9305,7 @@ static int pc_setcart(struct map_session_data *sd, int type)
break;
default:/* everything else is an allowed ID so we can move on */
if( !sd->sc.data[SC_PUSH_CART] ) /* first time, so fill cart data */
- clif->cartlist(sd);
+ clif->cartList(sd);
clif->updatestatus(sd, SP_CARTINFO);
sc_start(NULL,&sd->bl, SC_PUSH_CART, 100, type, 0);
clif->sc_load(&sd->bl, sd->bl.id, AREA, SI_ON_PUSH_CART, type, 0, 0);