[Tasks] Make Task Selector Cooldown Optional (#2420)

Some live npcs ignore the request cooldown timer (tutorialb)

A separate function had to be used for perl because the apis use an
array instead of array reference which won't allow a bool overload

This also replaces the fixed array and count args with a vector
This commit is contained in:
hg
2022-09-03 13:20:03 -04:00
committed by GitHub
parent 5e9a9e8afe
commit aa3c72c1de
10 changed files with 120 additions and 112 deletions
+15 -6
View File
@@ -2407,16 +2407,24 @@ int Perl_Client_GetSpellDamage(Client* self)
void Perl_Client_TaskSelector(Client* self, perl::array task_ids)
{
int tasks[MAXCHOOSERENTRIES] = { 0 };
int task_count = 0;
std::vector<int> tasks;
for (int i = 0; i < task_ids.size() && i < MAXCHOOSERENTRIES; ++i)
{
tasks[i] = task_ids[i];
++task_count;
tasks.push_back(task_ids[i]);
}
self->TaskQuestSetSelector(self, task_count, tasks);
self->TaskQuestSetSelector(self, tasks, false);
}
void Perl_Client_TaskSelectorNoCooldown(Client* self, perl::array task_ids)
{
std::vector<int> tasks;
for (int i = 0; i < task_ids.size() && i < MAXCHOOSERENTRIES; ++i)
{
tasks.push_back(task_ids[i]);
}
self->TaskQuestSetSelector(self, tasks, true);
}
bool Perl_Client_TeleportToPlayerByCharacterID(Client* self, uint32 character_id)
@@ -2872,6 +2880,7 @@ void perl_register_client()
package.add("TeleportRaidToPlayerByCharID", &Perl_Client_TeleportRaidToPlayerByCharacterID);
package.add("TeleportRaidToPlayerByName", &Perl_Client_TeleportRaidToPlayerByName);
package.add("TaskSelector", &Perl_Client_TaskSelector);
package.add("TaskSelectorNoCooldown", &Perl_Client_TaskSelectorNoCooldown);
package.add("Thirsty", &Perl_Client_Thirsty);
package.add("TrainDiscBySpellID", &Perl_Client_TrainDiscBySpellID);
package.add("UnFreeze", &Perl_Client_UnFreeze);