summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/HPMHooking/HPMHooking_char.GetSymbol.inc1
-rw-r--r--src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc5
-rw-r--r--src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc2
-rw-r--r--src/plugins/HPMHooking/HPMHooking_char.Hooks.inc28
-rw-r--r--src/plugins/HPMHooking/HPMHooking_char.sources.inc1
-rw-r--r--tools/HPMHookGen/HPMDataCheckGen.pl11
-rwxr-xr-xtools/HPMHookGen/HPMHookGen.pl26
7 files changed, 55 insertions, 19 deletions
diff --git a/src/plugins/HPMHooking/HPMHooking_char.GetSymbol.inc b/src/plugins/HPMHooking/HPMHooking_char.GetSymbol.inc
index 02249550d..6d6db24ae 100644
--- a/src/plugins/HPMHooking/HPMHooking_char.GetSymbol.inc
+++ b/src/plugins/HPMHooking/HPMHooking_char.GetSymbol.inc
@@ -15,6 +15,7 @@ if( !(inter_mail = GET_SYMBOL("inter_mail") ) ) return false;
if( !(inter_mercenary = GET_SYMBOL("inter_mercenary") ) ) return false;
if( !(inter_party = GET_SYMBOL("inter_party") ) ) return false;
if( !(inter_pet = GET_SYMBOL("inter_pet") ) ) return false;
+if( !(inter_quest = GET_SYMBOL("inter_quest") ) ) return false;
if( !(inter_storage = GET_SYMBOL("inter_storage") ) ) return false;
if( !(loginif = GET_SYMBOL("loginif") ) ) return false;
if( !(mapif = GET_SYMBOL("mapif") ) ) return false;
diff --git a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc
index 52ca7fc84..46a225568 100644
--- a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc
+++ b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc
@@ -499,6 +499,8 @@ struct {
struct HPMHookPoint *HP_inter_pet_delete__post;
struct HPMHookPoint *HP_inter_pet_parse_frommap_pre;
struct HPMHookPoint *HP_inter_pet_parse_frommap_post;
+ struct HPMHookPoint *HP_inter_quest_parse_frommap_pre;
+ struct HPMHookPoint *HP_inter_quest_parse_frommap_post;
struct HPMHookPoint *HP_inter_storage_tosql_pre;
struct HPMHookPoint *HP_inter_storage_tosql_post;
struct HPMHookPoint *HP_inter_storage_fromsql_pre;
@@ -1388,6 +1390,8 @@ struct {
int HP_inter_pet_delete__post;
int HP_inter_pet_parse_frommap_pre;
int HP_inter_pet_parse_frommap_post;
+ int HP_inter_quest_parse_frommap_pre;
+ int HP_inter_quest_parse_frommap_post;
int HP_inter_storage_tosql_pre;
int HP_inter_storage_tosql_post;
int HP_inter_storage_fromsql_pre;
@@ -1794,6 +1798,7 @@ struct {
struct inter_mercenary_interface inter_mercenary;
struct inter_party_interface inter_party;
struct inter_pet_interface inter_pet;
+ struct inter_quest_interface inter_quest;
struct inter_storage_interface inter_storage;
struct loginif_interface loginif;
struct mapif_interface mapif;
diff --git a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc
index f53ff207b..b1b64af18 100644
--- a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc
+++ b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc
@@ -263,6 +263,8 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(inter_pet->sql_final, HP_inter_pet_sql_final) },
{ HP_POP(inter_pet->delete_, HP_inter_pet_delete_) },
{ HP_POP(inter_pet->parse_frommap, HP_inter_pet_parse_frommap) },
+/* inter_quest */
+ { HP_POP(inter_quest->parse_frommap, HP_inter_quest_parse_frommap) },
/* inter_storage */
{ HP_POP(inter_storage->tosql, HP_inter_storage_tosql) },
{ HP_POP(inter_storage->fromsql, HP_inter_storage_fromsql) },
diff --git a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc
index 8a775ccfd..8a602686f 100644
--- a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc
@@ -6612,6 +6612,34 @@ int HP_inter_pet_parse_frommap(int fd) {
}
return retVal___;
}
+/* inter_quest */
+int HP_inter_quest_parse_frommap(int fd) {
+ int hIndex = 0;
+ int retVal___ = 0;
+ if( HPMHooks.count.HP_inter_quest_parse_frommap_pre ) {
+ int (*preHookFunc) (int *fd);
+ *HPMforce_return = false;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_quest_parse_frommap_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_inter_quest_parse_frommap_pre[hIndex].func;
+ retVal___ = preHookFunc(&fd);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.inter_quest.parse_frommap(fd);
+ }
+ if( HPMHooks.count.HP_inter_quest_parse_frommap_post ) {
+ int (*postHookFunc) (int retVal___, int *fd);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_quest_parse_frommap_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_inter_quest_parse_frommap_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, &fd);
+ }
+ }
+ return retVal___;
+}
/* inter_storage */
int HP_inter_storage_tosql(int account_id, struct storage_data *p) {
int hIndex = 0;
diff --git a/src/plugins/HPMHooking/HPMHooking_char.sources.inc b/src/plugins/HPMHooking/HPMHooking_char.sources.inc
index 8d51ace0b..00700756c 100644
--- a/src/plugins/HPMHooking/HPMHooking_char.sources.inc
+++ b/src/plugins/HPMHooking/HPMHooking_char.sources.inc
@@ -15,6 +15,7 @@ memcpy(&HPMHooks.source.inter_mail, inter_mail, sizeof(struct inter_mail_interfa
memcpy(&HPMHooks.source.inter_mercenary, inter_mercenary, sizeof(struct inter_mercenary_interface));
memcpy(&HPMHooks.source.inter_party, inter_party, sizeof(struct inter_party_interface));
memcpy(&HPMHooks.source.inter_pet, inter_pet, sizeof(struct inter_pet_interface));
+memcpy(&HPMHooks.source.inter_quest, inter_quest, sizeof(struct inter_quest_interface));
memcpy(&HPMHooks.source.inter_storage, inter_storage, sizeof(struct inter_storage_interface));
memcpy(&HPMHooks.source.loginif, loginif, sizeof(struct loginif_interface));
memcpy(&HPMHooks.source.mapif, mapif, sizeof(struct mapif_interface));
diff --git a/tools/HPMHookGen/HPMDataCheckGen.pl b/tools/HPMHookGen/HPMDataCheckGen.pl
index f950152d1..01728341d 100644
--- a/tools/HPMHookGen/HPMDataCheckGen.pl
+++ b/tools/HPMHookGen/HPMDataCheckGen.pl
@@ -20,17 +20,18 @@ 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 $data = $xml->XMLin($file, ForceArray => 1);
+ my $filekey = (keys $data->{compounddef})[0];
+ next unless $data->{compounddef}->{$filekey}->{includes}; # means its a struct from a .c file, plugins cant access those so we don't care.
+ next if $data->{compounddef}->{$filekey}->{compoundname}->[0] =~ /::/; # its a duplicate with a :: name e.g. struct script_state {<...>} ay;
+ my @filepath = split(/[\/\\]/, $data->{compounddef}->{$filekey}->{location}->[0]->{file});
my $foldername = uc($filepath[-2]);
my $filename = uc($filepath[-1]); $filename =~ s/-/_/g; $filename =~ s/\.[^.]*$//;
my $plugintypes = 'SERVER_TYPE_UNKNOWN';
$plugintypes = 'SERVER_TYPE_ALL' if $foldername eq 'COMMON';
$plugintypes = "SERVER_TYPE_${foldername}" if $foldername =~ /^(LOGIN|CHAR|MAP)/;
my $symboldata = {
- name => $data->{compounddef}->{compoundname},
+ name => $data->{compounddef}->{$filekey}->{compoundname}->[0],
type => $plugintypes,
};
my $name = "${foldername}_${filename}_H";
diff --git a/tools/HPMHookGen/HPMHookGen.pl b/tools/HPMHookGen/HPMHookGen.pl
index 57e50e0b6..3daf742bc 100755
--- a/tools/HPMHookGen/HPMHookGen.pl
+++ b/tools/HPMHookGen/HPMHookGen.pl
@@ -3,8 +3,7 @@
# Copyright (c) Hercules Dev Team, licensed under GNU GPL.
# See the LICENSE file
-# disabled strict because it show warning and failing
-#use strict;
+use strict;
use warnings;
use XML::Simple;
@@ -259,13 +258,14 @@ my %keys = (
foreach my $file (@files) { # Loop through the xml files
my $xml = new XML::Simple;
- my $data = $xml->XMLin($file);
+ my $data = $xml->XMLin($file, ForceArray => 1);
- my $loc = $data->{compounddef}->{location};
+ my $filekey = (keys $data->{compounddef})[0];
+ my $loc = $data->{compounddef}->{$filekey}->{location}->[0];
next unless $loc->{file} =~ /src\/(map|char|login)\//;
my $servertype = $1;
- my $key = $data->{compounddef}->{compoundname};
+ my $key = $data->{compounddef}->{$filekey}->{compoundname}->[0];
my $original = $key;
# Some known interfaces with different names
@@ -289,19 +289,17 @@ foreach my $file (@files) { # Loop through the xml files
$key =~ s/_interface//;
}
- foreach my $v ($data->{compounddef}->{sectiondef}) { # Loop through the sections
+ foreach my $v ($data->{compounddef}->{$filekey}->{sectiondef}->[0]) { # Loop through the sections
my $memberdef = $v->{memberdef};
- foreach my $fk (sort { # Sort the members in declaration order according to what the xml says
- my $astart = $memberdef->{$a}->{location}->{bodystart} || $memberdef->{$a}->{location}->{line};
- my $bstart = $memberdef->{$b}->{location}->{bodystart} || $memberdef->{$b}->{location}->{line};
+ foreach my $f (sort { # Sort the members in declaration order according to what the xml says
+ my $astart = $a->{location}->[0]->{bodystart} || $a->{location}->[0]->{line};
+ my $bstart = $b->{location}->[0]->{bodystart} || $b->{location}->[0]->{line};
$astart <=> $bstart
- } keys %$memberdef) { # Loop through the members
- my $f = $memberdef->{$fk};
-
- my $t = $f->{argsstring};
+ } @$memberdef) { # Loop through the members
+ my $t = $f->{argsstring}->[0];
next unless ref $t ne 'HASH' and $t =~ /^[^\[]/; # If it's not a string, or if it starts with an array subscript, we can skip it
- my $if = parse($t, $f->{definition});
+ my $if = parse($t, $f->{definition}->[0]);
next unless scalar keys %$if; # If it returns an empty hash reference, an error must've occurred
# Skip variadic functions, we only allow hooks on their arglist equivalents.