/*
* 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/global_define.h"
#include <list>
#include "embperl.h"

#ifdef seed
#undef seed
#endif

#include "entity.h"

#ifdef THIS /* this macro seems to leak out on some systems */
#undef THIS
#endif


XS(XS_EntityList_GetMobID); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_GetMobID)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::GetMobID(THIS, id)");
	{
		EntityList *		THIS;
		Mob *		RETVAL;
		uint16		id = (uint16)SvUV(ST(1));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		RETVAL = THIS->GetMobID(id);
		ST(0) = sv_newmortal();
		sv_setref_pv(ST(0), "Mob", (void*)RETVAL);
	}
	XSRETURN(1);
}

XS(XS_EntityList_GetMob); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_GetMob)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::GetMob(THIS, name)");
	{
		EntityList *		THIS;
		Mob *		RETVAL;
		char*		name = (char *)SvPV_nolen(ST(1));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		RETVAL = THIS->GetMob(name);
		ST(0) = sv_newmortal();
		sv_setref_pv(ST(0), "Mob", (void*)RETVAL);
	}
	XSRETURN(1);
}

XS(XS_EntityList_GetMobByID); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_GetMobByID)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::GetMobByID(THIS, id)");
	{
		EntityList *		THIS;
		Mob *		RETVAL;
		uint16		id = (uint16)SvUV(ST(1));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		RETVAL = THIS->GetMob(id);
		ST(0) = sv_newmortal();
		sv_setref_pv(ST(0), "Mob", (void*)RETVAL);
	}
	XSRETURN(1);
}

XS(XS_EntityList_GetMobByNpcTypeID); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_GetMobByNpcTypeID)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::GetMobByNpcTypeID(THIS, get_id)");
	{
		EntityList *		THIS;
		Mob *		RETVAL;
		uint32		get_id = (uint32)SvUV(ST(1));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		RETVAL = THIS->GetMobByNpcTypeID(get_id);
		ST(0) = sv_newmortal();
		sv_setref_pv(ST(0), "Mob", (void*)RETVAL);
	}
	XSRETURN(1);
}

XS(XS_EntityList_IsMobSpawnedByNpcTypeID); /* prototype pass -Wmissing-prototypes */
XS(XS_EntityList_IsMobSpawnedByNpcTypeID)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::ValidMobByNpcTypeID(THIS, get_id)");
	{
		EntityList *		THIS;
		bool		RETVAL;
		uint32		get_id = (uint32)SvUV(ST(1));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		RETVAL = THIS->IsMobSpawnedByNpcTypeID(get_id);
		ST(0) = boolSV(RETVAL);
		sv_2mortal(ST(0));
	}
	XSRETURN(1);
}

XS(XS_EntityList_GetNPCByID); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_GetNPCByID)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::GetNPCByID(THIS, id)");
	{
		EntityList *		THIS;
		NPC *		RETVAL;
		uint16		id = (uint16)SvUV(ST(1));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		RETVAL = THIS->GetNPCByID(id);
		ST(0) = sv_newmortal();
		sv_setref_pv(ST(0), "NPC", (void*)RETVAL);
	}
	XSRETURN(1);
}

XS(XS_EntityList_GetNPCByNPCTypeID); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_GetNPCByNPCTypeID)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::GetNPCByNPCTypeID(THIS, npc_id)");
	{
		EntityList *		THIS;
		NPC *		RETVAL;
		uint32		npc_id = (uint32)SvUV(ST(1));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		RETVAL = THIS->GetNPCByNPCTypeID(npc_id);
		ST(0) = sv_newmortal();
		sv_setref_pv(ST(0), "NPC", (void*)RETVAL);
	}
	XSRETURN(1);
}

XS(XS_EntityList_GetClientByName); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_GetClientByName)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::GetClientByName(THIS, name)");
	{
		EntityList *		THIS;
		Client *		RETVAL;
		char *		name = (char *)SvPV_nolen(ST(1));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		RETVAL = THIS->GetClientByName(name);
		ST(0) = sv_newmortal();
		sv_setref_pv(ST(0), "Client", (void*)RETVAL);
	}
	XSRETURN(1);
}

XS(XS_EntityList_GetClientByAccID); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_GetClientByAccID)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::GetClientByAccID(THIS, accid)");
	{
		EntityList *		THIS;
		Client *		RETVAL;
		uint32		accid = (uint32)SvUV(ST(1));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		RETVAL = THIS->GetClientByAccID(accid);
		ST(0) = sv_newmortal();
		sv_setref_pv(ST(0), "Client", (void*)RETVAL);
	}
	XSRETURN(1);
}

XS(XS_EntityList_GetClientByID); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_GetClientByID)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::GetClientByID(THIS, id)");
	{
		EntityList *		THIS;
		Client *		RETVAL;
		uint16		id = (uint16)SvUV(ST(1));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		RETVAL = THIS->GetClientByID(id);
		ST(0) = sv_newmortal();
		sv_setref_pv(ST(0), "Client", (void*)RETVAL);
	}
	XSRETURN(1);
}

XS(XS_EntityList_GetClientByCharID); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_GetClientByCharID)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::GetClientByCharID(THIS, iCharID)");
	{
		EntityList *		THIS;
		Client *		RETVAL;
		uint32		iCharID = (uint32)SvUV(ST(1));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		RETVAL = THIS->GetClientByCharID(iCharID);
		ST(0) = sv_newmortal();
		sv_setref_pv(ST(0), "Client", (void*)RETVAL);
	}
	XSRETURN(1);
}

XS(XS_EntityList_GetClientByWID); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_GetClientByWID)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::GetClientByWID(THIS, iWID)");
	{
		EntityList *		THIS;
		Client *		RETVAL;
		uint32		iWID = (uint32)SvUV(ST(1));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		RETVAL = THIS->GetClientByWID(iWID);
		ST(0) = sv_newmortal();
		sv_setref_pv(ST(0), "Client", (void*)RETVAL);
	}
	XSRETURN(1);
}

