Bläddra i källkod

Fixed item creation with full inventory (#2914)

* Fixes #2858.
* Prevented items from being created if adding them to the inventory failed for whatever reason.
* Introduced a new config that allows to keep the old behavior.
Thanks to @Artuvazro and @Daegaladh!
Lemongrass3110 7 år sedan
förälder
incheckning
3c41d4eeb0
4 ändrade filer med 16 tillägg och 3 borttagningar
  1. 5 0
      conf/battle/skill.conf
  2. 1 0
      src/map/battle.cpp
  3. 1 0
      src/map/battle.hpp
  4. 9 3
      src/map/skill.cpp

+ 5 - 0
conf/battle/skill.conf

@@ -369,3 +369,8 @@ dispel_song: no
 // 0: Uses the official duration
 // X: Enter a custom duration in milliseconds.
 banana_bomb_duration: 0
+
+// Should items that you try to create be dropped if you have no space left in your inventory? (Note 1)
+// Official: no
+// Legacy rAthena logic: yes
+skill_drop_items_full: no

+ 1 - 0
src/map/battle.cpp

@@ -8494,6 +8494,7 @@ static const struct _battle_data {
 	{ "event_refine_chance",                &battle_config.event_refine_chance,             0,      0,      1,              },
 	{ "autoloot_adjust",                    &battle_config.autoloot_adjust,                 0,      0,      1,              },
 	{ "broadcast_hide_name",                &battle_config.broadcast_hide_name,             2,      0,      NAME_LENGTH,    },
+	{ "skill_drop_items_full",              &battle_config.skill_drop_items_full,           0,      0,      1,              },
 
 #include "../custom/battle_config_init.inc"
 };

+ 1 - 0
src/map/battle.hpp

@@ -638,6 +638,7 @@ struct Battle_Config
 	int event_refine_chance;
 	int autoloot_adjust;
 	int broadcast_hide_name;
+	int skill_drop_items_full;
 
 #include "../custom/battle_config_struct.inc"
 };

+ 9 - 3
src/map/skill.cpp

@@ -19451,7 +19451,9 @@ bool skill_produce_mix(struct map_session_data *sd, uint16 skill_id, unsigned sh
 							for (l = 0; l < total_qty; l += tmp_item.amount) {
 								if ((flag = pc_additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) {
 									clif_additem(sd,0,0,flag);
-									map_addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0,0);
+									if( battle_config.skill_drop_items_full ){
+										map_addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0,0);
+									}
 								}
 							}
 							k++;
@@ -19469,7 +19471,9 @@ bool skill_produce_mix(struct map_session_data *sd, uint16 skill_id, unsigned sh
 		} else if (tmp_item.amount) { //Success
 			if ((flag = pc_additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) {
 				clif_additem(sd,0,0,flag);
-				map_addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0,0);
+				if( battle_config.skill_drop_items_full ){
+					map_addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0,0);
+				}
 			}
 			if (skill_id == GN_MIX_COOKING || skill_id == GN_MAKEBOMB || skill_id ==  GN_S_PHARMACY) {
 				clif_produceeffect(sd,6,nameid);
@@ -19526,7 +19530,9 @@ bool skill_produce_mix(struct map_session_data *sd, uint16 skill_id, unsigned sh
 					tmp_item.identify = 1;
 					if ((flag = pc_additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) {
 						clif_additem(sd,0,0,flag);
-						map_addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0,0);
+						if( battle_config.skill_drop_items_full ){
+							map_addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0,0);
+						}
 					}
 					clif_produceeffect(sd,7,nameid);
 					clif_misceffect(&sd->bl,6);