Merge branch 'master' of github.com:EQEmu/Server

This commit is contained in:
KimLS
2018-07-02 22:10:13 -07:00
15 changed files with 11065 additions and 12237 deletions
+241
View File
@@ -0,0 +1,241 @@
#!/usr/bin/perl
# Author: Akkadius
# @file: lua-doc-parser.pl
# @description: Script meant to parse the source code to build the LUA API list
use File::Find;
use Data::Dumper;
sub usage() {
print "Usage:\n";
print " --client - Prints methods for just client class methods\n";
print " --mob - Prints methods for just mob class methods\n";
print " --npc - Prints methods for just npc class methods\n";
print " --entity - Prints methods for just entity class methods\n";
print " --entity_list - Prints methods for just entity_list class methods\n";
print " --door - Prints methods for just door class methods\n";
print " --object - Prints methods for just object class methods\n";
print " --group - Prints methods for just group class methods\n";
print " --raid - Prints methods for just raid class methods\n";
print " --item - Prints methods for just item class methods\n";
print " --iteminst - Prints methods for just iteminst class methods\n";
print " --inventory - Prints methods for just inventory class methods\n";
print " --corpse - Prints methods for just corpse class methods\n";
print " --hate_entry - Prints methods for just hate_entry class methods\n";
print " --quest - Prints methods for just quest class methods\n";
print " --spell - Prints methods for just spell class methods\n";
print " --spawn - Prints methods for just spawn class methods\n";
print " --packet - Prints methods for just packet class methods\n";
print " --stat_bonuses - Prints methods for just stat_bonuses class methods\n";
print " --all - Prints methods for all classes\n";
exit(1);
}
if($#ARGV < 0) {
usage();
}
#::: Open File
my $filename = 'lua-api.md';
open(my $fh, '>', $filename) or die "Could not open file '$filename' $!";
my $export = $ARGV[0];
$export=~s/--//g;
my $export_file_search = $export;
if ($export eq "quest") {
$export_file_search = "lua_general";
}
my @files;
my $start_dir = "zone/";
find(
sub { push @files, $File::Find::name unless -d; },
$start_dir
);
for my $file (@files) {
#::: Skip non lua.cpp files
if($file!~/lua_/i || $file!~/cpp/i){
next;
}
#::: If we are specifying a specific class type, skip everything else
if ($export ne "all" && $export ne "") {
if ($file!~/$export_file_search\.cpp/i) {
next;
}
}
@methods = ();
$split_key = "";
$object_prefix = "";
#::: Client Export
if ($export=~/all|client/i && $file=~/_client/i) {
$split_key = "Client::";
$object_prefix = "client:";
}
#::: Mob Export
if ($export=~/all|mob/i && $file=~/_mob/i) {
$split_key = "Mob::";
$object_prefix = "mob:";
}
#::: NPC Export
if ($export=~/all|npc/i && $file=~/_npc/i) {
$split_key = "NPC::";
$object_prefix = "npc:";
}
#::: Object Export
if ($export=~/all|object/i && $file=~/_object/i) {
$split_key = "Object::";
$object_prefix = "object:";
}
#::: Door Export
if ($export=~/all|door/i && $file=~/_door/i) {
$split_key = "Door::";
$object_prefix = "door:";
}
#::: Entity Export
if ($export=~/all|entity/i && $file=~/_entity/i) {
$split_key = "Entity::";
$object_prefix = "entity:";
}
#::: Entity List Export
if ($export=~/all|entity_list/i && $file=~/_entity_list/i) {
$split_key = "EntityList::";
$object_prefix = "entity_list:";
}
#::: Group
if ($export=~/all|group/i && $file=~/_group/i) {
$split_key = "Group::";
$object_prefix = "group:";
}
#::: Raid
if ($export=~/all|raid/i && $file=~/_raid/i) {
$split_key = "Raid::";
$object_prefix = "raid:";
}
#::: Corpse
if ($export=~/all|corpse/i && $file=~/_corpse/i) {
$split_key = "Corpse::";
$object_prefix = "corpse:";
}
#::: Hateentry
if ($export=~/all|hate_entry/i && $file=~/_hate_entry/i) {
$split_key = "HateEntry::";
$object_prefix = "hate_entry:";
}
#::: Spell
if ($export=~/all|spell/i && $file=~/_spell/i) {
$split_key = "Spell::";
$object_prefix = "spell:";
}
#::: Spawn
if ($export=~/all|spawn/i && $file=~/_spawn/i) {
$split_key = "Spawn::";
$object_prefix = "spawn:";
}
#::: StatBonuses
if ($export=~/all|stat_bonuses/i && $file=~/stat_bonuses/i) {
$split_key = "StatBonuses::";
$object_prefix = "statbonuses:";
}
#::: Item
if ($export=~/all|item/i && $file=~/_item/i) {
$split_key = "Item::";
$object_prefix = "item:";
}
#::: ItemInst
if ($export=~/all|iteminst/i && $file=~/_iteminst/i) {
$split_key = "ItemInst::";
$object_prefix = "iteminst:";
}
#::: Inventory
if ($export=~/all|inventory/i && $file=~/_inventory/i) {
$split_key = "Inventory::";
$object_prefix = "inventory:";
}
#::: Packet
if ($export=~/all|packet/i && $file=~/_packet/i) {
$split_key = "Packet::";
$object_prefix = "packet:";
}
#::: Quest
if ($export=~/all|quest/i && $file=~/lua_general/i) {
$split_key = " lua_";
$object_prefix = "eq.";
}
#::: Open File
print "\nOpening '" . $file . "'\n";
if ($split_key eq "") {
next;
}
open (FILE, $file);
while (<FILE>) {
chomp;
$line = $_;
@data = split(" ", $line);
if ((lc(substr($data[1], 0, 4)) eq "lua_") && $line!~/luabind/i && $line!~/return |#ifdef|struct /i) {
#::: Get return type
$return_type = trim($data[0]);
@method_split = split($split_key, $line);
@method_end = split("{", $method_split[1]);
$method = $object_prefix . trim($method_end[0]) . "; -- " . $return_type . "\n";
push @methods, $method;
}
}
#::: Header
$header = $split_key;
$header =~s/:://g;
print $fh "# " . $header . "\n";
print $fh "```lua\n";
@methods = sort @methods;
foreach $method (@methods) {
print $fh $method;
print $method;
}
print $fh "```\n\n";
}
close $fh;
#::: Trim Whitespaces
sub trim {
my $string = $_[0];
$string =~ s/^\s+//;
$string =~ s/\s+$//;
return $string;
}
+179
View File
@@ -0,0 +1,179 @@
#!/usr/bin/perl
# Author: Akkadius
# @file: perl-doc-parser.pl
# @description: Script meant to parse the source code to build the Perl API list
use File::Find;
use Data::Dumper;
sub usage() {
print "Usage:\n";
print " --client - Prints methods for just client class methods\n";
print " --mob - Prints methods for just mob class methods\n";
print " --npc - Prints methods for just npc class methods\n";
print " --entity - Prints methods for just entity class methods\n";
print " --door - Prints methods for just door class methods\n";
print " --object - Prints methods for just object class methods\n";
print " --group - Prints methods for just group class methods\n";
print " --raid - Prints methods for just raid class methods\n";
print " --questitem - Prints methods for just questitem class methods\n";
print " --corpse - Prints methods for just corpse class methods\n";
print " --hateentry - Prints methods for just hateentry class methods\n";
print " --quest - Prints methods for just quest class methods\n";
print " --all - Prints methods for all classes\n";
exit(1);
}
if($#ARGV < 0) {
usage();
}
my $export = $ARGV[0];
$export=~s/--//g;
my $export_file_search = $export;
if ($export eq "quest") {
$export_file_search = "embparser_api";
}
my @files;
my $start_dir = "zone/";
find(
sub { push @files, $File::Find::name unless -d; },
$start_dir
);
for my $file (@files) {
#::: Skip non Perl files
if($file!~/perl_|embparser_api/i){
next;
}
#::: If we are specifying a specific class type, skip everything else
if ($export ne "all" && $export ne "") {
if ($file!~/$export_file_search/i) {
next;
}
}
@methods = ();
$split_key = "";
$object_prefix = "";
#::: Open File
print "\nOpening '" . $file . "'\n";
open (FILE, $file);
while (<FILE>) {
chomp;
$line = $_;
if ($line=~/Perl_croak/i && $line=~/Usa/i && $line=~/::/i && $line!~/::new/i) {
#::: Client export
if ($export=~/all|client/i && $line=~/Client::/i) {
$split_key = "Client::";
$object_prefix = "\$client->";
}
#::: Mob export
if ($export=~/all|mob/i && $line=~/Mob::/i) {
$split_key = "Mob::";
$object_prefix = "\$mob->";
}
#::: NPC export
if ($export=~/all|npc/i && $line=~/NPC::/i) {
$split_key = "NPC::";
$object_prefix = "\$npc->";
}
#::: Corpse export
if ($export=~/all|corpse/i && $line=~/Corpse::/i) {
$split_key = "Corpse::";
$object_prefix = "\$corpse->";
}
#::: Entity export
if ($export=~/all|entity/i && $line=~/EntityList::/i) {
$split_key = "EntityList::";
$object_prefix = "\$entity_list->";
}
#::: Doors export
if ($export=~/all|door/i && $line=~/Doors::/i) {
$split_key = "Doors::";
$object_prefix = "\$door->";
}
#::: Object export
if ($export=~/all|object/i && $line=~/Object::/i) {
$split_key = "Object::";
$object_prefix = "\$object->";
}
#::: Group export
if ($export=~/all|group/i && $line=~/Group::/i) {
$split_key = "Group::";
$object_prefix = "\$group->";
}
#::: Raid export
if ($export=~/all|raid/i && $line=~/Raid::/i) {
$split_key = "Raid::";
$object_prefix = "\$raid->";
}
#::: Hateentry export
if ($export=~/all|hateentry/i && $line=~/HateEntry::/i) {
$split_key = "HateEntry::";
$object_prefix = "\$hate_entry->";
}
#::: Questitem export
if ($export=~/all|questitem/i && $line=~/QuestItem::/i) {
$split_key = "QuestItem::";
$object_prefix = "\$quest_item->";
}
#::: Quest:: exports
if ($export=~/all|quest/i && $line=~/quest::/i) {
$split_key = "quest::";
$object_prefix = "\quest::";
}
#::: Split on croak usage
@data = split($split_key, $line);
$usage = trim($data[1]);
#::: Split out param borders and get method name
@params_begin = split('\(', $usage);
$method_name = trim($params_begin[0]);
#::: Get params string built
@params_end = split('\)', $params_begin[1]);
$params_string = trim($params_end[0]);
$params_string =~s/THIS\,//g;
$params_string =~s/THIS//g;
$params_string = trim($params_string);
$method = $object_prefix . $method_name . "(" . lc($params_string) . ")\n";
push @methods, $method;
}
}
@methods = sort @methods;
foreach $method (@methods) {
print $method;
}
}
#::: Trim Whitespaces
sub trim {
my $string = $_[0];
$string =~ s/^\s+//;
$string =~ s/\s+$//;
return $string;
}
+1292 -1448
View File
File diff suppressed because it is too large Load Diff
+2 -4
View File
@@ -725,14 +725,12 @@ void Lua_Client::SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug
self->SummonItem(item_id, charges, aug1, aug2, aug3, aug4, aug5); self->SummonItem(item_id, charges, aug1, aug2, aug3, aug4, aug5);
} }
void Lua_Client::SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, void Lua_Client::SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, bool attuned) {
bool attuned) {
Lua_Safe_Call_Void(); Lua_Safe_Call_Void();
self->SummonItem(item_id, charges, aug1, aug2, aug3, aug4, aug5, 0, attuned); self->SummonItem(item_id, charges, aug1, aug2, aug3, aug4, aug5, 0, attuned);
} }
void Lua_Client::SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, void Lua_Client::SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, bool attuned, int to_slot) {
bool attuned, int to_slot) {
Lua_Safe_Call_Void(); Lua_Safe_Call_Void();
self->SummonItem(item_id, charges, aug1, aug2, aug3, aug4, aug5, 0, attuned, to_slot); self->SummonItem(item_id, charges, aug1, aug2, aug3, aug4, aug5, 0, attuned, to_slot);
} }
+2632 -2991
View File
File diff suppressed because it is too large Load Diff
+269 -310
View File
@@ -26,7 +26,9 @@
*/ */
#include "../common/features.h" #include "../common/features.h"
#ifdef EMBPERL_XS_CLASSES #ifdef EMBPERL_XS_CLASSES
#include "../common/global_define.h" #include "../common/global_define.h"
#include "embperl.h" #include "embperl.h"
@@ -41,282 +43,270 @@
#endif #endif
XS(XS_Doors_GetDoorDBID); /* prototype to pass -Wmissing-prototypes */ XS(XS_Doors_GetDoorDBID); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_GetDoorDBID) XS(XS_Doors_GetDoorDBID) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Doors::GetDoorDBID(THIS)"); Perl_croak(aTHX_ "Usage: Doors::GetDoorDBID(THIS)");
{ {
Doors * THIS; Doors *THIS;
uint32 RETVAL; uint32 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Doors")) { if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp); THIS = INT2PTR(Doors *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Doors"); Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetDoorDBID(); RETVAL = THIS->GetDoorDBID();
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Doors_GetDoorID); /* prototype to pass -Wmissing-prototypes */ XS(XS_Doors_GetDoorID); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_GetDoorID) XS(XS_Doors_GetDoorID) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Doors::GetDoorID(THIS)"); Perl_croak(aTHX_ "Usage: Doors::GetDoorID(THIS)");
{ {
Doors * THIS; Doors *THIS;
uint32 RETVAL; uint32 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Doors")) { if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp); THIS = INT2PTR(Doors *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Doors"); Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetDoorID(); RETVAL = THIS->GetDoorID();
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Doors_GetID); /* prototype to pass -Wmissing-prototypes */ XS(XS_Doors_GetID); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_GetID) XS(XS_Doors_GetID) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Doors::GetID(THIS)"); Perl_croak(aTHX_ "Usage: Doors::GetID(THIS)");
{ {
Doors * THIS; Doors *THIS;
uint16 RETVAL; uint16 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Doors")) { if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp); THIS = INT2PTR(Doors *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Doors"); Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetEntityID(); RETVAL = THIS->GetEntityID();
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Doors_GetX); /* prototype to pass -Wmissing-prototypes */ XS(XS_Doors_GetX); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_GetX) XS(XS_Doors_GetX) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Doors::GetX(THIS)"); Perl_croak(aTHX_ "Usage: Doors::GetX(THIS)");
{ {
Doors * THIS; Doors *THIS;
float RETVAL; float RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Doors")) { if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp); THIS = INT2PTR(Doors *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Doors"); Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetPosition().x; RETVAL = THIS->GetPosition().x;
XSprePUSH; PUSHn((double)RETVAL); XSprePUSH;
PUSHn((double) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Doors_GetY); /* prototype to pass -Wmissing-prototypes */ XS(XS_Doors_GetY); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_GetY) XS(XS_Doors_GetY) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Doors::GetY(THIS)"); Perl_croak(aTHX_ "Usage: Doors::GetY(THIS)");
{ {
Doors * THIS; Doors *THIS;
float RETVAL; float RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Doors")) { if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp); THIS = INT2PTR(Doors *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Doors"); Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetPosition().y; RETVAL = THIS->GetPosition().y;
XSprePUSH; PUSHn((double)RETVAL); XSprePUSH;
PUSHn((double) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Doors_GetZ); /* prototype to pass -Wmissing-prototypes */ XS(XS_Doors_GetZ); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_GetZ) XS(XS_Doors_GetZ) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Doors::GetZ(THIS)"); Perl_croak(aTHX_ "Usage: Doors::GetZ(THIS)");
{ {
Doors * THIS; Doors *THIS;
float RETVAL; float RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Doors")) { if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp); THIS = INT2PTR(Doors *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Doors"); Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetPosition().z; RETVAL = THIS->GetPosition().z;
XSprePUSH; PUSHn((double)RETVAL); XSprePUSH;
PUSHn((double) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Doors_GetHeading); /* prototype to pass -Wmissing-prototypes */ XS(XS_Doors_GetHeading); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_GetHeading) XS(XS_Doors_GetHeading) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Doors::GetHeading(THIS)"); Perl_croak(aTHX_ "Usage: Doors::GetHeading(THIS)");
{ {
Doors * THIS; Doors *THIS;
float RETVAL; float RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Doors")) { if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp); THIS = INT2PTR(Doors *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Doors"); Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetPosition().w; RETVAL = THIS->GetPosition().w;
XSprePUSH; PUSHn((double)RETVAL); XSprePUSH;
PUSHn((double) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Doors_GetOpenType); /* prototype to pass -Wmissing-prototypes */ XS(XS_Doors_GetOpenType); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_GetOpenType) XS(XS_Doors_GetOpenType) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Doors::GetOpenType(THIS)"); Perl_croak(aTHX_ "Usage: Doors::GetOpenType(THIS)");
{ {
Doors * THIS; Doors *THIS;
uint32 RETVAL; uint32 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Doors")) { if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp); THIS = INT2PTR(Doors *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Doors"); Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetOpenType(); RETVAL = THIS->GetOpenType();
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Doors_GetLockpick); /* prototype to pass -Wmissing-prototypes */ XS(XS_Doors_GetLockpick); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_GetLockpick) XS(XS_Doors_GetLockpick) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Doors::GetLockpick(THIS)"); Perl_croak(aTHX_ "Usage: Doors::GetLockpick(THIS)");
{ {
Doors * THIS; Doors *THIS;
uint32 RETVAL; uint32 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Doors")) { if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp); THIS = INT2PTR(Doors *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Doors"); Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetLockpick(); RETVAL = THIS->GetLockpick();
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Doors_GetKeyItem); /* prototype to pass -Wmissing-prototypes */ XS(XS_Doors_GetKeyItem); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_GetKeyItem) XS(XS_Doors_GetKeyItem) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Doors::GetKeyItem(THIS)"); Perl_croak(aTHX_ "Usage: Doors::GetKeyItem(THIS)");
{ {
Doors * THIS; Doors *THIS;
uint32 RETVAL; uint32 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Doors")) { if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp); THIS = INT2PTR(Doors *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Doors"); Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetKeyItem(); RETVAL = THIS->GetKeyItem();
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Doors_GetNoKeyring); /* prototype to pass -Wmissing-prototypes */ XS(XS_Doors_GetNoKeyring); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_GetNoKeyring) XS(XS_Doors_GetNoKeyring) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Doors::GetNoKeyring(THIS, type)"); Perl_croak(aTHX_ "Usage: Doors::GetNoKeyring(THIS, uint8 type)");
{ {
Doors * THIS; Doors *THIS;
uint8 type = (uint8)SvUV(ST(1)); uint8 type = (uint8) SvUV(ST(1));
if (sv_derived_from(ST(0), "Doors")) { if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp); THIS = INT2PTR(Doors *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Doors"); Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->GetNoKeyring(); THIS->GetNoKeyring();
@@ -325,76 +315,71 @@ XS(XS_Doors_GetNoKeyring)
} }
XS(XS_Doors_GetIncline); /* prototype to pass -Wmissing-prototypes */ XS(XS_Doors_GetIncline); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_GetIncline) XS(XS_Doors_GetIncline) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Doors::GetIncline(THIS)"); Perl_croak(aTHX_ "Usage: Doors::GetIncline(THIS)");
{ {
Doors * THIS; Doors *THIS;
uint32 RETVAL; uint32 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Doors")) { if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp); THIS = INT2PTR(Doors *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Doors"); Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetIncline(); RETVAL = THIS->GetIncline();
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Doors_GetSize); /* prototype to pass -Wmissing-prototypes */ XS(XS_Doors_GetSize); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_GetSize) XS(XS_Doors_GetSize) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Doors::GetIncline(THIS)"); Perl_croak(aTHX_ "Usage: Doors::GetIncline(THIS)");
{ {
Doors * THIS; Doors *THIS;
uint32 RETVAL; uint32 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Doors")) { if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp); THIS = INT2PTR(Doors *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Doors"); Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetSize(); RETVAL = THIS->GetSize();
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Doors_SetOpenType); /* prototype to pass -Wmissing-prototypes */ XS(XS_Doors_SetOpenType); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_SetOpenType) XS(XS_Doors_SetOpenType) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Doors::SetOpenType(THIS, type)"); Perl_croak(aTHX_ "Usage: Doors::SetOpenType(THIS, uint32 open_type)");
{ {
Doors * THIS; Doors *THIS;
uint32 type = (uint32)SvUV(ST(1)); uint32 type = (uint32) SvUV(ST(1));
if (sv_derived_from(ST(0), "Doors")) { if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp); THIS = INT2PTR(Doors *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Doors"); Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->SetOpenType(type); THIS->SetOpenType(type);
@@ -403,22 +388,20 @@ XS(XS_Doors_SetOpenType)
} }
XS(XS_Doors_SetLockpick); /* prototype to pass -Wmissing-prototypes */ XS(XS_Doors_SetLockpick); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_SetLockpick) XS(XS_Doors_SetLockpick) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Doors::SetLockpick(THIS, type)"); Perl_croak(aTHX_ "Usage: Doors::SetLockpick(THIS, uint32 lockpick_type)");
{ {
Doors * THIS; Doors *THIS;
uint32 type = (uint32)SvUV(ST(1)); uint32 type = (uint32) SvUV(ST(1));
if (sv_derived_from(ST(0), "Doors")) { if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp); THIS = INT2PTR(Doors *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Doors"); Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->SetLockpick(type); THIS->SetLockpick(type);
@@ -427,22 +410,20 @@ XS(XS_Doors_SetLockpick)
} }
XS(XS_Doors_SetKeyItem); /* prototype to pass -Wmissing-prototypes */ XS(XS_Doors_SetKeyItem); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_SetKeyItem) XS(XS_Doors_SetKeyItem) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Doors::SetKeyItem(THIS, type)"); Perl_croak(aTHX_ "Usage: Doors::SetKeyItem(THIS, uint32 key_item_id)");
{ {
Doors * THIS; Doors *THIS;
uint32 type = (uint32)SvUV(ST(1)); uint32 type = (uint32) SvUV(ST(1));
if (sv_derived_from(ST(0), "Doors")) { if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp); THIS = INT2PTR(Doors *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Doors"); Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->SetKeyItem(type); THIS->SetKeyItem(type);
@@ -451,22 +432,20 @@ XS(XS_Doors_SetKeyItem)
} }
XS(XS_Doors_SetNoKeyring); /* prototype to pass -Wmissing-prototypes */ XS(XS_Doors_SetNoKeyring); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_SetNoKeyring) XS(XS_Doors_SetNoKeyring) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Doors::SetNoKeyring(THIS, type)"); Perl_croak(aTHX_ "Usage: Doors::SetNoKeyring(THIS, uint8 no_key_ring)");
{ {
Doors * THIS; Doors *THIS;
uint8 type = (uint8)SvUV(ST(1)); uint8 type = (uint8) SvUV(ST(1));
if (sv_derived_from(ST(0), "Doors")) { if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp); THIS = INT2PTR(Doors *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Doors"); Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->SetNoKeyring(type); THIS->SetNoKeyring(type);
@@ -475,22 +454,20 @@ XS(XS_Doors_SetNoKeyring)
} }
XS(XS_Doors_SetIncline); /* prototype to pass -Wmissing-prototypes */ XS(XS_Doors_SetIncline); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_SetIncline) XS(XS_Doors_SetIncline) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Doors::SetIncline(THIS, type)"); Perl_croak(aTHX_ "Usage: Doors::SetIncline(THIS, uint32 incline)");
{ {
Doors * THIS; Doors *THIS;
uint32 type = (uint32)SvUV(ST(1)); uint32 type = (uint32) SvUV(ST(1));
if (sv_derived_from(ST(0), "Doors")) { if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp); THIS = INT2PTR(Doors *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Doors"); Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->SetIncline(type); THIS->SetIncline(type);
@@ -499,22 +476,20 @@ XS(XS_Doors_SetIncline)
} }
XS(XS_Doors_SetSize); /* prototype to pass -Wmissing-prototypes */ XS(XS_Doors_SetSize); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_SetSize) XS(XS_Doors_SetSize) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Doors::SetSize(THIS, size)"); Perl_croak(aTHX_ "Usage: Doors::SetSize(THIS, uint32 size)");
{ {
Doors * THIS; Doors *THIS;
uint32 type = (uint32)SvUV(ST(1)); uint32 type = (uint32) SvUV(ST(1));
if (sv_derived_from(ST(0), "Doors")) { if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp); THIS = INT2PTR(Doors *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Doors"); Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->SetSize(type); THIS->SetSize(type);
@@ -523,24 +498,22 @@ XS(XS_Doors_SetSize)
} }
XS(XS_Doors_SetLocation); /* prototype to pass -Wmissing-prototypes */ XS(XS_Doors_SetLocation); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_SetLocation) XS(XS_Doors_SetLocation) {
{
dXSARGS; dXSARGS;
if (items != 4) if (items != 4)
Perl_croak(aTHX_ "Usage: Doors::SetLocation(THIS, x, y, z)"); Perl_croak(aTHX_ "Usage: Doors::SetLocation(THIS, float x, float y, float z)");
{ {
Doors * THIS; Doors *THIS;
float x = (float)SvNV(ST(1)); float x = (float) SvNV(ST(1));
float y = (float)SvNV(ST(2)); float y = (float) SvNV(ST(2));
float z = (float)SvNV(ST(3)); float z = (float) SvNV(ST(3));
if (sv_derived_from(ST(0), "Doors")) { if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp); THIS = INT2PTR(Doors *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Doors"); Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->SetLocation(x, y, z); THIS->SetLocation(x, y, z);
@@ -549,175 +522,163 @@ XS(XS_Doors_SetLocation)
} }
XS(XS_Doors_SetX); /* prototype to pass -Wmissing-prototypes */ XS(XS_Doors_SetX); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_SetX) XS(XS_Doors_SetX) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Doors::SetX(THIS, XPos)"); Perl_croak(aTHX_ "Usage: Doors::SetX(THIS, float x)");
{ {
Doors * THIS; Doors *THIS;
float x = (float)SvNV(ST(1)); float x = (float) SvNV(ST(1));
if (sv_derived_from(ST(0), "Doors")) { if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp); THIS = INT2PTR(Doors *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Doors"); Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
auto position = THIS->GetPosition(); auto position = THIS->GetPosition();
position.x = x; position.x = x;
THIS->SetPosition(position); THIS->SetPosition(position);
} }
XSRETURN_EMPTY; XSRETURN_EMPTY;
} }
XS(XS_Doors_SetY); /* prototype to pass -Wmissing-prototypes */ XS(XS_Doors_SetY); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_SetY) XS(XS_Doors_SetY) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Doors::SetY(THIS, YPos)"); Perl_croak(aTHX_ "Usage: Doors::SetY(THIS, float y)");
{ {
Doors * THIS; Doors *THIS;
float y = (float)SvNV(ST(1)); float y = (float) SvNV(ST(1));
if (sv_derived_from(ST(0), "Doors")) { if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp); THIS = INT2PTR(Doors *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Doors"); Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
auto position = THIS->GetPosition(); auto position = THIS->GetPosition();
position.y = y; position.y = y;
THIS->SetPosition(position); THIS->SetPosition(position);
} }
XSRETURN_EMPTY; XSRETURN_EMPTY;
} }
XS(XS_Doors_SetZ); /* prototype to pass -Wmissing-prototypes */ XS(XS_Doors_SetZ); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_SetZ) XS(XS_Doors_SetZ) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Doors::SetZ(THIS, ZPos)"); Perl_croak(aTHX_ "Usage: Doors::SetZ(THIS, float z)");
{ {
Doors * THIS; Doors *THIS;
float z = (float)SvNV(ST(1)); float z = (float) SvNV(ST(1));
if (sv_derived_from(ST(0), "Doors")) { if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp); THIS = INT2PTR(Doors *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Doors"); Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
auto position = THIS->GetPosition(); auto position = THIS->GetPosition();
position.z = z; position.z = z;
THIS->SetPosition(position); THIS->SetPosition(position);
} }
XSRETURN_EMPTY; XSRETURN_EMPTY;
} }
XS(XS_Doors_SetHeading); /* prototype to pass -Wmissing-prototypes */ XS(XS_Doors_SetHeading); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_SetHeading) XS(XS_Doors_SetHeading) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Doors::SetHeading(THIS, heading)"); Perl_croak(aTHX_ "Usage: Doors::SetHeading(THIS, float heading)");
{ {
Doors * THIS; Doors *THIS;
float heading = (float)SvNV(ST(1)); float heading = (float) SvNV(ST(1));
if (sv_derived_from(ST(0), "Doors")) { if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp); THIS = INT2PTR(Doors *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Doors"); Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
auto position = THIS->GetPosition(); auto position = THIS->GetPosition();
position.w = heading; position.w = heading;
THIS->SetPosition(position); THIS->SetPosition(position);
} }
XSRETURN_EMPTY; XSRETURN_EMPTY;
} }
XS(XS_Doors_SetModelName); /* prototype to pass -Wmissing-prototypes */ XS(XS_Doors_SetModelName); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_SetModelName) XS(XS_Doors_SetModelName) {
{
dXSARGS; dXSARGS;
if (items < 1 || items > 2) if (items < 1 || items > 2)
Perl_croak(aTHX_ "Usage: Doors::SetModelName(THIS, name)"); Perl_croak(aTHX_ "Usage: Doors::SetModelName(THIS, string name)");
{ {
Doors * THIS; Doors *THIS;
char * name = nullptr; char *name = nullptr;
if (sv_derived_from(ST(0), "Doors")) { if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp); THIS = INT2PTR(Doors *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Doors"); Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (items > 1) { name = (char *)SvPV_nolen(ST(1)); } if (items > 1) { name = (char *) SvPV_nolen(ST(1)); }
THIS->SetDoorName(name); THIS->SetDoorName(name);
} }
XSRETURN_EMPTY; XSRETURN_EMPTY;
} }
XS(XS_Doors_GetModelName); /* prototype to pass -Wmissing-prototypes */ XS(XS_Doors_GetModelName); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_GetModelName) XS(XS_Doors_GetModelName) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Doors::GetModelName(THIS)"); Perl_croak(aTHX_ "Usage: Doors::GetModelName(THIS)");
{ {
Doors * THIS; Doors *THIS;
Const_char * RETVAL; Const_char *RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Doors")) { if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp); THIS = INT2PTR(Doors *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Doors"); Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetDoorName(); RETVAL = THIS->GetDoorName();
sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG; sv_setpv(TARG, RETVAL);
XSprePUSH;
PUSHTARG;
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Doors_CreateDatabaseEntry); /* prototype to pass -Wmissing-prototypes */ XS(XS_Doors_CreateDatabaseEntry); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_CreateDatabaseEntry) XS(XS_Doors_CreateDatabaseEntry) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Doors::InsertDoor(THIS)"); Perl_croak(aTHX_ "Usage: Doors::InsertDoor(THIS)");
{ {
Doors * THIS; Doors *THIS;
if (sv_derived_from(ST(0), "Doors")) { if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp); THIS = INT2PTR(Doors *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Doors"); Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->CreateDatabaseEntry(); THIS->CreateDatabaseEntry();
@@ -726,52 +687,50 @@ XS(XS_Doors_CreateDatabaseEntry)
} }
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
#endif #endif
XS(boot_Doors); /* prototype to pass -Wmissing-prototypes */ XS(boot_Doors); /* prototype to pass -Wmissing-prototypes */
XS(boot_Doors) XS(boot_Doors) {
{
dXSARGS; dXSARGS;
char file[256]; char file[256];
strncpy(file, __FILE__, 256); strncpy(file, __FILE__, 256);
file[255] = 0; file[255] = 0;
if(items != 1) if (items != 1)
fprintf(stderr, "boot_quest does not take any arguments."); fprintf(stderr, "boot_quest does not take any arguments.");
char buf[128]; char buf[128];
//add the strcpy stuff to get rid of const warnings.... //add the strcpy stuff to get rid of const warnings....
XS_VERSION_BOOTCHECK ; XS_VERSION_BOOTCHECK;
newXSproto(strcpy(buf, "GetID"),XS_Doors_GetID, file, "$"); newXSproto(strcpy(buf, "GetID"), XS_Doors_GetID, file, "$");
newXSproto(strcpy(buf, "SetModelName"),XS_Doors_SetModelName, file, "$$"); newXSproto(strcpy(buf, "SetModelName"), XS_Doors_SetModelName, file, "$$");
newXSproto(strcpy(buf, "GetModelName"),XS_Doors_GetModelName, file, "$"); newXSproto(strcpy(buf, "GetModelName"), XS_Doors_GetModelName, file, "$");
newXSproto(strcpy(buf, "GetX"),XS_Doors_GetX, file, "$"); newXSproto(strcpy(buf, "GetX"), XS_Doors_GetX, file, "$");
newXSproto(strcpy(buf, "GetY"),XS_Doors_GetY, file, "$"); newXSproto(strcpy(buf, "GetY"), XS_Doors_GetY, file, "$");
newXSproto(strcpy(buf, "GetZ"),XS_Doors_GetZ, file, "$"); newXSproto(strcpy(buf, "GetZ"), XS_Doors_GetZ, file, "$");
newXSproto(strcpy(buf, "GetHeading"),XS_Doors_GetHeading, file, "$"); newXSproto(strcpy(buf, "GetHeading"), XS_Doors_GetHeading, file, "$");
newXSproto(strcpy(buf, "SetX"),XS_Doors_SetX, file, "$$"); newXSproto(strcpy(buf, "SetX"), XS_Doors_SetX, file, "$$");
newXSproto(strcpy(buf, "SetY"),XS_Doors_SetY, file, "$$"); newXSproto(strcpy(buf, "SetY"), XS_Doors_SetY, file, "$$");
newXSproto(strcpy(buf, "SetZ"),XS_Doors_SetZ, file, "$$"); newXSproto(strcpy(buf, "SetZ"), XS_Doors_SetZ, file, "$$");
newXSproto(strcpy(buf, "SetHeading"),XS_Doors_SetHeading, file, "$$"); newXSproto(strcpy(buf, "SetHeading"), XS_Doors_SetHeading, file, "$$");
newXSproto(strcpy(buf, "SetLocation"),XS_Doors_SetLocation, file, "$$$$"); newXSproto(strcpy(buf, "SetLocation"), XS_Doors_SetLocation, file, "$$$$");
newXSproto(strcpy(buf, "GetDoorDBID"),XS_Doors_GetDoorDBID, file, "$"); newXSproto(strcpy(buf, "GetDoorDBID"), XS_Doors_GetDoorDBID, file, "$");
newXSproto(strcpy(buf, "GetDoorID"),XS_Doors_GetDoorID, file, "$"); newXSproto(strcpy(buf, "GetDoorID"), XS_Doors_GetDoorID, file, "$");
newXSproto(strcpy(buf, "SetSize"),XS_Doors_SetSize, file, "$$"); newXSproto(strcpy(buf, "SetSize"), XS_Doors_SetSize, file, "$$");
newXSproto(strcpy(buf, "GetSize"),XS_Doors_GetSize, file, "$"); newXSproto(strcpy(buf, "GetSize"), XS_Doors_GetSize, file, "$");
newXSproto(strcpy(buf, "SetIncline"),XS_Doors_SetIncline, file, "$$"); newXSproto(strcpy(buf, "SetIncline"), XS_Doors_SetIncline, file, "$$");
newXSproto(strcpy(buf, "GetIncline"),XS_Doors_GetIncline, file, "$"); newXSproto(strcpy(buf, "GetIncline"), XS_Doors_GetIncline, file, "$");
newXSproto(strcpy(buf, "SetOpenType"),XS_Doors_SetOpenType, file, "$$"); newXSproto(strcpy(buf, "SetOpenType"), XS_Doors_SetOpenType, file, "$$");
newXSproto(strcpy(buf, "GetOpenType"),XS_Doors_GetOpenType, file, "$"); newXSproto(strcpy(buf, "GetOpenType"), XS_Doors_GetOpenType, file, "$");
newXSproto(strcpy(buf, "SetLockPick"),XS_Doors_SetLockpick, file, "$$"); newXSproto(strcpy(buf, "SetLockPick"), XS_Doors_SetLockpick, file, "$$");
newXSproto(strcpy(buf, "GetLockPick"),XS_Doors_GetLockpick, file, "$"); newXSproto(strcpy(buf, "GetLockPick"), XS_Doors_GetLockpick, file, "$");
newXSproto(strcpy(buf, "SetKeyItem"),XS_Doors_SetKeyItem, file, "$$"); newXSproto(strcpy(buf, "SetKeyItem"), XS_Doors_SetKeyItem, file, "$$");
newXSproto(strcpy(buf, "GetKeyItem"),XS_Doors_GetKeyItem, file, "$"); newXSproto(strcpy(buf, "GetKeyItem"), XS_Doors_GetKeyItem, file, "$");
newXSproto(strcpy(buf, "SetNoKeyring"),XS_Doors_SetNoKeyring, file, "$$"); newXSproto(strcpy(buf, "SetNoKeyring"), XS_Doors_SetNoKeyring, file, "$$");
newXSproto(strcpy(buf, "GetNoKeyring"),XS_Doors_GetNoKeyring, file, "$"); newXSproto(strcpy(buf, "GetNoKeyring"), XS_Doors_GetNoKeyring, file, "$");
newXSproto(strcpy(buf, "CreateDatabaseEntry"),XS_Doors_CreateDatabaseEntry, file, "$"); newXSproto(strcpy(buf, "CreateDatabaseEntry"), XS_Doors_CreateDatabaseEntry, file, "$");
XSRETURN_YES; XSRETURN_YES;
} }
#endif //EMBPERL_XS_CLASSES #endif //EMBPERL_XS_CLASSES
+801 -956
View File
File diff suppressed because it is too large Load Diff
+238 -277
View File
@@ -26,7 +26,9 @@
*/ */
#include "../common/features.h" #include "../common/features.h"
#ifdef EMBPERL_XS_CLASSES #ifdef EMBPERL_XS_CLASSES
#include "../common/global_define.h" #include "../common/global_define.h"
#include "embperl.h" #include "embperl.h"
@@ -42,21 +44,19 @@
XS(XS_Group_DisbandGroup); /* prototype to pass -Wmissing-prototypes */ XS(XS_Group_DisbandGroup); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_DisbandGroup) XS(XS_Group_DisbandGroup) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Group::DisbandGroup(THIS)"); Perl_croak(aTHX_ "Usage: Group::DisbandGroup(THIS)");
{ {
Group * THIS; Group *THIS;
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->DisbandGroup(); THIS->DisbandGroup();
@@ -65,32 +65,29 @@ XS(XS_Group_DisbandGroup)
} }
XS(XS_Group_IsGroupMember); /* prototype to pass -Wmissing-prototypes */ XS(XS_Group_IsGroupMember); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_IsGroupMember) XS(XS_Group_IsGroupMember) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Group::IsGroupMember(THIS, client)"); Perl_croak(aTHX_ "Usage: Group::IsGroupMember(THIS, client)");
{ {
Group * THIS; Group *THIS;
bool RETVAL; bool RETVAL;
Mob* client; Mob *client;
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) { if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1))); IV tmp = SvIV((SV *) SvRV(ST(1)));
client = INT2PTR(Mob *,tmp); client = INT2PTR(Mob *, tmp);
} } else
else
Perl_croak(aTHX_ "client is not of type Mob"); Perl_croak(aTHX_ "client is not of type Mob");
if(client == nullptr) if (client == nullptr)
Perl_croak(aTHX_ "client is nullptr, avoiding crash."); Perl_croak(aTHX_ "client is nullptr, avoiding crash.");
RETVAL = THIS->IsGroupMember(client); RETVAL = THIS->IsGroupMember(client);
@@ -101,32 +98,29 @@ XS(XS_Group_IsGroupMember)
} }
XS(XS_Group_CastGroupSpell); /* prototype to pass -Wmissing-prototypes */ XS(XS_Group_CastGroupSpell); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_CastGroupSpell) XS(XS_Group_CastGroupSpell) {
{
dXSARGS; dXSARGS;
if (items != 3) if (items != 3)
Perl_croak(aTHX_ "Usage: Group::CastGroupSpell(THIS, caster, spellid)"); Perl_croak(aTHX_ "Usage: Group::CastGroupSpell(THIS, Mob* caster, uint16 spell_id)");
{ {
Group * THIS; Group *THIS;
Mob* caster; Mob *caster;
uint16 spellid = (uint16)SvUV(ST(2)); uint16 spellid = (uint16) SvUV(ST(2));
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) { if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1))); IV tmp = SvIV((SV *) SvRV(ST(1)));
caster = INT2PTR(Mob *,tmp); caster = INT2PTR(Mob *, tmp);
} } else
else
Perl_croak(aTHX_ "caster is not of type Mob"); Perl_croak(aTHX_ "caster is not of type Mob");
if(caster == nullptr) if (caster == nullptr)
Perl_croak(aTHX_ "caster is nullptr, avoiding crash."); Perl_croak(aTHX_ "caster is nullptr, avoiding crash.");
THIS->CastGroupSpell(caster, spellid); THIS->CastGroupSpell(caster, spellid);
@@ -135,32 +129,29 @@ XS(XS_Group_CastGroupSpell)
} }
XS(XS_Group_SplitExp); /* prototype to pass -Wmissing-prototypes */ XS(XS_Group_SplitExp); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_SplitExp) XS(XS_Group_SplitExp) {
{
dXSARGS; dXSARGS;
if (items != 3) if (items != 3)
Perl_croak(aTHX_ "Usage: Group::SplitExp(THIS, exp, other)"); Perl_croak(aTHX_ "Usage: Group::SplitExp(THIS, uint32 exp, Mob* other)");
{ {
Group * THIS; Group *THIS;
uint32 exp = (uint32)SvUV(ST(1)); uint32 exp = (uint32) SvUV(ST(1));
Mob* other; Mob *other;
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(2), "Mob")) { if (sv_derived_from(ST(2), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(2))); IV tmp = SvIV((SV *) SvRV(ST(2)));
other = INT2PTR(Mob *,tmp); other = INT2PTR(Mob *, tmp);
} } else
else
Perl_croak(aTHX_ "other is not of type Mob"); Perl_croak(aTHX_ "other is not of type Mob");
if(other == nullptr) if (other == nullptr)
Perl_croak(aTHX_ "other is nullptr, avoiding crash."); Perl_croak(aTHX_ "other is nullptr, avoiding crash.");
THIS->SplitExp(exp, other); THIS->SplitExp(exp, other);
@@ -169,106 +160,98 @@ XS(XS_Group_SplitExp)
} }
XS(XS_Group_GroupMessage); /* prototype to pass -Wmissing-prototypes */ XS(XS_Group_GroupMessage); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_GroupMessage) XS(XS_Group_GroupMessage) {
{
dXSARGS; dXSARGS;
if ((items != 3) && (items != 4)) // the 3 item version is kept for backwards compatability if ((items != 3) && (items != 4)) // the 3 item version is kept for backwards compatability
Perl_croak(aTHX_ "Usage: Group::GroupMessage(THIS, sender, language, message)"); Perl_croak(aTHX_ "Usage: Group::GroupMessage(THIS, Mob* sender, uint8 language, string message)");
{ {
Group * THIS; Group *THIS;
Mob* sender; Mob *sender;
uint8 language; uint8 language;
char* message; char *message;
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) { if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1))); IV tmp = SvIV((SV *) SvRV(ST(1)));
sender = INT2PTR(Mob *,tmp); sender = INT2PTR(Mob *, tmp);
} } else
else
Perl_croak(aTHX_ "sender is not of type Mob"); Perl_croak(aTHX_ "sender is not of type Mob");
if(sender == nullptr) if (sender == nullptr)
Perl_croak(aTHX_ "sender is nullptr, avoiding crash."); Perl_croak(aTHX_ "sender is nullptr, avoiding crash.");
if (items == 4) { if (items == 4) {
language = (uint8)SvUV(ST(2)); language = (uint8) SvUV(ST(2));
if ((language >= MAX_PP_LANGUAGE) || (language < 0)) if ((language >= MAX_PP_LANGUAGE) || (language < 0))
language = 0; language = 0;
message = (char *)SvPV_nolen(ST(3)); message = (char *) SvPV_nolen(ST(3));
THIS->GroupMessage(sender, language, 100, message); THIS->GroupMessage(sender, language, 100, message);
} } else { // if no language is specificed, send it in common
else { // if no language is specificed, send it in common message = (char *) SvPV_nolen(ST(2));
message = (char *)SvPV_nolen(ST(2)); THIS->GroupMessage(sender, 0, 100, message);
THIS->GroupMessage(sender,0, 100, message);
} }
} }
XSRETURN_EMPTY; XSRETURN_EMPTY;
} }
XS(XS_Group_GetTotalGroupDamage); /* prototype to pass -Wmissing-prototypes */ XS(XS_Group_GetTotalGroupDamage); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_GetTotalGroupDamage) XS(XS_Group_GetTotalGroupDamage) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Group::GetTotalGroupDamage(THIS, other)"); Perl_croak(aTHX_ "Usage: Group::GetTotalGroupDamage(THIS, Mob* other)");
{ {
Group * THIS; Group *THIS;
uint32 RETVAL; uint32 RETVAL;
dXSTARG; dXSTARG;
Mob* other; Mob *other;
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) { if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1))); IV tmp = SvIV((SV *) SvRV(ST(1)));
other = INT2PTR(Mob *,tmp); other = INT2PTR(Mob *, tmp);
} } else
else
Perl_croak(aTHX_ "other is not of type Mob"); Perl_croak(aTHX_ "other is not of type Mob");
if(other == nullptr) if (other == nullptr)
Perl_croak(aTHX_ "other is nullptr, avoiding crash."); Perl_croak(aTHX_ "other is nullptr, avoiding crash.");
RETVAL = THIS->GetTotalGroupDamage(other); RETVAL = THIS->GetTotalGroupDamage(other);
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Group_SplitMoney); /* prototype to pass -Wmissing-prototypes */ XS(XS_Group_SplitMoney); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_SplitMoney) XS(XS_Group_SplitMoney) {
{
dXSARGS; dXSARGS;
if (items != 5) if (items != 5)
Perl_croak(aTHX_ "Usage: Group::SplitMoney(THIS, copper, silver, gold, platinum)"); Perl_croak(aTHX_ "Usage: Group::SplitMoney(THIS, uint32 copper, uint32 silver, uint32 gold, uint32 platinum)");
{ {
Group * THIS; Group *THIS;
uint32 copper = (uint32)SvUV(ST(1)); uint32 copper = (uint32) SvUV(ST(1));
uint32 silver = (uint32)SvUV(ST(2)); uint32 silver = (uint32) SvUV(ST(2));
uint32 gold = (uint32)SvUV(ST(3)); uint32 gold = (uint32) SvUV(ST(3));
uint32 platinum = (uint32)SvUV(ST(4)); uint32 platinum = (uint32) SvUV(ST(4));
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->SplitMoney(copper, silver, gold, platinum); THIS->SplitMoney(copper, silver, gold, platinum);
@@ -277,31 +260,28 @@ XS(XS_Group_SplitMoney)
} }
XS(XS_Group_SetLeader); /* prototype to pass -Wmissing-prototypes */ XS(XS_Group_SetLeader); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_SetLeader) XS(XS_Group_SetLeader) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Group::SetLeader(THIS, newleader)"); Perl_croak(aTHX_ "Usage: Group::SetLeader(THIS, Mob* new_leader)");
{ {
Group * THIS; Group *THIS;
Mob* newleader; Mob *newleader;
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) { if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1))); IV tmp = SvIV((SV *) SvRV(ST(1)));
newleader = INT2PTR(Mob *,tmp); newleader = INT2PTR(Mob *, tmp);
} } else
else
Perl_croak(aTHX_ "newleader is not of type Mob"); Perl_croak(aTHX_ "newleader is not of type Mob");
if(newleader == nullptr) if (newleader == nullptr)
Perl_croak(aTHX_ "newleader is nullptr, avoiding crash."); Perl_croak(aTHX_ "newleader is nullptr, avoiding crash.");
THIS->SetLeader(newleader); THIS->SetLeader(newleader);
@@ -310,83 +290,78 @@ XS(XS_Group_SetLeader)
} }
XS(XS_Group_GetLeader); /* prototype to pass -Wmissing-prototypes */ XS(XS_Group_GetLeader); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_GetLeader) XS(XS_Group_GetLeader) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Group::GetLeader(THIS)"); Perl_croak(aTHX_ "Usage: Group::GetLeader(THIS)");
{ {
Group * THIS; Group *THIS;
Mob * RETVAL; Mob *RETVAL;
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetLeader(); RETVAL = THIS->GetLeader();
ST(0) = sv_newmortal(); ST(0) = sv_newmortal();
sv_setref_pv(ST(0), "Mob", (void*)RETVAL); sv_setref_pv(ST(0), "Mob", (void *) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Group_GetLeaderName); /* prototype to pass -Wmissing-prototypes */ XS(XS_Group_GetLeaderName); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_GetLeaderName) XS(XS_Group_GetLeaderName) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Group::GetLeaderName(THIS)"); Perl_croak(aTHX_ "Usage: Group::GetLeaderName(THIS)");
{ {
Group * THIS; Group *THIS;
const char * RETVAL; const char *RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetLeaderName(); RETVAL = THIS->GetLeaderName();
sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG; sv_setpv(TARG, RETVAL);
XSprePUSH;
PUSHTARG;
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Group_SendHPPacketsTo); /* prototype to pass -Wmissing-prototypes */ XS(XS_Group_SendHPPacketsTo); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_SendHPPacketsTo) XS(XS_Group_SendHPPacketsTo) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Group::SendHPPacketsTo(THIS, newmember)"); Perl_croak(aTHX_ "Usage: Group::SendHPPacketsTo(THIS, Mob* new_member)");
{ {
Group * THIS; Group *THIS;
Mob* newmember; Mob *newmember;
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) { if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1))); IV tmp = SvIV((SV *) SvRV(ST(1)));
newmember = INT2PTR(Mob *,tmp); newmember = INT2PTR(Mob *, tmp);
} } else
else
Perl_croak(aTHX_ "newmember is not of type Mob"); Perl_croak(aTHX_ "newmember is not of type Mob");
if(newmember == nullptr) if (newmember == nullptr)
Perl_croak(aTHX_ "newmember is nullptr, avoiding crash."); Perl_croak(aTHX_ "newmember is nullptr, avoiding crash.");
THIS->SendHPManaEndPacketsTo(newmember); THIS->SendHPManaEndPacketsTo(newmember);
@@ -395,31 +370,28 @@ XS(XS_Group_SendHPPacketsTo)
} }
XS(XS_Group_SendHPPacketsFrom); /* prototype to pass -Wmissing-prototypes */ XS(XS_Group_SendHPPacketsFrom); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_SendHPPacketsFrom) XS(XS_Group_SendHPPacketsFrom) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Group::SendHPPacketsFrom(THIS, newmember)"); Perl_croak(aTHX_ "Usage: Group::SendHPPacketsFrom(THIS, Mob* new_member)");
{ {
Group * THIS; Group *THIS;
Mob* newmember; Mob *newmember;
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) { if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1))); IV tmp = SvIV((SV *) SvRV(ST(1)));
newmember = INT2PTR(Mob *,tmp); newmember = INT2PTR(Mob *, tmp);
} } else
else
Perl_croak(aTHX_ "newmember is not of type Mob"); Perl_croak(aTHX_ "newmember is not of type Mob");
if(newmember == nullptr) if (newmember == nullptr)
Perl_croak(aTHX_ "newmember is nullptr, avoiding crash."); Perl_croak(aTHX_ "newmember is nullptr, avoiding crash.");
THIS->SendHPPacketsFrom(newmember); THIS->SendHPPacketsFrom(newmember);
@@ -428,32 +400,29 @@ XS(XS_Group_SendHPPacketsFrom)
} }
XS(XS_Group_IsLeader); /* prototype to pass -Wmissing-prototypes */ XS(XS_Group_IsLeader); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_IsLeader) XS(XS_Group_IsLeader) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Group::IsLeader(THIS, leadertest)"); Perl_croak(aTHX_ "Usage: Group::IsLeader(THIS, Mob* target)");
{ {
Group * THIS; Group *THIS;
bool RETVAL; bool RETVAL;
Mob* leadertest; Mob *leadertest;
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) { if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1))); IV tmp = SvIV((SV *) SvRV(ST(1)));
leadertest = INT2PTR(Mob *,tmp); leadertest = INT2PTR(Mob *, tmp);
} } else
else
Perl_croak(aTHX_ "leadertest is not of type Mob"); Perl_croak(aTHX_ "leadertest is not of type Mob");
if(leadertest == nullptr) if (leadertest == nullptr)
Perl_croak(aTHX_ "leadertest is nullptr, avoiding crash."); Perl_croak(aTHX_ "leadertest is nullptr, avoiding crash.");
RETVAL = THIS->IsLeader(leadertest); RETVAL = THIS->IsLeader(leadertest);
@@ -464,88 +433,84 @@ XS(XS_Group_IsLeader)
} }
XS(XS_Group_GroupCount); /* prototype to pass -Wmissing-prototypes */ XS(XS_Group_GroupCount); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_GroupCount) XS(XS_Group_GroupCount) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Group::GroupCount(THIS)"); Perl_croak(aTHX_ "Usage: Group::GroupCount(THIS)");
{ {
Group * THIS; Group *THIS;
uint8 RETVAL; uint8 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GroupCount(); RETVAL = THIS->GroupCount();
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Group_GetHighestLevel); /* prototype to pass -Wmissing-prototypes */ XS(XS_Group_GetHighestLevel); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_GetHighestLevel) XS(XS_Group_GetHighestLevel) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Group::GetHighestLevel(THIS)"); Perl_croak(aTHX_ "Usage: Group::GetHighestLevel(THIS)");
{ {
Group * THIS; Group *THIS;
uint32 RETVAL; uint32 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetHighestLevel(); RETVAL = THIS->GetHighestLevel();
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Group_TeleportGroup); /* prototype to pass -Wmissing-prototypes */ XS(XS_Group_TeleportGroup); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_TeleportGroup) XS(XS_Group_TeleportGroup) {
{
dXSARGS; dXSARGS;
if (items != 7) if (items != 7)
Perl_croak(aTHX_ "Usage: Group::TeleportGroup(THIS, sender, zoneID, x, y, z, heading)"); Perl_croak(aTHX_
"Usage: Group::TeleportGroup(THIS, Mob* sender, uint32 zone_id, float x, float y, float z, float heading)");
{ {
Group * THIS; Group *THIS;
Mob* sender; Mob *sender;
uint32 zoneID = (uint32)SvUV(ST(2)); uint32 zoneID = (uint32) SvUV(ST(2));
float x = (float)SvNV(ST(3)); float x = (float) SvNV(ST(3));
float y = (float)SvNV(ST(4)); float y = (float) SvNV(ST(4));
float z = (float)SvNV(ST(5)); float z = (float) SvNV(ST(5));
float heading = (float)SvNV(ST(6)); float heading = (float) SvNV(ST(6));
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) { if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1))); IV tmp = SvIV((SV *) SvRV(ST(1)));
sender = INT2PTR(Mob *,tmp); sender = INT2PTR(Mob *, tmp);
} } else
else
Perl_croak(aTHX_ "sender is not of type Mob"); Perl_croak(aTHX_ "sender is not of type Mob");
if(sender == nullptr) if (sender == nullptr)
Perl_croak(aTHX_ "sender is nullptr, avoiding crash."); Perl_croak(aTHX_ "sender is nullptr, avoiding crash.");
THIS->TeleportGroup(sender, zoneID, 0, x, y, z, heading); THIS->TeleportGroup(sender, zoneID, 0, x, y, z, heading);
@@ -554,63 +519,60 @@ XS(XS_Group_TeleportGroup)
} }
XS(XS_Group_GetID); /* prototype to pass -Wmissing-prototypes */ XS(XS_Group_GetID); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_GetID) XS(XS_Group_GetID) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Group::GetID(THIS)"); Perl_croak(aTHX_ "Usage: Group::GetID(THIS)");
{ {
Group * THIS; Group *THIS;
uint32 RETVAL; uint32 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetID(); RETVAL = THIS->GetID();
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Group_GetMember); XS(XS_Group_GetMember);
XS(XS_Group_GetMember) XS(XS_Group_GetMember) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Group::GetMember(THIS, index)"); Perl_croak(aTHX_ "Usage: Group::GetMember(THIS, int group_index)");
{ {
Group * THIS; Group *THIS;
Mob* member; Mob *member;
Client* RETVAL = nullptr; Client *RETVAL = nullptr;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Group")) { if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp); THIS = INT2PTR(Group *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Group"); Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
int index = (int)SvUV(ST(1)); int index = (int) SvUV(ST(1));
if (index < 0 || index > 5) if (index < 0 || index > 5)
RETVAL = nullptr; RETVAL = nullptr;
else { else {
member = THIS->members[index]; member = THIS->members[index];
if (member != nullptr) if (member != nullptr)
RETVAL = member->CastToClient(); RETVAL = member->CastToClient();
} }
ST(0) = sv_newmortal(); ST(0) = sv_newmortal();
sv_setref_pv(ST(0), "Client", (void*)RETVAL); sv_setref_pv(ST(0), "Client", (void *) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
@@ -619,39 +581,38 @@ XS(XS_Group_GetMember)
extern "C" extern "C"
#endif #endif
XS(boot_Group); /* prototype to pass -Wmissing-prototypes */ XS(boot_Group); /* prototype to pass -Wmissing-prototypes */
XS(boot_Group) XS(boot_Group) {
{
dXSARGS; dXSARGS;
char file[256]; char file[256];
strncpy(file, __FILE__, 256); strncpy(file, __FILE__, 256);
file[255] = 0; file[255] = 0;
if(items != 1) if (items != 1)
fprintf(stderr, "boot_quest does not take any arguments."); fprintf(stderr, "boot_quest does not take any arguments.");
char buf[128]; char buf[128];
//add the strcpy stuff to get rid of const warnings.... //add the strcpy stuff to get rid of const warnings....
XS_VERSION_BOOTCHECK ; XS_VERSION_BOOTCHECK;
newXSproto(strcpy(buf, "DisbandGroup"), XS_Group_DisbandGroup, file, "$"); newXSproto(strcpy(buf, "DisbandGroup"), XS_Group_DisbandGroup, file, "$");
newXSproto(strcpy(buf, "IsGroupMember"), XS_Group_IsGroupMember, file, "$$"); newXSproto(strcpy(buf, "IsGroupMember"), XS_Group_IsGroupMember, file, "$$");
newXSproto(strcpy(buf, "CastGroupSpell"), XS_Group_CastGroupSpell, file, "$$$"); newXSproto(strcpy(buf, "CastGroupSpell"), XS_Group_CastGroupSpell, file, "$$$");
newXSproto(strcpy(buf, "SplitExp"), XS_Group_SplitExp, file, "$$$"); newXSproto(strcpy(buf, "SplitExp"), XS_Group_SplitExp, file, "$$$");
newXSproto(strcpy(buf, "GroupMessage"), XS_Group_GroupMessage, file, "$$$"); newXSproto(strcpy(buf, "GroupMessage"), XS_Group_GroupMessage, file, "$$$");
newXSproto(strcpy(buf, "GetTotalGroupDamage"), XS_Group_GetTotalGroupDamage, file, "$$"); newXSproto(strcpy(buf, "GetTotalGroupDamage"), XS_Group_GetTotalGroupDamage, file, "$$");
newXSproto(strcpy(buf, "SplitMoney"), XS_Group_SplitMoney, file, "$$$$$"); newXSproto(strcpy(buf, "SplitMoney"), XS_Group_SplitMoney, file, "$$$$$");
newXSproto(strcpy(buf, "SetLeader"), XS_Group_SetLeader, file, "$$"); newXSproto(strcpy(buf, "SetLeader"), XS_Group_SetLeader, file, "$$");
newXSproto(strcpy(buf, "GetLeader"), XS_Group_GetLeader, file, "$"); newXSproto(strcpy(buf, "GetLeader"), XS_Group_GetLeader, file, "$");
newXSproto(strcpy(buf, "GetLeaderName"), XS_Group_GetLeaderName, file, "$"); newXSproto(strcpy(buf, "GetLeaderName"), XS_Group_GetLeaderName, file, "$");
newXSproto(strcpy(buf, "SendHPPacketsTo"), XS_Group_SendHPPacketsTo, file, "$$"); newXSproto(strcpy(buf, "SendHPPacketsTo"), XS_Group_SendHPPacketsTo, file, "$$");
newXSproto(strcpy(buf, "SendHPPacketsFrom"), XS_Group_SendHPPacketsFrom, file, "$$"); newXSproto(strcpy(buf, "SendHPPacketsFrom"), XS_Group_SendHPPacketsFrom, file, "$$");
newXSproto(strcpy(buf, "IsLeader"), XS_Group_IsLeader, file, "$$"); newXSproto(strcpy(buf, "IsLeader"), XS_Group_IsLeader, file, "$$");
newXSproto(strcpy(buf, "GroupCount"), XS_Group_GroupCount, file, "$"); newXSproto(strcpy(buf, "GroupCount"), XS_Group_GroupCount, file, "$");
newXSproto(strcpy(buf, "GetHighestLevel"), XS_Group_GetHighestLevel, file, "$"); newXSproto(strcpy(buf, "GetHighestLevel"), XS_Group_GetHighestLevel, file, "$");
newXSproto(strcpy(buf, "TeleportGroup"), XS_Group_TeleportGroup, file, "$$$$$$$"); newXSproto(strcpy(buf, "TeleportGroup"), XS_Group_TeleportGroup, file, "$$$$$$$");
newXSproto(strcpy(buf, "GetID"), XS_Group_GetID, file, "$"); newXSproto(strcpy(buf, "GetID"), XS_Group_GetID, file, "$");
newXSproto(strcpy(buf, "GetMember"), XS_Group_GetMember, file, "$$"); newXSproto(strcpy(buf, "GetMember"), XS_Group_GetMember, file, "$$");
XSRETURN_YES; XSRETURN_YES;
} }
+33 -36
View File
@@ -18,7 +18,9 @@
#include "../common/features.h" #include "../common/features.h"
#include "client.h" #include "client.h"
#ifdef EMBPERL_XS_CLASSES #ifdef EMBPERL_XS_CLASSES
#include "../common/global_define.h" #include "../common/global_define.h"
#include "embperl.h" #include "embperl.h"
@@ -29,84 +31,80 @@
#include "../common/linked_list.h" #include "../common/linked_list.h"
#include "hate_list.h" #include "hate_list.h"
#ifdef THIS /* this macro seems to leak out on some systems */ #ifdef THIS /* this macro seems to leak out on some systems */
#undef THIS #undef THIS
#endif #endif
XS(XS_HateEntry_GetEnt); /* prototype to pass -Wmissing-prototypes */ XS(XS_HateEntry_GetEnt); /* prototype to pass -Wmissing-prototypes */
XS(XS_HateEntry_GetEnt) XS(XS_HateEntry_GetEnt) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: HateEntry::GetData(THIS)"); Perl_croak(aTHX_ "Usage: HateEntry::GetData(THIS)");
{ {
struct_HateList * THIS; struct_HateList *THIS;
Mob * RETVAL; Mob *RETVAL;
if (sv_derived_from(ST(0), "HateEntry")) { if (sv_derived_from(ST(0), "HateEntry")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(struct_HateList *,tmp); THIS = INT2PTR(struct_HateList *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type tHateEntry"); Perl_croak(aTHX_ "THIS is not of type tHateEntry");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->entity_on_hatelist; RETVAL = THIS->entity_on_hatelist;
ST(0) = sv_newmortal(); ST(0) = sv_newmortal();
sv_setref_pv(ST(0), "Mob", (void*)RETVAL); sv_setref_pv(ST(0), "Mob", (void *) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_HateEntry_GetHate); /* prototype to pass -Wmissing-prototypes */ XS(XS_HateEntry_GetHate); /* prototype to pass -Wmissing-prototypes */
XS(XS_HateEntry_GetHate) XS(XS_HateEntry_GetHate) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: HateEntry::GetHate(THIS)"); Perl_croak(aTHX_ "Usage: HateEntry::GetHate(THIS)");
{ {
struct_HateList * THIS; struct_HateList *THIS;
int32 RETVAL; int32 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "HateEntry")) { if (sv_derived_from(ST(0), "HateEntry")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(struct_HateList *,tmp); THIS = INT2PTR(struct_HateList *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type tHateEntry"); Perl_croak(aTHX_ "THIS is not of type tHateEntry");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->stored_hate_amount; RETVAL = THIS->stored_hate_amount;
XSprePUSH; PUSHi((IV)RETVAL); XSprePUSH;
PUSHi((IV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_HateEntry_GetDamage); /* prototype to pass -Wmissing-prototypes */ XS(XS_HateEntry_GetDamage); /* prototype to pass -Wmissing-prototypes */
XS(XS_HateEntry_GetDamage) XS(XS_HateEntry_GetDamage) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: HateEntry::GetDamage(THIS)"); Perl_croak(aTHX_ "Usage: HateEntry::GetDamage(THIS)");
{ {
struct_HateList * THIS; struct_HateList *THIS;
int32 RETVAL; int32 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "HateEntry")) { if (sv_derived_from(ST(0), "HateEntry")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(struct_HateList *,tmp); THIS = INT2PTR(struct_HateList *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type tHateEntry"); Perl_croak(aTHX_ "THIS is not of type tHateEntry");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->hatelist_damage; RETVAL = THIS->hatelist_damage;
XSprePUSH; PUSHi((IV)RETVAL); XSprePUSH;
PUSHi((IV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
@@ -116,24 +114,23 @@ extern "C"
#endif #endif
XS(boot_HateEntry); XS(boot_HateEntry);
XS(boot_HateEntry) XS(boot_HateEntry) {
{
dXSARGS; dXSARGS;
char file[256]; char file[256];
strncpy(file, __FILE__, 256); strncpy(file, __FILE__, 256);
file[255] = 0; file[255] = 0;
if(items != 1) if (items != 1)
fprintf(stderr, "boot_quest does not take any arguments."); fprintf(stderr, "boot_quest does not take any arguments.");
char buf[128]; char buf[128];
//add the strcpy stuff to get rid of const warnings.... //add the strcpy stuff to get rid of const warnings....
XS_VERSION_BOOTCHECK ; XS_VERSION_BOOTCHECK;
newXSproto(strcpy(buf, "GetEnt"), XS_HateEntry_GetEnt, file, "$"); newXSproto(strcpy(buf, "GetEnt"), XS_HateEntry_GetEnt, file, "$");
newXSproto(strcpy(buf, "GetDamage"), XS_HateEntry_GetDamage, file, "$"); newXSproto(strcpy(buf, "GetDamage"), XS_HateEntry_GetDamage, file, "$");
newXSproto(strcpy(buf, "GetHate"), XS_HateEntry_GetHate, file, "$"); newXSproto(strcpy(buf, "GetHate"), XS_HateEntry_GetHate, file, "$");
XSRETURN_YES; XSRETURN_YES;
} }
+3425 -3960
View File
File diff suppressed because it is too large Load Diff
+954 -1101
View File
File diff suppressed because it is too large Load Diff
+394 -460
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+91 -101
View File
@@ -18,7 +18,9 @@
#include "../common/features.h" #include "../common/features.h"
#include "client.h" #include "client.h"
#ifdef EMBPERL_XS_CLASSES #ifdef EMBPERL_XS_CLASSES
#include "../common/global_define.h" #include "../common/global_define.h"
#include "embperl.h" #include "embperl.h"
@@ -28,7 +30,7 @@
#include "../common/item_instance.h" #include "../common/item_instance.h"
#ifdef THIS /* this macro seems to leak out on some systems */ #ifdef THIS /* this macro seems to leak out on some systems */
#undef THIS #undef THIS
#endif #endif
@@ -38,76 +40,73 @@ XS(XS_QuestItem_GetName) {
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: QuestItem::GetName(THIS)"); Perl_croak(aTHX_ "Usage: QuestItem::GetName(THIS)");
{ {
EQEmu::ItemInstance * THIS; EQEmu::ItemInstance *THIS;
Const_char * RETVAL; Const_char *RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "QuestItem")) { if (sv_derived_from(ST(0), "QuestItem")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *,tmp); THIS = INT2PTR(EQEmu::ItemInstance *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance"); Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetItem()->Name; RETVAL = THIS->GetItem()->Name;
sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG; sv_setpv(TARG, RETVAL);
XSprePUSH;
PUSHTARG;
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_QuestItem_SetScale); XS(XS_QuestItem_SetScale);
XS(XS_QuestItem_SetScale) XS(XS_QuestItem_SetScale) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: QuestItem::SetScale(THIS, scale factor)"); Perl_croak(aTHX_ "Usage: QuestItem::SetScale(THIS, float scale_multiplier)");
{ {
EQEmu::ItemInstance * THIS; EQEmu::ItemInstance *THIS;
float Mult; float Mult;
if (sv_derived_from(ST(0), "QuestItem")) { if (sv_derived_from(ST(0), "QuestItem")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *,tmp); THIS = INT2PTR(EQEmu::ItemInstance *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance"); Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
Mult = (float)SvNV(ST(1)); Mult = (float) SvNV(ST(1));
if(THIS->IsScaling()) { if (THIS->IsScaling()) {
THIS->SetExp((int)(Mult*10000+.5)); THIS->SetExp((int) (Mult * 10000 + .5));
} }
} }
XSRETURN_EMPTY; XSRETURN_EMPTY;
} }
XS(XS_QuestItem_ItemSay); XS(XS_QuestItem_ItemSay);
XS(XS_QuestItem_ItemSay) XS(XS_QuestItem_ItemSay) {
{
dXSARGS; dXSARGS;
if (items != 2 && items != 3) if (items != 2 && items != 3)
Perl_croak(aTHX_ "Usage: QuestItem::ItemSay(THIS, text [, language])"); Perl_croak(aTHX_ "Usage: QuestItem::ItemSay(THIS, string text [int language_id])");
{ {
EQEmu::ItemInstance* THIS; EQEmu::ItemInstance *THIS;
Const_char* text; Const_char *text;
int lang = 0; int lang = 0;
if (sv_derived_from(ST(0), "QuestItem")) { if (sv_derived_from(ST(0), "QuestItem")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *,tmp); THIS = INT2PTR(EQEmu::ItemInstance *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance"); Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
text = SvPV_nolen(ST(1)); text = SvPV_nolen(ST(1));
if(items == 3) if (items == 3)
lang = (int)SvUV(ST(2)); lang = (int) SvUV(ST(2));
quest_manager.GetInitiator()->ChannelMessageSend(THIS->GetItem()->Name, 0, 8, lang, 100, text); quest_manager.GetInitiator()->ChannelMessageSend(THIS->GetItem()->Name, 0, 8, lang, 100, text);
} }
@@ -115,49 +114,45 @@ XS(XS_QuestItem_ItemSay)
} }
XS(XS_QuestItem_IsType); /* prototype to pass -Wmissing-prototypes */ XS(XS_QuestItem_IsType); /* prototype to pass -Wmissing-prototypes */
XS(XS_QuestItem_IsType) XS(XS_QuestItem_IsType) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: QuestItem::IsType(THIS, type)"); Perl_croak(aTHX_ "Usage: QuestItem::IsType(THIS, type)");
{ {
EQEmu::ItemInstance* THIS; EQEmu::ItemInstance *THIS;
bool RETVAL; bool RETVAL;
uint32 type = (int32)SvIV(ST(1)); uint32 type = (int32) SvIV(ST(1));
if (sv_derived_from(ST(0), "QuestItem")) { if (sv_derived_from(ST(0), "QuestItem")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *,tmp); THIS = INT2PTR(EQEmu::ItemInstance *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance"); Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->IsType((EQEmu::item::ItemClass)type); RETVAL = THIS->IsType((EQEmu::item::ItemClass) type);
ST(0) = boolSV(RETVAL); ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0)); sv_2mortal(ST(0));
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_QuestItem_IsAttuned); /* prototype to pass -Wmissing-prototypes */ XS(XS_QuestItem_IsAttuned); /* prototype to pass -Wmissing-prototypes */
XS(XS_QuestItem_IsAttuned) XS(XS_QuestItem_IsAttuned) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: QuestItem::IsAttuned(THIS)"); Perl_croak(aTHX_ "Usage: QuestItem::IsAttuned(THIS)");
{ {
EQEmu::ItemInstance* THIS; EQEmu::ItemInstance *THIS;
bool RETVAL; bool RETVAL;
if (sv_derived_from(ST(0), "QuestItem")) { if (sv_derived_from(ST(0), "QuestItem")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *,tmp); THIS = INT2PTR(EQEmu::ItemInstance *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance"); Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->IsAttuned(); RETVAL = THIS->IsAttuned();
@@ -168,80 +163,76 @@ XS(XS_QuestItem_IsAttuned)
} }
XS(XS_QuestItem_GetCharges); /* prototype to pass -Wmissing-prototypes */ XS(XS_QuestItem_GetCharges); /* prototype to pass -Wmissing-prototypes */
XS(XS_QuestItem_GetCharges) XS(XS_QuestItem_GetCharges) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: QuestItem::GetCharges(THIS)"); Perl_croak(aTHX_ "Usage: QuestItem::GetCharges(THIS)");
{ {
EQEmu::ItemInstance* THIS; EQEmu::ItemInstance *THIS;
int16 RETVAL; int16 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "QuestItem")) { if (sv_derived_from(ST(0), "QuestItem")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *,tmp); THIS = INT2PTR(EQEmu::ItemInstance *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance"); Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetCharges(); RETVAL = THIS->GetCharges();
XSprePUSH; PUSHi((IV)RETVAL); XSprePUSH;
PUSHi((IV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_QuestItem_GetAugment); /* prototype to pass -Wmissing-prototypes */ XS(XS_QuestItem_GetAugment); /* prototype to pass -Wmissing-prototypes */
XS(XS_QuestItem_GetAugment) XS(XS_QuestItem_GetAugment) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: QuestItem::GetAugment(THIS, augment_id)"); Perl_croak(aTHX_ "Usage: QuestItem::GetAugment(THIS, int16 slot_id)");
{ {
EQEmu::ItemInstance* THIS; EQEmu::ItemInstance *THIS;
int16 slot_id = (int16)SvIV(ST(1)); int16 slot_id = (int16) SvIV(ST(1));
EQEmu::ItemInstance* RETVAL; EQEmu::ItemInstance *RETVAL;
if (sv_derived_from(ST(0), "QuestItem")) { if (sv_derived_from(ST(0), "QuestItem")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *,tmp); THIS = INT2PTR(EQEmu::ItemInstance *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance"); Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetAugment(slot_id); RETVAL = THIS->GetAugment(slot_id);
ST(0) = sv_newmortal(); ST(0) = sv_newmortal();
sv_setref_pv(ST(0), "QuestItem", (void*)RETVAL); sv_setref_pv(ST(0), "QuestItem", (void *) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_QuestItem_GetID); /* prototype to pass -Wmissing-prototypes */ XS(XS_QuestItem_GetID); /* prototype to pass -Wmissing-prototypes */
XS(XS_QuestItem_GetID) XS(XS_QuestItem_GetID) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: QuestItem::GetID(THIS)"); Perl_croak(aTHX_ "Usage: QuestItem::GetID(THIS)");
{ {
EQEmu::ItemInstance* THIS; EQEmu::ItemInstance *THIS;
uint32 RETVAL; uint32 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "QuestItem")) { if (sv_derived_from(ST(0), "QuestItem")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *,tmp); THIS = INT2PTR(EQEmu::ItemInstance *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance"); Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetItem()->ID; RETVAL = THIS->GetItem()->ID;
XSprePUSH; PUSHi((IV)RETVAL); XSprePUSH;
PUSHi((IV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
@@ -251,29 +242,28 @@ extern "C"
#endif #endif
XS(boot_QuestItem); XS(boot_QuestItem);
XS(boot_QuestItem) XS(boot_QuestItem) {
{
dXSARGS; dXSARGS;
char file[256]; char file[256];
strncpy(file, __FILE__, 256); strncpy(file, __FILE__, 256);
file[255] = 0; file[255] = 0;
if(items != 1) if (items != 1)
fprintf(stderr, "boot_quest does not take any arguments."); fprintf(stderr, "boot_quest does not take any arguments.");
char buf[128]; char buf[128];
//add the strcpy stuff to get rid of const warnings.... //add the strcpy stuff to get rid of const warnings....
XS_VERSION_BOOTCHECK ; XS_VERSION_BOOTCHECK;
newXSproto(strcpy(buf, "GetName"), XS_QuestItem_GetName, file, "$"); newXSproto(strcpy(buf, "GetName"), XS_QuestItem_GetName, file, "$");
newXSproto(strcpy(buf, "SetScale"), XS_QuestItem_SetScale, file, "$"); newXSproto(strcpy(buf, "SetScale"), XS_QuestItem_SetScale, file, "$");
newXSproto(strcpy(buf, "ItemSay"), XS_QuestItem_ItemSay, file, "$"); newXSproto(strcpy(buf, "ItemSay"), XS_QuestItem_ItemSay, file, "$");
newXSproto(strcpy(buf, "IsType"), XS_QuestItem_IsType, file, "$$"); newXSproto(strcpy(buf, "IsType"), XS_QuestItem_IsType, file, "$$");
newXSproto(strcpy(buf, "IsAttuned"), XS_QuestItem_IsAttuned, file, "$"); newXSproto(strcpy(buf, "IsAttuned"), XS_QuestItem_IsAttuned, file, "$");
newXSproto(strcpy(buf, "GetCharges"), XS_QuestItem_GetCharges, file, "$"); newXSproto(strcpy(buf, "GetCharges"), XS_QuestItem_GetCharges, file, "$");
newXSproto(strcpy(buf, "GetAugment"), XS_QuestItem_GetAugment, file, "$$"); newXSproto(strcpy(buf, "GetAugment"), XS_QuestItem_GetAugment, file, "$$");
newXSproto(strcpy(buf, "GetID"), XS_QuestItem_GetID, file, "$"); newXSproto(strcpy(buf, "GetID"), XS_QuestItem_GetID, file, "$");
XSRETURN_YES; XSRETURN_YES;
} }
+233 -264
View File
@@ -26,7 +26,9 @@
*/ */
#include "../common/features.h" #include "../common/features.h"
#ifdef EMBPERL_XS_CLASSES #ifdef EMBPERL_XS_CLASSES
#include "../common/global_define.h" #include "../common/global_define.h"
#include "embperl.h" #include "embperl.h"
@@ -43,60 +45,55 @@
XS(XS_Raid_IsRaidMember); /* prototype to pass -Wmissing-prototypes */ XS(XS_Raid_IsRaidMember); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_IsRaidMember) XS(XS_Raid_IsRaidMember) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Raid::IsRaidMember(THIS, name)"); Perl_croak(aTHX_ "Usage: Raid::IsRaidMember(THIS, string name)");
{ {
Raid * THIS; Raid *THIS;
bool RETVAL; bool RETVAL;
const char* name = (char *)SvPV_nolen(ST(1)); const char *name = (char *) SvPV_nolen(ST(1));
if (sv_derived_from(ST(0), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->IsRaidMember(name); RETVAL = THIS->IsRaidMember(name);
ST(0) = boolSV(RETVAL); ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0)); sv_2mortal(ST(0));
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Raid_CastGroupSpell); /* prototype to pass -Wmissing-prototypes */ XS(XS_Raid_CastGroupSpell); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_CastGroupSpell) XS(XS_Raid_CastGroupSpell) {
{
dXSARGS; dXSARGS;
if (items != 4) if (items != 4)
Perl_croak(aTHX_ "Usage: Raid::CastGroupSpell(THIS, caster, spellid, gid)"); Perl_croak(aTHX_ "Usage: Raid::CastGroupSpell(THIS, Mob* caster, uint16 spell_id, uint32 group_id)");
{ {
Raid * THIS; Raid *THIS;
Mob* caster; Mob *caster;
uint16 spellid = (uint16)SvUV(ST(2)); uint16 spellid = (uint16) SvUV(ST(2));
uint32 gid = (uint32)SvUV(ST(3)); uint32 gid = (uint32) SvUV(ST(3));
if (sv_derived_from(ST(0), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) { if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1))); IV tmp = SvIV((SV *) SvRV(ST(1)));
caster = INT2PTR(Mob *,tmp); caster = INT2PTR(Mob *, tmp);
} } else
else
Perl_croak(aTHX_ "caster is not of type Mob"); Perl_croak(aTHX_ "caster is not of type Mob");
if(caster == nullptr) if (caster == nullptr)
Perl_croak(aTHX_ "caster is nullptr, avoiding crash."); Perl_croak(aTHX_ "caster is nullptr, avoiding crash.");
THIS->CastGroupSpell(caster, spellid, gid); THIS->CastGroupSpell(caster, spellid, gid);
@@ -105,112 +102,106 @@ XS(XS_Raid_CastGroupSpell)
} }
XS(XS_Raid_GroupCount); /* prototype to pass -Wmissing-prototypes */ XS(XS_Raid_GroupCount); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_GroupCount) XS(XS_Raid_GroupCount) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Raid::GroupCount(THIS, gid)"); Perl_croak(aTHX_ "Usage: Raid::GroupCount(THIS, uint32 group_id)");
{ {
Raid * THIS; Raid *THIS;
uint8 RETVAL; uint8 RETVAL;
dXSTARG; dXSTARG;
uint32 gid = (uint32)SvUV(ST(1)); uint32 gid = (uint32) SvUV(ST(1));
if (sv_derived_from(ST(0), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GroupCount(gid); RETVAL = THIS->GroupCount(gid);
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Raid_RaidCount); /* prototype to pass -Wmissing-prototypes */ XS(XS_Raid_RaidCount); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_RaidCount) XS(XS_Raid_RaidCount) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Raid::RaidCount(THIS)"); Perl_croak(aTHX_ "Usage: Raid::RaidCount(THIS)");
{ {
Raid * THIS; Raid *THIS;
uint8 RETVAL; uint8 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->RaidCount(); RETVAL = THIS->RaidCount();
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Raid_GetGroup); /* prototype to pass -Wmissing-prototypes */ XS(XS_Raid_GetGroup); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_GetGroup) XS(XS_Raid_GetGroup) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Raid::GetGroup(THIS, name)"); Perl_croak(aTHX_ "Usage: Raid::GetGroup(THIS, string name)");
{ {
Raid * THIS; Raid *THIS;
uint32 RETVAL; uint32 RETVAL;
dXSTARG; dXSTARG;
const char* name = (char *)SvPV_nolen(ST(1)); const char *name = (char *) SvPV_nolen(ST(1));
if (sv_derived_from(ST(0), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetGroup(name); RETVAL = THIS->GetGroup(name);
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Raid_SplitExp); /* prototype to pass -Wmissing-prototypes */ XS(XS_Raid_SplitExp); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_SplitExp) XS(XS_Raid_SplitExp) {
{
dXSARGS; dXSARGS;
if (items != 3) if (items != 3)
Perl_croak(aTHX_ "Usage: Raid::SplitExp(THIS, exp, other)"); Perl_croak(aTHX_ "Usage: Raid::SplitExp(THIS, uint32 experience, [Mob* other = nullptr])");
{ {
Raid * THIS; Raid *THIS;
uint32 exp = (uint32)SvUV(ST(1)); uint32 exp = (uint32) SvUV(ST(1));
Mob* other; Mob *other;
if (sv_derived_from(ST(0), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(2), "Mob")) { if (sv_derived_from(ST(2), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(2))); IV tmp = SvIV((SV *) SvRV(ST(2)));
other = INT2PTR(Mob *,tmp); other = INT2PTR(Mob *, tmp);
} } else
else
Perl_croak(aTHX_ "other is not of type Mob"); Perl_croak(aTHX_ "other is not of type Mob");
if(other == nullptr) if (other == nullptr)
Perl_croak(aTHX_ "other is nullptr, avoiding crash."); Perl_croak(aTHX_ "other is nullptr, avoiding crash.");
THIS->SplitExp(exp, other); THIS->SplitExp(exp, other);
@@ -219,61 +210,57 @@ XS(XS_Raid_SplitExp)
} }
XS(XS_Raid_GetTotalRaidDamage); /* prototype to pass -Wmissing-prototypes */ XS(XS_Raid_GetTotalRaidDamage); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_GetTotalRaidDamage) XS(XS_Raid_GetTotalRaidDamage) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Raid::GetTotalRaidDamage(THIS, other)"); Perl_croak(aTHX_ "Usage: Raid::GetTotalRaidDamage(THIS, [Mob* other = nullptr])");
{ {
Raid * THIS; Raid *THIS;
uint32 RETVAL; uint32 RETVAL;
dXSTARG; dXSTARG;
Mob* other; Mob *other;
if (sv_derived_from(ST(0), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) { if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1))); IV tmp = SvIV((SV *) SvRV(ST(1)));
other = INT2PTR(Mob *,tmp); other = INT2PTR(Mob *, tmp);
} } else
else
Perl_croak(aTHX_ "other is not of type Mob"); Perl_croak(aTHX_ "other is not of type Mob");
if(other == nullptr) if (other == nullptr)
Perl_croak(aTHX_ "other is nullptr, avoiding crash."); Perl_croak(aTHX_ "other is nullptr, avoiding crash.");
RETVAL = THIS->GetTotalRaidDamage(other); RETVAL = THIS->GetTotalRaidDamage(other);
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Raid_SplitMoney); /* prototype to pass -Wmissing-prototypes */ XS(XS_Raid_SplitMoney); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_SplitMoney) XS(XS_Raid_SplitMoney) {
{
dXSARGS; dXSARGS;
if (items != 5) if (items != 5)
Perl_croak(aTHX_ "Usage: Raid::SplitMoney(THIS, copper, silver, gold, platinum)"); Perl_croak(aTHX_ "Usage: Raid::SplitMoney(THIS, uint32 copper, uint32 silver, uint32 gold, uint32 platinum)");
{ {
Raid * THIS; Raid *THIS;
uint32 copper = (uint32)SvUV(ST(1)); uint32 copper = (uint32) SvUV(ST(1));
uint32 silver = (uint32)SvUV(ST(2)); uint32 silver = (uint32) SvUV(ST(2));
uint32 gold = (uint32)SvUV(ST(3)); uint32 gold = (uint32) SvUV(ST(3));
uint32 platinum = (uint32)SvUV(ST(4)); uint32 platinum = (uint32) SvUV(ST(4));
if (sv_derived_from(ST(0), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->SplitMoney(copper, silver, gold, platinum); THIS->SplitMoney(copper, silver, gold, platinum);
@@ -282,23 +269,21 @@ XS(XS_Raid_SplitMoney)
} }
XS(XS_Raid_BalanceHP); /* prototype to pass -Wmissing-prototypes */ XS(XS_Raid_BalanceHP); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_BalanceHP) XS(XS_Raid_BalanceHP) {
{
dXSARGS; dXSARGS;
if (items != 3) if (items != 3)
Perl_croak(aTHX_ "Usage: Raid::BalanceHP(THIS, penalty, gid)"); Perl_croak(aTHX_ "Usage: Raid::BalanceHP(THIS, int32 penalty, uint32 group_id)");
{ {
Raid * THIS; Raid *THIS;
int32 penalty = (int32)SvUV(ST(1)); int32 penalty = (int32) SvUV(ST(1));
uint32 gid = (uint32)SvUV(ST(2)); uint32 gid = (uint32) SvUV(ST(2));
if (sv_derived_from(ST(0), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->BalanceHP(penalty, gid); THIS->BalanceHP(penalty, gid);
@@ -307,170 +292,160 @@ XS(XS_Raid_BalanceHP)
} }
XS(XS_Raid_IsLeader); /* prototype to pass -Wmissing-prototypes */ XS(XS_Raid_IsLeader); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_IsLeader) XS(XS_Raid_IsLeader) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Raid::IsLeader(THIS, name)"); Perl_croak(aTHX_ "Usage: Raid::IsLeader(THIS, string name)");
{ {
Raid * THIS; Raid *THIS;
bool RETVAL; bool RETVAL;
const char* name = (char *)SvPV_nolen(ST(1)); const char *name = (char *) SvPV_nolen(ST(1));
if (sv_derived_from(ST(0), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->IsLeader(name); RETVAL = THIS->IsLeader(name);
ST(0) = boolSV(RETVAL); ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0)); sv_2mortal(ST(0));
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Raid_IsGroupLeader); /* prototype to pass -Wmissing-prototypes */ XS(XS_Raid_IsGroupLeader); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_IsGroupLeader) XS(XS_Raid_IsGroupLeader) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Raid::IsGroupLeader(THIS, who)"); Perl_croak(aTHX_ "Usage: Raid::IsGroupLeader(THIS, string name)");
{ {
Raid * THIS; Raid *THIS;
bool RETVAL; bool RETVAL;
const char* who = (char *)SvPV_nolen(ST(1)); const char *who = (char *) SvPV_nolen(ST(1));
if (sv_derived_from(ST(0), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->IsGroupLeader(who); RETVAL = THIS->IsGroupLeader(who);
ST(0) = boolSV(RETVAL); ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0)); sv_2mortal(ST(0));
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Raid_GetHighestLevel); /* prototype to pass -Wmissing-prototypes */ XS(XS_Raid_GetHighestLevel); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_GetHighestLevel) XS(XS_Raid_GetHighestLevel) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Raid::GetHighestLevel(THIS)"); Perl_croak(aTHX_ "Usage: Raid::GetHighestLevel(THIS)");
{ {
Raid * THIS; Raid *THIS;
uint32 RETVAL; uint32 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetHighestLevel(); RETVAL = THIS->GetHighestLevel();
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Raid_GetLowestLevel); /* prototype to pass -Wmissing-prototypes */ XS(XS_Raid_GetLowestLevel); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_GetLowestLevel) XS(XS_Raid_GetLowestLevel) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Raid::GetLowestLevel(THIS)"); Perl_croak(aTHX_ "Usage: Raid::GetLowestLevel(THIS)");
{ {
Raid * THIS; Raid *THIS;
uint32 RETVAL; uint32 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetLowestLevel(); RETVAL = THIS->GetLowestLevel();
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Raid_GetClientByIndex); /* prototype to pass -Wmissing-prototypes */ XS(XS_Raid_GetClientByIndex); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_GetClientByIndex) XS(XS_Raid_GetClientByIndex) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Raid::GetClientByIndex(THIS, index)"); Perl_croak(aTHX_ "Usage: Raid::GetClientByIndex(THIS, uint16 raid_indez)");
{ {
Raid * THIS; Raid *THIS;
Client * RETVAL; Client *RETVAL;
uint16 index = (uint16)SvUV(ST(1)); uint16 index = (uint16) SvUV(ST(1));
if (sv_derived_from(ST(0), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetClientByIndex(index); RETVAL = THIS->GetClientByIndex(index);
ST(0) = sv_newmortal(); ST(0) = sv_newmortal();
sv_setref_pv(ST(0), "Client", (void*)RETVAL); sv_setref_pv(ST(0), "Client", (void *) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Raid_TeleportGroup); /* prototype to pass -Wmissing-prototypes */ XS(XS_Raid_TeleportGroup); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_TeleportGroup) XS(XS_Raid_TeleportGroup) {
{
dXSARGS; dXSARGS;
if (items != 8) if (items != 8)
Perl_croak(aTHX_ "Usage: Raid::TeleportGroup(THIS, sender, zoneID, x, y, z, heading, gid)"); Perl_croak(aTHX_
"Usage: Raid::TeleportGroup(THIS, Mob* sender, uint32 zone_id, float x, float y, float z, float heading, uint32 group_id)");
{ {
Raid * THIS; Raid *THIS;
Mob* sender; Mob *sender;
uint32 zoneID = (uint32)SvUV(ST(2)); uint32 zoneID = (uint32) SvUV(ST(2));
float x = (float)SvNV(ST(3)); float x = (float) SvNV(ST(3));
float y = (float)SvNV(ST(4)); float y = (float) SvNV(ST(4));
float z = (float)SvNV(ST(5)); float z = (float) SvNV(ST(5));
float heading = (float)SvNV(ST(6)); float heading = (float) SvNV(ST(6));
uint32 gid = (uint32)SvUV(ST(7)); uint32 gid = (uint32) SvUV(ST(7));
if (sv_derived_from(ST(0), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) { if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1))); IV tmp = SvIV((SV *) SvRV(ST(1)));
sender = INT2PTR(Mob *,tmp); sender = INT2PTR(Mob *, tmp);
} } else
else
Perl_croak(aTHX_ "sender is not of type Mob"); Perl_croak(aTHX_ "sender is not of type Mob");
if(sender == nullptr) if (sender == nullptr)
Perl_croak(aTHX_ "sender is nullptr, avoiding crash."); Perl_croak(aTHX_ "sender is nullptr, avoiding crash.");
THIS->TeleportGroup(sender, zoneID, 0, x, y, z, heading, gid); THIS->TeleportGroup(sender, zoneID, 0, x, y, z, heading, gid);
@@ -479,36 +454,34 @@ XS(XS_Raid_TeleportGroup)
} }
XS(XS_Raid_TeleportRaid); /* prototype to pass -Wmissing-prototypes */ XS(XS_Raid_TeleportRaid); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_TeleportRaid) XS(XS_Raid_TeleportRaid) {
{
dXSARGS; dXSARGS;
if (items != 7) if (items != 7)
Perl_croak(aTHX_ "Usage: Raid::TeleportRaid(THIS, sender, zoneID, x, y, z, heading)"); Perl_croak(aTHX_
"Usage: Raid::TeleportRaid(THIS, Mob* sender, uint32 zone_id, float x, float y, float z, float heading)");
{ {
Raid * THIS; Raid *THIS;
Mob* sender; Mob *sender;
uint32 zoneID = (uint32)SvUV(ST(2)); uint32 zoneID = (uint32) SvUV(ST(2));
float x = (float)SvNV(ST(3)); float x = (float) SvNV(ST(3));
float y = (float)SvNV(ST(4)); float y = (float) SvNV(ST(4));
float z = (float)SvNV(ST(5)); float z = (float) SvNV(ST(5));
float heading = (float)SvNV(ST(6)); float heading = (float) SvNV(ST(6));
if (sv_derived_from(ST(0), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) { if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1))); IV tmp = SvIV((SV *) SvRV(ST(1)));
sender = INT2PTR(Mob *,tmp); sender = INT2PTR(Mob *, tmp);
} } else
else
Perl_croak(aTHX_ "sender is not of type Mob"); Perl_croak(aTHX_ "sender is not of type Mob");
if(sender == nullptr) if (sender == nullptr)
Perl_croak(aTHX_ "sender is nullptr, avoiding crash."); Perl_croak(aTHX_ "sender is nullptr, avoiding crash.");
THIS->TeleportRaid(sender, zoneID, 0, x, y, z, heading); THIS->TeleportRaid(sender, zoneID, 0, x, y, z, heading);
@@ -517,61 +490,58 @@ XS(XS_Raid_TeleportRaid)
} }
XS(XS_Raid_GetID); /* prototype to pass -Wmissing-prototypes */ XS(XS_Raid_GetID); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_GetID) XS(XS_Raid_GetID) {
{
dXSARGS; dXSARGS;
if (items != 1) if (items != 1)
Perl_croak(aTHX_ "Usage: Raid::GetID(THIS)"); Perl_croak(aTHX_ "Usage: Raid::GetID(THIS)");
{ {
Raid * THIS; Raid *THIS;
uint32 RETVAL; uint32 RETVAL;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetID(); RETVAL = THIS->GetID();
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH;
PUSHu((UV) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
XS(XS_Raid_GetMember); XS(XS_Raid_GetMember);
XS(XS_Raid_GetMember) XS(XS_Raid_GetMember) {
{
dXSARGS; dXSARGS;
if (items != 2) if (items != 2)
Perl_croak(aTHX_ "Usage: Raid::GetMember(THIS, index)"); Perl_croak(aTHX_ "Usage: Raid::GetMember(THIS, int raid_index)");
{ {
Raid * THIS; Raid *THIS;
Client* RETVAL = nullptr; Client *RETVAL = nullptr;
dXSTARG; dXSTARG;
if (sv_derived_from(ST(0), "Raid")) { if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0))); IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp); THIS = INT2PTR(Raid *, tmp);
} } else
else
Perl_croak(aTHX_ "THIS is not of type Raid"); Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr) if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
int index = (int)SvUV(ST(1)); int index = (int) SvUV(ST(1));
if (index < 0 || index > 71) if (index < 0 || index > 71)
RETVAL = nullptr; RETVAL = nullptr;
else { else {
if(THIS->members[index].member != nullptr) if (THIS->members[index].member != nullptr)
RETVAL = THIS->members[index].member->CastToClient(); RETVAL = THIS->members[index].member->CastToClient();
} }
ST(0) = sv_newmortal(); ST(0) = sv_newmortal();
sv_setref_pv(ST(0), "Client", (void*)RETVAL); sv_setref_pv(ST(0), "Client", (void *) RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
@@ -580,39 +550,38 @@ XS(XS_Raid_GetMember)
extern "C" extern "C"
#endif #endif
XS(boot_Raid); /* prototype to pass -Wmissing-prototypes */ XS(boot_Raid); /* prototype to pass -Wmissing-prototypes */
XS(boot_Raid) XS(boot_Raid) {
{
dXSARGS; dXSARGS;
char file[256]; char file[256];
strncpy(file, __FILE__, 256); strncpy(file, __FILE__, 256);
file[255] = 0; file[255] = 0;
if(items != 1) if (items != 1)
fprintf(stderr, "boot_quest does not take any arguments."); fprintf(stderr, "boot_quest does not take any arguments.");
char buf[128]; char buf[128];
//add the strcpy stuff to get rid of const warnings.... //add the strcpy stuff to get rid of const warnings....
XS_VERSION_BOOTCHECK ; XS_VERSION_BOOTCHECK;
newXSproto(strcpy(buf, "IsRaidMember"), XS_Raid_IsRaidMember, file, "$$"); newXSproto(strcpy(buf, "IsRaidMember"), XS_Raid_IsRaidMember, file, "$$");
newXSproto(strcpy(buf, "CastGroupSpell"), XS_Raid_CastGroupSpell, file, "$$$$"); newXSproto(strcpy(buf, "CastGroupSpell"), XS_Raid_CastGroupSpell, file, "$$$$");
newXSproto(strcpy(buf, "GroupCount"), XS_Raid_GroupCount, file, "$$"); newXSproto(strcpy(buf, "GroupCount"), XS_Raid_GroupCount, file, "$$");
newXSproto(strcpy(buf, "RaidCount"), XS_Raid_RaidCount, file, "$"); newXSproto(strcpy(buf, "RaidCount"), XS_Raid_RaidCount, file, "$");
newXSproto(strcpy(buf, "GetGroup"), XS_Raid_GetGroup, file, "$$"); newXSproto(strcpy(buf, "GetGroup"), XS_Raid_GetGroup, file, "$$");
newXSproto(strcpy(buf, "SplitExp"), XS_Raid_SplitExp, file, "$$$"); newXSproto(strcpy(buf, "SplitExp"), XS_Raid_SplitExp, file, "$$$");
newXSproto(strcpy(buf, "GetTotalRaidDamage"), XS_Raid_GetTotalRaidDamage, file, "$$"); newXSproto(strcpy(buf, "GetTotalRaidDamage"), XS_Raid_GetTotalRaidDamage, file, "$$");
newXSproto(strcpy(buf, "SplitMoney"), XS_Raid_SplitMoney, file, "$$$$$"); newXSproto(strcpy(buf, "SplitMoney"), XS_Raid_SplitMoney, file, "$$$$$");
newXSproto(strcpy(buf, "BalanceHP"), XS_Raid_BalanceHP, file, "$$$"); newXSproto(strcpy(buf, "BalanceHP"), XS_Raid_BalanceHP, file, "$$$");
newXSproto(strcpy(buf, "IsLeader"), XS_Raid_IsLeader, file, "$$"); newXSproto(strcpy(buf, "IsLeader"), XS_Raid_IsLeader, file, "$$");
newXSproto(strcpy(buf, "IsGroupLeader"), XS_Raid_IsGroupLeader, file, "$$"); newXSproto(strcpy(buf, "IsGroupLeader"), XS_Raid_IsGroupLeader, file, "$$");
newXSproto(strcpy(buf, "GetHighestLevel"), XS_Raid_GetHighestLevel, file, "$"); newXSproto(strcpy(buf, "GetHighestLevel"), XS_Raid_GetHighestLevel, file, "$");
newXSproto(strcpy(buf, "GetLowestLevel"), XS_Raid_GetLowestLevel, file, "$"); newXSproto(strcpy(buf, "GetLowestLevel"), XS_Raid_GetLowestLevel, file, "$");
newXSproto(strcpy(buf, "GetClientByIndex"), XS_Raid_GetClientByIndex, file, "$$"); newXSproto(strcpy(buf, "GetClientByIndex"), XS_Raid_GetClientByIndex, file, "$$");
newXSproto(strcpy(buf, "TeleportGroup"), XS_Raid_TeleportGroup, file, "$$$$$$$$"); newXSproto(strcpy(buf, "TeleportGroup"), XS_Raid_TeleportGroup, file, "$$$$$$$$");
newXSproto(strcpy(buf, "TeleportRaid"), XS_Raid_TeleportRaid, file, "$$$$$$$"); newXSproto(strcpy(buf, "TeleportRaid"), XS_Raid_TeleportRaid, file, "$$$$$$$");
newXSproto(strcpy(buf, "GetID"), XS_Raid_GetID, file, "$"); newXSproto(strcpy(buf, "GetID"), XS_Raid_GetID, file, "$");
newXSproto(strcpy(buf, "GetMember"), XS_Raid_GetMember, file, "$$"); newXSproto(strcpy(buf, "GetMember"), XS_Raid_GetMember, file, "$$");
XSRETURN_YES; XSRETURN_YES;
} }