From 8f32cfd4efb6892f7647f9bb3173ffb43c94ba94 Mon Sep 17 00:00:00 2001 From: Jedzkie Date: Sun, 31 May 2020 15:24:13 +0800 Subject: Storage now closes when using teleport skill. --- conf/map/battle/skill.conf | 5 +++++ src/map/battle.c | 1 + src/map/battle.h | 1 + src/map/skill.c | 25 +++++++++++++++---------- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/conf/map/battle/skill.conf b/conf/map/battle/skill.conf index fe9ca638a..080ca6517 100644 --- a/conf/map/battle/skill.conf +++ b/conf/map/battle/skill.conf @@ -355,3 +355,8 @@ magicrod_type: 0 // Official RE: 0 (Default value.) // Official Pre-RE: 1 skill_enabled_npc: 0 + +// Close the storage/gstorage when teleported? (Note 1) +// true : (Official) +// false : (Athena) +teleport_close_storage: true diff --git a/src/map/battle.c b/src/map/battle.c index b5c0cf4fa..689622cf4 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -7456,6 +7456,7 @@ static const struct battle_data { { "autoloot_adjust", &battle_config.autoloot_adjust, 0, 0, 1, }, { "hom_bonus_exp_from_master", &battle_config.hom_bonus_exp_from_master, 10, 0, 100, }, { "allowed_actions_when_dead", &battle_config.allowed_actions_when_dead, 0, 0, 3, }, + { "teleport_close_storage", &battle_config.teleport_close_storage, 1, 0, 1, }, }; static bool battle_set_value_sub(int index, int value) diff --git a/src/map/battle.h b/src/map/battle.h index f648718ff..f4ad9c556 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -616,6 +616,7 @@ struct Battle_Config { int autoloot_adjust; int allowed_actions_when_dead; + int teleport_close_storage; }; /* criteria for battle_config.idletime_critera */ diff --git a/src/map/skill.c b/src/map/skill.c index ccc4264d9..17721caff 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -47,6 +47,7 @@ #include "map/refine.h" #include "map/script.h" #include "map/status.h" +#include "map/storage.h" #include "map/unit.h" #include "common/cbasetypes.h" #include "common/ers.h" @@ -11354,17 +11355,21 @@ static int skill_castend_map(struct map_session_data *sd, uint16 skill_id, const return 0; } - switch(skill_id) { + switch (skill_id) { case AL_TELEPORT: - // The storage window is closed automatically by the client when there's - // any kind of map change, so we need to restore it automatically - // issue: 8027 - if(strcmp(mapname,"Random")==0) - pc->randomwarp(sd,CLR_TELEPORT); - else if (sd->menuskill_val > 1) //Need lv2 to be able to warp here. - pc->setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT); - - clif->refresh_storagewindow(sd); + if (strcmp(mapname, "Random") == 0) + pc->randomwarp(sd, CLR_TELEPORT); + else if (sd->menuskill_val > 1) // Need lv2 to be able to warp here. + pc->setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_TELEPORT); + + if (battle_config.teleport_close_storage == 1 && sd->state.storage_flag != STORAGE_FLAG_CLOSED) { + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->close(sd); + if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->close(sd); + } else { + clif->refresh_storagewindow(sd); + } break; case AL_WARP: -- cgit v1.2.3-60-g2f50