[Feature] Make ornamentations work with any augment type (#3281)

* [Feature] Make ornamentations work with any augment type

# Notes
- On Live there are augments that are not type 20/21 and are ornamentations.
- We also only allow a singular augment type to be ornamentation augment types, this will allow you to use any augment type as an ornamentation if it has a proper Hero's Forge model or a non-IT63/non-IT64 idfile.

* Update ruletypes.h

* Update client_packet.cpp

* Update item_instance.cpp

* Cleanup.
This commit is contained in:
Alex King
2023-04-16 10:26:19 -04:00
committed by GitHub
parent 93db35658a
commit fa3a5c7a72
9 changed files with 144 additions and 109 deletions
+26 -21
View File
@@ -204,13 +204,11 @@ int32 Mob::GetTextureProfileHeroForgeModel(uint8 material_slot) const
*/
int32 Mob::GetEquipmentMaterial(uint8 material_slot) const
{
uint32 equipment_material = 0;
int32 ornamentation_augment_type = RuleI(Character, OrnamentationAugmentType);
uint32 equipment_material = 0;
int32 texture_profile_material = GetTextureProfileMaterial(material_slot);
int32 texture_profile_material = GetTextureProfileMaterial(material_slot);
Log(Logs::Detail, Logs::MobAppearance,
"[%s] material_slot: %u texture_profile_material: %i",
LogMobAppearance(
"[{}] material_slot: {} texture_profile_material: {}",
clean_name,
material_slot,
texture_profile_material
@@ -233,9 +231,12 @@ int32 Mob::GetEquipmentMaterial(uint8 material_slot) const
}
const auto* inst = CastToClient()->m_inv[inventory_slot];
if (inst) {
if (inst->GetOrnamentationAug(ornamentation_augment_type)) {
item = inst->GetOrnamentationAug(ornamentation_augment_type)->GetItem();
const auto augment = inst->GetOrnamentationAugment();
if (augment) {
item = augment->GetItem();
if (item && strlen(item->IDFile) > 2 && Strings::IsNumber(&item->IDFile[2])) {
equipment_material = Strings::ToInt(&item->IDFile[2]);
}
@@ -310,21 +311,20 @@ uint32 Mob::GetEquipmentColor(uint8 material_slot) const
int32 Mob::GetHerosForgeModel(uint8 material_slot) const
{
uint32 hero_model = 0;
if (material_slot >= 0 && material_slot < EQ::textures::weaponPrimary) {
uint32 ornamentation_aug_type = RuleI(Character, OrnamentationAugmentType);
if (EQ::ValueWithin(material_slot, 0, EQ::textures::weaponPrimary)) {
const EQ::ItemData *item = database.GetItem(GetEquippedItemFromTextureSlot(material_slot));
int16 invslot = EQ::InventoryProfile::CalcSlotFromMaterial(material_slot);
const auto slot = EQ::InventoryProfile::CalcSlotFromMaterial(material_slot);
if (item != nullptr && invslot != INVALID_INDEX) {
if (item && slot != INVALID_INDEX) {
if (IsClient()) {
const EQ::ItemInstance *inst = CastToClient()->m_inv[invslot];
const auto inst = CastToClient()->m_inv[slot];
if (inst) {
if (inst->GetOrnamentationAug(ornamentation_aug_type)) {
item = inst->GetOrnamentationAug(ornamentation_aug_type)->GetItem();
const auto augment = inst->GetOrnamentationAugment();
if (augment) {
item = augment->GetItem();
hero_model = item->HerosForgeModel;
}
else if (inst->GetOrnamentHeroModel()) {
} else if (inst->GetOrnamentHeroModel()) {
hero_model = inst->GetOrnamentHeroModel();
}
}
@@ -341,8 +341,13 @@ int32 Mob::GetHerosForgeModel(uint8 material_slot) const
/**
* Robes require full model number, and should only be sent to chest, arms, wrists, and legs slots
*/
if (hero_model > 1000 && material_slot != 1 && material_slot != 2 && material_slot != 3 &&
material_slot != 5) {
if (
hero_model > 1000 &&
material_slot != EQ::textures::armorChest &&
material_slot != EQ::textures::armorArms &&
material_slot != EQ::textures::armorWrist &&
material_slot != EQ::textures::armorLegs
) {
hero_model = 0;
}
}
@@ -354,7 +359,7 @@ int32 Mob::GetHerosForgeModel(uint8 material_slot) const
* Otherwise, use the exact Model if model is > 999
* Robes for example are 11607 to 12107 in RoF
*/
if (hero_model > 0 && hero_model < 1000) {
if (EQ::ValueWithin(hero_model, 1, 999)) {
hero_model *= 100;
hero_model += material_slot;
}