|
802 | 802 |
|
803 | 803 | function STATUSBTN:CastBar_OnEvent(event, ...) |
804 | 804 |
|
805 | | - local unit = ... |
| 805 | + local unit = select(1, ...) |
| 806 | + local eventCastID = select(2,...)--return payload is "unitTarget", "castGUID", spellID |
806 | 807 |
|
807 | 808 | if (unit ~= self.sb.unit) then |
808 | 809 | return |
@@ -876,39 +877,13 @@ function STATUSBTN:CastBar_OnEvent(event, ...) |
876 | 877 | self.sb.cbtimer.castInfo[unit][1] = text |
877 | 878 | self.sb.cbtimer.castInfo[unit][2] = "%0.1f" |
878 | 879 |
|
879 | | - elseif (event == "UNIT_SPELLCAST_SUCCEEDED" and not self.sb.channeling) then |
| 880 | + elseif (event == "UNIT_SPELLCAST_SUCCEEDED" and not self.sb.channeling) then --don't do anything with this event when channeling as it fires at each pulse of a spell channel |
880 | 881 |
|
881 | 882 | self.sb:SetStatusBarColor(self.sb.successColor[1], self.sb.successColor[2], self.sb.successColor[3], self.sb.successColor[4]) |
882 | 883 |
|
883 | | - elseif (event == "UNIT_SPELLCAST_SUCCEEDED" and self.sb.channeling) then |
| 884 | + elseif (event == "UNIT_SPELLCAST_FAILED" or event == "UNIT_SPELLCAST_INTERRUPTED" or event == "UNIT_SPELLCAST_STOP" or event == "UNIT_SPELLCAST_CHANNEL_STOP") and self.sb.castID == eventCastID then |
884 | 885 |
|
885 | | - -- do nothing (when Tranquility is channeling if reports UNIT_SPELLCAST_SUCCEEDED many times during the duration) |
886 | | - |
887 | | - elseif (event == "UNIT_SPELLCAST_STOP" or event == "UNIT_SPELLCAST_CHANNEL_STOP") then |
888 | | - |
889 | | - if ((self.sb.casting and event == "UNIT_SPELLCAST_STOP") or |
890 | | - (self.sb.channeling and event == "UNIT_SPELLCAST_CHANNEL_STOP")) then |
891 | | - |
892 | | - self.sb.spark:Hide() |
893 | | - self.sb.barflash:SetAlpha(0.0) |
894 | | - self.sb.barflash:Show() |
895 | | - |
896 | | - self.sb:SetValue(self.sb.maxValue) |
897 | | - |
898 | | - if (event == "UNIT_SPELLCAST_STOP") then |
899 | | - self.sb.casting = false |
900 | | - else |
901 | | - self.sb.channeling = false |
902 | | - end |
903 | | - |
904 | | - self.sb.flash = 1 |
905 | | - self.sb.fadeOut = 1 |
906 | | - self.sb.holdTime = 0 |
907 | | - end |
908 | | - |
909 | | - elseif (event == "UNIT_SPELLCAST_FAILED" or event == "UNIT_SPELLCAST_INTERRUPTED") then |
910 | | - |
911 | | - if (self.sb:IsShown() and (self.sb.casting) and not self.sb.fadeOut) then |
| 886 | + if (self.sb:IsShown() and ((self.sb.casting) or self.sb.channeling) and not self.sb.fadeOut) then |
912 | 887 |
|
913 | 888 | self.sb:SetValue(self.sb.maxValue) |
914 | 889 |
|
|
0 commit comments