From 3c41d4eeb06858ee34929bd99eaac4d44a3303ae Mon Sep 17 00:00:00 2001 From: Lemongrass3110 Date: Thu, 22 Feb 2018 01:42:49 +0100 Subject: [PATCH] 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! --- conf/battle/skill.conf | 5 +++++ src/map/battle.cpp | 1 + src/map/battle.hpp | 1 + src/map/skill.cpp | 12 +++++++++--- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/conf/battle/skill.conf b/conf/battle/skill.conf index d59068e064..f19805a79f 100644 --- a/conf/battle/skill.conf +++ b/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 diff --git a/src/map/battle.cpp b/src/map/battle.cpp index 909293e409..2db6368af1 100644 --- a/src/map/battle.cpp +++ b/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" }; diff --git a/src/map/battle.hpp b/src/map/battle.hpp index e107390ad6..ad13f69d53 100644 --- a/src/map/battle.hpp +++ b/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" }; diff --git a/src/map/skill.cpp b/src/map/skill.cpp index c75e6f00d2..28b5d290d3 100755 --- a/src/map/skill.cpp +++ b/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);