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

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

Reply
 
Thread Tools Display Modes
  #1  
Old 09-10-2010, 06:00 PM
Akkadius's Avatar
Akkadius
Administrator
 
Join Date: Feb 2009
Location: MN
Posts: 2,071
Default Awesome-O plugin::QuestHandIn

In the content expansion that is due to come out for Blood of the Akkadian, there is a quest that involves two tiers of 112 pieces of visible armor each for each individual class (so 224 armor pieces). These are obtained through gathering several pieces all over the world and named spawns in various zones of Kunark with our own developed backstory etc.

For some people who care, Blood of the Akkadian is young in its prowress and is only living a small population simply because of the limited solo content available. This is due to our own custom numberset and failure to be able to envision content beyond that time, hence me not announcing it at all as of yet. That's all about to change.

Instead of writing huge huge bricks of code to achieve this, I wrote a plugin that will easily manage this hassle and I will explain how it works.

The reason why me and Trevius specifically make plugins is because it consolidates bigger functions and brings them down to simple forms of one line commands. We like to share them with the community because it makes the community stronger to share their work. So in this case all you have to do is declare how many separate items you want to use and enter them in as shown in the example.

Code:
###Usage: plugin::QuestHandIn(ItemRewardID, RewardMessageofNPC, NPCAnimation, Case(How many separate items you want handed in) ItemID1, HowManyItem1, [ItemID2, HowManyItem2, ItemID3, HowManyItem3, ItemID4, HowManyItem4]);
Only having 1 item is required, hence the [brackets] around item 2 and above, those are optional.

The case stands for how many separate items you require, so if you have 2 separate items in your quest, you need to put 2 in the case variable.

Here the plugin itself, you can get my animation plugin here: http://www.eqemulator.org/forums/showthread.php?t=31241

Code:
###Akkadius from Blood of the Akkadian####
###Usage: plugin::QuestHandIn(ItemRewardID, RewardMessageofNPC, NPCAnimation, Case(How many separate items you want handed in) ItemID1, HowManyItem1, [ItemID2, HowManyItem2, ItemID3, HowManyItem3, ItemID4, HowManyItem4]);
###This plugin requires my DoAnim plugin to function properly with the animation function
sub QuestHandIn{
        my $npc = plugin::val('$npc');
        my $client = plugin::val('$client');
        my $name = plugin::val('$name');
        my $itemcount = plugin::var('itemcount');
        my $ulevel = plugin::val('$ulevel');
        my $npc_name = $npc->GetCleanName();
        my $Item1 = 0;
        my $Item2 = 0;
        my $Item3 = 0;
        my $Item4 = 0;
        my $RewardID = $_[0];
        my $NPCMESSAGE = $_[1];
        my $NPCANIMATION = $_[2];
        my $CaseItems = $_[3];
        my $Item1 = $_[4];
        my $ItemCount1 = $_[5];
        my $Item2 = $_[6];
        my $ItemCount2 = $_[7];
        my $Item3 = $_[8];
        my $ItemCount3 = $_[9];
        my $Item4 = $_[10];
        my $ItemCount4 = $_[11];
        my $Reward = quest::varlink($RewardID);
        if ($CaseItems == 4){ ###If there are four separate item cases
        ###quest::say("Fallen in case 1 $itemcount");
            if (plugin::check_handin($itemcount, $Item1 => $ItemCount1, $Item2 => $ItemCount2, $Item3 => $ItemCount3, $Item4 => $ItemCount4))
                { 
                $client->Message(315, "$npc_name says, '$NPCMESSAGE");
                $client->Message(15, "You have obtained $Reward!");
                plugin::DoAnim("$NPCANIMATION");
                quest::summonitem($RewardID);
                quest::write("HandIn/$npc_name$zonesn.txt","[$timestamp] : $name the $ulevel has handed in $Item1, $Item2, $Item3, $item4 into $npc_name, and gotten $RewardID.");            
                }
        }
        elsif ($CaseItems == 3){ ###If there are 3 separate item cases
        ###    quest::say("Fallen in case 2");
            if (plugin::check_handin($itemcount, $Item1 => $ItemCount1, $Item2 => $ItemCount2, $Item3 => $ItemCount3))
                    { 
                    $client->Message(315, "$npc_name says, '$NPCMESSAGE");
                    $client->Message(15, "You have obtained $Reward!");
                    plugin::DoAnim("$NPCANIMATION");
                    quest::summonitem($RewardID);
                    quest::write("HandIn/$npc_name$zonesn.txt","[$timestamp] : $name the $ulevel has handed in $Item1, $Item2, $Item3, $item4 into $npc_name, and gotten $RewardID.");    
                    }
        }
        elsif ($CaseItems == 2){ ###If there are 2 separate item cases
        ###    quest::say("Fallen in case 3");
            if (plugin::check_handin($itemcount, $Item1 => $ItemCount1, $Item2 => $ItemCount2))
                        { 
                        $client->Message(315, "$npc_name says, '$NPCMESSAGE");
                        $client->Message(15, "You have obtained $Reward!");
                        plugin::DoAnim("$NPCANIMATION");
                        quest::summonitem($RewardID);
                        quest::write("HandIn/$npc_name$zonesn.txt","[$timestamp] : $name the $ulevel has handed in $Item1, $Item2, $Item3, $item4 into $npc_name, and gotten $RewardID.");    
                        }
            }
        elsif ($CaseItems == 1){ ###If there is one single item case
        ###quest::say("Fallen in case 4");
            if (plugin::check_handin($itemcount, $Item1 => $ItemCount1))
                            { 
                            $client->Message(315, "$npc_name says, '$NPCMESSAGE");
                            $client->Message(15, "You have obtained $Reward!");
                            plugin::DoAnim("$NPCANIMATION");
                            quest::summonitem($RewardID);
                            quest::write("HandIn/$npc_name$zonesn.txt","[$timestamp] : $name the $ulevel has handed in $Item1, $Item2, $Item3, $item4 into $npc_name, and gotten $RewardID.");    
                            }

                }
}

        return 1;
