-
Posted by xentro on Thu, 15 Mar 2012 18:02:24
Hey guys,
So i've got this addon ever since vanilla, but they stopped updating it. It has worked fine up until 4.3 and now it doesn't work anymore, i've tried to fix it myself, but i can't find what's wrong ( i fail to find sites who list functions and don't understand some of the code used). Now i wonder if any of you guys can see what's going wrong.
Your help is VERY much appreciated :)
Kind regards, Xentro
This is the code (main file, as there are some settings files too):
--This function adds a splatter to the texture frame. function BS_AddSplatters(args)
if (BS_BloodBehaviour == 1) then for i = 0, GetComboPoints("player")-1 do if (not BS_Textures[i]:IsVisible()) then BS_Textures[i]:Show(); BS_Texture_OnShow(i, BS_MaximalScalingFactor); end end else local eventType = args[2]; local srcGUID = args[3]; local destGUID = args[6]; local scale = BS_MaximalScalingFactor; local dmg = 0; if (srcGUID == UnitGUID("player")) then if (BS_BloodBehaviour == 2) then if (destGUID == UnitGUID ("target")) then if ((eventType == "SWING_DAMAGE") and (args[15]) and (BS_DisplayOnWhiteCrits)) then BS_CritCount = BS_CritCount+1; dmg = args[9]; end if ((eventType == "RANGE_DAMAGE") and (args[18]) and (BS_DisplayOnWhiteCrits) and (not BS_EnableRangeCheck)) then BS_CritCount = BS_CritCount+1; dmg = args[12]; end if ((eventType == "SPELL_DAMAGE") and (args[18]) and ((not BS_EnableRangeCheck) or (BS_InRange()))) then BS_CritCount = BS_CritCount+1; dmg = args[12]; end if ((eventType == "SPELL_PERIODIC_DAMAGE") and (args[18]) and ((not BS_EnableRangeCheck) or (BS_InRange()))) then BS_CritCount = BS_CritCount+1; dmg = args[12]; end end if ((BS_MeasurementActive) and (dmg ~= 0)) then BS_DamageMeasurement_Evaluate(dmg); end if (BS_DamageReference) then dmg = math.max(BS_DamageReference_LowerDamageLimit,dmg); scale = BS_MinimalScalingFactor+(BS_MaximalScalingFactor-BS_MinimalScalingFactor)*(dmg/BS_DamageReference_UpperDamageLimit); end for i = 0,math.min(BS_CritCount-1,BS_MaximumTextures-1) do if (not BS_Textures[i]:IsVisible()) then BS_Textures[i]:Show(); BS_Texture_OnShow(i, scale); end end end if (BS_BloodBehaviour == 3) then if (destGUID == UnitGUID ("target")) then local CritMatchesConfig = false; if ((eventType == "SWING_DAMAGE") and (args[15]) and (BS_DisplayOnWhiteCrits)) then CritMatchesConfig = true; dmg = args[9]; end if ((eventType == "RANGE_DAMAGE") and (args[18]) and (BS_DisplayOnWhiteCrits) and (not BS_EnableRangeCheck)) then CritMatchesConfig = true; dmg = args[12]; end if ((eventType == "SPELL_DAMAGE") and (args[18]) and ((not BS_EnableRangeCheck) or (BS_InRange()))) then CritMatchesConfig = true; dmg = args[12]; end if ((eventType == "SPELL_PERIODIC_DAMAGE") and (args[18]) and ((not BS_EnableRangeCheck) or (BS_InRange()))) then CritMatchesConfig = true; dmg = args[12]; end if ((BS_MeasurementActive) and (dmg ~= 0)) then BS_DamageMeasurement_Evaluate(dmg); end if (BS_DamageReference) then dmg = math.max(BS_DamageReference_LowerDamageLimit,dmg); scale = BS_MinimalScalingFactor+(BS_MaximalScalingFactor-BS_MinimalScalingFactor)*(dmg/BS_DamageReference_UpperDamageLimit); end if (CritMatchesConfig) then BS_LastTextureShown = (BS_LastTextureShown+1)%BS_MaximumTextures; BS_Timers[BS_LastTextureShown] = time(); BS_Textures[BS_LastTextureShown]:Show(); BS_Texture_OnShow(BS_LastTextureShown, scale); end end end if (BS_BloodBehaviour == 4) then if (destGUID == UnitGUID ("target")) then local CritMatchesConfig = false; if ((eventType == "SWING_DAMAGE") and (args[15]) and (BS_DisplayOnWhiteCrits)) then CritMatchesConfig = true; dmg = args[9]; end if ((eventType == "RANGE_DAMAGE") and (args[18]) and (BS_DisplayOnWhiteCrits) and (not BS_EnableRangeCheck)) then CritMatchesConfig = true; dmg = args[12]; end if ((eventType == "SPELL_DAMAGE") and (args[18]) and ((not BS_EnableRangeCheck) or (BS_InRange()))) then CritMatchesConfig = true; dmg = args[12]; end if ((eventType == "SPELL_PERIODIC_DAMAGE") and (args[18]) and ((not BS_EnableRangeCheck) or (BS_InRange()))) then CritMatchesConfig = true; dmg = args[12]; end if ((BS_MeasurementActive) and (dmg ~= 0)) then BS_DamageMeasurement_Evaluate(dmg); end if (BS_DamageReference) then dmg = math.max(BS_DamageReference_LowerDamageLimit,dmg); scale = BS_MinimalScalingFactor+(BS_MaximalScalingFactor-BS_MinimalScalingFactor)*(dmg/BS_DamageReference_UpperDamageLimit); end if (CritMatchesConfig) then BS_LastTextureShown = (BS_LastTextureShown+1)%BS_MaximumTextures; BS_GlobalTimer = time(); BS_Textures[BS_LastTextureShown]:Show(); BS_Texture_OnShow(BS_LastTextureShown, scale); end end end end end
end
--This function handles the used game events. function BS_OnEvent(self, event, ...)
local args = {...}; if (event == "ADDON_LOADED") then if (args[1] == "BloodyScreen") then BS_Init(); end end if ((event == "UNIT_COMBO_POINTS") and (BS_BloodBehaviour == 1)) then if (((BS_EnableOnPVP) and (UnitIsPlayer("target"))) or ((BS_EnableOnPVE) and (not UnitIsPlayer("target")))) then BS_AddSplatters(args); end end if ((event == "COMBAT_LOG_EVENT_UNFILTERED") and (BS_BloodBehaviour > 1)) then if (((BS_EnableOnPVP) and (UnitIsPlayer("target"))) or ((BS_EnableOnPVE) and (not UnitIsPlayer("target")))) then BS_AddSplatters(args); end end
end
--This function is called, whenever the texture frame is updated. It determines, which textures have to be hidden. function BSTexturesOnUpdate()
if (math.min(BS_TextureFrame:GetWidth(), BS_TextureFrame:GetHeight()) < 0) then BS_AjustTextureFrame(); end if (not BS_ConfigFrameOpen) then if (BS_BloodBehaviour == 1) then for i = 0,BS_MaximumTextures-1 do if ((i >= GetComboPoints("player")) and ((BS_Textures[i]:IsVisible()) and (BS_FadingIterator[i] <= 0))) then BS_FadingIterator[i] = 1; end end end if (BS_BloodBehaviour == 2) then if (UnitAffectingCombat("player") == nil) then for i = 0, BS_MaximumTextures-1 do if ((BS_Textures[i]:IsVisible()) and (BS_FadingIterator[i] <= 0)) then BS_FadingIterator[i] = 1; end end end end if (BS_BloodBehaviour == 3) then for i = 0,BS_MaximumTextures-1 do if ((BS_Timers[i] > 0) or (BS_Textures[i]:IsVisible())) then if ((BS_Timers[i] < time()-BS_Timer_RunTime) and (BS_FadingIterator[i] <= 0)) then BS_Timers[i] = 0; BS_FadingIterator[i] = 1; end end end end if (BS_BloodBehaviour == 4) then if (BS_GlobalTimer > 0) then if (BS_GlobalTimer < time()-BS_Timer_RunTime) then BS_GlobalTimer = 0; for i = 0, BS_MaximumTextures-1 do BS_FadingIterator[i] = 1; end end end end BS_Textures_Hide(); end
end
--This function shows all actually used textures. function BS_ShowAllTextures()
for i = 0,BS_MaximumTextures-1 do if (not BS_Textures[i]:IsVisible()) then BS_Textures[i]:Show(); BS_Texture_OnShow(i, BS_MaximalScalingFactor); end end
end
--This function hides all shown textures and sets their timer to zero. function BS_HideAllTextures()
BS_GlobalTimer = 0; BS_CritCount = 0; for i = 0,BS_MaximumTextures-1 do BS_FadingIterator[i] = 1; BS_Timers[i] = 0; end
end
--This function dynamically creates textures for later use. function BS_CreateTextures()
for i = 0,(BS_MaximumTextures-1) do if (BS_Textures[i] == nil) then BS_Textures[i] = BS_TextureFrame:CreateTexture("BS_Splatter"..i, "BACKGROUND"); BS_Textures[i]:SetTexture(BS_TexturePath..((i%BS_NumberOfTextureFiles)+1)); BS_Textures[i]:SetWidth(266); BS_Textures[i]:SetHeight(266); BS_Textures[i]:SetBlendMode("MOD"); BS_Textures[i]:Hide(); end if (BS_Timers[i] == nil) then BS_Timers[i] = 0; end if (BS_Alpha[i] == nil) then BS_Alpha[i] = 1; end if (BS_FadingIterator[i] == nil) then BS_FadingIterator[i] = 0; end end
end
--This function handles the display option of each texture, when it gets visible; it rotates them randomly and sets their scaling. function BSTextureOnShow(i, s)
if (266*s > math.min(BS_TextureFrame:GetWidth(),BS_TextureFrame:GetHeight())) then s = math.floor(math.min(BS_TextureFrame:GetWidth(),BS_TextureFrame:GetHeight())/26.6)/10; end if (s ~= 0) then BS_Alpha[i] = 1; BS_Textures[i]:SetTexture(BS_TexturePath..((i%BS_NumberOfTextureFiles)+1).."_"..BS_Alpha[i]); BS_Textures[i]:SetRotation(math.rad(random(360))); BS_Textures[i]:ClearAllPoints(); BS_Textures[i]:SetWidth(266*s); BS_Textures[i]:SetHeight(266*s); local width = BS_TextureFrame:GetWidth()-BS_Textures[i]:GetWidth(); local height = BS_TextureFrame:GetHeight()-BS_Textures[i]:GetHeight(); if (with == 0) then width = 1; end if (height == 0) then height = 1; end BS_Textures[i]:SetPoint("CENTER", BS_TextureFrame, "CENTER", random(width)-(width/2), random(height)-(height/2)); else print("|cff0000ffBloodyScreen: |cffff0000"..BS_String_Error_TextureFrameSize.."|r"); end
end
--This function handles the fading of the vanishing textures function BSTexturesHide()
for i = 0,BS_MaximumTextures-1 do if ((BS_FadingIterator[i] > 0) and (BS_Textures[i]:IsVisible())) then BS_FadingIterator[i] = BS_FadingIterator[i]+1; local miniteratorvalue = (BS_FadingTime*GetFramerate())/10; if (BS_FadingIterator[i] > miniteratorvalue) then BS_FadingIterator[i] = BS_FadingIterator[i] - math.floor(miniteratorvalue); BS_Texture_ChangeAlpha(i); end end end
end
--This function reduces the alpha value of the given texture by 10% function BSTextureChangeAlpha(i)
BS_Alpha[i] = BS_Alpha[i]+1; if (BS_Alpha[i] > 10) then BS_Timers[i] = 0; BS_FadingIterator[i] = 0; BS_Textures[i]:Hide(); if (BS_CritCount > 0) then BS_CritCount=0; end else BS_Textures[i]:SetTexture(BS_TexturePath..((i%BS_NumberOfTextureFiles)+1).."_"..BS_Alpha[i]); end
end
--This function is used by the damage measurement option. function BSDamageMeasurementEvaluate(dmg)
BS_DamageMeasurement_AverageDamage=BS_DamageMeasurement_AverageDamage*BS_DamageMeasurement_HitsCounted+dmg; BS_DamageMeasurement_HitsCounted=BS_DamageMeasurement_HitsCounted+1; BS_DamageMeasurement_AverageDamage=BS_DamageMeasurement_AverageDamage/BS_DamageMeasurement_HitsCounted; BS_DamageMeasurement_MaximalDamage = math.max(BS_DamageMeasurement_MaximalDamage,dmg); if (BS_DamageMeasurement_HitsCounted >= BS_DamageMeasurement_NumberOfHits) then BS_MeasurementActive = false; BS_DamageReference_UpperDamageLimit = BS_DamageMeasurement_MaximalDamage; BS_DamageReference_AverageDamage = BS_DamageMeasurement_AverageDamage; BS_EvaluateDamageData(); print("|cff0000ffBloodyScreen: |cff00ff00"..BS_String_Notification_MeasurementFinished.."|r"); end
end
--This function checks if the target is in combat range. It returns true if the target is in range or a check isn't possible. function BS_InRange()
local _,class = UnitClass("player"); if (BS_RangeCheckAction[class] > 0) then local spellname, _, _, _, _, _, _, _, _ = GetSpellInfo(BS_RangeCheckAction[class]); if (IsSpellInRange(spellname, "target") == 0) then return false; end end return true;
end
-
Posted by acidweb on Thu, 15 Mar 2012 18:23:05
COMBATLOGEVENT_UNFILTERED event was modified in 4.3.
I drycoded fix - not tested it.
local srcGUID = args[3]; -> local srcGUID = args[4]; local destGUID = args[6]; -> local destGUID = args[8];
And then replace all:
args[15] with args[21] args[9] with args[15] args[18] with args[21] args[12] with args[15]
-
Posted by xentro on Thu, 15 Mar 2012 18:31:59
Wtf man it works, thanks a LOT, but where do you find these changes?
-
Posted by acidweb on Thu, 15 Mar 2012 18:39:55
I don't read about them anywhere :-)
After I examined the code I just checked new field numbers here:
http://wowprogramming.com/docs/events/COMBATLOGEVENT_UNFILTERED