Forráskód Böngészése

Act restriction on Lapine UI

Cydh 5 éve
szülő
commit
80218e99e2
5 módosított fájl, 18 hozzáadás és 11 törlés
  1. 1 1
      src/map/atcommand.cpp
  2. 14 7
      src/map/clif.cpp
  3. 1 1
      src/map/item_synthesis.cpp
  4. 1 1
      src/map/item_upgrade.cpp
  5. 1 1
      src/map/pc.hpp

+ 1 - 1
src/map/atcommand.cpp

@@ -936,7 +936,7 @@ ACMD_FUNC(storage)
 {
 	nullpo_retr(-1, sd);
 
-	if (sd->npc_id || sd->state.vending || sd->state.buyingstore || sd->state.trading || sd->state.storage_flag ||sd->state.lapine_ui)
+	if (sd->npc_id || sd->state.vending || sd->state.buyingstore || sd->state.trading || sd->state.storage_flag || sd->state.lapine_ui)
 		return -1;
 
 	if (storage_storageopen(sd) == 1)

+ 14 - 7
src/map/clif.cpp

@@ -11531,7 +11531,7 @@ void clif_parse_UseItem(int fd, struct map_session_data *sd)
 		return;
 	}
 
-	if ( (!sd->npc_id && pc_istrading(sd)) || sd->chatID || (sd->state.block_action & PCBLOCK_USEITEM) ) {
+	if ( (!sd->npc_id && pc_istrading(sd)) || sd->chatID || sd->state.lapine_ui || (sd->state.block_action & PCBLOCK_USEITEM) ) {
 		clif_msg(sd, WORK_IN_PROGRESS);
 		return;
 	}
@@ -20893,6 +20893,11 @@ void clif_parse_equipswitch_request_single( int fd, struct map_session_data* sd
 #endif
 }
 
+static void clif_lapine_ui_reset(map_session_data *sd) {
+	sd->state.lapine_ui = 0;
+	sd->last_lapine_box = 0;
+}
+
 bool clif_synthesisui_open(struct map_session_data *sd, unsigned int itemid) {
 #if PACKETVER >= 20160525
 	nullpo_retr(false, sd);
@@ -20929,6 +20934,8 @@ void clif_synthesisui_result(struct map_session_data *sd, e_item_synthesis_resul
 	unsigned short cmd = 0;
 	s_packet_db *info = NULL;
 
+	clif_lapine_ui_reset(sd);
+
 	if (!(cmd = packet_db_ack[ZC_LAPINE_SYNTHESIS_RESULT]))
 		return;
 
@@ -20971,7 +20978,7 @@ void clif_parse_lapineSynthesis_submit(int fd, struct map_session_data* sd) {
 #endif
 	item_data *id;
 
-	if (n < 1 || n > MAX_SYNTHESIS_SOURCES || sd->last_lapine_box != itemid || !(id = itemdb_exists(itemid))) {
+	if (n < 1 || n > MAX_SYNTHESIS_SOURCES || sd->last_lapine_box != itemid || sd->last_lapine_box != sd->itemid || !(id = itemdb_exists(itemid))) {
 		//clif_synthesisui_result(sd, SYNTHESIS_INVALID_ITEM);
 		set_eof(sd->fd);
 		return;
@@ -21013,8 +21020,7 @@ void clif_parse_lapineSynthesis_submit(int fd, struct map_session_data* sd) {
 void clif_parse_lapineSynthesis_close(int fd, struct map_session_data* sd) {
 #if PACKETVER >= 20160525
 	nullpo_retv(sd);
-	sd->state.lapine_ui = 0;
-	sd->last_lapine_box = 0;
+	clif_lapine_ui_reset(sd);
 #endif
 }
 
@@ -21054,6 +21060,8 @@ void clif_lapine_upgrade_result(struct map_session_data *sd, e_item_upgrade_resu
 	unsigned short cmd = 0;
 	s_packet_db *info = NULL;
 
+	clif_lapine_ui_reset(sd);
+
 	if (!(cmd = packet_db_ack[ZC_LAPINE_UPGRADE_RESULT]))
 		return;
 
@@ -21105,7 +21113,7 @@ void clif_parse_lapineUpgrade_submit(int fd, struct map_session_data* sd) {
 
 	item_data *id;
 
-	if (sd->last_lapine_box != itemid || index < 0 || index >= MAX_INVENTORY || !(id = itemdb_search(sd->last_lapine_box))) {
+	if (sd->last_lapine_box != itemid || sd->last_lapine_box != sd->itemid || index < 0 || index >= MAX_INVENTORY || !(id = itemdb_search(sd->last_lapine_box))) {
 		//clif_lapine_upgrade_result(sd, LAPINE_UPRAGDE_FAILURE);
 		set_eof(sd->fd);
 		return;
@@ -21128,8 +21136,7 @@ void clif_parse_lapineUpgrade_submit(int fd, struct map_session_data* sd) {
 void clif_parse_lapineUpgrade_close(int fd, struct map_session_data* sd) {
 #if PACKETVER >= 20160525
 	nullpo_retv(sd);
-	sd->state.lapine_ui = 0;
-	sd->last_lapine_box = 0;
+	clif_lapine_ui_reset(sd);
 #endif
 }
 

+ 1 - 1
src/map/item_synthesis.cpp

@@ -121,7 +121,7 @@ uint64 ItemSynthesisDatabase::parseBodyNode(const YAML::Node &node) {
 bool item_synthesis_open(map_session_data *sd, unsigned int itemid) {
 	nullpo_retr(false, sd);
 
-	if (sd->state.vending || sd->state.buyingstore || sd->state.trading || sd->state.storage_flag || sd->state.prevend || sd->state.lapine_ui)
+	if (pc_cant_act(sd))
 		return false;
 
 	if (pc_is90overweight(sd) || !pc_inventoryblank(sd)) {

+ 1 - 1
src/map/item_upgrade.cpp

@@ -107,7 +107,7 @@ uint64 ItemUpgradeDatabase::parseBodyNode(const YAML::Node &node) {
 bool item_upgrade_open(map_session_data *sd, unsigned int itemid) {
 	nullpo_retr(false, sd);
 
-	if (sd->state.vending || sd->state.buyingstore || sd->state.trading || sd->state.storage_flag || sd->state.prevend || sd->state.lapine_ui)
+	if (pc_cant_act(sd))
 		return false;
 
 	if (pc_is90overweight(sd) || !pc_inventoryblank(sd)) {

+ 1 - 1
src/map/pc.hpp

@@ -902,7 +902,7 @@ extern struct s_job_info job_info[CLASS_COUNT];
 #define pc_cant_act(sd)       ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend || (sd)->state.lapine_ui )
 
 /* equals pc_cant_act except it doesn't check for chat rooms or npcs */
-#define pc_cant_act2(sd)       ( (sd)->state.vending || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )
+#define pc_cant_act2(sd)       ( (sd)->state.vending || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend || (sd)->state.lapine_ui )
 
 #define pc_setdir(sd,b,h)     ( (sd)->ud.dir = (b) ,(sd)->head_dir = (h) )
 #define pc_setchatid(sd,n)    ( (sd)->chatID = n )