Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Server Code Submissions

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 08-28-2010, 07:06 PM
wheeljack
Fire Beetle
 
Join Date: Aug 2010
Posts: 18
Default COMMITTED: Fix for losing items in world containers

Problem: If you put an item in a world container such as a forge or an aug sealer, walk away or go linkdead, then somebody else uses the world container or the zone shuts down, your items are gone. See http://www.eqemulator.org/forums/showthread.php?t=25547

Solution: This patch will put any remaining items from a world container onto the user's cursor when the world container is closed. I *think* that live might only put the no drop items from a world container onto your cursor if you walk away with the window up and leave the tradeable items in there for the next person, but I believe that it returns them all to you if you go linkdead while using a world container. I don't have a live account to verify all the different scenarios and it seemed safest to always just put them on the cursor rather than missing some bizarre edge case and have people potentially lose items.

Code:
Index: zone/Object.cpp
===================================================================
--- zone/Object.cpp	(revision 1634)
+++ zone/Object.cpp	(working copy)
@@ -357,6 +357,22 @@
 	m_inuse = false;
 	if(user != NULL) {
 		last_user = user;
+
+		// put any remaining items from the world container onto the user's cursor to avoid item loss
+		//  if they close the container without removing all items
+		ItemInst* container = this->m_inst;
+		if(container != NULL)
+		{
+			for (uint8 i = 0; i < MAX_ITEMS_PER_BAG; i++)
+			{
+				ItemInst* inst = container->PopItem(i);
+				if(inst != NULL)
+				{
+					user->PushItemOnCursor(*inst, true);
+				}
+			}
+		}
+
 		user->SetTradeskillObject(NULL);
 	}
 	user = NULL;
I tested walking away from the container while open, going linkdead with a container open, zoning with a container open, and dieing with a container open and all worked quite well.
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 09:52 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