XS(XS_EntityList_GetObjectByDBID); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_GetObjectByDBID)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::GetObjectByDBID(THIS, id)");
	{
		EntityList *		THIS;
		Object *		RETVAL;
		uint32		id = (uint32)SvUV(ST(1));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		RETVAL = THIS->GetObjectByDBID(id);
		ST(0) = sv_newmortal();
		sv_setref_pv(ST(0), "Object", (void*)RETVAL);
	}
	XSRETURN(1);
}

XS(XS_EntityList_GetObjectByID); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_GetObjectByID)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::GetObjectByID(THIS, id)");
	{
		EntityList *		THIS;
		Object *		RETVAL;
		uint32		id = (uint32)SvUV(ST(1));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		RETVAL = THIS->GetObjectByID(id);
		ST(0) = sv_newmortal();
		sv_setref_pv(ST(0), "Object", (void*)RETVAL);
	}
	XSRETURN(1);
}

XS(XS_EntityList_GetDoorsByDBID); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_GetDoorsByDBID)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::GetDoorsByDBID(THIS, id)");
	{
		EntityList *		THIS;
		Doors *		RETVAL;
		uint32		id = (uint32)SvUV(ST(1));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		RETVAL = THIS->GetDoorsByDBID(id);
		ST(0) = sv_newmortal();
		sv_setref_pv(ST(0), "Doors", (void*)RETVAL);
	}
	XSRETURN(1);
}

XS(XS_EntityList_GetDoorsByDoorID); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_GetDoorsByDoorID)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::GetDoorsByDoorID(THIS, id)");
	{
		EntityList *		THIS;
		Doors *		RETVAL;
		uint32		id = (uint32)SvUV(ST(1));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		RETVAL = THIS->GetDoorsByDoorID(id);
		ST(0) = sv_newmortal();
		sv_setref_pv(ST(0), "Doors", (void*)RETVAL);
	}
	XSRETURN(1);
}

XS(XS_EntityList_GetDoorsByID); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_GetDoorsByID)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::GetDoorsByID(THIS, id)");
	{
		EntityList *		THIS;
		Doors *		RETVAL;
		uint32		id = (uint32)SvUV(ST(1));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		RETVAL = THIS->GetDoorsByID(id);
		ST(0) = sv_newmortal();
		sv_setref_pv(ST(0), "Doors", (void*)RETVAL);
	}
	XSRETURN(1);
}

XS(XS_EntityList_FindDoor); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_FindDoor)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::FindDoor(THIS, id)");
	{
		EntityList *		THIS;
		Doors *		RETVAL;
		uint32		id = (uint32)SvUV(ST(1));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		RETVAL = THIS->FindDoor(id);
		ST(0) = sv_newmortal();
		sv_setref_pv(ST(0), "Doors", (void*)RETVAL);
	}
	XSRETURN(1);
}

XS(XS_EntityList_GetGroupByMob); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_GetGroupByMob)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::GetGroupByMob(THIS, mob)");
	{
		EntityList *		THIS;
		Group *		RETVAL;
		Mob*		mob;

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		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)));
			mob = INT2PTR(Mob *,tmp);
		}
		else
			Perl_croak(aTHX_ "mob is not of type Mob");
		if(mob == nullptr)
			Perl_croak(aTHX_ "mob is nullptr, avoiding crash.");

		RETVAL = THIS->GetGroupByMob(mob);
		ST(0) = sv_newmortal();
		sv_setref_pv(ST(0), "Group", (void*)RETVAL);
	}
	XSRETURN(1);
}

XS(XS_EntityList_GetGroupByClient); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_GetGroupByClient)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::GetGroupByClient(THIS, client)");
	{
		EntityList *		THIS;
		Group *		RETVAL;
		Client*		client;

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		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.");

		RETVAL = THIS->GetGroupByClient(client);
		ST(0) = sv_newmortal();
		sv_setref_pv(ST(0), "Group", (void*)RETVAL);
	}
	XSRETURN(1);
}

XS(XS_EntityList_GetGroupByID); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_GetGroupByID)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::GetGroupByID(THIS, id)");
	{
		EntityList *		THIS;
		Group *		RETVAL;
		uint32		id = (uint32)SvUV(ST(1));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		RETVAL = THIS->GetGroupByID(id);
		ST(0) = sv_newmortal();
		sv_setref_pv(ST(0), "Group", (void*)RETVAL);
	}
	XSRETURN(1);
}

XS(XS_EntityList_GetGroupByLeaderName); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_GetGroupByLeaderName)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::GetGroupByLeaderName(THIS, leader)");
	{
		EntityList *		THIS;
		Group *		RETVAL;
		char*		leader = (char *)SvPV_nolen(ST(1));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		RETVAL = THIS->GetGroupByLeaderName(leader);
		ST(0) = sv_newmortal();
		sv_setref_pv(ST(0), "Group", (void*)RETVAL);
	}
	XSRETURN(1);
}

XS(XS_EntityList_GetRaidByID); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_GetRaidByID)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::GetRaidByID(THIS, id)");
	{
		EntityList *		THIS;
		Raid *		RETVAL;
		uint32		id = (uint32)SvUV(ST(1));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		RETVAL = THIS->GetRaidByID(id);
		ST(0) = sv_newmortal();
		sv_setref_pv(ST(0), "Raid", (void*)RETVAL);
	}
	XSRETURN(1);
}

XS(XS_EntityList_GetRaidByClient); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_GetRaidByClient)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::GetRaidByClient(THIS, client)");
	{
		EntityList *		THIS;
		Raid *		RETVAL;
		Client*		client;

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		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.");

		RETVAL = THIS->GetRaidByClient(client);
		ST(0) = sv_newmortal();
		sv_setref_pv(ST(0), "Raid", (void*)RETVAL);
	}
	XSRETURN(1);
}

