Identified the routines needed to augment items in RoF. Currently, only Insert and Remove are supported. Swap and Destroy do not work due to missing functions related to the cursor.

This commit is contained in:
SecretsOTheP 2014-09-03 18:25:21 -04:00
parent 64c324a42b
commit e6a0b01f37
6 changed files with 158 additions and 13 deletions

View File

@ -1,5 +1,8 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50) EQEMu Changelog (Started on Sept 24, 2003 15:50)
------------------------------------------------------- -------------------------------------------------------
== 09/03/2014 ==
Secrets: Identified the routines needed to augment items in RoF. Currently, only Insert and Remove are supported. Swap and Destroy do not work due to missing functions related to the cursor.
== 09/02/2014 == == 09/02/2014 ==
Secrets: Identified OP_GuildPromote for RoF clients. Secrets: Identified OP_GuildPromote for RoF clients.
Secrets: Fixed promotion, demotion, transferring a leader and displaying of client ranks in the Rain of Fear client. The rain of fear client, as such, will only have 3 ranks like the other clients, but supports a theoretical 8 ranks later. Secrets: Fixed promotion, demotion, transferring a leader and displaying of client ranks in the Rain of Fear client. The rain of fear client, as such, will only have 3 ranks like the other clients, but supports a theoretical 8 ranks later.

View File

@ -2287,10 +2287,13 @@ struct Stun_Struct { // 4 bytes total
}; };
struct AugmentItem_Struct { struct AugmentItem_Struct {
/*00*/ int16 container_slot; /*00*/ uint32 container_index;
/*02*/ char unknown02[2]; /*04*/ int32 container_slot;
/*04*/ int32 augment_slot; /*08*/ uint32 augment_index;
/*08*/ /*12*/ int32 augment_slot;
/*16*/ uint32 dest_inst_id; // The unique serial number for the item instance that is being augmented
/*20*/ int32 augment_action; // Guessed - 0 = augment, 1 = remove with distiller, 3 = delete aug
/*24*/
}; };
// OP_Emote // OP_Emote

View File

@ -4682,8 +4682,11 @@ DECODE(OP_AugmentItem) {
SETUP_DIRECT_DECODE(AugmentItem_Struct, structs::AugmentItem_Struct); SETUP_DIRECT_DECODE(AugmentItem_Struct, structs::AugmentItem_Struct);
emu->container_slot = RoFToServerSlot(eq->container_slot); emu->container_slot = RoFToServerSlot(eq->container_slot);
//emu->augment_slot = eq->augment_slot; emu->augment_slot = RoFToServerSlot(eq->augment_slot);
emu->container_index = eq->container_index;
emu->augment_index = eq->augment_index;
emu->dest_inst_id = eq->dest_inst_id;
emu->augment_action = eq->augment_action;
FINISH_DIRECT_DECODE(); FINISH_DIRECT_DECODE();
} }
@ -5090,7 +5093,7 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint
memset(&isbs, 0, sizeof(RoF::structs::ItemSecondaryBodyStruct)); memset(&isbs, 0, sizeof(RoF::structs::ItemSecondaryBodyStruct));
isbs.augtype = item->AugType; isbs.augtype = item->AugType;
isbs.augdistiller = 0; isbs.augdistiller = 65535;
isbs.augrestrict = item->AugRestrict; isbs.augrestrict = item->AugRestrict;

View File

