From 42b5c048e3d97be93c71f81f84ff37c502f96163 Mon Sep 17 00:00:00 2001 From: Haru Date: Mon, 3 Feb 2014 03:17:29 +0100 Subject: Added /stat+ commands support for 2013-12+ clients - Fixes /str+, /agi+ and the likes, only being able to increase stats by 1 point on 2013-12 and newer clients. - As a bonus, on those clients, processing of the /stat+ commands will be much faster, and the requested points will be added instantly and all at once rather than one at a time like in older clients. Signed-off-by: Haru --- src/map/clif.c | 9 +++--- src/map/pc.c | 93 +++++++++++++++++++++++++++++++++++++++----------------- src/map/pc.h | 3 +- src/map/script.c | 5 ++- 4 files changed, 73 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/map/clif.c b/src/map/clif.c index 9ae88200c..1e1a98e09 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -11175,11 +11175,10 @@ void clif_parse_ChangeCart(int fd,struct map_session_data *sd) /// status id: /// SP_STR ~ SP_LUK /// amount: -/// client sends always 1 for this, even when using /str+ and -/// the like -void clif_parse_StatusUp(int fd,struct map_session_data *sd) -{ - pc->statusup(sd,RFIFOW(fd,2)); +/// Old clients send always 1 for this, even when using /str+ and the like. +/// Newer clients (2013-12-23 and newer) send the correct amount. +void clif_parse_StatusUp(int fd,struct map_session_data *sd) { + pc->statusup(sd,RFIFOW(fd,2), RFIFOB(fd, 4)); } diff --git a/src/map/pc.c b/src/map/pc.c index b6c354189..acbdd8df5 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -6174,52 +6174,88 @@ int pc_need_status_point(struct map_session_data* sd, int type, int val) return sp; } -/// Raises a stat by 1. -/// Obeys max_parameter limits. -/// Subtracts stat points. -/// -/// @param type The stat to change (see enum _sp) -int pc_statusup(struct map_session_data* sd, int type) -{ - int max, need, val; +/** + * Returns the value the specified stat can be increased by with the current + * amount of available status points for the current character's class. + * + * @param sd The target character. + * @param type Stat to verify. + * @return Maximum value the stat could grow by. + */ +int pc_maxparameterincrease(struct map_session_data* sd, int type) { + int base, final, status_points = sd->status.status_point; + + base = final = pc->getstat(sd, type); + + while (final <= pc_maxparameter(sd) && status_points >= 0) { +#ifdef RENEWAL // renewal status point cost formula + status_points -= (final < 100) ? (2 + (final - 1) / 10) : (16 + 4 * ((final - 100) / 5)); +#else + status_points -= ( 1 + (final + 9) / 10 ); +#endif + final++; + } + final--; + + return final > base ? final-base : 0; +} + +/** + * Raises a stat by the specified amount. + * Obeys max_parameter limits. + * Subtracts stat points. + * + * @param sd The target character. + * @param type The stat to change (see enum _sp) + * @param increase The stat increase amount. + * @return true if the stat was increased by any amount, false if there were no + * changes. + */ +bool pc_statusup(struct map_session_data* sd, int type, int increase) { + int max_increase = 0, current = 0, needed_points = 0, final_value = 0; nullpo_ret(sd); // check conditions - need = pc->need_status_point(sd,type,1); - if( type < SP_STR || type > SP_LUK || need < 0 || need > sd->status.status_point ) - { - clif->statusupack(sd,type,0,0); - return 1; + if (type < SP_STR || type > SP_LUK || increase <= 0) { + clif->statusupack(sd, type, 0, 0); + return false; } // check limits - max = pc_maxparameter(sd); - if( pc->getstat(sd,type) >= max ) - { - clif->statusupack(sd,type,0,0); - return 1; + current = pc->getstat(sd, type); + max_increase = pc->maxparameterincrease(sd, type); + increase = cap_value(increase, 0, max_increase); // cap to the maximum status points available + if (increase <= 0 || current + increase > pc_maxparameter(sd)) { + clif->statusupack(sd, type, 0, 0); + return false; + } + + // check status points + needed_points = pc->need_status_point(sd, type, increase); + if (needed_points < 0 || needed_points > sd->status.status_point) { // Sanity check + clif->statusupack(sd, type, 0, 0); + return false; } // set new values - val = pc->setstat(sd, type, pc->getstat(sd,type) + 1); - sd->status.status_point -= need; + final_value = pc->setstat(sd, type, current + increase); + sd->status.status_point -= needed_points; - status_calc_pc(sd,SCO_NONE); + status_calc_pc(sd, SCO_NONE); // update increase cost indicator - if( need != pc->need_status_point(sd,type,1) ) - clif->updatestatus(sd, SP_USTR + type-SP_STR); + clif->updatestatus(sd, SP_USTR + type-SP_STR); // update statpoint count - clif->updatestatus(sd,SP_STATUSPOINT); + clif->updatestatus(sd, SP_STATUSPOINT); // update stat value - clif->statusupack(sd,type,1,val); // required - if( val > 255 ) - clif->updatestatus(sd,type); // send after the 'ack' to override the truncated value + clif->statusupack(sd, type, 1, final_value); // required + if (final_value > 255) + clif->updatestatus(sd, type); // send after the 'ack' to override the truncated value - return 0; + return true; } /// Raises a stat by the specified amount. @@ -10674,6 +10710,7 @@ void pc_defaults(void) { pc->thisjobexp = pc_thisjobexp; pc->gets_status_point = pc_gets_status_point; pc->need_status_point = pc_need_status_point; + pc->maxparameterincrease = pc_maxparameterincrease; pc->statusup = pc_statusup; pc->statusup2 = pc_statusup2; pc->skillup = pc_skillup; diff --git a/src/map/pc.h b/src/map/pc.h index 487266646..808f6c52c 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -884,7 +884,8 @@ struct pc_interface { unsigned int (*thisjobexp) (struct map_session_data *sd); int (*gets_status_point) (int level); int (*need_status_point) (struct map_session_data *sd,int type,int val); - int (*statusup) (struct map_session_data *sd,int type); + int (*maxparameterincrease) (struct map_session_data* sd, int type); + bool (*statusup) (struct map_session_data *sd, int type, int increase); int (*statusup2) (struct map_session_data *sd,int type,int val); int (*skillup) (struct map_session_data *sd,uint16 skill_id); int (*allskillup) (struct map_session_data *sd); diff --git a/src/map/script.c b/src/map/script.c index adea269c7..21d55ca77 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -7803,8 +7803,7 @@ BUILDIN(delequip) /*========================================== * *------------------------------------------*/ -BUILDIN(statusup) -{ +BUILDIN(statusup) { int type; TBL_PC *sd; @@ -7813,7 +7812,7 @@ BUILDIN(statusup) if( sd == NULL ) return true; - pc->statusup(sd,type); + pc->statusup(sd, type, 1); return true; } -- cgit v1.2.3-60-g2f50 From 35e1b99c2d1ecab5fa67b2033c87a90512b5d9aa Mon Sep 17 00:00:00 2001 From: Haru Date: Mon, 3 Feb 2014 18:27:19 +0100 Subject: Updated HPMHookGen with a HPMDataCheck generator - It will be used by an upcoming commit by Ind. - Added dummy HPMDataCheck.h, to test the API bot's capability to re-generate it. - Improved XML parser performance. Signed-off-by: Haru --- src/common/HPMDataCheck.h | 17 ++++++++++ tools/HPMHookGen/HPMDataCheckGen.pl | 68 +++++++++++++++++++++++++++++++++++++ tools/HPMHookGen/HPMHookGen.pl | 6 ++++ tools/HPMHookGen/Makefile.in | 30 ++++++++++------ 4 files changed, 110 insertions(+), 11 deletions(-) create mode 100644 src/common/HPMDataCheck.h create mode 100644 tools/HPMHookGen/HPMDataCheckGen.pl (limited to 'src') diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h new file mode 100644 index 000000000..a4d94a010 --- /dev/null +++ b/src/common/HPMDataCheck.h @@ -0,0 +1,17 @@ +// Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// See the LICENSE file +// +// NOTE: This file was auto-generated and should never be manually edited, +// as it will get overwritten. + + +#ifndef _HPM_DATA_CHECK_H_ +#define _HPM_DATA_CHECK_H_ + +const struct s_HPMDataCheck HPMDataCheck[] = { + /** PLACEHOLDER - Testing HerculesWS API Bot **/ + { "foo", 0 }, +}; +unsigned int HPMDataCheckLen = ARRAYLENGTH(HPMDataCheck); + +#endif /* _HPM_DATA_CHECK_H_ */ diff --git a/tools/HPMHookGen/HPMDataCheckGen.pl b/tools/HPMHookGen/HPMDataCheckGen.pl new file mode 100644 index 000000000..1d4ed21b0 --- /dev/null +++ b/tools/HPMHookGen/HPMDataCheckGen.pl @@ -0,0 +1,68 @@ +#!/usr/bin/perl + +# Copyright (c) Hercules Dev Team, licensed under GNU GPL. +# See the LICENSE file + +use strict; +use warnings; +use XML::Simple; + +# XML Parser hint (some are faster than others) +#local $ENV{XML_SIMPLE_PREFERRED_PARSER} = ''; # 0m14.181s +local $ENV{XML_SIMPLE_PREFERRED_PARSER} = 'XML::Parser'; # 0m4.256s +#local $ENV{XML_SIMPLE_PREFERRED_PARSER} = 'XML::SAX::Expat'; # 0m14.186s +#local $ENV{XML_SIMPLE_PREFERRED_PARSER} = 'XML::LibXML::SAX'; # 0m7.055s + +my @files = grep { -f } grep { /[^h]\.xml/ } glob 'doxyoutput/xml/struct*.xml'; +my %out; + +foreach my $file (@files) { + my $xml = new XML::Simple; + my $data = $xml->XMLin($file); + next unless $data->{compounddef}->{includes}; # means its a struct from a .c file, plugins cant access those so we don't care. + next if $data->{compounddef}->{compoundname} =~ /::/; # its a duplicate with a :: name e.g. struct script_state {<...>} ay; + my @filepath = split(/[\/\\]/, $data->{compounddef}->{location}->{file}); + my $foldername = uc($filepath[-2]); + my $filename = uc($filepath[-1]); $filename =~ s/-/_/g; $filename =~ s/\.[^.]*$//; + my $name = "_${foldername}_${filename}_H_"; + push @{ $out{$name} }, $data->{compounddef}->{compoundname}; +} + +my $fname = '../../src/common/HPMDataCheck.h'; +open(FH, '>', $fname); + +print FH <<"EOF"; +// Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// See the LICENSE file +// +// NOTE: This file was auto-generated and should never be manually edited, +// as it will get overwritten. +#ifndef _HPM_DATA_CHECK_H_ +#define _HPM_DATA_CHECK_H_ + + +const struct s_HPMDataCheck HPMDataCheck[] = { +EOF + +foreach my $key (sort keys %out) { + print FH <<"EOF"; + #ifdef $key +EOF + foreach my $entry (@{ $out{$key} }) { + print FH <<"EOF" + { "$entry", sizeof(struct $entry) }, +EOF + } + print FH <<"EOF" + #else + #define $key + #endif // $key +EOF +} +print FH <<"EOF"; +}; +unsigned int HPMDataCheckLen = ARRAYLENGTH(HPMDataCheck); + +#endif /* _HPM_DATA_CHECK_H_ */ +EOF +close(FH); diff --git a/tools/HPMHookGen/HPMHookGen.pl b/tools/HPMHookGen/HPMHookGen.pl index eef490e29..b035687e2 100755 --- a/tools/HPMHookGen/HPMHookGen.pl +++ b/tools/HPMHookGen/HPMHookGen.pl @@ -7,6 +7,12 @@ use strict; use warnings; use XML::Simple; +# XML Parser hint (some are faster than others) +#local $ENV{XML_SIMPLE_PREFERRED_PARSER} = ''; # 0m7.138s +local $ENV{XML_SIMPLE_PREFERRED_PARSER} = 'XML::Parser'; # 0m2.674s +#local $ENV{XML_SIMPLE_PREFERRED_PARSER} = 'XML::SAX::Expat'; # 0m7.026s +#local $ENV{XML_SIMPLE_PREFERRED_PARSER} = 'XML::LibXML::SAX'; # 0m4.152s + sub trim($) { my $s = $_[0]; $s =~ s/^\s+//; $s =~ s/\s+$//; diff --git a/tools/HPMHookGen/Makefile.in b/tools/HPMHookGen/Makefile.in index c89228c7a..eb9cad8ff 100644 --- a/tools/HPMHookGen/Makefile.in +++ b/tools/HPMHookGen/Makefile.in @@ -1,18 +1,24 @@ @SET_MAKE@ -COMMON_C = $(wildcard ../../src/common/*.c) -COMMON_H = $(wildcard ../../src/common/*.h) -MAP_C = $(wildcard ../../src/map/*.c) -MAP_H = $(wildcard ../../src/map/*.h) -CHAR_C = $(wildcard ../../src/char/*.c) -CHAR_H = $(wildcard ../../src/char/*.h) -LOGIN_C = $(wildcard ../../src/login/*.c) -LOGIN_H = $(wildcard ../../src/login/*.h) +COMMON_D = ../../src/common +MAP_D = ../../src/map +CHAR_D = ../../src/char +LOGIN_D = ../../src/login +PLUGIN_D = ../../src/plugins +COMMON_C = $(wildcard $(COMMON_D)/*.c) +COMMON_H = $(filter-out $(COMMON_D)/HPMDataCheck.%,$(wildcard $(COMMON_D)/*.h)) +MAP_C = $(wildcard $(MAP_D)/*.c) +MAP_H = $(wildcard $(MAP_D)/*.h) +CHAR_C = $(wildcard $(CHAR_D)/*.c) +CHAR_H = $(wildcard $(CHAR_D)/*.h) +LOGIN_C = $(wildcard $(LOGIN_D)/*.c) +LOGIN_H = $(wildcard $(LOGIN_D)/*.h) ALL_C = $(COMMON_C) $(MAP_C) $(CHAR_C) $(LOGIN_C) ALL_H = $(COMMON_H) $(MAP_H) $(CHAR_H) $(LOGIN_H) -HOOK_INC = $(addprefix ../../src/plugins/HPMHooking., \ - $(addsuffix .inc, HookingPoints sources GetSymbol HPMHooksCore Hooks)) +HOOK_INC = $(addprefix $(PLUGIN_D)/HPMHooking., \ + $(addsuffix .inc, HookingPoints sources GetSymbol HPMHooksCore Hooks)) \ + $(COMMON_D)/HPMDataCheck.h HAVE_DOXYGEN=@HAVE_DOXYGEN@ HAVE_PERL=@HAVE_PERL@ @@ -49,8 +55,10 @@ hooks: $(HOOK_INC) $(HOOK_INC): generate generate: doxyoutput - @echo " Regenerating hook definitions..." + @echo " Regenerating HPM Hook definitions..." @perl HPMHookGen.pl + @echo " Regenerating HPM Data Check definitions..." + @perl HPMDataCheckGen.pl doxyoutput: $(ALL_C) $(ALL_H) doxygen.conf @echo " Extracting functions information..." -- cgit v1.2.3-60-g2f50 From c8c3255fd990ae2f91ed130c0a742bf94037128a Mon Sep 17 00:00:00 2001 From: "Hercules.ws" Date: Mon, 3 Feb 2014 18:32:30 +0100 Subject: HPM Hooks Update Signed-off-by: HerculesWSAPI --- src/common/HPMDataCheck.h | 121 ++++++++++++++++++++- src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc | 4 + .../HPMHooking/HPMHooking.HookingPoints.inc | 1 + src/plugins/HPMHooking/HPMHooking.Hooks.inc | 38 ++++++- 4 files changed, 154 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h index a4d94a010..19b079418 100644 --- a/src/common/HPMDataCheck.h +++ b/src/common/HPMDataCheck.h @@ -3,14 +3,127 @@ // // NOTE: This file was auto-generated and should never be manually edited, // as it will get overwritten. - - #ifndef _HPM_DATA_CHECK_H_ #define _HPM_DATA_CHECK_H_ + const struct s_HPMDataCheck HPMDataCheck[] = { - /** PLACEHOLDER - Testing HerculesWS API Bot **/ - { "foo", 0 }, + #ifdef _COMMON_CONF_H_ + { "libconfig_interface", sizeof(struct libconfig_interface) }, + #else + #define _COMMON_CONF_H_ + #endif // _COMMON_CONF_H_ + #ifdef _COMMON_DB_H_ + { "DBData", sizeof(struct DBData) }, + { "DBIterator", sizeof(struct DBIterator) }, + { "DBMap", sizeof(struct DBMap) }, + #else + #define _COMMON_DB_H_ + #endif // _COMMON_DB_H_ + #ifdef _COMMON_DES_H_ + { "BIT64", sizeof(struct BIT64) }, + #else + #define _COMMON_DES_H_ + #endif // _COMMON_DES_H_ + #ifdef _COMMON_ERS_H_ + { "eri", sizeof(struct eri) }, + #else + #define _COMMON_ERS_H_ + #endif // _COMMON_ERS_H_ + #ifdef _COMMON_MAPINDEX_H_ + { "mapindex_interface", sizeof(struct mapindex_interface) }, + #else + #define _COMMON_MAPINDEX_H_ + #endif // _COMMON_MAPINDEX_H_ + #ifdef _COMMON_MMO_H_ + { "quest", sizeof(struct quest) }, + #else + #define _COMMON_MMO_H_ + #endif // _COMMON_MMO_H_ + #ifdef _COMMON_SOCKET_H_ + { "socket_interface", sizeof(struct socket_interface) }, + #else + #define _COMMON_SOCKET_H_ + #endif // _COMMON_SOCKET_H_ + #ifdef _COMMON_STRLIB_H_ + { "StringBuf", sizeof(struct StringBuf) }, + { "s_svstate", sizeof(struct s_svstate) }, + #else + #define _COMMON_STRLIB_H_ + #endif // _COMMON_STRLIB_H_ + #ifdef _MAP_ATCOMMAND_H_ + { "AliasInfo", sizeof(struct AliasInfo) }, + { "atcommand_interface", sizeof(struct atcommand_interface) }, + #else + #define _MAP_ATCOMMAND_H_ + #endif // _MAP_ATCOMMAND_H_ + #ifdef _MAP_BATTLE_H_ + { "Damage", sizeof(struct Damage) }, + { "battle_interface", sizeof(struct battle_interface) }, + #else + #define _MAP_BATTLE_H_ + #endif // _MAP_BATTLE_H_ + #ifdef _MAP_BUYINGSTORE_H_ + { "buyingstore_interface", sizeof(struct buyingstore_interface) }, + { "s_buyingstore_item", sizeof(struct s_buyingstore_item) }, + #else + #define _MAP_BUYINGSTORE_H_ + #endif // _MAP_BUYINGSTORE_H_ + #ifdef _MAP_CHRIF_H_ + { "auth_node", sizeof(struct auth_node) }, + #else + #define _MAP_CHRIF_H_ + #endif // _MAP_CHRIF_H_ + #ifdef _MAP_CLIF_H_ + { "clif_interface", sizeof(struct clif_interface) }, + #else + #define _MAP_CLIF_H_ + #endif // _MAP_CLIF_H_ + #ifdef _MAP_ELEMENTAL_H_ + { "elemental_skill", sizeof(struct elemental_skill) }, + #else + #define _MAP_ELEMENTAL_H_ + #endif // _MAP_ELEMENTAL_H_ + #ifdef _MAP_GUILD_H_ + { "eventlist", sizeof(struct eventlist) }, + #else + #define _MAP_GUILD_H_ + #endif // _MAP_GUILD_H_ + #ifdef _MAP_MAP_H_ + { "map_data_other_server", sizeof(struct map_data_other_server) }, + #else + #define _MAP_MAP_H_ + #endif // _MAP_MAP_H_ + #ifdef _MAP_PACKETS_STRUCT_H_ + { "EQUIPSLOTINFO", sizeof(struct EQUIPSLOTINFO) }, + #else + #define _MAP_PACKETS_STRUCT_H_ + #endif // _MAP_PACKETS_STRUCT_H_ + #ifdef _MAP_PC_H_ + { "autotrade_vending", sizeof(struct autotrade_vending) }, + { "item_cd", sizeof(struct item_cd) }, + #else + #define _MAP_PC_H_ + #endif // _MAP_PC_H_ + #ifdef _MAP_SCRIPT_H_ + { "Script_Config", sizeof(struct Script_Config) }, + { "script_interface", sizeof(struct script_interface) }, + #else + #define _MAP_SCRIPT_H_ + #endif // _MAP_SCRIPT_H_ + #ifdef _MAP_SEARCHSTORE_H_ + { "searchstore_interface", sizeof(struct searchstore_interface) }, + #else + #define _MAP_SEARCHSTORE_H_ + #endif // _MAP_SEARCHSTORE_H_ + #ifdef _MAP_SKILL_H_ + { "skill_cd", sizeof(struct skill_cd) }, + { "skill_condition", sizeof(struct skill_condition) }, + { "skill_interface", sizeof(struct skill_interface) }, + { "skill_unit_save", sizeof(struct skill_unit_save) }, + #else + #define _MAP_SKILL_H_ + #endif // _MAP_SKILL_H_ }; unsigned int HPMDataCheckLen = ARRAYLENGTH(HPMDataCheck); diff --git a/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc index 3dfa69d4c..1767f103a 100644 --- a/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc @@ -3649,6 +3649,8 @@ struct { struct HPMHookPoint *HP_pc_gets_status_point_post; struct HPMHookPoint *HP_pc_need_status_point_pre; struct HPMHookPoint *HP_pc_need_status_point_post; + struct HPMHookPoint *HP_pc_maxparameterincrease_pre; + struct HPMHookPoint *HP_pc_maxparameterincrease_post; struct HPMHookPoint *HP_pc_statusup_pre; struct HPMHookPoint *HP_pc_statusup_post; struct HPMHookPoint *HP_pc_statusup2_pre; @@ -8668,6 +8670,8 @@ struct { int HP_pc_gets_status_point_post; int HP_pc_need_status_point_pre; int HP_pc_need_status_point_post; + int HP_pc_maxparameterincrease_pre; + int HP_pc_maxparameterincrease_post; int HP_pc_statusup_pre; int HP_pc_statusup_post; int HP_pc_statusup2_pre; diff --git a/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc index 0b7201cdc..f47a9cc5d 100644 --- a/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc @@ -1855,6 +1855,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(pc->thisjobexp, HP_pc_thisjobexp) }, { HP_POP(pc->gets_status_point, HP_pc_gets_status_point) }, { HP_POP(pc->need_status_point, HP_pc_need_status_point) }, + { HP_POP(pc->maxparameterincrease, HP_pc_maxparameterincrease) }, { HP_POP(pc->statusup, HP_pc_statusup) }, { HP_POP(pc->statusup2, HP_pc_statusup2) }, { HP_POP(pc->skillup, HP_pc_skillup) }, diff --git a/src/plugins/HPMHooking/HPMHooking.Hooks.inc b/src/plugins/HPMHooking/HPMHooking.Hooks.inc index 4db53868d..9584f4960 100644 --- a/src/plugins/HPMHooking/HPMHooking.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking.Hooks.inc @@ -46994,14 +46994,40 @@ int HP_pc_need_status_point(struct map_session_data *sd, int type, int val) { } return retVal___; } -int HP_pc_statusup(struct map_session_data *sd, int type) { +int HP_pc_maxparameterincrease(struct map_session_data *sd, int type) { int hIndex = 0; int retVal___ = 0; - if( HPMHooks.count.HP_pc_statusup_pre ) { + if( HPMHooks.count.HP_pc_maxparameterincrease_pre ) { int (*preHookFunc) (struct map_session_data *sd, int *type); + for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_maxparameterincrease_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_pc_maxparameterincrease_pre[hIndex].func; + retVal___ = preHookFunc(sd, &type); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.pc.maxparameterincrease(sd, type); + } + if( HPMHooks.count.HP_pc_maxparameterincrease_post ) { + int (*postHookFunc) (int retVal___, struct map_session_data *sd, int *type); + for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_maxparameterincrease_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_pc_maxparameterincrease_post[hIndex].func; + retVal___ = postHookFunc(retVal___, sd, &type); + } + } + return retVal___; +} +bool HP_pc_statusup(struct map_session_data *sd, int type, int increase) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_pc_statusup_pre ) { + bool (*preHookFunc) (struct map_session_data *sd, int *type, int *increase); for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_statusup_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_pc_statusup_pre[hIndex].func; - retVal___ = preHookFunc(sd, &type); + retVal___ = preHookFunc(sd, &type, &increase); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -47009,13 +47035,13 @@ int HP_pc_statusup(struct map_session_data *sd, int type) { } } { - retVal___ = HPMHooks.source.pc.statusup(sd, type); + retVal___ = HPMHooks.source.pc.statusup(sd, type, increase); } if( HPMHooks.count.HP_pc_statusup_post ) { - int (*postHookFunc) (int retVal___, struct map_session_data *sd, int *type); + bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, int *type, int *increase); for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_statusup_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_pc_statusup_post[hIndex].func; - retVal___ = postHookFunc(retVal___, sd, &type); + retVal___ = postHookFunc(retVal___, sd, &type, &increase); } } return retVal___; -- cgit v1.2.3-60-g2f50