summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2019-09-23 00:38:52 +0200
committerGitHub <noreply@github.com>2019-09-23 00:38:52 +0200
commitd6dd1e7d1a8701def756d25ceb170674ee88f619 (patch)
tree291a0b3831c3876d13cad7a4488de3e10ad6c8ac
parenta1b62d431c74c2b805e2b6bd8081c2b7b7a6ff7e (diff)
parentad19056bfcc1e98129bf25e14b58dcd0d438f9f9 (diff)
downloadhercules-d6dd1e7d1a8701def756d25ceb170674ee88f619.tar.gz
hercules-d6dd1e7d1a8701def756d25ceb170674ee88f619.tar.bz2
hercules-d6dd1e7d1a8701def756d25ceb170674ee88f619.tar.xz
hercules-d6dd1e7d1a8701def756d25ceb170674ee88f619.zip
Merge pull request #2462 from hemagx/dehardcoded_rentrals
Dehardcode Rental Expire/Renting item checks
-rw-r--r--db/item_db2.conf2
-rw-r--r--db/pre-re/item_db.conf57
-rw-r--r--db/re/item_db.conf57
-rw-r--r--doc/script_commands.txt6
-rw-r--r--src/map/itemdb.c37
-rw-r--r--src/map/itemdb.h2
-rw-r--r--src/map/pc.c83
-rw-r--r--src/map/script.c46
-rw-r--r--src/map/script.h2
-rw-r--r--src/plugins/HPMHooking/HPMHooking.Defs.inc4
-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.inc52
13 files changed, 271 insertions, 87 deletions
diff --git a/db/item_db2.conf b/db/item_db2.conf
index 8a2d8e429..ed673c5ea 100644
--- a/db/item_db2.conf
+++ b/db/item_db2.conf
@@ -117,6 +117,8 @@ item_db: (
">
OnEquipScript: <" OnEquip Script (can also be multi-line) ">
OnUnequipScript: <" OnUnequip Script (can also be multi-line) ">
+ OnRentalStartScript: <" On item renting script, gets called after item is created in inventory (can also be multi-line) ">
+ OnRentalEndScript: <" On item rent end/expire script, gets called after item is removed from inventory (can also be multi-line) ">
// ================ Optional fields (item_db2 only) ===============
Inherit: true/false (boolean, if true, inherit the values
that weren't specified, from item_db.conf,
diff --git a/db/pre-re/item_db.conf b/db/pre-re/item_db.conf
index c860e0239..ba9de0dd4 100644
--- a/db/pre-re/item_db.conf
+++ b/db/pre-re/item_db.conf
@@ -121,6 +121,8 @@ item_db: (
">
OnEquipScript: <" OnEquip Script (can also be multi-line) ">
OnUnequipScript: <" OnUnequip Script (can also be multi-line) ">
+ OnRentalStartScript: <" On item renting script, gets called after item is created in inventory (can also be multi-line) ">
+ OnRentalEndScript: <" On item rent end/expire script, gets called after item is removed from inventory (can also be multi-line) ">
},
**************************************************************************/
@@ -69570,7 +69572,11 @@ item_db: (
nomail: true
noauction: true
}
- Script: <" setfont 1; ">
+ Script: <" setfont(1); ">
+ OnRentalEndScript: <"
+ if (getfont() == 1)
+ setfont(0);
+ ">
},
{
Id: 12288
@@ -69587,7 +69593,11 @@ item_db: (
nomail: true
noauction: true
}
- Script: <" setfont 2; ">
+ Script: <" setfont(2); ">
+ OnRentalEndScript: <"
+ if (getfont() == 2)
+ setfont(0);
+ ">
},
{
Id: 12289
@@ -69604,7 +69614,11 @@ item_db: (
nomail: true
noauction: true
}
- Script: <" setfont 3; ">
+ Script: <" setfont(3); ">
+ OnRentalEndScript: <"
+ if (getfont() == 3)
+ setfont(0);
+ ">
},
{
Id: 12290
@@ -69856,7 +69870,11 @@ item_db: (
nomail: true
noauction: true
}
- Script: <" setfont 4; ">
+ Script: <" setfont(4); ">
+ OnRentalEndScript: <"
+ if (getfont() == 4)
+ setfont(0);
+ ">
},
{
Id: 12305
@@ -69873,7 +69891,11 @@ item_db: (
nomail: true
noauction: true
}
- Script: <" setfont 5; ">
+ Script: <" setfont(5); ">
+ OnRentalEndScript: <"
+ if (getfont() == 5)
+ setfont(0);
+ ">
},
{
Id: 12306
@@ -69890,7 +69912,11 @@ item_db: (
nomail: true
noauction: true
}
- Script: <" setfont 6; ">
+ Script: <" setfont(6); ">
+ OnRentalEndScript: <"
+ if (getfont() == 6)
+ setfont(0);
+ ">
},
{
Id: 12307
@@ -69907,7 +69933,11 @@ item_db: (
nomail: true
noauction: true
}
- Script: <" setfont 7; ">
+ Script: <" setfont(7); ">
+ OnRentalEndScript: <"
+ if (getfont() == 7)
+ setfont(0);
+ ">
},
{
Id: 12308
@@ -69924,7 +69954,11 @@ item_db: (
nomail: true
noauction: true
}
- Script: <" setfont 8; ">
+ Script: <" setfont(8); ">
+ OnRentalEndScript: <"
+ if (getfont() == 8)
+ setfont(0);
+ ">
},
{
Id: 12309
@@ -69941,7 +69975,11 @@ item_db: (
nomail: true
noauction: true
}
- Script: <" setfont 9; ">
+ Script: <" setfont(9); ">
+ OnRentalEndScript: <"
+ if (getfont() == 9)
+ setfont(0);
+ ">
},
{
Id: 12310
@@ -73051,6 +73089,7 @@ item_db: (
noauction: true
}
Script: <" setcashmount(); ">
+ OnRentalEndScript: <" sc_end(SC_ALL_RIDING); ">
},
{
Id: 12701
diff --git a/db/re/item_db.conf b/db/re/item_db.conf
index 794746784..f9997cb53 100644
--- a/db/re/item_db.conf
+++ b/db/re/item_db.conf
@@ -121,6 +121,8 @@ item_db: (
">
OnEquipScript: <" OnEquip Script (can also be multi-line) ">
OnUnequipScript: <" OnUnequip Script (can also be multi-line) ">
+ OnRentalStartScript: <" On item renting script, gets called after item is created in inventory (can also be multi-line) ">
+ OnRentalEndScript: <" On item rent end/expire script, gets called after item is removed from inventory (can also be multi-line) ">
},
**************************************************************************/
@@ -89226,7 +89228,11 @@ item_db: (
nomail: true
noauction: true
}
- Script: <" setfont 1; ">
+ Script: <" setfont(1); ">
+ OnRentalEndScript: <"
+ if (getfont() == 1)
+ setfont(0);
+ ">
},
{
Id: 12288
@@ -89243,7 +89249,11 @@ item_db: (
nomail: true
noauction: true
}
- Script: <" setfont 2; ">
+ Script: <" setfont(2); ">
+ OnRentalEndScript: <"
+ if (getfont() == 2)
+ setfont(0);
+ ">
},
{
Id: 12289
@@ -89260,7 +89270,11 @@ item_db: (
nomail: true
noauction: true
}
- Script: <" setfont 3; ">
+ Script: <" setfont(3); ">
+ OnRentalEndScript: <"
+ if (getfont() == 3)
+ setfont(0);
+ ">
},
{
Id: 12290
@@ -89512,7 +89526,11 @@ item_db: (
nomail: true
noauction: true
}
- Script: <" setfont 4; ">
+ Script: <" setfont(4); ">
+ OnRentalEndScript: <"
+ if (getfont() == 4)
+ setfont(0);
+ ">
},
{
Id: 12305
@@ -89529,7 +89547,11 @@ item_db: (
nomail: true
noauction: true
}
- Script: <" setfont 5; ">
+ Script: <" setfont(5); ">
+ OnRentalEndScript: <"
+ if (getfont() == 5)
+ setfont(0);
+ ">
},
{
Id: 12306
@@ -89546,7 +89568,11 @@ item_db: (
nomail: true
noauction: true
}
- Script: <" setfont 6; ">
+ Script: <" setfont(6); ">
+ OnRentalEndScript: <"
+ if (getfont() == 6)
+ setfont(0);
+ ">
},
{
Id: 12307
@@ -89563,7 +89589,11 @@ item_db: (
nomail: true
noauction: true
}
- Script: <" setfont 7; ">
+ Script: <" setfont(7); ">
+ OnRentalEndScript: <"
+ if (getfont() == 7)
+ setfont(0);
+ ">
},
{
Id: 12308
@@ -89580,7 +89610,11 @@ item_db: (
nomail: true
noauction: true
}
- Script: <" setfont 8; ">
+ Script: <" setfont(8); ">
+ OnRentalEndScript: <"
+ if (getfont() == 8)
+ setfont(0);
+ ">
},
{
Id: 12309
@@ -89597,7 +89631,11 @@ item_db: (
nomail: true
noauction: true
}
- Script: <" setfont 9; ">
+ Script: <" setfont(9); ">
+ OnRentalEndScript: <"
+ if (getfont() == 9)
+ setfont(0);
+ ">
},
{
Id: 12310
@@ -93349,6 +93387,7 @@ item_db: (
noauction: true
}
Script: <" setcashmount(); ">
+ OnRentalEndScript: <" sc_end(SC_ALL_RIDING); ">
},
{
Id: 12623
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index c603fda44..e6bd32ca6 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -9172,6 +9172,12 @@ currently used font is used, default interface font is used again.
---------------------------------------
+*getfont()
+
+This command return the player's current font.
+if no player is attached it would always return a 0, which is also the default font.
+
+---------------------------------------'
*showdigit(<value>{, <type>})
Displays given numeric 'value' in large digital clock font on top of the
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index bb2732b17..204d0ead5 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -1726,6 +1726,14 @@ static int itemdb_validate_entry(struct item_data *entry, int n, const char *sou
script->free_code(entry->unequip_script);
entry->unequip_script = NULL;
}
+ if (entry->rental_start_script != NULL) {
+ script->free_code(entry->rental_start_script);
+ entry->rental_start_script = NULL;
+ }
+ if (entry->rental_end_script != NULL) {
+ script->free_code(entry->rental_end_script);
+ entry->rental_end_script = NULL;
+ }
return 0;
#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
}
@@ -1756,6 +1764,14 @@ static int itemdb_validate_entry(struct item_data *entry, int n, const char *sou
script->free_code(entry->unequip_script);
entry->unequip_script = NULL;
}
+ if (entry->rental_start_script != NULL) {
+ script->free_code(entry->rental_start_script);
+ entry->rental_start_script = NULL;
+ }
+ if (entry->rental_end_script != NULL) {
+ script->free_code(entry->rental_end_script);
+ entry->rental_end_script = NULL;
+ }
return 0;
}
}
@@ -1883,7 +1899,14 @@ static int itemdb_validate_entry(struct item_data *entry, int n, const char *sou
script->free_code(item->unequip_script);
item->unequip_script = NULL;
}
-
+ if (item->rental_start_script != NULL && item->rental_start_script != entry->rental_start_script) { // Don't free if it's inheriting the same script
+ script->free_code(item->rental_start_script);
+ item->rental_start_script = NULL;
+ }
+ if (item->rental_end_script != NULL && item->rental_end_script != entry->rental_end_script) { // Don't free if it's inheriting the same script
+ script->free_code(item->rental_end_script);
+ item->rental_end_script = NULL;
+ }
*item = *entry;
return item->nameid;
}
@@ -1999,6 +2022,8 @@ static int itemdb_readdb_libconfig_sub(struct config_setting_t *it, int n, const
* ">
* OnEquipScript: <" OnEquip Script ">
* OnUnequipScript: <" OnUnequip Script ">
+ * OnRentalStartScript: <" on renting script ">
+ * OnRentalEndScript: <" on renting end script ">
* Inherit: inherit or override
*/
if( !itemdb->lookup_const(it, "Id", &i32) ) {
@@ -2276,6 +2301,12 @@ static int itemdb_readdb_libconfig_sub(struct config_setting_t *it, int n, const
if( libconfig->setting_lookup_string(it, "OnUnequipScript", &str) )
id.unequip_script = *str ? script->parse(str, source, -id.nameid, SCRIPT_IGNORE_EXTERNAL_BRACKETS, NULL) : NULL;
+ if (libconfig->setting_lookup_string(it, "OnRentalStartScript", &str) != CONFIG_FALSE)
+ id.rental_start_script = (*str != '\0') ? script->parse(str, source, -id.nameid, SCRIPT_IGNORE_EXTERNAL_BRACKETS, NULL) : NULL;
+
+ if (libconfig->setting_lookup_string(it, "OnRentalEndScript", &str) != CONFIG_FALSE)
+ id.rental_end_script = (*str != '\0') ? script->parse(str, source, -id.nameid, SCRIPT_IGNORE_EXTERNAL_BRACKETS, NULL) : NULL;
+
return itemdb->validate_entry(&id, n, source);
}
@@ -2519,6 +2550,10 @@ static void destroy_item_data(struct item_data *self, int free_self)
script->free_code(self->equip_script);
if( self->unequip_script )
script->free_code(self->unequip_script);
+ if (self->rental_start_script != NULL)
+ script->free_code(self->rental_start_script);
+ if (self->rental_end_script != NULL)
+ script->free_code(self->rental_end_script);
if( self->combos )
aFree(self->combos);
HPM->data_store_destroy(&self->hdata);
diff --git a/src/map/itemdb.h b/src/map/itemdb.h
index 7da7609f1..d1e5973e8 100644
--- a/src/map/itemdb.h
+++ b/src/map/itemdb.h
@@ -516,6 +516,8 @@ struct item_data {
struct script_code *script; ///< Default script for everything.
struct script_code *equip_script; ///< Script executed once when equipping.
struct script_code *unequip_script; ///< Script executed once when unequipping.
+ struct script_code *rental_start_script; ///< Script executed once this item get rented
+ struct script_code *rental_end_script; ///< Script executed once this item rent ends
struct {
unsigned available : 1;
unsigned no_refine : 1; // [celest]
diff --git a/src/map/pc.c b/src/map/pc.c
index 8ac820d79..2cefa7674 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -565,72 +565,8 @@ static int pc_inventory_rental_clear(struct map_session_data *sd)
/* assumes i is valid (from default areas where it is called, it is) */
static void pc_rental_expire(struct map_session_data *sd, int i)
{
- int nameid;
-
nullpo_retv(sd);
Assert_retv(i >= 0 && i < sd->status.inventorySize);
- nameid = sd->status.inventory[i].nameid;
-
- /* Soon to be dropped, we got plans to integrate it with item db */
- switch( nameid ) {
- case ITEMID_BOARDING_HALTER:
- status_change_end(&sd->bl,SC_ALL_RIDING,INVALID_TIMER);
- break;
- case ITEMID_LOVE_ANGEL:
- if( sd->status.font == 1 ) {
- sd->status.font = 0;
- clif->font(sd);
- }
- break;
- case ITEMID_SQUIRREL:
- if( sd->status.font == 2 ) {
- sd->status.font = 0;
- clif->font(sd);
- }
- break;
- case ITEMID_GOGO:
- if( sd->status.font == 3 ) {
- sd->status.font = 0;
- clif->font(sd);
- }
- break;
- case ITEMID_PICTURE_DIARY:
- if( sd->status.font == 4 ) {
- sd->status.font = 0;
- clif->font(sd);
- }
- break;
- case ITEMID_MINI_HEART:
- if( sd->status.font == 5 ) {
- sd->status.font = 0;
- clif->font(sd);
- }
- break;
- case ITEMID_NEWCOMER:
- if( sd->status.font == 6 ) {
- sd->status.font = 0;
- clif->font(sd);
- }
- break;
- case ITEMID_KID:
- if( sd->status.font == 7 ) {
- sd->status.font = 0;
- clif->font(sd);
- }
- break;
- case ITEMID_MAGIC_CASTLE:
- if( sd->status.font == 8 ) {
- sd->status.font = 0;
- clif->font(sd);
- }
- break;
- case ITEMID_BULGING_HEAD:
- if( sd->status.font == 9 ) {
- sd->status.font = 0;
- clif->font(sd);
- }
- break;
- }
clif->rental_expired(sd->fd, i, sd->status.inventory[i].nameid);
pc->delitem(sd, i, sd->status.inventory[i].amount, 0, DELITEM_NORMAL, LOG_TYPE_RENTAL);
@@ -4789,13 +4725,15 @@ static int pc_additem(struct map_session_data *sd, const struct item *item_data,
pc->equipitem(sd, i, data->equip);
/* rental item check */
- if( item_data->expire_time ) {
- if( time(NULL) > item_data->expire_time ) {
- pc->rental_expire(sd,i);
+ if (item_data->expire_time > 0) {
+ if (time(NULL) > item_data->expire_time) {
+ pc->rental_expire(sd, i);
} else {
- int seconds = (int)( item_data->expire_time - time(NULL) );
+ int seconds = (int)(item_data->expire_time - time(NULL));
clif->rental_time(sd->fd, sd->status.inventory[i].nameid, seconds);
pc->inventory_rental_add(sd, seconds);
+ if (data->rental_start_script != NULL)
+ script->run_item_rental_start_script(sd, data, 0);
}
}
quest->questinfo_refresh(sd);
@@ -4826,12 +4764,21 @@ static int pc_delitem(struct map_session_data *sd, int n, int amount, int type,
sd->status.inventory[n].amount -= amount;
sd->weight -= sd->inventory_data[n]->weight*amount ;
+
+ // It's here because the data would most likely get zeroed in following if [Hemagx]
+ struct item_data *itd = sd->inventory_data[n];
+ bool is_rental = (sd->status.inventory[n].expire_time > 0) ? true : false;
+
if( sd->status.inventory[n].amount <= 0 ){
if(sd->status.inventory[n].equip)
pc->unequipitem(sd, n, PCUNEQUIPITEM_RECALC|PCUNEQUIPITEM_FORCE);
memset(&sd->status.inventory[n],0,sizeof(sd->status.inventory[0]));
sd->inventory_data[n] = NULL;
}
+
+ if (is_rental && itd->rental_end_script != NULL)
+ script->run_item_rental_end_script(sd, itd, 0);
+
if(!(type&1))
clif->delitem(sd,n,amount,reason);
if(!(type&2))
diff --git a/src/map/script.c b/src/map/script.c
index de00f66be..64b794ba0 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -22744,6 +22744,19 @@ static BUILDIN(setfont)
return true;
}
+static BUILDIN(getfont)
+{
+ struct map_session_data *sd = script->rid2sd(st);
+
+ if (sd == NULL) {
+ script_pushint(st, 0);
+ return true;
+ }
+
+ script_pushint(st, sd->status.font);
+ return true;
+}
+
static int buildin_mobuseskill_sub(struct block_list *bl, va_list ap)
{
struct mob_data *md = NULL;
@@ -25891,6 +25904,36 @@ static void script_run_item_unequip_script(struct map_session_data *sd, struct i
script->current_item_id = 0;
}
+static void script_run_item_rental_start_script(struct map_session_data *sd, struct item_data *data, int oid) __attribute__((nonnull(1, 2)));
+
+/**
+ * Run item rental start script
+ * @param sd player session data. Must be correct and checked before.
+ * @param data rental item data. Must be correct and checked before.
+ * @param oid npc id. Can be also 0 or fake npc id.
+ **/
+static void script_run_item_rental_start_script(struct map_session_data *sd, struct item_data *data, int oid)
+{
+ script->current_item_id = data->nameid;
+ script->run(data->rental_start_script, 0, sd->bl.id, oid);
+ script->current_item_id = 0;
+}
+
+static void script_run_item_rental_end_script(struct map_session_data *sd, struct item_data *data, int oid) __attribute__((nonnull(1, 2)));
+
+/**
+* Run item rental end script
+* @param sd player session data. Must be correct and checked before.
+* @param data rental item data. Must be correct and checked before.
+* @param oid npc id. Can be also 0 or fake npc id.
+**/
+static void script_run_item_rental_end_script(struct map_session_data *sd, struct item_data *data, int oid)
+{
+ script->current_item_id = data->nameid;
+ script->run(data->rental_end_script, 0, sd->bl.id, oid);
+ script->current_item_id = 0;
+}
+
#define BUILDIN_DEF(x,args) { buildin_ ## x , #x , args, false }
#define BUILDIN_DEF2(x,x2,args) { buildin_ ## x , x2 , args, false }
#define BUILDIN_DEF_DEPRECATED(x,args) { buildin_ ## x , #x , args, true }
@@ -26326,6 +26369,7 @@ static void script_parse_builtin(void)
BUILDIN_DEF(mercenary_set_faith,"ii"),
BUILDIN_DEF(readbook,"ii"),
BUILDIN_DEF(setfont,"i"),
+ BUILDIN_DEF(getfont, ""),
BUILDIN_DEF(areamobuseskill,"siiiiviiiii"),
BUILDIN_DEF(progressbar,"si"),
BUILDIN_DEF(progressbar_unit,"si?"),
@@ -27443,4 +27487,6 @@ void script_defaults(void)
script->run_use_script = script_run_use_script;
script->run_item_equip_script = script_run_item_equip_script;
script->run_item_unequip_script = script_run_item_unequip_script;
+ script->run_item_rental_start_script = script_run_item_rental_start_script;
+ script->run_item_rental_end_script = script_run_item_rental_end_script;
}
diff --git a/src/map/script.h b/src/map/script.h
index 64e709a27..a75b948ab 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -1049,6 +1049,8 @@ struct script_interface {
void (*run_use_script) (struct map_session_data *sd, struct item_data *data, int oid);
void (*run_item_equip_script) (struct map_session_data *sd, struct item_data *data, int oid);
void (*run_item_unequip_script) (struct map_session_data *sd, struct item_data *data, int oid);
+ void (*run_item_rental_end_script) (struct map_session_data *sd, struct item_data *data, int oid);
+ void (*run_item_rental_start_script) (struct map_session_data *sd, struct item_data *data, int oid);
};
#ifdef HERCULES_CORE
diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc
index 5e79b3fe3..5fb0c1555 100644
--- a/src/plugins/HPMHooking/HPMHooking.Defs.inc
+++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc
@@ -7062,6 +7062,10 @@ typedef void (*HPMHOOK_pre_script_run_item_equip_script) (struct map_session_dat
typedef void (*HPMHOOK_post_script_run_item_equip_script) (struct map_session_data *sd, struct item_data *data, int oid);
typedef void (*HPMHOOK_pre_script_run_item_unequip_script) (struct map_session_data **sd, struct item_data **data, int *oid);
typedef void (*HPMHOOK_post_script_run_item_unequip_script) (struct map_session_data *sd, struct item_data *data, int oid);
+typedef void (*HPMHOOK_pre_script_run_item_rental_end_script) (struct map_session_data **sd, struct item_data **data, int *oid);
+typedef void (*HPMHOOK_post_script_run_item_rental_end_script) (struct map_session_data *sd, struct item_data *data, int oid);
+typedef void (*HPMHOOK_pre_script_run_item_rental_start_script) (struct map_session_data **sd, struct item_data **data, int *oid);
+typedef void (*HPMHOOK_post_script_run_item_rental_start_script) (struct map_session_data *sd, struct item_data *data, int oid);
#endif // MAP_SCRIPT_H
#ifdef MAP_SEARCHSTORE_H /* searchstore */
typedef bool (*HPMHOOK_pre_searchstore_open) (struct map_session_data **sd, unsigned int *uses, unsigned short *effect);
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
index f45ec4cc2..aa73d8748 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
@@ -5596,6 +5596,10 @@ struct {
struct HPMHookPoint *HP_script_run_item_equip_script_post;
struct HPMHookPoint *HP_script_run_item_unequip_script_pre;
struct HPMHookPoint *HP_script_run_item_unequip_script_post;
+ struct HPMHookPoint *HP_script_run_item_rental_end_script_pre;
+ struct HPMHookPoint *HP_script_run_item_rental_end_script_post;
+ struct HPMHookPoint *HP_script_run_item_rental_start_script_pre;
+ struct HPMHookPoint *HP_script_run_item_rental_start_script_post;
struct HPMHookPoint *HP_searchstore_open_pre;
struct HPMHookPoint *HP_searchstore_open_post;
struct HPMHookPoint *HP_searchstore_query_pre;
@@ -12389,6 +12393,10 @@ struct {
int HP_script_run_item_equip_script_post;
int HP_script_run_item_unequip_script_pre;
int HP_script_run_item_unequip_script_post;
+ int HP_script_run_item_rental_end_script_pre;
+ int HP_script_run_item_rental_end_script_post;
+ int HP_script_run_item_rental_start_script_pre;
+ int HP_script_run_item_rental_start_script_post;
int HP_searchstore_open_pre;
int HP_searchstore_open_post;
int HP_searchstore_query_pre;
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
index ea22350a6..ddc3e643c 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
@@ -2864,6 +2864,8 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(script->run_use_script, HP_script_run_use_script) },
{ HP_POP(script->run_item_equip_script, HP_script_run_item_equip_script) },
{ HP_POP(script->run_item_unequip_script, HP_script_run_item_unequip_script) },
+ { HP_POP(script->run_item_rental_end_script, HP_script_run_item_rental_end_script) },
+ { HP_POP(script->run_item_rental_start_script, HP_script_run_item_rental_start_script) },
/* searchstore_interface */
{ HP_POP(searchstore->open, HP_searchstore_open) },
{ HP_POP(searchstore->query, HP_searchstore_query) },
diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
index 247087159..f62cb4733 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
@@ -74672,6 +74672,58 @@ void HP_script_run_item_unequip_script(struct map_session_data *sd, struct item_
}
return;
}
+void HP_script_run_item_rental_end_script(struct map_session_data *sd, struct item_data *data, int oid) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_script_run_item_rental_end_script_pre > 0) {
+ void (*preHookFunc) (struct map_session_data **sd, struct item_data **data, int *oid);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_script_run_item_rental_end_script_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_script_run_item_rental_end_script_pre[hIndex].func;
+ preHookFunc(&sd, &data, &oid);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.script.run_item_rental_end_script(sd, data, oid);
+ }
+ if (HPMHooks.count.HP_script_run_item_rental_end_script_post > 0) {
+ void (*postHookFunc) (struct map_session_data *sd, struct item_data *data, int oid);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_script_run_item_rental_end_script_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_script_run_item_rental_end_script_post[hIndex].func;
+ postHookFunc(sd, data, oid);
+ }
+ }
+ return;
+}
+void HP_script_run_item_rental_start_script(struct map_session_data *sd, struct item_data *data, int oid) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_script_run_item_rental_start_script_pre > 0) {
+ void (*preHookFunc) (struct map_session_data **sd, struct item_data **data, int *oid);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_script_run_item_rental_start_script_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_script_run_item_rental_start_script_pre[hIndex].func;
+ preHookFunc(&sd, &data, &oid);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.script.run_item_rental_start_script(sd, data, oid);
+ }
+ if (HPMHooks.count.HP_script_run_item_rental_start_script_post > 0) {
+ void (*postHookFunc) (struct map_session_data *sd, struct item_data *data, int oid);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_script_run_item_rental_start_script_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_script_run_item_rental_start_script_post[hIndex].func;
+ postHookFunc(sd, data, oid);
+ }
+ }
+ return;
+}
/* searchstore_interface */
bool HP_searchstore_open(struct map_session_data *sd, unsigned int uses, unsigned short effect) {
int hIndex = 0;