Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Bug Reports

Development::Bug Reports Post detailed bug reports and what you would like to see next in the emu here.

Reply
 
Thread Tools Display Modes
  #1  
Old 02-26-2009, 12:30 AM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,449
Default

Have not tested this, but this should work hopefully. I probably messed it up but something along the lines of this should work, heh.

PlayerCorpse.cpp

Code:
void Corpse::MoveItemToCorpse(Client *client, ItemInst *item, sint16 equipslot)
{
	int bagindex;
	sint16 interior_slot;
	ItemInst *interior_item;

	AddItem(item->GetItem()->ID, item->GetCharges(),  equipslot, item->GetAugmentItemID(0), item->GetAugmentItemID(1), item->GetAugmentItemID(2), item->GetAugmentItemID(3), item->GetAugmentItemID(4));
	if(item->IsType(ItemClassContainer))
	{
		for(bagindex = 0; bagindex <= 10; bagindex++)
		{
			interior_slot = Inventory::CalcSlotId(equipslot, bagindex);
			interior_item = client->GetInv().GetItem(interior_slot);
			if(interior_item->IsInstNoDrop)
			{
				interior_item->SetInstNoDrop(true);
			}
			if(interior_item)
			{
				AddItem(interior_item->GetItem()->ID, interior_item->GetCharges(), interior_slot, interior_item->GetAugmentItemID(0), interior_item->GetAugmentItemID(1), interior_item->GetAugmentItemID(2), interior_item->GetAugmentItemID(3), interior_item->GetAugmentItemID(4));
				client->DeleteItemInInventory(interior_slot);
			}
		}
	}
	client->DeleteItemInInventory(equipslot);
}
Reply With Quote
  #2  
Old 02-26-2009, 10:25 AM
Theeper
Discordant
 
Join Date: May 2004
Posts: 290
Default

Thanks guys, I'll try to get the NPC trade thing and the corpse flag done when I get home tonite.

Secrets, this doesn't look proper though. You're setting a flag that is already set.

Code:
			if(interior_item->IsInstNoDrop)
			{
				interior_item->SetInstNoDrop(true);
			}
I'm wondering if you meant to do..

Code:
			if(item->IsInstNoDrop())
			{
				interior_item->SetInstNoDrop(true);
			}
Reply With Quote
  #3  
Old 02-26-2009, 03:06 PM
cavedude's Avatar
cavedude
The PEQ Dude
 
Join Date: Apr 2003
Location: -
Posts: 1,988
Default

The PlayerCorpse change is a bad, bad change! I accidentally put it up on TGC without testing and it caused players to lose all but 1 bag in their top inventory slot when they died, and caused a zone crash. That'll teach me to upload files when I am half asleep. Good thing we keep daily backups.

Theeper: Yes, if the change was good that's the syntax you'd use.
Reply With Quote
  #4  
Old 02-26-2009, 09:43 PM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,449
Default

Quote:
Originally Posted by cavedude View Post
The PlayerCorpse change is a bad, bad change! I accidentally put it up on TGC without testing and it caused players to lose all but 1 bag in their top inventory slot when they died, and caused a zone crash. That'll teach me to upload files when I am half asleep. Good thing we keep daily backups.

Theeper: Yes, if the change was good that's the syntax you'd use.
Heh, yeah. I'm still learning C++. Sorry about that.

I guess that doesn't work, then. Back to the drawing board!
Reply With Quote
  #5  
Old 02-26-2009, 10:08 PM
Theeper
Discordant
 
Join Date: May 2004
Posts: 290
Default

I think the corpse issue will involve adding an 'instnodrop' field to the ServerLootItem_Struct struct and setting it when a corpse is made so it's saved into the item list in the corpse blob, then setting the item instance flag and the DB flag upon looting.

I'm short on time today, but I'll look through it tomorrow after work.
Reply With Quote
  #6  
Old 02-26-2009, 10:21 PM
cavedude's Avatar
cavedude
The PEQ Dude
 
Join Date: Apr 2003
Location: -
Posts: 1,988
Default

Quote:
Originally Posted by Secrets View Post
Heh, yeah. I'm still learning C++. Sorry about that.

I guess that doesn't work, then. Back to the drawing board!
Nah, it was totally my fault. That could have just as easily been my broken code getting into TGC. We all have to start somewhere, and I applaud you for contributing
Reply With Quote
  #7  
