vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 <Ui xmlns="http://www.blizzard.com/wow/ui/"
2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3 xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\..\FrameXML\UI.xsd">
4 <Frame name="StatRingsEnemyHealth" parent="UIParent" inherits="StatRingsRingTemplate">
5 <Anchors>
6 <Anchor point="LEFT" relativeTo="StatRingsHealth">
7 <Offset>
8 <AbsDimension x="-15" y="0"/>
9 </Offset>
10 </Anchor>
11 </Anchors>
12 <Scripts>
13 <OnLoad>
14 StatRings_RegisterRing(this, "Enemy Health");
15 StatRingsRingTemplate_OnLoad();
16  
17 this:SetAlpha(0.1);
18  
19 this:RegisterEvent("PLAYER_ENTERING_WORLD");
20 this:RegisterEvent("UNIT_HEALTH");
21 this:RegisterEvent("UNIT_MAXHEALTH");
22 this:RegisterEvent("PLAYER_TARGET_CHANGED");
23  
24 this:UpdateColor({["r"] = 1, ["g"] = 0, ["b"] = 0});
25 if not UnitExists("target") then
26 this:SetMax(100);
27 this:SetValue(0);
28 else
29 this:SetMax(UnitHealthMax("target"));
30 this:SetValue(UnitHealth("target"));
31 end
32  
33 function this:UpdateAlpha()
34 if this.startValue &lt; this.maxValue then
35 StatRingsTest_SetAlpha(self, 0.6);
36 elseif this.startValue == this.maxValue then
37 StatRingsTest_SetAlpha(self, 0.05);
38 end
39 end
40 this:AddUpdateFunction(this.UpdateAlpha);
41 </OnLoad>
42 <OnEvent>
43 if (event == "PLAYER_ENTERING_WORLD") then
44 this:UpdateColor({["r"] = 1, ["g"] = 0, ["b"] = 0});
45 this:SetValue(UnitHealth("target"));
46 return;
47 elseif event == "PLAYER_TARGET_CHANGED" then
48 if (UnitIsTapped("target") and not UnitIsTappedByPlayer("target")) then
49 this:UpdateColor({["r"] = 0.5, ["g"] = 0.5, ["b"] = 0.5});
50 else
51 this:UpdateColor({["r"] = 1, ["g"] = 0, ["b"] = 0});
52 end
53 StatRingsTest_SetAlpha(this, 0.6, 1);
54 this.alphaState = -1;
55 if not UnitExists("target") then
56 this:SetMax(100);
57 this:SetValue(0);
58 this.startValue = 0;
59 else
60 this:SetMax(UnitHealthMax("target"));
61 this:SetValue(UnitHealth("target"));
62 end
63 elseif (event == "UNIT_MAXHEALTH" and arg1 == "target") then
64 local max = UnitHealthMax("target");
65 this:SetMax(max);
66 elseif (event == "UNIT_HEALTH" and arg1 == "target") then
67 if (UnitIsTapped("target") and not UnitIsTappedByPlayer("target")) then
68 this:UpdateColor({["r"] = 0.5, ["g"] = 0.5, ["b"] = 0.5});
69 end
70 if(UnitIsDead("target")) then
71 this:SetValue(0);
72 else
73 this:SetValue(UnitHealth("target"));
74 end
75 end
76 </OnEvent>
77 </Scripts>
78 </Frame>
79 </Ui>