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="StatRingsPetHealth" parent="UIParent" inherits="StatRingsRingTemplate">
5 <Anchors>
6 <Anchor point="TOPLEFT" relativeTo="StatRingsHealth" relativePoint="TOPLEFT">
7 <Offset>
8 <AbsDimension x="15" y="0"/>
9 </Offset>
10 </Anchor>
11 </Anchors>
12 <Scripts>
13 <OnLoad>
14 StatRings_RegisterRing(this, "Pet Health");
15  
16 StatRingsRingTemplate_OnLoad();
17 this.isInCombat = false;
18 this:SetAlpha(0.1);
19  
20 this:RegisterEvent("PLAYER_ENTERING_WORLD");
21 this:RegisterEvent("UNIT_HEALTH");
22 this:RegisterEvent("UNIT_MAXHEALTH");
23 this:RegisterEvent("PLAYER_ENTER_COMBAT");
24 this:RegisterEvent("PLAYER_LEAVE_COMBAT");
25 this:RegisterEvent("PLAYER_REGEN_ENABLED");
26 this:RegisterEvent("PLAYER_REGEN_DISABLED");
27 this:RegisterEvent("PLAYER_LEVEL_UP");
28 this:RegisterEvent("UNIT_PET");
29  
30 this:UpdateColor({["r"] = 1, ["g"] = 0.5, ["b"] = 0});
31 if not UnitExists("pet") then
32 this:SetMax(100);
33 this:SetValue(0);
34 else
35 this:SetMax(UnitHealthMax("pet"));
36 this:SetValue(UnitHealth("pet"), UnitHealthMax("pet"));
37 end
38  
39  
40 function this:UpdateAlpha()
41 --if not getglobal(this:GetName().."MoveAnchor"):IsVisible() then
42 if this.isInCombat then
43 StatRingsTest_SetAlpha(self, 0.5);
44 elseif this.startValue &lt; this.maxValue then
45 StatRingsTest_SetAlpha(self, 0.5);
46 elseif not this.isInCombat then
47 StatRingsTest_SetAlpha(self, 0.1);
48 end
49 --end
50 end
51 this:AddUpdateFunction(this.UpdateAlpha);
52 </OnLoad>
53 <OnEvent>
54 if (event == "UNIT_PET") then
55 if (arg1 == "player") then
56 if not UnitExists("pet") then
57 this:SetMax(100);
58 this:SetValue(0);
59 else
60 this:SetMax(UnitHealthMax("pet"));
61 this:SetValue(UnitHealth("pet"));
62 end
63 return;
64 end
65 end
66  
67 if (event == "PLAYER_ENTERING_WORLD") then
68 this:UpdateColor({["r"] = 1, ["g"] = 0.5, ["b"] = 0});
69 if not UnitExists("pet") then
70 this:SetMax(100);
71 this:SetValue(0);
72 else
73 this:SetMax(UnitHealthMax("pet"));
74 this:SetValue(UnitHealth("pet"));
75 end
76 return;
77 elseif event == "PLAYER_ENTER_COMBAT" or event == "PLAYER_REGEN_DISABLED" then
78 this.isInCombat = true;
79 this.alphaState = -1;
80 elseif event == "PLAYER_LEAVE_COMBAT" or event == "PLAYER_REGEN_ENABLED" then
81 this.isInCombat = false;
82 this.alphaState = -1;
83 elseif event == "PLAYER_LEVEL_UP" then
84 this:SetMax(UnitHealthMax("pet"));
85 end
86 if (arg1 == "pet") then
87 if (event == "UNIT_MAXHEALTH") then
88 this:SetMax(UnitHealthMax("pet"));
89 else
90 this:SetValue(UnitHealth("pet"));
91 end
92 end
93 </OnEvent>
94 </Scripts>
95 </Frame>
96 </Ui>