[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,8 +6180,10 @@ void Client::Handle_OP_EnvDamage(const EQApplicationPacket *app)
return; return;
} else { } else {
SetHP(GetHP() - (damage * RuleR(Character, EnvironmentDamageMulipliter))); SetHP(GetHP() - (damage * RuleR(Character, EnvironmentDamageMulipliter)));
if (parse->PlayerHasQuestSub(EVENT_ENVIRONMENTAL_DAMAGE)) {
int final_damage = (damage * RuleR(Character, EnvironmentDamageMulipliter)); int final_damage = (damage * RuleR(Character, EnvironmentDamageMulipliter));
std::string export_string = fmt::format( const auto& export_string = fmt::format(
"{} {} {}", "{} {} {}",
ed->damage, ed->damage,
ed->dmgtype, ed->dmgtype,
@ -6189,6 +6191,7 @@ void Client::Handle_OP_EnvDamage(const EQApplicationPacket *app)
); );
parse->EventPlayer(EVENT_ENVIRONMENTAL_DAMAGE, this, export_string, 0); parse->EventPlayer(EVENT_ENVIRONMENTAL_DAMAGE, this, export_string, 0);
} }
}
if (GetHP() <= 0) { if (GetHP() <= 0) {
mod_client_death_env(); mod_client_death_env();