XS(XS_EntityList_GetCorpseByOwner); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_GetCorpseByOwner)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::GetCorpseByOwner(THIS, client)");
	{
		EntityList *		THIS;
		Corpse *		RETVAL;
		Client*		client;

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		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.");

		RETVAL = THIS->GetCorpseByOwner(client);
		ST(0) = sv_newmortal();
		sv_setref_pv(ST(0), "Corpse", (void*)RETVAL);
	}
	XSRETURN(1);
}

XS(XS_EntityList_GetCorpseByID); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_GetCorpseByID)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::GetCorpseByID(THIS, id)");
	{
		EntityList *		THIS;
		Corpse *		RETVAL;
		uint16		id = (uint16)SvUV(ST(1));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		RETVAL = THIS->GetCorpseByID(id);
		ST(0) = sv_newmortal();
		sv_setref_pv(ST(0), "Corpse", (void*)RETVAL);
	}
	XSRETURN(1);
}

XS(XS_EntityList_GetCorpseByName); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_GetCorpseByName)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::GetCorpseByName(THIS, name)");
	{
		EntityList *		THIS;
		Corpse *		RETVAL;
		char*		name = (char *)SvPV_nolen(ST(1));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		RETVAL = THIS->GetCorpseByName(name);
		ST(0) = sv_newmortal();
		sv_setref_pv(ST(0), "Corpse", (void*)RETVAL);
	}
	XSRETURN(1);
}

XS(XS_EntityList_ClearClientPetitionQueue); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_ClearClientPetitionQueue)
{
	dXSARGS;
	if (items != 1)
		Perl_croak(aTHX_ "Usage: EntityList::ClearClientPetitionQueue(THIS)");
	{
		EntityList *		THIS;

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		THIS->ClearClientPetitionQueue();
	}
	XSRETURN_EMPTY;
}

XS(XS_EntityList_CanAddHateForMob); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_CanAddHateForMob)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::CanAddHateForMob(THIS, p)");
	{
		EntityList *		THIS;
		bool		RETVAL;
		Mob *		p;

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		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)));
			p = INT2PTR(Mob *,tmp);
		}
		else
			Perl_croak(aTHX_ "p is not of type Mob");
		if(p == nullptr)
			Perl_croak(aTHX_ "p is nullptr, avoiding crash.");

		RETVAL = THIS->CanAddHateForMob(p);
		ST(0) = boolSV(RETVAL);
		sv_2mortal(ST(0));
	}
	XSRETURN(1);
}

XS(XS_EntityList_Clear); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_Clear)
{
	dXSARGS;
	if (items != 1)
		Perl_croak(aTHX_ "Usage: EntityList::Clear(THIS)");
	{
		EntityList *		THIS;

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		THIS->Clear();
	}
	XSRETURN_EMPTY;
}

XS(XS_EntityList_RemoveMob); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_RemoveMob)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::RemoveMob(THIS, delete_id)");
	{
		EntityList *		THIS;
		bool		RETVAL;
		uint16		delete_id = (uint16)SvUV(ST(1));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		RETVAL = THIS->RemoveMob(delete_id);
		ST(0) = boolSV(RETVAL);
		sv_2mortal(ST(0));
	}
	XSRETURN(1);
}

XS(XS_EntityList_RemoveClient); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_RemoveClient)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::RemoveClient(THIS, delete_id)");
	{
		EntityList *		THIS;
		bool		RETVAL;
		uint16		delete_id = (uint16)SvUV(ST(1));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		RETVAL = THIS->RemoveClient(delete_id);
		ST(0) = boolSV(RETVAL);
		sv_2mortal(ST(0));
	}
	XSRETURN(1);
}

XS(XS_EntityList_RemoveNPC); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_RemoveNPC)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::RemoveNPC(THIS, delete_id)");
	{
		EntityList *		THIS;
		bool		RETVAL;
		uint16		delete_id = (uint16)SvUV(ST(1));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		RETVAL = THIS->RemoveNPC(delete_id);
		ST(0) = boolSV(RETVAL);
		sv_2mortal(ST(0));
	}
	XSRETURN(1);
}

XS(XS_EntityList_RemoveGroup); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_RemoveGroup)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::RemoveGroup(THIS, delete_id)");
	{
		EntityList *		THIS;
		bool		RETVAL;
		uint32		delete_id = (uint32)SvUV(ST(1));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		RETVAL = THIS->RemoveGroup(delete_id);
		ST(0) = boolSV(RETVAL);
		sv_2mortal(ST(0));
	}
	XSRETURN(1);
}

XS(XS_EntityList_RemoveCorpse); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_RemoveCorpse)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::RemoveCorpse(THIS, delete_id)");
	{
		EntityList *		THIS;
		bool		RETVAL;
		uint16		delete_id = (uint16)SvUV(ST(1));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		RETVAL = THIS->RemoveCorpse(delete_id);
		ST(0) = boolSV(RETVAL);
		sv_2mortal(ST(0));
	}
	XSRETURN(1);
}

XS(XS_EntityList_RemoveDoor); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_RemoveDoor)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::RemoveDoor(THIS, delete_id)");
	{
		EntityList *		THIS;
		bool		RETVAL;
		uint16		delete_id = (uint16)SvUV(ST(1));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		RETVAL = THIS->RemoveDoor(delete_id);
		ST(0) = boolSV(RETVAL);
		sv_2mortal(ST(0));
	}
	XSRETURN(1);
}

XS(XS_EntityList_RemoveTrap); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_RemoveTrap)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::RemoveTrap(THIS, delete_id)");
	{
		EntityList *		THIS;
		bool		RETVAL;
		uint16		delete_id = (uint16)SvUV(ST(1));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		RETVAL = THIS->RemoveTrap(delete_id);
		ST(0) = boolSV(RETVAL);
		sv_2mortal(ST(0));
	}
	XSRETURN(1);
}

