summaryrefslogtreecommitdiff
path: root/src/map/clif.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2017-05-27 19:24:42 +0200
committerGitHub <noreply@github.com>2017-05-27 19:24:42 +0200
commitcb3e2f5f3b91d0a1f7711eff9c10ae9a655a74f2 (patch)
tree1b1df55f4143bae6bed85093f3424b6af11e4a01 /src/map/clif.c
parentbe118c7fad6df29dc691452ef511ac12fea37a06 (diff)
parentd966a8e6860d418bb3a235e57928436127eba555 (diff)
downloadhercules-cb3e2f5f3b91d0a1f7711eff9c10ae9a655a74f2.tar.gz
hercules-cb3e2f5f3b91d0a1f7711eff9c10ae9a655a74f2.tar.bz2
hercules-cb3e2f5f3b91d0a1f7711eff9c10ae9a655a74f2.tar.xz
hercules-cb3e2f5f3b91d0a1f7711eff9c10ae9a655a74f2.zip
Merge pull request #1722 from Smokexyz/mmo_charstatus-fix
Dismemberment of `storage_data` from `mmo_charstatus`.
Diffstat (limited to 'src/map/clif.c')
-rw-r--r--src/map/clif.c44
1 files changed, 26 insertions, 18 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index e70857ab6..524378439 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -4189,12 +4189,13 @@ void clif_storageitemremoved(struct map_session_data* sd, int index, int amount)
nullpo_retv(sd);
- fd=sd->fd;
- WFIFOHEAD(fd,packet_len(0xf6));
- WFIFOW(fd,0)=0xf6; // Storage item removed
- WFIFOW(fd,2)=index+1;
- WFIFOL(fd,4)=amount;
- WFIFOSET(fd,packet_len(0xf6));
+ fd = sd->fd;
+
+ WFIFOHEAD(fd, packet_len(0xf6));
+ WFIFOW(fd, 0) = 0xf6; // Storage item removed
+ WFIFOW(fd, 2) = index + 1;
+ WFIFOL(fd, 4) = amount;
+ WFIFOSET(fd, packet_len(0xf6));
}
/// Closes storage (ZC_CLOSE_STORE).
@@ -8431,9 +8432,11 @@ void clif_refresh_storagewindow(struct map_session_data *sd)
nullpo_retv(sd);
// Notify the client that the storage is open
if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) {
- storage->sortitem(sd->status.storage.items, ARRAYLENGTH(sd->status.storage.items));
- clif->storagelist(sd, sd->status.storage.items, ARRAYLENGTH(sd->status.storage.items));
- clif->updatestorageamount(sd, sd->status.storage.storage_amount, MAX_STORAGE);
+ if (sd->storage.aggregate > 0) {
+ storage->sortitem(VECTOR_DATA(sd->storage.item), VECTOR_LENGTH(sd->storage.item));
+ clif->storagelist(sd, VECTOR_DATA(sd->storage.item), VECTOR_LENGTH(sd->storage.item));
+ }
+ clif->updatestorageamount(sd, sd->storage.aggregate, MAX_STORAGE);
}
// Notify the client that the gstorage is open otherwise it will
// remain locked forever and nobody will be able to access it
@@ -9340,7 +9343,7 @@ void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) {
sd->state.warping = 0;
sd->state.dialog = 0;/* reset when warping, client dialog will go missing */
- // look
+ // Character Looks
#if PACKETVER < 4
clif->changelook(&sd->bl,LOOK_WEAPON,sd->status.weapon);
clif->changelook(&sd->bl,LOOK_SHIELD,sd->status.shield);
@@ -9350,21 +9353,26 @@ void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) {
if(sd->vd.cloth_color)
clif->refreshlook(&sd->bl,sd->bl.id,LOOK_CLOTHES_COLOR,sd->vd.cloth_color,SELF);
+
if (sd->vd.body_style)
clif->refreshlook(&sd->bl,sd->bl.id,LOOK_BODY2,sd->vd.body_style,SELF);
- // item
- clif->inventorylist(sd); // inventory list first, otherwise deleted items in pc->checkitem show up as 'unknown item'
- pc->checkitem(sd);
- // cart
+ // Send character inventory to the client.
+ // call this before pc->checkitem() so that the client isn't called to delete a non-existent item.
+ clif->inventorylist(sd);
+
+ // Send the cart inventory, counts & weight to the client.
if(pc_iscarton(sd)) {
clif->cartlist(sd);
- clif->updatestatus(sd,SP_CARTINFO);
+ clif->updatestatus(sd, SP_CARTINFO);
}
- // weight
- clif->updatestatus(sd,SP_WEIGHT);
- clif->updatestatus(sd,SP_MAXWEIGHT);
+ // Check for and delete unavailable/disabled items.
+ pc->checkitem(sd);
+
+ // Send the character's weight to the client.
+ clif->updatestatus(sd, SP_WEIGHT);
+ clif->updatestatus(sd, SP_MAXWEIGHT);
// guild
// (needs to go before clif_spawn() to show guild emblems correctly)