Merge branch 'master' into tasks

This commit is contained in:
Michael Cook (mackal)
2018-07-02 22:02:07 -04:00
16 changed files with 11066 additions and 12241 deletions
+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);
}
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);
}
+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"
#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
+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"
#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;
}
+33 -36
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;
}
+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 "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;
}
+233 -264
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;
}