XS(XS_EntityList_RemoveObject); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_RemoveObject)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::RemoveObject(THIS, delete_id)");
	{
		EntityList *		THIS;
		bool		RETVAL;
		uint16		delete_id = (uint16)SvUV(ST(1));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		RETVAL = THIS->RemoveObject(delete_id);
		ST(0) = boolSV(RETVAL);
		sv_2mortal(ST(0));
	}
	XSRETURN(1);
}

XS(XS_EntityList_RemoveAllMobs); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_RemoveAllMobs)
{
	dXSARGS;
	if (items != 1)
		Perl_croak(aTHX_ "Usage: EntityList::RemoveAllMobs(THIS)");
	{
		EntityList *		THIS;

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		THIS->RemoveAllMobs();
	}
	XSRETURN_EMPTY;
}

XS(XS_EntityList_RemoveAllClients); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_RemoveAllClients)
{
	dXSARGS;
	if (items != 1)
		Perl_croak(aTHX_ "Usage: EntityList::RemoveAllClients(THIS)");
	{
		EntityList *		THIS;

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		THIS->RemoveAllClients();
	}
	XSRETURN_EMPTY;
}

XS(XS_EntityList_RemoveAllNPCs); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_RemoveAllNPCs)
{
	dXSARGS;
	if (items != 1)
		Perl_croak(aTHX_ "Usage: EntityList::RemoveAllNPCs(THIS)");
	{
		EntityList *		THIS;

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		THIS->RemoveAllNPCs();
	}
	XSRETURN_EMPTY;
}

XS(XS_EntityList_RemoveAllGroups); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_RemoveAllGroups)
{
	dXSARGS;
	if (items != 1)
		Perl_croak(aTHX_ "Usage: EntityList::RemoveAllGroups(THIS)");
	{
		EntityList *		THIS;

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		THIS->RemoveAllGroups();
	}
	XSRETURN_EMPTY;
}

XS(XS_EntityList_RemoveAllCorpses); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_RemoveAllCorpses)
{
	dXSARGS;
	if (items != 1)
		Perl_croak(aTHX_ "Usage: EntityList::RemoveAllCorpses(THIS)");
	{
		EntityList *		THIS;

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		THIS->RemoveAllCorpses();
	}
	XSRETURN_EMPTY;
}

XS(XS_EntityList_RemoveAllDoors); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_RemoveAllDoors)
{
	dXSARGS;
	if (items != 1)
		Perl_croak(aTHX_ "Usage: EntityList::RemoveAllDoors(THIS)");
	{
		EntityList *		THIS;

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		THIS->RemoveAllDoors();
	}
	XSRETURN_EMPTY;
}

XS(XS_EntityList_RemoveAllTraps); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_RemoveAllTraps)
{
	dXSARGS;
	if (items != 1)
		Perl_croak(aTHX_ "Usage: EntityList::RemoveAllTraps(THIS)");
	{
		EntityList *		THIS;

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		THIS->RemoveAllTraps();
	}
	XSRETURN_EMPTY;
}

XS(XS_EntityList_RemoveAllObjects); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_RemoveAllObjects)
{
	dXSARGS;
	if (items != 1)
		Perl_croak(aTHX_ "Usage: EntityList::RemoveAllObjects(THIS)");
	{
		EntityList *		THIS;

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		THIS->RemoveAllObjects();
	}
	XSRETURN_EMPTY;
}

XS(XS_EntityList_Message); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_Message)
{
	dXSARGS;
	if (items < 4)
		Perl_croak(aTHX_ "Usage: EntityList::Message(THIS, to_guilddbid, type, message, ...)");
	{
		EntityList *		THIS;
		uint32		to_guilddbid = (uint32)SvUV(ST(1));
		uint32		type = (uint32)SvUV(ST(2));
		char*		message = (char *)SvPV_nolen(ST(3));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		THIS->Message(to_guilddbid, type, message);
	}
	XSRETURN_EMPTY;
}

XS(XS_EntityList_MessageStatus); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_MessageStatus)
{
	dXSARGS;
	if (items < 5)
		Perl_croak(aTHX_ "Usage: EntityList::MessageStatus(THIS, to_guilddbid, to_minstatus, type, message, ...)");
	{
		EntityList *		THIS;
		uint32		to_guilddbid = (uint32)SvUV(ST(1));
		int		to_minstatus = (int)SvIV(ST(2));
		uint32		type = (uint32)SvUV(ST(3));
		char*		message = (char *)SvPV_nolen(ST(4));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		THIS->MessageStatus(to_guilddbid, to_minstatus, type, message);
	}
	XSRETURN_EMPTY;
}

XS(XS_EntityList_MessageClose); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_MessageClose)
{
	dXSARGS;
	if (items < 6)
		Perl_croak(aTHX_ "Usage: EntityList::MessageClose(THIS, sender, skipsender, dist, type, message, ...)");
	{
		EntityList *		THIS;
		Mob*		sender;
		bool		skipsender = (bool)SvTRUE(ST(2));
		float		dist = (float)SvNV(ST(3));
		uint32		type = (uint32)SvUV(ST(4));
		char*		message = (char *)SvPV_nolen(ST(5));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		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
			Perl_croak(aTHX_ "sender is not of type Mob");
		if(sender == nullptr)
			Perl_croak(aTHX_ "sender is nullptr, avoiding crash.");

		THIS->MessageClose(sender, skipsender, dist, type, message);
	}
	XSRETURN_EMPTY;
}

