mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-06 13:02:59 +00:00
866 lines
21 KiB
C++
866 lines
21 KiB
C++
/*
|
|
* This file was generated automatically by xsubpp version 1.9508 from the
|
|
* contents of tmp. Do not edit this file, edit tmp instead.
|
|
*
|
|
* ANY CHANGES MADE HERE WILL BE LOST!
|
|
*
|
|
*/
|
|
|
|
|
|
/* EQEMu: Everquest Server Emulator
|
|
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; version 2 of the License.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
|
are required to give you total support for your newly bought product;
|
|
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*/
|
|
|
|
#include "../common/features.h"
|
|
#ifdef EMBPERL_XS_CLASSES
|
|
#include "../common/debug.h"
|
|
#include "embperl.h"
|
|
|
|
#ifdef seed
|
|
#undef seed
|
|
#endif
|
|
|
|
#include "corpse.h"
|
|
|
|
#ifdef THIS /* this macro seems to leak out on some systems */
|
|
#undef THIS
|
|
#endif
|
|
|
|
|
|
XS(XS_Corpse_getCharacterID); /* prototype to pass -Wmissing-prototypes */
|
|
XS(XS_Corpse_getCharacterID)
|
|
{
|
|
dXSARGS;
|
|
if (items != 1)
|
|
Perl_croak(aTHX_ "Usage: Corpse::getCharacterID(THIS)");
|
|
{
|
|
Corpse * THIS;
|
|
uint32 RETVAL;
|
|
dXSTARG;
|
|
|
|
if (sv_derived_from(ST(0), "Corpse")) {
|
|
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
|
THIS = INT2PTR(Corpse *,tmp);
|
|
}
|
|
else
|
|
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
if(THIS == nullptr)
|
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
|
|
RETVAL = THIS->getCharacterID();
|
|
XSprePUSH; PUSHu((UV)RETVAL);
|
|
}
|
|
XSRETURN(1);
|
|
}
|
|
|
|
XS(XS_Corpse_GetDecayTime); /* prototype to pass -Wmissing-prototypes */
|
|
XS(XS_Corpse_GetDecayTime)
|
|
{
|
|
dXSARGS;
|
|
if (items != 1)
|
|
Perl_croak(aTHX_ "Usage: Corpse::GetDecayTime(THIS)");
|
|
{
|
|
Corpse * THIS;
|
|
uint32 RETVAL;
|
|
dXSTARG;
|
|
|
|
if (sv_derived_from(ST(0), "Corpse")) {
|
|
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
|
THIS = INT2PTR(Corpse *,tmp);
|
|
}
|
|
else
|
|
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
if(THIS == nullptr)
|
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
|
|
RETVAL = THIS->GetDecayTime();
|
|
XSprePUSH; PUSHu((UV)RETVAL);
|
|
}
|
|
XSRETURN(1);
|
|
}
|
|
|
|
XS(XS_Corpse_lock); /* prototype to pass -Wmissing-prototypes */
|
|
XS(XS_Corpse_lock)
|
|
{
|
|
dXSARGS;
|
|
if (items != 1)
|
|
Perl_croak(aTHX_ "Usage: Corpse::lock(THIS)");
|
|
{
|
|
Corpse * THIS;
|
|
|
|
if (sv_derived_from(ST(0), "Corpse")) {
|
|
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
|
THIS = INT2PTR(Corpse *,tmp);
|
|
}
|
|
else
|
|
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
if(THIS == nullptr)
|
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
|
|
THIS->lock();
|
|
}
|
|
XSRETURN_EMPTY;
|
|
}
|
|
|
|
XS(XS_Corpse_unlock); /* prototype to pass -Wmissing-prototypes */
|
|
XS(XS_Corpse_unlock)
|
|
{
|
|
dXSARGS;
|
|
if (items != 1)
|
|
Perl_croak(aTHX_ "Usage: Corpse::unlock(THIS)");
|
|
{
|
|
Corpse * THIS;
|
|
|
|
if (sv_derived_from(ST(0), "Corpse")) {
|
|
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
|
THIS = INT2PTR(Corpse *,tmp);
|
|
}
|
|
else
|
|
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
if(THIS == nullptr)
|
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
|
|
THIS->unlock();
|
|
}
|
|
XSRETURN_EMPTY;
|
|
}
|
|
|
|
XS(XS_Corpse_isLocked); /* prototype to pass -Wmissing-prototypes */
|
|
XS(XS_Corpse_isLocked)
|
|
{
|
|
dXSARGS;
|
|
if (items != 1)
|
|
Perl_croak(aTHX_ "Usage: Corpse::isLocked(THIS)");
|
|
{
|
|
Corpse * THIS;
|
|
bool RETVAL;
|
|
|
|
if (sv_derived_from(ST(0), "Corpse")) {
|
|
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
|
THIS = INT2PTR(Corpse *,tmp);
|
|
}
|
|
else
|
|
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
if(THIS == nullptr)
|
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
|
|
RETVAL = THIS->isLocked();
|
|
ST(0) = boolSV(RETVAL);
|
|
sv_2mortal(ST(0));
|
|
}
|
|
XSRETURN(1);
|
|
}
|
|
|
|
XS(XS_Corpse_ResetLooter); /* prototype to pass -Wmissing-prototypes */
|
|
XS(XS_Corpse_ResetLooter)
|
|
{
|
|
dXSARGS;
|
|
if (items != 1)
|
|
Perl_croak(aTHX_ "Usage: Corpse::ResetLooter(THIS)");
|
|
{
|
|
Corpse * THIS;
|
|
|
|
if (sv_derived_from(ST(0), "Corpse")) {
|
|
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
|
THIS = INT2PTR(Corpse *,tmp);
|
|
}
|
|
else
|
|
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
if(THIS == nullptr)
|
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
|
|
THIS->ResetLooter();
|
|
}
|
|
XSRETURN_EMPTY;
|
|
}
|
|
|
|
XS(XS_Corpse_GetDBID); /* prototype to pass -Wmissing-prototypes */
|
|
XS(XS_Corpse_GetDBID)
|
|
{
|
|
dXSARGS;
|
|
if (items != 1)
|
|
Perl_croak(aTHX_ "Usage: Corpse::GetDBID(THIS)");
|
|
{
|
|
Corpse * THIS;
|
|
uint32 RETVAL;
|
|
dXSTARG;
|
|
|
|
if (sv_derived_from(ST(0), "Corpse")) {
|
|
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
|
THIS = INT2PTR(Corpse *,tmp);
|
|
}
|
|
else
|
|
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
if(THIS == nullptr)
|
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
|
|
RETVAL = THIS->GetDBID();
|
|
XSprePUSH; PUSHu((UV)RETVAL);
|
|
}
|
|
XSRETURN(1);
|
|
}
|
|
|
|
XS(XS_Corpse_GetOwnerName); /* prototype to pass -Wmissing-prototypes */
|
|
XS(XS_Corpse_GetOwnerName)
|
|
{
|
|
dXSARGS;
|
|
if (items != 1)
|
|
Perl_croak(aTHX_ "Usage: Corpse::GetOwnerName(THIS)");
|
|
{
|
|
Corpse * THIS;
|
|
char * RETVAL;
|
|
dXSTARG;
|
|
|
|
if (sv_derived_from(ST(0), "Corpse")) {
|
|
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
|
THIS = INT2PTR(Corpse *,tmp);
|
|
}
|
|
else
|
|
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
if(THIS == nullptr)
|
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
|
|
RETVAL = THIS->GetOwnerName();
|
|
sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
|
|
}
|
|
XSRETURN(1);
|
|
}
|
|
|
|
XS(XS_Corpse_SetDecayTimer); /* prototype to pass -Wmissing-prototypes */
|
|
XS(XS_Corpse_SetDecayTimer)
|
|
{
|
|
dXSARGS;
|
|
if (items != 2)
|
|
Perl_croak(aTHX_ "Usage: Corpse::SetDecayTimer(THIS, decaytime)");
|
|
{
|
|
Corpse * THIS;
|
|
uint32 decaytime = (uint32)SvUV(ST(1));
|
|
|
|
if (sv_derived_from(ST(0), "Corpse")) {
|
|
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
|
THIS = INT2PTR(Corpse *,tmp);
|
|
}
|
|
else
|
|
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
if(THIS == nullptr)
|
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
|
|
THIS->SetDecayTimer(decaytime);
|
|
}
|
|
XSRETURN_EMPTY;
|
|
}
|
|
|
|
XS(XS_Corpse_IsEmpty); /* prototype to pass -Wmissing-prototypes */
|
|
XS(XS_Corpse_IsEmpty)
|
|
{
|
|
dXSARGS;
|
|
if (items != 1)
|
|
Perl_croak(aTHX_ "Usage: Corpse::IsEmpty(THIS)");
|
|
{
|
|
Corpse * THIS;
|
|
bool RETVAL;
|
|
|
|
if (sv_derived_from(ST(0), "Corpse")) {
|
|
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
|
THIS = INT2PTR(Corpse *,tmp);
|
|
}
|
|
else
|
|
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
if(THIS == nullptr)
|
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
|
|
RETVAL = THIS->IsEmpty();
|
|
ST(0) = boolSV(RETVAL);
|
|
sv_2mortal(ST(0));
|
|
}
|
|
XSRETURN(1);
|
|
}
|
|
|
|
XS(XS_Corpse_AddItem); /* prototype to pass -Wmissing-prototypes */
|
|
XS(XS_Corpse_AddItem)
|
|
{
|
|
dXSARGS;
|
|
if (items < 3 || items > 4)
|
|
Perl_croak(aTHX_ "Usage: Corpse::AddItem(THIS, itemnum, charges, slot= 0)");
|
|
{
|
|
Corpse * THIS;
|
|
uint32 itemnum = (uint32)SvUV(ST(1));
|
|
uint16 charges = (uint16)SvUV(ST(2));
|
|
int16 slot;
|
|
|
|
if (sv_derived_from(ST(0), "Corpse")) {
|
|
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
|
THIS = INT2PTR(Corpse *,tmp);
|
|
}
|
|
else
|
|
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
if(THIS == nullptr)
|
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
|
|
if (items < 4)
|
|
slot = 0;
|
|
else {
|
|
slot = (int16)SvIV(ST(3));
|
|
}
|
|
|
|
THIS->AddItem(itemnum, charges, slot);
|
|
}
|
|
XSRETURN_EMPTY;
|
|
}
|
|
|
|
XS(XS_Corpse_GetWornItem); /* prototype to pass -Wmissing-prototypes */
|
|
XS(XS_Corpse_GetWornItem)
|
|
{
|
|
dXSARGS;
|
|
if (items != 2)
|
|
Perl_croak(aTHX_ "Usage: Corpse::GetWornItem(THIS, equipSlot)");
|
|
{
|
|
Corpse * THIS;
|
|
uint32 RETVAL;
|
|
dXSTARG;
|
|
int16 equipSlot = (int16)SvIV(ST(1));
|
|
|
|
if (sv_derived_from(ST(0), "Corpse")) {
|
|
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
|
THIS = INT2PTR(Corpse *,tmp);
|
|
}
|
|
else
|
|
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
if(THIS == nullptr)
|
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
|
|
RETVAL = THIS->GetWornItem(equipSlot);
|
|
XSprePUSH; PUSHu((UV)RETVAL);
|
|
}
|
|
XSRETURN(1);
|
|
}
|
|
|
|
XS(XS_Corpse_RemoveItem); /* prototype to pass -Wmissing-prototypes */
|
|
XS(XS_Corpse_RemoveItem)
|
|
{
|
|
dXSARGS;
|
|
if (items != 2)
|
|
Perl_croak(aTHX_ "Usage: Corpse::RemoveItem(THIS, lootslot)");
|
|
{
|
|
Corpse * THIS;
|
|
uint16 lootslot = (uint16)SvUV(ST(1));
|
|
|
|
if (sv_derived_from(ST(0), "Corpse")) {
|
|
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
|
THIS = INT2PTR(Corpse *,tmp);
|
|
}
|
|
else
|
|
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
if(THIS == nullptr)
|
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
|
|
THIS->RemoveItem(lootslot);
|
|
}
|
|
XSRETURN_EMPTY;
|
|
}
|
|
|
|
XS(XS_Corpse_setCash); /* prototype to pass -Wmissing-prototypes */
|
|
XS(XS_Corpse_setCash)
|
|
{
|
|
dXSARGS;
|
|
if (items != 5)
|
|
Perl_croak(aTHX_ "Usage: Corpse::setCash(THIS, in_copper, in_silver, in_gold, in_platinum)");
|
|
{
|
|
Corpse * THIS;
|
|
uint16 in_copper = (uint16)SvUV(ST(1));
|
|
uint16 in_silver = (uint16)SvUV(ST(2));
|
|
uint16 in_gold = (uint16)SvUV(ST(3));
|
|
uint16 in_platinum = (uint16)SvUV(ST(4));
|
|
|
|
if (sv_derived_from(ST(0), "Corpse")) {
|
|
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
|
THIS = INT2PTR(Corpse *,tmp);
|
|
}
|
|
else
|
|
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
if(THIS == nullptr)
|
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
|
|
THIS->setCash(in_copper, in_silver, in_gold, in_platinum);
|
|
}
|
|
XSRETURN_EMPTY;
|
|
}
|
|
|
|
XS(XS_Corpse_removeCash); /* prototype to pass -Wmissing-prototypes */
|
|
XS(XS_Corpse_removeCash)
|
|
{
|
|
dXSARGS;
|
|
if (items != 1)
|
|
Perl_croak(aTHX_ "Usage: Corpse::removeCash(THIS)");
|
|
{
|
|
Corpse * THIS;
|
|
|
|
if (sv_derived_from(ST(0), "Corpse")) {
|
|
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
|
THIS = INT2PTR(Corpse *,tmp);
|
|
}
|
|
else
|
|
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
if(THIS == nullptr)
|
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
|
|
THIS->removeCash();
|
|
}
|
|
XSRETURN_EMPTY;
|
|
}
|
|
|
|
XS(XS_Corpse_getNumItems); /* prototype to pass -Wmissing-prototypes */
|
|
XS(XS_Corpse_getNumItems)
|
|
{
|
|
dXSARGS;
|
|
if (items != 1)
|
|
Perl_croak(aTHX_ "Usage: Corpse::getNumItems(THIS)");
|
|
{
|
|
Corpse * THIS;
|
|
uint32 RETVAL;
|
|
dXSTARG;
|
|
|
|
if (sv_derived_from(ST(0), "Corpse")) {
|
|
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
|
THIS = INT2PTR(Corpse *,tmp);
|
|
}
|
|
else
|
|
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
if(THIS == nullptr)
|
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
|
|
RETVAL = THIS->getNumItems();
|
|
XSprePUSH; PUSHu((UV)RETVAL);
|
|
}
|
|
XSRETURN(1);
|
|
}
|
|
|
|
XS(XS_Corpse_Delete); /* prototype to pass -Wmissing-prototypes */
|
|
XS(XS_Corpse_Delete)
|
|
{
|
|
dXSARGS;
|
|
if (items != 1)
|
|
Perl_croak(aTHX_ "Usage: Corpse::Delete(THIS)");
|
|
{
|
|
Corpse * THIS;
|
|
|
|
if (sv_derived_from(ST(0), "Corpse")) {
|
|
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
|
THIS = INT2PTR(Corpse *,tmp);
|
|
}
|
|
else
|
|
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
if(THIS == nullptr)
|
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
|
|
THIS->Delete();
|
|
}
|
|
XSRETURN_EMPTY;
|
|
}
|
|
|
|
XS(XS_Corpse_getCopper); /* prototype to pass -Wmissing-prototypes */
|
|
XS(XS_Corpse_getCopper)
|
|
{
|
|
dXSARGS;
|
|
if (items != 1)
|
|
Perl_croak(aTHX_ "Usage: Corpse::getCopper(THIS)");
|
|
{
|
|
Corpse * THIS;
|
|
uint32 RETVAL;
|
|
dXSTARG;
|
|
|
|
if (sv_derived_from(ST(0), "Corpse")) {
|
|
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
|
THIS = INT2PTR(Corpse *,tmp);
|
|
}
|
|
else
|
|
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
if(THIS == nullptr)
|
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
|
|
RETVAL = THIS->getCopper();
|
|
XSprePUSH; PUSHu((UV)RETVAL);
|
|
}
|
|
XSRETURN(1);
|
|
}
|
|
|
|
XS(XS_Corpse_getSilver); /* prototype to pass -Wmissing-prototypes */
|
|
XS(XS_Corpse_getSilver)
|
|
{
|
|
dXSARGS;
|
|
if (items != 1)
|
|
Perl_croak(aTHX_ "Usage: Corpse::getSilver(THIS)");
|
|
{
|
|
Corpse * THIS;
|
|
uint32 RETVAL;
|
|
dXSTARG;
|
|
|
|
if (sv_derived_from(ST(0), "Corpse")) {
|
|
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
|
THIS = INT2PTR(Corpse *,tmp);
|
|
}
|
|
else
|
|
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
if(THIS == nullptr)
|
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
|
|
RETVAL = THIS->getSilver();
|
|
XSprePUSH; PUSHu((UV)RETVAL);
|
|
}
|
|
XSRETURN(1);
|
|
}
|
|
|
|
XS(XS_Corpse_getGold); /* prototype to pass -Wmissing-prototypes */
|
|
XS(XS_Corpse_getGold)
|
|
{
|
|
dXSARGS;
|
|
if (items != 1)
|
|
Perl_croak(aTHX_ "Usage: Corpse::getGold(THIS)");
|
|
{
|
|
Corpse * THIS;
|
|
uint32 RETVAL;
|
|
dXSTARG;
|
|
|
|
if (sv_derived_from(ST(0), "Corpse")) {
|
|
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
|
THIS = INT2PTR(Corpse *,tmp);
|
|
}
|
|
else
|
|
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
if(THIS == nullptr)
|
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
|
|
RETVAL = THIS->getGold();
|
|
XSprePUSH; PUSHu((UV)RETVAL);
|
|
}
|
|
XSRETURN(1);
|
|
}
|
|
|
|
XS(XS_Corpse_getPlatinum); /* prototype to pass -Wmissing-prototypes */
|
|
XS(XS_Corpse_getPlatinum)
|
|
{
|
|
dXSARGS;
|
|
if (items != 1)
|
|
Perl_croak(aTHX_ "Usage: Corpse::getPlatinum(THIS)");
|
|
{
|
|
Corpse * THIS;
|
|
uint32 RETVAL;
|
|
dXSTARG;
|
|
|
|
if (sv_derived_from(ST(0), "Corpse")) {
|
|
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
|
THIS = INT2PTR(Corpse *,tmp);
|
|
}
|
|
else
|
|
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
if(THIS == nullptr)
|
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
|
|
RETVAL = THIS->getPlatinum();
|
|
XSprePUSH; PUSHu((UV)RETVAL);
|
|
}
|
|
XSRETURN(1);
|
|
}
|
|
|
|
XS(XS_Corpse_Summon); /* prototype to pass -Wmissing-prototypes */
|
|
XS(XS_Corpse_Summon)
|
|
{
|
|
dXSARGS;
|
|
if (items != 3)
|
|
Perl_croak(aTHX_ "Usage: Corpse::Summon(THIS, client, spell)");
|
|
{
|
|
Corpse * THIS;
|
|
Client* client;
|
|
bool spell = (bool)SvTRUE(ST(2));
|
|
|
|
if (sv_derived_from(ST(0), "Corpse")) {
|
|
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
|
THIS = INT2PTR(Corpse *,tmp);
|
|
}
|
|
else
|
|
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
if(THIS == nullptr)
|
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
|
|
if (sv_derived_from(ST(1), "Client")) {
|
|
IV tmp = SvIV((SV*)SvRV(ST(1)));
|
|
client = INT2PTR(Client *,tmp);
|
|
}
|
|
else
|
|
Perl_croak(aTHX_ "client is not of type Client");
|
|
if(client == nullptr)
|
|
Perl_croak(aTHX_ "client is nullptr, avoiding crash.");
|
|
|
|
THIS->Summon(client, spell, true);
|
|
}
|
|
XSRETURN_EMPTY;
|
|
}
|
|
|
|
XS(XS_Corpse_CastResurrection); /* prototype to pass -Wmissing-prototypes */
|
|
XS(XS_Corpse_CastResurrection)
|
|
{
|
|
dXSARGS;
|
|
if (items != 3)
|
|
Perl_croak(aTHX_ "Usage: Corpse::CastResurrection(THIS, spellid, Caster)");
|
|
{
|
|
Corpse * THIS;
|
|
uint16 spellid = (uint16)SvUV(ST(1));
|
|
Mob* Caster;
|
|
|
|
if (sv_derived_from(ST(0), "Corpse")) {
|
|
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
|
THIS = INT2PTR(Corpse *,tmp);
|
|
}
|
|
else
|
|
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
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)));
|
|
Caster = INT2PTR(Mob *,tmp);
|
|
}
|
|
else
|
|
Perl_croak(aTHX_ "Caster is not of type Mob");
|
|
if(Caster == nullptr)
|
|
Perl_croak(aTHX_ "Caster is nullptr, avoiding crash.");
|
|
|
|
THIS->CastResurrection(spellid, Caster);
|
|
}
|
|
XSRETURN_EMPTY;
|
|
}
|
|
|
|
XS(XS_Corpse_CompleteResurrection); /* prototype to pass -Wmissing-prototypes */
|
|
XS(XS_Corpse_CompleteResurrection)
|
|
{
|
|
dXSARGS;
|
|
if (items != 1)
|
|
Perl_croak(aTHX_ "Usage: Corpse::CompleteResurrection(THIS)");
|
|
{
|
|
Corpse * THIS;
|
|
|
|
if (sv_derived_from(ST(0), "Corpse")) {
|
|
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
|
THIS = INT2PTR(Corpse *,tmp);
|
|
}
|
|
else
|
|
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
if(THIS == nullptr)
|
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
|
|
THIS->CompleteResurrection();
|
|
}
|
|
XSRETURN_EMPTY;
|
|
}
|
|
|
|
XS(XS_Corpse_canMobLoot); /* prototype to pass -Wmissing-prototypes */
|
|
XS(XS_Corpse_canMobLoot)
|
|
{
|
|
dXSARGS;
|
|
if (items != 2)
|
|
Perl_croak(aTHX_ "Usage: Corpse::canMobLoot(THIS, charid)");
|
|
{
|
|
Corpse * THIS;
|
|
bool RETVAL;
|
|
int charid = (int)SvIV(ST(1));
|
|
|
|
if (sv_derived_from(ST(0), "Corpse")) {
|
|
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
|
THIS = INT2PTR(Corpse *,tmp);
|
|
}
|
|
else
|
|
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
if(THIS == nullptr)
|
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
|
|
RETVAL = THIS->canMobLoot(charid);
|
|
ST(0) = boolSV(RETVAL);
|
|
sv_2mortal(ST(0));
|
|
}
|
|
XSRETURN(1);
|
|
}
|
|
|
|
XS(XS_Corpse_AllowMobLoot); /* prototype to pass -Wmissing-prototypes */
|
|
XS(XS_Corpse_AllowMobLoot)
|
|
{
|
|
dXSARGS;
|
|
if (items != 3)
|
|
Perl_croak(aTHX_ "Usage: Corpse::AllowMobLoot(THIS, them, slot)");
|
|
{
|
|
Corpse * THIS;
|
|
Mob * them;
|
|
uint8 slot = (uint8)SvUV(ST(2));
|
|
|
|
if (sv_derived_from(ST(0), "Corpse")) {
|
|
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
|
THIS = INT2PTR(Corpse *,tmp);
|
|
}
|
|
else
|
|
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
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)));
|
|
them = INT2PTR(Mob *,tmp);
|
|
}
|
|
else
|
|
Perl_croak(aTHX_ "them is not of type Mob");
|
|
if(them == nullptr)
|
|
Perl_croak(aTHX_ "them is nullptr, avoiding crash.");
|
|
|
|
THIS->AllowMobLoot(them, slot);
|
|
}
|
|
XSRETURN_EMPTY;
|
|
}
|
|
|
|
XS(XS_Corpse_addLooter); /* prototype to pass -Wmissing-prototypes */
|
|
XS(XS_Corpse_addLooter)
|
|
{
|
|
dXSARGS;
|
|
if (items != 2)
|
|
Perl_croak(aTHX_ "Usage: Corpse::addLooter(THIS, who)");
|
|
{
|
|
Corpse * THIS;
|
|
Mob * who;
|
|
|
|
if (sv_derived_from(ST(0), "Corpse")) {
|
|
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
|
THIS = INT2PTR(Corpse *,tmp);
|
|
}
|
|
else
|
|
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
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)));
|
|
who = INT2PTR(Mob *,tmp);
|
|
}
|
|
else
|
|
Perl_croak(aTHX_ "who is not of type Mob");
|
|
if(who == nullptr)
|
|
Perl_croak(aTHX_ "who is nullptr, avoiding crash.");
|
|
|
|
THIS->addLooter(who);
|
|
}
|
|
XSRETURN_EMPTY;
|
|
}
|
|
|
|
XS(XS_Corpse_isResurrected); /* prototype to pass -Wmissing-prototypes */
|
|
XS(XS_Corpse_isResurrected)
|
|
{
|
|
dXSARGS;
|
|
if (items != 1)
|
|
Perl_croak(aTHX_ "Usage: Corpse::isResurrected(THIS)");
|
|
{
|
|
Corpse * THIS;
|
|
bool RETVAL;
|
|
|
|
if (sv_derived_from(ST(0), "Corpse")) {
|
|
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
|
THIS = INT2PTR(Corpse *,tmp);
|
|
}
|
|
else
|
|
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
if(THIS == nullptr)
|
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
|
|
RETVAL = THIS->isResurrected();
|
|
ST(0) = boolSV(RETVAL);
|
|
sv_2mortal(ST(0));
|
|
}
|
|
XSRETURN(1);
|
|
}
|
|
|
|
XS(XS_Corpse_setResurrected); /* prototype to pass -Wmissing-prototypes */
|
|
XS(XS_Corpse_setResurrected) {
|
|
dXSARGS;
|
|
if (items != 2)
|
|
Perl_croak(aTHX_ "Usage: Corpse::setResurrected(THIS, resurrected)");
|
|
{
|
|
Corpse * THIS;
|
|
bool resurrected = (bool)SvTRUE(ST(1));
|
|
|
|
if (sv_derived_from(ST(0), "Corpse")) {
|
|
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
|
THIS = INT2PTR(Corpse *, tmp);
|
|
}
|
|
else
|
|
Perl_croak(aTHX_ "THIS is not of type Corpse");
|
|
if(THIS == nullptr)
|
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
|
|
|
THIS->setResurrected(resurrected);
|
|
}
|
|
XSRETURN_EMPTY;
|
|
}
|
|
|
|
|
|
#ifdef __cplusplus
|
|
extern "C"
|
|
#endif
|
|
XS(boot_Corpse); /* prototype to pass -Wmissing-prototypes */
|
|
XS(boot_Corpse)
|
|
{
|
|
dXSARGS;
|
|
char file[256];
|
|
strncpy(file, __FILE__, 256);
|
|
file[255] = 0;
|
|
|
|
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, "getCharacterID"), XS_Corpse_getCharacterID, file, "$");
|
|
newXSproto(strcpy(buf, "GetDecayTime"), XS_Corpse_GetDecayTime, file, "$");
|
|
newXSproto(strcpy(buf, "lock"), XS_Corpse_lock, file, "$");
|
|
newXSproto(strcpy(buf, "unlock"), XS_Corpse_unlock, file, "$");
|
|
newXSproto(strcpy(buf, "isLocked"), XS_Corpse_isLocked, file, "$");
|
|
newXSproto(strcpy(buf, "ResetLooter"), XS_Corpse_ResetLooter, file, "$");
|
|
newXSproto(strcpy(buf, "GetDBID"), XS_Corpse_GetDBID, file, "$");
|
|
newXSproto(strcpy(buf, "GetOwnerName"), XS_Corpse_GetOwnerName, file, "$");
|
|
newXSproto(strcpy(buf, "SetDecayTimer"), XS_Corpse_SetDecayTimer, file, "$$");
|
|
newXSproto(strcpy(buf, "IsEmpty"), XS_Corpse_IsEmpty, file, "$");
|
|
newXSproto(strcpy(buf, "AddItem"), XS_Corpse_AddItem, file, "$$$;$");
|
|
newXSproto(strcpy(buf, "GetWornItem"), XS_Corpse_GetWornItem, file, "$$");
|
|
newXSproto(strcpy(buf, "RemoveItem"), XS_Corpse_RemoveItem, file, "$$");
|
|
newXSproto(strcpy(buf, "setCash"), XS_Corpse_setCash, file, "$$$$$");
|
|
newXSproto(strcpy(buf, "removeCash"), XS_Corpse_removeCash, file, "$");
|
|
newXSproto(strcpy(buf, "getNumItems"), XS_Corpse_getNumItems, file, "$");
|
|
newXSproto(strcpy(buf, "Delete"), XS_Corpse_Delete, file, "$");
|
|
newXSproto(strcpy(buf, "getCopper"), XS_Corpse_getCopper, file, "$");
|
|
newXSproto(strcpy(buf, "getSilver"), XS_Corpse_getSilver, file, "$");
|
|
newXSproto(strcpy(buf, "getGold"), XS_Corpse_getGold, file, "$");
|
|
newXSproto(strcpy(buf, "getPlatinum"), XS_Corpse_getPlatinum, file, "$");
|
|
newXSproto(strcpy(buf, "Summon"), XS_Corpse_Summon, file, "$$$");
|
|
newXSproto(strcpy(buf, "CastResurrection"), XS_Corpse_CastResurrection, file, "$$$");
|
|
newXSproto(strcpy(buf, "CompleteResurrection"), XS_Corpse_CompleteResurrection, file, "$");
|
|
newXSproto(strcpy(buf, "canMobLoot"), XS_Corpse_canMobLoot, file, "$$");
|
|
newXSproto(strcpy(buf, "addLooter"), XS_Corpse_addLooter, file, "$$$");
|
|
newXSproto(strcpy(buf, "isResurrected"), XS_Corpse_isResurrected, file, "$");
|
|
newXSproto(strcpy(buf, "setResurrected"), XS_Corpse_setResurrected, file, "$$"); //Number of $ is dependent upon number of arguments needed.
|
|
XSRETURN_YES;
|
|
}
|
|
|
|
#endif //EMBPERL_XS_CLASSES
|
|
|