|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Development::Bug Reports Post detailed bug reports and what you would like to see next in the emu here. |
02-26-2009, 10:08 PM
|
Discordant
|
|
Join Date: May 2004
Posts: 290
|
|
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.
|
02-26-2009, 10:21 PM
|
|
The PEQ Dude
|
|
Join Date: Apr 2003
Location: -
Posts: 1,988
|
|
Quote:
Originally Posted by Secrets
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
|
|
|
|
03-09-2009, 08:55 AM
|
Discordant
|
|
Join Date: May 2004
Posts: 290
|
|
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 {
|
|
|
|
|
|
|
03-27-2009, 06:39 PM
|
Discordant
|
|
Join Date: May 2004
Posts: 290
|
|
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 {
|
|
|
|
|
|
|
05-04-2009, 10:22 AM
|
Sarnak
|
|
Join Date: Oct 2008
Location: USA
Posts: 92
|
|
This is working for people in the titanium client, but not for the SoF client. Everytime I zone with an attuneable item equipped it loses it's no trade flag. I would assume that this has something to do with the titanium.cpp being edited for this but not the sof.cpp. I tried changing around closer to what was done with titanium, but I haven't had any luck so far. I'm by no means a coder so I was hoping someone could look into this?
What it looks like in titanium.
Code:
MakeAnyLenString(&instance,
"%i|%i|%i|%i|%i|%i|%i|%i|%i|%i|%i|",
stackable ? charges : 0,
0,
(merchant_slot==0) ? slot_id : merchant_slot,
inst->GetPrice(),
(merchant_slot==0) ? 1 : inst->GetMerchantCount(),
0,
//merchant_slot, //instance ID, bullshit for now
(merchant_slot==0) ? inst->GetSerialNumber() : merchant_slot,
0,
(stackable ? ((inst->GetItem()->ItemType == ItemTypePotion) ? 1 : 0) : charges),
inst->IsInstNoDrop() ? 1 : 0,
0
);
What I changed in SoF.cpp (not working)
Code:
hdr.slot = (merchant_slot == 0) ? slot_id : merchant_slot;
hdr.price = inst->GetPrice();
hdr.merchant_slot = (merchant_slot == 0) ? 1 : inst->GetMerchantCount();
hdr.unknown020 = 0;
hdr.instance_id = (merchant_slot == 0) ? inst->GetSerialNumber() : merchant_slot;
0,
hdr.potion_type = (stackable ? ((inst->GetItem()->ItemType == ItemTypePotion) ? 1 : 0) : charges);
hdr.inst_nodrop = inst->IsInstNoDrop() ? 1 : 0;
hdr.charges = charges;
hdr.unknown040 = 0;
hdr.unknown044 = 0;
hdr.unknown048 = 0;
hdr.unknown052 = 0;
hdr.unknown056 = 0;
hdr.unknown060 = 0;
hdr.unknown061 = 0;
hdr.ItemClass = item->ItemClass;
|
|
|
|
05-04-2009, 04:25 PM
|
|
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
It is on the list of things left to do in SoF in the Development Tracking thread. I update it regularly so that it stays current. This is something I would like to get working. Maybe I can figure it out later. Been focusing on other things lately like AAs and such. Hadn't looked too closely at this yet, but it should just be a part of the serialization that we need to set. What you have set is probably close, but the attuned check might be in another unknown spot of the serialization. It is hard to know for sure without seeing an item from live, or just guessing at it until you get it right.
|
05-04-2009, 05:19 PM
|
Discordant
|
|
Join Date: May 2004
Posts: 290
|
|
I just guessed where it was in the serialization code for Titanium since it was in the wrong spot. It took a couple tries to find the right place. I didn't bother with the serialization for SoF since I don't have it yet, and I assume the item struct is radically different.
I guess I could get off my lazy butt and buy SoF and figure it out.
|
05-04-2009, 06:09 PM
|
Developer
|
|
Join Date: Dec 2007
Posts: 122
|
|
I found the variable that is supposed to be the instance no drop flag. It's currently labelled as unknown40 in the header. I'll rename it and merge it to the SVN later tonight, but for now the quick fix is to change the serialization code to
SoF.cpp
Code:
hdr.charges = charges;
hdr.unknown040 = inst->IsInstNoDrop() ? 1 : 0;
hdr.unknown044 = 0;
|
05-05-2009, 12:39 AM
|
Sarnak
|
|
Join Date: Oct 2008
Location: USA
Posts: 92
|
|
Yeah, this works now. Thanks realityincarnate! Another SoF issue to cross off the list. =)
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 05:13 PM.
|
|
|
|
|
|
|
|
|
|
|
|
|