diff options
author | Haru <haru@dotalux.com> | 2020-06-28 21:47:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-28 21:47:12 +0200 |
commit | fbdd77d3dab85a2d14382ddffa51688e64ccda24 (patch) | |
tree | 043385dbdbe055791297b9d96c40b332b0a456b5 /src | |
parent | a6d5893396ce96926b98ffd1cfe4d2a1f205fc0d (diff) | |
parent | 8f32cfd4efb6892f7647f9bb3173ffb43c94ba94 (diff) | |
download | hercules-fbdd77d3dab85a2d14382ddffa51688e64ccda24.tar.gz hercules-fbdd77d3dab85a2d14382ddffa51688e64ccda24.tar.bz2 hercules-fbdd77d3dab85a2d14382ddffa51688e64ccda24.tar.xz hercules-fbdd77d3dab85a2d14382ddffa51688e64ccda24.zip |
Merge pull request #2756 from Jedzkie/jedzkie-pr07
Storage now closes when using teleport skill.
Diffstat (limited to 'src')
-rw-r--r-- | src/map/battle.c | 1 | ||||
-rw-r--r-- | src/map/battle.h | 1 | ||||
-rw-r--r-- | src/map/skill.c | 25 |
3 files changed, 17 insertions, 10 deletions
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: |