This plugin consolidates a lot of chunky nasty code and can be used flexibly. It also makes a file of the npc name and the zone into a folder called 'HandIn', in the root folder of your server folder, you will have to make this folder if you want to enable this feature.

The NPC performs a whisper type tell to the player or client message in which you can make your own with the plugin and your NPC can say whatever he wants. Based on this this script example given below, on getting an item, my npc will either cheer or salute the player give you have my animation plugin installed. If you want a list of the animations, it is listed in the plugin itself.

Also, based on the information that you put in the plugin, such as the reward ID, the script will also automatically give you an itemlink with the reward. As shown below...


An example is given below with a warrior class using this plugin...

NOTE: I didn't show the rest of the classes for some obvious reasons....

Code:
sub EVENT_ITEM{
	my $Animation = quest::ChooseRandom("salute","cheer");
	my $GratsMessage = "Congratulations $name!";
	
	####MOLDS###
	my $HelmPreReq = 5170;
	my $BootsPreReq = 5202;
	my $GlovesPreReq = 5229;
	my $VambracesPreReq = 5302;
	my $BreastplatePreReq = 5318;
	my $GreavesPreReq = 5323;
	my $BracerPreReq = 5324;
	####MOLDS###
	if ($class eq "Warrior")
		{
		my $RewardGauntlets = 117075;
		my $RewardBoots = 117076;
		my $RewardHelm = 117077;
		my $RewardVambraces = 117078;
		my $RewardGreaves = 117079;
		my $RewardBreastplate = 117080;
		my $RewardBracer = 117074;
		my $PreReqItem1 = 117349; ###Dragorn claws	(Dreadlands)
		my $PreReqItem2 = 117350; ###Hardened Golem Clay (Golems)
		my $PreReqItem3 = 117351; ###Drake Scales (New Born Drakes in Dreadlands)
		plugin::QuestHandIn($RewardGauntlets, "$GratsMessage", "$Animation", 4, $GlovesPreReq, 1, $PreReqItem1, 1, $PreReqItem2, 1, $PreReqItem3, 1);
		plugin::QuestHandIn($RewardBoots, "$GratsMessage", "$Animation", 4, $BootsPreReq, 1, $PreReqItem1, 1, $PreReqItem2, 1, $PreReqItem3, 1);
		plugin::QuestHandIn($RewardHelm, "$GratsMessage", "$Animation", 4, $HelmPreReq, 1, $PreReqItem1, 1, $PreReqItem2, 1, $PreReqItem3, 1);
		plugin::QuestHandIn($RewardVambraces, "$GratsMessage", "$Animation", 4, $VambracesPreReq, 1, $PreReqItem1, 1, $PreReqItem2, 1, $PreReqItem3, 1);
		plugin::QuestHandIn($RewardGreaves, "$GratsMessage", "$Animation", 4, $GreavesPreReq, 1, $PreReqItem1, 1, $PreReqItem2, 1, $PreReqItem3, 1);
		plugin::QuestHandIn($RewardBreastplate, "$GratsMessage", "$Animation", 4, $BreastplatePreReq, 1, $PreReqItem1, 1, $PreReqItem2, 1, $PreReqItem3, 1);
		plugin::QuestHandIn($RewardBracer, "$GratsMessage", "$Animation", 4, $BracerPreReq, 1, $PreReqItem1, 1, $PreReqItem2, 1, $PreReqItem3, 1);
                plugin::return_items(\%itemcount);
		}
	 
	if ($class eq "Shadowknight")
		{
	
		}
		
	if ($class eq "Cleric")
		{
	
		}
		
	if ($class eq "Druid")
		{

		}
		
	if ($class eq "Shaman")
		{
	
		}
		
	if ($class eq "Necromancer")
		{
	
		}
		
	if ($class eq "Magician")
		{
		
		}
		
	if ($class eq "Beastlord")
		{
	
		}
		
	if ($class eq "Bard")
		{
		
		}
		
	if ($class eq "Berserker")
		{
	
		}
		
	if ($class eq "Rogue")
		{
	
		}
		
	if ($class eq "Paladin")
		{
	
		}
		
	if ($class eq "Monk")
		{
	
		}
		
	if ($class eq "Enchanter")
		{
	
		}
		
	if ($class eq "Ranger")
		{
	
		}
		
	if ($class eq "Wizard")
		{
	
		}
	
}
You can see how the one line takes place of quite a few lines of code and makes your life much easier. And if you write your script right you can easily go back and change how the entire function performs or how it looks without having to change several and several lines of code again.

All in all I made this plugin in maybe an hour, and the rest of the quest script I wrote in another hour given I had to look all my ID's up for my item ID's. It saved me tons of time with this and I will continue to use it myself, and hopefully it saves you other developers time as well.

If you have any questions, please reply here.

Last edited by Secrets; 09-11-2010 at 01:09 AM..
Reply With Quote
  #2  
Old 09-11-2010, 08:21 AM
nenelan
Hill Giant
 
Join Date: Feb 2008
Posts: 116
Default

I used to do this stuff through loops and Arrays and Hashes. Yours, I feel, is a much better, more streamlined way of doing this. Cheers, Akkadius.
Reply With Quote
Reply


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 09:43 AM.


 

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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3