View Single Post
  #3  
Old 03-19-2017, 01:32 PM
ghanja's Avatar
ghanja
Dragon
 
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
Default

Sounds like the hot potato quest I once did, which, I cannot find now. So, this is all untested, but, along the lines of what I did (really wish I could find it, as many little neat quests were in that directory). Haven't tested any of the following for shit. If I come across that directory, then I'll share that quest, but in the meantime:

Code:
## /quests/global/global_player.pl may NOT work I would suggest placing this in each zone's /quests/<zonesn>/player.pl
sub EVENT_TIMER {
	if ($timer eq "tempcheck$charid") 
	{
		foreach (0..30,251..340,2000..2015,2030..2190,2500,2501,2531..2550) 
		{
			if ($client->GetItemAt($_) and plugin::NoRentItem($client->GetItemIDAt($_))) 
			{
				$slot_item_id = $client->GetItemIDAt($_);
				if (!defined $qglobals{"looted$slot_item_id"})
				{
					$client->Message(15, "Your ".$client->GetItemAt($_)->GetName()." has poofed!");
					$client->NukeItem($client->GetItemIDAt($_));
				}
			}
		}
	}
}





## /quests/global/global_player.pl
## ensure item you make as the "hot potato" (any and all) are LORE!
sub EVENT_LOOT {
	if (plugin::NoRentItem($looted_id))
	{
		if (!$client->GetGlobal("looted$looted_id"))
		{
			$client->SetGlobal("looted$looted_id", 1, 5, "M30");
			quest::settimer("tempcheck$charid", 30);
		}
	}
}





## /plugins/NoRentItem.pl
sub NoRentItem {
	my $ic = $_[0];
	my $dbh = plugin::MySQL_Connect();
	my $sth = $dbh->prepare("SELECT `norent` FROM `items` WHERE ID = ".$ic." LIMIT 1");
	$sth->execute();	
	@data = $sth->fetchrow_array();
	$sth->finish();
	$dbh->disconnect();
	if ($data[0] == 0) { return 1; }
	else { return 0; }
}

return 1;
global_player.pl is screwy in its behavior (not to say it doesn't work "correctly" it's just finicky) so I'd heed the suggestion within the code.
Reply With Quote