[Quest API] (Performance) Check equip or scale item events exist before export and execute (#2898)

* [Quest API] Optional parse equip and scale item events

# Notes
- Optionally parse `EVENT_SCALE_CALC`, `EVENT_ITEM_ENTER_ZONE`, `EVENT_UNEQUIP_ITEM_BOT`, `EVENT_EQUIP_ITEM_BOT`, `EVENT_EQUIP_ITEM`, `EVENT_UNEQUIP_ITEM`, `EVENT_EQUIP_ITEM_CLIENT`, `EVENT_UNEQUIP_ITEM_CLIENT`

* Cleanup
This commit is contained in:
Alex King
2023-02-12 23:15:54 -05:00
committed by GitHub
parent efd6d2f9b1
commit bc6efd5f74
4 changed files with 122 additions and 72 deletions
+27 -8
View File
@@ -4009,7 +4009,10 @@ bool Client::CalcItemScale(uint32 slot_x, uint32 slot_y) {
if(inst->IsScaling())
{
uint16 oldexp = inst->GetExp();
parse->EventItem(EVENT_SCALE_CALC, this, inst, nullptr, "", 0);
if (parse->ItemHasQuestSub(inst, EVENT_SCALE_CALC)) {
parse->EventItem(EVENT_SCALE_CALC, this, inst, nullptr, "", 0);
}
if (inst->GetExp() != oldexp) { // if the scaling factor changed, rescale the item and update the client
inst->ScaleItem();
@@ -4028,7 +4031,10 @@ bool Client::CalcItemScale(uint32 slot_x, uint32 slot_y) {
if(a_inst->IsScaling())
{
uint16 oldexp = a_inst->GetExp();
parse->EventItem(EVENT_SCALE_CALC, this, a_inst, nullptr, "", 0);
if (parse->ItemHasQuestSub(a_inst, EVENT_SCALE_CALC)) {
parse->EventItem(EVENT_SCALE_CALC, this, a_inst, nullptr, "", 0);
}
if (a_inst->GetExp() != oldexp)
{
@@ -4096,9 +4102,14 @@ bool Client::DoItemEnterZone(uint32 slot_x, uint32 slot_y) {
{
uint16 oldexp = inst->GetExp();
parse->EventItem(EVENT_ITEM_ENTER_ZONE, this, inst, nullptr, "", 0);
if (parse->ItemHasQuestSub(inst, EVENT_ITEM_ENTER_ZONE)) {
parse->EventItem(EVENT_ITEM_ENTER_ZONE, this, inst, nullptr, "", 0);
}
if (i <= EQ::invslot::EQUIPMENT_END) {
parse->EventItem(EVENT_EQUIP_ITEM, this, inst, nullptr, "", i);
if (parse->ItemHasQuestSub(inst, EVENT_EQUIP_ITEM)) {
parse->EventItem(EVENT_EQUIP_ITEM, this, inst, nullptr, "", i);
}
}
if (inst->GetExp() != oldexp) { // if the scaling factor changed, rescale the item and update the client
@@ -4108,10 +4119,14 @@ bool Client::DoItemEnterZone(uint32 slot_x, uint32 slot_y) {
}
} else {
if (i <= EQ::invslot::EQUIPMENT_END) {
parse->EventItem(EVENT_EQUIP_ITEM, this, inst, nullptr, "", i);
if (parse->ItemHasQuestSub(inst, EVENT_EQUIP_ITEM)) {
parse->EventItem(EVENT_EQUIP_ITEM, this, inst, nullptr, "", i);
}
}
parse->EventItem(EVENT_ITEM_ENTER_ZONE, this, inst, nullptr, "", 0);
if (parse->ItemHasQuestSub(inst, EVENT_ITEM_ENTER_ZONE)) {
parse->EventItem(EVENT_ITEM_ENTER_ZONE, this, inst, nullptr, "", 0);
}
}
//iterate all augments
@@ -4125,7 +4140,9 @@ bool Client::DoItemEnterZone(uint32 slot_x, uint32 slot_y) {
{
uint16 oldexp = a_inst->GetExp();
parse->EventItem(EVENT_ITEM_ENTER_ZONE, this, a_inst, nullptr, "", 0);
if (parse->ItemHasQuestSub(a_inst, EVENT_ITEM_ENTER_ZONE)) {
parse->EventItem(EVENT_ITEM_ENTER_ZONE, this, a_inst, nullptr, "", 0);
}
if (a_inst->GetExp() != oldexp)
{
@@ -4134,7 +4151,9 @@ bool Client::DoItemEnterZone(uint32 slot_x, uint32 slot_y) {
update_slot = true;
}
} else {
parse->EventItem(EVENT_ITEM_ENTER_ZONE, this, a_inst, nullptr, "", 0);
if (parse->ItemHasQuestSub(a_inst, EVENT_ITEM_ENTER_ZONE)) {
parse->EventItem(EVENT_ITEM_ENTER_ZONE, this, a_inst, nullptr, "", 0);
}
}
}