Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Plugins & Mods

Quests::Plugins & Mods Completed plugins for public use as well as modifications.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 06-28-2011, 01:06 AM
Akkadius's Avatar
Akkadius
Administrator
 
Join Date: Feb 2009
Location: MN
Posts: 2,072
Default 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;

Last edited by Akkadius; 06-28-2011 at 01:22 AM.. Reason: Code changes
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 11:22 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3