XS(XS_EntityList_RemoveFromTargets); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_RemoveFromTargets)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::RemoveFromTargets(THIS, mob)");
	{
		EntityList *		THIS;
		Mob*		mob;

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		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)));
			mob = INT2PTR(Mob *,tmp);
		}
		else
			Perl_croak(aTHX_ "mob is not of type Mob");
		if(mob == nullptr)
			Perl_croak(aTHX_ "mob is nullptr, avoiding crash.");

		THIS->RemoveFromTargets(mob);
	}
	XSRETURN_EMPTY;
}

XS(XS_EntityList_ReplaceWithTarget); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_ReplaceWithTarget)
{
	dXSARGS;
	if (items != 3)
		Perl_croak(aTHX_ "Usage: EntityList::ReplaceWithTarget(THIS, pOldMob, pNewTarget)");
	{
		EntityList *		THIS;
		Mob*		pOldMob;
		Mob*		pNewTarget;

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		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)));
			pOldMob = INT2PTR(Mob *,tmp);
		}
		else
			Perl_croak(aTHX_ "pOldMob is not of type Mob");
		if(pOldMob == nullptr)
			Perl_croak(aTHX_ "pOldMob is nullptr, avoiding crash.");

		if (sv_derived_from(ST(2), "Mob")) {
			IV tmp = SvIV((SV*)SvRV(ST(2)));
			pNewTarget = INT2PTR(Mob *,tmp);
		}
		else
			Perl_croak(aTHX_ "pNewTarget is not of type Mob");
		if(pNewTarget == nullptr)
			Perl_croak(aTHX_ "pNewTarget is nullptr, avoiding crash.");

		THIS->ReplaceWithTarget(pOldMob, pNewTarget);
	}
	XSRETURN_EMPTY;
}

XS(XS_EntityList_OpenDoorsNear); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_OpenDoorsNear)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::OpenDoorsNear(THIS, opener)");
	{
		EntityList *		THIS;
		NPC*		opener;

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		if (sv_derived_from(ST(1), "NPC")) {
			IV tmp = SvIV((SV*)SvRV(ST(1)));
			opener = INT2PTR(NPC *,tmp);
		}
		else
			Perl_croak(aTHX_ "opener is not of type NPC");
		if(opener == nullptr)
			Perl_croak(aTHX_ "opener is nullptr, avoiding crash.");

		THIS->OpenDoorsNear(opener);
	}
	XSRETURN_EMPTY;
}

XS(XS_EntityList_MakeNameUnique); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_MakeNameUnique)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::MakeNameUnique(THIS, name)");
	{
		EntityList *		THIS;
		char *		RETVAL;
		dXSTARG;
		char*		name = (char *)SvPV_nolen(ST(1));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		RETVAL = THIS->MakeNameUnique(name);
		sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
	}
	XSRETURN(1);
}

XS(XS_EntityList_RemoveNumbers); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_RemoveNumbers)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::RemoveNumbers(CLASS, name)");
	{
		char *		RETVAL;
		dXSTARG;
		char*		name = (char *)SvPV_nolen(ST(1));

		RETVAL = EntityList::RemoveNumbers(name);
		sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
	}
	XSRETURN(1);
}

XS(XS_EntityList_SignalMobsByNPCID); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_SignalMobsByNPCID)
{
	dXSARGS;
	if (items != 3)
		Perl_croak(aTHX_ "Usage: EntityList::SignalMobsByNPCID(THIS, npc_type, signal_id)");
	{
		EntityList *		THIS;
		uint32		npc_type = (uint32)SvUV(ST(1));
		int		signal_id = (int)SvIV(ST(2));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		THIS->SignalMobsByNPCID(npc_type, signal_id);
	}
	XSRETURN_EMPTY;
}

XS(XS_EntityList_RemoveEntity); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_RemoveEntity)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::RemoveEntity(THIS, id)");
	{
		EntityList *		THIS;
		uint16		id = (uint16)SvUV(ST(1));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		THIS->RemoveEntity(id);
	}
	XSRETURN_EMPTY;
}

XS(XS_EntityList_DeleteNPCCorpses); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_DeleteNPCCorpses)
{
	dXSARGS;
	if (items != 1)
		Perl_croak(aTHX_ "Usage: EntityList::DeleteNPCCorpses(THIS)");
	{
		EntityList *		THIS;
		int32		RETVAL;
		dXSTARG;

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		RETVAL = THIS->DeleteNPCCorpses();
		XSprePUSH; PUSHi((IV)RETVAL);
	}
	XSRETURN(1);
}

XS(XS_EntityList_DeletePlayerCorpses); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_DeletePlayerCorpses)
{
	dXSARGS;
	if (items != 1)
		Perl_croak(aTHX_ "Usage: EntityList::DeletePlayerCorpses(THIS)");
	{
		EntityList *		THIS;
		int32		RETVAL;
		dXSTARG;

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		RETVAL = THIS->DeletePlayerCorpses();
		XSprePUSH; PUSHi((IV)RETVAL);
	}
	XSRETURN(1);
}

XS(XS_EntityList_HalveAggro); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_HalveAggro)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::HalveAggro(THIS, who)");
	{
		EntityList *		THIS;
		Mob*		who;

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		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->HalveAggro(who);
	}
	XSRETURN_EMPTY;
}

XS(XS_EntityList_DoubleAggro); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_DoubleAggro)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::DoubleAggro(THIS, who)");
	{
		EntityList *		THIS;
		Mob*		who;

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		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->DoubleAggro(who);
	}
	XSRETURN_EMPTY;
}

XS(XS_EntityList_ClearFeignAggro); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_ClearFeignAggro)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::ClearFeignAggro(THIS, targ)");
	{
		EntityList *		THIS;
		Mob*		targ;

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		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)));
			targ = INT2PTR(Mob *,tmp);
		}
		else
			Perl_croak(aTHX_ "targ is not of type Mob");
		if(targ == nullptr)
			Perl_croak(aTHX_ "targ is nullptr, avoiding crash.");

		THIS->ClearFeignAggro(targ);
	}
	XSRETURN_EMPTY;
}

