[Quest API] (Performance) Check event EVENT_ENVIRONMENTAL_DAMAGE exists before export and execute (#2899)

* [Quest API] Optionally parse EVENT_ENVIRONMENTAL_DAMAGE

# Notes
- Optionally parses this event instead of always doing so.

* Update client_packet.cpp
This commit is contained in:
Alex King 2023-02-13 00:00:04 -05:00 committed by GitHub
parent de047fb851
commit 0a7d482299
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6180,14 +6180,17 @@ void Client::Handle_OP_EnvDamage(const EQApplicationPacket *app)
return;
} else {
SetHP(GetHP() - (damage * RuleR(Character, EnvironmentDamageMulipliter)));
int final_damage = (damage * RuleR(Character, EnvironmentDamageMulipliter));
std::string export_string = fmt::format(
"{} {} {}",
ed->damage,
ed->dmgtype,
final_damage
);
parse->EventPlayer(EVENT_ENVIRONMENTAL_DAMAGE, this, export_string, 0);
if (parse->PlayerHasQuestSub(EVENT_ENVIRONMENTAL_DAMAGE)) {
int final_damage = (damage * RuleR(Character, EnvironmentDamageMulipliter));
const auto& export_string = fmt::format(
"{} {} {}",
ed->damage,
ed->dmgtype,
final_damage
);
parse->EventPlayer(EVENT_ENVIRONMENTAL_DAMAGE, this, export_string, 0);
}
}
if (GetHP() <= 0) {