diff --git a/src/map/clif.cpp b/src/map/clif.cpp index a8c521e0b4..b5cab4320b 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -12466,9 +12466,7 @@ void clif_parse_StopAttack(int fd,map_session_data *sd) /// Request to move an item from inventory to cart (CZ_MOVE_ITEM_FROM_BODY_TO_CART). /// 0126 .W .L void clif_parse_PutItemToCart( int fd, map_session_data *sd ){ - if (pc_istrading(sd)) - return; - if (!pc_iscarton(sd)) + if (pc_istrading(sd) || !pc_iscarton(sd) || pc_cant_act2(sd)) return; if (map_getmapflag(sd->bl.m, MF_NOUSECART)) return; @@ -12484,7 +12482,7 @@ void clif_parse_PutItemToCart( int fd, map_session_data *sd ){ void clif_parse_GetItemFromCart(int fd,map_session_data *sd) { struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; - if (!pc_iscarton(sd)) + if (!pc_iscarton(sd) || pc_cant_act2(sd)) return; if (map_getmapflag(sd->bl.m, MF_NOUSECART)) return; diff --git a/src/map/intif.cpp b/src/map/intif.cpp index b3d557c273..9218db61c3 100644 --- a/src/map/intif.cpp +++ b/src/map/intif.cpp @@ -3514,7 +3514,11 @@ static bool intif_parse_StorageReceived(int fd) }else if( sd->state.prevend ){ clif_clearcart(sd->fd); clif_cartlist(sd); - clif_openvendingreq(sd, sd->vend_skill_lv+2); + // Only open the vending UI, if it has not been opened already + if (sd->state.pending_vending_ui) { + clif_openvendingreq(sd, sd->vend_skill_lv + 2); + sd->state.pending_vending_ui = false; + } } break; diff --git a/src/map/pc.hpp b/src/map/pc.hpp index c6ee17ece4..91fe236930 100644 --- a/src/map/pc.hpp +++ b/src/map/pc.hpp @@ -425,6 +425,7 @@ public: unsigned int autolooting : 1; //performance-saver, autolooting state for @alootid unsigned int gmaster_flag : 1; unsigned int prevend : 1;//used to flag wheather you've spent 40sp to open the vending or not. + bool pending_vending_ui; // flag whether the vending packet should still be sent to this player or not unsigned int warping : 1;//states whether you're in the middle of a warp processing unsigned int permanent_speed : 1; // When 1, speed cannot be changed through status_calc_pc(). bool hold_recalc; diff --git a/src/map/skill.cpp b/src/map/skill.cpp index 45529eb515..e24aa56036 100755 --- a/src/map/skill.cpp +++ b/src/map/skill.cpp @@ -9019,10 +9019,16 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui sd->state.workinprogress = WIP_DISABLE_ALL; sd->vend_skill_lv = skill_lv; ARR_FIND(0, MAX_CART, i, sd->cart.u.items_cart[i].nameid && sd->cart.u.items_cart[i].id == 0); - if (i < MAX_CART) + if (i < MAX_CART) { + // Save the cart before opening the vending UI + sd->state.pending_vending_ui = true; intif_storage_save(sd, &sd->cart); - else + } + else{ + // Instantly open the vending UI + sd->state.pending_vending_ui = false; clif_openvendingreq(sd,2+skill_lv); + } } } break;