PDA

View Full Version : Partial Fix for World Tradeskill Objects (new opcode)


krich
11-24-2003, 05:28 AM
This fixes the problem where ingredients are not removed from the tradeskill object after the combine button is pushed. Notice there's a new, undocumented opcode: 0x01c5 whose function appears to clear the open tradeskill window.

Changes are made towards the end of Object.cpp around line 511 where the routine starts that removes objects from tradeskill containers.

Original Object.cpp:
// Remove all items from tradeskill container now that combine is done
for (uint8 i=0; i<10; i++){
const ItemInst* inst = container->GetItem(i);
if (inst)
user->DeleteItemInInventory(Inventory::CalcSlotId(in_com bine->container_slot,i),0,true);
}
container->Clear();

Changed to new Object.cpp:
// Remove all items from tradeskill container now that combine is done
for (uint8 i=0; i<10; i++){
const ItemInst* inst = container->GetItem(i);
if (inst) {
if (Inventory::SupportsContainers(in_combine->container_slot) )
user->DeleteItemInInventory(Inventory::CalcSlotId(in_com bine->container_slot,i),0,true);
else
container->DeleteItem(i);
}
}
if (Inventory::SupportsContainers(in_combine->container_slot)) {
container->Clear();
} else {
APPLAYER* outapp2 = new APPLAYER(0x01c5, 0);
user->QueuePacket(outapp2);
safe_delete(outapp2);
}


This is a partial fix because there is one more thing that needs to be fixed before Tradeskill Objects will work perfectly. Currently when the tradeskill object is opened, for some reason the client is not displaying the contents (if any) of that object (from object_contents table). The code is in, but is not working for some reason. This is a bad thing since if someone leaves items in the Tradeskill Object and closes the Object window, that Tradeskill Object will be unusable for tradeskill combines until someone clears out the object_contents table for that object. I haven't figured this out yet, but wanted to go ahead and post the above change since it greatly improves the viability of tradeskills.

I've worked with Tcsmyworld to get functional Objects table data. I'm thinking that table and its data should be added into the CVS once this is confirmed to work properly.

Oh, I just noticed something, if there's a better way of detecting an object other than SupportsContainers (that's kinda unintuitive in my opinion but it worked at the time...), please substitute.

Regards,

krich