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 11-27-2018, 02:03 PM
Almusious
Fire Beetle
 
Join Date: Sep 2012
Posts: 25
Default check_hasitem.pl

A recent post by Uleat (today) reminded me, that those already rolling with an EQEmu setup may not have updated their check_hasitem.pl much less know it should be. This is for those of whom the aforementioned apply:

It's a modified version of the one that used to be provided BEFORE the inventory changes in which made this necessary. Unsure who to credit for it, sorry.

Code:
## Plugin Name: check_hasitem.pl
## Description: Checks character's possession(s) throughout all inventory slots to determine if the requested item (ID) exists (ie. returns 1 for true, 0 for false)
## Usage: plugin::check_hasitem($client, itemid); -- (whereas itemid = the item number we're looking for)
sub check_hasitem 
{
	my $client = shift;
	my $itemtocheckfor = shift;
	my $individualslot;
	my $founditem;
	my $augmentid;
	my $i;
	my $body_count = $client->GetCorpseCount();
	my $body_id;

	my @slotsarray =	((quest::getinventoryslotid("possessions.begin"))..(quest::getinventoryslotid("possessions.end")),
						(quest::getinventoryslotid("generalbags.begin"))..(quest::getinventoryslotid("generalbags.end")),
						(quest::getinventoryslotid("cursorbag.begin"))..(quest::getinventoryslotid("cursorbag.end")),
						(quest::getinventoryslotid("bank.begin"))..(quest::getinventoryslotid("bank.end")),
						(quest::getinventoryslotid("sharedbankbags.begin"))..(quest::getinventoryslotid("sharedbankbags.end")),
						(quest::getinventoryslotid("sharedbank.begin"))..(quest::getinventoryslotid("sharedbank.end")));
	
	
	foreach my $individualslot (@slotsarray)
	{
		$founditem = $client->GetItemIDAt($individualslot);
		if ($founditem == $itemtocheckfor) { return 1; }
		for ($i = quest::getinventoryslotid("augsocket.begin"); $i < quest::getinventoryslotid("augsocket.end"); $i++)
		{
			$augmentid = $client->GetAugmentIDAt($individualslot, $i);
			if ($augmentid == $itemtocheckfor) { return 1; }
		}
	}

	## Check corpses contents
	if ($body_count) 
	{
		my $foundcorpseitem;
		my @corpseslotsarray =	((quest::getinventoryslotid("possessions.begin"))..(quest::getinventoryslotid("possessions.end")),
								(quest::getinventoryslotid("generalbags.begin"))..(quest::getinventoryslotid("generalbags.end")));
		for ($i = 1; $i <= $body_count; $i++) 
		{
			$body_id = $client->GetCorpseID($i);
			foreach my $individualcorpseslot (@corpseslotsarray)
			{
				$foundcorpseitem = $client->GetCorpseItemAt($body_id, $individualcorpseslot);
				if ($foundcorpseitem == $itemtocheckfor) { return 1; }
			}
		}
	}
	return 0;
}

1;
Reply With Quote
  #2  
Old 08-25-2020, 05:42 PM
lctucker2999
Sarnak
 
Join Date: Jan 2018
Posts: 51
Default

Apologies for necro'ing a 2 year old thread.

Is it just a matter of replacing the existing check_hasitem.pl with the code here? I ran into some quests that weren't working for me, and eventually figured out that it was the check_hasitem plugin that was causing the script to fail, which led me here.

So I saved backup of the original, and pasted this code into check_hasitem.pl but it doesn't seem to have had any effect. Restarted the server etc. I assume there is more to it that i'm missing
Reply With Quote
  #3  
Old 08-25-2020, 06:52 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

If you're in a particular zone and it's not working, double-check that there's not a lua script overriding the perl one.

You would have to check whatever parent script is calling this function (i.e., player.lua vs. player.pl)
__________________
Uleat of Bertoxxulous

Compilin' Dirty
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 10:47 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3