Wrote these to support a work around for Group/Raid based Task assigning, updating and failing for now with what I am currently working on with at the moment. I look to add more functions to support group and raid but am posting these for now. These are all functional, tested and committed to plugins SVN.
*Added support for the raid switch, by using "raid" it will default to group updates if there is no raid existing at the time so you do not have to rework your scripts.
Note: these plugins will update the group or raid that the client triggered these on. For example, if Player A picked up a ground object and triggered
sub EVENT_PLAYER_PICKUP , it will update throughout all players in relation to the triggerer.
*Requires Revision 1953
###UpdateTaskActivity(UpdateType=[solo, group, raid], TaskID, ActivityID, Count);
###AssignTask(UpdateType=[solo, group, raid], TaskID, [NPCID = 0] ($npc->GetID());
###FailTask(UpdateType=[solo, group, raid], TaskID);
Code:
###Akkadius###
###AssignTask(UpdateType=[solo, group, raid], TaskID, [NPCID = 0] ($npc->GetID());
sub AssignTask{
my $UT = $_[0];
my $TaskID = $_[1];
my $NPCID = $_[2] || 0;
my $client = plugin::val('$client');
my $npc = plugin::val('$npc');
my $entity_list = plugin::val('$entity_list');
my $name = plugin::val('$name');
if($UT eq "solo"){
$client->AssignTask($TaskID, $NPCID);
}
if($UT eq "group"){
my $group = $client->GetGroup();
if($group)
{
for($count = 0; $count < 6; $count++)
{
my $cur = $group->GetMember($count);
if($cur)
{
if($cur->IsClient())
{
$cur->AssignTask($TaskID, $NPCID);
}
}
}
}
}
if($UT eq "raid"){
my $raid = $client->GetRaid();
if($raid)
{
for($count = 0; $count < 72; $count++)
{
my $cur = $raid->GetMember($count);
if($cur)
{
if($cur->IsClient())
{
$cur->AssignTask($TaskID, $NPCID);
}
}
}
}
my $group = $client->GetGroup();
if($group && !$raid)
{
for($count = 0; $count < 6; $count++)
{
my $cur = $group->GetMember($count);
if($cur)
{
if($cur->IsClient())
{
$cur->AssignTask($TaskID, $NPCID);
}
}
}
}
}
}
###FailTask(UpdateType=[solo, group, raid], TaskID);
sub FailTask{
my $UT = $_[0];
my $TaskID = $_[1];
my $client = plugin::val('$client');
my $npc = plugin::val('$npc');
my $entity_list = plugin::val('$entity_list');
my $name = plugin::val('$name');
if($UT eq "solo"){
$client->FailTask($TaskID);
}
if($UT eq "group"){
my $group = $client->GetGroup();
if($group)
{
for($count = 0; $count < 6; $count++)
{
my $cur = $group->GetMember($count);
if($cur)
{
if($cur->IsClient())
{
$cur->FailTask($TaskID);
}
}
}
}
}
if($UT eq "raid"){
my $raid = $client->GetRaid();
if($raid)
{
for($count = 0; $count < 72; $count++)
{
my $cur = $raid->GetMember($count);
if($cur)
{
if($cur->IsClient())
{
$cur->FailTask($TaskID);
}
}
}
}
my $group = $client->GetGroup();
if($group && !$raid)
{
for($count = 0; $count < 6; $count++)
{
my $cur = $group->GetMember($count);
if($cur)
{
if($cur->IsClient())
{
$cur->AssignTask($TaskID, $NPCID);
}
}
}
}
}
}
###UpdateTaskActivity(UpdateType=[solo, group, raid], TaskID, ActivityID, Count);
sub UpdateTaskActivity{
my $UT = $_[0];
my $TaskID = $_[1];
my $ActivityID = $_[2];
my $TCount = $_[3];
my $client = plugin::val('$client');
my $npc = plugin::val('$npc');
my $entity_list = plugin::val('$entity_list');
my $name = plugin::val('$name');
if($UT eq "solo"){
$client->UpdateTaskActivity($TaskID, $ActivityID, $TCount);
}
if($UT eq "group"){
my $group = $client->GetGroup();
if($group)
{
for($count = 0; $count < 6; $count++)
{
my $cur = $group->GetMember($count);
if($cur)
{
if($cur->IsClient())
{
$cur->UpdateTaskActivity($TaskID, $ActivityID, $TCount);
}
}
}
}
}
if($UT eq "raid"){
my $raid = $client->GetRaid();
if($raid)
{
for($count = 0; $count < 72; $count++)
{
my $cur = $raid->GetMember($count);
if($cur)
{
if($cur->IsClient())
{
$cur->UpdateTaskActivity($TaskID, $ActivityID, $TCount);
}
}
}
}
my $group = $client->GetGroup();
if($group && !$raid)
{
for($count = 0; $count < 6; $count++)
{
my $cur = $group->GetMember($count);
if($cur)
{
if($cur->IsClient())
{
$cur->AssignTask($TaskID, $NPCID);
}
}
}
}
}
}
return 1;