View Single Post
06/10/20, 08:45 AM   #10
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
LightAttackHelper.onCombatEvent must be assigned as callback function to an event like EVENT_COMBAT_EVENT e.g.
So if this event also fires as the light attack does not hit you need to find out what parameters the callback function "LightAttackHelper.onCombatEvent" returns in this case.

Currently it checks for
Lua Code:
  1. if abilityActionSlotType == ACTION_SLOT_TYPE_LIGHT_ATTACK and LightAttackHelper.playerName == sourceName and abilityName == GetString(LAH_LIGHT_ATTACK) then
Makes sense. Only if the actionSlotType is a light attack, if the source is you and if the abilityName used is something for light attack.
Maybe one could also use an abilitId instead of a name here, not sure if it's always the same abilityId.

You could check what the parameters return by adding something like this at the start of the function LightAttackHelper.onCombatEvent
d("ActionSlotType: " ..tostring(abilityActionSlotType ) .. ", source: " .. tostring(sourceName) )
Just add additional .. "variableName: " .. tostring(variable) after the tostring(sourceName) (within the opening ( and closing ) of d) to see what the values are. Do a reloadui then and do some tests what is shown in your chat.

The possible variables of the function are these:
LightAttackHelper.onCombatEvent(_, _, _, abilityName, _, abilityActionSlotType, sourceName, _, _, _, hitValue)

Where all the _ could be special variables as well but you'd need to rename them to use them for a chat output.
The event_combat_event uses this parameters:
Code:
 EVENT_COMBAT_EVENT (number eventCode, number ActionResult result, boolean isError, string abilityName, number abilityGraphic, number ActionSlotType abilityActionSlotType, string sourceName, number CombatUnitType sourceType, string targetName, number CombatUnitType targetType, number hitValue, number CombatMechanicType powerType, number DamageType damageType, boolean log, number sourceUnitId, number targetUnitId, number abilityId, number overflow)
number, boolean, string etc. are the type of variables, and after that there is the name of the value that gets returned, like ActionResult or isError or abilityName.
You see, if you lay my event_combat_event function definition with all parameters above the function LightAttackHelper.onCombatEvent that the 1st _ would be eventCode, the 2nd would be Actionresult, the 3rd isError and then there is abilityName. And so on.
Just replace the _ in the function LightAttackHelper.onCombatEvent with the variables names I have shown you and you would be able to use them in your d() chat output, like e.g. ", isError: " .. tostring(isError)
  Reply With Quote