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

Reply
 
Thread Tools Display Modes
  #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
  #2  
Old 08-28-2010, 08:37 PM
ChaosSlayerZ's Avatar
ChaosSlayerZ
Demi-God
 
Join Date: Mar 2009
Location: Umm
Posts: 1,492
Default

awesome! I must say many players inadvertently cause zone crashes by simply hitting their ESc key accidentally or trying to change their mind about what they want to put into container.

This will solve a lot of problems!
Great work!
Reply With Quote
  #3  
Old 09-11-2010, 10:22 AM
Derision
Developer
 
Join Date: Feb 2004
Location: UK
Posts: 1,540
Default

Thanks. I committed this, but I had the items placed directly into the player's inventory as I checked on Live and that is what happens.
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 08:31 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