Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

Reply
 
Thread Tools Display Modes
  #1  
Old 03-18-2017, 11:52 PM
ChaosSlayerZ's Avatar
ChaosSlayerZ
Demi-God
 
Join Date: Mar 2009
Location: Umm
Posts: 1,492
Default Altering Temp item

Greetings.

I know that temporary items get some sort of timestamp to track when they needed to be removed from a character if he logs off for more than 30 min I believe.

Would it be possible to retrieve this timestamp via quest and remove the item of a player while he still logged in?

I want to set up a quest where player only has like 30 min to turn in the item before it goes poof.

Another question - would it heavily tax the server if a quest script would go off every 30 min to go through all the stored characters in DB searching for item X and removing it?

Thanks!
Reply With Quote
  #2  
Old 03-18-2017, 11:57 PM
GRUMPY
Discordant
 
Join Date: Oct 2016
Posts: 445
Default

Quote:
Originally Posted by ChaosSlayerZ View Post
player only has like 30 min to turn in the item before it goes poof.
Wow, that sounds like a kewl challenge. Especially if that item was a pita to get it to drop, haha
Reply With Quote
  #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
  #4  
Old 03-19-2017, 02:55 PM
ChaosSlayerZ's Avatar
ChaosSlayerZ
Demi-God
 
Join Date: Mar 2009
Location: Umm
Posts: 1,492
Default

Thank you so much!
I will study this and put into good use
Reply With Quote
  #5  
Old 03-19-2017, 03:04 PM
ghanja's Avatar
ghanja
Dragon
 
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
Default

Well. Don't thank me just yet. Decided to give this a whirl and perhaps I'm missing something simple but:

Code:
$client->GetItemIDAt($_)
Returns -1 for each slot. In fact, it returns -1 if any variable is used with it. Which, strikes me as odd. Maybe something is screwy with my test end.
Reply With Quote
  #6  
Old 03-19-2017, 03:10 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

That's probably the best way to handle it for now.

We only use client logout time to determine when no rent items should be deleted.


There may be ways to use item timers (custom data) to do this..but, I've never seen it.

At some point, I'll be adding something called `ItemInstance::origin_tag` - which is a base64 encoded 16-byte text field. (Later clients can use this for hotkey assignments)

I don't know what live puts into this field..but, one of the things I'm looking at using is a creation timestamp.
__________________
Uleat of Bertoxxulous

Compilin' Dirty
Reply With Quote
  #7  
Old 03-19-2017, 07:12 PM
ghanja's Avatar
ghanja
Dragon
 
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
Default

Ok. It should work. Oddly enough, GetItemIDAt was not working, it would return a -1 for every iteration of a loop when a variable was passed to it. Hardcoding GetItemIDAt(2) or any other valid slot number would work though. That is on a GM toon that had:

Been created days (and many restarts ago) -> world.exe flag <accountname> 255 -> #gm on -> #zone cshome -> "bought" GM items (and did a few days/months worth of melee killing, #cast killing, many many #zone's, etc.)

However. Immediately following a #summonitem 50100 and equipping it (forcing a save I'm sure, though dont see how that matters, the toon has existed for quite some time), the GetItemIDAt when using a variable would work.

Strange, real strange.
Reply With Quote
  #8  
Old 03-20-2017, 10:04 AM
Maze_EQ
Demi-God
 
Join Date: Mar 2012
Posts: 1,103
Default

Ghanja, would you like me to post your hot potato/coffee quest?

I have it from Sanctuary backups.
__________________
"No, thanks, man. I don't want you fucking up my life, too."

Skype:
Comerian1
Reply With Quote
  #9  
Old 03-20-2017, 12:58 PM
ghanja's Avatar
ghanja
Dragon
 
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
Default

Quote:
Originally Posted by Maze_EQ View Post
Ghanja, would you like me to post your hot potato/coffee quest?

I have it from Sanctuary backups.
That was code that Secrets did (I believe it was him), it was for a specific item (or two?). But, if you do post any code from there that I did, know, variable declarations from hell (with meaningful names) as I was trying to make it all so he could understand what the lines of code did. Not the most "optimized" work, but.. yeah. Your call.
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 07:41 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