XS(XS_EntityList_Fighting); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_Fighting)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::Fighting(THIS, targ)");
	{
		EntityList *		THIS;
		bool		RETVAL;
		Mob*		targ;

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		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)));
			targ = INT2PTR(Mob *,tmp);
		}
		else
			Perl_croak(aTHX_ "targ is not of type Mob");
		if(targ == nullptr)
			Perl_croak(aTHX_ "targ is nullptr, avoiding crash.");

		RETVAL = THIS->Fighting(targ);
		ST(0) = boolSV(RETVAL);
		sv_2mortal(ST(0));
	}
	XSRETURN(1);
}

XS(XS_EntityList_RemoveFromHateLists); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_RemoveFromHateLists)
{
	dXSARGS;
	if (items < 2 || items > 3)
		Perl_croak(aTHX_ "Usage: EntityList::RemoveFromHateLists(THIS, mob, settoone= false)");
	{
		EntityList *		THIS;
		Mob*		mob;
		bool		settoone;

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		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)));
			mob = INT2PTR(Mob *,tmp);
		}
		else
			Perl_croak(aTHX_ "mob is not of type Mob");
		if(mob == nullptr)
			Perl_croak(aTHX_ "mob is nullptr, avoiding crash.");

		if (items < 3)
			settoone = false;
		else {
			settoone = (bool)SvTRUE(ST(2));
		}

		THIS->RemoveFromHateLists(mob, settoone);
	}
	XSRETURN_EMPTY;
}

XS(XS_EntityList_MessageGroup); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_MessageGroup)
{
	dXSARGS;
	if (items < 5)
		Perl_croak(aTHX_ "Usage: EntityList::MessageGroup(THIS, sender, skipclose, type, message, ...)");
	{
		EntityList *		THIS;
		Mob*		sender;
		bool		skipclose = (bool)SvTRUE(ST(2));
		uint32		type = (uint32)SvUV(ST(3));
		char*		message = (char *)SvPV_nolen(ST(4));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");
		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
			Perl_croak(aTHX_ "sender is not of type Mob");
		if(sender == nullptr)
			Perl_croak(aTHX_ "sender is nullptr, avoiding crash.");

		THIS->MessageGroup(sender, skipclose, type, message);
	}
	XSRETURN_EMPTY;
}

XS(XS_EntityList_GetRandomClient); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_GetRandomClient)
{
	dXSARGS;
	if ((items < 5) || (items > 6))
		Perl_croak(aTHX_ "Usage: EntityList::GetRandomClient(THIS, x, y, z, distance, excludeclient = nullptr)");
	{
		EntityList *THIS;
		Client *RETVAL, *c = nullptr;
		float x = (float)SvNV(ST(1));
		float y = (float)SvNV(ST(2));
		float z = (float)SvNV(ST(3));
		float d = (float)SvNV(ST(4));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");

		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		if(items == 6)
		{
			if (sv_derived_from(ST(5), "Client")) {
				IV tmp = SvIV((SV*)SvRV(ST(5)));
				c = INT2PTR(Client *,tmp);
			}
		}
		RETVAL = entity_list.GetRandomClient(glm::vec3(x, y, z), d * d, c);
		ST(0) = sv_newmortal();
		sv_setref_pv(ST(0), "Client", (void*)RETVAL);
	}
	XSRETURN(1);
}

XS(XS_EntityList_GetMobList); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_GetMobList)
{
	dXSARGS;
	int num_mobs = 0;
	if (items != 1)
		Perl_croak(aTHX_ "Usage: EntityList::GetMobList(THIS)");
	{
		EntityList *THIS;

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");

		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		std::list<Mob*> mob_list;
		entity_list.GetMobList(mob_list);
		auto iter = mob_list.begin();

		while(iter != mob_list.end())
		{
			Mob *entry = (*iter);
			ST(0) = sv_newmortal();
			sv_setref_pv(ST(0), "Mob", (void*)entry);
			XPUSHs(ST(0));
			num_mobs++;
			iter++;
		}
	}
	XSRETURN(num_mobs);
}

XS(XS_EntityList_GetClientList); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_GetClientList)
{
	dXSARGS;
	int num_clients = 0;
	if (items != 1)
		Perl_croak(aTHX_ "Usage: EntityList::GetClientList(THIS)");
	{
		EntityList *THIS;

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");

		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		std::list<Client*> client_list;
		entity_list.GetClientList(client_list);
		auto iter = client_list.begin();

		while(iter != client_list.end())
		{
			Client *entry = (*iter);
			ST(0) = sv_newmortal();
			sv_setref_pv(ST(0), "Client", (void*)entry);
			XPUSHs(ST(0));
			num_clients++;
			iter++;
		}
	}
	XSRETURN(num_clients);
}

XS(XS_EntityList_GetNPCList); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_GetNPCList)
{
	dXSARGS;
	int num_npcs = 0;
	if (items != 1)
		Perl_croak(aTHX_ "Usage: EntityList::GetNPCList(THIS)");
	{
		EntityList *THIS;

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");

		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		std::list<NPC*> npc_list;
		entity_list.GetNPCList(npc_list);
		auto iter = npc_list.begin();

		while(iter != npc_list.end())
		{
			NPC *entry = (*iter);
			ST(0) = sv_newmortal();
			sv_setref_pv(ST(0), "NPC", (void*)entry);
			XPUSHs(ST(0));
			num_npcs++;
			iter++;
		}
	}
	XSRETURN(num_npcs);
}

