mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-03 21:56:36 +00:00
[Quest API] Add TaskSelector to Perl/Lua. (#2177)
- Add $client->TaskSelector(task_list) to Perl.
- Add client:TaskSelector({task_list}) to Lua.
- Allow $client->AssignTask(task_id) in Perl.
- Allow client:AssignTask(task_id) in Lua.
- Can now assign tasks in scripts without the NPC ID parameter.
This commit is contained in:
+36
-11
@@ -3861,20 +3861,24 @@ XS(XS_Client_GetTaskActivityDoneCount) {
|
||||
XS(XS_Client_AssignTask); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_AssignTask) {
|
||||
dXSARGS;
|
||||
if (items != 3 && items != 4)
|
||||
Perl_croak(aTHX_ "Usage: Client::AssignTask(THIS, int task_id, int npc_id, [bool enforce_level_requirement = false])"); // @categories Tasks and Activities
|
||||
if (items < 2 || items > 4)
|
||||
Perl_croak(aTHX_ "Usage: Client::AssignTask(THIS, int task_id, [int npc_id = 0, bool enforce_level_requirement = false])"); // @categories Tasks and Activities
|
||||
{
|
||||
Client *THIS;
|
||||
int TaskID = (int) SvIV(ST(1));
|
||||
int NPCID = (int) SvIV(ST(2));
|
||||
int task_id = (int) SvIV(ST(1));
|
||||
int npc_id = 0;
|
||||
bool enforce_level_requirement = false;
|
||||
if (items == 4) {
|
||||
if ((int) SvIV(ST(3)) == 1) {
|
||||
enforce_level_requirement = true;
|
||||
}
|
||||
}
|
||||
VALIDATE_THIS_IS_CLIENT;
|
||||
THIS->AssignTask(TaskID, NPCID, enforce_level_requirement);
|
||||
|
||||
if (items > 2) {
|
||||
npc_id = (int) SvIV(ST(2));
|
||||
}
|
||||
|
||||
if (items > 3) {
|
||||
enforce_level_requirement = SvTRUE(ST(3));
|
||||
}
|
||||
|
||||
THIS->AssignTask(task_id, npc_id, enforce_level_requirement);
|
||||
}
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
@@ -6366,6 +6370,26 @@ XS(XS_Client_GetSpellDamage) {
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS_Client_TaskSelector); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_TaskSelector) {
|
||||
dXSARGS;
|
||||
if (items < 2 || items > 41) {
|
||||
Perl_croak(aTHX_ "Usage: Client::TaskSelector(THIS, int task_id, 2, 3, 4, 5 [up to 40])");
|
||||
}
|
||||
|
||||
Client *THIS;
|
||||
VALIDATE_THIS_IS_CLIENT;
|
||||
|
||||
int tasks[MAXCHOOSERENTRIES];
|
||||
int task_count = (items - 1);
|
||||
for (int i = 1; i <= task_count; i++) {
|
||||
tasks[i] = (int) SvIV(ST(i));
|
||||
}
|
||||
|
||||
THIS->TaskQuestSetSelector(THIS, task_count, tasks);
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
@@ -6400,7 +6424,7 @@ XS(boot_Client) {
|
||||
newXSproto(strcpy(buf, "AddPVPPoints"), XS_Client_AddPVPPoints, file, "$$");
|
||||
newXSproto(strcpy(buf, "AddSkill"), XS_Client_AddSkill, file, "$$$");
|
||||
newXSproto(strcpy(buf, "Admin"), XS_Client_Admin, file, "$");
|
||||
newXSproto(strcpy(buf, "AssignTask"), XS_Client_AssignTask, file, "$$$;$");
|
||||
newXSproto(strcpy(buf, "AssignTask"), XS_Client_AssignTask, file, "$$;$$");
|
||||
newXSproto(strcpy(buf, "AssignToInstance"), XS_Client_AssignToInstance, file, "$$");
|
||||
newXSproto(strcpy(buf, "AutoSplitEnabled"), XS_Client_AutoSplitEnabled, file, "$");
|
||||
newXSproto(strcpy(buf, "BreakInvis"), XS_Client_BreakInvis, file, "$");
|
||||
@@ -6692,6 +6716,7 @@ XS(boot_Client) {
|
||||
newXSproto(strcpy(buf, "TGB"), XS_Client_TGB, file, "$");
|
||||
newXSproto(strcpy(buf, "TakeMoneyFromPP"), XS_Client_TakeMoneyFromPP, file, "$$;$");
|
||||
newXSproto(strcpy(buf, "TakePlatinum"), XS_Client_TakePlatinum, file, "$$;$");
|
||||
newXSproto(strcpy(buf, "TaskSelector"), XS_Client_TaskSelector, file, "$$;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$");
|
||||
newXSproto(strcpy(buf, "Thirsty"), XS_Client_Thirsty, file, "$");
|
||||
newXSproto(strcpy(buf, "TrainDiscBySpellID"), XS_Client_TrainDiscBySpellID, file, "$$");
|
||||
newXSproto(strcpy(buf, "UnFreeze"), XS_Client_UnFreeze, file, "$");
|
||||
|
||||
Reference in New Issue
Block a user