summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2019-05-06 01:10:05 +0200
committerGitHub <noreply@github.com>2019-05-06 01:10:05 +0200
commit4bcdd614e6d6de69edb7f203b21fc09a3fa0a5bc (patch)
treed1f3d43eb51906694583fff0dd8504647998cf9f
parentd6fecbcb87db2a32bf189627b9b1dd7230265458 (diff)
parent1e3d3a3c0bca912ebdf18ae337814b2f434ec442 (diff)
downloadhercules-4bcdd614e6d6de69edb7f203b21fc09a3fa0a5bc.tar.gz
hercules-4bcdd614e6d6de69edb7f203b21fc09a3fa0a5bc.tar.bz2
hercules-4bcdd614e6d6de69edb7f203b21fc09a3fa0a5bc.tar.xz
hercules-4bcdd614e6d6de69edb7f203b21fc09a3fa0a5bc.zip
Merge pull request #2232 from guilherme-gm/201810-trap-visibility
Added option to make hunter traps invisible
-rw-r--r--conf/map/battle/skill.conf20
-rw-r--r--db/pre-re/skill_db.conf1
-rw-r--r--db/re/skill_db.conf9
-rw-r--r--src/map/battle.c7
-rw-r--r--src/map/battle.h3
-rw-r--r--src/map/clif.c7
-rw-r--r--src/map/skill.c40
-rw-r--r--src/map/skill.h2
8 files changed, 70 insertions, 19 deletions
diff --git a/conf/map/battle/skill.conf b/conf/map/battle/skill.conf
index 3c4b90505..0cc63662c 100644
--- a/conf/map/battle/skill.conf
+++ b/conf/map/battle/skill.conf
@@ -138,10 +138,22 @@ skill_nofootset: 1
// Default on official servers: true for player-traps
gvg_traps_target_all: 1
-// Some traps settings (add as necessary):
-// 1: Traps are invisible to those who come into view of it. When unset, all traps are visible at all times.
-// (Invisible traps can be revealed through Hunter's Detecting skill)
-traps_setting: 0
+// Hunter's traps visibility setting (with HiddenTrap: true on skill_db.conf)
+// Here we have 2 configs:
+// visibility stands to how traps are displayed by default:
+// 0: Traps are always visible to everyone (Hercules/Pre-renewal)
+// 1: Traps with HiddenTrap: true are hidden in versus maps (PvP/GvG/BG)
+// 2: Traps with HiddenTrap: true are always invisible (Renewal) (Default)
+// Notes: - Invisibility applies to players that are not in caster's party.
+// - Invisible traps can be made visible to everyone with Hunter's Detecting skill.
+//
+// display_on_trigger tells if HiddenTraps should become visible once triggered
+// 0: Do not make traps visible once triggered (except for Ankle Snare) (Aegis)
+// 1: Always make traps visible once triggered (Hercules)
+trap_options: {
+ visibility: 2
+ display_on_trigger: 1
+}
// Restrictions applied to the Alchemist's Summon Flora skill (add as necessary)
// 1: Enable players to damage the floras outside of versus grounds.
diff --git a/db/pre-re/skill_db.conf b/db/pre-re/skill_db.conf
index 21a0f0e78..351a63bda 100644
--- a/db/pre-re/skill_db.conf
+++ b/db/pre-re/skill_db.conf
@@ -75,6 +75,7 @@
Works like FreeCastReduced, but not reduce speed.
ShowSkillScale: true/false (boolean, defaults to false)
AllowReproduce: true/false (boolean, defaults to false)
+ HiddenTrap: true/false (boolean, defaults to false)
}
AttackType: "Attack Type" (string, defaults to "None")
Types: "None", "Weapon", "Magic" or "Misc"
diff --git a/db/re/skill_db.conf b/db/re/skill_db.conf
index ec8548ab2..9f5ce6439 100644
--- a/db/re/skill_db.conf
+++ b/db/re/skill_db.conf
@@ -75,6 +75,7 @@
Works like FreeCastReduced, but not reduce speed.
ShowSkillScale: true/false (boolean, defaults to false)
AllowReproduce: true/false (boolean, defaults to false)
+ HiddenTrap: true/false (boolean, defaults to false)
}
AttackType: "Attack Type" (string, defaults to "None")
Types: "None", "Weapon", "Magic" or "Misc"
@@ -4110,6 +4111,7 @@ skill_db: (
}
SkillInfo: {
Trap: true
+ HiddenTrap: true
}
AttackType: "Misc"
DamageType: {
@@ -4170,6 +4172,7 @@ skill_db: (
SkillInfo: {
Trap: true
AllowReproduce: true
+ HiddenTrap: true
}
AttackType: "Misc"
Element: "Ele_Earth"
@@ -4222,6 +4225,7 @@ skill_db: (
}
SkillInfo: {
Trap: true
+ HiddenTrap: true
}
AttackType: "Misc"
DamageType: {
@@ -4281,6 +4285,7 @@ skill_db: (
}
SkillInfo: {
Trap: true
+ HiddenTrap: true
}
AttackType: "Misc"
DamageType: {
@@ -4329,6 +4334,7 @@ skill_db: (
}
SkillInfo: {
Trap: true
+ HiddenTrap: true
}
AttackType: "Misc"
DamageType: {
@@ -4390,6 +4396,7 @@ skill_db: (
}
SkillInfo: {
Trap: true
+ HiddenTrap: true
}
AttackType: "Misc"
DamageType: {
@@ -4452,6 +4459,7 @@ skill_db: (
SkillInfo: {
Trap: true
AllowReproduce: true
+ HiddenTrap: true
}
AttackType: "Weapon"
Element: "Ele_Water"
@@ -4638,6 +4646,7 @@ skill_db: (
}
SkillInfo: {
Trap: true
+ HiddenTrap: true
}
AttackType: "Misc"
DamageType: {
diff --git a/src/map/battle.c b/src/map/battle.c
index 4ee1791ba..c40c3afac 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -7004,7 +7004,8 @@ static const struct battle_data {
{ "player_damage_delay_rate", &battle_config.pc_damage_delay_rate, 100, 0, INT_MAX, },
{ "defunit_not_enemy", &battle_config.defnotenemy, 0, 0, 1, },
{ "gvg_traps_target_all", &battle_config.vs_traps_bctall, BL_PC, BL_NUL, BL_ALL, },
- { "traps_setting", &battle_config.traps_setting, 0, 0, 1, },
+ { "trap_options/visibility", &battle_config.trap_visibility, 2, 0, 2, },
+ { "trap_options/display_on_trigger", &battle_config.trap_trigger, 1, 0, 1, },
{ "summon_flora_setting", &battle_config.summon_flora, 1|2, 0, 1|2, },
{ "clear_skills_on_death", &battle_config.clear_unit_ondeath, BL_NUL, BL_NUL, BL_ALL, },
{ "clear_skills_on_warp", &battle_config.clear_unit_onwarp, BL_ALL, BL_NUL, BL_ALL, },
@@ -7601,6 +7602,10 @@ static bool battle_config_read(const char *filename, bool imported)
if (!imported)
battle->config_set_defaults();
+ if (libconfig->lookup(&config, "battle_configuration/traps_setting") != NULL) {
+ ShowError("The `traps_setting` battle conf option has been replaced by `trap_visibility`. Please see conf/map/battle/skill.conf.\n");
+ }
+
for (i = 0; i < ARRAYLENGTH(battle_data); i++) {
int type, val;
char config_name[256];
diff --git a/src/map/battle.h b/src/map/battle.h
index 2e52a63a6..0ff5135d8 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -149,7 +149,8 @@ struct Battle_Config {
int pc_damage_delay_rate;
int defnotenemy;
int vs_traps_bctall;
- int traps_setting;
+ int trap_visibility;
+ int trap_trigger;
int summon_flora; //[Skotlex]
int clear_unit_ondeath; //[Skotlex]
int clear_unit_onwarp; //[Skotlex]
diff --git a/src/map/clif.c b/src/map/clif.c
index 462991510..0aef5b8dc 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -5038,9 +5038,8 @@ static void clif_getareachar_skillunit(struct block_list *bl, struct skill_unit
p.xPos = su->bl.x;
p.yPos = su->bl.y;
- //Use invisible unit id for traps.
- if ((battle_config.traps_setting&1 && skill->get_inf2(su->group->skill_id)&INF2_TRAP) ||
- (skill->get_unit_flag(su->group->skill_id) & UF_RANGEDSINGLEUNIT && !(su->val2 & UF_RANGEDSINGLEUNIT)))
+ // Use invisible unit id for some ground skills.
+ if (skill->get_unit_flag(su->group->skill_id) & UF_RANGEDSINGLEUNIT && !(su->val2 & UF_RANGEDSINGLEUNIT))
p.job = UNT_DUMMYSKILL;
else
p.job = su->group->unit_id;
@@ -5049,7 +5048,7 @@ static void clif_getareachar_skillunit(struct block_list *bl, struct skill_unit
p.RadiusRange = (unsigned char)su->range;
#endif
- p.isVisible = 1;
+ p.isVisible = su->visible;
#if PACKETVER >= 20130731
p.level = (unsigned char)su->group->skill_lv;
diff --git a/src/map/skill.c b/src/map/skill.c
index 2b2c2b6f1..a259829ef 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -4156,10 +4156,9 @@ static int skill_reveal_trap(struct block_list *bl, va_list ap)
Assert_ret(bl->type == BL_SKILL);
su = BL_UCAST(BL_SKILL, bl);
- if (su->alive && su->group && skill->get_inf2(su->group->skill_id)&INF2_TRAP) { //Reveal trap.
- //Change look is not good enough, the client ignores it as an actual trap still. [Skotlex]
- //clif->changetraplook(bl, su->group->unit_id);
- clif->getareachar_skillunit(&su->bl,su,AREA);
+ if (su->alive && su->group && skill->get_inf2(su->group->skill_id) & INF2_HIDDEN_TRAP) { //Reveal trap.
+ su->visible = true;
+ clif->skillunit_update(bl);
return 1;
}
return 0;
@@ -11045,9 +11044,10 @@ static int skill_castend_pos2(struct block_list *src, int x, int y, uint16 skill
map->foreachinarea(status->change_timer_sub,
src->m, x-r, y-r, x+r,y+r,BL_CHAR,
src,NULL,SC_SIGHT,tick);
- if(battle_config.traps_setting&1)
- map->foreachinarea(skill_reveal_trap,
- src->m, x-r, y-r, x+r, y+r, BL_SKILL);
+ if (battle_config.trap_visibility != 0) {
+ map->foreachinarea(skill_reveal_trap,
+ src->m, x - r, y - r, x + r, y + r, BL_SKILL);
+ }
break;
case SR_RIDEINLIGHTNING:
@@ -12764,6 +12764,13 @@ static int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *b
ts->tick += sg->interval*(map->count_oncell(bl->m,bl->x,bl->y,BL_CHAR,0)-1);
}
+ if (sg->skill_id == HT_ANKLESNARE
+ || (battle_config.trap_trigger == 1 && skill->get_inf2(sg->skill_id) & INF2_HIDDEN_TRAP)
+ ) {
+ src->visible = true;
+ clif->skillunit_update(&src->bl);
+ }
+
switch (sg->unit_id) {
case UNT_FIREWALL:
case UNT_KAEN: {
@@ -12916,10 +12923,11 @@ static int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *b
clif->fixpos(bl);
}
sg->val2 = bl->id;
- } else
+ } else {
sec = 3000; //Couldn't trap it?
+ }
+
if( sg->unit_id == UNT_ANKLESNARE ) {
- clif->skillunit_update(&src->bl);
/**
* If you're snared from a trap that was invisible this makes the trap be
* visible again -- being you stepped on it (w/o this the trap remains invisible and you go "WTF WHY I CANT MOVE")
@@ -17076,6 +17084,14 @@ static struct skill_unit *skill_initunit(struct skill_unit_group *group, int idx
su->val1=val1;
su->val2 = val2;
su->prev = 0;
+ su->visible = true;
+
+ if (skill->get_inf2(group->skill_id) & INF2_HIDDEN_TRAP
+ && ((battle_config.trap_visibility == 1 && map_flag_vs(group->map)) // invisible in PvP/GvG
+ || battle_config.trap_visibility == 2 // always invisible
+ )) {
+ su->visible = false;
+ }
idb_put(skill->unit_db, su->bl.id, su);
map->addiddb(&su->bl);
@@ -20241,6 +20257,12 @@ static void skill_validate_skillinfo(struct config_setting_t *conf, struct s_ski
} else {
sk->inf2 &= ~INF2_ALLOW_REPRODUCE;
}
+ } else if (strcmpi(type, "HiddenTrap") == 0) {
+ if (on) {
+ sk->inf2 |= INF2_HIDDEN_TRAP;
+ } else {
+ sk->inf2 &= ~INF2_HIDDEN_TRAP;
+ }
} else if (strcmpi(type, "None") != 0) {
skilldb_invalid_error(type, config_setting_name(t), sk->nameid);
}
diff --git a/src/map/skill.h b/src/map/skill.h
index 0ace19927..5da37d129 100644
--- a/src/map/skill.h
+++ b/src/map/skill.h
@@ -124,6 +124,7 @@ enum e_skill_inf2 {
INF2_FREE_CAST_REDUCED = 0x10000,
INF2_SHOW_SKILL_SCALE = 0x20000,
INF2_ALLOW_REPRODUCE = 0x40000,
+ INF2_HIDDEN_TRAP = 0x80000, // Traps that are hidden (based on trap_visiblity battle conf)
};
@@ -1806,6 +1807,7 @@ struct skill_unit {
int limit;
int val1,val2;
+ bool visible;
short alive,range;
int prev;
};