mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-11 03:31:08 +00:00
[Quest API] Add GetBotListByCharacterID() to Perl/Lua. (#2069)
This commit is contained in:
+32
-1
@@ -1347,6 +1347,35 @@ XS(XS_EntityList_GetBotList) {
|
||||
XSRETURN(bot_count);
|
||||
}
|
||||
|
||||
XS(XS_EntityList_GetBotListByCharacterID);
|
||||
XS(XS_EntityList_GetBotListByCharacterID) {
|
||||
dXSARGS;
|
||||
if (items != 2) {
|
||||
Perl_croak(aTHX_ "Usage: EntityList::GetBotListByCharacterID(THIS, uint32 character_id)"); // @categories Script Utility, Bot
|
||||
}
|
||||
|
||||
EntityList *THIS;
|
||||
uint32 character_id = (uint32) SvUV(ST(1));
|
||||
VALIDATE_THIS_IS_ENTITY;
|
||||
|
||||
auto current_bot_list = THIS->GetBotListByCharacterID(character_id);
|
||||
auto bot_count = current_bot_list.size();
|
||||
|
||||
if (bot_count) {
|
||||
EXTEND(sp, bot_count);
|
||||
for (int index = 0; index < bot_count; ++index) {
|
||||
ST(index) = sv_newmortal();
|
||||
sv_setref_pv(ST(index), "Bot", (void *) current_bot_list[index]);
|
||||
XPUSHs(ST(index));
|
||||
}
|
||||
XSRETURN(bot_count);
|
||||
}
|
||||
|
||||
SV* return_value = &PL_sv_undef;
|
||||
ST(0) = return_value;
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS_EntityList_GetBotListByClientName);
|
||||
XS(XS_EntityList_GetBotListByClientName) {
|
||||
dXSARGS;
|
||||
@@ -1361,7 +1390,7 @@ XS(XS_EntityList_GetBotListByClientName) {
|
||||
auto current_bot_list = THIS->GetBotListByClientName(client_name);
|
||||
auto bot_count = current_bot_list.size();
|
||||
|
||||
if (bot_count > 0) {
|
||||
if (bot_count) {
|
||||
EXTEND(sp, bot_count);
|
||||
for (int index = 0; index < bot_count; ++index) {
|
||||
ST(index) = sv_newmortal();
|
||||
@@ -1370,6 +1399,7 @@ XS(XS_EntityList_GetBotListByClientName) {
|
||||
}
|
||||
XSRETURN(bot_count);
|
||||
}
|
||||
|
||||
SV* return_value = &PL_sv_undef;
|
||||
ST(0) = return_value;
|
||||
XSRETURN(1);
|
||||
@@ -1576,6 +1606,7 @@ XS(boot_EntityList) {
|
||||
newXSproto(strcpy(buf, "GetBotByID"), XS_EntityList_GetBotByID, file, "$$");
|
||||
newXSproto(strcpy(buf, "GetBotByName"), XS_EntityList_GetBotByName, file, "$$");
|
||||
newXSproto(strcpy(buf, "GetBotList"), XS_EntityList_GetBotList, file, "$");
|
||||
newXSproto(strcpy(buf, "GetBotListByCharacterID"), XS_EntityList_GetBotListByCharacterID, file, "$$");
|
||||
newXSproto(strcpy(buf, "GetBotListByClientName"), XS_EntityList_GetBotListByClientName, file, "$$");
|
||||
#endif
|
||||
newXSproto(strcpy(buf, "GetClientByAccID"), XS_EntityList_GetClientByAccID, file, "$$");
|
||||
|
||||
Reference in New Issue
Block a user