EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Plugins & Mods (https://www.eqemulator.org/forums/forumdisplay.php?f=678)
-   -   Task Plugins (https://www.eqemulator.org/forums/showthread.php?t=33757)

Akkadius 06-28-2011 01:06 AM

Task Plugins
 
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;


mamba700 02-23-2012 02:21 PM

I was playing around with this plugin for a group task.

Here is what worked for me.

plugin::AssignTask("group", 254, ($npc->GetID()));

I had to put group in quotes. I originally tried "UpdateType=group" and that didn't work.

254 is my task ID -

for NPC I originally just put in the ID number of the NPC I am not sure why but using ($npc->GetID()) worked instead.


I just tought I would share for those of you trying to use this plugin. It is great especially when you want to implement raid or group tasks. Doing individual tasks was no problem, but I wanted to implement some group and raid tasks on my server.

Thank You very much Akkadius for all of your contributions to the EQEMU community.


All times are GMT -4. The time now is 04:29 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.