Old 03-09-2009, 08:55 AM
Theeper
Discordant
 
Join Date: May 2004
Posts: 290
Default

Here is another step closer to having attuneable items working. This will make corpses properly handle the instnodrop flag .. almost.

It works fine except for on bagged items. They lose the flag upon looting. It's set on the corpse, and set when looted, but I can't figure out why it's getting unset. I was hoping someone else would put their eyes on it and tell me what I missed.

I am not sure how this works with PVP looting and shared bank as I haven't tested them.

This one is kinda long, so I made a diff against rev 373. This is on windows with PEQ.

Code:
Index: common/shareddb.cpp
===================================================================
--- common/shareddb.cpp	(revision 373)
+++ common/shareddb.cpp	(working copy)
@@ -1201,7 +1201,7 @@
 
 
 // Create appropriate ItemInst class
-ItemInst* SharedDatabase::CreateItem(uint32 item_id, sint16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5)
+ItemInst* SharedDatabase::CreateItem(uint32 item_id, sint16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, bool instnodrop)
 {
 	const Item_Struct* item = NULL;
 	ItemInst* inst = NULL;
@@ -1213,6 +1213,7 @@
 		inst->PutAugment(this, 2, aug3);
 		inst->PutAugment(this, 3, aug4);
 		inst->PutAugment(this, 4, aug5);
+		inst->SetInstNoDrop(instnodrop);
 
 	}
 
@@ -1221,7 +1222,7 @@
 
 
 // Create appropriate ItemInst class
