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

This commit is contained in:
KimLS 2018-07-02 22:10:13 -07:00
commit d2683022e1
15 changed files with 11065 additions and 12237 deletions

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
utils/scripts/perl-doc-parser.pl Executable file
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;
}

File diff suppressed because it is too large Load Diff

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);
}
void Lua_Client::SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5,
bool attuned) {
void Lua_Client::SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, bool attuned) {
Lua_Safe_Call_Void();
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,
bool attuned, int to_slot) {
void Lua_Client::SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, bool attuned, int to_slot) {
Lua_Safe_Call_Void();
self->SummonItem(item_id, charges, aug1, aug2, aug3, aug4, aug5, 0, attuned, to_slot);
}

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,9 @@
*/
#include "../common/features.h"
#ifdef EMBPERL_XS_CLASSES
#include "../common/global_define.h"
#include "embperl.h"
@ -41,282 +43,270 @@
#endif
XS(XS_Doors_GetDoorDBID); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_GetDoorDBID)
{
XS(XS_Doors_GetDoorDBID) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Doors::GetDoorDBID(THIS)");
{
Doors * THIS;
uint32 RETVAL;
Doors *THIS;
uint32 RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetDoorDBID();
XSprePUSH; PUSHu((UV)RETVAL);
XSprePUSH;
PUSHu((UV) RETVAL);
}
XSRETURN(1);
}
XS(XS_Doors_GetDoorID); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_GetDoorID)
{
XS(XS_Doors_GetDoorID) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Doors::GetDoorID(THIS)");
{
Doors * THIS;
uint32 RETVAL;
Doors *THIS;
uint32 RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetDoorID();
XSprePUSH; PUSHu((UV)RETVAL);
XSprePUSH;
PUSHu((UV) RETVAL);
}
XSRETURN(1);
}
XS(XS_Doors_GetID); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_GetID)
{
XS(XS_Doors_GetID) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Doors::GetID(THIS)");
{
Doors * THIS;
uint16 RETVAL;
Doors *THIS;
uint16 RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetEntityID();
XSprePUSH; PUSHu((UV)RETVAL);
XSprePUSH;
PUSHu((UV) RETVAL);
}
XSRETURN(1);
}
XS(XS_Doors_GetX); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_GetX)
{
XS(XS_Doors_GetX) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Doors::GetX(THIS)");
{
Doors * THIS;
float RETVAL;
Doors *THIS;
float RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetPosition().x;
XSprePUSH; PUSHn((double)RETVAL);
XSprePUSH;
PUSHn((double) RETVAL);
}
XSRETURN(1);
}
XS(XS_Doors_GetY); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_GetY)
{
XS(XS_Doors_GetY) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Doors::GetY(THIS)");
{
Doors * THIS;
float RETVAL;
Doors *THIS;
float RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetPosition().y;
XSprePUSH; PUSHn((double)RETVAL);
XSprePUSH;
PUSHn((double) RETVAL);
}
XSRETURN(1);
}
XS(XS_Doors_GetZ); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_GetZ)
{
XS(XS_Doors_GetZ) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Doors::GetZ(THIS)");
{
Doors * THIS;
float RETVAL;
Doors *THIS;
float RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetPosition().z;
XSprePUSH; PUSHn((double)RETVAL);
XSprePUSH;
PUSHn((double) RETVAL);
}
XSRETURN(1);
}
XS(XS_Doors_GetHeading); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_GetHeading)
{
XS(XS_Doors_GetHeading) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Doors::GetHeading(THIS)");
{
Doors * THIS;
float RETVAL;
Doors *THIS;
float RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetPosition().w;
XSprePUSH; PUSHn((double)RETVAL);
XSprePUSH;
PUSHn((double) RETVAL);
}
XSRETURN(1);
}
XS(XS_Doors_GetOpenType); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_GetOpenType)
{
XS(XS_Doors_GetOpenType) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Doors::GetOpenType(THIS)");
{
Doors * THIS;
uint32 RETVAL;
Doors *THIS;
uint32 RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetOpenType();
XSprePUSH; PUSHu((UV)RETVAL);
XSprePUSH;
PUSHu((UV) RETVAL);
}
XSRETURN(1);
}
XS(XS_Doors_GetLockpick); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_GetLockpick)
{
XS(XS_Doors_GetLockpick) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Doors::GetLockpick(THIS)");
{
Doors * THIS;
uint32 RETVAL;
Doors *THIS;
uint32 RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetLockpick();
XSprePUSH; PUSHu((UV)RETVAL);
XSprePUSH;
PUSHu((UV) RETVAL);
}
XSRETURN(1);
}
XS(XS_Doors_GetKeyItem); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_GetKeyItem)
{
XS(XS_Doors_GetKeyItem) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Doors::GetKeyItem(THIS)");
{
Doors * THIS;
uint32 RETVAL;
Doors *THIS;
uint32 RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetKeyItem();
XSprePUSH; PUSHu((UV)RETVAL);
XSprePUSH;
PUSHu((UV) RETVAL);
}
XSRETURN(1);
}
XS(XS_Doors_GetNoKeyring); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_GetNoKeyring)
{
XS(XS_Doors_GetNoKeyring) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Doors::GetNoKeyring(THIS, type)");
Perl_croak(aTHX_ "Usage: Doors::GetNoKeyring(THIS, uint8 type)");
{
Doors * THIS;
uint8 type = (uint8)SvUV(ST(1));
Doors *THIS;
uint8 type = (uint8) SvUV(ST(1));
if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->GetNoKeyring();
@ -325,76 +315,71 @@ XS(XS_Doors_GetNoKeyring)
}
XS(XS_Doors_GetIncline); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_GetIncline)
{
XS(XS_Doors_GetIncline) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Doors::GetIncline(THIS)");
{
Doors * THIS;
uint32 RETVAL;
Doors *THIS;
uint32 RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetIncline();
XSprePUSH; PUSHu((UV)RETVAL);
XSprePUSH;
PUSHu((UV) RETVAL);
}
XSRETURN(1);
}
XS(XS_Doors_GetSize); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_GetSize)
{
XS(XS_Doors_GetSize) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Doors::GetIncline(THIS)");
{
Doors * THIS;
uint32 RETVAL;
Doors *THIS;
uint32 RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetSize();
XSprePUSH; PUSHu((UV)RETVAL);
XSprePUSH;
PUSHu((UV) RETVAL);
}
XSRETURN(1);
}
XS(XS_Doors_SetOpenType); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_SetOpenType)
{
XS(XS_Doors_SetOpenType) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Doors::SetOpenType(THIS, type)");
Perl_croak(aTHX_ "Usage: Doors::SetOpenType(THIS, uint32 open_type)");
{
Doors * THIS;
uint32 type = (uint32)SvUV(ST(1));
Doors *THIS;
uint32 type = (uint32) SvUV(ST(1));
if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->SetOpenType(type);
@ -403,22 +388,20 @@ XS(XS_Doors_SetOpenType)
}
XS(XS_Doors_SetLockpick); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_SetLockpick)
{
XS(XS_Doors_SetLockpick) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Doors::SetLockpick(THIS, type)");
Perl_croak(aTHX_ "Usage: Doors::SetLockpick(THIS, uint32 lockpick_type)");
{
Doors * THIS;
uint32 type = (uint32)SvUV(ST(1));
Doors *THIS;
uint32 type = (uint32) SvUV(ST(1));
if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->SetLockpick(type);
@ -427,22 +410,20 @@ XS(XS_Doors_SetLockpick)
}
XS(XS_Doors_SetKeyItem); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_SetKeyItem)
{
XS(XS_Doors_SetKeyItem) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Doors::SetKeyItem(THIS, type)");
Perl_croak(aTHX_ "Usage: Doors::SetKeyItem(THIS, uint32 key_item_id)");
{
Doors * THIS;
uint32 type = (uint32)SvUV(ST(1));
Doors *THIS;
uint32 type = (uint32) SvUV(ST(1));
if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->SetKeyItem(type);
@ -451,22 +432,20 @@ XS(XS_Doors_SetKeyItem)
}
XS(XS_Doors_SetNoKeyring); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_SetNoKeyring)
{
XS(XS_Doors_SetNoKeyring) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Doors::SetNoKeyring(THIS, type)");
Perl_croak(aTHX_ "Usage: Doors::SetNoKeyring(THIS, uint8 no_key_ring)");
{
Doors * THIS;
uint8 type = (uint8)SvUV(ST(1));
Doors *THIS;
uint8 type = (uint8) SvUV(ST(1));
if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->SetNoKeyring(type);
@ -475,22 +454,20 @@ XS(XS_Doors_SetNoKeyring)
}
XS(XS_Doors_SetIncline); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_SetIncline)
{
XS(XS_Doors_SetIncline) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Doors::SetIncline(THIS, type)");
Perl_croak(aTHX_ "Usage: Doors::SetIncline(THIS, uint32 incline)");
{
Doors * THIS;
uint32 type = (uint32)SvUV(ST(1));
Doors *THIS;
uint32 type = (uint32) SvUV(ST(1));
if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->SetIncline(type);
@ -499,22 +476,20 @@ XS(XS_Doors_SetIncline)
}
XS(XS_Doors_SetSize); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_SetSize)
{
XS(XS_Doors_SetSize) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Doors::SetSize(THIS, size)");
Perl_croak(aTHX_ "Usage: Doors::SetSize(THIS, uint32 size)");
{
Doors * THIS;
uint32 type = (uint32)SvUV(ST(1));
Doors *THIS;
uint32 type = (uint32) SvUV(ST(1));
if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->SetSize(type);
@ -523,24 +498,22 @@ XS(XS_Doors_SetSize)
}
XS(XS_Doors_SetLocation); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_SetLocation)
{
XS(XS_Doors_SetLocation) {
dXSARGS;
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;
float x = (float)SvNV(ST(1));
float y = (float)SvNV(ST(2));
float z = (float)SvNV(ST(3));
Doors *THIS;
float x = (float) SvNV(ST(1));
float y = (float) SvNV(ST(2));
float z = (float) SvNV(ST(3));
if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
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)
{
XS(XS_Doors_SetX) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Doors::SetX(THIS, XPos)");
Perl_croak(aTHX_ "Usage: Doors::SetX(THIS, float x)");
{
Doors * THIS;
float x = (float)SvNV(ST(1));
Doors *THIS;
float x = (float) SvNV(ST(1));
if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
auto position = THIS->GetPosition();
position.x = x;
auto position = THIS->GetPosition();
position.x = x;
THIS->SetPosition(position);
}
XSRETURN_EMPTY;
}
XS(XS_Doors_SetY); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_SetY)
{
XS(XS_Doors_SetY) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Doors::SetY(THIS, YPos)");
Perl_croak(aTHX_ "Usage: Doors::SetY(THIS, float y)");
{
Doors * THIS;
float y = (float)SvNV(ST(1));
Doors *THIS;
float y = (float) SvNV(ST(1));
if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
auto position = THIS->GetPosition();
position.y = y;
auto position = THIS->GetPosition();
position.y = y;
THIS->SetPosition(position);
}
XSRETURN_EMPTY;
}
XS(XS_Doors_SetZ); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_SetZ)
{
XS(XS_Doors_SetZ) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Doors::SetZ(THIS, ZPos)");
Perl_croak(aTHX_ "Usage: Doors::SetZ(THIS, float z)");
{
Doors * THIS;
float z = (float)SvNV(ST(1));
Doors *THIS;
float z = (float) SvNV(ST(1));
if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
auto position = THIS->GetPosition();
position.z = z;
position.z = z;
THIS->SetPosition(position);
}
XSRETURN_EMPTY;
}
XS(XS_Doors_SetHeading); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_SetHeading)
{
XS(XS_Doors_SetHeading) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Doors::SetHeading(THIS, heading)");
Perl_croak(aTHX_ "Usage: Doors::SetHeading(THIS, float heading)");
{
Doors * THIS;
float heading = (float)SvNV(ST(1));
Doors *THIS;
float heading = (float) SvNV(ST(1));
if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
auto position = THIS->GetPosition();
position.w = heading;
position.w = heading;
THIS->SetPosition(position);
}
XSRETURN_EMPTY;
}
XS(XS_Doors_SetModelName); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_SetModelName)
{
XS(XS_Doors_SetModelName) {
dXSARGS;
if (items < 1 || items > 2)
Perl_croak(aTHX_ "Usage: Doors::SetModelName(THIS, name)");
Perl_croak(aTHX_ "Usage: Doors::SetModelName(THIS, string name)");
{
Doors * THIS;
char * name = nullptr;
Doors *THIS;
char *name = nullptr;
if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr)
if (THIS == nullptr)
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);
}
XSRETURN_EMPTY;
}
XS(XS_Doors_GetModelName); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_GetModelName)
{
XS(XS_Doors_GetModelName) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Doors::GetModelName(THIS)");
{
Doors * THIS;
Const_char * RETVAL;
Doors *THIS;
Const_char *RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetDoorName();
sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
sv_setpv(TARG, RETVAL);
XSprePUSH;
PUSHTARG;
}
XSRETURN(1);
}
XS(XS_Doors_CreateDatabaseEntry); /* prototype to pass -Wmissing-prototypes */
XS(XS_Doors_CreateDatabaseEntry)
{
XS(XS_Doors_CreateDatabaseEntry) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Doors::InsertDoor(THIS)");
{
Doors * THIS;
Doors *THIS;
if (sv_derived_from(ST(0), "Doors")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Doors *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Doors *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Doors");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->CreateDatabaseEntry();
@ -726,52 +687,50 @@ XS(XS_Doors_CreateDatabaseEntry)
}
#ifdef __cplusplus
extern "C"
#endif
XS(boot_Doors); /* prototype to pass -Wmissing-prototypes */
XS(boot_Doors)
{
XS(boot_Doors) {
dXSARGS;
char file[256];
strncpy(file, __FILE__, 256);
file[255] = 0;
if(items != 1)
if (items != 1)
fprintf(stderr, "boot_quest does not take any arguments.");
char buf[128];
//add the strcpy stuff to get rid of const warnings....
XS_VERSION_BOOTCHECK ;
newXSproto(strcpy(buf, "GetID"),XS_Doors_GetID, file, "$");
newXSproto(strcpy(buf, "SetModelName"),XS_Doors_SetModelName, file, "$$");
newXSproto(strcpy(buf, "GetModelName"),XS_Doors_GetModelName, file, "$");
newXSproto(strcpy(buf, "GetX"),XS_Doors_GetX, file, "$");
newXSproto(strcpy(buf, "GetY"),XS_Doors_GetY, file, "$");
newXSproto(strcpy(buf, "GetZ"),XS_Doors_GetZ, file, "$");
newXSproto(strcpy(buf, "GetHeading"),XS_Doors_GetHeading, file, "$");
newXSproto(strcpy(buf, "SetX"),XS_Doors_SetX, file, "$$");
newXSproto(strcpy(buf, "SetY"),XS_Doors_SetY, file, "$$");
newXSproto(strcpy(buf, "SetZ"),XS_Doors_SetZ, file, "$$");
newXSproto(strcpy(buf, "SetHeading"),XS_Doors_SetHeading, file, "$$");
newXSproto(strcpy(buf, "SetLocation"),XS_Doors_SetLocation, file, "$$$$");
newXSproto(strcpy(buf, "GetDoorDBID"),XS_Doors_GetDoorDBID, file, "$");
newXSproto(strcpy(buf, "GetDoorID"),XS_Doors_GetDoorID, file, "$");
newXSproto(strcpy(buf, "SetSize"),XS_Doors_SetSize, file, "$$");
newXSproto(strcpy(buf, "GetSize"),XS_Doors_GetSize, file, "$");
newXSproto(strcpy(buf, "SetIncline"),XS_Doors_SetIncline, file, "$$");
newXSproto(strcpy(buf, "GetIncline"),XS_Doors_GetIncline, file, "$");
newXSproto(strcpy(buf, "SetOpenType"),XS_Doors_SetOpenType, file, "$$");
newXSproto(strcpy(buf, "GetOpenType"),XS_Doors_GetOpenType, file, "$");
newXSproto(strcpy(buf, "SetLockPick"),XS_Doors_SetLockpick, file, "$$");
newXSproto(strcpy(buf, "GetLockPick"),XS_Doors_GetLockpick, file, "$");
newXSproto(strcpy(buf, "SetKeyItem"),XS_Doors_SetKeyItem, file, "$$");
newXSproto(strcpy(buf, "GetKeyItem"),XS_Doors_GetKeyItem, file, "$");
newXSproto(strcpy(buf, "SetNoKeyring"),XS_Doors_SetNoKeyring, file, "$$");
newXSproto(strcpy(buf, "GetNoKeyring"),XS_Doors_GetNoKeyring, file, "$");
newXSproto(strcpy(buf, "CreateDatabaseEntry"),XS_Doors_CreateDatabaseEntry, file, "$");
XS_VERSION_BOOTCHECK;
newXSproto(strcpy(buf, "GetID"), XS_Doors_GetID, file, "$");
newXSproto(strcpy(buf, "SetModelName"), XS_Doors_SetModelName, file, "$$");
newXSproto(strcpy(buf, "GetModelName"), XS_Doors_GetModelName, file, "$");
newXSproto(strcpy(buf, "GetX"), XS_Doors_GetX, file, "$");
newXSproto(strcpy(buf, "GetY"), XS_Doors_GetY, file, "$");
newXSproto(strcpy(buf, "GetZ"), XS_Doors_GetZ, file, "$");
newXSproto(strcpy(buf, "GetHeading"), XS_Doors_GetHeading, file, "$");
newXSproto(strcpy(buf, "SetX"), XS_Doors_SetX, file, "$$");
newXSproto(strcpy(buf, "SetY"), XS_Doors_SetY, file, "$$");
newXSproto(strcpy(buf, "SetZ"), XS_Doors_SetZ, file, "$$");
newXSproto(strcpy(buf, "SetHeading"), XS_Doors_SetHeading, file, "$$");
newXSproto(strcpy(buf, "SetLocation"), XS_Doors_SetLocation, file, "$$$$");
newXSproto(strcpy(buf, "GetDoorDBID"), XS_Doors_GetDoorDBID, file, "$");
newXSproto(strcpy(buf, "GetDoorID"), XS_Doors_GetDoorID, file, "$");
newXSproto(strcpy(buf, "SetSize"), XS_Doors_SetSize, file, "$$");
newXSproto(strcpy(buf, "GetSize"), XS_Doors_GetSize, file, "$");
newXSproto(strcpy(buf, "SetIncline"), XS_Doors_SetIncline, file, "$$");
newXSproto(strcpy(buf, "GetIncline"), XS_Doors_GetIncline, file, "$");
newXSproto(strcpy(buf, "SetOpenType"), XS_Doors_SetOpenType, file, "$$");
newXSproto(strcpy(buf, "GetOpenType"), XS_Doors_GetOpenType, file, "$");
newXSproto(strcpy(buf, "SetLockPick"), XS_Doors_SetLockpick, file, "$$");
newXSproto(strcpy(buf, "GetLockPick"), XS_Doors_GetLockpick, file, "$");
newXSproto(strcpy(buf, "SetKeyItem"), XS_Doors_SetKeyItem, file, "$$");
newXSproto(strcpy(buf, "GetKeyItem"), XS_Doors_GetKeyItem, file, "$");
newXSproto(strcpy(buf, "SetNoKeyring"), XS_Doors_SetNoKeyring, file, "$$");
newXSproto(strcpy(buf, "GetNoKeyring"), XS_Doors_GetNoKeyring, file, "$");
newXSproto(strcpy(buf, "CreateDatabaseEntry"), XS_Doors_CreateDatabaseEntry, file, "$");
XSRETURN_YES;
}
#endif //EMBPERL_XS_CLASSES

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,9 @@
*/
#include "../common/features.h"
#ifdef EMBPERL_XS_CLASSES
#include "../common/global_define.h"
#include "embperl.h"
@ -42,21 +44,19 @@
XS(XS_Group_DisbandGroup); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_DisbandGroup)
{
XS(XS_Group_DisbandGroup) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Group::DisbandGroup(THIS)");
{
Group * THIS;
Group *THIS;
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->DisbandGroup();
@ -65,32 +65,29 @@ XS(XS_Group_DisbandGroup)
}
XS(XS_Group_IsGroupMember); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_IsGroupMember)
{
XS(XS_Group_IsGroupMember) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Group::IsGroupMember(THIS, client)");
{
Group * THIS;
bool RETVAL;
Mob* client;
Group *THIS;
bool RETVAL;
Mob *client;
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1)));
client = INT2PTR(Mob *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(1)));
client = INT2PTR(Mob *, tmp);
} else
Perl_croak(aTHX_ "client is not of type Mob");
if(client == nullptr)
if (client == nullptr)
Perl_croak(aTHX_ "client is nullptr, avoiding crash.");
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)
{
XS(XS_Group_CastGroupSpell) {
dXSARGS;
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;
Mob* caster;
uint16 spellid = (uint16)SvUV(ST(2));
Group *THIS;
Mob *caster;
uint16 spellid = (uint16) SvUV(ST(2));
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1)));
caster = INT2PTR(Mob *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(1)));
caster = INT2PTR(Mob *, tmp);
} else
Perl_croak(aTHX_ "caster is not of type Mob");
if(caster == nullptr)
if (caster == nullptr)
Perl_croak(aTHX_ "caster is nullptr, avoiding crash.");
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)
{
XS(XS_Group_SplitExp) {
dXSARGS;
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;
uint32 exp = (uint32)SvUV(ST(1));
Mob* other;
Group *THIS;
uint32 exp = (uint32) SvUV(ST(1));
Mob *other;
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(2), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(2)));
other = INT2PTR(Mob *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(2)));
other = INT2PTR(Mob *, tmp);
} else
Perl_croak(aTHX_ "other is not of type Mob");
if(other == nullptr)
if (other == nullptr)
Perl_croak(aTHX_ "other is nullptr, avoiding crash.");
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)
{
XS(XS_Group_GroupMessage) {
dXSARGS;
if ((items != 3) && (items != 4)) // the 3 item version is kept for backwards compatability
Perl_croak(aTHX_ "Usage: Group::GroupMessage(THIS, sender, language, message)");
if ((items != 3) && (items != 4)) // the 3 item version is kept for backwards compatability
Perl_croak(aTHX_ "Usage: Group::GroupMessage(THIS, Mob* sender, uint8 language, string message)");
{
Group * THIS;
Mob* sender;
uint8 language;
char* message;
Group *THIS;
Mob *sender;
uint8 language;
char *message;
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1)));
sender = INT2PTR(Mob *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(1)));
sender = INT2PTR(Mob *, tmp);
} else
Perl_croak(aTHX_ "sender is not of type Mob");
if(sender == nullptr)
if (sender == nullptr)
Perl_croak(aTHX_ "sender is nullptr, avoiding crash.");
if (items == 4) {
language = (uint8)SvUV(ST(2));
language = (uint8) SvUV(ST(2));
if ((language >= MAX_PP_LANGUAGE) || (language < 0))
language = 0;
message = (char *)SvPV_nolen(ST(3));
message = (char *) SvPV_nolen(ST(3));
THIS->GroupMessage(sender, language, 100, message);
}
else { // if no language is specificed, send it in common
message = (char *)SvPV_nolen(ST(2));
THIS->GroupMessage(sender,0, 100, message);
} else { // if no language is specificed, send it in common
message = (char *) SvPV_nolen(ST(2));
THIS->GroupMessage(sender, 0, 100, message);
}
}
XSRETURN_EMPTY;
}
XS(XS_Group_GetTotalGroupDamage); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_GetTotalGroupDamage)
{
XS(XS_Group_GetTotalGroupDamage) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Group::GetTotalGroupDamage(THIS, other)");
Perl_croak(aTHX_ "Usage: Group::GetTotalGroupDamage(THIS, Mob* other)");
{
Group * THIS;
uint32 RETVAL;
Group *THIS;
uint32 RETVAL;
dXSTARG;
Mob* other;
Mob *other;
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1)));
other = INT2PTR(Mob *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(1)));
other = INT2PTR(Mob *, tmp);
} else
Perl_croak(aTHX_ "other is not of type Mob");
if(other == nullptr)
if (other == nullptr)
Perl_croak(aTHX_ "other is nullptr, avoiding crash.");
RETVAL = THIS->GetTotalGroupDamage(other);
XSprePUSH; PUSHu((UV)RETVAL);
XSprePUSH;
PUSHu((UV) RETVAL);
}
XSRETURN(1);
}
XS(XS_Group_SplitMoney); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_SplitMoney)
{
XS(XS_Group_SplitMoney) {
dXSARGS;
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;
uint32 copper = (uint32)SvUV(ST(1));
uint32 silver = (uint32)SvUV(ST(2));
uint32 gold = (uint32)SvUV(ST(3));
uint32 platinum = (uint32)SvUV(ST(4));
Group *THIS;
uint32 copper = (uint32) SvUV(ST(1));
uint32 silver = (uint32) SvUV(ST(2));
uint32 gold = (uint32) SvUV(ST(3));
uint32 platinum = (uint32) SvUV(ST(4));
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
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)
{
XS(XS_Group_SetLeader) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Group::SetLeader(THIS, newleader)");
Perl_croak(aTHX_ "Usage: Group::SetLeader(THIS, Mob* new_leader)");
{
Group * THIS;
Mob* newleader;
Group *THIS;
Mob *newleader;
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1)));
newleader = INT2PTR(Mob *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(1)));
newleader = INT2PTR(Mob *, tmp);
} else
Perl_croak(aTHX_ "newleader is not of type Mob");
if(newleader == nullptr)
if (newleader == nullptr)
Perl_croak(aTHX_ "newleader is nullptr, avoiding crash.");
THIS->SetLeader(newleader);
@ -310,83 +290,78 @@ XS(XS_Group_SetLeader)
}
XS(XS_Group_GetLeader); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_GetLeader)
{
XS(XS_Group_GetLeader) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Group::GetLeader(THIS)");
{
Group * THIS;
Mob * RETVAL;
Group *THIS;
Mob *RETVAL;
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetLeader();
ST(0) = sv_newmortal();
sv_setref_pv(ST(0), "Mob", (void*)RETVAL);
sv_setref_pv(ST(0), "Mob", (void *) RETVAL);
}
XSRETURN(1);
}
XS(XS_Group_GetLeaderName); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_GetLeaderName)
{
XS(XS_Group_GetLeaderName) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Group::GetLeaderName(THIS)");
{
Group * THIS;
const char * RETVAL;
Group *THIS;
const char *RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetLeaderName();
sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
sv_setpv(TARG, RETVAL);
XSprePUSH;
PUSHTARG;
}
XSRETURN(1);
}
XS(XS_Group_SendHPPacketsTo); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_SendHPPacketsTo)
{
XS(XS_Group_SendHPPacketsTo) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Group::SendHPPacketsTo(THIS, newmember)");
Perl_croak(aTHX_ "Usage: Group::SendHPPacketsTo(THIS, Mob* new_member)");
{
Group * THIS;
Mob* newmember;
Group *THIS;
Mob *newmember;
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1)));
newmember = INT2PTR(Mob *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(1)));
newmember = INT2PTR(Mob *, tmp);
} else
Perl_croak(aTHX_ "newmember is not of type Mob");
if(newmember == nullptr)
if (newmember == nullptr)
Perl_croak(aTHX_ "newmember is nullptr, avoiding crash.");
THIS->SendHPManaEndPacketsTo(newmember);
@ -395,31 +370,28 @@ XS(XS_Group_SendHPPacketsTo)
}
XS(XS_Group_SendHPPacketsFrom); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_SendHPPacketsFrom)
{
XS(XS_Group_SendHPPacketsFrom) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Group::SendHPPacketsFrom(THIS, newmember)");
Perl_croak(aTHX_ "Usage: Group::SendHPPacketsFrom(THIS, Mob* new_member)");
{
Group * THIS;
Mob* newmember;
Group *THIS;
Mob *newmember;
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1)));
newmember = INT2PTR(Mob *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(1)));
newmember = INT2PTR(Mob *, tmp);
} else
Perl_croak(aTHX_ "newmember is not of type Mob");
if(newmember == nullptr)
if (newmember == nullptr)
Perl_croak(aTHX_ "newmember is nullptr, avoiding crash.");
THIS->SendHPPacketsFrom(newmember);
@ -428,32 +400,29 @@ XS(XS_Group_SendHPPacketsFrom)
}
XS(XS_Group_IsLeader); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_IsLeader)
{
XS(XS_Group_IsLeader) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Group::IsLeader(THIS, leadertest)");
Perl_croak(aTHX_ "Usage: Group::IsLeader(THIS, Mob* target)");
{
Group * THIS;
bool RETVAL;
Mob* leadertest;
Group *THIS;
bool RETVAL;
Mob *leadertest;
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1)));
leadertest = INT2PTR(Mob *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(1)));
leadertest = INT2PTR(Mob *, tmp);
} else
Perl_croak(aTHX_ "leadertest is not of type Mob");
if(leadertest == nullptr)
if (leadertest == nullptr)
Perl_croak(aTHX_ "leadertest is nullptr, avoiding crash.");
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)
{
XS(XS_Group_GroupCount) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Group::GroupCount(THIS)");
{
Group * THIS;
uint8 RETVAL;
Group *THIS;
uint8 RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GroupCount();
XSprePUSH; PUSHu((UV)RETVAL);
XSprePUSH;
PUSHu((UV) RETVAL);
}
XSRETURN(1);
}
XS(XS_Group_GetHighestLevel); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_GetHighestLevel)
{
XS(XS_Group_GetHighestLevel) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Group::GetHighestLevel(THIS)");
{
Group * THIS;
uint32 RETVAL;
Group *THIS;
uint32 RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetHighestLevel();
XSprePUSH; PUSHu((UV)RETVAL);
XSprePUSH;
PUSHu((UV) RETVAL);
}
XSRETURN(1);
}
XS(XS_Group_TeleportGroup); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_TeleportGroup)
{
XS(XS_Group_TeleportGroup) {
dXSARGS;
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;
Mob* sender;
uint32 zoneID = (uint32)SvUV(ST(2));
float x = (float)SvNV(ST(3));
float y = (float)SvNV(ST(4));
float z = (float)SvNV(ST(5));
float heading = (float)SvNV(ST(6));
Group *THIS;
Mob *sender;
uint32 zoneID = (uint32) SvUV(ST(2));
float x = (float) SvNV(ST(3));
float y = (float) SvNV(ST(4));
float z = (float) SvNV(ST(5));
float heading = (float) SvNV(ST(6));
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1)));
sender = INT2PTR(Mob *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(1)));
sender = INT2PTR(Mob *, tmp);
} else
Perl_croak(aTHX_ "sender is not of type Mob");
if(sender == nullptr)
if (sender == nullptr)
Perl_croak(aTHX_ "sender is nullptr, avoiding crash.");
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)
{
XS(XS_Group_GetID) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Group::GetID(THIS)");
{
Group * THIS;
uint32 RETVAL;
Group *THIS;
uint32 RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetID();
XSprePUSH; PUSHu((UV)RETVAL);
XSprePUSH;
PUSHu((UV) RETVAL);
}
XSRETURN(1);
}
XS(XS_Group_GetMember);
XS(XS_Group_GetMember)
{
XS(XS_Group_GetMember) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Group::GetMember(THIS, index)");
Perl_croak(aTHX_ "Usage: Group::GetMember(THIS, int group_index)");
{
Group * THIS;
Mob* member;
Client* RETVAL = nullptr;
Group *THIS;
Mob *member;
Client *RETVAL = nullptr;
dXSTARG;
if (sv_derived_from(ST(0), "Group")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Group *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Group *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Group");
if(THIS == nullptr)
if (THIS == nullptr)
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)
RETVAL = nullptr;
else {
member = THIS->members[index];
member = THIS->members[index];
if (member != nullptr)
RETVAL = member->CastToClient();
}
ST(0) = sv_newmortal();
sv_setref_pv(ST(0), "Client", (void*)RETVAL);
ST(0) = sv_newmortal();
sv_setref_pv(ST(0), "Client", (void *) RETVAL);
}
XSRETURN(1);
}
@ -619,39 +581,38 @@ XS(XS_Group_GetMember)
extern "C"
#endif
XS(boot_Group); /* prototype to pass -Wmissing-prototypes */
XS(boot_Group)
{
XS(boot_Group) {
dXSARGS;
char file[256];
strncpy(file, __FILE__, 256);
file[255] = 0;
if(items != 1)
if (items != 1)
fprintf(stderr, "boot_quest does not take any arguments.");
char buf[128];
//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, "IsGroupMember"), XS_Group_IsGroupMember, file, "$$");
newXSproto(strcpy(buf, "CastGroupSpell"), XS_Group_CastGroupSpell, file, "$$$");
newXSproto(strcpy(buf, "SplitExp"), XS_Group_SplitExp, file, "$$$");
newXSproto(strcpy(buf, "GroupMessage"), XS_Group_GroupMessage, file, "$$$");
newXSproto(strcpy(buf, "GetTotalGroupDamage"), XS_Group_GetTotalGroupDamage, file, "$$");
newXSproto(strcpy(buf, "SplitMoney"), XS_Group_SplitMoney, file, "$$$$$");
newXSproto(strcpy(buf, "SetLeader"), XS_Group_SetLeader, file, "$$");
newXSproto(strcpy(buf, "GetLeader"), XS_Group_GetLeader, file, "$");
newXSproto(strcpy(buf, "GetLeaderName"), XS_Group_GetLeaderName, file, "$");
newXSproto(strcpy(buf, "SendHPPacketsTo"), XS_Group_SendHPPacketsTo, file, "$$");
newXSproto(strcpy(buf, "SendHPPacketsFrom"), XS_Group_SendHPPacketsFrom, file, "$$");
newXSproto(strcpy(buf, "IsLeader"), XS_Group_IsLeader, file, "$$");
newXSproto(strcpy(buf, "GroupCount"), XS_Group_GroupCount, file, "$");
newXSproto(strcpy(buf, "GetHighestLevel"), XS_Group_GetHighestLevel, file, "$");
newXSproto(strcpy(buf, "TeleportGroup"), XS_Group_TeleportGroup, file, "$$$$$$$");
newXSproto(strcpy(buf, "GetID"), XS_Group_GetID, file, "$");
newXSproto(strcpy(buf, "GetMember"), XS_Group_GetMember, file, "$$");
newXSproto(strcpy(buf, "DisbandGroup"), XS_Group_DisbandGroup, file, "$");
newXSproto(strcpy(buf, "IsGroupMember"), XS_Group_IsGroupMember, file, "$$");
newXSproto(strcpy(buf, "CastGroupSpell"), XS_Group_CastGroupSpell, file, "$$$");
newXSproto(strcpy(buf, "SplitExp"), XS_Group_SplitExp, file, "$$$");
newXSproto(strcpy(buf, "GroupMessage"), XS_Group_GroupMessage, file, "$$$");
newXSproto(strcpy(buf, "GetTotalGroupDamage"), XS_Group_GetTotalGroupDamage, file, "$$");
newXSproto(strcpy(buf, "SplitMoney"), XS_Group_SplitMoney, file, "$$$$$");
newXSproto(strcpy(buf, "SetLeader"), XS_Group_SetLeader, file, "$$");
newXSproto(strcpy(buf, "GetLeader"), XS_Group_GetLeader, file, "$");
newXSproto(strcpy(buf, "GetLeaderName"), XS_Group_GetLeaderName, file, "$");
newXSproto(strcpy(buf, "SendHPPacketsTo"), XS_Group_SendHPPacketsTo, file, "$$");
newXSproto(strcpy(buf, "SendHPPacketsFrom"), XS_Group_SendHPPacketsFrom, file, "$$");
newXSproto(strcpy(buf, "IsLeader"), XS_Group_IsLeader, file, "$$");
newXSproto(strcpy(buf, "GroupCount"), XS_Group_GroupCount, file, "$");
newXSproto(strcpy(buf, "GetHighestLevel"), XS_Group_GetHighestLevel, file, "$");
newXSproto(strcpy(buf, "TeleportGroup"), XS_Group_TeleportGroup, file, "$$$$$$$");
newXSproto(strcpy(buf, "GetID"), XS_Group_GetID, file, "$");
newXSproto(strcpy(buf, "GetMember"), XS_Group_GetMember, file, "$$");
XSRETURN_YES;
}

View File

@ -18,7 +18,9 @@
#include "../common/features.h"
#include "client.h"
#ifdef EMBPERL_XS_CLASSES
#include "../common/global_define.h"
#include "embperl.h"
@ -29,84 +31,80 @@
#include "../common/linked_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
#endif
XS(XS_HateEntry_GetEnt); /* prototype to pass -Wmissing-prototypes */
XS(XS_HateEntry_GetEnt)
{
XS(XS_HateEntry_GetEnt) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: HateEntry::GetData(THIS)");
{
struct_HateList * THIS;
Mob * RETVAL;
struct_HateList *THIS;
Mob *RETVAL;
if (sv_derived_from(ST(0), "HateEntry")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(struct_HateList *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(struct_HateList *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type tHateEntry");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->entity_on_hatelist;
ST(0) = sv_newmortal();
sv_setref_pv(ST(0), "Mob", (void*)RETVAL);
sv_setref_pv(ST(0), "Mob", (void *) RETVAL);
}
XSRETURN(1);
}
XS(XS_HateEntry_GetHate); /* prototype to pass -Wmissing-prototypes */
XS(XS_HateEntry_GetHate)
{
XS(XS_HateEntry_GetHate) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: HateEntry::GetHate(THIS)");
{
struct_HateList * THIS;
struct_HateList *THIS;
int32 RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "HateEntry")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(struct_HateList *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(struct_HateList *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type tHateEntry");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->stored_hate_amount;
XSprePUSH; PUSHi((IV)RETVAL);
XSprePUSH;
PUSHi((IV) RETVAL);
}
XSRETURN(1);
}
XS(XS_HateEntry_GetDamage); /* prototype to pass -Wmissing-prototypes */
XS(XS_HateEntry_GetDamage)
{
XS(XS_HateEntry_GetDamage) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: HateEntry::GetDamage(THIS)");
{
struct_HateList * THIS;
struct_HateList *THIS;
int32 RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "HateEntry")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(struct_HateList *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(struct_HateList *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type tHateEntry");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->hatelist_damage;
XSprePUSH; PUSHi((IV)RETVAL);
XSprePUSH;
PUSHi((IV) RETVAL);
}
XSRETURN(1);
}
@ -116,24 +114,23 @@ extern "C"
#endif
XS(boot_HateEntry);
XS(boot_HateEntry)
{
XS(boot_HateEntry) {
dXSARGS;
char file[256];
strncpy(file, __FILE__, 256);
file[255] = 0;
if(items != 1)
if (items != 1)
fprintf(stderr, "boot_quest does not take any arguments.");
char buf[128];
//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, "GetDamage"), XS_HateEntry_GetDamage, file, "$");
newXSproto(strcpy(buf, "GetHate"), XS_HateEntry_GetHate, file, "$");
newXSproto(strcpy(buf, "GetEnt"), XS_HateEntry_GetEnt, file, "$");
newXSproto(strcpy(buf, "GetDamage"), XS_HateEntry_GetDamage, file, "$");
newXSproto(strcpy(buf, "GetHate"), XS_HateEntry_GetHate, file, "$");
XSRETURN_YES;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -18,7 +18,9 @@
#include "../common/features.h"
#include "client.h"
#ifdef EMBPERL_XS_CLASSES
#include "../common/global_define.h"
#include "embperl.h"
@ -28,7 +30,7 @@
#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
#endif
@ -38,76 +40,73 @@ XS(XS_QuestItem_GetName) {
if (items != 1)
Perl_croak(aTHX_ "Usage: QuestItem::GetName(THIS)");
{
EQEmu::ItemInstance * THIS;
Const_char * RETVAL;
EQEmu::ItemInstance *THIS;
Const_char *RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "QuestItem")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetItem()->Name;
sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
sv_setpv(TARG, RETVAL);
XSprePUSH;
PUSHTARG;
}
XSRETURN(1);
}
XS(XS_QuestItem_SetScale);
XS(XS_QuestItem_SetScale)
{
XS(XS_QuestItem_SetScale) {
dXSARGS;
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;
float Mult;
EQEmu::ItemInstance *THIS;
float Mult;
if (sv_derived_from(ST(0), "QuestItem")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
Mult = (float)SvNV(ST(1));
Mult = (float) SvNV(ST(1));
if(THIS->IsScaling()) {
THIS->SetExp((int)(Mult*10000+.5));
if (THIS->IsScaling()) {
THIS->SetExp((int) (Mult * 10000 + .5));
}
}
XSRETURN_EMPTY;
}
XS(XS_QuestItem_ItemSay);
XS(XS_QuestItem_ItemSay)
{
XS(XS_QuestItem_ItemSay) {
dXSARGS;
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;
Const_char* text;
int lang = 0;
EQEmu::ItemInstance *THIS;
Const_char *text;
int lang = 0;
if (sv_derived_from(ST(0), "QuestItem")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
text = SvPV_nolen(ST(1));
if(items == 3)
lang = (int)SvUV(ST(2));
text = SvPV_nolen(ST(1));
if (items == 3)
lang = (int) SvUV(ST(2));
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)
{
XS(XS_QuestItem_IsType) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: QuestItem::IsType(THIS, type)");
{
EQEmu::ItemInstance* THIS;
bool RETVAL;
uint32 type = (int32)SvIV(ST(1));
EQEmu::ItemInstance *THIS;
bool RETVAL;
uint32 type = (int32) SvIV(ST(1));
if (sv_derived_from(ST(0), "QuestItem")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->IsType((EQEmu::item::ItemClass)type);
ST(0) = boolSV(RETVAL);
RETVAL = THIS->IsType((EQEmu::item::ItemClass) type);
ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0));
}
XSRETURN(1);
}
XS(XS_QuestItem_IsAttuned); /* prototype to pass -Wmissing-prototypes */
XS(XS_QuestItem_IsAttuned)
{
XS(XS_QuestItem_IsAttuned) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: QuestItem::IsAttuned(THIS)");
{
EQEmu::ItemInstance* THIS;
bool RETVAL;
EQEmu::ItemInstance *THIS;
bool RETVAL;
if (sv_derived_from(ST(0), "QuestItem")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->IsAttuned();
@ -168,80 +163,76 @@ XS(XS_QuestItem_IsAttuned)
}
XS(XS_QuestItem_GetCharges); /* prototype to pass -Wmissing-prototypes */
XS(XS_QuestItem_GetCharges)
{
XS(XS_QuestItem_GetCharges) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: QuestItem::GetCharges(THIS)");
{
EQEmu::ItemInstance* THIS;
int16 RETVAL;
EQEmu::ItemInstance *THIS;
int16 RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "QuestItem")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetCharges();
XSprePUSH; PUSHi((IV)RETVAL);
XSprePUSH;
PUSHi((IV) RETVAL);
}
XSRETURN(1);
}
XS(XS_QuestItem_GetAugment); /* prototype to pass -Wmissing-prototypes */
XS(XS_QuestItem_GetAugment)
{
XS(XS_QuestItem_GetAugment) {
dXSARGS;
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;
int16 slot_id = (int16)SvIV(ST(1));
EQEmu::ItemInstance* RETVAL;
EQEmu::ItemInstance *THIS;
int16 slot_id = (int16) SvIV(ST(1));
EQEmu::ItemInstance *RETVAL;
if (sv_derived_from(ST(0), "QuestItem")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetAugment(slot_id);
ST(0) = sv_newmortal();
sv_setref_pv(ST(0), "QuestItem", (void*)RETVAL);
sv_setref_pv(ST(0), "QuestItem", (void *) RETVAL);
}
XSRETURN(1);
}
XS(XS_QuestItem_GetID); /* prototype to pass -Wmissing-prototypes */
XS(XS_QuestItem_GetID)
{
XS(XS_QuestItem_GetID) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: QuestItem::GetID(THIS)");
{
EQEmu::ItemInstance* THIS;
uint32 RETVAL;
EQEmu::ItemInstance *THIS;
uint32 RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "QuestItem")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(EQEmu::ItemInstance *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetItem()->ID;
XSprePUSH; PUSHi((IV)RETVAL);
XSprePUSH;
PUSHi((IV) RETVAL);
}
XSRETURN(1);
}
@ -251,29 +242,28 @@ extern "C"
#endif
XS(boot_QuestItem);
XS(boot_QuestItem)
{
XS(boot_QuestItem) {
dXSARGS;
char file[256];
strncpy(file, __FILE__, 256);
file[255] = 0;
if(items != 1)
if (items != 1)
fprintf(stderr, "boot_quest does not take any arguments.");
char buf[128];
//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, "SetScale"), XS_QuestItem_SetScale, file, "$");
newXSproto(strcpy(buf, "ItemSay"), XS_QuestItem_ItemSay, file, "$");
newXSproto(strcpy(buf, "IsType"), XS_QuestItem_IsType, file, "$$");
newXSproto(strcpy(buf, "IsAttuned"), XS_QuestItem_IsAttuned, file, "$");
newXSproto(strcpy(buf, "GetCharges"), XS_QuestItem_GetCharges, file, "$");
newXSproto(strcpy(buf, "GetAugment"), XS_QuestItem_GetAugment, file, "$$");
newXSproto(strcpy(buf, "GetID"), XS_QuestItem_GetID, file, "$");
newXSproto(strcpy(buf, "GetName"), XS_QuestItem_GetName, file, "$");
newXSproto(strcpy(buf, "SetScale"), XS_QuestItem_SetScale, file, "$");
newXSproto(strcpy(buf, "ItemSay"), XS_QuestItem_ItemSay, file, "$");
newXSproto(strcpy(buf, "IsType"), XS_QuestItem_IsType, file, "$$");
newXSproto(strcpy(buf, "IsAttuned"), XS_QuestItem_IsAttuned, file, "$");
newXSproto(strcpy(buf, "GetCharges"), XS_QuestItem_GetCharges, file, "$");
newXSproto(strcpy(buf, "GetAugment"), XS_QuestItem_GetAugment, file, "$$");
newXSproto(strcpy(buf, "GetID"), XS_QuestItem_GetID, file, "$");
XSRETURN_YES;
}

View File

@ -26,7 +26,9 @@
*/
#include "../common/features.h"
#ifdef EMBPERL_XS_CLASSES
#include "../common/global_define.h"
#include "embperl.h"
@ -43,60 +45,55 @@
XS(XS_Raid_IsRaidMember); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_IsRaidMember)
{
XS(XS_Raid_IsRaidMember) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Raid::IsRaidMember(THIS, name)");
Perl_croak(aTHX_ "Usage: Raid::IsRaidMember(THIS, string name)");
{
Raid * THIS;
bool RETVAL;
const char* name = (char *)SvPV_nolen(ST(1));
Raid *THIS;
bool RETVAL;
const char *name = (char *) SvPV_nolen(ST(1));
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->IsRaidMember(name);
ST(0) = boolSV(RETVAL);
ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0));
}
XSRETURN(1);
}
XS(XS_Raid_CastGroupSpell); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_CastGroupSpell)
{
XS(XS_Raid_CastGroupSpell) {
dXSARGS;
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;
Mob* caster;
uint16 spellid = (uint16)SvUV(ST(2));
uint32 gid = (uint32)SvUV(ST(3));
Raid *THIS;
Mob *caster;
uint16 spellid = (uint16) SvUV(ST(2));
uint32 gid = (uint32) SvUV(ST(3));
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1)));
caster = INT2PTR(Mob *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(1)));
caster = INT2PTR(Mob *, tmp);
} else
Perl_croak(aTHX_ "caster is not of type Mob");
if(caster == nullptr)
if (caster == nullptr)
Perl_croak(aTHX_ "caster is nullptr, avoiding crash.");
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)
{
XS(XS_Raid_GroupCount) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Raid::GroupCount(THIS, gid)");
Perl_croak(aTHX_ "Usage: Raid::GroupCount(THIS, uint32 group_id)");
{
Raid * THIS;
uint8 RETVAL;
Raid *THIS;
uint8 RETVAL;
dXSTARG;
uint32 gid = (uint32)SvUV(ST(1));
uint32 gid = (uint32) SvUV(ST(1));
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GroupCount(gid);
XSprePUSH; PUSHu((UV)RETVAL);
XSprePUSH;
PUSHu((UV) RETVAL);
}
XSRETURN(1);
}
XS(XS_Raid_RaidCount); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_RaidCount)
{
XS(XS_Raid_RaidCount) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Raid::RaidCount(THIS)");
{
Raid * THIS;
uint8 RETVAL;
Raid *THIS;
uint8 RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->RaidCount();
XSprePUSH; PUSHu((UV)RETVAL);
XSprePUSH;
PUSHu((UV) RETVAL);
}
XSRETURN(1);
}
XS(XS_Raid_GetGroup); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_GetGroup)
{
XS(XS_Raid_GetGroup) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Raid::GetGroup(THIS, name)");
Perl_croak(aTHX_ "Usage: Raid::GetGroup(THIS, string name)");
{
Raid * THIS;
uint32 RETVAL;
Raid *THIS;
uint32 RETVAL;
dXSTARG;
const char* name = (char *)SvPV_nolen(ST(1));
const char *name = (char *) SvPV_nolen(ST(1));
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetGroup(name);
XSprePUSH; PUSHu((UV)RETVAL);
XSprePUSH;
PUSHu((UV) RETVAL);
}
XSRETURN(1);
}
XS(XS_Raid_SplitExp); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_SplitExp)
{
XS(XS_Raid_SplitExp) {
dXSARGS;
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;
uint32 exp = (uint32)SvUV(ST(1));
Mob* other;
Raid *THIS;
uint32 exp = (uint32) SvUV(ST(1));
Mob *other;
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(2), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(2)));
other = INT2PTR(Mob *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(2)));
other = INT2PTR(Mob *, tmp);
} else
Perl_croak(aTHX_ "other is not of type Mob");
if(other == nullptr)
if (other == nullptr)
Perl_croak(aTHX_ "other is nullptr, avoiding crash.");
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)
{
XS(XS_Raid_GetTotalRaidDamage) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Raid::GetTotalRaidDamage(THIS, other)");
Perl_croak(aTHX_ "Usage: Raid::GetTotalRaidDamage(THIS, [Mob* other = nullptr])");
{
Raid * THIS;
uint32 RETVAL;
Raid *THIS;
uint32 RETVAL;
dXSTARG;
Mob* other;
Mob *other;
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1)));
other = INT2PTR(Mob *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(1)));
other = INT2PTR(Mob *, tmp);
} else
Perl_croak(aTHX_ "other is not of type Mob");
if(other == nullptr)
if (other == nullptr)
Perl_croak(aTHX_ "other is nullptr, avoiding crash.");
RETVAL = THIS->GetTotalRaidDamage(other);
XSprePUSH; PUSHu((UV)RETVAL);
XSprePUSH;
PUSHu((UV) RETVAL);
}
XSRETURN(1);
}
XS(XS_Raid_SplitMoney); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_SplitMoney)
{
XS(XS_Raid_SplitMoney) {
dXSARGS;
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;
uint32 copper = (uint32)SvUV(ST(1));
uint32 silver = (uint32)SvUV(ST(2));
uint32 gold = (uint32)SvUV(ST(3));
uint32 platinum = (uint32)SvUV(ST(4));
Raid *THIS;
uint32 copper = (uint32) SvUV(ST(1));
uint32 silver = (uint32) SvUV(ST(2));
uint32 gold = (uint32) SvUV(ST(3));
uint32 platinum = (uint32) SvUV(ST(4));
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
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)
{
XS(XS_Raid_BalanceHP) {
dXSARGS;
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;
int32 penalty = (int32)SvUV(ST(1));
uint32 gid = (uint32)SvUV(ST(2));
Raid *THIS;
int32 penalty = (int32) SvUV(ST(1));
uint32 gid = (uint32) SvUV(ST(2));
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
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)
{
XS(XS_Raid_IsLeader) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Raid::IsLeader(THIS, name)");
Perl_croak(aTHX_ "Usage: Raid::IsLeader(THIS, string name)");
{
Raid * THIS;
bool RETVAL;
const char* name = (char *)SvPV_nolen(ST(1));
Raid *THIS;
bool RETVAL;
const char *name = (char *) SvPV_nolen(ST(1));
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->IsLeader(name);
ST(0) = boolSV(RETVAL);
ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0));
}
XSRETURN(1);
}
XS(XS_Raid_IsGroupLeader); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_IsGroupLeader)
{
XS(XS_Raid_IsGroupLeader) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Raid::IsGroupLeader(THIS, who)");
Perl_croak(aTHX_ "Usage: Raid::IsGroupLeader(THIS, string name)");
{
Raid * THIS;
bool RETVAL;
const char* who = (char *)SvPV_nolen(ST(1));
Raid *THIS;
bool RETVAL;
const char *who = (char *) SvPV_nolen(ST(1));
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->IsGroupLeader(who);
ST(0) = boolSV(RETVAL);
ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0));
}
XSRETURN(1);
}
XS(XS_Raid_GetHighestLevel); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_GetHighestLevel)
{
XS(XS_Raid_GetHighestLevel) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Raid::GetHighestLevel(THIS)");
{
Raid * THIS;
uint32 RETVAL;
Raid *THIS;
uint32 RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetHighestLevel();
XSprePUSH; PUSHu((UV)RETVAL);
XSprePUSH;
PUSHu((UV) RETVAL);
}
XSRETURN(1);
}
XS(XS_Raid_GetLowestLevel); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_GetLowestLevel)
{
XS(XS_Raid_GetLowestLevel) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Raid::GetLowestLevel(THIS)");
{
Raid * THIS;
uint32 RETVAL;
Raid *THIS;
uint32 RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetLowestLevel();
XSprePUSH; PUSHu((UV)RETVAL);
XSprePUSH;
PUSHu((UV) RETVAL);
}
XSRETURN(1);
}
XS(XS_Raid_GetClientByIndex); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_GetClientByIndex)
{
XS(XS_Raid_GetClientByIndex) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Raid::GetClientByIndex(THIS, index)");
Perl_croak(aTHX_ "Usage: Raid::GetClientByIndex(THIS, uint16 raid_indez)");
{
Raid * THIS;
Client * RETVAL;
uint16 index = (uint16)SvUV(ST(1));
Raid *THIS;
Client *RETVAL;
uint16 index = (uint16) SvUV(ST(1));
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetClientByIndex(index);
ST(0) = sv_newmortal();
sv_setref_pv(ST(0), "Client", (void*)RETVAL);
ST(0) = sv_newmortal();
sv_setref_pv(ST(0), "Client", (void *) RETVAL);
}
XSRETURN(1);
}
XS(XS_Raid_TeleportGroup); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_TeleportGroup)
{
XS(XS_Raid_TeleportGroup) {
dXSARGS;
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;
Mob* sender;
uint32 zoneID = (uint32)SvUV(ST(2));
float x = (float)SvNV(ST(3));
float y = (float)SvNV(ST(4));
float z = (float)SvNV(ST(5));
float heading = (float)SvNV(ST(6));
uint32 gid = (uint32)SvUV(ST(7));
Raid *THIS;
Mob *sender;
uint32 zoneID = (uint32) SvUV(ST(2));
float x = (float) SvNV(ST(3));
float y = (float) SvNV(ST(4));
float z = (float) SvNV(ST(5));
float heading = (float) SvNV(ST(6));
uint32 gid = (uint32) SvUV(ST(7));
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1)));
sender = INT2PTR(Mob *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(1)));
sender = INT2PTR(Mob *, tmp);
} else
Perl_croak(aTHX_ "sender is not of type Mob");
if(sender == nullptr)
if (sender == nullptr)
Perl_croak(aTHX_ "sender is nullptr, avoiding crash.");
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)
{
XS(XS_Raid_TeleportRaid) {
dXSARGS;
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;
Mob* sender;
uint32 zoneID = (uint32)SvUV(ST(2));
float x = (float)SvNV(ST(3));
float y = (float)SvNV(ST(4));
float z = (float)SvNV(ST(5));
float heading = (float)SvNV(ST(6));
Raid *THIS;
Mob *sender;
uint32 zoneID = (uint32) SvUV(ST(2));
float x = (float) SvNV(ST(3));
float y = (float) SvNV(ST(4));
float z = (float) SvNV(ST(5));
float heading = (float) SvNV(ST(6));
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1)));
sender = INT2PTR(Mob *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(1)));
sender = INT2PTR(Mob *, tmp);
} else
Perl_croak(aTHX_ "sender is not of type Mob");
if(sender == nullptr)
if (sender == nullptr)
Perl_croak(aTHX_ "sender is nullptr, avoiding crash.");
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)
{
XS(XS_Raid_GetID) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Raid::GetID(THIS)");
{
Raid * THIS;
uint32 RETVAL;
Raid *THIS;
uint32 RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr)
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetID();
XSprePUSH; PUSHu((UV)RETVAL);
XSprePUSH;
PUSHu((UV) RETVAL);
}
XSRETURN(1);
}
XS(XS_Raid_GetMember);
XS(XS_Raid_GetMember)
{
XS(XS_Raid_GetMember) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Raid::GetMember(THIS, index)");
Perl_croak(aTHX_ "Usage: Raid::GetMember(THIS, int raid_index)");
{
Raid * THIS;
Client* RETVAL = nullptr;
Raid *THIS;
Client *RETVAL = nullptr;
dXSTARG;
if (sv_derived_from(ST(0), "Raid")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Raid *,tmp);
}
else
IV tmp = SvIV((SV *) SvRV(ST(0)));
THIS = INT2PTR(Raid *, tmp);
} else
Perl_croak(aTHX_ "THIS is not of type Raid");
if(THIS == nullptr)
if (THIS == nullptr)
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)
RETVAL = nullptr;
else {
if(THIS->members[index].member != nullptr)
if (THIS->members[index].member != nullptr)
RETVAL = THIS->members[index].member->CastToClient();
}
ST(0) = sv_newmortal();
sv_setref_pv(ST(0), "Client", (void*)RETVAL);
ST(0) = sv_newmortal();
sv_setref_pv(ST(0), "Client", (void *) RETVAL);
}
XSRETURN(1);
}
@ -580,39 +550,38 @@ XS(XS_Raid_GetMember)
extern "C"
#endif
XS(boot_Raid); /* prototype to pass -Wmissing-prototypes */
XS(boot_Raid)
{
XS(boot_Raid) {
dXSARGS;
char file[256];
strncpy(file, __FILE__, 256);
file[255] = 0;
if(items != 1)
if (items != 1)
fprintf(stderr, "boot_quest does not take any arguments.");
char buf[128];
//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, "CastGroupSpell"), XS_Raid_CastGroupSpell, file, "$$$$");
newXSproto(strcpy(buf, "GroupCount"), XS_Raid_GroupCount, file, "$$");
newXSproto(strcpy(buf, "RaidCount"), XS_Raid_RaidCount, file, "$");
newXSproto(strcpy(buf, "GetGroup"), XS_Raid_GetGroup, file, "$$");
newXSproto(strcpy(buf, "SplitExp"), XS_Raid_SplitExp, file, "$$$");
newXSproto(strcpy(buf, "GetTotalRaidDamage"), XS_Raid_GetTotalRaidDamage, file, "$$");
newXSproto(strcpy(buf, "SplitMoney"), XS_Raid_SplitMoney, file, "$$$$$");
newXSproto(strcpy(buf, "BalanceHP"), XS_Raid_BalanceHP, file, "$$$");
newXSproto(strcpy(buf, "IsLeader"), XS_Raid_IsLeader, file, "$$");
newXSproto(strcpy(buf, "IsGroupLeader"), XS_Raid_IsGroupLeader, file, "$$");
newXSproto(strcpy(buf, "GetHighestLevel"), XS_Raid_GetHighestLevel, file, "$");
newXSproto(strcpy(buf, "GetLowestLevel"), XS_Raid_GetLowestLevel, file, "$");
newXSproto(strcpy(buf, "GetClientByIndex"), XS_Raid_GetClientByIndex, file, "$$");
newXSproto(strcpy(buf, "TeleportGroup"), XS_Raid_TeleportGroup, file, "$$$$$$$$");
newXSproto(strcpy(buf, "TeleportRaid"), XS_Raid_TeleportRaid, file, "$$$$$$$");
newXSproto(strcpy(buf, "GetID"), XS_Raid_GetID, file, "$");
newXSproto(strcpy(buf, "GetMember"), XS_Raid_GetMember, file, "$$");
newXSproto(strcpy(buf, "IsRaidMember"), XS_Raid_IsRaidMember, file, "$$");
newXSproto(strcpy(buf, "CastGroupSpell"), XS_Raid_CastGroupSpell, file, "$$$$");
newXSproto(strcpy(buf, "GroupCount"), XS_Raid_GroupCount, file, "$$");
newXSproto(strcpy(buf, "RaidCount"), XS_Raid_RaidCount, file, "$");
newXSproto(strcpy(buf, "GetGroup"), XS_Raid_GetGroup, file, "$$");
newXSproto(strcpy(buf, "SplitExp"), XS_Raid_SplitExp, file, "$$$");
newXSproto(strcpy(buf, "GetTotalRaidDamage"), XS_Raid_GetTotalRaidDamage, file, "$$");
newXSproto(strcpy(buf, "SplitMoney"), XS_Raid_SplitMoney, file, "$$$$$");
newXSproto(strcpy(buf, "BalanceHP"), XS_Raid_BalanceHP, file, "$$$");
newXSproto(strcpy(buf, "IsLeader"), XS_Raid_IsLeader, file, "$$");
newXSproto(strcpy(buf, "IsGroupLeader"), XS_Raid_IsGroupLeader, file, "$$");
newXSproto(strcpy(buf, "GetHighestLevel"), XS_Raid_GetHighestLevel, file, "$");
newXSproto(strcpy(buf, "GetLowestLevel"), XS_Raid_GetLowestLevel, file, "$");
newXSproto(strcpy(buf, "GetClientByIndex"), XS_Raid_GetClientByIndex, file, "$$");
newXSproto(strcpy(buf, "TeleportGroup"), XS_Raid_TeleportGroup, file, "$$$$$$$$");
newXSproto(strcpy(buf, "TeleportRaid"), XS_Raid_TeleportRaid, file, "$$$$$$$");
newXSproto(strcpy(buf, "GetID"), XS_Raid_GetID, file, "$");
newXSproto(strcpy(buf, "GetMember"), XS_Raid_GetMember, file, "$$");
XSRETURN_YES;
}