XS(XS_EntityList_GetCorpseList); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_GetCorpseList)
{
	dXSARGS;
	int num_corpses = 0;
	if (items != 1)
		Perl_croak(aTHX_ "Usage: EntityList::GetCorpseList(THIS)");
	{
		EntityList *THIS;

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");

		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		std::list<Corpse*> corpse_list;
		entity_list.GetCorpseList(corpse_list);
		auto iter = corpse_list.begin();

		while(iter != corpse_list.end())
		{
			Corpse *entry = (*iter);
			ST(0) = sv_newmortal();
			sv_setref_pv(ST(0), "Corpse", (void*)entry);
			XPUSHs(ST(0));
			num_corpses++;
			iter++;
		}
	}
	XSRETURN(num_corpses);
}

XS(XS_EntityList_GetObjectList); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_GetObjectList)
{
	dXSARGS;
	int num_objects = 0;
	if (items != 1)
		Perl_croak(aTHX_ "Usage: EntityList::GetObjectList(THIS)");
	{
		EntityList *THIS;

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");

		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		std::list<Object*> object_list;
		entity_list.GetObjectList(object_list);
		auto iter = object_list.begin();

		while(iter != object_list.end())
		{
			Object *entry = (*iter);
			ST(0) = sv_newmortal();
			sv_setref_pv(ST(0), "Object", (void*)entry);
			XPUSHs(ST(0));
			num_objects++;
			iter++;
		}
	}
	XSRETURN(num_objects);
}

XS(XS_EntityList_GetDoorsList); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_GetDoorsList)
{
	dXSARGS;
	int num_objects = 0;
	if (items != 1)
		Perl_croak(aTHX_ "Usage: EntityList::GetDoorsList(THIS)");
	{
		EntityList *THIS;

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");

		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		std::list<Doors*> door_list;
		entity_list.GetDoorsList(door_list);
		auto iter = door_list.begin();

		while(iter != door_list.end())
		{
			Doors *entry = (*iter);
			ST(0) = sv_newmortal();
			sv_setref_pv(ST(0), "Doors", (void*)entry);
			XPUSHs(ST(0));
			num_objects++;
			iter++;
		}
	}
	XSRETURN(num_objects);
}

