[Rules] Add Invisible Augment Rules (#4385)

* [Rules] Add Invisible Augment Slot Rule

* Update item_instance.cpp

* Second rule

* Update ruletypes.h
This commit is contained in:
Alex King 2024-06-14 13:02:21 -04:00 committed by GitHub
parent abc8c3d886
commit 187288f3aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 29 deletions

View File

@ -303,47 +303,34 @@ int8 EQ::ItemInstance::AvailableAugmentSlot(int32 augment_type) const
return INVALID_INDEX; return INVALID_INDEX;
} }
auto i = invaug::SOCKET_BEGIN; for (int16 slot_id = invaug::SOCKET_BEGIN; slot_id <= invaug::SOCKET_END; ++slot_id) {
for (; i <= invaug::SOCKET_END; ++i) { if (IsAugmentSlotAvailable(augment_type, slot_id)) {
if (GetItem(i)) { return slot_id;
continue;
}
if (
augment_type == -1 ||
(
m_item->AugSlotType[i] &&
((1 << (m_item->AugSlotType[i] - 1)) & augment_type)
)
) {
break;
} }
} }
return (i <= invaug::SOCKET_END) ? i : INVALID_INDEX; return INVALID_INDEX;
} }
bool EQ::ItemInstance::IsAugmentSlotAvailable(int32 augment_type, uint8 slot) const bool EQ::ItemInstance::IsAugmentSlotAvailable(int32 augment_type, uint8 slot) const
{ {
if (!m_item || !m_item->IsClassCommon()) { if (!m_item || !m_item->IsClassCommon() || GetItem(slot)) {
return false; return false;
} }
if ( return (
( (
!GetItem(slot) && augment_type == -1 ||
m_item->AugSlotVisible[slot] (
m_item->AugSlotType[slot] &&
((1 << (m_item->AugSlotType[slot] - 1)) & augment_type)
)
) && ) &&
augment_type == -1 ||
( (
m_item->AugSlotType[slot] && RuleB(Items, AugmentItemAllowInvisibleAugments) ||
((1 << (m_item->AugSlotType[slot] - 1)) & augment_type) m_item->AugSlotVisible[slot]
) )
) { );
return true;
}
return false;
} }
// Retrieve item inside container // Retrieve item inside container

View File

@ -996,6 +996,8 @@ RULE_BOOL(Items, DisableNoRent, false, "Enable this to disable No Rent Items")
RULE_BOOL(Items, DisableNoTransfer, false, "Enable this to disable No Transfer Items") RULE_BOOL(Items, DisableNoTransfer, false, "Enable this to disable No Transfer Items")
RULE_BOOL(Items, DisablePotionBelt, false, "Enable this to disable Potion Belt Items") RULE_BOOL(Items, DisablePotionBelt, false, "Enable this to disable Potion Belt Items")
RULE_BOOL(Items, DisableSpellFocusEffects, false, "Enable this to disable Spell Focus Effects on Items") RULE_BOOL(Items, DisableSpellFocusEffects, false, "Enable this to disable Spell Focus Effects on Items")
RULE_BOOL(Items, SummonItemAllowInvisibleAugments, false, "Enable this to allow augments to be put in invisible augment slots of items in Client::SummonItem")
RULE_BOOL(Items, AugmentItemAllowInvisibleAugments, false, "Enable this to allow augments to be put in invisible augment slots by players")
RULE_CATEGORY_END() RULE_CATEGORY_END()
RULE_CATEGORY(Parcel) RULE_CATEGORY(Parcel)

View File

@ -384,7 +384,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
return false; return false;
} }
if(item->AugSlotVisible[iter] == 0) { if (!RuleB(Items, SummonItemAllowInvisibleAugments) && item->AugSlotVisible[iter] == 0) {
Message( Message(
Chat::Red, Chat::Red,
fmt::format( fmt::format(
@ -1105,7 +1105,7 @@ void Client::DeleteItemInInventory(int16 slot_id, int16 quantity, bool client_up
if(update_db) if(update_db)
database.SaveInventory(character_id, inst, slot_id); database.SaveInventory(character_id, inst, slot_id);
} }
if(client_update && IsValidSlot(slot_id)) { if(client_update && IsValidSlot(slot_id)) {
EQApplicationPacket* outapp = nullptr; EQApplicationPacket* outapp = nullptr;
if(inst) { if(inst) {