[Quest API] Add EVENT_DAMAGE_GIVEN and EVENT_DAMAGE_TAKEN to Perl/Lua. (#2804)

* [Quest API] Add EVENT_DAMAGE_GIVEN and EVENT_DAMAGE_TAKEN to Perl/Lua.

# Perl
- Add `EVENT_DAMAGE_GIVEN`.
- Add `EVENT_DAMAGE_TAKEN`.
- Both events export `$entity_id`, `$damage`, `$spell_id`, `$skill_id`, `$is_damage_shield`, `$is_avoidable`, `$buff_slot`, `$is_buff_tic`, `$special_attack`.

# Lua
- Add `event_damage_given`.
- Add `event_damage_taken`.
- Both events export `e.entity_id`, `e.damage`, `e.spell_id`, `e.skill_id`, `e.is_damage_shield`, `e.is_avoidable`, `e.buff_slot`, `e.is_buff_tic`, `e.special_attack`, and `e.other`.

# Notes
- These events allow operators to have events fire based on damage given or taken, as well as keep better track of a Bot, Client, or NPC's damage per second or otherwise.
- Special Attack is only useful for NPCs, but allows you to see if the attack is Rampage, AERampage, or Chaotic Stab.

* Cleanup.
This commit is contained in:
Alex King
2023-01-29 14:35:17 -05:00
committed by GitHub
parent a489290eba
commit b867d40774
6 changed files with 257 additions and 14 deletions
+17
View File
@@ -171,6 +171,8 @@ const char *QuestEventSubroutines[_LargestEventID] = {
"EVENT_AUGMENT_REMOVE_CLIENT",
"EVENT_EQUIP_ITEM_BOT",
"EVENT_UNEQUIP_ITEM_BOT",
"EVENT_DAMAGE_GIVEN",
"EVENT_DAMAGE_TAKEN",
// Add new events before these or Lua crashes
"EVENT_SPELL_EFFECT_BOT",
"EVENT_SPELL_EFFECT_BUFF_TIC_BOT"
@@ -2031,6 +2033,21 @@ void PerlembParser::ExportEventVariables(
break;
}
case EVENT_DAMAGE_GIVEN:
case EVENT_DAMAGE_TAKEN:{
Seperator sep(data);
ExportVar(package_name.c_str(), "entity_id", sep.arg[0]);
ExportVar(package_name.c_str(), "damage", sep.arg[1]);
ExportVar(package_name.c_str(), "spell_id", sep.arg[2]);
ExportVar(package_name.c_str(), "skill_id", sep.arg[3]);
ExportVar(package_name.c_str(), "is_damage_shield", sep.arg[4]);
ExportVar(package_name.c_str(), "is_avoidable", sep.arg[5]);
ExportVar(package_name.c_str(), "buff_slot", sep.arg[6]);
ExportVar(package_name.c_str(), "is_buff_tic", sep.arg[7]);
ExportVar(package_name.c_str(), "special_attack", sep.arg[8]);
break;
}
default: {
break;
}