XS(XS_EntityList_SignalAllClients); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_SignalAllClients)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: EntityList::SignalAllClients(THIS, data)");
	{
		EntityList *THIS;
		uint32 data = (uint32)SvUV(ST(1));

		if (sv_derived_from(ST(0), "EntityList")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(EntityList *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type EntityList");

		if(THIS == nullptr)
			Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");

		entity_list.SignalAllClients(data);
	}
	XSRETURN_EMPTY;
}

#ifdef __cplusplus
extern "C"
#endif
XS(boot_EntityList); /* prototype to pass -Wmissing-prototypes */
XS(boot_EntityList)
{
	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, "GetMobID"), XS_EntityList_GetMobID, file, "$$");
		newXSproto(strcpy(buf, "GetMob"), XS_EntityList_GetMob, file, "$$");
		newXSproto(strcpy(buf, "GetMobByID"), XS_EntityList_GetMobByID, file, "$$");
		newXSproto(strcpy(buf, "GetMobByNpcTypeID"), XS_EntityList_GetMobByNpcTypeID, file, "$$");
		newXSproto(strcpy(buf, "IsMobSpawnedByNpcTypeID"), XS_EntityList_IsMobSpawnedByNpcTypeID, file, "$$");
		newXSproto(strcpy(buf, "GetNPCByID"), XS_EntityList_GetNPCByID, file, "$$");
		newXSproto(strcpy(buf, "GetNPCByNPCTypeID"), XS_EntityList_GetNPCByNPCTypeID, file, "$$");
		newXSproto(strcpy(buf, "GetClientByName"), XS_EntityList_GetClientByName, file, "$$");
		newXSproto(strcpy(buf, "GetClientByAccID"), XS_EntityList_GetClientByAccID, file, "$$");
		newXSproto(strcpy(buf, "GetClientByID"), XS_EntityList_GetClientByID, file, "$$");
		newXSproto(strcpy(buf, "GetClientByCharID"), XS_EntityList_GetClientByCharID, file, "$$");
		newXSproto(strcpy(buf, "GetClientByWID"), XS_EntityList_GetClientByWID, file, "$$");
		newXSproto(strcpy(buf, "GetObjectByID"), XS_EntityList_GetObjectByID, file, "$");
		newXSproto(strcpy(buf, "GetObjectByDBID"), XS_EntityList_GetObjectByDBID, file, "$");
		newXSproto(strcpy(buf, "GetDoorsByID"), XS_EntityList_GetDoorsByID, file, "$$");
		newXSproto(strcpy(buf, "GetDoorsByDBID"), XS_EntityList_GetDoorsByDBID, file, "$$");
		newXSproto(strcpy(buf, "GetDoorsByDoorID"), XS_EntityList_GetDoorsByDoorID, file, "$$");
		newXSproto(strcpy(buf, "FindDoor"), XS_EntityList_FindDoor, file, "$$");
		newXSproto(strcpy(buf, "GetGroupByMob"), XS_EntityList_GetGroupByMob, file, "$$");
		newXSproto(strcpy(buf, "GetGroupByClient"), XS_EntityList_GetGroupByClient, file, "$$");
		newXSproto(strcpy(buf, "GetGroupByID"), XS_EntityList_GetGroupByID, file, "$$");
		newXSproto(strcpy(buf, "GetGroupByLeaderName"), XS_EntityList_GetGroupByLeaderName, file, "$$");
		newXSproto(strcpy(buf, "GetRaidByID"), XS_EntityList_GetRaidByID, file, "$$");
		newXSproto(strcpy(buf, "GetRaidByClient"), XS_EntityList_GetRaidByClient, file, "$$");
		newXSproto(strcpy(buf, "GetCorpseByOwner"), XS_EntityList_GetCorpseByOwner, file, "$$");
		newXSproto(strcpy(buf, "GetCorpseByID"), XS_EntityList_GetCorpseByID, file, "$$");
		newXSproto(strcpy(buf, "GetCorpseByName"), XS_EntityList_GetCorpseByName, file, "$$");
		newXSproto(strcpy(buf, "ClearClientPetitionQueue"), XS_EntityList_ClearClientPetitionQueue, file, "$");
		newXSproto(strcpy(buf, "CanAddHateForMob"), XS_EntityList_CanAddHateForMob, file, "$$");
		newXSproto(strcpy(buf, "Clear"), XS_EntityList_Clear, file, "$");
		newXSproto(strcpy(buf, "RemoveMob"), XS_EntityList_RemoveMob, file, "$$");
		newXSproto(strcpy(buf, "RemoveClient"), XS_EntityList_RemoveClient, file, "$$");
		newXSproto(strcpy(buf, "RemoveNPC"), XS_EntityList_RemoveNPC, file, "$$");
		newXSproto(strcpy(buf, "RemoveGroup"), XS_EntityList_RemoveGroup, file, "$$");
		newXSproto(strcpy(buf, "RemoveCorpse"), XS_EntityList_RemoveCorpse, file, "$$");
		newXSproto(strcpy(buf, "RemoveDoor"), XS_EntityList_RemoveDoor, file, "$$");
		newXSproto(strcpy(buf, "RemoveTrap"), XS_EntityList_RemoveTrap, file, "$$");
		newXSproto(strcpy(buf, "RemoveObject"), XS_EntityList_RemoveObject, file, "$$");
		newXSproto(strcpy(buf, "RemoveAllMobs"), XS_EntityList_RemoveAllMobs, file, "$");
		newXSproto(strcpy(buf, "RemoveAllClients"), XS_EntityList_RemoveAllClients, file, "$");
		newXSproto(strcpy(buf, "RemoveAllNPCs"), XS_EntityList_RemoveAllNPCs, file, "$");
		newXSproto(strcpy(buf, "RemoveAllGroups"), XS_EntityList_RemoveAllGroups, file, "$");
		newXSproto(strcpy(buf, "RemoveAllCorpses"), XS_EntityList_RemoveAllCorpses, file, "$");
		newXSproto(strcpy(buf, "RemoveAllDoors"), XS_EntityList_RemoveAllDoors, file, "$");
		newXSproto(strcpy(buf, "RemoveAllTraps"), XS_EntityList_RemoveAllTraps, file, "$");
		newXSproto(strcpy(buf, "RemoveAllObjects"), XS_EntityList_RemoveAllObjects, file, "$");
		newXSproto(strcpy(buf, "Message"), XS_EntityList_Message, file, "$$$$;@");
		newXSproto(strcpy(buf, "MessageStatus"), XS_EntityList_MessageStatus, file, "$$$$$;@");
		newXSproto(strcpy(buf, "MessageClose"), XS_EntityList_MessageClose, file, "$$$$$$;@");
		newXSproto(strcpy(buf, "RemoveFromTargets"), XS_EntityList_RemoveFromTargets, file, "$$");
		newXSproto(strcpy(buf, "ReplaceWithTarget"), XS_EntityList_ReplaceWithTarget, file, "$$$");
		newXSproto(strcpy(buf, "OpenDoorsNear"), XS_EntityList_OpenDoorsNear, file, "$$");
		newXSproto(strcpy(buf, "MakeNameUnique"), XS_EntityList_MakeNameUnique, file, "$$");
		newXSproto(strcpy(buf, "RemoveNumbers"), XS_EntityList_RemoveNumbers, file, "$$");
		newXSproto(strcpy(buf, "SignalMobsByNPCID"), XS_EntityList_SignalMobsByNPCID, file, "$$$");
		newXSproto(strcpy(buf, "RemoveEntity"), XS_EntityList_RemoveEntity, file, "$$");
		newXSproto(strcpy(buf, "DeleteNPCCorpses"), XS_EntityList_DeleteNPCCorpses, file, "$");
		newXSproto(strcpy(buf, "DeletePlayerCorpses"), XS_EntityList_DeletePlayerCorpses, file, "$");
		newXSproto(strcpy(buf, "HalveAggro"), XS_EntityList_HalveAggro, file, "$$");
		newXSproto(strcpy(buf, "DoubleAggro"), XS_EntityList_DoubleAggro, file, "$$");
		newXSproto(strcpy(buf, "ClearFeignAggro"), XS_EntityList_ClearFeignAggro, file, "$$");
		newXSproto(strcpy(buf, "Fighting"), XS_EntityList_Fighting, file, "$$");
		newXSproto(strcpy(buf, "RemoveFromHateLists"), XS_EntityList_RemoveFromHateLists, file, "$$;$");
		newXSproto(strcpy(buf, "MessageGroup"), XS_EntityList_MessageGroup, file, "$$$$$;@");
		newXSproto(strcpy(buf, "GetRandomClient"), XS_EntityList_GetRandomClient, file, "$$$$$;$");
		newXSproto(strcpy(buf, "GetMobList"), XS_EntityList_GetMobList, file, "$");
		newXSproto(strcpy(buf, "GetClientList"), XS_EntityList_GetClientList, file, "$");
		newXSproto(strcpy(buf, "GetNPCList"), XS_EntityList_GetNPCList, file, "$");
		newXSproto(strcpy(buf, "GetCorpseList"), XS_EntityList_GetCorpseList, file, "$");
		newXSproto(strcpy(buf, "GetObjectList"), XS_EntityList_GetObjectList, file, "$");
		newXSproto(strcpy(buf, "GetDoorsList"), XS_EntityList_GetDoorsList, file, "$");
		newXSproto(strcpy(buf, "SignalAllClients"), XS_EntityList_SignalAllClients, file, "$$");
	XSRETURN_YES;
}

#endif //EMBPERL_XS_CLASSES

