summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md7
-rw-r--r--conf/map/script.conf2
-rw-r--r--db/re/item_db.conf48
-rw-r--r--doc/constants.md8
-rw-r--r--doc/script_commands.txt11
-rw-r--r--sql-files/item_db_re.sql6
-rw-r--r--src/common/HPMDataCheck.h6
-rw-r--r--src/map/clif.c25
-rw-r--r--src/map/instance.c9
-rw-r--r--src/map/map.c153
-rw-r--r--src/map/map.h41
-rw-r--r--src/map/npc.c20
-rw-r--r--src/map/npc.h2
-rw-r--r--src/map/pc.h3
-rw-r--r--src/map/quest.c42
-rw-r--r--src/map/quest.h34
-rw-r--r--src/map/refine.c2
-rw-r--r--src/map/script.c78
-rw-r--r--src/plugins/HPMHooking/HPMHooking.Defs.inc8
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc8
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc2
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.Hooks.inc69
22 files changed, 303 insertions, 281 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fccc2e5b1..00251f987 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,12 @@ 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+4] `May 5 2019` `PATCH 4`
+
+### Fixed
+
+- Fixed a reading error in refine database caused refine chances to be incorrectly read. (#2481)
+
## [v2019.05.05+3] `May 5 2019` `PATCH 3`
### Fixed
@@ -762,6 +768,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+4]: https://github.com/HerculesWS/Hercules/compare/v2019.05.05+3...v2019.05.05+4
[v2019.05.05+3]: https://github.com/HerculesWS/Hercules/compare/v2019.05.05+2...v2019.05.05+3
[v2019.05.05+2]: https://github.com/HerculesWS/Hercules/compare/v2019.05.05+1...v2019.05.05+2
[v2019.05.05+1]: https://github.com/HerculesWS/Hercules/compare/v2019.05.05...v2019.05.05+1
diff --git a/conf/map/script.conf b/conf/map/script.conf
index fc617d858..802ce2538 100644
--- a/conf/map/script.conf
+++ b/conf/map/script.conf
@@ -52,7 +52,7 @@ script_configuration: {
// Default value of the 'min' argument of the script command 'input'.
// When the 'min' argument isn't provided, this value is used instead.
// Defaults to 0.
- //input_min_value: 0
+ input_min_value: 0
// Default value of the 'max' argument of the script command 'input'.
// When the 'max' argument isn't provided, this value is used instead.
diff --git a/db/re/item_db.conf b/db/re/item_db.conf
index 961fa102e..6c0bea7f0 100644
--- a/db/re/item_db.conf
+++ b/db/re/item_db.conf
@@ -148002,6 +148002,54 @@ item_db: (
Script: <" percentheal 5,5; ">
},
{
+ Id: 22702
+ AegisName: "STR_Soul_Potion"
+ Name: "STR Reduction Potion"
+ Type: "IT_DELAYCONSUME"
+ Buy: 10
+ Script: <" callfunc("F_CashReduceStat", bStr, -1, STR_Soul_Potion); ">
+},
+{
+ Id: 22703
+ AegisName: "AGI_Soul_Potion"
+ Name: "AGI Reduction Potion"
+ Type: "IT_DELAYCONSUME"
+ Buy: 10
+ Script: <" callfunc("F_CashReduceStat", bAgi, -1, AGI_Soul_Potion); ">
+},
+{
+ Id: 22704
+ AegisName: "VIT_Soul_Potion"
+ Name: "VIT Reduction Potion"
+ Type: "IT_DELAYCONSUME"
+ Buy: 10
+ Script: <" callfunc("F_CashReduceStat", bVit, -1, VIT_Soul_Potion); ">
+},
+{
+ Id: 22705
+ AegisName: "INT_Soul_Potion"
+ Name: "INT Reduction Potion"
+ Type: "IT_DELAYCONSUME"
+ Buy: 10
+ Script: <" callfunc("F_CashReduceStat", bInt, -1, INT_Soul_Potion); ">
+},
+{
+ Id: 22706
+ AegisName: "DEX_Soul_Potion"
+ Name: "DEX Reduction Potion"
+ Type: "IT_DELAYCONSUME"
+ Buy: 10
+ Script: <" callfunc("F_CashReduceStat", bDex, -1, DEX_Soul_Potion); ">
+},
+{
+ Id: 22707
+ AegisName: "LUK_Soul_Potion"
+ Name: "LUK Reduction Potion"
+ Type: "IT_DELAYCONSUME"
+ Buy: 10
+ Script: <" callfunc("F_CashReduceStat", bLuk, -1, LUK_Soul_Potion); ">
+},
+{
Id: 22737
AegisName: "Bullet_Case_Blood_"
Name: "Bloody Bullet Case"
diff --git a/doc/constants.md b/doc/constants.md
index d5dbf7afd..835b49036 100644
--- a/doc/constants.md
+++ b/doc/constants.md
@@ -3934,6 +3934,7 @@
- `MAX_MENU_LENGTH`: 2048
- `MOB_CLONE_START`: 4001
- `MOB_CLONE_END`: 5000
+- `MAX_NPC_PER_MAP`: 512
### status options
@@ -4201,6 +4202,7 @@
- `MAPINFO_SIZE_X`: 2
- `MAPINFO_SIZE_Y`: 3
- `MAPINFO_ZONE`: 4
+- `MAPINFO_NPC_COUNT`: 5
### consolemes options
@@ -17895,6 +17897,12 @@
- `Chest_Of_Death`: 22679
- `Solo_Christmas_Gift`: 22685
- `Solo_Cookie`: 22686
+- `STR_Soul_Potion`: 22702
+- `AGI_Soul_Potion`: 22703
+- `VIT_Soul_Potion`: 22704
+- `INT_Soul_Potion`: 22705
+- `DEX_Soul_Potion`: 22706
+- `LUK_Soul_Potion`: 22707
- `Bullet_Case_Blood_`: 22737
- `Bullet_Case_Silver_`: 22738
- `Sphere_Case_Wind_`: 22739
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index 2cbeff37b..bcd2297b9 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -3396,11 +3396,12 @@ argument is omitted, it will try to use the map of the attached NPC, or the
map of the attached player if the NPC can't be found.
Valid <info> are:
- MAPINFO_NAME name of the map
- MAPINFO_ID numeric ID of the map
- MAPINFO_ZONE name of the zone used by the map
- MAPINFO_SIZE_X width of the map (cells on the x axis)
- MAPINFO_SIZE_Y height of the map (cells on the y axis)
+ MAPINFO_NAME name of the map
+ MAPINFO_ID numeric ID of the map
+ MAPINFO_ZONE name of the zone used by the map
+ MAPINFO_SIZE_X width of the map (cells on the x axis)
+ MAPINFO_SIZE_Y height of the map (cells on the y axis)
+ MAPINFO_NPC_COUNT total number of NPC in the map
Examples:
getmapinfo(MAPINFO_ID, "map name"); // ID from name
diff --git a/sql-files/item_db_re.sql b/sql-files/item_db_re.sql
index c2a017a8d..933ef3815 100644
--- a/sql-files/item_db_re.sql
+++ b/sql-files/item_db_re.sql
@@ -9956,6 +9956,12 @@ REPLACE INTO `item_db` VALUES ('22676','Hangul_Day_Event_Box','Hangul Day Event
REPLACE INTO `item_db` VALUES ('22679','Chest_Of_Death','Death Bin','18','0','10','5','0','0','0','0','0','0','18446744073709551615','63','2','0','0','170',NULL,'0','1','0','0','0','0','0','0',NULL,'0',NULL,'0',NULL,'0','','','');
REPLACE INTO `item_db` VALUES ('22685','Solo_Christmas_Gift','Single Union Christmas Gift','2','0','0','0','0','0','0','0','0','0','18446744073709551615','63','2','0','0','0',NULL,'0','1','0','0','0','0','0','467',NULL,'0',NULL,'0',NULL,'0','','','');
REPLACE INTO `item_db` VALUES ('22686','Solo_Cookie','Single Cookie','0','0','0','0','50','0','0','0','0','0','18446744073709551615','63','2','0','0','0',NULL,'0','1','0','0','0','0','0','0',NULL,'0',NULL,'0',NULL,'0','percentheal 5,5;','','');
+REPLACE INTO `item_db` VALUES ('22702','STR_Soul_Potion','STR Reduction Potion','11','0','10','5','0','0','0','0','0','0','18446744073709551615','63','2','0','0','0',NULL,'0','1','0','0','0','0','0','0',NULL,'0',NULL,'0',NULL,'0','callfunc(\"F_CashReduceStat\", bStr, -1, STR_Soul_Potion);','','');
+REPLACE INTO `item_db` VALUES ('22703','AGI_Soul_Potion','AGI Reduction Potion','11','0','10','5','0','0','0','0','0','0','18446744073709551615','63','2','0','0','0',NULL,'0','1','0','0','0','0','0','0',NULL,'0',NULL,'0',NULL,'0','callfunc(\"F_CashReduceStat\", bAgi, -1, AGI_Soul_Potion);','','');
+REPLACE INTO `item_db` VALUES ('22704','VIT_Soul_Potion','VIT Reduction Potion','11','0','10','5','0','0','0','0','0','0','18446744073709551615','63','2','0','0','0',NULL,'0','1','0','0','0','0','0','0',NULL,'0',NULL,'0',NULL,'0','callfunc(\"F_CashReduceStat\", bVit, -1, VIT_Soul_Potion);','','');
+REPLACE INTO `item_db` VALUES ('22705','INT_Soul_Potion','INT Reduction Potion','11','0','10','5','0','0','0','0','0','0','18446744073709551615','63','2','0','0','0',NULL,'0','1','0','0','0','0','0','0',NULL,'0',NULL,'0',NULL,'0','callfunc(\"F_CashReduceStat\", bInt, -1, INT_Soul_Potion);','','');
+REPLACE INTO `item_db` VALUES ('22706','DEX_Soul_Potion','DEX Reduction Potion','11','0','10','5','0','0','0','0','0','0','18446744073709551615','63','2','0','0','0',NULL,'0','1','0','0','0','0','0','0',NULL,'0',NULL,'0',NULL,'0','callfunc(\"F_CashReduceStat\", bDex, -1, DEX_Soul_Potion);','','');
+REPLACE INTO `item_db` VALUES ('22707','LUK_Soul_Potion','LUK Reduction Potion','11','0','10','5','0','0','0','0','0','0','18446744073709551615','63','2','0','0','0',NULL,'0','1','0','0','0','0','0','0',NULL,'0',NULL,'0',NULL,'0','callfunc(\"F_CashReduceStat\", bLuk, -1, LUK_Soul_Potion);','','');
REPLACE INTO `item_db` VALUES ('22737','Bullet_Case_Blood_','Bloody Bullet Case','2','0','2','1','250','0','0','0','0','0','18446744073709551615','63','2','0','0','0',NULL,'0','1','0','0','0','0','0','0',NULL,'0',NULL,'0',NULL,'0','getitem Shell_Of_Blood_, 500;','','');
REPLACE INTO `item_db` VALUES ('22738','Bullet_Case_Silver_','Silver Bullet Case','2','0','2','1','250','0','0','0','0','0','18446744073709551615','63','2','0','0','0',NULL,'0','1','0','0','0','0','0','0',NULL,'0',NULL,'0',NULL,'0','getitem Silver_Bullet_, 500;','','');
REPLACE INTO `item_db` VALUES ('22739','Sphere_Case_Wind_','Lightning Sphere Pack','2','0','2','1','350','0','0','0','0','0','18446744073709551615','63','2','0','0','0',NULL,'0','1','0','0','0','0','0','0',NULL,'0',NULL,'0',NULL,'0','getitem Lighting_Sphere_, 500;','','');
diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h
index db0594ff6..0a3494cce 100644
--- a/src/common/HPMDataCheck.h
+++ b/src/common/HPMDataCheck.h
@@ -571,9 +571,6 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = {
{ "mapcell", sizeof(struct mapcell), SERVER_TYPE_MAP },
{ "mapflag_skill_adjust", sizeof(struct mapflag_skill_adjust), SERVER_TYPE_MAP },
{ "mapit_interface", sizeof(struct mapit_interface), SERVER_TYPE_MAP },
- { "questinfo", sizeof(struct questinfo), SERVER_TYPE_MAP },
- { "questinfo_itemreq", sizeof(struct questinfo_itemreq), SERVER_TYPE_MAP },
- { "questinfo_qreq", sizeof(struct questinfo_qreq), SERVER_TYPE_MAP },
{ "spawn_data", sizeof(struct spawn_data), SERVER_TYPE_MAP },
#else
#define MAP_MAP_H
@@ -889,6 +886,9 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = {
{ "quest_dropitem", sizeof(struct quest_dropitem), SERVER_TYPE_MAP },
{ "quest_interface", sizeof(struct quest_interface), SERVER_TYPE_MAP },
{ "quest_objective", sizeof(struct quest_objective), SERVER_TYPE_MAP },
+ { "questinfo", sizeof(struct questinfo), SERVER_TYPE_MAP },
+ { "questinfo_itemreq", sizeof(struct questinfo_itemreq), SERVER_TYPE_MAP },
+ { "questinfo_qreq", sizeof(struct questinfo_qreq), SERVER_TYPE_MAP },
#else
#define MAP_QUEST_H
#endif // MAP_QUEST_H
diff --git a/src/map/clif.c b/src/map/clif.c
index 5228f06a3..b93274d3d 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -10790,15 +10790,7 @@ static void clif_parse_LoadEndAck(int fd, struct map_session_data *sd)
// NPC Quest / Event Icon Check [Kisuka]
#if PACKETVER >= 20090218
- {
- int i;
- for (i = 0; i < VECTOR_LENGTH(map->list[sd->bl.m].qi_data); i++) {
- struct questinfo *qi = &VECTOR_INDEX(map->list[sd->bl.m].qi_data, i);
-
- if (quest->questinfo_validate(sd, qi))
- clif->quest_show_event(sd, &qi->nd->bl, qi->icon, qi->color);
- }
- }
+ quest->questinfo_refresh(sd);
#endif
}
@@ -12851,10 +12843,19 @@ static void clif_parse_NpcAmountInput(int fd, struct map_session_data *sd)
int npcid = RFIFOL(fd,2);
int amount = RFIFOL(fd,6);
- if (amount >= 0)
+ if (amount < sd->npc_amount_min) {
+ sd->npc_amount = sd->npc_amount_min;
+ sd->npc_input_capped_range = -1;
+ }
+ else if (amount > sd->npc_amount_max) {
+ sd->npc_amount = sd->npc_amount_max;
+ sd->npc_input_capped_range = 1;
+ }
+ else {
sd->npc_amount = amount;
- else
- sd->npc_amount = 0;
+ sd->npc_input_capped_range = 0;
+ }
+
npc->scriptcont(sd, npcid, false);
}
diff --git a/src/map/instance.c b/src/map/instance.c
index 1e83b0b76..e87cc03bb 100644
--- a/src/map/instance.c
+++ b/src/map/instance.c
@@ -295,13 +295,6 @@ static int instance_add_map(const char *name, int instance_id, bool usebasename,
}
}
- //Mimic questinfo
- VECTOR_INIT(map->list[im].qi_data);
- VECTOR_ENSURE(map->list[im].qi_data, VECTOR_LENGTH(map->list[m].qi_data), 1);
- for (i = 0; i < VECTOR_LENGTH(map->list[m].qi_data); i++) {
- VECTOR_PUSH(map->list[im].qi_data, VECTOR_INDEX(map->list[m].qi_data, i));
- }
-
map->list[im].m = im;
map->list[im].instance_id = instance_id;
map->list[im].instance_src_map = m;
@@ -518,7 +511,7 @@ static void instance_del_map(int16 m)
aFree(map->list[m].zone_mf);
}
- quest->questinfo_vector_clear(m);
+ VECTOR_CLEAR(map->list[m].qi_list);
// Remove from instance
for( i = 0; i < instance->list[map->list[m].instance_id].num_map; i++ ) {
diff --git a/src/map/map.c b/src/map/map.c
index 2b95ec27a..71eab9286 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -3586,23 +3586,27 @@ static void map_zone_db_clear(void)
}
static void map_clean(int i)
{
- int v;
Assert_retv(i >= 0 && i < map->count);
- if(map->list[i].cell && map->list[i].cell != (struct mapcell *)0xdeadbeaf) aFree(map->list[i].cell);
- if(map->list[i].block) aFree(map->list[i].block);
- if(map->list[i].block_mob) aFree(map->list[i].block_mob);
- if(battle_config.dynamic_mobs) { //Dynamic mobs flag by [random]
- int j;
- if(map->list[i].mob_delete_timer != INVALID_TIMER)
+ if (map->list[i].cell && map->list[i].cell != (struct mapcell *)0xdeadbeaf)
+ aFree(map->list[i].cell);
+ if (map->list[i].block)
+ aFree(map->list[i].block);
+ if (map->list[i].block_mob)
+ aFree(map->list[i].block_mob);
+
+ if (battle_config.dynamic_mobs != 0) { //Dynamic mobs flag by [random]
+ if (map->list[i].mob_delete_timer != INVALID_TIMER)
timer->delete(map->list[i].mob_delete_timer, map->removemobs_timer);
- for (j=0; j<MAX_MOB_LIST_PER_MAP; j++)
- if (map->list[i].moblist[j]) aFree(map->list[i].moblist[j]);
+ for (int j = 0; j < MAX_MOB_LIST_PER_MAP; j++) {
+ if (map->list[i].moblist[j] != NULL)
+ aFree(map->list[i].moblist[j]);
+ }
}
- if( map->list[i].unit_count ) {
- if( map->list[i].units ) {
- for(v = 0; v < map->list[i].unit_count; v++) {
+ if (map->list[i].unit_count != 0) {
+ if (map->list[i].units != NULL) {
+ for (int v = 0; v < map->list[i].unit_count; v++) {
aFree(map->list[i].units[v]);
}
aFree(map->list[i].units);
@@ -3611,98 +3615,44 @@ static void map_clean(int i)
map->list[i].unit_count = 0;
}
- if( map->list[i].skill_count ) {
- if( map->list[i].skills ) {
- for(v = 0; v < map->list[i].skill_count; v++) {
- aFree(map->list[i].skills[v]);
- }
+ if (map->list[i].skill_count != 0) {
+ if (map->list[i].skills != NULL) {
+ for (int v = 0; v < map->list[i].skill_count; v++) {
+ aFree(map->list[i].skills[v]);
+ }
aFree(map->list[i].skills);
map->list[i].skills = NULL;
}
map->list[i].skill_count = 0;
}
- if( map->list[i].zone_mf_count ) {
- if( map->list[i].zone_mf ) {
- for(v = 0; v < map->list[i].zone_mf_count; v++) {
- aFree(map->list[i].zone_mf[v]);
- }
+ if (map->list[i].zone_mf_count != 0) {
+ if (map->list[i].zone_mf != NULL) {
+ for (int v = 0; v < map->list[i].zone_mf_count; v++) {
+ aFree(map->list[i].zone_mf[v]);
+ }
aFree(map->list[i].zone_mf);
map->list[i].zone_mf = NULL;
}
map->list[i].zone_mf_count = 0;
}
- if( map->list[i].channel )
+ if (map->list[i].drop_list_count != 0)
+ map->list[i].drop_list_count = 0;
+ if (map->list[i].drop_list != NULL)
+ aFree(map->list[i].drop_list);
+
+ if (map->list[i].channel != NULL)
channel->delete(map->list[i].channel);
+
+ VECTOR_CLEAR(map->list[i].qi_list);
+ HPM->data_store_destroy(&map->list[i].hdata);
}
static void do_final_maps(void)
{
- int i, v = 0;
-
- for( i = 0; i < map->count; i++ ) {
-
- if(map->list[i].cell && map->list[i].cell != (struct mapcell *)0xdeadbeaf ) aFree(map->list[i].cell);
- if(map->list[i].block) aFree(map->list[i].block);
- if(map->list[i].block_mob) aFree(map->list[i].block_mob);
-
- if(battle_config.dynamic_mobs) { //Dynamic mobs flag by [random]
- int j;
- if(map->list[i].mob_delete_timer != INVALID_TIMER)
- timer->delete(map->list[i].mob_delete_timer, map->removemobs_timer);
- for (j=0; j<MAX_MOB_LIST_PER_MAP; j++)
- if (map->list[i].moblist[j]) aFree(map->list[i].moblist[j]);
- }
-
- if( map->list[i].unit_count ) {
- if( map->list[i].units ) {
- for(v = 0; v < map->list[i].unit_count; v++) {
- aFree(map->list[i].units[v]);
- }
- aFree(map->list[i].units);
- map->list[i].units = NULL;
- }
- map->list[i].unit_count = 0;
- }
-
- if( map->list[i].skill_count ) {
- if( map->list[i].skills ) {
- for(v = 0; v < map->list[i].skill_count; v++) {
- aFree(map->list[i].skills[v]);
- }
- aFree(map->list[i].skills);
- map->list[i].skills = NULL;
- }
- map->list[i].skill_count = 0;
- }
-
- if( map->list[i].zone_mf_count ) {
- if( map->list[i].zone_mf ) {
- for(v = 0; v < map->list[i].zone_mf_count; v++) {
- aFree(map->list[i].zone_mf[v]);
- }
- aFree(map->list[i].zone_mf);
- map->list[i].zone_mf = NULL;
- }
- map->list[i].zone_mf_count = 0;
- }
-
- if( map->list[i].drop_list_count ) {
- map->list[i].drop_list_count = 0;
- }
- if( map->list[i].drop_list != NULL )
- aFree(map->list[i].drop_list);
-
- if( map->list[i].channel )
- channel->delete(map->list[i].channel);
-
- quest->questinfo_vector_clear(i);
-
- HPM->data_store_destroy(&map->list[i].hdata);
- }
-
+ for (int i = 0; i < map->count; i++)
+ map->clean(i);
map->zone_db_clear();
-
}
static void map_zonedb_reload(void)
@@ -3793,7 +3743,8 @@ static void map_flags_init(void)
map->list[i].short_damage_rate = 100;
map->list[i].long_damage_rate = 100;
- VECTOR_INIT(map->list[i].qi_data);
+ VECTOR_CLEAR(map->list[i].qi_list);
+ VECTOR_INIT(map->list[i].qi_list);
}
}
@@ -6029,28 +5980,30 @@ static int map_get_new_bonus_id(void)
return map->bonus_id++;
}
-static void map_add_questinfo(int m, struct questinfo *qi)
+static bool map_add_questinfo(int m, struct npc_data *nd)
{
- nullpo_retv(qi);
- Assert_retv(m >= 0 && m < map->count);
+ nullpo_retr(false, nd);
+ Assert_retr(false, m >= 0 && m < map->count);
- VECTOR_ENSURE(map->list[m].qi_data, 1, 1);
- VECTOR_PUSH(map->list[m].qi_data, *qi);
+ if (&VECTOR_LAST(map->list[m].qi_list) == nd)
+ return false;
+
+ VECTOR_ENSURE(map->list[m].qi_list, 1, 1);
+ VECTOR_PUSH(map->list[m].qi_list, *nd);
+ return true;
}
static bool map_remove_questinfo(int m, struct npc_data *nd)
{
- unsigned short i;
nullpo_retr(false, nd);
Assert_retr(false, m >= 0 && m < map->count);
- for (i = 0; i < VECTOR_LENGTH(map->list[m].qi_data); i++) {
- struct questinfo *qi_data = &VECTOR_INDEX(map->list[m].qi_data, i);
- if (qi_data->nd == nd) {
- VECTOR_ERASE(map->list[m].qi_data, i);
- return true;
- }
+ int i;
+ ARR_FIND(0, VECTOR_LENGTH(map->list[m].qi_list), i, &VECTOR_INDEX(map->list[m].qi_list, i) == nd);
+ if (i != VECTOR_LENGTH(map->list[m].qi_list)) {
+ VECTOR_ERASE(map->list[m].qi_list, i);
+ return true;
}
return false;
}
diff --git a/src/map/map.h b/src/map/map.h
index 1f70680e8..0330eccc4 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -705,41 +705,6 @@ struct map_drop_list {
int drop_per;
};
-struct questinfo_qreq {
- int id;
- int state;
-};
-
-struct questinfo_itemreq {
- int nameid;
- int min;
- int max;
-};
-
-struct questinfo {
- struct npc_data *nd;
- unsigned short icon;
- unsigned char color;
- bool hasJob;
- unsigned int job;/* perhaps a mapid mask would be most flexible? */
- bool sex_enabled;
- int sex;
- struct {
- int min;
- int max;
- } base_level;
- struct {
- int min;
- int max;
- } job_level;
- VECTOR_DECL(struct questinfo_itemreq) items;
- struct s_homunculus homunculus;
- int homunculus_type;
- VECTOR_DECL(struct questinfo_qreq) quest_requirement;
- int mercenary_class;
-};
-
-
struct map_data {
char name[MAP_NAME_LENGTH];
uint16 index; // The map index used by the mapindex* functions.
@@ -877,8 +842,8 @@ struct map_data {
int len;
} cell_buf;
- /* ShowEvent Data Cache */
- VECTOR_DECL(struct questinfo) qi_data;
+ /* questinfo entries list */
+ VECTOR_DECL(struct npc_data) qi_list;
/* speeds up clif_updatestatus processing by causing hpmeter to run only when someone with the permission can view it */
unsigned short hpmeter_visible;
@@ -1312,7 +1277,7 @@ END_ZEROED_BLOCK;
int (*abort_sub) (struct map_session_data *sd, va_list ap);
void (*update_cell_bl) (struct block_list *bl, bool increase);
int (*get_new_bonus_id) (void);
- void (*add_questinfo) (int m, struct questinfo *qi);
+ bool (*add_questinfo) (int m, struct npc_data *nd);
bool (*remove_questinfo) (int m, struct npc_data *nd);
struct map_zone_data *(*merge_zone) (struct map_zone_data *main, struct map_zone_data *other);
void (*zone_clear_single) (struct map_zone_data *zone);
diff --git a/src/map/npc.c b/src/map/npc.c
index 4b79a9fed..77087d6cb 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -36,6 +36,7 @@
#include "map/mob.h"
#include "map/pc.h"
#include "map/pet.h"
+#include "map/quest.h"
#include "map/script.h"
#include "map/skill.h"
#include "map/status.h"
@@ -2638,8 +2639,9 @@ static int npc_unload(struct npc_data *nd, bool single)
nd->path = NULL;
}
- if( single && nd->bl.m != -1 )
- map->remove_questinfo(nd->bl.m,nd);
+ if (single && nd->bl.m != -1)
+ map->remove_questinfo(nd->bl.m, nd);
+ npc->questinfo_clear(nd);
if (nd->src_id == 0 && ( nd->subtype == SHOP || nd->subtype == CASHSHOP)) {
//src check for duplicate shops [Orcao]
@@ -2978,6 +2980,7 @@ static struct npc_data *npc_create_npc(enum npc_subtype subtype, int m, int x, i
nd->class_ = class_;
nd->speed = 200;
nd->vd = npc_viewdb[0]; // Copy INVISIBLE_CLASS view data. Actual view data is set by npc->add_to_location() later.
+ VECTOR_INIT(nd->qi_data);
return nd;
}
@@ -5331,6 +5334,18 @@ static void npc_debug_warps(void)
npc->debug_warps_sub(map->list[m].npc[i]);
}
+static void npc_questinfo_clear(struct npc_data *nd)
+{
+ nullpo_retv(nd);
+
+ for (int i = 0; i < VECTOR_LENGTH(nd->qi_data); i++) {
+ struct questinfo *qi = &VECTOR_INDEX(nd->qi_data, i);
+ VECTOR_CLEAR(qi->items);
+ VECTOR_CLEAR(qi->quest_requirement);
+ }
+ VECTOR_CLEAR(nd->qi_data);
+}
+
/*==========================================
* npc initialization
*------------------------------------------*/
@@ -5551,4 +5566,5 @@ void npc_defaults(void)
npc->barter_delfromsql_sub = npc_barter_delfromsql_sub;
npc->db_checkid = npc_db_checkid;
npc->refresh = npc_refresh;
+ npc->questinfo_clear = npc_questinfo_clear;
}
diff --git a/src/map/npc.h b/src/map/npc.h
index 0eb8befd1..2819cbd87 100644
--- a/src/map/npc.h
+++ b/src/map/npc.h
@@ -129,6 +129,7 @@ struct npc_data {
int spawn_timer;
} tomb;
} u;
+ VECTOR_DECL(struct questinfo) qi_data;
struct hplugin_data_store *hdata; ///< HPM Plugin Data Store
};
@@ -322,6 +323,7 @@ struct npc_interface {
void (*barter_delfromsql_sub) (const char *npcname, int itemId, int itemId2, int amount2);
bool (*db_checkid) (const int id);
void (*refresh) (struct npc_data* nd);
+ void (*questinfo_clear) (struct npc_data *nd);
/**
* For the Secure NPC Timeout option (check config/Secure.h) [RR]
**/
diff --git a/src/map/pc.h b/src/map/pc.h
index 42c9d204e..7c89f7f32 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -274,6 +274,9 @@ struct map_session_data {
int npc_item_flag; //Marks the npc_id with which you can change equipments during interactions with said npc (see script command enable_itemuse)
int npc_menu; // internal variable, used in npc menu handling
int npc_amount;
+ int npc_amount_min;
+ int npc_amount_max;
+ int npc_input_capped_range;
struct script_state *st;
char npc_str[CHATBOX_SIZE]; // for passing npc input box text to script engine
int npc_timer_id; //For player attached npc timers. [Skotlex]
diff --git a/src/map/quest.c b/src/map/quest.c
index 7a216095e..9540b411d 100644
--- a/src/map/quest.c
+++ b/src/map/quest.c
@@ -672,21 +672,22 @@ static int quest_questinfo_validate_icon(int icon)
*/
static void quest_questinfo_refresh(struct map_session_data *sd)
{
- int i;
-
nullpo_retv(sd);
- for (i = 0; i < VECTOR_LENGTH(map->list[sd->bl.m].qi_data); i++) {
- struct questinfo *qi = &VECTOR_INDEX(map->list[sd->bl.m].qi_data, i);
- // Remove the bubbles if one of the conditions is no longer valid.
- if (quest->questinfo_validate(sd, qi) == false) {
+ for (int i = 0; i < VECTOR_LENGTH(map->list[sd->bl.m].qi_list); i++) {
+ struct npc_data *nd = &VECTOR_INDEX(map->list[sd->bl.m].qi_list, i);
+
+ int j;
+ ARR_FIND(0, VECTOR_LENGTH(nd->qi_data), j, quest->questinfo_validate(sd, &VECTOR_INDEX(nd->qi_data, j)) == true);
+ if (j != VECTOR_LENGTH(nd->qi_data)) {
+ struct questinfo *qi = &VECTOR_INDEX(nd->qi_data, j);
+ clif->quest_show_event(sd, &nd->bl, qi->icon, qi->color);
+ } else {
#if PACKETVER >= 20120410
- clif->quest_show_event(sd, &qi->nd->bl, 9999, 0);
+ clif->quest_show_event(sd, &nd->bl, 9999, 0);
#else
- clif->quest_show_event(sd, &qi->nd->bl, 0, 0);
+ clif->quest_show_event(sd, &nd->bl, 0, 0);
#endif
- } else {
- clif->quest_show_event(sd, &qi->nd->bl, qi->icon, qi->color);
}
}
}
@@ -927,26 +928,6 @@ static bool quest_questinfo_validate_mercenary_class(struct map_session_data *sd
}
/**
- * Clears the questinfo data vector
- *
- * @param m mapindex.
- *
- */
-static void quest_questinfo_vector_clear(int m)
-{
- int i;
-
- Assert_retv(m >= 0 && m < map->count);
-
- for (i = 0; i < VECTOR_LENGTH(map->list[m].qi_data); i++) {
- struct questinfo *qi_data = &VECTOR_INDEX(map->list[m].qi_data, i);
- VECTOR_CLEAR(qi_data->items);
- VECTOR_CLEAR(qi_data->quest_requirement);
- }
- VECTOR_CLEAR(map->list[m].qi_data);
-}
-
-/**
* Initializes the quest interface.
*
* @param minimal Run in minimal mode (skips most of the loading)
@@ -1020,5 +1001,4 @@ void quest_defaults(void)
quest->questinfo_validate_homunculus_type = quest_questinfo_validate_homunculus_type;
quest->questinfo_validate_quests = quest_questinfo_validate_quests;
quest->questinfo_validate_mercenary_class = quest_questinfo_validate_mercenary_class;
- quest->questinfo_vector_clear = quest_questinfo_vector_clear;
}
diff --git a/src/map/quest.h b/src/map/quest.h
index 206a7902f..d60b9b33c 100644
--- a/src/map/quest.h
+++ b/src/map/quest.h
@@ -60,6 +60,39 @@ enum quest_check_type {
HUNTING, ///< Check if the given hunting quest's requirements have been met
};
+struct questinfo_qreq {
+ int id;
+ int state;
+};
+
+struct questinfo_itemreq {
+ int nameid;
+ int min;
+ int max;
+};
+
+struct questinfo {
+ unsigned short icon;
+ unsigned char color;
+ bool hasJob;
+ unsigned int job;/* perhaps a mapid mask would be most flexible? */
+ bool sex_enabled;
+ int sex;
+ struct {
+ int min;
+ int max;
+ } base_level;
+ struct {
+ int min;
+ int max;
+ } job_level;
+ VECTOR_DECL(struct questinfo_itemreq) items;
+ struct s_homunculus homunculus;
+ int homunculus_type;
+ VECTOR_DECL(struct questinfo_qreq) quest_requirement;
+ int mercenary_class;
+};
+
struct quest_interface {
struct quest_db **db_data; ///< Quest database
struct quest_db dummy; ///< Dummy entry for invalid quest lookups
@@ -93,7 +126,6 @@ struct quest_interface {
bool (*questinfo_validate_homunculus_type) (struct map_session_data *sd, struct questinfo *qi);
bool (*questinfo_validate_quests) (struct map_session_data *sd, struct questinfo *qi);
bool (*questinfo_validate_mercenary_class) (struct map_session_data *sd, struct questinfo *qi);
- void (*questinfo_vector_clear) (int m);
};
#ifdef HERCULES_CORE
diff --git a/src/map/refine.c b/src/map/refine.c
index 1ff893c56..4fe6e73c4 100644
--- a/src/map/refine.c
+++ b/src/map/refine.c
@@ -528,7 +528,7 @@ static int refine_readdb_refine_libconfig_sub(struct config_setting_t *r, const
chance[i][j] = 100; // default value for all rates.
struct config_setting_t *t = NULL;
- for (int i = 0; (t = libconfig->setting_get_elem(rate, i++)) != NULL && config_setting_is_group(t); ++i) {
+ for (int i = 0; (t = libconfig->setting_get_elem(rate, i)) != NULL && config_setting_is_group(t); ++i) {
int level = 0, i32;
char *rlvl = config_setting_name(t);
memset(&lv, 0, sizeof(lv));
diff --git a/src/map/script.c b/src/map/script.c
index 8f56b8ee1..1e0cd87ec 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -6948,59 +6948,60 @@ static BUILDIN(jobname)
return true;
}
-/// Get input from the player.
-/// For numeric inputs the value is capped to the range [min,max]. Returns 1 if
-/// the value was higher than 'max', -1 if lower than 'min' and 0 otherwise.
-/// For string inputs it returns 1 if the string was longer than 'max', -1 is
-/// shorter than 'min' and 0 otherwise.
-///
-/// input(<var>{,<min>{,<max>}}) -> <int>
+/*
+ * Get input from the player.
+ * For numeric inputs the value is capped to the range [min,max]. Returns 1 if
+ * the value was higher than 'max', -1 if lower than 'min' and 0 otherwise.
+ * For string inputs it returns 1 if the string was longer than 'max', -1 is
+ * shorter than 'min' and 0 otherwise.
+ *
+ * input(<var>{,<min>{,<max>}}) -> <int>
+ */
static BUILDIN(input)
{
- struct script_data* data;
- int64 uid;
- const char* name;
- int min;
- int max;
struct map_session_data *sd = script->rid2sd(st);
if (sd == NULL)
return true;
- data = script_getdata(st,2);
- if( !data_isreference(data) ) {
+ struct script_data *data = script_getdata(st, 2);
+ if (!data_isreference(data)) {
ShowError("script:input: not a variable\n");
script->reportdata(data);
st->state = END;
return false;
}
- uid = reference_getuid(data);
- name = reference_getname(data);
- min = (script_hasdata(st,3) ? script_getnum(st,3) : script->config.input_min_value);
- max = (script_hasdata(st,4) ? script_getnum(st,4) : script->config.input_max_value);
+
+ int64 uid = reference_getuid(data);
+ const char *name = reference_getname(data);
+ int min = (script_hasdata(st, 3) ? script_getnum(st, 3) : script->config.input_min_value);
+ int max = (script_hasdata(st, 4) ? script_getnum(st, 4) : script->config.input_max_value);
#ifdef SECURE_NPCTIMEOUT
sd->npc_idle_type = NPCT_WAIT;
#endif
- if( !sd->state.menu_or_input ) {
+ if (!sd->state.menu_or_input) {
// first invocation, display npc input box
sd->state.menu_or_input = 1;
st->state = RERUNLINE;
- if( is_string_variable(name) )
- clif->scriptinputstr(sd,st->oid);
- else
- clif->scriptinput(sd,st->oid);
+ if (is_string_variable(name)) {
+ clif->scriptinputstr(sd, st->oid);
+ } else {
+ sd->npc_amount_min = min;
+ sd->npc_amount_max = max;
+ clif->scriptinput(sd, st->oid);
+ }
} else {
// take received text/value and store it in the designated variable
sd->state.menu_or_input = 0;
if (is_string_variable(name)) {
int len = (int)strlen(sd->npc_str);
- script->set_reg(st, sd, uid, name, sd->npc_str, script_getref(st,2));
+ script->set_reg(st, sd, uid, name, sd->npc_str, script_getref(st, 2));
script_pushint(st, (len > max ? 1 : len < min ? -1 : 0));
} else {
int amount = sd->npc_amount;
script->set_reg(st, sd, uid, name, (const void *)h64BPTRSIZE(cap_value(amount,min,max)), script_getref(st,2));
- script_pushint(st, (amount > max ? 1 : amount < min ? -1 : 0));
+ script_pushint(st, sd->npc_input_capped_range);
}
st->state = RUN;
}
@@ -13052,7 +13053,8 @@ enum mapinfo_info {
MAPINFO_ID,
MAPINFO_SIZE_X,
MAPINFO_SIZE_Y,
- MAPINFO_ZONE
+ MAPINFO_ZONE,
+ MAPINFO_NPC_COUNT
};
static BUILDIN(getmapinfo)
@@ -13077,7 +13079,7 @@ static BUILDIN(getmapinfo)
}
if (bl == NULL) {
- ShowError("script:getmapinfo: map not supplied and NPC/PC not attached!\n");
+ ShowError("buildin_getmapinfo: map not supplied and NPC/PC not attached!\n");
script_pushint(st, -3);
return false;
}
@@ -13108,8 +13110,11 @@ static BUILDIN(getmapinfo)
case MAPINFO_ZONE:
script_pushstrcopy(st, map->list[m].zone->name);
break;
+ case MAPINFO_NPC_COUNT:
+ script_pushint(st, map->list[m].npc_num);
+ break;
default:
- ShowError("script:getmapinfo: unknown option in second argument (%u).\n", mode);
+ ShowError("buildin_getmapinfo: unknown option in second argument (%u).\n", mode);
script_pushint(st, -2);
return false;
}
@@ -13915,7 +13920,8 @@ static BUILDIN(failedremovecards)
if (sd->status.inventory[i].card[c] > 0 && itemdb_type(sd->status.inventory[i].card[c]) == IT_CARD) {
cardflag = 1;
- sd->status.inventory[i].card[c] = 0;
+ if (typefail == 1)
+ sd->status.inventory[i].card[c] = 0;
if (typefail == 2) { // add cards to inventory, clear
int flag;
@@ -21267,7 +21273,6 @@ static BUILDIN(questinfo)
return false;
}
- qi.nd = nd;
qi.icon = quest->questinfo_validate_icon(icon);
if (script_hasdata(st, 3)) {
int color = script_getnum(st, 3);
@@ -21279,7 +21284,9 @@ static BUILDIN(questinfo)
qi.color = (unsigned char)color;
}
- map->add_questinfo(nd->bl.m, &qi);
+ VECTOR_ENSURE(nd->qi_data, 1, 1);
+ VECTOR_PUSH(nd->qi_data, qi);
+ map->add_questinfo(nd->bl.m, nd);
return true;
}
@@ -21297,15 +21304,12 @@ static BUILDIN(setquestinfo)
return false;
}
- qi = &VECTOR_LAST(map->list[nd->bl.m].qi_data);
+ qi = &VECTOR_LAST(nd->qi_data);
if (qi == NULL) {
ShowWarning("buildin_setquestinfo: no valide questinfo data has been found for this npc.\n");
return false;
}
- if (qi->nd != nd) {
- ShowWarning("buildin_setquestinfo: invalid usage, setquestinfo must be used only after questinfo.\n");
- return false;
- }
+
switch (type) {
case QINFO_JOB:
{
@@ -26123,6 +26127,7 @@ static void script_hardcoded_constants(void)
script->set_constant("MAX_MENU_LENGTH", MAX_MENU_LENGTH, false, false);
script->set_constant("MOB_CLONE_START", MOB_CLONE_START, false, false);
script->set_constant("MOB_CLONE_END", MOB_CLONE_END, false, false);
+ script->set_constant("MAX_NPC_PER_MAP", MAX_NPC_PER_MAP, false, false);
script->constdb_comment("status options");
script->set_constant("Option_Nothing",OPTION_NOTHING,false, false);
@@ -26373,6 +26378,7 @@ static void script_hardcoded_constants(void)
script->set_constant("MAPINFO_SIZE_X", MAPINFO_SIZE_X, false, false);
script->set_constant("MAPINFO_SIZE_Y", MAPINFO_SIZE_Y, false, false);
script->set_constant("MAPINFO_ZONE", MAPINFO_ZONE, false, false);
+ script->set_constant("MAPINFO_NPC_COUNT", MAPINFO_NPC_COUNT, false, false);
script->constdb_comment("consolemes options");
script->set_constant("CONSOLEMES_DEBUG", CONSOLEMES_DEBUG, false, false);
diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc
index 920f81ca5..d8bf3fae9 100644
--- a/src/plugins/HPMHooking/HPMHooking.Defs.inc
+++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc
@@ -4816,8 +4816,8 @@ typedef void (*HPMHOOK_pre_map_update_cell_bl) (struct block_list **bl, bool *in
typedef void (*HPMHOOK_post_map_update_cell_bl) (struct block_list *bl, bool increase);
typedef int (*HPMHOOK_pre_map_get_new_bonus_id) (void);
typedef int (*HPMHOOK_post_map_get_new_bonus_id) (int retVal___);
-typedef void (*HPMHOOK_pre_map_add_questinfo) (int *m, struct questinfo **qi);
-typedef void (*HPMHOOK_post_map_add_questinfo) (int m, struct questinfo *qi);
+typedef bool (*HPMHOOK_pre_map_add_questinfo) (int *m, struct npc_data **nd);
+typedef bool (*HPMHOOK_post_map_add_questinfo) (bool retVal___, int m, struct npc_data *nd);
typedef bool (*HPMHOOK_pre_map_remove_questinfo) (int *m, struct npc_data **nd);
typedef bool (*HPMHOOK_post_map_remove_questinfo) (bool retVal___, int m, struct npc_data *nd);
typedef struct map_zone_data* (*HPMHOOK_pre_map_merge_zone) (struct map_zone_data **main, struct map_zone_data **other);
@@ -5794,6 +5794,8 @@ typedef bool (*HPMHOOK_pre_npc_db_checkid) (const int *id);
typedef bool (*HPMHOOK_post_npc_db_checkid) (bool retVal___, const int id);
typedef void (*HPMHOOK_pre_npc_refresh) (struct npc_data **nd);
typedef void (*HPMHOOK_post_npc_refresh) (struct npc_data *nd);
+typedef void (*HPMHOOK_pre_npc_questinfo_clear) (struct npc_data **nd);
+typedef void (*HPMHOOK_post_npc_questinfo_clear) (struct npc_data *nd);
typedef int (*HPMHOOK_pre_npc_secure_timeout_timer) (int *tid, int64 *tick, int *id, intptr_t *data);
typedef int (*HPMHOOK_post_npc_secure_timeout_timer) (int retVal___, int tid, int64 tick, int id, intptr_t data);
#endif // MAP_NPC_H
@@ -6626,8 +6628,6 @@ typedef bool (*HPMHOOK_pre_quest_questinfo_validate_quests) (struct map_session_
typedef bool (*HPMHOOK_post_quest_questinfo_validate_quests) (bool retVal___, struct map_session_data *sd, struct questinfo *qi);
typedef bool (*HPMHOOK_pre_quest_questinfo_validate_mercenary_class) (struct map_session_data **sd, struct questinfo **qi);
typedef bool (*HPMHOOK_post_quest_questinfo_validate_mercenary_class) (bool retVal___, struct map_session_data *sd, struct questinfo *qi);
-typedef void (*HPMHOOK_pre_quest_questinfo_vector_clear) (int *m);
-typedef void (*HPMHOOK_post_quest_questinfo_vector_clear) (int m);
#endif // MAP_QUEST_H
#ifdef MAP_REFINE_H /* refine */
typedef int (*HPMHOOK_pre_refine_init) (bool *minimal);
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
index 9c0b1905e..1044b7592 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
@@ -4356,6 +4356,8 @@ struct {
struct HPMHookPoint *HP_npc_db_checkid_post;
struct HPMHookPoint *HP_npc_refresh_pre;
struct HPMHookPoint *HP_npc_refresh_post;
+ struct HPMHookPoint *HP_npc_questinfo_clear_pre;
+ struct HPMHookPoint *HP_npc_questinfo_clear_post;
struct HPMHookPoint *HP_npc_secure_timeout_timer_pre;
struct HPMHookPoint *HP_npc_secure_timeout_timer_post;
struct HPMHookPoint *HP_nullpo_assert_report_pre;
@@ -5136,8 +5138,6 @@ struct {
struct HPMHookPoint *HP_quest_questinfo_validate_quests_post;
struct HPMHookPoint *HP_quest_questinfo_validate_mercenary_class_pre;
struct HPMHookPoint *HP_quest_questinfo_validate_mercenary_class_post;
- struct HPMHookPoint *HP_quest_questinfo_vector_clear_pre;
- struct HPMHookPoint *HP_quest_questinfo_vector_clear_post;
struct HPMHookPoint *HP_refine_init_pre;
struct HPMHookPoint *HP_refine_init_post;
struct HPMHookPoint *HP_refine_final_pre;
@@ -11137,6 +11137,8 @@ struct {
int HP_npc_db_checkid_post;
int HP_npc_refresh_pre;
int HP_npc_refresh_post;
+ int HP_npc_questinfo_clear_pre;
+ int HP_npc_questinfo_clear_post;
int HP_npc_secure_timeout_timer_pre;
int HP_npc_secure_timeout_timer_post;
int HP_nullpo_assert_report_pre;
@@ -11917,8 +11919,6 @@ struct {
int HP_quest_questinfo_validate_quests_post;
int HP_quest_questinfo_validate_mercenary_class_pre;
int HP_quest_questinfo_validate_mercenary_class_post;
- int HP_quest_questinfo_vector_clear_pre;
- int HP_quest_questinfo_vector_clear_post;
int HP_refine_init_pre;
int HP_refine_init_post;
int HP_refine_final_pre;
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
index 6c0b6db36..a817b2023 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
@@ -2230,6 +2230,7 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(npc->barter_delfromsql_sub, HP_npc_barter_delfromsql_sub) },
{ HP_POP(npc->db_checkid, HP_npc_db_checkid) },
{ HP_POP(npc->refresh, HP_npc_refresh) },
+ { HP_POP(npc->questinfo_clear, HP_npc_questinfo_clear) },
{ HP_POP(npc->secure_timeout_timer, HP_npc_secure_timeout_timer) },
/* nullpo_interface */
{ HP_POP(nullpo->assert_report, HP_nullpo_assert_report) },
@@ -2629,7 +2630,6 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(quest->questinfo_validate_homunculus_type, HP_quest_questinfo_validate_homunculus_type) },
{ HP_POP(quest->questinfo_validate_quests, HP_quest_questinfo_validate_quests) },
{ HP_POP(quest->questinfo_validate_mercenary_class, HP_quest_questinfo_validate_mercenary_class) },
- { HP_POP(quest->questinfo_vector_clear, HP_quest_questinfo_vector_clear) },
/* refine_interface */
{ HP_POP(refine->init, HP_refine_init) },
{ HP_POP(refine->final, HP_refine_final) },
diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
index 9cc986922..9636d67c7 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
@@ -49379,31 +49379,32 @@ int HP_map_get_new_bonus_id(void) {
}
return retVal___;
}
-void HP_map_add_questinfo(int m, struct questinfo *qi) {
+bool HP_map_add_questinfo(int m, struct npc_data *nd) {
int hIndex = 0;
+ bool retVal___ = false;
if (HPMHooks.count.HP_map_add_questinfo_pre > 0) {
- void (*preHookFunc) (int *m, struct questinfo **qi);
+ bool (*preHookFunc) (int *m, struct npc_data **nd);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_map_add_questinfo_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_map_add_questinfo_pre[hIndex].func;
- preHookFunc(&m, &qi);
+ retVal___ = preHookFunc(&m, &nd);
}
if (*HPMforce_return) {
*HPMforce_return = false;
- return;
+ return retVal___;
}
}
{
- HPMHooks.source.map.add_questinfo(m, qi);
+ retVal___ = HPMHooks.source.map.add_questinfo(m, nd);
}
if (HPMHooks.count.HP_map_add_questinfo_post > 0) {
- void (*postHookFunc) (int m, struct questinfo *qi);
+ bool (*postHookFunc) (bool retVal___, int m, struct npc_data *nd);
for (hIndex = 0; hIndex < HPMHooks.count.HP_map_add_questinfo_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_map_add_questinfo_post[hIndex].func;
- postHookFunc(m, qi);
+ retVal___ = postHookFunc(retVal___, m, nd);
}
}
- return;
+ return retVal___;
}
bool HP_map_remove_questinfo(int m, struct npc_data *nd) {
int hIndex = 0;
@@ -57872,6 +57873,32 @@ void HP_npc_refresh(struct npc_data *nd) {
}
return;
}
+void HP_npc_questinfo_clear(struct npc_data *nd) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_npc_questinfo_clear_pre > 0) {
+ void (*preHookFunc) (struct npc_data **nd);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_npc_questinfo_clear_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_npc_questinfo_clear_pre[hIndex].func;
+ preHookFunc(&nd);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.npc.questinfo_clear(nd);
+ }
+ if (HPMHooks.count.HP_npc_questinfo_clear_post > 0) {
+ void (*postHookFunc) (struct npc_data *nd);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_npc_questinfo_clear_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_npc_questinfo_clear_post[hIndex].func;
+ postHookFunc(nd);
+ }
+ }
+ return;
+}
int HP_npc_secure_timeout_timer(int tid, int64 tick, int id, intptr_t data) {
int hIndex = 0;
int retVal___ = 0;
@@ -68395,32 +68422,6 @@ bool HP_quest_questinfo_validate_mercenary_class(struct map_session_data *sd, st
}
return retVal___;
}
-void HP_quest_questinfo_vector_clear(int m) {
- int hIndex = 0;
- if (HPMHooks.count.HP_quest_questinfo_vector_clear_pre > 0) {
- void (*preHookFunc) (int *m);
- *HPMforce_return = false;
- for (hIndex = 0; hIndex < HPMHooks.count.HP_quest_questinfo_vector_clear_pre; hIndex++) {
- preHookFunc = HPMHooks.list.HP_quest_questinfo_vector_clear_pre[hIndex].func;
- preHookFunc(&m);
- }
- if (*HPMforce_return) {
- *HPMforce_return = false;
- return;
- }
- }
- {
- HPMHooks.source.quest.questinfo_vector_clear(m);
- }
- if (HPMHooks.count.HP_quest_questinfo_vector_clear_post > 0) {
- void (*postHookFunc) (int m);
- for (hIndex = 0; hIndex < HPMHooks.count.HP_quest_questinfo_vector_clear_post; hIndex++) {
- postHookFunc = HPMHooks.list.HP_quest_questinfo_vector_clear_post[hIndex].func;
- postHookFunc(m);
- }
- }
- return;
-}
/* refine_interface */
int HP_refine_init(bool minimal) {
int hIndex = 0;