@ -2519,10 +2519,10 @@ struct Stun_Struct { // 8 bytes total
struct AugmentItem_Struct { struct AugmentItem_Struct {
/*00*/ uint32 dest_inst_id; // The unique serial number for the item instance that is being augmented /*00*/ uint32 dest_inst_id; // The unique serial number for the item instance that is being augmented
/*04*/ uint32 unknown04; // Seen 0 /*04*/ uint32 container_index; // Seen 0
/*08*/ ItemSlotStruct container_slot; // Slot of the item being augmented /*08*/ ItemSlotStruct container_slot; // Slot of the item being augmented
/*20*/ uint32 unknown20; // Seen 0 /*20*/ uint32 augment_index; // Seen 0
/*24*/ ItemSlotStruct distiller_slot; // Slot of the distiller to use (if one applies) /*24*/ ItemSlotStruct augment_slot; // Slot of the distiller to use (if one applies)
/*36*/ int32 augment_action; // Guessed - 0 = augment, 1 = remove with distiller, 3 = delete aug /*36*/ int32 augment_action; // Guessed - 0 = augment, 1 = remove with distiller, 3 = delete aug
/*36*/ //int32 augment_slot; /*36*/ //int32 augment_slot;
/*40*/ /*40*/

View File

@ -6281,7 +6281,145 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app)
// Delegate to tradeskill object to perform combine // Delegate to tradeskill object to perform combine
AugmentItem_Struct* in_augment = (AugmentItem_Struct*)app->pBuffer; AugmentItem_Struct* in_augment = (AugmentItem_Struct*)app->pBuffer;
Object::HandleAugmentation(this, in_augment, m_tradeskill_object); bool deleteItems = false;
if(GetClientVersion() >= EQClientRoF)
{
ItemInst *itemOneToPush = nullptr, *itemTwoToPush = nullptr;
//Message(15, "%i %i %i %i %i %i", in_augment->container_slot, in_augment->augment_slot, in_augment->container_index, in_augment->augment_index, in_augment->augment_action, in_augment->dest_inst_id);
// Adding augment
if (in_augment->augment_action == 0)
{
ItemInst *tobe_auged, *auged_with = nullptr;
int8 slot=-1;
Inventory& user_inv = GetInv();
uint16 slot_id = in_augment->container_slot;
uint16 aug_slot_id = in_augment->augment_slot;
//Message(13, "%i AugSlot", aug_slot_id);
if(slot_id == INVALID_INDEX || aug_slot_id == INVALID_INDEX)
{
Message(13, "Error: Invalid Aug Index.");
return;
}
tobe_auged = user_inv.GetItem(slot_id);
auged_with = user_inv.GetItem(MainCursor);
if(tobe_auged && auged_with)
{
if (((slot=tobe_auged->AvailableAugmentSlot(auged_with->GetAugmentType()))!=-1) &&
(tobe_auged->AvailableWearSlot(auged_with->GetItem()->Slots)))
{
tobe_auged->PutAugment(slot, *auged_with);
ItemInst *aug = tobe_auged->GetAugment(in_augment->augment_index);
if(aug) {
std::vector<EQEmu::Any> args;
args.push_back(aug);
parse->EventItem(EVENT_AUGMENT_ITEM, this, tobe_auged, nullptr, "", in_augment->augment_index, &args);
args.assign(1, tobe_auged);
parse->EventItem(EVENT_AUGMENT_INSERT, this, aug, nullptr, "", in_augment->augment_index, &args);
}
else
{
Message(13, "Error: Could not find augmentation at index %i. Aborting.");
return;
}
itemOneToPush = tobe_auged->Clone();
// Must push items after the items in inventory are deleted - necessary due to lore items...
if (itemOneToPush)
{
DeleteItemInInventory(slot_id, 0, true);
DeleteItemInInventory(MainCursor, 0, true);
if(PutItemInInventory(slot_id, *itemOneToPush, true))
{
//Message(13, "Sucessfully added an augment to your item!");
return;
}
else
{
Message(13, "Error: No available slot for end result. Please free up some bag space.");
}
}
else
{
Message(13, "Error in cloning item for augment. Aborted.");
}
}
else
{
Message(13, "Error: No available slot for augment in that item.");
}
}
}
else if(in_augment->augment_action == 1)
{
ItemInst *tobe_auged, *auged_with = nullptr;
int8 slot=-1;
Inventory& user_inv = GetInv();
uint16 slot_id = in_augment->container_slot;
uint16 aug_slot_id = in_augment->augment_slot; //it's actually solvent slot
if(slot_id == INVALID_INDEX || aug_slot_id == INVALID_INDEX)
{
Message(13, "Error: Invalid Aug Index.");
return;
}
tobe_auged = user_inv.GetItem(slot_id);
auged_with = user_inv.GetItem(aug_slot_id);
ItemInst *old_aug = nullptr;
if(!auged_with)
return;
const uint32 id = auged_with->GetID();
ItemInst *aug = tobe_auged->GetAugment(in_augment->augment_index);
if(aug) {
std::vector<EQEmu::Any> args;
args.push_back(aug);
parse->EventItem(EVENT_UNAUGMENT_ITEM, this, tobe_auged, nullptr, "", in_augment->augment_index, &args);
args.assign(1, tobe_auged);
args.push_back(false);
parse->EventItem(EVENT_AUGMENT_REMOVE, this, aug, nullptr, "", in_augment->augment_index, &args);
}
else
{
Message(13, "Error: Could not find augmentation at index %i. Aborting.");
return;
}
old_aug = tobe_auged->RemoveAugment(in_augment->augment_index);
itemOneToPush = tobe_auged->Clone();
if (old_aug)
itemTwoToPush = old_aug->Clone();
if(itemOneToPush && itemTwoToPush && auged_with)
{
DeleteItemInInventory(slot_id, 0, true);
DeleteItemInInventory(aug_slot_id, auged_with->IsStackable() ? 1 : 0, true);
if(!PutItemInInventory(slot_id, *itemOneToPush, true))
{
Message(15, "Shouldn't happen, contact an admin!");
}
if(PutItemInInventory(MainCursor, *itemTwoToPush, true))
{
//Message(15, "Successfully removed an augmentation!");
}
}
}
}
else
{
Object::HandleAugmentation(this, in_augment, m_tradeskill_object);
}
return; return;
} }

View File

@ -11429,8 +11429,6 @@ void command_augmentitem(Client *c, const Seperator *sep)
AugmentItem_Struct* in_augment = new AugmentItem_Struct[sizeof(AugmentItem_Struct)]; AugmentItem_Struct* in_augment = new AugmentItem_Struct[sizeof(AugmentItem_Struct)];
in_augment->container_slot = 1000; // <watch> in_augment->container_slot = 1000; // <watch>
in_augment->unknown02[0] = 0;
in_augment->unknown02[1] = 0;
in_augment->augment_slot = -1; in_augment->augment_slot = -1;
if(c->GetTradeskillObject() != nullptr) if(c->GetTradeskillObject() != nullptr)
Object::HandleAugmentation(c, in_augment, c->GetTradeskillObject()); Object::HandleAugmentation(c, in_augment, c->GetTradeskillObject());