summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorHaruna <haru@dotalux.com>2014-11-15 17:04:09 +0100
committerHaruna <haru@dotalux.com>2014-11-15 17:04:09 +0100
commita6f077063eeff08ee27ae5170de1bb5cf4b2defb (patch)
tree9bb5ab158230301e604918883ce6d06c31890341 /tools
parent77b88fe80b907122b24d698938538c22e029d25f (diff)
parent7f9fa7f59a82682fb139be4301e9a12a99644a19 (diff)
downloadhercules-a6f077063eeff08ee27ae5170de1bb5cf4b2defb.tar.gz
hercules-a6f077063eeff08ee27ae5170de1bb5cf4b2defb.tar.bz2
hercules-a6f077063eeff08ee27ae5170de1bb5cf4b2defb.tar.xz
hercules-a6f077063eeff08ee27ae5170de1bb5cf4b2defb.zip
Merge pull request #388 from 4144/charplugins
char server plugins
Diffstat (limited to 'tools')
-rw-r--r--tools/HPMHookGen/HPMDataCheckGen.pl11
-rwxr-xr-xtools/HPMHookGen/HPMHookGen.pl27
2 files changed, 21 insertions, 17 deletions
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 71bd8f245..3daf742bc 100755
--- a/tools/HPMHookGen/HPMHookGen.pl
+++ b/tools/HPMHookGen/HPMHookGen.pl
@@ -258,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
@@ -272,6 +273,8 @@ foreach my $file (@files) { # Loop through the xml files
$key = "bg";
} elsif ($key =~ /guild_storage/) {
$key = "gstorage";
+ } elsif ($key =~ /inter_homunculus/) { # to avoid replace to homun
+ $key = "inter_homunculus";
} elsif ($key =~ /homunculus/) {
$key = "homun";
} elsif ($key =~ /irc_bot/) {
@@ -280,23 +283,23 @@ foreach my $file (@files) { # Loop through the xml files
$key = "logs";
} elsif ($key =~ /pc_groups_interface/) {
$key = "pcg";
+ } elsif ($key =~ /char_interface/) {
+ $key = "chr";
} else {
$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.