diff --git a/changelog.txt b/changelog.txt index 23640f7e5..233f26b5e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 09/07/2014 == +Akkadius: Fixed ROF Augment item dupe with not checking for available slots properly and adding items to the virtual instance + == 09/06/2014 == Uleat: Tweaked 'Smart' trading code to return main slots before sub slots in stackable and free space search processes. (If enough people ask for it, I'll add an optional rule to allow 'bag packing' - the original implementation behavior) diff --git a/common/item.cpp b/common/item.cpp index 127f85614..513ddb23f 100644 --- a/common/item.cpp +++ b/common/item.cpp @@ -1580,6 +1580,16 @@ int8 ItemInst::AvailableAugmentSlot(int32 augtype) const return (i < EmuConstants::ITEM_COMMON_SIZE) ? i : INVALID_INDEX; } +bool ItemInst::IsAugmentSlotAvailable(int32 augtype, uint8 slot) const { + if (m_item->ItemClass != ItemClassCommon || !m_item) + return false; + + if ((!GetItem(slot) && m_item->AugSlotVisible[slot]) && augtype == -1 || (m_item->AugSlotType[slot] && ((1 << (m_item->AugSlotType[slot] - 1)) & augtype))) { + return true; + } + return false; +} + // Retrieve item inside container ItemInst* ItemInst::GetItem(uint8 index) const { diff --git a/common/item.h b/common/item.h index f279bd2aa..c24c708b1 100644 --- a/common/item.h +++ b/common/item.h @@ -274,6 +274,7 @@ public: inline bool IsAugmentable() const { return m_item->AugSlotType[0]!=0 || m_item->AugSlotType[1]!=0 || m_item->AugSlotType[2]!=0 || m_item->AugSlotType[3]!=0 || m_item->AugSlotType[4]!=0; } bool AvailableWearSlot(uint32 aug_wear_slots) const; int8 AvailableAugmentSlot(int32 augtype) const; + bool IsAugmentSlotAvailable(int32 augtype, uint8 slot) const; inline int32 GetAugmentType() const { return m_item->AugType; } inline bool IsExpendable() const { return ((m_item->Click.Type == ET_Expendable ) || (m_item->ItemType == ItemTypePotion)); } diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index fc77e0c82..9d7c9e01d 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -6307,12 +6307,12 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) tobe_auged = user_inv.GetItem(slot_id); auged_with = user_inv.GetItem(MainCursor); - if(tobe_auged && auged_with) + if (tobe_auged && auged_with) { - if (((slot=tobe_auged->AvailableAugmentSlot(auged_with->GetAugmentType()))!=-1) && + if (((tobe_auged->IsAugmentSlotAvailable(auged_with->GetAugmentType(), in_augment->augment_index)) != -1) && (tobe_auged->AvailableWearSlot(auged_with->GetItem()->Slots))) { - tobe_auged->PutAugment(slot, *auged_with); + tobe_auged->PutAugment(in_augment->augment_index, *auged_with); ItemInst *aug = tobe_auged->GetAugment(in_augment->augment_index); if(aug) { @@ -6325,7 +6325,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) } else { - Message(13, "Error: Could not find augmentation at index %i. Aborting."); + Message(13, "Error: Could not find augmentation at index %i. Aborting.", in_augment->augment_index); return; }