View Single Post
  #6  
Old 02-25-2009, 09:21 AM
Theeper
Discordant
 
Join Date: May 2004
Posts: 290
Default

Here's a start on getting attuneable items working. Items are flagged as No Trade and remain No Trade when zoning
and logging off.

This is with rev 361 compiled Windows XP.

Set the instnodrop flag when an item is placed into a gear slot that has it's attuneable flag set. (This probably needs to be done somewhere else).

In zone\inventory.cpp around line 901 change

Code:
		// Not dealing with charges - just do direct swap
		if(src_inst && dst_slot_id<22 && dst_slot_id>0)
			SetMaterial(dst_slot_id,src_inst->GetItem()->ID);
		mlog(INVENTORY__SLOTS, "Moving entire item from slot %d to slot %d", src_slot_id, dst_slot_id);
		m_inv.SwapItem(src_slot_id, dst_slot_id);
to

Code:
		// Not dealing with charges - just do direct swap
		if(src_inst && dst_slot_id<22 && dst_slot_id>0) {
			if (src_inst->GetItem()->Attuneable) {
				src_inst->SetInstNoDrop(true);
			}
			SetMaterial(dst_slot_id,src_inst->GetItem()->ID);
		}
		mlog(INVENTORY__SLOTS, "Moving entire item from slot %d to slot %d", src_slot_id, dst_slot_id);
		m_inv.SwapItem(src_slot_id, dst_slot_id);

Then, move the instnodrop field in the item serialization code a couple spots over in the Titanium patch file.

In patches\Titanium.cpp near line 871, change

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,
		inst->IsInstNoDrop() ? 1 : 0,		//not sure where this field is
		(stackable ? ((inst->GetItem()->ItemType == ItemTypePotion) ? 1 : 0) : charges),
		0,
		0
	);
to

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
	);
- You can still trade attuned items to NPC's and maybe sell in the bazaar, but you can't trade to players or sell to vendors. I will put in some checks for these later.
- When items are autoequipped from loot, it bypasses the "Attune" popup that happens when you manually equip stuff. Need to at least put a check on startup to flag the items. I'm not sure of the popup behaviour on Live though.
- I didn't look into the other client serializations because I can't test them.

I thought ChaosSlayer might want to test it out now though.
Reply With Quote