-ItemInst* SharedDatabase::CreateItem(const Item_Struct* item, sint16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5)
+ItemInst* SharedDatabase::CreateItem(const Item_Struct* item, sint16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, bool instnodrop)
 {
 	ItemInst* inst = NULL;
 	if (item) {
@@ -1234,6 +1235,7 @@
 		inst->PutAugment(this, 3, aug4);
 		inst->PutAugment(this, 4, aug5);
 		inst->SetCharges(charges);
+		inst->SetInstNoDrop(instnodrop);
 	}
 	
 	return inst;
Index: common/shareddb.h
===================================================================
--- common/shareddb.h	(revision 373)
+++ common/shareddb.h	(working copy)
@@ -58,8 +58,8 @@
 	/*
 	 * Item Methods
 	 */
-	ItemInst* CreateItem(uint32 item_id, sint16 charges=0, uint32 aug1=0, uint32 aug2=0, uint32 aug3=0, uint32 aug4=0, uint32 aug5=0);
-	ItemInst* CreateItem(const Item_Struct* item, sint16 charges=0, uint32 aug1=0, uint32 aug2=0, uint32 aug3=0, uint32 aug4=0, uint32 aug5=0);
+	ItemInst* CreateItem(uint32 item_id, sint16 charges=0, uint32 aug1=0, uint32 aug2=0, uint32 aug3=0, uint32 aug4=0, uint32 aug5=0, bool instnodrop = false);
+	ItemInst* CreateItem(const Item_Struct* item, sint16 charges=0, uint32 aug1=0, uint32 aug2=0, uint32 aug3=0, uint32 aug4=0, uint32 aug5=0, bool instnodrop = false);
 	
 	
 	/*
Index: zone/PlayerCorpse.cpp
===================================================================
--- zone/PlayerCorpse.cpp	(revision 373)
+++ zone/PlayerCorpse.cpp	(working copy)
@@ -293,7 +293,7 @@
 	sint16 interior_slot;
 	ItemInst *interior_item;
 
-	AddItem(item->GetItem()->ID, item->GetCharges(),  equipslot, item->GetAugmentItemID(0), item->GetAugmentItemID(1), item->GetAugmentItemID(2), item->GetAugmentItemID(3), item->GetAugmentItemID(4));
+	AddItem(item->GetItem()->ID, item->GetCharges(),  equipslot, item->GetAugmentItemID(0), item->GetAugmentItemID(1), item->GetAugmentItemID(2), item->GetAugmentItemID(3), item->GetAugmentItemID(4), item->IsInstNoDrop());
 	if(item->IsType(ItemClassContainer))
 	{
 		for(bagindex = 0; bagindex <= 10; bagindex++)
@@ -303,7 +303,7 @@
 
 			if(interior_item)
 			{
-				AddItem(interior_item->GetItem()->ID, interior_item->GetCharges(), interior_slot, interior_item->GetAugmentItemID(0), interior_item->GetAugmentItemID(1), interior_item->GetAugmentItemID(2), interior_item->GetAugmentItemID(3), interior_item->GetAugmentItemID(4));
+				AddItem(interior_item->GetItem()->ID, interior_item->GetCharges(), interior_slot, interior_item->GetAugmentItemID(0), interior_item->GetAugmentItemID(1), interior_item->GetAugmentItemID(2), interior_item->GetAugmentItemID(3), interior_item->GetAugmentItemID(4), interior_item->IsInstNoDrop());
 				client->DeleteItemInInventory(interior_slot);
 			}
 		}
@@ -456,7 +456,7 @@
 	return itemlist.size();
 }
 
-void Corpse::AddItem(uint32 itemnum, int8 charges, sint16 slot, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5) {
+void Corpse::AddItem(uint32 itemnum, int8 charges, sint16 slot, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, bool instnodrop) {
 	if (!database.GetItem(itemnum))
 		return;
 	pIsChanged = true;
@@ -470,6 +470,7 @@
 	item->aug3=aug3;
 	item->aug4=aug4;
 	item->aug5=aug5;
+	item->instnodrop = instnodrop;
 	itemlist.push_back(item);
 }
 
@@ -822,7 +823,7 @@
 					item = database.GetItem(item_data->item_id);
 					if (client && item)
 					{
-						ItemInst* inst = database.CreateItem(item, item_data->charges, item_data->aug1, item_data->aug2, item_data->aug3, item_data->aug4, item_data->aug5);
+						ItemInst* inst = database.CreateItem(item, item_data->charges, item_data->aug1, item_data->aug2, item_data->aug3, item_data->aug4, item_data->aug5, item_data->instnodrop);
 						if (inst)
 						{
 							client->SendItemPacket(i + 22, inst, ItemPacketLoot);
@@ -888,7 +889,7 @@
 	if (item != 0)
 	{
 		if(item_data)
-			inst = database.CreateItem(item, item_data?item_data->charges:0, item_data->aug1, item_data->aug2, item_data->aug3, item_data->aug4, item_data->aug5);
+			inst = database.CreateItem(item, item_data?item_data->charges:0, item_data->aug1, item_data->aug2, item_data->aug3, item_data->aug4, item_data->aug5, item_data->instnodrop);
 		else
 			inst = database.CreateItem(item);
 
Index: zone/PlayerCorpse.h
===================================================================
--- zone/PlayerCorpse.h	(revision 373)
+++ zone/PlayerCorpse.h	(working copy)
@@ -57,7 +57,7 @@
 
 	void	SetDecayTimer(int32 decaytime);
 	bool	IsEmpty() const;
-	void	AddItem(uint32 itemnum, int8 charges, sint16 slot = 0, uint32 aug1=0, uint32 aug2=0, uint32 aug3=0, uint32 aug4=0, uint32 aug5=0);
+	void	AddItem(uint32 itemnum, int8 charges, sint16 slot = 0, uint32 aug1=0, uint32 aug2=0, uint32 aug3=0, uint32 aug4=0, uint32 aug5=0, bool instnodrop=false);
 	uint32	GetWornItem(sint16 equipSlot) const;
 	ServerLootItem_Struct* GetItem(int16 lootslot, ServerLootItem_Struct** bag_item_data = 0);
 	void	RemoveItem(int16 lootslot);
Index: zone/zonedump.h
===================================================================
--- zone/zonedump.h	(revision 373)
+++ zone/zonedump.h	(working copy)
@@ -155,6 +155,7 @@
 	uint32 aug3;
 	uint32 aug4;
 	uint32 aug5;
+	bool instnodrop;
 };
 
 struct DBPlayerCorpse_Struct {
Reply With Quote
  #8  
Old 03-27-2009, 06:39 PM
Theeper
Discordant
 
Join Date: May 2004
Posts: 290
Default

I got the flag to persist through bagged items now. This seems to make attuneable items work properly in my limited testing.

Here's a diff against 397.

Code:
Index: common/shareddb.cpp
===================================================================
--- common/shareddb.cpp	(revision 397)
+++ common/shareddb.cpp	(working copy)
@@ -1229,7 +1229,7 @@
 
 
 // Create appropriate ItemInst class
-ItemInst* SharedDatabase::CreateItem(uint32 item_id, sint16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5)
+ItemInst* SharedDatabase::CreateItem(uint32 item_id, sint16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, bool instnodrop)
 {
 	const Item_Struct* item = NULL;
 	ItemInst* inst = NULL;
@@ -1241,6 +1241,7 @@
 		inst->PutAugment(this, 2, aug3);
 		inst->PutAugment(this, 3, aug4);
 		inst->PutAugment(this, 4, aug5);
+		inst->SetInstNoDrop(instnodrop);
 
 	}
 
@@ -1249,7 +1250,7 @@
 
 
 // Create appropriate ItemInst class
-ItemInst* SharedDatabase::CreateItem(const Item_Struct* item, sint16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5)
+ItemInst* SharedDatabase::CreateItem(const Item_Struct* item, sint16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, bool instnodrop)
 {
 	ItemInst* inst = NULL;
 	if (item) {
@@ -1262,6 +1263,7 @@
 		inst->PutAugment(this, 3, aug4);
 		inst->PutAugment(this, 4, aug5);
 		inst->SetCharges(charges);
+		inst->SetInstNoDrop(instnodrop);
 	}
 	
 	return inst;
Index: common/shareddb.h
===================================================================
--- common/shareddb.h	(revision 397)
+++ common/shareddb.h	(working copy)
@@ -60,8 +60,8 @@
 	/*
 	 * Item Methods
 	 */
-	ItemInst* CreateItem(uint32 item_id, sint16 charges=0, uint32 aug1=0, uint32 aug2=0, uint32 aug3=0, uint32 aug4=0, uint32 aug5=0);
-	ItemInst* CreateItem(const Item_Struct* item, sint16 charges=0, uint32 aug1=0, uint32 aug2=0, uint32 aug3=0, uint32 aug4=0, uint32 aug5=0);
+	ItemInst* CreateItem(uint32 item_id, sint16 charges=0, uint32 aug1=0, uint32 aug2=0, uint32 aug3=0, uint32 aug4=0, uint32 aug5=0, bool instnodrop = false);
+	ItemInst* CreateItem(const Item_Struct* item, sint16 charges=0, uint32 aug1=0, uint32 aug2=0, uint32 aug3=0, uint32 aug4=0, uint32 aug5=0, bool instnodrop = false);
 	
 	
 	/*
Index: zone/inventory.cpp
===================================================================
--- zone/inventory.cpp	(revision 397)
+++ zone/inventory.cpp	(working copy)
@@ -330,7 +330,7 @@
 		{
 			if(bag_item_data[i] == NULL)
 				continue;
-			const ItemInst *bagitem = database.CreateItem(bag_item_data[i]->item_id, bag_item_data[i]->charges);
+			const ItemInst *bagitem = database.CreateItem(bag_item_data[i]->item_id, bag_item_data[i]->charges, bag_item_data[i]->aug1, bag_item_data[i]->aug2, bag_item_data[i]->aug3, bag_item_data[i]->aug4, bag_item_data[i]->aug5, bag_item_data[i]->instnodrop);
 			interior_slot = Inventory::CalcSlotId(slot_id, i);
 			mlog(INVENTORY__SLOTS, "Putting bag loot item %s (%d) into slot %d (bag slot %d)", inst.GetItem()->Name, inst.GetItem()->ID, interior_slot, i);
 			PutLootInInventory(interior_slot, *bagitem);
Index: zone/PlayerCorpse.cpp
===================================================================
--- zone/PlayerCorpse.cpp	(revision 397)
+++ zone/PlayerCorpse.cpp	(working copy)
@@ -309,7 +309,7 @@
 	sint16 interior_slot;
 	ItemInst *interior_item;
 
-	AddItem(item->GetItem()->ID, item->GetCharges(),  equipslot, item->GetAugmentItemID(0), item->GetAugmentItemID(1), item->GetAugmentItemID(2), item->GetAugmentItemID(3), item->GetAugmentItemID(4));
+	AddItem(item->GetItem()->ID, item->GetCharges(),  equipslot, item->GetAugmentItemID(0), item->GetAugmentItemID(1), item->GetAugmentItemID(2), item->GetAugmentItemID(3), item->GetAugmentItemID(4), item->IsInstNoDrop());
 	if(item->IsType(ItemClassContainer))
 	{
 		for(bagindex = 0; bagindex <= 10; bagindex++)
@@ -319,7 +319,7 @@
 
 			if(interior_item)
 			{
-				AddItem(interior_item->GetItem()->ID, interior_item->GetCharges(), interior_slot, interior_item->GetAugmentItemID(0), interior_item->GetAugmentItemID(1), interior_item->GetAugmentItemID(2), interior_item->GetAugmentItemID(3), interior_item->GetAugmentItemID(4));
+				AddItem(interior_item->GetItem()->ID, interior_item->GetCharges(), interior_slot, interior_item->GetAugmentItemID(0), interior_item->GetAugmentItemID(1), interior_item->GetAugmentItemID(2), interior_item->GetAugmentItemID(3), interior_item->GetAugmentItemID(4), interior_item->IsInstNoDrop());
 				client->DeleteItemInInventory(interior_slot);
 			}
 		}
@@ -488,7 +488,7 @@
 	return itemlist.size();
 }
 
-void Corpse::AddItem(uint32 itemnum, int8 charges, sint16 slot, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5) {
+void Corpse::AddItem(uint32 itemnum, int8 charges, sint16 slot, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, bool instnodrop) {
 	if (!database.GetItem(itemnum))
 		return;
 	pIsChanged = true;
@@ -502,6 +502,7 @@
 	item->aug3=aug3;
 	item->aug4=aug4;
 	item->aug5=aug5;
+	item->instnodrop = instnodrop;
 	itemlist.push_back(item);
 }
 
@@ -854,7 +855,7 @@
 					item = database.GetItem(item_data->item_id);
 					if (client && item)
 					{
-						ItemInst* inst = database.CreateItem(item, item_data->charges, item_data->aug1, item_data->aug2, item_data->aug3, item_data->aug4, item_data->aug5);
+						ItemInst* inst = database.CreateItem(item, item_data->charges, item_data->aug1, item_data->aug2, item_data->aug3, item_data->aug4, item_data->aug5, item_data->instnodrop);
 						if (inst)
 						{
 							client->SendItemPacket(i + 22, inst, ItemPacketLoot);
@@ -920,7 +921,7 @@
 	if (item != 0)
 	{
 		if(item_data)
-			inst = database.CreateItem(item, item_data?item_data->charges:0, item_data->aug1, item_data->aug2, item_data->aug3, item_data->aug4, item_data->aug5);
+			inst = database.CreateItem(item, item_data?item_data->charges:0, item_data->aug1, item_data->aug2, item_data->aug3, item_data->aug4, item_data->aug5, item_data->instnodrop);
 		else
 			inst = database.CreateItem(item);
 
Index: zone/PlayerCorpse.h
===================================================================
--- zone/PlayerCorpse.h	(revision 397)
+++ zone/PlayerCorpse.h	(working copy)
@@ -57,7 +57,7 @@
 
 	void	SetDecayTimer(int32 decaytime);
 	bool	IsEmpty() const;
-	void	AddItem(uint32 itemnum, int8 charges, sint16 slot = 0, uint32 aug1=0, uint32 aug2=0, uint32 aug3=0, uint32 aug4=0, uint32 aug5=0);
+	void	AddItem(uint32 itemnum, int8 charges, sint16 slot = 0, uint32 aug1=0, uint32 aug2=0, uint32 aug3=0, uint32 aug4=0, uint32 aug5=0, bool instnodrop=false);
 	uint32	GetWornItem(sint16 equipSlot) const;
 	ServerLootItem_Struct* GetItem(int16 lootslot, ServerLootItem_Struct** bag_item_data = 0);
 	void	RemoveItem(int16 lootslot);
Index: zone/zonedump.h
===================================================================
--- zone/zonedump.h	(revision 397)
+++ zone/zonedump.h	(working copy)
@@ -155,6 +155,7 @@
 	uint32 aug3;
 	uint32 aug4;
 	uint32 aug5;
+	bool instnodrop;
 };
 
 struct DBPlayerCorpse_Struct {
Reply With Quote
Reply

Thread Tools
Display Modes

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 04:42 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 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3