[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
+7 -6
View File
@@ -5619,7 +5619,6 @@ void Client::ProcessInspectRequest(Client *requestee, Client *requester)
const EQ::ItemData *item = nullptr;
const EQ::ItemInstance *inst = nullptr;
int ornamentation_augment_type = RuleI(Character, OrnamentationAugmentType);
for (int16 L = EQ::invslot::EQUIPMENT_BEGIN; L <= EQ::invslot::EQUIPMENT_END; L++) {
inst = requestee->GetInv().GetItem(L);
@@ -5629,13 +5628,15 @@ void Client::ProcessInspectRequest(Client *requestee, Client *requester)
if (item) {
strcpy(insr->itemnames[L], item->Name);
const EQ::ItemData *aug_item = nullptr;
if (inst->GetOrnamentationAug(ornamentation_augment_type)) {
aug_item = inst->GetOrnamentationAug(ornamentation_augment_type)->GetItem();
const EQ::ItemData *augment_item = nullptr;
const auto augment = inst->GetOrnamentationAugment();
if (augment) {
augment_item = augment->GetItem();
}
if (aug_item) {
insr->itemicons[L] = aug_item->Icon;
if (augment_item) {
insr->itemicons[L] = augment_item->Icon;
} else if (inst->GetOrnamentationIcon()) {
insr->itemicons[L] = inst->GetOrnamentationIcon();
} else {
+27 -23
View File
@@ -8613,47 +8613,51 @@ void Client::Handle_OP_Illusion(const EQApplicationPacket *app)
void Client::Handle_OP_InspectAnswer(const EQApplicationPacket *app)
{
if (app->size != sizeof(InspectResponse_Struct)) {
LogError("Wrong size: OP_InspectAnswer, size=[{}], expected [{}]", app->size, sizeof(InspectResponse_Struct));
return;
}
//Fills the app sent from client.
EQApplicationPacket* outapp = app->Copy();
InspectResponse_Struct* insr = (InspectResponse_Struct*)outapp->pBuffer;
Mob* tmp = entity_list.GetMob(insr->TargetID);
const EQ::ItemData* item = nullptr;
auto outapp = app->Copy();
auto insr = (InspectResponse_Struct *) outapp->pBuffer;
auto tmp = entity_list.GetMob(insr->TargetID);
const EQ::ItemData *item = nullptr;
int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType);
for (int16 L = EQ::invslot::EQUIPMENT_BEGIN; L <= EQ::invslot::EQUIPMENT_END; L++) {
const EQ::ItemInstance* inst = GetInv().GetItem(L);
for (int16 L = EQ::invslot::EQUIPMENT_BEGIN; L <= EQ::invslot::EQUIPMENT_END; L++) {
const auto inst = GetInv().GetItem(L);
item = inst ? inst->GetItem() : nullptr;
if (item) {
strcpy(insr->itemnames[L], item->Name);
if (inst && inst->GetOrnamentationAug(ornamentationAugtype)) {
const EQ::ItemData *aug_item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem();
insr->itemicons[L] = aug_item->Icon;
}
else if (inst->GetOrnamentationIcon()) {
insr->itemicons[L] = inst->GetOrnamentationIcon();
}
else {
if (inst) {
const auto augment = inst->GetOrnamentationAugment();
if (augment) {
insr->itemicons[L] = augment->GetItem()->Icon;
} else if (inst->GetOrnamentationIcon()) {
insr->itemicons[L] = inst->GetOrnamentationIcon();
}
} else {
insr->itemicons[L] = item->Icon;
}
} else {
insr->itemicons[L] = 0xFFFFFFFF;
}
else { insr->itemicons[L] = 0xFFFFFFFF; }
}
InspectMessage_Struct* newmessage = (InspectMessage_Struct*)insr->text;
InspectMessage_Struct& playermessage = GetInspectMessage();
memcpy(&playermessage, newmessage, sizeof(InspectMessage_Struct));
database.SaveCharacterInspectMessage(CharacterID(), &playermessage);
auto message = (InspectMessage_Struct *) insr->text;
auto inspect_message = GetInspectMessage();
if (tmp != 0 && tmp->IsClient()) { tmp->CastToClient()->QueuePacket(outapp); } // Send answer to requester
memcpy(&inspect_message, message, sizeof(InspectMessage_Struct));
database.SaveCharacterInspectMessage(CharacterID(), &inspect_message);
return;
if (
tmp &&
tmp->IsClient()
) {
tmp->CastToClient()->QueuePacket(outapp);
} // Send answer to requester
}
void Client::Handle_OP_InspectMessageUpdate(const EQApplicationPacket *app)
+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;
}