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 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
 


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 12:27 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