summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJedzkie <jedzkie13@rocketmail.com>2020-05-31 15:24:13 +0800
committerHaru <haru@dotalux.com>2020-06-28 19:29:47 +0200
commit8f32cfd4efb6892f7647f9bb3173ffb43c94ba94 (patch)
tree043385dbdbe055791297b9d96c40b332b0a456b5
parenta6d5893396ce96926b98ffd1cfe4d2a1f205fc0d (diff)
downloadhercules-8f32cfd4efb6892f7647f9bb3173ffb43c94ba94.tar.gz
hercules-8f32cfd4efb6892f7647f9bb3173ffb43c94ba94.tar.bz2
hercules-8f32cfd4efb6892f7647f9bb3173ffb43c94ba94.tar.xz
hercules-8f32cfd4efb6892f7647f9bb3173ffb43c94ba94.zip
Storage now closes when using teleport skill.
-rw-r--r--conf/map/battle/skill.conf5
-rw-r--r--src/map/battle.c1
-rw-r--r--src/map/battle.h1
-rw-r--r--src/map/skill.c25
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: