summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml135
-rw-r--r--CHANGELOG.md61
-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/char/int_rodex.c2
-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
-rw-r--r--src/map/unit.c2
-rw-r--r--src/plugins/HPMHooking.h10
-rw-r--r--src/plugins/HPMHooking/HPMHooking.Defs.inc48
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.Hooks.inc96
-rw-r--r--src/plugins/sample.c23
-rwxr-xr-xtools/itemdbconverter.pl6
17 files changed, 240 insertions, 232 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ad4a20bf8..72dbcf1d2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -281,96 +281,6 @@ zero-2018:clang-7:
- ./tools/ci/travis.sh build CC=clang-7 --enable-debug --enable-Werror --enable-buildbot --enable-packetver-zero --enable-packetver=20180511
- ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
-pre_re:gcc-4.6:
- <<: *branch_exceptions
- <<: *prerequisites
- stage: secondary
- image: debian:wheezy
- services:
- - mysql:5.5
- variables:
- <<: *base_vars
- INSTALL_PACKAGES: gcc-4.6 mysql-client libmysqlclient-dev
- SQLHOST: mysql
- script:
- - ./tools/ci/travis.sh build CC=gcc-4.6 --enable-debug --enable-Werror --enable-buildbot --disable-renewal
- - ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
-
-re:gcc-4.6:
- <<: *branch_exceptions
- <<: *prerequisites
- stage: secondary
- image: debian:wheezy
- services:
- - mysql:5.5
- variables:
- <<: *base_vars
- INSTALL_PACKAGES: gcc-4.6 mysql-client libmysqlclient-dev
- SQLHOST: mysql
- script:
- - ./tools/ci/travis.sh build CC=gcc-4.6 --enable-debug --enable-Werror --enable-buildbot
- - ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
-
-zero-2018:gcc-4.6:
- <<: *branch_exceptions
- <<: *prerequisites
- stage: clients
- image: debian:wheezy
- services:
- - mysql:5.5
- variables:
- <<: *base_vars
- INSTALL_PACKAGES: gcc-4.6 mysql-client libmysqlclient-dev
- SQLHOST: mysql
- script:
- - ./tools/ci/travis.sh build CC=gcc-4.6 --enable-debug --enable-Werror --enable-buildbot --enable-packetver-zero --enable-packetver=20180511
- - ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
-
-pre_re:gcc-4.7:
- <<: *branch_exceptions
- <<: *prerequisites
- stage: secondary
- image: debian:wheezy
- services:
- - mysql:5.5
- variables:
- <<: *base_vars
- INSTALL_PACKAGES: gcc-4.7 mysql-client libmysqlclient-dev
- SQLHOST: mysql
- script:
- - ./tools/ci/travis.sh build CC=gcc-4.7 --enable-debug --enable-Werror --enable-buildbot --disable-renewal
- - ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
-
-re:gcc-4.7:
- <<: *branch_exceptions
- <<: *prerequisites
- stage: secondary
- image: debian:wheezy
- services:
- - mysql:5.5
- variables:
- <<: *base_vars
- INSTALL_PACKAGES: gcc-4.7 mysql-client libmysqlclient-dev
- SQLHOST: mysql
- script:
- - ./tools/ci/travis.sh build CC=gcc-4.7 --enable-debug --enable-Werror --enable-buildbot
- - ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
-
-zero-2018:gcc-4.7:
- <<: *branch_exceptions
- <<: *prerequisites
- stage: clients
- image: debian:wheezy
- services:
- - mysql:5.5
- variables:
- <<: *base_vars
- INSTALL_PACKAGES: gcc-4.7 mysql-client libmysqlclient-dev
- SQLHOST: mysql
- script:
- - ./tools/ci/travis.sh build CC=gcc-4.7 --enable-debug --enable-Werror --enable-buildbot --enable-packetver-zero --enable-packetver=20180511
- - ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
-
pre_re:gcc-4.8:
<<: *branch_exceptions
<<: *prerequisites
@@ -461,51 +371,6 @@ zero-2018:gcc-4.9:
- ./tools/ci/travis.sh build CC=gcc-4.9 --enable-debug --enable-Werror --enable-buildbot --enable-packetver-zero --enable-packetver=20180511
- ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
-pre_re:gcc-5:
- <<: *branch_exceptions
- <<: *prerequisites
- stage: secondary
- image: debian:unstable
- services:
- - mariadb:10
- variables:
- <<: *base_vars
- INSTALL_PACKAGES: gcc-5 mariadb-client libmariadbclient-dev-compat
- SQLHOST: mariadb
- script:
- - ./tools/ci/travis.sh build CC=gcc-5 --enable-debug --enable-Werror --enable-buildbot --disable-renewal
- - ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
-
-re:gcc-5:
- <<: *branch_exceptions
- <<: *prerequisites
- stage: secondary
- image: debian:unstable
- services:
- - mariadb:10
- variables:
- <<: *base_vars
- INSTALL_PACKAGES: gcc-5 mariadb-client libmariadbclient-dev-compat
- SQLHOST: mariadb
- script:
- - ./tools/ci/travis.sh build CC=gcc-5 --enable-debug --enable-Werror --enable-buildbot
- - ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
-
-zero-2018:gcc-5:
- <<: *branch_exceptions
- <<: *prerequisites
- stage: clients
- image: debian:unstable
- services:
- - mariadb:10
- variables:
- <<: *base_vars
- INSTALL_PACKAGES: gcc-5 mariadb-client libmariadbclient-dev-compat
- SQLHOST: mariadb
- script:
- - ./tools/ci/travis.sh build CC=gcc-5 --enable-debug --enable-Werror --enable-buildbot --enable-packetver-zero --enable-packetver=20180511
- - ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
-
pre_re:gcc-6:
<<: *branch_exceptions
<<: *prerequisites
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c434f0b1a..f50287544 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,66 @@ and this project does not adhere to [Semantic Versioning](http://semver.org/spec
If you are reading this in a text editor, simply ignore this section
-->
+## [v2019.05.05] `May 5 2019`
+
+### Added
+
+- Added `consolemes()` script function which allow the script engine to print error, warning, status, debug and info messages to the console. (part of #2440)
+- Added the item combo effect for Geffenia Tomb of Water (2161) and La'cryma Stick (1646). (#2441, issue #1982)
+- Added support for mobs to drop items with Random Options. See the new database file `db/option_drop_group.conf` and the new optional syntax in the drop entries of `mob_db.conf`. (#2309)
+- Added a global function `F_MesItemInfo()`, to print an item name with description link, formatted for the current client version. (#2068)
+- Added/updated packets, encryption keys and message tables for clients up to 2019-05-02. (#2432)
+- Added a new function `clif_selforarea()` to send packets to self, falling back to area when no target is specified. (part of #2432)
+- Added script commands `getunittitle()` and `setunittitle()`, and the related information in the `unit_data` structure. (part of #2432)
+- Added support for players to automatically reject party invites through the party options. (part of #2432)
+- Added an option to automatically drop the connection on the server side when a character is kicked. See `drop_connection_on_quit` in `client.conf` (note: the previous behavior was equivalent to `true`). (part of #2432)
+- Added an option to force character save when the party options are changed. See `save_settings` in `map-server.conf`. (part of #2432)
+- Added the script command `closeroulette()` and the related packet `ZC_ACK_CLOSE_ROULETTE` to close the roulette window. (part of #2432)
+- Added a missing `CSBR_BUSY` value to `enum CASH_SHOP_BUY_RESULT`. (part of #2432)
+- Added support for the refinery UI. See the new `refine_db.conf` changes and the settings `enable_refinery_ui` and `replace_refine_npcs` in `features.conf` to toggle between the new UI and the previous scripted refiner. (#2446)
+- Added a new `SkillInfo` flag `HiddenTrap`, to make certain traps invisible, according to the `trap_options` configuration flag. The default settings have changed to match Renewal. Pre-renewal users might want to review `trap_options` and the now superseded `traps_setting`. (#2232, issues #1927 and #1928)
+
+### Changed
+
+- Extended `@dropall` to accept an optional argument for item type (#2439).
+- Updated copyright header in the configuration files for year 2019. (part of #2452)
+- Extended the `getinventorylist()` script command to return an array `@inventorylist_favorite`, set to true when the item is located in the favorite tab. (#2426)
+- Split the function `clif_blname_ack()` into bl type-specific functions. (part of #2432)
+- Extended `getunitdata()` and `setunitdata()` with support for the group ID (`UDT_GROUP`), and added the related information in the `unit_data` structure. (part of #2432)
+- Moved the `UDT_*` constants from `constants.conf` to `script.c`. (part of #2432)
+- Extended the guild expulsion information to include the character ID for supported client versions. This includes a database migration. (part of #2432)
+- Disabled packet validation in `socket_datasync()`. (part of #2432)
+- Moved the refine database and refine related functions to a new `refine.c` file. A public and private interface is provided, with public database accessors `refine->get_bonus()` and `refine->get_randombonus_max()`. (part of #2446)
+- Changed several battle calculation limits to be configurable through `battle/limits.conf` and no longer hardcoded. Several `status_data` fields and battle functions now use `int` instead of `short` to accommodate this change. (#2419)
+- Changed the `unitwarp()` script command to allow NPCs to be relocated to non-walkable cells (like `movenpc()`). (#2453)
+
+### Fixed
+
+- Corrected MSVC version naming in console (#2450).
+- Corrected an example using a sprite number instead of a constant in README.md. (#2449)
+- Fixed an issue in a monster death label callback in `npc/custom/events/mushroom_event.txt` when the monster is killed without an attached player. (#2442, issue #1955)
+- Fixed an issue where when a chat room handler leaves, the following leader won't be checked for `cell_chknochat` and will bypass it. (#2443, issue #1569)
+- Corrected the documentation for `pincode.enabled` in the char-server configuration. (part of #2452)
+- Fixed an incorrectly displayed ITEMLINK entry in the OldGlastHeim script. (part of #2068)
+- Fixed a packet size underflow in the storage packet for certain client versions. (#2424)
+- Fixed an issue that caused named/brewed/forged items to be saved to database with the wrong character ID. Database migrations are provided, to update the existing data. (#2425, issue #2409)
+- Fixed a truncated title in the inventory window. (part of #2432)
+- Fixed a possible overflow in the guild member login field (only supporting timestamps until 2036-12-31). (part of #2432)
+- Fixed a compile error with old packet versions. (part of #2432, issue #2438)
+- Fixed a potential exploit related to the vending skill, by adding stricter validation on the vending status flags. (part of #2432)
+- Fixed a regression, restoring the ability for HPM Hooks to hook into private interfaces, through the new macros `addHookPrePriv()` and `addHookPostPriv()`. (#2447)
+- Fixed a zeny loss caused by the inter-server deleting zeny from messages when the user only requests to take items. (#2455)
+- Fixed a compatibility issue with Perl 5.26 in the item converter script. (#2444)
+- Fixed various gitlab-ci build failures, by removing some no longer supported debian versions and packages. The gcc-4.6, gcc-4.7 and gcc-5 builds have been removed. (#2458)
+
+### Deprecated
+
+- Deprecated the script command `debugmes()`, superseded by `consolemes()`. (part of #2440)
+
+### Removed
+
+- Removed the superseded `traps_setting` configuration flag, replaced by `trap_options`. (part of #2232)
+
## [v2019.04.07+1] `April 7 2019` `PATCH 1`
### Fixed
@@ -681,6 +741,7 @@ If you are reading this in a text editor, simply ignore this section
- New versioning scheme and project changelogs/release notes (#1853)
[Unreleased]: https://github.com/HerculesWS/Hercules/compare/stable...master
+[v2019.05.05]: https://github.com/HerculesWS/Hercules/compare/v2019.04.07+1...v2019.05.05
[v2019.04.07+1]: https://github.com/HerculesWS/Hercules/compare/v2019.04.07...v2019.04.07+1
[v2019.04.07]: https://github.com/HerculesWS/Hercules/compare/v2019.03.10...v2019.04.07
[v2019.03.10]: https://github.com/HerculesWS/Hercules/compare/v2019.02.10+1...v2019.03.10
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/char/int_rodex.c b/src/char/int_rodex.c
index ffa5f5452..fbf628f32 100644
--- a/src/char/int_rodex.c
+++ b/src/char/int_rodex.c
@@ -493,8 +493,6 @@ static bool inter_rodex_updatemail(int fd, int account_id, int char_id, int64 ma
const int count = inter_rodex->getitems(mail_id, &items[0]);
if (SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `mail_id` = '%"PRId64"'", rodex_item_db, mail_id))
Sql_ShowDebug(inter->sql_handle);
- if (SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `zeny` = 0, `type` = `type` & (~4) WHERE `mail_id` = '%"PRId64"'", rodex_db, mail_id))
- Sql_ShowDebug(inter->sql_handle);
mapif->rodex_getitemsack(fd, char_id, mail_id, opentype, count, &items[0]);
break;
}
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 89d907fd9..1214106b7 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;
};
diff --git a/src/map/unit.c b/src/map/unit.c
index a6805c610..45cb7dffd 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -957,7 +957,7 @@ static int unit_warp(struct block_list *bl, short m, short x, short y, enum clr_
return 2;
}
- } else if (map->getcell(m, bl, x, y, CELL_CHKNOREACH)) {
+ } else if (bl->type != BL_NPC && map->getcell(m, bl, x, y, CELL_CHKNOREACH)) {
//Invalid target cell
ShowWarning("unit_warp: Specified non-walkable target cell: %d (%s) at [%d,%d]\n", m, map->list[m].name, x,y);
diff --git a/src/plugins/HPMHooking.h b/src/plugins/HPMHooking.h
index 44970863c..f94dccac4 100644
--- a/src/plugins/HPMHooking.h
+++ b/src/plugins/HPMHooking.h
@@ -50,11 +50,21 @@ HPExport struct HPMHooking_interface HPMHooking_s;
HPMi->hooking->AddHook(HOOK_TYPE_PRE, #ifname "->" #funcname, (hook), HPMi->pid) \
)
+#define addHookPrePriv(ifname, funcname, hook) ( \
+ (void)((HPMHOOK_pre_PRIV__ ## ifname ## _ ## funcname)0 == (hook)), \
+ HPMi->hooking->AddHook(HOOK_TYPE_PRE, #ifname "->p->" #funcname, (hook), HPMi->pid) \
+ )
+
#define addHookPost(ifname, funcname, hook) ( \
(void)((HPMHOOK_post_ ## ifname ## _ ## funcname)0 == (hook)), \
HPMi->hooking->AddHook(HOOK_TYPE_POST, #ifname "->" #funcname, (hook), HPMi->pid) \
)
+#define addHookPostPriv(ifname, funcname, hook) ( \
+ (void)((HPMHOOK_post_PRIV__ ## ifname ## _ ## funcname)0 == (hook)), \
+ HPMi->hooking->AddHook(HOOK_TYPE_POST, #ifname "->p->" #funcname, (hook), HPMi->pid) \
+ )
+
/* need better names ;/ */
/* will not run the original function after pre-hook processing is complete (other hooks will run) */
#define hookStop() (HPMi->hooking->HookStop(__func__,HPMi->pid))
diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc
index f6fa6a5e8..920f81ca5 100644
--- a/src/plugins/HPMHooking/HPMHooking.Defs.inc
+++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc
@@ -7884,10 +7884,10 @@ typedef defType (*HPMHOOK_pre_status_calc_mdef) (struct block_list **bl, struct
typedef defType (*HPMHOOK_post_status_calc_mdef) (defType retVal___, struct block_list *bl, struct status_change *sc, int mdef, bool viewable);
typedef short (*HPMHOOK_pre_status_calc_mdef2) (struct block_list **bl, struct status_change **sc, int *mdef2, bool *viewable);
typedef short (*HPMHOOK_post_status_calc_mdef2) (short retVal___, struct block_list *bl, struct status_change *sc, int mdef2, bool viewable);
-typedef unsigned short (*HPMHOOK_pre_status_calc_batk) (struct block_list **bl, struct status_change **sc, int *batk, bool *viewable);
-typedef unsigned short (*HPMHOOK_post_status_calc_batk) (unsigned short retVal___, struct block_list *bl, struct status_change *sc, int batk, bool viewable);
-typedef unsigned short (*HPMHOOK_pre_status_base_matk) (struct block_list **bl, const struct status_data **st, int *level);
-typedef unsigned short (*HPMHOOK_post_status_base_matk) (unsigned short retVal___, struct block_list *bl, const struct status_data *st, int level);
+typedef int (*HPMHOOK_pre_status_calc_batk) (struct block_list **bl, struct status_change **sc, int *batk, bool *viewable);
+typedef int (*HPMHOOK_post_status_calc_batk) (int retVal___, struct block_list *bl, struct status_change *sc, int batk, bool viewable);
+typedef int (*HPMHOOK_pre_status_base_matk) (struct block_list **bl, const struct status_data **st, int *level);
+typedef int (*HPMHOOK_post_status_base_matk) (int retVal___, struct block_list *bl, const struct status_data *st, int level);
typedef int (*HPMHOOK_pre_status_get_weapon_atk) (struct block_list **src, struct weapon_atk **watk, int *flag);
typedef int (*HPMHOOK_post_status_get_weapon_atk) (int retVal___, struct block_list *src, struct weapon_atk *watk, int flag);
typedef int (*HPMHOOK_pre_status_get_total_mdef) (struct block_list **src);
@@ -7906,8 +7906,8 @@ typedef void (*HPMHOOK_pre_status_initDummyData) (void);
typedef void (*HPMHOOK_post_status_initDummyData) (void);
typedef int (*HPMHOOK_pre_status_base_amotion_pc) (struct map_session_data **sd, struct status_data **st);
typedef int (*HPMHOOK_post_status_base_amotion_pc) (int retVal___, struct map_session_data *sd, struct status_data *st);
-typedef unsigned short (*HPMHOOK_pre_status_base_atk) (const struct block_list **bl, const struct status_data **st);
-typedef unsigned short (*HPMHOOK_post_status_base_atk) (unsigned short retVal___, const struct block_list *bl, const struct status_data *st);
+typedef int (*HPMHOOK_pre_status_base_atk) (const struct block_list **bl, const struct status_data **st);
+typedef int (*HPMHOOK_post_status_base_atk) (int retVal___, const struct block_list *bl, const struct status_data *st);
typedef unsigned int (*HPMHOOK_pre_status_get_base_maxhp) (const struct map_session_data **sd, const struct status_data **st);
typedef unsigned int (*HPMHOOK_post_status_get_base_maxhp) (unsigned int retVal___, const struct map_session_data *sd, const struct status_data *st);
typedef unsigned int (*HPMHOOK_pre_status_get_base_maxsp) (const struct map_session_data **sd, const struct status_data **st);
@@ -7930,18 +7930,18 @@ typedef unsigned short (*HPMHOOK_pre_status_calc_dex) (struct block_list **bl, s
typedef unsigned short (*HPMHOOK_post_status_calc_dex) (unsigned short retVal___, struct block_list *bl, struct status_change *sc, int dex);
typedef unsigned short (*HPMHOOK_pre_status_calc_luk) (struct block_list **bl, struct status_change **sc, int *luk);
typedef unsigned short (*HPMHOOK_post_status_calc_luk) (unsigned short retVal___, struct block_list *bl, struct status_change *sc, int luk);
-typedef unsigned short (*HPMHOOK_pre_status_calc_watk) (struct block_list **bl, struct status_change **sc, int *watk, bool *viewable);
-typedef unsigned short (*HPMHOOK_post_status_calc_watk) (unsigned short retVal___, struct block_list *bl, struct status_change *sc, int watk, bool viewable);
-typedef unsigned short (*HPMHOOK_pre_status_calc_matk) (struct block_list **bl, struct status_change **sc, int *matk, bool *viewable);
-typedef unsigned short (*HPMHOOK_post_status_calc_matk) (unsigned short retVal___, struct block_list *bl, struct status_change *sc, int matk, bool viewable);
-typedef signed short (*HPMHOOK_pre_status_calc_hit) (struct block_list **bl, struct status_change **sc, int *hit, bool *viewable);
-typedef signed short (*HPMHOOK_post_status_calc_hit) (signed short retVal___, struct block_list *bl, struct status_change *sc, int hit, bool viewable);
-typedef signed short (*HPMHOOK_pre_status_calc_critical) (struct block_list **bl, struct status_change **sc, int *critical, bool *viewable);
-typedef signed short (*HPMHOOK_post_status_calc_critical) (signed short retVal___, struct block_list *bl, struct status_change *sc, int critical, bool viewable);
-typedef signed short (*HPMHOOK_pre_status_calc_flee) (struct block_list **bl, struct status_change **sc, int *flee, bool *viewable);
-typedef signed short (*HPMHOOK_post_status_calc_flee) (signed short retVal___, struct block_list *bl, struct status_change *sc, int flee, bool viewable);
-typedef signed short (*HPMHOOK_pre_status_calc_flee2) (struct block_list **bl, struct status_change **sc, int *flee2, bool *viewable);
-typedef signed short (*HPMHOOK_post_status_calc_flee2) (signed short retVal___, struct block_list *bl, struct status_change *sc, int flee2, bool viewable);
+typedef int (*HPMHOOK_pre_status_calc_watk) (struct block_list **bl, struct status_change **sc, int *watk, bool *viewable);
+typedef int (*HPMHOOK_post_status_calc_watk) (int retVal___, struct block_list *bl, struct status_change *sc, int watk, bool viewable);
+typedef int (*HPMHOOK_pre_status_calc_matk) (struct block_list **bl, struct status_change **sc, int *matk, bool *viewable);
+typedef int (*HPMHOOK_post_status_calc_matk) (int retVal___, struct block_list *bl, struct status_change *sc, int matk, bool viewable);
+typedef signed int (*HPMHOOK_pre_status_calc_hit) (struct block_list **bl, struct status_change **sc, int *hit, bool *viewable);
+typedef signed int (*HPMHOOK_post_status_calc_hit) (signed int retVal___, struct block_list *bl, struct status_change *sc, int hit, bool viewable);
+typedef signed int (*HPMHOOK_pre_status_calc_critical) (struct block_list **bl, struct status_change **sc, int *critical, bool *viewable);
+typedef signed int (*HPMHOOK_post_status_calc_critical) (signed int retVal___, struct block_list *bl, struct status_change *sc, int critical, bool viewable);
+typedef signed int (*HPMHOOK_pre_status_calc_flee) (struct block_list **bl, struct status_change **sc, int *flee, bool *viewable);
+typedef signed int (*HPMHOOK_post_status_calc_flee) (signed int retVal___, struct block_list *bl, struct status_change *sc, int flee, bool viewable);
+typedef signed int (*HPMHOOK_pre_status_calc_flee2) (struct block_list **bl, struct status_change **sc, int *flee2, bool *viewable);
+typedef signed int (*HPMHOOK_post_status_calc_flee2) (signed int retVal___, struct block_list *bl, struct status_change *sc, int flee2, bool viewable);
typedef unsigned short (*HPMHOOK_pre_status_calc_speed) (struct block_list **bl, struct status_change **sc, int *speed);
typedef unsigned short (*HPMHOOK_post_status_calc_speed) (unsigned short retVal___, struct block_list *bl, struct status_change *sc, int speed);
typedef short (*HPMHOOK_pre_status_calc_aspd_rate) (struct block_list **bl, struct status_change **sc, int *aspd_rate);
@@ -7962,8 +7962,8 @@ typedef unsigned char (*HPMHOOK_pre_status_calc_element_lv) (struct block_list *
typedef unsigned char (*HPMHOOK_post_status_calc_element_lv) (unsigned char retVal___, struct block_list *bl, struct status_change *sc, int lv);
typedef uint32 (*HPMHOOK_pre_status_calc_mode) (const struct block_list **bl, const struct status_change **sc, uint32 *mode);
typedef uint32 (*HPMHOOK_post_status_calc_mode) (uint32 retVal___, const struct block_list *bl, const struct status_change *sc, uint32 mode);
-typedef unsigned short (*HPMHOOK_pre_status_calc_ematk) (struct block_list **bl, struct status_change **sc, int *matk);
-typedef unsigned short (*HPMHOOK_post_status_calc_ematk) (unsigned short retVal___, struct block_list *bl, struct status_change *sc, int matk);
+typedef int (*HPMHOOK_pre_status_calc_ematk) (struct block_list **bl, struct status_change **sc, int *matk);
+typedef int (*HPMHOOK_post_status_calc_ematk) (int retVal___, struct block_list *bl, struct status_change *sc, int matk);
typedef void (*HPMHOOK_pre_status_calc_bl_main) (struct block_list **bl, int *flag);
typedef void (*HPMHOOK_post_status_calc_bl_main) (struct block_list *bl, int flag);
typedef void (*HPMHOOK_pre_status_display_add) (struct map_session_data **sd, enum sc_type *type, int *dval1, int *dval2, int *dval3);
@@ -7988,10 +7988,10 @@ typedef void (*HPMHOOK_pre_status_set_sc) (uint16 *skill_id, sc_type *sc, int *i
typedef void (*HPMHOOK_post_status_set_sc) (uint16 skill_id, sc_type sc, int icon, unsigned int flag);
typedef void (*HPMHOOK_pre_status_copy) (struct status_data **a, const struct status_data **b);
typedef void (*HPMHOOK_post_status_copy) (struct status_data *a, const struct status_data *b);
-typedef unsigned short (*HPMHOOK_pre_status_base_matk_min) (const struct status_data **st);
-typedef unsigned short (*HPMHOOK_post_status_base_matk_min) (unsigned short retVal___, const struct status_data *st);
-typedef unsigned short (*HPMHOOK_pre_status_base_matk_max) (const struct status_data **st);
-typedef unsigned short (*HPMHOOK_post_status_base_matk_max) (unsigned short retVal___, const struct status_data *st);
+typedef int (*HPMHOOK_pre_status_base_matk_min) (const struct status_data **st);
+typedef int (*HPMHOOK_post_status_base_matk_min) (int retVal___, const struct status_data *st);
+typedef int (*HPMHOOK_pre_status_base_matk_max) (const struct status_data **st);
+typedef int (*HPMHOOK_post_status_base_matk_max) (int retVal___, const struct status_data *st);
#endif // MAP_STATUS_H
#ifdef MAP_STORAGE_H /* storage */
typedef void (*HPMHOOK_pre_storage_reconnect) (void);
diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
index 44fb02b62..9cc986922 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
@@ -85245,11 +85245,11 @@ short HP_status_calc_mdef2(struct block_list *bl, struct status_change *sc, int
}
return retVal___;
}
-unsigned short HP_status_calc_batk(struct block_list *bl, struct status_change *sc, int batk, bool viewable) {
+int HP_status_calc_batk(struct block_list *bl, struct status_change *sc, int batk, bool viewable) {
int hIndex = 0;
- unsigned short retVal___ = 0;
+ int retVal___ = 0;
if (HPMHooks.count.HP_status_calc_batk_pre > 0) {
- unsigned short (*preHookFunc) (struct block_list **bl, struct status_change **sc, int *batk, bool *viewable);
+ int (*preHookFunc) (struct block_list **bl, struct status_change **sc, int *batk, bool *viewable);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_batk_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_status_calc_batk_pre[hIndex].func;
@@ -85264,7 +85264,7 @@ unsigned short HP_status_calc_batk(struct block_list *bl, struct status_change *
retVal___ = HPMHooks.source.status.calc_batk(bl, sc, batk, viewable);
}
if (HPMHooks.count.HP_status_calc_batk_post > 0) {
- unsigned short (*postHookFunc) (unsigned short retVal___, struct block_list *bl, struct status_change *sc, int batk, bool viewable);
+ int (*postHookFunc) (int retVal___, struct block_list *bl, struct status_change *sc, int batk, bool viewable);
for (hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_batk_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_status_calc_batk_post[hIndex].func;
retVal___ = postHookFunc(retVal___, bl, sc, batk, viewable);
@@ -85272,11 +85272,11 @@ unsigned short HP_status_calc_batk(struct block_list *bl, struct status_change *
}
return retVal___;
}
-unsigned short HP_status_base_matk(struct block_list *bl, const struct status_data *st, int level) {
+int HP_status_base_matk(struct block_list *bl, const struct status_data *st, int level) {
int hIndex = 0;
- unsigned short retVal___ = 0;
+ int retVal___ = 0;
if (HPMHooks.count.HP_status_base_matk_pre > 0) {
- unsigned short (*preHookFunc) (struct block_list **bl, const struct status_data **st, int *level);
+ int (*preHookFunc) (struct block_list **bl, const struct status_data **st, int *level);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_status_base_matk_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_status_base_matk_pre[hIndex].func;
@@ -85291,7 +85291,7 @@ unsigned short HP_status_base_matk(struct block_list *bl, const struct status_da
retVal___ = HPMHooks.source.status.base_matk(bl, st, level);
}
if (HPMHooks.count.HP_status_base_matk_post > 0) {
- unsigned short (*postHookFunc) (unsigned short retVal___, struct block_list *bl, const struct status_data *st, int level);
+ int (*postHookFunc) (int retVal___, struct block_list *bl, const struct status_data *st, int level);
for (hIndex = 0; hIndex < HPMHooks.count.HP_status_base_matk_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_status_base_matk_post[hIndex].func;
retVal___ = postHookFunc(retVal___, bl, st, level);
@@ -85539,11 +85539,11 @@ int HP_status_base_amotion_pc(struct map_session_data *sd, struct status_data *s
}
return retVal___;
}
-unsigned short HP_status_base_atk(const struct block_list *bl, const struct status_data *st) {
+int HP_status_base_atk(const struct block_list *bl, const struct status_data *st) {
int hIndex = 0;
- unsigned short retVal___ = 0;
+ int retVal___ = 0;
if (HPMHooks.count.HP_status_base_atk_pre > 0) {
- unsigned short (*preHookFunc) (const struct block_list **bl, const struct status_data **st);
+ int (*preHookFunc) (const struct block_list **bl, const struct status_data **st);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_status_base_atk_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_status_base_atk_pre[hIndex].func;
@@ -85558,7 +85558,7 @@ unsigned short HP_status_base_atk(const struct block_list *bl, const struct stat
retVal___ = HPMHooks.source.status.base_atk(bl, st);
}
if (HPMHooks.count.HP_status_base_atk_post > 0) {
- unsigned short (*postHookFunc) (unsigned short retVal___, const struct block_list *bl, const struct status_data *st);
+ int (*postHookFunc) (int retVal___, const struct block_list *bl, const struct status_data *st);
for (hIndex = 0; hIndex < HPMHooks.count.HP_status_base_atk_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_status_base_atk_post[hIndex].func;
retVal___ = postHookFunc(retVal___, bl, st);
@@ -85863,11 +85863,11 @@ unsigned short HP_status_calc_luk(struct block_list *bl, struct status_change *s
}
return retVal___;
}
-unsigned short HP_status_calc_watk(struct block_list *bl, struct status_change *sc, int watk, bool viewable) {
+int HP_status_calc_watk(struct block_list *bl, struct status_change *sc, int watk, bool viewable) {
int hIndex = 0;
- unsigned short retVal___ = 0;
+ int retVal___ = 0;
if (HPMHooks.count.HP_status_calc_watk_pre > 0) {
- unsigned short (*preHookFunc) (struct block_list **bl, struct status_change **sc, int *watk, bool *viewable);
+ int (*preHookFunc) (struct block_list **bl, struct status_change **sc, int *watk, bool *viewable);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_watk_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_status_calc_watk_pre[hIndex].func;
@@ -85882,7 +85882,7 @@ unsigned short HP_status_calc_watk(struct block_list *bl, struct status_change *
retVal___ = HPMHooks.source.status.calc_watk(bl, sc, watk, viewable);
}
if (HPMHooks.count.HP_status_calc_watk_post > 0) {
- unsigned short (*postHookFunc) (unsigned short retVal___, struct block_list *bl, struct status_change *sc, int watk, bool viewable);
+ int (*postHookFunc) (int retVal___, struct block_list *bl, struct status_change *sc, int watk, bool viewable);
for (hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_watk_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_status_calc_watk_post[hIndex].func;
retVal___ = postHookFunc(retVal___, bl, sc, watk, viewable);
@@ -85890,11 +85890,11 @@ unsigned short HP_status_calc_watk(struct block_list *bl, struct status_change *
}
return retVal___;
}
-unsigned short HP_status_calc_matk(struct block_list *bl, struct status_change *sc, int matk, bool viewable) {
+int HP_status_calc_matk(struct block_list *bl, struct status_change *sc, int matk, bool viewable) {
int hIndex = 0;
- unsigned short retVal___ = 0;
+ int retVal___ = 0;
if (HPMHooks.count.HP_status_calc_matk_pre > 0) {
- unsigned short (*preHookFunc) (struct block_list **bl, struct status_change **sc, int *matk, bool *viewable);
+ int (*preHookFunc) (struct block_list **bl, struct status_change **sc, int *matk, bool *viewable);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_matk_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_status_calc_matk_pre[hIndex].func;
@@ -85909,7 +85909,7 @@ unsigned short HP_status_calc_matk(struct block_list *bl, struct status_change *
retVal___ = HPMHooks.source.status.calc_matk(bl, sc, matk, viewable);
}
if (HPMHooks.count.HP_status_calc_matk_post > 0) {
- unsigned short (*postHookFunc) (unsigned short retVal___, struct block_list *bl, struct status_change *sc, int matk, bool viewable);
+ int (*postHookFunc) (int retVal___, struct block_list *bl, struct status_change *sc, int matk, bool viewable);
for (hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_matk_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_status_calc_matk_post[hIndex].func;
retVal___ = postHookFunc(retVal___, bl, sc, matk, viewable);
@@ -85917,11 +85917,11 @@ unsigned short HP_status_calc_matk(struct block_list *bl, struct status_change *
}
return retVal___;
}
-signed short HP_status_calc_hit(struct block_list *bl, struct status_change *sc, int hit, bool viewable) {
+signed int HP_status_calc_hit(struct block_list *bl, struct status_change *sc, int hit, bool viewable) {
int hIndex = 0;
- signed short retVal___ = 0;
+ signed int retVal___ = 0;
if (HPMHooks.count.HP_status_calc_hit_pre > 0) {
- signed short (*preHookFunc) (struct block_list **bl, struct status_change **sc, int *hit, bool *viewable);
+ signed int (*preHookFunc) (struct block_list **bl, struct status_change **sc, int *hit, bool *viewable);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_hit_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_status_calc_hit_pre[hIndex].func;
@@ -85936,7 +85936,7 @@ signed short HP_status_calc_hit(struct block_list *bl, struct status_change *sc,
retVal___ = HPMHooks.source.status.calc_hit(bl, sc, hit, viewable);
}
if (HPMHooks.count.HP_status_calc_hit_post > 0) {
- signed short (*postHookFunc) (signed short retVal___, struct block_list *bl, struct status_change *sc, int hit, bool viewable);
+ signed int (*postHookFunc) (signed int retVal___, struct block_list *bl, struct status_change *sc, int hit, bool viewable);
for (hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_hit_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_status_calc_hit_post[hIndex].func;
retVal___ = postHookFunc(retVal___, bl, sc, hit, viewable);
@@ -85944,11 +85944,11 @@ signed short HP_status_calc_hit(struct block_list *bl, struct status_change *sc,
}
return retVal___;
}
-signed short HP_status_calc_critical(struct block_list *bl, struct status_change *sc, int critical, bool viewable) {
+signed int HP_status_calc_critical(struct block_list *bl, struct status_change *sc, int critical, bool viewable) {
int hIndex = 0;
- signed short retVal___ = 0;
+ signed int retVal___ = 0;
if (HPMHooks.count.HP_status_calc_critical_pre > 0) {
- signed short (*preHookFunc) (struct block_list **bl, struct status_change **sc, int *critical, bool *viewable);
+ signed int (*preHookFunc) (struct block_list **bl, struct status_change **sc, int *critical, bool *viewable);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_critical_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_status_calc_critical_pre[hIndex].func;
@@ -85963,7 +85963,7 @@ signed short HP_status_calc_critical(struct block_list *bl, struct status_change
retVal___ = HPMHooks.source.status.calc_critical(bl, sc, critical, viewable);
}
if (HPMHooks.count.HP_status_calc_critical_post > 0) {
- signed short (*postHookFunc) (signed short retVal___, struct block_list *bl, struct status_change *sc, int critical, bool viewable);
+ signed int (*postHookFunc) (signed int retVal___, struct block_list *bl, struct status_change *sc, int critical, bool viewable);
for (hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_critical_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_status_calc_critical_post[hIndex].func;
retVal___ = postHookFunc(retVal___, bl, sc, critical, viewable);
@@ -85971,11 +85971,11 @@ signed short HP_status_calc_critical(struct block_list *bl, struct status_change
}
return retVal___;
}
-signed short HP_status_calc_flee(struct block_list *bl, struct status_change *sc, int flee, bool viewable) {
+signed int HP_status_calc_flee(struct block_list *bl, struct status_change *sc, int flee, bool viewable) {
int hIndex = 0;
- signed short retVal___ = 0;
+ signed int retVal___ = 0;
if (HPMHooks.count.HP_status_calc_flee_pre > 0) {
- signed short (*preHookFunc) (struct block_list **bl, struct status_change **sc, int *flee, bool *viewable);
+ signed int (*preHookFunc) (struct block_list **bl, struct status_change **sc, int *flee, bool *viewable);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_flee_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_status_calc_flee_pre[hIndex].func;
@@ -85990,7 +85990,7 @@ signed short HP_status_calc_flee(struct block_list *bl, struct status_change *sc
retVal___ = HPMHooks.source.status.calc_flee(bl, sc, flee, viewable);
}
if (HPMHooks.count.HP_status_calc_flee_post > 0) {
- signed short (*postHookFunc) (signed short retVal___, struct block_list *bl, struct status_change *sc, int flee, bool viewable);
+ signed int (*postHookFunc) (signed int retVal___, struct block_list *bl, struct status_change *sc, int flee, bool viewable);
for (hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_flee_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_status_calc_flee_post[hIndex].func;
retVal___ = postHookFunc(retVal___, bl, sc, flee, viewable);
@@ -85998,11 +85998,11 @@ signed short HP_status_calc_flee(struct block_list *bl, struct status_change *sc
}
return retVal___;
}
-signed short HP_status_calc_flee2(struct block_list *bl, struct status_change *sc, int flee2, bool viewable) {
+signed int HP_status_calc_flee2(struct block_list *bl, struct status_change *sc, int flee2, bool viewable) {
int hIndex = 0;
- signed short retVal___ = 0;
+ signed int retVal___ = 0;
if (HPMHooks.count.HP_status_calc_flee2_pre > 0) {
- signed short (*preHookFunc) (struct block_list **bl, struct status_change **sc, int *flee2, bool *viewable);
+ signed int (*preHookFunc) (struct block_list **bl, struct status_change **sc, int *flee2, bool *viewable);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_flee2_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_status_calc_flee2_pre[hIndex].func;
@@ -86017,7 +86017,7 @@ signed short HP_status_calc_flee2(struct block_list *bl, struct status_change *s
retVal___ = HPMHooks.source.status.calc_flee2(bl, sc, flee2, viewable);
}
if (HPMHooks.count.HP_status_calc_flee2_post > 0) {
- signed short (*postHookFunc) (signed short retVal___, struct block_list *bl, struct status_change *sc, int flee2, bool viewable);
+ signed int (*postHookFunc) (signed int retVal___, struct block_list *bl, struct status_change *sc, int flee2, bool viewable);
for (hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_flee2_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_status_calc_flee2_post[hIndex].func;
retVal___ = postHookFunc(retVal___, bl, sc, flee2, viewable);
@@ -86295,11 +86295,11 @@ uint32 HP_status_calc_mode(const struct block_list *bl, const struct status_chan
}
return retVal___;
}
-unsigned short HP_status_calc_ematk(struct block_list *bl, struct status_change *sc, int matk) {
+int HP_status_calc_ematk(struct block_list *bl, struct status_change *sc, int matk) {
int hIndex = 0;
- unsigned short retVal___ = 0;
+ int retVal___ = 0;
if (HPMHooks.count.HP_status_calc_ematk_pre > 0) {
- unsigned short (*preHookFunc) (struct block_list **bl, struct status_change **sc, int *matk);
+ int (*preHookFunc) (struct block_list **bl, struct status_change **sc, int *matk);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_ematk_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_status_calc_ematk_pre[hIndex].func;
@@ -86314,7 +86314,7 @@ unsigned short HP_status_calc_ematk(struct block_list *bl, struct status_change
retVal___ = HPMHooks.source.status.calc_ematk(bl, sc, matk);
}
if (HPMHooks.count.HP_status_calc_ematk_post > 0) {
- unsigned short (*postHookFunc) (unsigned short retVal___, struct block_list *bl, struct status_change *sc, int matk);
+ int (*postHookFunc) (int retVal___, struct block_list *bl, struct status_change *sc, int matk);
for (hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_ematk_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_status_calc_ematk_post[hIndex].func;
retVal___ = postHookFunc(retVal___, bl, sc, matk);
@@ -86645,11 +86645,11 @@ void HP_status_copy(struct status_data *a, const struct status_data *b) {
}
return;
}
-unsigned short HP_status_base_matk_min(const struct status_data *st) {
+int HP_status_base_matk_min(const struct status_data *st) {
int hIndex = 0;
- unsigned short retVal___ = 0;
+ int retVal___ = 0;
if (HPMHooks.count.HP_status_base_matk_min_pre > 0) {
- unsigned short (*preHookFunc) (const struct status_data **st);
+ int (*preHookFunc) (const struct status_data **st);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_status_base_matk_min_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_status_base_matk_min_pre[hIndex].func;
@@ -86664,7 +86664,7 @@ unsigned short HP_status_base_matk_min(const struct status_data *st) {
retVal___ = HPMHooks.source.status.base_matk_min(st);
}
if (HPMHooks.count.HP_status_base_matk_min_post > 0) {
- unsigned short (*postHookFunc) (unsigned short retVal___, const struct status_data *st);
+ int (*postHookFunc) (int retVal___, const struct status_data *st);
for (hIndex = 0; hIndex < HPMHooks.count.HP_status_base_matk_min_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_status_base_matk_min_post[hIndex].func;
retVal___ = postHookFunc(retVal___, st);
@@ -86672,11 +86672,11 @@ unsigned short HP_status_base_matk_min(const struct status_data *st) {
}
return retVal___;
}
-unsigned short HP_status_base_matk_max(const struct status_data *st) {
+int HP_status_base_matk_max(const struct status_data *st) {
int hIndex = 0;
- unsigned short retVal___ = 0;
+ int retVal___ = 0;
if (HPMHooks.count.HP_status_base_matk_max_pre > 0) {
- unsigned short (*preHookFunc) (const struct status_data **st);
+ int (*preHookFunc) (const struct status_data **st);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_status_base_matk_max_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_status_base_matk_max_pre[hIndex].func;
@@ -86691,7 +86691,7 @@ unsigned short HP_status_base_matk_max(const struct status_data *st) {
retVal___ = HPMHooks.source.status.base_matk_max(st);
}
if (HPMHooks.count.HP_status_base_matk_max_post > 0) {
- unsigned short (*postHookFunc) (unsigned short retVal___, const struct status_data *st);
+ int (*postHookFunc) (int retVal___, const struct status_data *st);
for (hIndex = 0; hIndex < HPMHooks.count.HP_status_base_matk_max_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_status_base_matk_max_post[hIndex].func;
retVal___ = postHookFunc(retVal___, st);
diff --git a/src/plugins/sample.c b/src/plugins/sample.c
index 7ad6794b3..da29bd837 100644
--- a/src/plugins/sample.c
+++ b/src/plugins/sample.c
@@ -26,6 +26,8 @@
#include "common/random.h"
#include "common/socket.h"
#include "common/strlib.h"
+#include "login/login.h"
+#include "login/lclif.p.h"
#include "map/clif.h"
#include "map/pc.h"
#include "map/script.h"
@@ -136,6 +138,19 @@ int my_pc_dropitem_post(int retVal, struct map_session_data *sd, int n, int amou
}
return 1;
}
+
+ /**
+ * pre-hook for lclif->p->parse_CA_CONNECT_INFO_CHANGED this is a private interface function and while in source it cannot be used
+ * outside of lclif.c since it's private, plugin can use it and hook to private interface functions if needed
+ * the pre-hook takes this currently unused packet and show a notice whenver a player sends it
+ **/
+enum parsefunc_rcode my_lclif_parse_CA_CONNECT_INFO_CHANGED_pre(int *fd, struct login_session_data **sd) __attribute__((nonnull(2)));
+enum parsefunc_rcode my_lclif_parse_CA_CONNECT_INFO_CHANGED_pre(int *fd, struct login_session_data **sd)
+{
+ ShowNotice("Player (AID: %d) has sent CA_CONNECT_INFO_CHANGED packet\n", (*sd)->account_id);
+ return PACKET_VALID;
+}
+
/*
* Key is the setting name in our example it's 'my_setting' while val is the value of it.
* this way you can manage more than one setting in one function instead of define multiable ones
@@ -212,6 +227,14 @@ HPExport void plugin_init (void) {
/* - by checking whether it was successful (retVal value) it allows for the originals conditions to take place */
addHookPost(pc, dropitem, my_pc_dropitem_post);
}
+
+ if (SERVER_TYPE == SERVER_TYPE_LOGIN) {
+ /**
+ * In this example we add a pre-hook to lclif->p->parse_CA_CONNECT_INFO_CHANGED
+ * It's similar to nomral hooks except it have it own hooking macros which ends with Priv
+ **/
+ addHookPrePriv(lclif, parse_CA_CONNECT_INFO_CHANGED, my_lclif_parse_CA_CONNECT_INFO_CHANGED_pre);
+ }
}
/* triggered when server starts loading, before any server-specific data is set */
HPExport void server_preinit(void)
diff --git a/tools/itemdbconverter.pl b/tools/itemdbconverter.pl
index 58cb08bc1..fe30ce24e 100755
--- a/tools/itemdbconverter.pl
+++ b/tools/itemdbconverter.pl
@@ -109,9 +109,9 @@ sub parsedb (@) {
(?<eLV>[0-9]*)[^,:]*(?<hasmaxlv>:[\s\t]*(?<eLVmax>[0-9]*))?[^,]*,[\s\t]*
(?<Refineable>[0-9]*)[^,]*,[\s\t]*
(?<View>[0-9]*)[^,]*,[\s\t]*
- {(?<Script>.*)},
- {(?<OnEquip>.*)},
- {(?<OnUnequip>.*)}
+ \{(?<Script>.*)},
+ \{(?<OnEquip>.*)},
+ \{(?<OnUnequip>.*)}
/x ) {
my %cols = map { $_ => $+{$_} } keys %+;
print "/*\n" if $cols{prefix};