Export of additional instance functions to perl as per #128.

Change QuestManager RemoveAllFromInstance function to use existing function to remove all clients from instance.
This commit is contained in:
JJ
2014-11-02 20:43:47 -05:00
parent b4576435e3
commit 4bd41b3678
5 changed files with 118 additions and 34 deletions
+71 -9
View File
@@ -2859,14 +2859,49 @@ XS(XS__GetInstanceID) {
XSRETURN_UV(id);
}
XS(XS__GetCharactersInInstance);
XS(XS__GetCharactersInInstance) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: GetCharactersInInstance(instance_id)");
dXSTARG;
Const_char * RETVAL;
uint16 instance_id = (int)SvUV(ST(0));
std::list<uint32> charid_list;
std::string charid_string;
database.GetCharactersInInstance(instance_id, charid_list);
if (charid_list.size() > 0)
{
charid_string = itoa(charid_list.size());
charid_string += " player(s) in instance. CharID list: ";
auto iter = charid_list.begin();
while (iter != charid_list.end())
{
charid_string += itoa(*iter);
++iter;
if (iter != charid_list.end())
charid_string += ", ";
}
RETVAL = charid_string.c_str();
}
else
RETVAL = "No players in that instance.";
sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
XSRETURN(1);
}
XS(XS__AssignToInstance);
XS(XS__AssignToInstance) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: AssignToInstance(id)");
Perl_croak(aTHX_ "Usage: AssignToInstance(instance_id)");
uint16 id = (int)SvUV(ST(0));
quest_manager.AssignToInstance(id);
uint16 instance_id = (int)SvUV(ST(0));
quest_manager.AssignToInstance(instance_id);
XSRETURN_EMPTY;
}
@@ -2875,10 +2910,10 @@ XS(XS__AssignGroupToInstance);
XS(XS__AssignGroupToInstance) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: AssignGroupToInstance(id)");
Perl_croak(aTHX_ "Usage: AssignGroupToInstance(instance_id)");
uint16 id = (int)SvUV(ST(0));
quest_manager.AssignGroupToInstance(id);
uint16 instance_id = (int)SvUV(ST(0));
quest_manager.AssignGroupToInstance(instance_id);
XSRETURN_EMPTY;
}
@@ -2887,10 +2922,34 @@ XS(XS__AssignRaidToInstance);
XS(XS__AssignRaidToInstance) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: AssignRaidToInstance(id)");
Perl_croak(aTHX_ "Usage: AssignRaidToInstance(instance_id)");
uint16 id = (int)SvUV(ST(0));
quest_manager.AssignRaidToInstance(id);
uint16 instance_id = (int)SvUV(ST(0));
quest_manager.AssignRaidToInstance(instance_id);
XSRETURN_EMPTY;
}
XS(XS__RemoveFromInstance);
XS(XS__RemoveFromInstance) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: RemoveFromInstance(instance_id)");
uint16 instance_id = (int)SvUV(ST(0));
quest_manager.RemoveFromInstance(instance_id);
XSRETURN_EMPTY;
}
XS(XS__RemoveAllFromInstance);
XS(XS__RemoveAllFromInstance) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: RemoveAllFromInstance(instance_id)");
uint16 instance_id = (int)SvUV(ST(0));
quest_manager.RemoveAllFromInstance(instance_id);
XSRETURN_EMPTY;
}
@@ -3628,9 +3687,12 @@ EXTERN_C XS(boot_quest)
newXS(strcpy(buf, "CreateInstance"), XS__CreateInstance, file);
newXS(strcpy(buf, "DestroyInstance"), XS__DestroyInstance, file);
newXS(strcpy(buf, "GetInstanceID"), XS__GetInstanceID, file);
newXS(strcpy(buf, "GetCharactersInInstance"), XS__GetCharactersInInstance, file);
newXS(strcpy(buf, "AssignToInstance"), XS__AssignToInstance, file);
newXS(strcpy(buf, "AssignGroupToInstance"), XS__AssignGroupToInstance, file);
newXS(strcpy(buf, "AssignRaidToInstance"), XS__AssignRaidToInstance, file);
newXS(strcpy(buf, "RemoveFromInstance"), XS__RemoveFromInstance, file);
newXS(strcpy(buf, "RemoveAllFromInstance"), XS__RemoveAllFromInstance, file);
newXS(strcpy(buf, "MovePCInstance"), XS__MovePCInstance, file);
newXS(strcpy(buf, "FlagInstanceByGroupLeader"), XS__FlagInstanceByGroupLeader, file);
newXS(strcpy(buf, "FlagInstanceByRaidLeader"), XS__FlagInstanceByRaidLeader, file);