<Ui xmlns="http://www.blizzard.com/wow/ui/" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\..\FrameXML\UI.xsd">
	<Frame name="StatRingsCasting" parent="UIParent" inherits="StatRingsRingTemplate">
		<Anchors>
			<Anchor point="RIGHT" relativeTo="StatRingsMana">
				<Offset>
					<AbsDimension x="15" y="0"/>
				</Offset>
			</Anchor>
		</Anchors>
		<Scripts>
			<OnLoad>
				StatRings_RegisterRing(this, "Casting");
      			StatRingsRingTemplate_OnLoad();
				this:SetReversed(true);
      			
				this:SetAlpha(0.1);
        		
				this:RegisterEvent("PLAYER_ENTERING_WORLD");
				this:RegisterEvent("SPELLCAST_START");
				this:RegisterEvent("SPELLCAST_STOP");
				this:RegisterEvent("SPELLCAST_FAILED");
				this:RegisterEvent("SPELLCAST_INTERRUPTED");
				this:RegisterEvent("SPELLCAST_DELAYED");
				this:RegisterEvent("SPELLCAST_CHANNEL_START");
				this:RegisterEvent("SPELLCAST_CHANNEL_UPDATE");
    			
				this:SetMax(1);
				this:SetValue(0);

				function this:UpdateAlpha()
					if this.startValue &lt; this.maxValue then
						StatRingsTest_SetAlpha(self, 0.4);
					elseif this.startValue == this.maxValue then
						StatRingsTest_SetAlpha(self, 0);
					end
				end
				this:AddUpdateFunction(this.UpdateAlpha);
			</OnLoad>
			<OnEvent>
				if (event == "PLAYER_ENTERING_WORLD") then
					this:UpdateColor({["r"] = 1, ["g"] = 1, ["b"] = 0});
					this:SetMax(1);
					this:SetValue(0);
					return;
				elseif event == "SPELLCAST_START" then
					this:UpdateColor({["r"] = 1, ["g"] = 1, ["b"] = 0});
					this:SetMax(GetTime() + (arg2 / 1000));
					--this:SetValue(GetTime());
					this.casting = 1;
				elseif event == "SPELLCAST_CHANNEL_START" then
					this:UpdateColor({["r"] = 0, ["g"] = 1, ["b"] = 0});
					this.channeling = 1;
				elseif event == "SPELLCAST_CHANNEL_UPDATE" then
					if arg1 == 0 then
						this.channeling = nil;
					else
					end
				elseif event == "SPELLCAST_DELAYED" then
					this:SetMax(this.maxValue + (arg1 / 1000));
					this:SetValue(this.startValue + (arg1 / 1000));
				elseif event == "SPELLCAST_STOP" or event == "SPELLCAST_FAILED" or event == "SPELLCAST_INTERRUPTED" then
					this:SetMax(1);
					this:SetValue(0);
					this.casting = nil;
				end
			</OnEvent>
		</Scripts>
	</Frame>
</Ui>