/
## Interface: 40200 |
## Title: Guild Lottery |
## Title-deDe: Guilden Lotterie |
## Title-esES: Guild Lottery |
## Notes: Easy Guild Lottery. Just type 'lottery' in guildchat |
## Creator: Zackran on The Shattar(EU), Malaron on Korialstrasz(US) |
## SavedVariables: GL_Data, GL_Settings |
## Version: 2.0.0 Beta |
## OptionalDeps: WIM |
--Embedded Libraries |
Embeds.xml |
--Locale Translations |
Locales\Locales.xml |
--Core Files |
GLottery.lua |
GLottery.xml |
GLotteryCalendar.xml |
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd"> |
<Script file="Libs\LibStub\LibStub.lua"/> |
<Include file="Libs\AceLocale-3.0\AceLocale-3.0.xml"/> |
<Include file="Libs\AceAddon-3.0\AceAddon-3.0.xml"/> |
<Include file="Libs\AceConsole-3.0\AceConsole-3.0.xml"/> |
<Include file="Libs\AceEvent-3.0\AceEvent-3.0.xml"/> |
<Include file="Libs\AceTimer-3.0\AceTimer-3.0.xml"/> |
</Ui> |
<Ui xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd" xmlns="http://www.blizzard.com/wow/ui/"> |
<Script file="GLotteryCalendar.lua" /> |
<Button name="GLCalendarDayHeaderTemplate" virtual="true"> |
<Size> |
<AbsDimension x="16" y="16" /> |
</Size> |
<Layers> |
<Layer level="BACKGROUND"> |
<Texture name="$parentMiddle" file="Interface\FriendsFrame\WhoFrame-ColumnTabs"> |
<Size> |
<AbsDimension x="16" y="16" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT" /> |
</Anchors> |
<TexCoords left="0.078125" right="0.90625" top="0" bottom="0.75" /> |
</Texture> |
</Layer> |
</Layers> |
<HighlightTexture file="Interface\QuestFrame\UI-QuestTitleHighlight" alphaMode="ADD"> |
<Size> |
<AbsDimension x="16" y="16" /> |
</Size> |
<Anchors> |
<Anchor point="TOP"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</HighlightTexture> |
<ButtonText inherits="GameFontHighlightSmall"> |
<Anchors> |
<Anchor point="LEFT"> |
<Offset> |
<AbsDimension x="0" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
</ButtonText> |
</Button> |
<Button name="GLCalendarDayButtonTemplate" virtual="true"> |
<Size> |
<AbsDimension x="16" y="16" /> |
</Size> |
<Scripts> |
<OnClick> |
PlaySound("igMainMenuOptionCheckBoxOn"); |
GL_Calendar_OnClick(self); |
</OnClick> |
</Scripts> |
<HighlightTexture file="Interface\QuestFrame\UI-QuestTitleHighlight" alphaMode="ADD"> |
<Size> |
<AbsDimension x="16" y="16" /> |
</Size> |
<Anchors> |
<Anchor point="TOP"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</HighlightTexture> |
<ButtonText name="$parentText" inherits="GameFontNormalSmall"> |
<Anchors> |
<Anchor point="LEFT"> |
<Offset> |
<AbsDimension x="0" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
</ButtonText> |
</Button> |
<Button name="GLEventCalendarDayHeaderTemplate" virtual="true"> |
<Size> |
<AbsDimension x="32" y="16" /> |
</Size> |
<Layers> |
<Layer level="BACKGROUND"> |
<Texture name="$parentMiddle" file="Interface\FriendsFrame\WhoFrame-ColumnTabs"> |
<Size> |
<AbsDimension x="32" y="16" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT" /> |
</Anchors> |
<TexCoords left="0.078125" right="0.90625" top="0" bottom="0.75" /> |
</Texture> |
</Layer> |
</Layers> |
<HighlightTexture file="Interface\QuestFrame\UI-QuestTitleHighlight" alphaMode="ADD"> |
<Size> |
<AbsDimension x="32" y="16" /> |
</Size> |
<Anchors> |
<Anchor point="TOP"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</HighlightTexture> |
<ButtonText inherits="GameFontHighlightSmall"> |
<Anchors> |
<Anchor point="LEFT"> |
<Offset> |
<AbsDimension x="0" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
</ButtonText> |
</Button> |
<Button name="GLEventCalendarDayButtonTemplate" virtual="true"> |
<Size> |
<AbsDimension x="32" y="32" /> |
</Size> |
<Layers> |
<Layer level="BACKGROUND"> |
<Texture name="$parentTexture"> |
<Size> |
<AbsDimension x="32" y="32" /> |
</Size> |
</Texture> |
</Layer> |
<Layer level="OVERLAY"> |
<FontString name="$parentText" inherits="GameFontNormalSmall" justifyV="TOP" justifyH="LEFT"> |
<Anchors> |
<Anchor point="TOPLEFT"> |
<Offset> |
<AbsDimension x="1" y="-1" /> |
</Offset> |
</Anchor> |
</Anchors> |
</FontString> |
</Layer> |
</Layers> |
<Scripts> |
<OnClick> |
PlaySound("igMainMenuOptionCheckBoxOn"); |
--GLEventCalendar_OnClick(); |
</OnClick> |
</Scripts> |
<HighlightTexture file="Interface\QuestFrame\UI-QuestTitleHighlight" alphaMode="ADD"> |
<Size> |
<AbsDimension x="32" y="32" /> |
</Size> |
<Anchors> |
<Anchor point="TOP"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</HighlightTexture> |
</Button> |
<Frame name="GLEventCalendarFrameTemplate" virtual="true"> |
<Size> |
<AbsDimension x="242" y="220" /> |
</Size> |
<Frames> |
<Button name="GLCalendarDayHeader1" inherits="GLEventCalendarDayHeaderTemplate"> |
<Anchors> |
<Anchor point="TOPLEFT"> |
<Offset> |
<AbsDimension x="2" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDayHeader2" inherits="GLEventCalendarDayHeaderTemplate"> |
<Anchors> |
<Anchor point="LEFT" relativeTo="$parentDayHeader1" relativePoint="RIGHT"> |
<Offset> |
<AbsDimension x="2" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDayHeader3" inherits="GLEventCalendarDayHeaderTemplate"> |
<Anchors> |
<Anchor point="LEFT" relativeTo="$parentDayHeader2" relativePoint="RIGHT"> |
<Offset> |
<AbsDimension x="2" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDayHeader4" inherits="GLEventCalendarDayHeaderTemplate"> |
<Anchors> |
<Anchor point="LEFT" relativeTo="$parentDayHeader3" relativePoint="RIGHT"> |
<Offset> |
<AbsDimension x="2" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarHeader5" inherits="GLEventCalendarDayHeaderTemplate"> |
<Anchors> |
<Anchor point="LEFT" relativeTo="$parentDayHeader4" relativePoint="RIGHT"> |
<Offset> |
<AbsDimension x="2" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDayHeader6" inherits="GLEventCalendarDayHeaderTemplate"> |
<Anchors> |
<Anchor point="LEFT" relativeTo="$parentDayHeader5" relativePoint="RIGHT"> |
<Offset> |
<AbsDimension x="2" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDayHeader7" inherits="GLEventCalendarDayHeaderTemplate"> |
<Anchors> |
<Anchor point="LEFT" relativeTo="$parentDayHeader6" relativePoint="RIGHT"> |
<Offset> |
<AbsDimension x="2" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay11" inherits="GLEventCalendarDayButtonTemplate" id="11"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDayHeader1" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay12" inherits="GLEventCalendarDayButtonTemplate" id="12"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDayHeader2" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay13" inherits="GLEventCalendarDayButtonTemplate" id="13"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDayHeader3" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay14" inherits="GLEventCalendarDayButtonTemplate" id="14"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDayHeader4" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay15" inherits="GLEventCalendarDayButtonTemplate" id="15"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDayHeader5" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay16" inherits="GLEventCalendarDayButtonTemplate" id="16"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDayHeader6" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay17" inherits="GLEventCalendarDayButtonTemplate" id="17"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDayHeader7" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay21" inherits="GLEventCalendarDayButtonTemplate" id="21"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay11" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay22" inherits="GLEventCalendarDayButtonTemplate" id="22"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay12" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay23" inherits="GLEventCalendarDayButtonTemplate" id="23"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay13" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay24" inherits="GLEventCalendarDayButtonTemplate" id="24"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay14" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay25" inherits="GLEventCalendarDayButtonTemplate" id="25"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay15" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay26" inherits="GLEventCalendarDayButtonTemplate" id="26"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay16" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay27" inherits="GLEventCalendarDayButtonTemplate" id="27"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay17" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay31" inherits="GLEventCalendarDayButtonTemplate" id="31"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay21" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay32" inherits="GLEventCalendarDayButtonTemplate" id="32"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay22" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay33" inherits="GLEventCalendarDayButtonTemplate" id="33"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay23" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay34" inherits="GLEventCalendarDayButtonTemplate" id="34"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay24" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay35" inherits="GLEventCalendarDayButtonTemplate" id="35"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay25" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay36" inherits="GLEventCalendarDayButtonTemplate" id="36"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay26" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay37" inherits="GLEventCalendarDayButtonTemplate" id="37"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay27" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay41" inherits="GLEventCalendarDayButtonTemplate" id="41"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay31" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay42" inherits="GLEventCalendarDayButtonTemplate" id="42"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay32" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay43" inherits="GLEventCalendarDayButtonTemplate" id="43"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay33" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay44" inherits="GLEventCalendarDayButtonTemplate" id="44"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay34" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay45" inherits="GLEventCalendarDayButtonTemplate" id="45"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay35" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay46" inherits="GLEventCalendarDayButtonTemplate" id="46"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay36" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay47" inherits="GLEventCalendarDayButtonTemplate" id="47"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay37" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay51" inherits="GLEventCalendarDayButtonTemplate" id="51"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay41" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay52" inherits="GLEventCalendarDayButtonTemplate" id="52"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay42" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay53" inherits="GLEventCalendarDayButtonTemplate" id="53"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay43" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay54" inherits="GLEventCalendarDayButtonTemplate" id="54"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay44" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay55" inherits="GLEventCalendarDayButtonTemplate" id="55"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay45" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay56" inherits="GLEventCalendarDayButtonTemplate" id="56"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay46" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay57" inherits="GLEventCalendarDayButtonTemplate" id="57"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay47" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay61" inherits="GLEventCalendarDayButtonTemplate" id="61"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay51" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay62" inherits="GLEventCalendarDayButtonTemplate" id="62"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay52" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay63" inherits="GLEventCalendarDayButtonTemplate" id="63"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay53" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay64" inherits="GLEventCalendarDayButtonTemplate" id="64"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay54" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay65" inherits="GLEventCalendarDayButtonTemplate" id="65"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay55" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay66" inherits="GLEventCalendarDayButtonTemplate" id="66"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay56" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentDay67" inherits="GLEventCalendarDayButtonTemplate" id="57"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDay57" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
</Frames> |
<Scripts> |
<OnMouseUp> |
if ( self.isMoving ) then |
self:StopMovingOrSizing(); |
self.isMoving = false; |
end |
</OnMouseUp> |
<OnMouseDown> |
if ( ( ( not self.isLocked ) or ( self.isLocked == 0 ) ) and ( arg1 == "LeftButton" ) ) then |
self:StartMoving(); |
self.isMoving = true; |
end |
</OnMouseDown> |
<OnHide> |
if ( self.isMoving ) then |
self:StopMovingOrSizing(); |
self.isMoving = false; |
end |
</OnHide> |
</Scripts> |
</Frame> |
<Frame name="GLCalendarFrame" hidden="true" parent="UIParent" movable="true" enableMouse="true"> |
<Size> |
<AbsDimension x="322" y="220" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT"> |
<Offset x="100" y="-104" /> |
</Anchor> |
</Anchors> |
<Backdrop name="$parentBackdrop" bgFile="Interface\TutorialFrame\TutorialFrameBackground" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true"> |
<BackgroundInsets> |
<AbsInset left="3" right="5" top="3" bottom="5" /> |
</BackgroundInsets> |
<TileSize> |
<AbsValue val="16" /> |
</TileSize> |
<EdgeSize> |
<AbsValue val="16" /> |
</EdgeSize> |
</Backdrop> |
<Layers> |
<Layer level="BACKGROUND"> |
<FontString name="GLCalendarTitle" inherits="GameFontNormal"> |
<Anchors> |
<Anchor point="TOP" relativePoint="TOP"> |
<Offset> |
<AbsDimension x="0" y="-6" /> |
</Offset> |
</Anchor> |
</Anchors> |
</FontString> |
</Layer> |
<Layer level="OVERLAY"> |
<FontString name="GLCalendarGuaranteedWinner" inherits="GameFontNormal"> |
<Size> |
<AbsDimension x="110" y="31" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT"> |
<Offset x="31" y="-183" /> |
</Anchor> |
</Anchors> |
</FontString> |
</Layer> |
</Layers> |
<Frames> |
<Frame name="GLCalendarHourBorderFrame" inherits="OptionFrameBoxTemplate"> |
<Size> |
<AbsDimension x="134" y="44" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT"> |
<Offset> |
<AbsDimension x="6" y="-22" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnLoad> |
self:SetBackdropColor(1,1,1,0) |
</OnLoad> |
</Scripts> |
</Frame> |
<Frame name="GLCalendarHourDropDown" inherits="UIDropDownMenuTemplate" enableMouse="true"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarHourBorderFrame" relativePoint="TOPLEFT"> |
<Offset> |
<AbsDimension x="-10" y="-7" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnShow> |
GL_CalendarHourDropDown_OnShow(); |
</OnShow> |
<OnLoad> |
GL_CalendarHourDropDown_OnShow(); |
</OnLoad> |
</Scripts> |
</Frame> |
<Frame name="GLCalendarMinuteDropDown" inherits="UIDropDownMenuTemplate" enableMouse="true"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarHourDropDown" relativePoint="TOPRIGHT"> |
<Offset> |
<AbsDimension x="-34" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnShow> |
GL_CalendarMinuteDropDown_OnShow(); |
</OnShow> |
<OnLoad> |
GL_CalendarMinuteDropDown_OnShow(); |
</OnLoad> |
</Scripts> |
</Frame> |
<Frame name="GLCalendarTextBorderFrame" inherits="OptionFrameBoxTemplate"> |
<Size> |
<AbsDimension x="134" y="126" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarHourBorderFrame" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Layers> |
<Layer level="OVERLAY"> |
<FontString name="GLCalendarHelp" inherits="GameFontNormalSmall"> |
<Scripts> |
<OnLoad> |
self:SetTextColor(0.4,0.8,1.0); |
</OnLoad> |
</Scripts> |
<Size> |
<AbsDimension x="116" y="130" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarTextBorderFrame" relativePoint="TOPLEFT"> |
<Offset> |
<AbsDimension x="8" y="8" /> |
</Offset> |
</Anchor> |
</Anchors> |
</FontString> |
</Layer> |
</Layers> |
<Scripts> |
<OnLoad> |
self:SetBackdropColor(1,1,1,0) |
</OnLoad> |
</Scripts> |
</Frame> |
<Frame name="GLCalendarDateBorderFrame" inherits="OptionFrameBoxTemplate"> |
<Size> |
<AbsDimension x="176" y="170" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarHourBorderFrame" relativePoint="TOPRIGHT"> |
<Offset> |
<AbsDimension x="0" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnLoad> |
self:SetBackdropColor(1,1,1,0) |
</OnLoad> |
</Scripts> |
</Frame> |
<Frame name="GLCalendarMonthDropDown" inherits="UIDropDownMenuTemplate" enableMouse="true"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDateBorderFrame" relativePoint="TOPLEFT"> |
<Offset> |
<AbsDimension x="-10" y="-7" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnShow> |
GL_CalendarMonthDropDown_OnShow(); |
</OnShow> |
<OnLoad> |
GL_CalendarMonthDropDown_OnShow(); |
</OnLoad> |
</Scripts> |
</Frame> |
<Frame name="GLCalendarYearDropDown" inherits="UIDropDownMenuTemplate" enableMouse="true"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarMonthDropDown" relativePoint="TOPRIGHT"> |
<Offset> |
<AbsDimension x="-34" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnShow> |
GL_CalendarYearDropDown_OnShow(); |
</OnShow> |
<OnLoad> |
GL_CalendarYearDropDown_OnShow(); |
</OnLoad> |
</Scripts> |
</Frame> |
<Button name="GLCalendarDayHeader1" inherits="GLCalendarDayHeaderTemplate"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarMonthDropDown" relativePoint="TOPLEFT"> |
<Offset> |
<AbsDimension x="37" y="-30" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDayHeader2" inherits="GLCalendarDayHeaderTemplate"> |
<Anchors> |
<Anchor point="LEFT" relativeTo="GLCalendarDayHeader1" relativePoint="RIGHT"> |
<Offset> |
<AbsDimension x="2" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDayHeader3" inherits="GLCalendarDayHeaderTemplate"> |
<Anchors> |
<Anchor point="LEFT" relativeTo="GLCalendarDayHeader2" relativePoint="RIGHT"> |
<Offset> |
<AbsDimension x="2" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDayHeader4" inherits="GLCalendarDayHeaderTemplate"> |
<Anchors> |
<Anchor point="LEFT" relativeTo="GLCalendarDayHeader3" relativePoint="RIGHT"> |
<Offset> |
<AbsDimension x="2" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDayHeader5" inherits="GLCalendarDayHeaderTemplate"> |
<Anchors> |
<Anchor point="LEFT" relativeTo="GLCalendarDayHeader4" relativePoint="RIGHT"> |
<Offset> |
<AbsDimension x="2" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDayHeader6" inherits="GLCalendarDayHeaderTemplate"> |
<Anchors> |
<Anchor point="LEFT" relativeTo="GLCalendarDayHeader5" relativePoint="RIGHT"> |
<Offset> |
<AbsDimension x="2" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDayHeader7" inherits="GLCalendarDayHeaderTemplate"> |
<Anchors> |
<Anchor point="LEFT" relativeTo="GLCalendarDayHeader6" relativePoint="RIGHT"> |
<Offset> |
<AbsDimension x="2" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay11" inherits="GLCalendarDayButtonTemplate" id="11"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDayHeader1" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay12" inherits="GLCalendarDayButtonTemplate" id="12"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDayHeader2" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay13" inherits="GLCalendarDayButtonTemplate" id="13"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDayHeader3" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay14" inherits="GLCalendarDayButtonTemplate" id="14"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDayHeader4" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay15" inherits="GLCalendarDayButtonTemplate" id="15"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDayHeader5" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay16" inherits="GLCalendarDayButtonTemplate" id="16"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDayHeader6" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay17" inherits="GLCalendarDayButtonTemplate" id="17"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDayHeader7" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay21" inherits="GLCalendarDayButtonTemplate" id="21"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay11" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay22" inherits="GLCalendarDayButtonTemplate" id="22"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay12" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay23" inherits="GLCalendarDayButtonTemplate" id="23"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay13" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay24" inherits="GLCalendarDayButtonTemplate" id="24"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay14" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay25" inherits="GLCalendarDayButtonTemplate" id="25"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay15" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay26" inherits="GLCalendarDayButtonTemplate" id="26"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay16" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay27" inherits="GLCalendarDayButtonTemplate" id="27"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay17" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay31" inherits="GLCalendarDayButtonTemplate" id="31"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay21" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay32" inherits="GLCalendarDayButtonTemplate" id="32"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay22" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay33" inherits="GLCalendarDayButtonTemplate" id="33"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay23" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay34" inherits="GLCalendarDayButtonTemplate" id="34"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay24" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay35" inherits="GLCalendarDayButtonTemplate" id="35"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay25" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay36" inherits="GLCalendarDayButtonTemplate" id="36"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay26" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay37" inherits="GLCalendarDayButtonTemplate" id="37"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay27" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay41" inherits="GLCalendarDayButtonTemplate" id="41"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay31" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay42" inherits="GLCalendarDayButtonTemplate" id="42"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay32" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay43" inherits="GLCalendarDayButtonTemplate" id="43"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay33" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay44" inherits="GLCalendarDayButtonTemplate" id="44"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay34" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay45" inherits="GLCalendarDayButtonTemplate" id="45"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay35" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay46" inherits="GLCalendarDayButtonTemplate" id="46"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay36" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay47" inherits="GLCalendarDayButtonTemplate" id="47"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay37" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay51" inherits="GLCalendarDayButtonTemplate" id="51"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay41" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay52" inherits="GLCalendarDayButtonTemplate" id="52"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay42" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay53" inherits="GLCalendarDayButtonTemplate" id="53"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay43" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay54" inherits="GLCalendarDayButtonTemplate" id="54"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay44" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay55" inherits="GLCalendarDayButtonTemplate" id="55"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay45" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay56" inherits="GLCalendarDayButtonTemplate" id="56"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay46" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay57" inherits="GLCalendarDayButtonTemplate" id="57"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay47" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay61" inherits="GLCalendarDayButtonTemplate" id="61"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay51" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay62" inherits="GLCalendarDayButtonTemplate" id="62"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay52" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay63" inherits="GLCalendarDayButtonTemplate" id="63"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay53" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay64" inherits="GLCalendarDayButtonTemplate" id="64"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay54" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay65" inherits="GLCalendarDayButtonTemplate" id="65"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay55" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay66" inherits="GLCalendarDayButtonTemplate" id="66"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay56" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarDay67" inherits="GLCalendarDayButtonTemplate" id="57"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLCalendarDay57" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="-2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLCalendarCloseButton" inherits="UIPanelCloseButton"> |
<Anchors> |
<Anchor point="TOPRIGHT"> |
<Offset> |
<AbsDimension x="1" y="2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<CheckButton name="GLGuarantee" inherits="UICheckButtonTemplate" text=""> |
<Anchors> |
<Anchor point="TOPLEFT"> |
<Offset x="4" y="-182" /> |
</Anchor> |
</Anchors> |
</CheckButton> |
</Frames> |
<Scripts> |
<OnMouseUp> |
if ( self.isMoving ) then |
self:StopMovingOrSizing(); |
self.isMoving = false; |
end |
</OnMouseUp> |
<OnMouseDown> |
if ( ( ( not self.isLocked ) or ( self.isLocked == 0 ) ) and ( arg1 == "LeftButton" ) ) then |
self:StartMoving(); |
self.isMoving = true; |
end |
</OnMouseDown> |
<OnHide> |
if ( self.isMoving ) then |
self:StopMovingOrSizing(); |
self.isMoving = false; |
end |
</OnHide> |
<OnShow> |
GL_Calendar_OnShow(); |
</OnShow> |
<OnLoad> |
self:RegisterForDrag("LeftButton"); |
GL_InitCalendarText(); |
</OnLoad> |
<OnDragStart> |
self:StartMoving(); |
</OnDragStart> |
<OnDragStop> |
self:StopMovingOrSizing(); |
</OnDragStop> |
</Scripts> |
</Frame> |
</Ui> |
local L = LibStub("AceLocale-3.0"):NewLocale("Glottery", "ruRU", false); |
if not L then return end |
GL_DATE_FORMAT = "%a %d %b %H:%M"; |
GL_HOUR_FORMAT = "%I:%M %p"; |
GL_DATE_CONVERT = {}; |
GL_NA_FORMAT = "N/A"; |
GLCalendar_Month = {"??????","???????","????","??????","???","????","????","??????","????????","???????","??????","???????"}; |
--@localization(locale="ruRU", format="lua_additive_table", handle-unlocalized="english")@ |
local L = LibStub("AceLocale-3.0"):NewLocale("Glottery", "esES", false); |
if not L then return end |
GL_DATE_FORMAT = "%a %d %b %H:%M"; |
GL_HOUR_FORMAT = "%I:%M %p"; |
GL_DATE_CONVERT = {}; |
GL_NA_FORMAT = "N/A"; |
GLCalendar_Month = {"Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"}; |
--@localization(locale="esES", format="lua_additive_table", handle-unlocalized="english")@ |
local L = LibStub("AceLocale-3.0"):NewLocale("Glottery", "frFR", false); |
if not L then return end |
GL_DATE_FORMAT = "%a %d %b %H:%M"; |
GL_HOUR_FORMAT = "%I:%M %p"; |
GL_DATE_CONVERT = {}; |
GL_NA_FORMAT = "N/A"; |
GLCalendar_Month = {"Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"}; |
--@localization(locale="frFR", format="lua_additive_table", handle-unlocalized="english")@ |
<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"> |
<Include file="enUS.lua"/> |
<Include file="deDE.lua"/> |
<Include file="frFR.lua"/> |
<Include file="esES.lua"/> |
<Include file="ruRU.lua"/> |
</Ui> |
local L = LibStub("AceLocale-3.0"):NewLocale("Glottery", "deDE", false); |
if not L then return end |
GL_DATE_FORMAT = "%a %d %b %H:%M"; |
GL_HOUR_FORMAT = "%I:%M %p"; |
GL_DATE_CONVERT = {}; |
GL_NA_FORMAT = "N/A"; |
GLCalendar_Month = {"Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"}; |
--@localization(locale="deDE", format="lua_additive_table", handle-unlocalized="english")@ |
--localization file for english/United States |
local L = LibStub("AceLocale-3.0"):NewLocale("Glottery", "enUS", true); |
if not L then return end |
GL_DATE_FORMAT = "%a %d %b %H:%M"; |
GL_HOUR_FORMAT = "%I:%M %p"; |
GL_DATE_CONVERT = {}; |
GL_NA_FORMAT = "N/A"; |
GLCalendar_Month = {"January","February","March","April","May","June","July","August","September","October","November","December"}; |
--@localization(locale="enUS", format="lua_additive_table", handle-unlocalized="english")@ |
--[[ |
Guild Event Manager by Kiki of European Cho'gall (Alliance) |
Calendar module - By Kiki |
]] |
--------------- Local variables --------------- |
local GL_CALENDAR_CBFunc = nil; |
local GL_CALENDAR_UserData = nil; |
local L = LibStub("AceLocale-3.0"):GetLocale("Glottery") |
--------------- Internal functions --------------- |
function GL_InitCalendarText() |
GLCalendarDayHeader1:SetText(L["TEXT_CALENDAR_SUNDAY"]) |
GLCalendarDayHeader2:SetText(L["TEXT_CALENDAR_MONDAY"]) |
GLCalendarDayHeader3:SetText(L["TEXT_CALENDAR_TUESDAY"]) |
GLCalendarDayHeader4:SetText(L["TEXT_CALENDAR_WEDNESDAY"]) |
GLCalendarDayHeader5:SetText(L["TEXT_CALENDAR_THURSDAY"]) |
GLCalendarDayHeader6:SetText(L["TEXT_CALENDAR_FRIDAY"]) |
GLCalendarDayHeader7:SetText(L["TEXT_CALENDAR_SATURDAY"]) |
GLCalendarTitle:SetText(L["TEXT_CALENDAR_HEADER"]) |
GLCalendarGuaranteedWinner:SetText(L["TEXT_CALENDAR_GUARANTEED"]) |
GLCalendarHelp:SetText(L["TEXT_CALENDAR_HELP"]) |
end |
function GL_EventCalendar_DrawDays(parent,tim,ShowReset) |
local today = date("*t"); |
-- Clear all days |
for i=1,6 do |
for j=1,7 do |
getglobal(parent:GetName().."Day"..i..j.."Text"):SetText(""); |
getglobal(parent:GetName().."Day"..i..j.."Texture"):SetTexture(""); |
getglobal(parent:GetName().."Day"..i..j):Hide(); |
end |
end |
-- Compute starting month day |
local tab = date("*t",tim); |
local day = 1; |
local line = 1; |
local row = 1; |
local current_month = tab.month; |
tab.hour = 12; |
tab.min = 1; |
tab.sec = 1; |
tim = time(tab); |
local start_tim = tim - ((tab.day-1) * 60*60*24); -- Rewind (tab.day - 1) days |
tab = date("*t",start_tim); |
-- Display all valid days |
while tab.month == current_month |
do |
if(tab.wday < row) -- Changed line |
then |
line = line + 1; |
end |
row = tab.wday; |
getglobal(parent:GetName().."Day"..line..row.."Text"):SetText(day); |
getglobal(parent:GetName().."Day"..line..row):Show(); |
getglobal(parent:GetName().."Day"..line..row).time = start_tim; |
if(today.year == tab.year and today.yday == tab.yday) |
then |
getglobal(parent:GetName().."Day"..line..row.."Text"):SetTextColor(0,1.0,0); |
else |
getglobal(parent:GetName().."Day"..line..row.."Text"):SetTextColor(0.4,0.8,1.0); |
end |
day = day + 1; |
start_tim = start_tim + 60*60*24; -- Increment day |
tab = date("*t",start_tim); |
end |
end |
local function GL_Calendar_DrawDays(tim) |
local today = date("*t"); |
-- Clear all days |
for i=1,6 do |
for j=1,7 do |
getglobal("GLCalendarDay"..i..j):SetText(""); |
getglobal("GLCalendarDay"..i..j):Hide(); |
end |
end |
-- Compute starting month day |
local tab = date("*t",tim); |
local day = 1; |
local line = 1; |
local row = 1; |
local current_month = tab.month; |
tab.hour = 12; |
tab.min = 1; |
tab.sec = 1; |
tim = time(tab); |
local start_tim = tim - ((tab.day-1) * 60*60*24); -- Rewind (tab.day - 1) days |
tab = date("*t",start_tim); |
-- Display all valid days |
while tab.month == current_month |
do |
if(tab.wday < row) -- Changed line |
then |
line = line + 1; |
end |
row = tab.wday; |
getglobal("GLCalendarDay"..line..row):SetText(day); |
getglobal("GLCalendarDay"..line..row):Show(); |
getglobal("GLCalendarDay"..line..row).time = start_tim; |
if(today.year == tab.year and today.yday == tab.yday) |
then |
getglobal("GLCalendarDay"..line..row.."Text"):SetTextColor(0.1,0.8,0.1); |
else |
getglobal("GLCalendarDay"..line..row.."Text"):SetTextColor(0.4,0.8,1.0); |
end |
day = day + 1; |
start_tim = start_tim + 60*60*24; -- Increment day |
tab = date("*t",start_tim); |
end |
end |
--------------- From XML functions --------------- |
function GL_Calendar_OnClick(self) |
local tab = date("*t",self.time); |
tab.hour = getglobal("GLCalendarHourDropDown").hour; |
tab.min = getglobal("GLCalendarMinuteDropDown").min; |
tab.sec = 0; |
if(GL_CALENDAR_CBFunc) |
then |
GL_CALENDAR_CBFunc(time(tab),GL_CALENDAR_UserData); |
end |
if (GLGuarantee:GetChecked() == 1) then |
GL_Data.GuaranteedWinner=GLGuarantee:GetChecked(); |
else |
GL_Data.GuaranteedWinner=0; |
end |
GLCalendarFrame:Hide(); |
end |
function GL_Calendar_OnShow() |
GL_Calendar_DrawDays(time()); |
end |
function GL_CalendarMonthDropDown_OnShow() |
local tab = date("*t"); |
getglobal("GLCalendarMonthDropDown").month = tab.month; |
UIDropDownMenu_Initialize(GLCalendarMonthDropDown, GL_CalendarMonthDropDown_Init); |
UIDropDownMenu_SetText(GLCalendarMonthDropDown,GLCalendar_Month[tab.month]); |
UIDropDownMenu_SetWidth(GLCalendarMonthDropDown,70); |
end |
function GL_CalendarMonthDropDown_OnClick(self) |
local tab = date("*t"); |
getglobal("GLCalendarMonthDropDown").month = self.value; |
tab.day = 1; |
tab.month = getglobal("GLCalendarMonthDropDown").month; |
tab.year = getglobal("GLCalendarYearDropDown").year; |
GL_Calendar_DrawDays(time(tab)); |
UIDropDownMenu_SetText(GLCalendarMonthDropDown,GLCalendar_Month[self.value] ); |
end |
function GL_CalendarMonthDropDown_Init() |
for i,month in pairs(GLCalendar_Month) do |
local info = { }; |
info.text = month; |
info.value = i; |
info.func = GL_CalendarMonthDropDown_OnClick; |
UIDropDownMenu_AddButton(info); |
end |
end |
-- |
function GL_CalendarYearDropDown_OnShow() |
local tab = date("*t"); |
getglobal("GLCalendarYearDropDown").year = tab.year; |
UIDropDownMenu_Initialize(GLCalendarYearDropDown, GL_CalendarYearDropDown_Init); |
UIDropDownMenu_SetText(GLCalendarYearDropDown,tab.year); |
UIDropDownMenu_SetWidth(GLCalendarYearDropDown,58); |
end |
function GL_CalendarYearDropDown_OnClick(self) |
local tab = date("*t"); |
getglobal("GLCalendarYearDropDown").year = self.value; |
tab.day = 1; |
tab.month = getglobal("GLCalendarMonthDropDown").month; |
tab.year = getglobal("GLCalendarYearDropDown").year; |
GL_Calendar_DrawDays(time(tab)); |
UIDropDownMenu_SetText(GLCalendarYearDropDown,self.value); |
end |
function GL_CalendarYearDropDown_Init() |
for i=2008,2015 do |
local info = { }; |
info.text = i; |
info.value = i; |
info.func = GL_CalendarYearDropDown_OnClick; |
UIDropDownMenu_AddButton(info); |
end |
end |
-- |
function GL_CalendarHourDropDown_OnShow() |
getglobal("GLCalendarHourDropDown").hour = 20; |
UIDropDownMenu_Initialize(GLCalendarHourDropDown, GL_CalendarHourDropDown_Init); |
UIDropDownMenu_SetText(GLCalendarHourDropDown,"20h"); |
UIDropDownMenu_SetWidth(GLCalendarHourDropDown,48); |
end |
function GL_CalendarHourDropDown_OnClick(self) |
getglobal("GLCalendarHourDropDown").hour = self.value; |
if(self.value < 10) |
then |
UIDropDownMenu_SetText(GLCalendarHourDropDown,"0"..self.value.."h"); |
else |
UIDropDownMenu_SetText(GLCalendarHourDropDown,self.value.."h"); |
end |
end |
function GL_CalendarHourDropDown_Init() |
for i=0,23 do |
local info = { }; |
if(i < 10) |
then |
info.text = "0"..i.."h"; |
else |
info.text = i.."h"; |
end |
info.value = i; |
info.func = GL_CalendarHourDropDown_OnClick; |
UIDropDownMenu_AddButton(info); |
end |
end |
-- |
function GL_CalendarMinuteDropDown_OnShow() |
getglobal("GLCalendarMinuteDropDown").min = 0; |
UIDropDownMenu_Initialize(GLCalendarMinuteDropDown, GL_CalendarMinuteDropDown_Init); |
UIDropDownMenu_SetText(GLCalendarMinuteDropDown,"00"); |
UIDropDownMenu_SetWidth(GLCalendarMinuteDropDown,40); |
end |
function GL_CalendarMinuteDropDown_OnClick(self) |
getglobal("GLCalendarMinuteDropDown").min = self.value; |
if(self.value < 10) |
then |
UIDropDownMenu_SetText(GLCalendarMinuteDropDown,"0"..self.value); |
else |
UIDropDownMenu_SetText(GLCalendarMinuteDropDown,self.value); |
end |
end |
function GL_CalendarMinuteDropDown_Init() |
for i=0,45,15 do |
local info = { }; |
if(i < 10) |
then |
info.text = "0"..i; |
else |
info.text = i; |
end |
info.value = i; |
info.func = GL_CalendarMinuteDropDown_OnClick; |
UIDropDownMenu_AddButton(info); |
end |
end |
--------------- GUI Exported functions --------------- |
--[[ |
function GLCalendar_PickupDate : |
Opens the calendar |
CBFunc : Function -- The CB function : void (*func)(sel_date,user_data) -- Called with the selected date (hour/minute undefined) |
user_data : any -- User data returned in the callback |
-- |
Returns false if Calendar is already open, True otherwise |
]] |
function GL_Calendar_PickupDate(CBFunc,user_data) |
if(GLCalendarFrame:IsVisible()) |
then |
return false; |
end |
GL_CALENDAR_CBFunc = CBFunc; |
GL_CALENDAR_UserData = user_data; |
GLCalendarFrame:Show(); |
return true; |
end |
-- /script GLCalendar_PickupDate(nil) |
GL_Data = {}; |
GL_DataInitialized=false; |
local L = LibStub("AceLocale-3.0"):GetLocale("Glottery"); |
function GL_DataInitialize() |
if GL_Data == nil then |
GL_Data={}; |
end |
if GL_Data.LotteryInfo == nil then GL_Data.LotteryInfo = {}; end |
if GL_Data.NextLotteryTicket== nil then GL_Data.NextLotteryTicket=0; end |
if GL_Data.StartGold== nil then GL_Data.StartGold=0; end |
if GL_Data.LotteryTicketSerie== nil then GL_Data.LotteryTicketSerie=1000; end |
if GL_Data.MaxLotteryTickets== nil then GL_Data.MaxLotteryTickets=20; end |
if GL_Data.LotteryTicketPrice== nil then GL_Data.LotteryTicketPrice=10000; end |
if GL_Data.LotteryDate== nil then GL_Data.LotteryDate=0; end |
if GL_Data.RaffleInfo == nil then GL_Data.RaffleInfo = {}; end |
if GL_Data.NextRaffleTicket== nil then GL_Data.NextRaffleTicket=0; end |
if GL_Data.RaffleTicketSerie== nil then GL_Data.RaffleTicketSerie=1000; end |
if GL_Data.MaxRaffleTickets== nil then GL_Data.MaxRaffleTickets=20; end |
if GL_Data.RaffleDate== nil then GL_Data.RaffleDate=0; end |
if GL_Data.RaffleTicketPrice== nil then GL_Data.RaffleTicketPrice=10000; end |
if GL_Data.SecondPrize== nil then GL_Data.SecondPrize=20; end |
if GL_Data.GuildCut== nil then GL_Data.GuildCut=0; end |
if GL_Data.LotteryName== nil then GL_Data.LotteryName=L["UI_TITLE_LOTTERY"]; end |
if GL_Data.RaffleName== nil then GL_Data.RaffleName=L["UI_TITLE_RAFFLE"]; end |
if GL_Data.RaffleItemOne== nil then GL_Data.RaffleItemOne='0'; end |
if GL_Data.RaffleItemTwo== nil then GL_Data.RaffleItemTwo='0'; end |
if GL_Data.RaffleItemThree== nil then GL_Data.RaffleItemThree='0'; end |
if GL_Data.MultipleWinners~= nil then GL_Data.MultipleWinners=nil; end |
if GL_Data.MultiWinners== nil then GL_Data.MultiWinners=1; end |
if GL_Data.GuaranteedWinner== nil then GL_Data.GuaranteedWinner=0; end |
if GL_Data.Raffle== nil then GL_Data.Raffle=1; end |
GL_DataInitialized=true; |
end |
function GuildLottery:DataClear(raffle) |
if raffle==1 then |
if GuildLottery:DataCount(raffle)>0 then |
GL_Data.RaffleTicketSerie=GL_Data.RaffleTicketSerie+1000; |
if GL_Data.RaffleTicketSerie>9000 then |
GL_Data.RaffleTicketSerie=1000; |
end |
end |
GL_Data.NextRaffleTicket=GL_Data.RaffleTicketSerie; |
local i,amount; |
amount=GuildLottery:DataCount(raffle); |
for i=1,amount,1 do |
GuildLottery:DataRemove(1, raffle); |
end |
else |
if GuildLottery:DataCount(raffle)>0 then |
GL_Data.LotteryTicketSerie=GL_Data.LotteryTicketSerie+1000; |
if GL_Data.LotteryTicketSerie>9000 then |
GL_Data.LotteryTicketSerie=1000; |
end |
end |
GL_Data.NextLotteryTicket=GL_Data.LotteryTicketSerie; |
local i,amount; |
amount=GuildLottery:DataCount(raffle); |
for i=1,amount,1 do |
GuildLottery:DataRemove(1, raffle); |
end |
end |
GuildLottery:UpdateScreen(); |
GuildLottery:UpdateUserButtons(); |
end |
function GuildLottery:DataValid( idx, raffle ) |
if GL_DataInitialized==false then |
GL_DataInitialize(); |
end |
if GL_Data then |
if raffle==1 and GL_Data.RaffleInfo then |
if idx==nil then |
return true; |
else |
if GL_Data.RaffleInfo[idx] then |
return true; |
end |
end |
elseif raffle==0 and GL_Data.LotteryInfo then |
if idx==nil then |
return true; |
else |
if GL_Data.LotteryInfo[idx] then |
return true; |
end |
end |
else |
return false; |
end |
end |
return false; |
end |
function GuildLottery:DataGetUserIdx ( user, raffle ) |
local i; |
for i=1, GuildLottery:DataCount(raffle), 1 do |
if raffle==1 then |
if GL_Data.RaffleInfo[i].User == user then |
return i; |
end |
else |
if GL_Data.LotteryInfo[i].User == user then |
return i; |
end |
end |
end |
return 0; |
end |
function GuildLottery:DataGetTicketIdx ( ticketnumber, raffle ) |
local i,j; |
for i=1, GuildLottery:DataCount(raffle), 1 do |
local Tickets=GuildLottery:DataGetTickets(i, raffle); |
for j=1, GuildLottery:DataGetTicketCount(i, raffle), 1 do |
if Tickets[j]==ticketnumber then |
return i; |
end |
end |
end |
return 0; |
end |
function GuildLottery:DataGetNotified( idx, raffle ) |
if GuildLottery:DataValid(idx, raffle) then |
if raffle==1 then |
return GL_Data.RaffleInfo[idx].Notified; |
else |
return GL_Data.LotteryInfo[idx].Notified; |
end |
end |
return 0; |
end |
function GuildLottery:DataSetNotified( idx, value, raffle ) |
if GuildLottery:DataValid(idx, raffle) then |
if raffle==1 then |
GL_Data.RaffleInfo[idx].Notified = value; |
else |
GL_Data.LotteryInfo[idx].Notified = value; |
end |
end |
end |
function GuildLottery:DataGetUser( idx, raffle ) |
if GuildLottery:DataValid(idx, raffle) then |
if raffle==1 then |
return GL_Data.RaffleInfo[idx].User; |
else |
return GL_Data.LotteryInfo[idx].User; |
end |
end |
return ""; |
end |
function GuildLottery:DataSetUser(idx, value) |
if GuildLottery:DataValid(idx, GL_Data.Raffle) then |
if GL_Data.Raffle==GL_RAFFLE then |
GL_Data.RaffleInfo[idx].User = value; |
else |
GL_Data.LotteryInfo[idx].User = value; |
end |
end |
end |
function GuildLottery:DataGetTickets( idx, raffle ) |
if GuildLottery:DataValid(idx, raffle) then |
if raffle==1 then |
return GL_Data.RaffleInfo[idx].Tickets; |
else |
return GL_Data.LotteryInfo[idx].Tickets; |
end |
end |
return nil; |
end |
function GuildLottery:DataGetTicketCount( idx, raffle ) |
if GuildLottery:DataValid(idx, raffle) then |
if raffle==GL_RAFFLE then |
return table.getn(GL_Data.RaffleInfo[idx].Tickets); |
else |
return table.getn(GL_Data.LotteryInfo[idx].Tickets); |
end |
end |
return 0; |
end |
function GuildLottery:DataGetTotalTicketCount(raffle) |
local i,count; |
count=0; |
for i=1, GuildLottery:DataCount(raffle), 1 do |
count=count+GuildLottery:DataGetTicketCount(i, raffle); |
end |
return count; |
end |
function GuildLottery:DataSetTickets( idx, value ) |
if GuildLottery:DataValid(idx, GL_Data.Raffle) then |
if GL_Data.Raffle==GL_RAFFLE then |
GL_Data.RaffleInfo[idx].Tickets = value; |
else |
GL_Data.LotteryInfo[idx].Tickets = value; |
end |
end |
end |
function GuildLottery:DataAddTickets( idx, value ) |
if GuildLottery:DataValid(idx, GL_Data.Raffle) then |
local i=0; |
for i=1, table.getn(value), 1 do |
if GL_Data.Raffle==GL_RAFFLE then |
table.insert(GL_Data.RaffleInfo[idx].Tickets,value[i]); |
else |
table.insert(GL_Data.LotteryInfo[idx].Tickets,value[i]); |
end |
end |
end |
end |
function GuildLottery:DataCount(raffle) |
if GuildLottery:DataValid(nil, raffle) then |
if raffle==1 then |
return table.getn(GL_Data.RaffleInfo); |
else |
return table.getn(GL_Data.LotteryInfo); |
end |
end |
return 0; |
end |
function GuildLottery:DataInsert( idx, info ) |
if GuildLottery:DataValid(nil, GL_Data.Raffle) then |
if idx>=GuildLottery:DataCount(GL_Data.Raffle)+1 then |
if GL_Data.Raffle==GL_RAFFLE then |
table.insert(GL_Data.RaffleInfo, info); |
else |
table.insert(GL_Data.LotteryInfo, info); |
end |
else |
if GL_Data.Raffle==GL_RAFFLE then |
table.insert(GL_Data.RaffleInfo, idx, info); |
else |
table.insert(GL_Data.LotteryInfo, idx, info); |
end |
end |
end |
end |
function GuildLottery:DataRemove( idx, raffle ) |
local i; |
if GuildLottery:DataValid(idx, raffle) then |
if raffle==GL_RAFFLE then |
table.remove(GL_Data.RaffleInfo, idx); |
else |
table.remove(GL_Data.LotteryInfo, idx); |
end |
end |
end |
ignore: |
- .pkgmeta |
externals: |
Libs/AceLocale-3.0: |
url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceLocale-3.0 |
Libs/AceAddon-3.0: |
url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceAddon-3.0 |
Libs/AceConsole-3.0: |
url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceConsole-3.0 |
Libs/AceEvent-3.0: |
url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceEvent-3.0 |
Libs/AceTimer-3.0: |
url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceTimer-3.0 |
<Ui xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd" xmlns="http://www.blizzard.com/wow/ui/"> |
<Script file="GLotteryData.lua" /> |
<CheckButton name="GLCheckButtonTemplate" virtual="true"> |
<Size> |
<AbsDimension x="20" y="20" /> |
</Size> |
<NormalTexture file="Interface\Buttons\UI-CheckBox-Up" /> |
<PushedTexture file="Interface\Buttons\UI-CheckBox-Down" /> |
<HighlightTexture file="Interface\Buttons\UI-CheckBox-Highlight" alphaMode="ADD" /> |
<CheckedTexture file="Interface\Buttons\UI-CheckBox-Check" /> |
<DisabledCheckedTexture file="Interface\Buttons\UI-CheckBox-Check-Disabled" /> |
</CheckButton> |
<Frame name="GLMoneyInputFrameTemplate" virtual="true"> |
<Size> |
<AbsDimension x="176" y="18" /> |
</Size> |
<Frames> |
<EditBox name="$parentGold" letters="5" numeric="true" autoFocus="false"> |
<Size> |
<AbsDimension x="50" y="20" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT" /> |
</Anchors> |
<Layers> |
<Layer level="BACKGROUND"> |
<Texture name="$parentLeft" file="Interface\Common\Common-Input-Border"> |
<Size> |
<AbsDimension x="8" y="20" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT"> |
<Offset> |
<AbsDimension x="-5" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<TexCoords left="0" right="0.0625" top="0" bottom="0.625" /> |
</Texture> |
<Texture name="$parentRight" file="Interface\Common\Common-Input-Border"> |
<Size> |
<AbsDimension x="8" y="20" /> |
</Size> |
<Anchors> |
<Anchor point="RIGHT"> |
<Offset> |
<AbsDimension x="-10" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<TexCoords left="0.9375" right="1" top="0" bottom="0.625" /> |
</Texture> |
<Texture name="$parentMiddle" file="Interface\Common\Common-Input-Border"> |
<Size> |
<AbsDimension x="10" y="20" /> |
</Size> |
<Anchors> |
<Anchor point="LEFT" relativeTo="$parentLeft" relativePoint="RIGHT" /> |
<Anchor point="RIGHT" relativeTo="$parentRight" relativePoint="LEFT" /> |
</Anchors> |
<TexCoords left="0.0625" right="0.9375" top="0" bottom="0.625" /> |
</Texture> |
<Texture file="Interface\MoneyFrame\UI-MoneyIcons"> |
<Size> |
<AbsDimension x="13" y="13" /> |
</Size> |
<Anchors> |
<Anchor point="LEFT" relativePoint="RIGHT"> |
<Offset> |
<AbsDimension x="-8" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<TexCoords left="0" right="0.25" top="0" bottom="1" /> |
</Texture> |
</Layer> |
</Layers> |
<Scripts> |
<OnTabPressed> |
if ( IsShiftKeyDown() and self:GetParent().previousFocus ) then |
self:GetParent().previousFocus:SetFocus(); |
else |
getglobal(self:GetParent():GetName().."Silver"):SetFocus(); |
end |
</OnTabPressed> |
<OnEnterPressed> |
getglobal(self:GetParent():GetName().."Silver"):SetFocus(); |
</OnEnterPressed> |
<OnEscapePressed> |
self:ClearFocus(); |
</OnEscapePressed> |
<OnTextChanged> |
MoneyInputFrame_OnTextChanged(self,self:GetParent()); |
</OnTextChanged> |
<OnEditFocusLost> |
self:HighlightText(0, 0); |
</OnEditFocusLost> |
<OnEditFocusGained> |
self:HighlightText(); |
</OnEditFocusGained> |
</Scripts> |
<FontString inherits="ChatFontNormal" /> |
</EditBox> |
<EditBox name="$parentSilver" letters="2" numeric="true" autoFocus="false"> |
<Size> |
<AbsDimension x="30" y="20" /> |
</Size> |
<Anchors> |
<Anchor point="LEFT" relativeTo="$parentGold" relativePoint="RIGHT"> |
<Offset> |
<AbsDimension x="16" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Layers> |
<Layer level="BACKGROUND"> |
<Texture name="$parentLeft" file="Interface\Common\Common-Input-Border"> |
<Size> |
<AbsDimension x="8" y="20" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT"> |
<Offset> |
<AbsDimension x="-5" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<TexCoords left="0" right="0.0625" top="0" bottom="0.625" /> |
</Texture> |
<Texture name="$parentRight" file="Interface\Common\Common-Input-Border"> |
<Size> |
<AbsDimension x="8" y="20" /> |
</Size> |
<Anchors> |
<Anchor point="RIGHT"> |
<Offset> |
<AbsDimension x="-10" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<TexCoords left="0.9375" right="1" top="0" bottom="0.625" /> |
</Texture> |
<Texture name="$parentMiddle" file="Interface\Common\Common-Input-Border"> |
<Size> |
<AbsDimension x="10" y="20" /> |
</Size> |
<Anchors> |
<Anchor point="LEFT" relativeTo="$parentLeft" relativePoint="RIGHT" /> |
<Anchor point="RIGHT" relativeTo="$parentRight" relativePoint="LEFT" /> |
</Anchors> |
<TexCoords left="0.0625" right="0.9375" top="0" bottom="0.625" /> |
</Texture> |
<Texture file="Interface\MoneyFrame\UI-MoneyIcons"> |
<Size> |
<AbsDimension x="13" y="13" /> |
</Size> |
<Anchors> |
<Anchor point="LEFT" relativePoint="RIGHT"> |
<Offset> |
<AbsDimension x="-8" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<TexCoords left="0.25" right="0.5" top="0" bottom="1" /> |
</Texture> |
</Layer> |
</Layers> |
<Scripts> |
<OnTabPressed> |
if ( IsShiftKeyDown() ) then |
getglobal(self:GetParent():GetName().."Gold"):SetFocus(); |
else |
if ( self:GetParent().nextFocus ) then |
self:GetParent().nextFocus:SetFocus(); |
else |
self:ClearFocus(); |
end |
end |
</OnTabPressed> |
<OnEnterPressed> |
if ( self:GetParent().nextFocus ) then |
self:GetParent().nextFocus:SetFocus(); |
else |
self:ClearFocus(); |
end |
</OnEnterPressed> |
<OnEscapePressed> |
self:ClearFocus(); |
</OnEscapePressed> |
<OnTextChanged> |
MoneyInputFrame_OnTextChanged(self,self:GetParent()); |
</OnTextChanged> |
<OnEditFocusLost> |
self:HighlightText(0, 0); |
</OnEditFocusLost> |
<OnEditFocusGained> |
self:HighlightText(); |
</OnEditFocusGained> |
</Scripts> |
<FontString inherits="ChatFontNormal" /> |
</EditBox> |
<EditBox name="$parentCopper" hidden="true" letters="2" numeric="true" autoFocus="false"> |
<Size> |
<AbsDimension x="30" y="20" /> |
</Size> |
<Anchors> |
<Anchor point="LEFT" relativeTo="$parentSilver" relativePoint="RIGHT"> |
<Offset> |
<AbsDimension x="16" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Layers> |
<Layer level="BACKGROUND"> |
<Texture name="$parentLeft" file="Interface\Common\Common-Input-Border"> |
<Size> |
<AbsDimension x="8" y="20" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT"> |
<Offset> |
<AbsDimension x="-5" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<TexCoords left="0" right="0.0625" top="0" bottom="0.625" /> |
</Texture> |
<Texture name="$parentRight" file="Interface\Common\Common-Input-Border"> |
<Size> |
<AbsDimension x="8" y="20" /> |
</Size> |
<Anchors> |
<Anchor point="RIGHT"> |
<Offset> |
<AbsDimension x="-10" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<TexCoords left="0.9375" right="1" top="0" bottom="0.625" /> |
</Texture> |
<Texture name="$parentMiddle" file="Interface\Common\Common-Input-Border"> |
<Size> |
<AbsDimension x="10" y="20" /> |
</Size> |
<Anchors> |
<Anchor point="LEFT" relativeTo="$parentLeft" relativePoint="RIGHT" /> |
<Anchor point="RIGHT" relativeTo="$parentRight" relativePoint="LEFT" /> |
</Anchors> |
<TexCoords left="0.0625" right="0.9375" top="0" bottom="0.625" /> |
</Texture> |
<Texture file="Interface\MoneyFrame\UI-MoneyIcons"> |
<Size> |
<AbsDimension x="13" y="13" /> |
</Size> |
<Anchors> |
<Anchor point="LEFT" relativePoint="RIGHT"> |
<Offset> |
<AbsDimension x="-8" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<TexCoords left="0.5" right="0.75" top="0" bottom="1" /> |
</Texture> |
</Layer> |
</Layers> |
<Scripts> |
<OnTabPressed> |
if ( IsShiftKeyDown() ) then |
getglobal(self:GetParent():GetName().."Silver"):SetFocus(); |
else |
if ( self:GetParent().nextFocus ) then |
self:GetParent().nextFocus:SetFocus(); |
else |
self:ClearFocus(); |
end |
end |
</OnTabPressed> |
<OnEnterPressed> |
if ( self:GetParent().nextFocus ) then |
self:GetParent().nextFocus:SetFocus(); |
else |
self:ClearFocus(); |
end |
</OnEnterPressed> |
<OnEscapePressed> |
self:ClearFocus(); |
</OnEscapePressed> |
<OnTextChanged> |
MoneyInputFrame_OnTextChanged(self,self:GetParent()); |
</OnTextChanged> |
<OnEditFocusLost> |
self:HighlightText(0, 0); |
</OnEditFocusLost> |
<OnEditFocusGained> |
self:HighlightText(); |
</OnEditFocusGained> |
</Scripts> |
<FontString inherits="ChatFontNormal" /> |
</EditBox> |
</Frames> |
</Frame> |
<Button name="GLUserButtonTemplate" virtual="true"> |
<Size> |
<AbsDimension x="260" y="16" /> |
</Size> |
<Layers> |
<Layer level="BACKGROUND"> |
<FontString name="$parentTag" inherits="GameFontNormal" justifyH="RIGHT"> |
<Size> |
<AbsDimension x="0" y="16" /> |
</Size> |
<Anchors> |
<Anchor point="LEFT"> |
<Offset> |
<AbsDimension x="20" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
</FontString> |
</Layer> |
</Layers> |
<Scripts> |
<OnClick> |
GuildLottery:User_OnClick(self, button) |
</OnClick> |
<OnLoad> |
GuildLottery:User_OnLoad(self) |
</OnLoad> |
<OnEnter> |
getglobal(self:GetName().."Tag"):SetTextColor((self.r or 0)+0.3, (self.g or 0)+0.3, (self.b or 0)+0.3); |
</OnEnter> |
<OnLeave> |
if (self:GetID() ~= (g_MenuItemSelected - FauxScrollFrame_GetOffset(GLUsersScrollFrame))) then |
getglobal(self:GetName().."Tag"):SetTextColor(self.r, self.g, self.b); |
end |
GameTooltip:Hide(); |
</OnLeave> |
</Scripts> |
<ButtonText name="$parentNormalText" nonspacewrap="true"> |
<Size> |
<AbsDimension x="0" y="10" /> |
</Size> |
<Anchors> |
<Anchor point="LEFT"> |
<Offset> |
<AbsDimension x="20" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
</ButtonText> |
<NormalFont justifyH="LEFT" inherits="GameFontNormal" /> |
<HighlightFont justifyH="LEFT" inherits="GameFontHighlight" /> |
<DisabledFont justifyH="LEFT" inherits="GameFontHighlight" /> |
</Button> |
<Frame name="GLUserCmdList" inherits="UIDropDownMenuTemplate"> |
<Scripts> |
<OnLoad> |
GL_UserCmdList_OnLoad() |
</OnLoad> |
</Scripts> |
</Frame> |
<Button name="GLMinimapButton" hidden="true" parent="Minimap" toplevel="true" frameStrata="DIALOG"> |
<Size> |
<AbsDimension x="36" y="36" /> |
</Size> |
<Layers> |
<Layer> |
<Texture name="$parentTexture" file="Interface\Icons\Spell_Nature_TimeStop"> |
<Size> |
<AbsDimension x="22" y="22" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT"> |
<Offset> |
<AbsDimension x="6" y="-5" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Texture> |
</Layer> |
<Layer level="OVERLAY"> |
<FontString name="$parentText" inherits="GameFontHighlight"> |
<Size> |
<AbsDimension x="16" y="14" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT"> |
<Offset> |
<AbsDimension x="8" y="-8" /> |
</Offset> |
</Anchor> |
</Anchors> |
</FontString> |
<Texture file="Interface\Minimap\MiniMap-TrackingBorder"> |
<Size> |
<AbsDimension x="57" y="57" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT" /> |
</Anchors> |
</Texture> |
</Layer> |
</Layers> |
<Scripts> |
<OnLoad> |
self:RegisterForClicks("LeftButtonDown", "RightButtonDown"); |
</OnLoad> |
<OnClick> |
if (arg1 == "LeftButton") then |
GuildLottery:Toggle(); |
else |
GuildLottery:Toggle(); |
end |
</OnClick> |
<OnEnter> |
GameTooltip:SetOwner(self, "ANCHOR_LEFT"); |
GameTooltip:ClearLines(); |
GameTooltip:SetText("Guild Lottery"); |
GameTooltip:Show(); |
</OnEnter> |
<OnLeave> |
GameTooltip:Hide(); |
</OnLeave> |
</Scripts> |
<HighlightTexture file="Interface\Minimap\UI-Minimap-ZoomButton-Highlight" alphaMode="ADD" /> |
</Button> |
<Frame name="GLNewUserFrame" hidden="true" parent="UIParent" toplevel="true" movable="true" frameStrata="DIALOG" enableMouse="true"> |
<Size> |
<AbsDimension x="300" y="125" /> |
</Size> |
<Anchors> |
<Anchor point="CENTER"> |
<Offset x="0" y="0" /> |
</Anchor> |
</Anchors> |
<Backdrop name="GLNewUserFrameBackdrop" bgFile="Interface\TutorialFrame\TutorialFrameBackground" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true"> |
<BackgroundInsets> |
<AbsInset left="3" right="5" top="3" bottom="5" /> |
</BackgroundInsets> |
<TileSize> |
<AbsValue val="16" /> |
</TileSize> |
<EdgeSize> |
<AbsValue val="16" /> |
</EdgeSize> |
</Backdrop> |
<Layers> |
<Layer> |
<FontString name="GLNewUserFramePlayerName" inherits="GameFontNormal"> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLNewUserFrame"> |
<Offset> |
<AbsDimension x="10" y="-11" /> |
</Offset> |
</Anchor> |
</Anchors> |
</FontString> |
<FontString name="GLNewUserFrameNumTickets" inherits="GameFontNormal"> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLNewUserFrame"> |
<Offset> |
<AbsDimension x="80" y="-67" /> |
</Offset> |
</Anchor> |
</Anchors> |
</FontString> |
</Layer> |
</Layers> |
<Frames> |
<Button name="GLNewUserFrameCloseButton" inherits="UIPanelCloseButton"> |
<Anchors> |
<Anchor point="TOPRIGHT" relativeTo="GLNewUserFrame"> |
<Offset> |
<AbsDimension x="2" y="2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLNewUserCancelButton" inherits="UIPanelButtonTemplate"> |
<Size> |
<AbsDimension x="100" y="21" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT"> |
<Offset> |
<AbsDimension x="80" y="-95" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnClick> |
GuildLottery:NewUserCancel_Click(); |
</OnClick> |
</Scripts> |
</Button> |
<Button name="GLNewUserOKButton" inherits="UIPanelButtonTemplate"> |
<Size> |
<AbsDimension x="100" y="21" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT"> |
<Offset> |
<AbsDimension x="190" y="-95" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnClick> |
GuildLottery:NewUserOK_Click(); |
</OnClick> |
</Scripts> |
</Button> |
<Frame name="GLNewUserNameBackground"> |
<Size> |
<AbsDimension x="260" y="32" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT"> |
<Offset> |
<AbsDimension x="11" y="-25" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true"> |
<BackgroundInsets> |
<AbsInset left="5" right="5" top="5" bottom="5" /> |
</BackgroundInsets> |
<TileSize> |
<AbsValue val="16" /> |
</TileSize> |
<EdgeSize> |
<AbsValue val="16" /> |
</EdgeSize> |
</Backdrop> |
<Scripts> |
<OnLoad> |
self:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b); |
self:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b); |
</OnLoad> |
</Scripts> |
</Frame> |
<EditBox name="GLNewUserNameEditBox" letters="40" autoFocus="false"> |
<FontString inherits="ChatFontNormal" /> |
<Size> |
<AbsDimension x="260" y="30" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT"> |
<Offset> |
<AbsDimension x="15" y="-26" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnTabPressed> |
GLNewUserTicketsEditBox:SetFocus(); |
</OnTabPressed> |
<OnChar> |
GuildLottery:NewUserNameAutocomplete(self) |
</OnChar> |
<OnEnterPressed> |
self:ClearFocus(); |
GuildLottery:NewUserOnEnterPressed(); |
</OnEnterPressed> |
<OnEscapePressed> |
self:ClearFocus(); |
GuildLottery:NewUserOnEscapePressed(); |
</OnEscapePressed> |
</Scripts> |
<FontString inherits="ChatFontNormal" /> |
</EditBox> |
<Frame name="GLNewUserTicketsBackground"> |
<Size> |
<AbsDimension x="60" y="32" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT"> |
<Offset> |
<AbsDimension x="211" y="-57" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true"> |
<BackgroundInsets> |
<AbsInset left="5" right="5" top="5" bottom="5" /> |
</BackgroundInsets> |
<TileSize> |
<AbsValue val="16" /> |
</TileSize> |
<EdgeSize> |
<AbsValue val="16" /> |
</EdgeSize> |
</Backdrop> |
<Scripts> |
<OnLoad> |
self:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b); |
self:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b); |
</OnLoad> |
</Scripts> |
</Frame> |
<EditBox name="GLNewUserTicketsEditBox" letters="40" autoFocus="false"> |
<Size> |
<AbsDimension x="60" y="30" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT"> |
<Offset> |
<AbsDimension x="215" y="-58" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnTabPressed> |
GLNewUserNameEditBox:SetFocus(); |
</OnTabPressed> |
<OnEnterPressed> |
self:ClearFocus(); |
GuildLottery:NewUserOnEnterPressed(); |
</OnEnterPressed> |
<OnEscapePressed> |
self:ClearFocus(); |
GuildLottery:NewUserOnEscapePressed(); |
</OnEscapePressed> |
</Scripts> |
<FontString inherits="ChatFontNormal" /> |
</EditBox> |
</Frames> |
<Scripts> |
<OnMouseUp> |
if ( self.isMoving ) then |
self:StopMovingOrSizing(); |
self.isMoving = false; |
end |
</OnMouseUp> |
<OnMouseDown> |
if ( ( ( not self.isLocked ) or ( self.isLocked == 0 ) ) and ( arg1 == "LeftButton" ) ) then |
self:StartMoving(); |
self.isMoving = true; |
end |
</OnMouseDown> |
<OnHide> |
if ( self.isMoving ) then |
self:StopMovingOrSizing(); |
self.isMoving = false; |
end |
</OnHide> |
<OnLoad> |
self:RegisterForDrag("LeftButton"); |
</OnLoad> |
<OnDragStart> |
self:StartMoving(); |
</OnDragStart> |
<OnDragStop> |
self:StopMovingOrSizing(); |
</OnDragStop> |
</Scripts> |
</Frame> |
<Frame name="GLQuestionFrame" hidden="true" parent="UIParent" toplevel="true" movable="true" frameStrata="DIALOG" enableMouse="true"> |
<Size> |
<AbsDimension x="300" y="200" /> |
</Size> |
<Anchors> |
<Anchor point="CENTER"> |
<Offset x="0" y="0" /> |
</Anchor> |
</Anchors> |
<Backdrop name="$parentBackdrop" bgFile="Interface\TutorialFrame\TutorialFrameBackground" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true"> |
<BackgroundInsets> |
<AbsInset left="3" right="5" top="3" bottom="5" /> |
</BackgroundInsets> |
<TileSize> |
<AbsValue val="16" /> |
</TileSize> |
<EdgeSize> |
<AbsValue val="16" /> |
</EdgeSize> |
</Backdrop> |
<Frames> |
<Button name="$parentCloseButton" inherits="UIPanelCloseButton"> |
<Anchors> |
<Anchor point="TOPRIGHT" relativeTo="GLQuestionFrame"> |
<Offset> |
<AbsDimension x="2" y="2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLQuestionNoButton" inherits="UIPanelButtonTemplate"> |
<Size> |
<AbsDimension x="100" y="21" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT"> |
<Offset> |
<AbsDimension x="80" y="-170" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnClick> |
GuildLottery:QuestionNo_Click() |
</OnClick> |
</Scripts> |
</Button> |
<Button name="GLQuestionYesButton" inherits="UIPanelButtonTemplate"> |
<Size> |
<AbsDimension x="100" y="21" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT"> |
<Offset> |
<AbsDimension x="190" y="-170" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnClick> |
GuildLottery:QuestionYes_Click() |
</OnClick> |
</Scripts> |
</Button> |
<EditBox name="GLQuestionEditBox" multiLine="true" autoFocus="false"> |
<Size> |
<AbsDimension x="260" y="60" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT"> |
<Offset> |
<AbsDimension x="11" y="-16" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnEscapePressed> |
self:ClearFocus(); |
</OnEscapePressed> |
</Scripts> |
<FontString inherits="ChatFontNormal" /> |
</EditBox> |
</Frames> |
<Scripts> |
<OnLoad> |
GLQuestionEditBox:EnableMouse(0); |
self:RegisterForDrag("LeftButton"); |
</OnLoad> |
<OnMouseUp> |
if ( self.isMoving ) then |
self:StopMovingOrSizing(); |
self.isMoving = false; |
end |
</OnMouseUp> |
<OnMouseDown> |
if ( ( ( not self.isLocked ) or ( self.isLocked == 0 ) ) and ( arg1 == "LeftButton" ) ) then |
self:StartMoving(); |
self.isMoving = true; |
end |
</OnMouseDown> |
<OnHide> |
if ( self.isMoving ) then |
self:StopMovingOrSizing(); |
self.isMoving = false; |
end |
</OnHide> |
<OnDragStart> |
self:StartMoving(); |
</OnDragStart> |
<OnDragStop> |
self:StopMovingOrSizing(); |
</OnDragStop> |
</Scripts> |
</Frame> |
<Frame name="GLControlFrame" hidden="true" parent="UIParent" toplevel="true" movable="true" frameStrata="DIALOG" enableMouse="true"> |
<Size> |
<AbsDimension x="512" y="490" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT"> |
<Offset x="318" y="-62" /> |
</Anchor> |
</Anchors> |
<Backdrop name="$parentBackdrop" bgFile="Interface\TutorialFrame\TutorialFrameBackground" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true"> |
<BackgroundInsets> |
<AbsInset left="3" right="5" top="3" bottom="5" /> |
</BackgroundInsets> |
<TileSize> |
<AbsValue val="16" /> |
</TileSize> |
<EdgeSize> |
<AbsValue val="16" /> |
</EdgeSize> |
</Backdrop> |
<Layers> |
<Layer> |
<Texture name="GLTitleTexture" file="Interface\DialogFrame\UI-DialogBox-Header"> |
<Size> |
<AbsDimension x="300" y="59" /> |
</Size> |
<Anchors> |
<Anchor point="TOP" relativeTo="GLControlFrame"> |
<Offset x="0" y="15" /> |
</Anchor> |
</Anchors> |
</Texture> |
<FontString name="GLTitleText" inherits="GameFontNormal"> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOP" relativeTo="GLTitleTexture"> |
<Offset> |
<AbsDimension x="0" y="-12" /> |
</Offset> |
</Anchor> |
</Anchors> |
</FontString> |
<FontString name="GLControlVersion" inherits="GameFontNormal"> |
<Anchors> |
<Anchor relativeFrom="BOTTOMRIGHT" point="BOTTOMRIGHT" relativeTo="GLControlFrame"> |
<Offset> |
<AbsDimension x="-15" y="10" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Color r="0.6" g="0.8" b="1" /> |
</FontString> |
</Layer> |
</Layers> |
<Frames> |
<Button name="$parentCloseButton" inherits="UIPanelCloseButton"> |
<Anchors> |
<Anchor point="TOPRIGHT" relativeTo="GLControlFrame"> |
<Offset> |
<AbsDimension x="2" y="2" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Frame name="GLOptionsFrame" hidden="true"> |
<Size> |
<AbsDimension x="502" y="480" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="BOTTOMLEFT" point="TOPLEFT" relativeTo="GLControlFrame"> |
<Offset> |
<AbsDimension x="5" y="-5" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Layers> |
</Layers> |
<Frames> |
<CheckButton name="GLTooltipCheckBox" inherits="GLCheckButtonTemplate"> |
<Anchors> |
<Anchor point="TOP"> |
<Offset> |
<AbsDimension x="-55" y="-30" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Layers> |
<Layer> |
<FontString name="GLTooltipText" inherits="GameFontNormalSmall"> |
<Anchors> |
<Anchor point="LEFT" relativePoint="RIGHT"> |
<Offset> |
<AbsDimension x="5" y="1" /> |
</Offset> |
</Anchor> |
</Anchors> |
</FontString> |
</Layer> |
</Layers> |
<Scripts> |
<OnClick> |
if self:GetChecked() then |
PlaySound("igMainMenuOptionCheckBoxOn"); |
else |
PlaySound("igMainMenuOptionCheckBoxOff"); |
end |
GuildLottery:TooltipCheckBox_OnClick(); |
</OnClick> |
</Scripts> |
</CheckButton> |
<CheckButton name="GLCheckBoxLotteryAnnouncement" inherits="GLCheckButtonTemplate"> |
<Anchors> |
<Anchor point="TOP"> |
<Offset> |
<AbsDimension x="-55" y="-60" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Layers> |
<Layer> |
<FontString name="GLCheckBoxLotteryLabel" inherits="GameFontNormalSmall"> |
<Anchors> |
<Anchor point="LEFT" relativePoint="RIGHT"> |
<Offset> |
<AbsDimension x="5" y="1" /> |
</Offset> |
</Anchor> |
</Anchors> |
</FontString> |
</Layer> |
</Layers> |
<Scripts> |
<OnClick> |
if self:GetChecked() then |
PlaySound("igMainMenuOptionCheckBoxOn"); |
else |
PlaySound("igMainMenuOptionCheckBoxOff"); |
end |
GuildLottery:LotteryAnnouncement_OnClick(); |
</OnClick> |
</Scripts> |
</CheckButton> |
<CheckButton name="GLCheckBoxWinnerAnnouncement" inherits="GLCheckButtonTemplate"> |
<Anchors> |
<Anchor point="TOP"> |
<Offset> |
<AbsDimension x="-55" y="-90" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Layers> |
<Layer> |
<FontString name="GLCheckBoxWinnerAnnouncementLabel" inherits="GameFontNormalSmall"> |
<Anchors> |
<Anchor point="LEFT" relativePoint="RIGHT"> |
<Offset> |
<AbsDimension x="5" y="1" /> |
</Offset> |
</Anchor> |
</Anchors> |
</FontString> |
</Layer> |
</Layers> |
<Scripts> |
<OnClick> |
if self:GetChecked() then |
PlaySound("igMainMenuOptionCheckBoxOn"); |
else |
PlaySound("igMainMenuOptionCheckBoxOff"); |
end |
GuildLottery:WinnerAnnouncement_OnClick(); |
</OnClick> |
</Scripts> |
</CheckButton> |
<CheckButton name="GLMinimapCheckBox" inherits="GLCheckButtonTemplate"> |
<Anchors> |
<Anchor point="TOP"> |
<Offset> |
<AbsDimension x="-55" y="-120" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Layers> |
<Layer> |
<FontString name="GLMinimapLabel" inherits="GameFontNormalSmall"> |
<Anchors> |
<Anchor point="LEFT" relativePoint="RIGHT"> |
<Offset> |
<AbsDimension x="5" y="1" /> |
</Offset> |
</Anchor> |
</Anchors> |
</FontString> |
</Layer> |
</Layers> |
<Scripts> |
<OnClick> |
if self:GetChecked() then |
PlaySound("igMainMenuOptionCheckBoxOn"); |
else |
PlaySound("igMainMenuOptionCheckBoxOff"); |
end |
GuildLottery:MinimapCheckBox_OnClick(); |
</OnClick> |
</Scripts> |
</CheckButton> |
<CheckButton name="GLInvalidItemsCheckBox" inherits="GLCheckButtonTemplate"> |
<Anchors> |
<Anchor point="TOP"> |
<Offset> |
<AbsDimension x="-55" y="-150" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Layers> |
<Layer> |
<FontString name="GLInvalidItemsLabel" inherits="GameFontNormalSmall"> |
<Anchors> |
<Anchor point="LEFT" relativePoint="RIGHT"> |
<Offset> |
<AbsDimension x="5" y="1" /> |
</Offset> |
</Anchor> |
</Anchors> |
</FontString> |
</Layer> |
</Layers> |
<Scripts> |
<OnClick> |
if self:GetChecked() then |
PlaySound("igMainMenuOptionCheckBoxOn"); |
else |
PlaySound("igMainMenuOptionCheckBoxOff"); |
end |
GuildLottery:InvalidItemsCheckBox_OnClick(); |
</OnClick> |
</Scripts> |
</CheckButton> |
<Button name="GLChannelDropDownMenuButton" inherits="UIDropDownMenuTemplate"> |
<Size> |
<AbsDimension x="20" y="16" /> |
</Size> |
<Anchors> |
<Anchor point="TOP"> |
<Offset> |
<AbsDimension x="30" y="-180" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Layers> |
<Layer> |
<FontString name="GLChannelDropDownLabel" inherits="GameFontNormalSmall"> |
<Anchors> |
<Anchor point="LEFT" relativePoint="LEFT"> |
<Offset> |
<AbsDimension x="-35" y="1" /> |
</Offset> |
</Anchor> |
</Anchors> |
</FontString> |
</Layer> |
</Layers> |
<Scripts> |
<OnLoad> |
UIDropDownMenu_Initialize(self, GL_ChannelDropDownMenu_OnLoad) |
</OnLoad> |
</Scripts> |
</Button> |
<Slider name="GLArcSliderButtonPos" inherits="OptionsSliderTemplate"> |
<Size> |
<AbsDimension x="180" y="16" /> |
</Size> |
<Anchors> |
<Anchor point="BOTTOM"> |
<Offset> |
<AbsDimension x="0" y="50" /> |
</Offset> |
</Anchor> |
</Anchors> |
<HitRectInsets> |
<AbsInset xsi:nil="true" /> |
</HitRectInsets> |
<Scripts> |
<OnLoad> |
getglobal(self:GetName().."Text"):SetText("Change icon position"); |
getglobal(self:GetName().."High"):SetText(); |
getglobal(self:GetName().."Low"):SetText(); |
GLArcSliderButtonPos:SetMinMaxValues(0,360); |
GLArcSliderButtonPos:SetValueStep(1); |
</OnLoad> |
<OnValueChanged> |
GL_Settings.MinimapArcOffset = GLArcSliderButtonPos:GetValue(); |
GuildLottery:MinimapButton_Update(); |
</OnValueChanged> |
</Scripts> |
</Slider> |
<Slider name="GLRadiusSliderButtonPos" inherits="OptionsSliderTemplate"> |
<Size> |
<AbsDimension x="180" y="16" /> |
</Size> |
<Anchors> |
<Anchor point="TOP" relativeTo="GLArcSliderButtonPos" relativePoint="TOP"> |
<Offset> |
<AbsDimension x="0" y="30" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnLoad> |
getglobal(self:GetName().."Text"):SetText("Change icon distance"); |
getglobal(self:GetName().."High"):SetText(); |
getglobal(self:GetName().."Low"):SetText(); |
GLRadiusSliderButtonPos:SetMinMaxValues(80,300); |
GLRadiusSliderButtonPos:SetValueStep(1); |
</OnLoad> |
<OnValueChanged> |
GL_Settings.MinimapRadiusOffset = GLRadiusSliderButtonPos:GetValue(); |
GuildLottery:MinimapButton_Update(); |
</OnValueChanged> |
</Scripts> |
</Slider> |
<Slider name="GLIconSliderButtonPos" inherits="OptionsSliderTemplate"> |
<Size> |
<AbsDimension x="180" y="16" /> |
</Size> |
<Anchors> |
<Anchor point="TOP" relativeTo="GLRadiusSliderButtonPos" relativePoint="TOP"> |
<Offset> |
<AbsDimension x="0" y="30" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnLoad> |
getglobal(self:GetName().."Text"):SetText("Change icon picture"); |
getglobal(self:GetName().."High"):SetText(); |
getglobal(self:GetName().."Low"):SetText(); |
GLIconSliderButtonPos:SetValueStep(1); |
GLIconSliderButtonPos:SetMinMaxValues(1,table.getn(GL_Icons)); |
</OnLoad> |
<OnValueChanged> |
GL_Settings.MinimapTextureId = GLIconSliderButtonPos:GetValue(); |
GuildLottery:MinimapButton_Update(); |
</OnValueChanged> |
</Scripts> |
</Slider> |
</Frames> |
</Frame> |
<Frame name="GLNonOptionsFrame"> |
<Size> |
<AbsDimension x="502" y="480" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="BOTTOMLEFT" point="TOPLEFT" relativeTo="GLControlFrame"> |
<Offset> |
<AbsDimension x="5" y="-5" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Layers> |
<Layer> |
<FontString name="GLLabelUsers" inherits="GameFontNormal"> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLControlFrame"> |
<Offset> |
<AbsDimension x="21" y="-250" /> |
</Offset> |
</Anchor> |
</Anchors> |
</FontString> |
<FontString name="GLLabelTickets" inherits="GameFontNormal"> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLControlFrame"> |
<Offset> |
<AbsDimension x="211" y="-250" /> |
</Offset> |
</Anchor> |
</Anchors> |
</FontString> |
<FontString name="GLLabelTicketOptions" inherits="GameFontNormal"> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLControlFrame"> |
<Offset> |
<AbsDimension x="20" y="-440" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Color r="1" g="1" b="0.2" a="0.6" /> |
</FontString> |
</Layer> |
</Layers> |
<Frames> |
<Frame name="GLRaffleSettingAreaBackground"> |
<Size> |
<AbsDimension x="340" y="200" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="BOTTOMLEFT" point="TOPLEFT" relativeTo="GLControlFrame"> |
<Offset> |
<AbsDimension x="150" y="-40" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true"> |
<BackgroundInsets> |
<AbsInset left="5" right="5" top="5" bottom="5" /> |
</BackgroundInsets> |
<TileSize> |
<AbsValue val="16" /> |
</TileSize> |
<EdgeSize> |
<AbsValue val="16" /> |
</EdgeSize> |
</Backdrop> |
<Layers> |
<Layer> |
<FontString name="GLLabelRaffleDate" inherits="GameFontNormal"> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLRaffleSettingAreaBackground"> |
<Offset> |
<AbsDimension x="15" y="-10" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Color r="0.6" g="0.8" b="1" /> |
</FontString> |
<FontString name="GLLabelRaffleName" inherits="GameFontNormal"> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLLabelRaffleDate"> |
<Offset> |
<AbsDimension x="140" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Color r="0.6" g="0.8" b="1" /> |
</FontString> |
<FontString name="GLLabelMaxRaffleTickets" inherits="GameFontNormal"> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLLabelRaffleDate"> |
<Offset> |
<AbsDimension x="0" y="-50" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Color r="0.6" g="0.8" b="1" /> |
</FontString> |
<FontString name="GLLabelRaffleItemOneTickets" inherits="GameFontNormal"> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLLabelMaxRaffleTickets"> |
<Offset> |
<AbsDimension x="0" y="-50" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Color r="0.6" g="0.8" b="1" /> |
</FontString> |
<FontString name="GLLabelRaffleItemTwoTickets" inherits="GameFontNormal"> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLLabelRaffleItemOneTickets"> |
<Offset> |
<AbsDimension x="0" y="-25" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Color r="0.6" g="0.8" b="1" /> |
</FontString> |
<FontString name="GLLabelRaffleItemThreeTickets" inherits="GameFontNormal"> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLLabelRaffleItemTwoTickets"> |
<Offset> |
<AbsDimension x="0" y="-25" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Color r="0.6" g="0.8" b="1" /> |
</FontString> |
<FontString name="GLLabelRaffleTicketPrice" inherits="GameFontNormal"> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLLabelRaffleName"> |
<Offset> |
<AbsDimension x="0" y="-50" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Color r="0.6" g="0.8" b="1" /> |
</FontString> |
</Layer> |
</Layers> |
<Scripts> |
<OnLoad> |
self:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b); |
self:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b); |
</OnLoad> |
</Scripts> |
</Frame> |
<Frame name="GLSettingAreaBackground"> |
<Size> |
<AbsDimension x="340" y="200" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="BOTTOMLEFT" point="TOPLEFT" relativeTo="GLControlFrame"> |
<Offset> |
<AbsDimension x="150" y="-40" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true"> |
<BackgroundInsets> |
<AbsInset left="5" right="5" top="5" bottom="5" /> |
</BackgroundInsets> |
<TileSize> |
<AbsValue val="16" /> |
</TileSize> |
<EdgeSize> |
<AbsValue val="16" /> |
</EdgeSize> |
</Backdrop> |
<Layers> |
<Layer> |
<FontString name="GLLabelLotteryDate" inherits="GameFontNormal"> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLSettingAreaBackground"> |
<Offset> |
<AbsDimension x="15" y="-10" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Color r="0.6" g="0.8" b="1" /> |
</FontString> |
<FontString name="GLLabelLotteryName" inherits="GameFontNormal"> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLLabelLotteryDate"> |
<Offset> |
<AbsDimension x="140" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Color r="0.6" g="0.8" b="1" /> |
</FontString> |
<FontString name="GLLabelStartGold" inherits="GameFontNormal"> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLLabelLotteryDate"> |
<Offset> |
<AbsDimension x="0" y="-50" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Color r="0.6" g="0.8" b="1" /> |
</FontString> |
<FontString name="GLLabelMaxTickets" inherits="GameFontNormal"> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLLabelStartGold"> |
<Offset> |
<AbsDimension x="0" y="-40" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Color r="0.6" g="0.8" b="1" /> |
</FontString> |
<FontString name="GLLabelSecondPrize" inherits="GameFontNormal"> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLLabelMaxTickets"> |
<Offset> |
<AbsDimension x="0" y="-40" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Color r="0.6" g="0.8" b="1" /> |
</FontString> |
<FontString name="GLLabelJackpot" inherits="GameFontNormal"> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLLabelLotteryName"> |
<Offset> |
<AbsDimension x="0" y="-50" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Color r="0.6" g="0.8" b="1" /> |
</FontString> |
<FontString name="GLLabelTicketPrice" inherits="GameFontNormal"> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLLabelJackpot"> |
<Offset> |
<AbsDimension x="0" y="-40" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Color r="0.6" g="0.8" b="1" /> |
</FontString> |
<FontString name="GLLabelGuildCut" inherits="GameFontNormal"> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLLabelTicketPrice"> |
<Offset> |
<AbsDimension x="0" y="-40" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Color r="0.6" g="0.8" b="1" /> |
</FontString> |
</Layer> |
</Layers> |
<Scripts> |
<OnLoad> |
self:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b); |
self:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b); |
</OnLoad> |
</Scripts> |
</Frame> |
<Frame name="GLMaxTicketsBackground" parent="GLSettingAreaBackground"> |
<Size> |
<AbsDimension x="60" y="20" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="BOTTOMLEFT" point="TOPLEFT" relativeTo="GLLabelMaxTickets"> |
<Offset> |
<AbsDimension x="0" y="-15" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true"> |
<BackgroundInsets> |
<AbsInset left="5" right="5" top="5" bottom="5" /> |
</BackgroundInsets> |
<TileSize> |
<AbsValue val="16" /> |
</TileSize> |
<EdgeSize> |
<AbsValue val="16" /> |
</EdgeSize> |
</Backdrop> |
<Scripts> |
<OnLoad> |
self:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b); |
self:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b); |
</OnLoad> |
</Scripts> |
</Frame> |
<Frame name="GLMaxRaffleTicketsBackground" parent="GLRaffleSettingAreaBackground"> |
<Size> |
<AbsDimension x="60" y="20" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="BOTTOMLEFT" point="TOPLEFT" relativeTo="GLLabelMaxRaffleTickets"> |
<Offset> |
<AbsDimension x="0" y="-15" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true"> |
<BackgroundInsets> |
<AbsInset left="5" right="5" top="5" bottom="5" /> |
</BackgroundInsets> |
<TileSize> |
<AbsValue val="16" /> |
</TileSize> |
<EdgeSize> |
<AbsValue val="16" /> |
</EdgeSize> |
</Backdrop> |
<Scripts> |
<OnLoad> |
self:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b); |
self:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b); |
</OnLoad> |
</Scripts> |
</Frame> |
<Frame name="GLSecondPrizeBackground" parent="GLSettingAreaBackground"> |
<Size> |
<AbsDimension x="60" y="20" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="BOTTOMLEFT" point="TOPLEFT" relativeTo="GLLabelSecondPrize"> |
<Offset> |
<AbsDimension x="0" y="-15" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true"> |
<BackgroundInsets> |
<AbsInset left="5" right="5" top="5" bottom="5" /> |
</BackgroundInsets> |
<TileSize> |
<AbsValue val="16" /> |
</TileSize> |
<EdgeSize> |
<AbsValue val="16" /> |
</EdgeSize> |
</Backdrop> |
<Scripts> |
<OnLoad> |
self:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b); |
self:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b); |
</OnLoad> |
</Scripts> |
</Frame> |
<Frame name="GLGuildCutBackground" parent="GLSettingAreaBackground"> |
<Size> |
<AbsDimension x="60" y="20" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="BOTTOMLEFT" point="TOPLEFT" relativeTo="GLLabelGuildCut"> |
<Offset> |
<AbsDimension x="0" y="-15" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true"> |
<BackgroundInsets> |
<AbsInset left="5" right="5" top="5" bottom="5" /> |
</BackgroundInsets> |
<TileSize> |
<AbsValue val="16" /> |
</TileSize> |
<EdgeSize> |
<AbsValue val="16" /> |
</EdgeSize> |
</Backdrop> |
<Scripts> |
<OnLoad> |
self:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b); |
self:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b); |
</OnLoad> |
</Scripts> |
</Frame> |
<Frame name="GLLotteryDateBackground" parent="GLSettingAreaBackground"> |
<Size> |
<AbsDimension x="130" y="20" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="BOTTOMLEFT" point="TOPLEFT" relativeTo="GLLabelLotteryDate"> |
<Offset> |
<AbsDimension x="0" y="-16" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true"> |
<BackgroundInsets> |
<AbsInset left="5" right="5" top="5" bottom="5" /> |
</BackgroundInsets> |
<TileSize> |
<AbsValue val="16" /> |
</TileSize> |
<EdgeSize> |
<AbsValue val="16" /> |
</EdgeSize> |
</Backdrop> |
<Scripts> |
<OnLoad> |
self:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b); |
self:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b); |
</OnLoad> |
</Scripts> |
</Frame> |
<Frame name="GLRaffleDateBackground" parent="GLRaffleSettingAreaBackground"> |
<Anchor relativeFrom="BOTTOMLEFT" point="TOPLEFT" relativeTo="GLControlFrame"> |
<Offset> |
<AbsDimension x="150" y="-40" /> |
</Offset> |
</Anchor> |
<Size> |
<AbsDimension x="130" y="20" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="BOTTOMLEFT" point="TOPLEFT" relativeTo="GLLabelRaffleDate"> |
<Offset> |
<AbsDimension x="0" y="-16" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true"> |
<BackgroundInsets> |
<AbsInset left="5" right="5" top="5" bottom="5" /> |
</BackgroundInsets> |
<TileSize> |
<AbsValue val="16" /> |
</TileSize> |
<EdgeSize> |
<AbsValue val="16" /> |
</EdgeSize> |
</Backdrop> |
<Scripts> |
<OnLoad> |
self:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b); |
self:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b); |
</OnLoad> |
</Scripts> |
</Frame> |
<Frame name="GLRaffleItemOneBackground" parent="GLRaffleSettingAreaBackground"> |
<Size> |
<AbsDimension x="130" y="20" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="BOTTOMLEFT" point="TOPLEFT" relativeTo="GLLabelRaffleItemOneTickets"> |
<Offset> |
<AbsDimension x="90" y="3" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true"> |
<BackgroundInsets> |
<AbsInset left="5" right="5" top="5" bottom="5" /> |
</BackgroundInsets> |
<TileSize> |
<AbsValue val="16" /> |
</TileSize> |
<EdgeSize> |
<AbsValue val="16" /> |
</EdgeSize> |
</Backdrop> |
<Scripts> |
<OnLoad> |
self:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b); |
self:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b); |
</OnLoad> |
</Scripts> |
</Frame> |
<Frame name="GLRaffleItemTwoBackground" parent="GLRaffleSettingAreaBackground"> |
<Size> |
<AbsDimension x="130" y="20" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="BOTTOMLEFT" point="TOPLEFT" relativeTo="GLLabelRaffleItemTwoTickets"> |
<Offset> |
<AbsDimension x="90" y="3" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true"> |
<BackgroundInsets> |
<AbsInset left="5" right="5" top="5" bottom="5" /> |
</BackgroundInsets> |
<TileSize> |
<AbsValue val="16" /> |
</TileSize> |
<EdgeSize> |
<AbsValue val="16" /> |
</EdgeSize> |
</Backdrop> |
<Scripts> |
<OnLoad> |
self:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b); |
self:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b); |
</OnLoad> |
</Scripts> |
</Frame> |
<Frame name="GLRaffleItemThreeBackground" parent="GLRaffleSettingAreaBackground"> |
<Size> |
<AbsDimension x="130" y="20" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="BOTTOMLEFT" point="TOPLEFT" relativeTo="GLLabelRaffleItemThreeTickets"> |
<Offset> |
<AbsDimension x="90" y="3" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true"> |
<BackgroundInsets> |
<AbsInset left="5" right="5" top="5" bottom="5" /> |
</BackgroundInsets> |
<TileSize> |
<AbsValue val="16" /> |
</TileSize> |
<EdgeSize> |
<AbsValue val="16" /> |
</EdgeSize> |
</Backdrop> |
<Scripts> |
<OnLoad> |
self:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b); |
self:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b); |
</OnLoad> |
</Scripts> |
</Frame> |
<Frame name="GLLotteryNameBackground" parent="GLSettingAreaBackground"> |
<Size> |
<AbsDimension x="130" y="20" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="BOTTOMLEFT" point="TOPLEFT" relativeTo="GLLabelLotteryName"> |
<Offset> |
<AbsDimension x="0" y="-16" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true"> |
<BackgroundInsets> |
<AbsInset left="5" right="5" top="5" bottom="5" /> |
</BackgroundInsets> |
<TileSize> |
<AbsValue val="16" /> |
</TileSize> |
<EdgeSize> |
<AbsValue val="16" /> |
</EdgeSize> |
</Backdrop> |
<Scripts> |
<OnLoad> |
self:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b); |
self:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b); |
</OnLoad> |
</Scripts> |
</Frame> |
<Frame name="GLRaffleNameBackground" parent="GLRaffleSettingAreaBackground"> |
<Size> |
<AbsDimension x="130" y="20" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="BOTTOMLEFT" point="TOPLEFT" relativeTo="GLLabelRaffleName"> |
<Offset> |
<AbsDimension x="0" y="-16" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true"> |
<BackgroundInsets> |
<AbsInset left="5" right="5" top="5" bottom="5" /> |
</BackgroundInsets> |
<TileSize> |
<AbsValue val="16" /> |
</TileSize> |
<EdgeSize> |
<AbsValue val="16" /> |
</EdgeSize> |
</Backdrop> |
<Scripts> |
<OnLoad> |
self:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b); |
self:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b); |
</OnLoad> |
</Scripts> |
</Frame> |
<Frame name="GLStartGoldFrame" inherits="GLMoneyInputFrameTemplate" parent="GLSettingAreaBackground"> |
<Anchors> |
<Anchor relativeFrom="BOTTOMLEFT" point="TOPLEFT" relativeTo="GLLabelStartGold"> |
<Offset> |
<AbsDimension x="5" y="-15" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Frame> |
<EditBox name="GLMaxRaffleTicketsEditBox" parent="GLRaffleSettingAreaBackground" letters="3" numeric="true" autoFocus="false"> |
<Size> |
<AbsDimension x="60" y="20" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLMaxRaffleTicketsBackground"> |
<Offset> |
<AbsDimension x="4" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnEditFocusGained> |
self:SetTextColor(1,1,0); |
self:HighlightText(); |
</OnEditFocusGained> |
<OnEscapePressed> |
GuildLottery:MaxRaffleTicketsOnEscapePressed(self); |
</OnEscapePressed> |
<OnEditFocusLost> |
GuildLottery:MaxRaffleTicketsOnEnterPressed(self); |
self:SetTextColor(1,1,1); |
</OnEditFocusLost> |
<OnEnterPressed> |
GuildLottery:MaxRaffleTicketsOnEnterPressed(self); |
self:ClearFocus(); |
self:SetTextColor(1,1,1); |
</OnEnterPressed> |
</Scripts> |
<FontString inherits="ChatFontNormal" /> |
</EditBox> |
<EditBox name="GLMaxTicketsEditBox" parent="GLSettingAreaBackground" letters="3" numeric="true" autoFocus="false"> |
<Size> |
<AbsDimension x="60" y="20" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLMaxTicketsBackground"> |
<Offset> |
<AbsDimension x="4" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnEditFocusGained> |
self:SetTextColor(1,1,0) |
self:HighlightText() |
</OnEditFocusGained> |
<OnEditFocusLost> |
GuildLottery:MaxTicketsOnEnterPressed(self) |
self:SetTextColor(1,1,1); |
</OnEditFocusLost> |
<OnEnterPressed> |
GuildLottery:MaxTicketsOnEnterPressed(self) |
</OnEnterPressed> |
<OnEscapePressed> |
GuildLottery:MaxTicketsOnEscapePressed(self) |
</OnEscapePressed> |
</Scripts> |
<FontString inherits="ChatFontNormal" /> |
</EditBox> |
<EditBox name="GLRaffleItemOneEditBox" parent="GLRaffleSettingAreaBackground" autoFocus="false"> |
<Size> |
<AbsDimension x="117" y="20" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLRaffleItemOneBackground"> |
<Offset> |
<AbsDimension x="4" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnEditFocusGained> |
self:SetTextColor(1,1,0); |
self:HighlightText(); |
</OnEditFocusGained> |
<OnEditFocusLost> |
self:HighlightText(0,0); |
self:SetTextColor(1,1,1); |
</OnEditFocusLost> |
<OnEnterPressed> |
GuildLottery:RaffleItemOne_OnEnterPressed(self); |
</OnEnterPressed> |
<OnEscapePressed> |
GuildLottery:RaffleItemOne_OnEscapePressed(self); |
</OnEscapePressed> |
<OnTextChanged> |
GuildLottery:RaffleItemOne_OnTextChanged(self); |
</OnTextChanged> |
</Scripts> |
<FontString inherits="ChatFontNormal" /> |
</EditBox> |
<EditBox name="GLRaffleItemTwoEditBox" parent="GLRaffleSettingAreaBackground" autoFocus="false"> |
<Size> |
<AbsDimension x="117" y="20" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLRaffleItemTwoBackground"> |
<Offset> |
<AbsDimension x="4" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnEditFocusGained> |
self:SetTextColor(1,1,0); |
self:HighlightText(); |
</OnEditFocusGained> |
<OnEditFocusLost> |
self:HighlightText(0,0); |
self:SetTextColor(1,1,1); |
</OnEditFocusLost> |
<OnEnterPressed> |
GuildLottery:RaffleItemTwo_OnEnterPressed(self); |
</OnEnterPressed> |
<OnEscapePressed> |
GuildLottery:RaffleItemTwo_OnEscapePressed(self); |
</OnEscapePressed> |
<OnTextChanged> |
GuildLottery:RaffleItemTwo_OnTextChanged(self); |
</OnTextChanged> |
</Scripts> |
<FontString inherits="ChatFontNormal" /> |
</EditBox> |
<EditBox name="GLRaffleItemThreeEditBox" parent="GLRaffleSettingAreaBackground" autoFocus="false"> |
<Size> |
<AbsDimension x="117" y="20" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLRaffleItemThreeBackground"> |
<Offset> |
<AbsDimension x="4" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnEditFocusGained> |
self:SetTextColor(1,1,0); |
self:HighlightText(); |
</OnEditFocusGained> |
<OnEditFocusLost> |
self:HighlightText(0,0); |
self:SetTextColor(1,1,1); |
</OnEditFocusLost> |
<OnEnterPressed> |
GuildLottery:RaffleItemThree_OnEnterPressed(self); |
</OnEnterPressed> |
<OnEscapePressed> |
GuildLottery:RaffleItemThree_OnEscapePressed(self); |
</OnEscapePressed> |
<OnTextChanged> |
GuildLottery:RaffleItemThree_OnTextChanged(self); |
</OnTextChanged> |
</Scripts> |
<FontString inherits="ChatFontNormal" /> |
</EditBox> |
<Button name="GLRaffleItemOneButton" inherits="UIPanelButtonTemplate" hidden="true"> |
<Size> |
<AbsDimension x="75" y="17" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLRaffleItemOneBackground"> |
<Offset> |
<AbsDimension x="135" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnClick> |
GuildLottery:RaffleItemOneButton_OnClick(self); |
</OnClick> |
</Scripts> |
</Button> |
<Button name="GLRaffleItemTwoButton" inherits="UIPanelButtonTemplate" hidden="true"> |
<Size> |
<AbsDimension x="75" y="17" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLRaffleItemTwoBackground"> |
<Offset> |
<AbsDimension x="135" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnClick> |
GuildLottery:RaffleItemTwoButton_OnClick(self); |
</OnClick> |
</Scripts> |
</Button> |
<Button name="GLRaffleItemThreeButton" inherits="UIPanelButtonTemplate" hidden="true"> |
<Size> |
<AbsDimension x="75" y="17" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLRaffleItemThreeBackground"> |
<Offset> |
<AbsDimension x="135" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnClick> |
GuildLottery:RaffleItemThreeButton_OnClick(self); |
</OnClick> |
</Scripts> |
</Button> |
<EditBox name="GLSecondPrizeEditBox" parent="GLSettingAreaBackground" letters="3" numeric="true" autoFocus="false"> |
<Size> |
<AbsDimension x="60" y="20" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLSecondPrizeBackground"> |
<Offset> |
<AbsDimension x="4" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnEditFocusGained> |
self:SetTextColor(1,1,0) |
self:HighlightText() |
</OnEditFocusGained> |
<OnEditFocusLost> |
GuildLottery:SecondPrizeOnEnterPressed(self) |
self:SetTextColor(1,1,1) |
</OnEditFocusLost> |
<OnEnterPressed> |
self:ClearFocus() |
GuildLottery:SecondPrizeOnEnterPressed(self) |
self:SetTextColor(1,1,1) |
</OnEnterPressed> |
<OnEscapePressed> |
GuildLottery:SecondPrizeOnEscapePressed(self) |
</OnEscapePressed> |
</Scripts> |
<FontString inherits="ChatFontNormal" /> |
</EditBox> |
<EditBox name="GLGuildCutEditBox" parent="GLSettingAreaBackground" letters="3" numeric="true" autoFocus="false"> |
<Size> |
<AbsDimension x="60" y="20" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLGuildCutBackground"> |
<Offset> |
<AbsDimension x="4" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnEditFocusGained> |
self:SetTextColor(1,1,0) |
self:HighlightText() |
</OnEditFocusGained> |
<OnEditFocusLost> |
GuildLottery:GuildCut_OnEnterPressed(self) |
self:SetTextColor(1,1,1) |
</OnEditFocusLost> |
<OnEnterPressed> |
GuildLottery:GuildCut_OnEnterPressed(self) |
</OnEnterPressed> |
<OnEscapePressed> |
GuildLottery:GuildCut_OnEscapePressed(self) |
</OnEscapePressed> |
</Scripts> |
<FontString inherits="ChatFontNormal" /> |
</EditBox> |
<Frame name="GLLotteryTicketPriceFrame" inherits="GLMoneyInputFrameTemplate" parent="GLSettingAreaBackground"> |
<Anchors> |
<Anchor relativeFrom="BOTTOMLEFT" point="TOPLEFT" relativeTo="GLLabelTicketPrice"> |
<Offset> |
<AbsDimension x="5" y="-15" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Frame> |
<Frame name="GLRaffleTicketPriceFrame" inherits="GLMoneyInputFrameTemplate" parent="GLRaffleSettingAreaBackground"> |
<Anchors> |
<Anchor relativeFrom="BOTTOMLEFT" point="TOPLEFT" relativeTo="GLLabelRaffleTicketPrice"> |
<Offset> |
<AbsDimension x="5" y="-15" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Frame> |
<EditBox name="GLLotteryDateEditBox" parent="GLSettingAreaBackground" letters="50" autoFocus="false"> |
<Size> |
<AbsDimension x="160" y="20" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLLotteryDateBackground"> |
<Offset> |
<AbsDimension x="4" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnLoad> |
self:EnableMouse(0); |
</OnLoad> |
</Scripts> |
<FontString inherits="ChatFontNormal" /> |
</EditBox> |
<EditBox name="GLRafflePrizeOneEditBox" parent="GLSettingAreaBackground" letters="50" autoFocus="false"> |
<Size> |
<AbsDimension x="160" y="20" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLLotteryDateBackground"> |
<Offset> |
<AbsDimension x="4" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnLoad> |
self:EnableMouse(0); |
</OnLoad> |
</Scripts> |
<FontString inherits="ChatFontNormal" /> |
</EditBox> |
<EditBox name="GLLotteryNameEditBox" parent="GLSettingAreaBackground" letters="25" autoFocus="false"> |
<Size> |
<AbsDimension x="130" y="20" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLLotteryNameBackground"> |
<Offset> |
<AbsDimension x="4" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnEditFocusGained> |
self:SetTextColor(1,1,0) |
self:HighlightText() |
</OnEditFocusGained> |
<OnEditFocusLost> |
GuildLottery:LotteryName_OnEnterPressed(self) |
self:SetTextColor(1,1,1) |
</OnEditFocusLost> |
<OnEnterPressed> |
GuildLottery:LotteryName_OnEnterPressed(self) |
</OnEnterPressed> |
<OnEscapePressed> |
GuildLottery:LotteryName_OnEscapePressed(self) |
</OnEscapePressed> |
</Scripts> |
<FontString inherits="ChatFontNormal" /> |
</EditBox> |
<EditBox name="GLRaffleDateEditBox" parent="GLRaffleSettingAreaBackground" letters="50" autoFocus="false"> |
<Size> |
<AbsDimension x="160" y="20" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLRaffleDateBackground"> |
<Offset> |
<AbsDimension x="4" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnLoad> |
self:EnableMouse(0); |
</OnLoad> |
</Scripts> |
<FontString inherits="ChatFontNormal" /> |
</EditBox> |
<EditBox name="GLRaffleNameEditBox" parent="GLRaffleSettingAreaBackground" letters="25" autoFocus="false"> |
<Size> |
<AbsDimension x="130" y="20" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLRaffleNameBackground"> |
<Offset> |
<AbsDimension x="4" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnEditFocusGained> |
self:SetTextColor(1,1,0); |
self:HighlightText(); |
</OnEditFocusGained> |
<OnEditFocusLost> |
GuildLottery:RaffleName_OnEnterPressed(self); |
self:SetTextColor(1,1,1); |
</OnEditFocusLost> |
<OnEnterPressed> |
GuildLottery:RaffleName_OnEnterPressed(self); |
</OnEnterPressed> |
<OnEscapePressed> |
GuildLottery:RaffleName_OnEscapePressed(self); |
</OnEscapePressed> |
</Scripts> |
<FontString inherits="ChatFontNormal" /> |
</EditBox> |
<Frame name="GLJackPotFrame" inherits="GLMoneyInputFrameTemplate" parent="GLSettingAreaBackground"> |
<Anchors> |
<Anchor relativeFrom="BOTTOMLEFT" point="TOPLEFT" relativeTo="GLLabelJackpot"> |
<Offset> |
<AbsDimension x="5" y="-15" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Frame> |
<Frame name="GLUsersBackground"> |
<Size> |
<AbsDimension x="130" y="170" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="BOTTOMLEFT" point="TOPLEFT" relativeTo="GLLabelUsers"> |
<Offset> |
<AbsDimension x="0" y="-20" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true"> |
<BackgroundInsets> |
<AbsInset left="5" right="5" top="5" bottom="5" /> |
</BackgroundInsets> |
<TileSize> |
<AbsValue val="16" /> |
</TileSize> |
<EdgeSize> |
<AbsValue val="16" /> |
</EdgeSize> |
</Backdrop> |
<Scripts> |
<OnLoad> |
self:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b); |
self:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b); |
</OnLoad> |
</Scripts> |
</Frame> |
<Frame name="GLUsersSliderBackground"> |
<Size> |
<AbsDimension x="28" y="170" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="TOPRIGHT" point="TOPLEFT" relativeTo="GLUsersBackground"> |
<Offset> |
<AbsDimension x="130" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true"> |
<BackgroundInsets> |
<AbsInset left="5" right="5" top="5" bottom="5" /> |
</BackgroundInsets> |
<TileSize> |
<AbsValue val="16" /> |
</TileSize> |
<EdgeSize> |
<AbsValue val="16" /> |
</EdgeSize> |
</Backdrop> |
<Scripts> |
<OnLoad> |
self:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b); |
self:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b); |
</OnLoad> |
</Scripts> |
</Frame> |
<ScrollFrame name="GLUsersScrollFrame" inherits="FauxScrollFrameTemplate"> |
<Size> |
<AbsDimension x="150" y="160" /> |
</Size> |
<Anchors> |
<Anchor point="TOPRIGHT" relativeTo="GLUsersSliderBackground" relativePoint="TOPLEFT"> |
<Offset> |
<AbsDimension x="0" y="-5" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnVerticalScroll> |
FauxScrollFrame_OnVerticalScroll(self, offset, GL_MENUBUTTONSIZEY, GL_UpdateUserButtons); |
</OnVerticalScroll> |
</Scripts> |
</ScrollFrame> |
<Frame name="GLTicketsTextBackground"> |
<Size> |
<AbsDimension x="276" y="170" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="BOTTOMLEFT" point="TOPLEFT" relativeTo="GLLabelTickets"> |
<Offset> |
<AbsDimension x="0" y="-20" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true"> |
<BackgroundInsets> |
<AbsInset left="5" right="5" top="5" bottom="5" /> |
</BackgroundInsets> |
<TileSize> |
<AbsValue val="16" /> |
</TileSize> |
<EdgeSize> |
<AbsValue val="16" /> |
</EdgeSize> |
</Backdrop> |
<Frames> |
<ScrollFrame name="GLTicketsFrameScrollFrame" inherits="UIPanelScrollFrameTemplate"> |
<Size> |
<AbsDimension x="246" y="158" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLTicketsTextBackground"> |
<Offset> |
<AbsDimension x="5" y="-6" /> |
</Offset> |
</Anchor> |
</Anchors> |
<ScrollChild> |
<EditBox name="GLTicketsEditBox" letters="500" multiLine="true" autoFocus="false"> |
<Size> |
<AbsDimension x="240" y="158" /> |
</Size> |
<Scripts> |
<OnTextChanged> |
local scrollBar = getglobal(self:GetParent():GetName().."ScrollBar") |
self:GetParent():UpdateScrollChildRect(); |
local min; |
local max; |
min, max = scrollBar:GetMinMaxValues(); |
if ( max > 0 and (self.max ~= max) ) then |
self.max = max; |
scrollBar:SetValue(max); |
end |
</OnTextChanged> |
</Scripts> |
<FontString inherits="ChatFontNormal" font="Fonts\ARIALN.TTF"> |
<FontHeight> |
<AbsValue val="14" /> |
</FontHeight> |
<Color r="1" g="1" b="1" /> |
<Shadow> |
<Offset> |
<AbsDimension x="1" y="-1" /> |
</Offset> |
<Color r="0" g="0" b="0" /> |
</Shadow> |
</FontString> |
</EditBox> |
</ScrollChild> |
</ScrollFrame> |
</Frames> |
<Scripts> |
<OnLoad> |
self:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b); |
self:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b); |
</OnLoad> |
<OnShow> |
--GL_UpdateGuildInfo(); |
</OnShow> |
</Scripts> |
</Frame> |
<Button name="GLNewLotteryButton" inherits="UIPanelButtonTemplate"> |
<Size> |
<AbsDimension x="120" y="21" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT"> |
<Offset> |
<AbsDimension x="20" y="-40" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnClick> |
GuildLottery:NewLotteryClick(); |
</OnClick> |
</Scripts> |
</Button> |
<Button name="GLStartRollButton" inherits="UIPanelButtonTemplate"> |
<Size> |
<AbsDimension x="120" y="21" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="BOTTOMLEFT" point="TOPLEFT" relativeTo="GLNewLotteryButton"> |
<Offset> |
<AbsDimension x="0" y="-21" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnClick> |
GuildLottery:StartRollClick(); |
</OnClick> |
</Scripts> |
</Button> |
<Button name="GLSpamButton" inherits="UIPanelButtonTemplate"> |
<Size> |
<AbsDimension x="120" y="21" /> |
</Size> |
<Anchors> |
<Anchor relativeFrom="BOTTOMLEFT" point="TOPLEFT" relativeTo="GLStartRollButton"> |
<Offset> |
<AbsDimension x="0" y="-21" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnClick> |
GuildLottery:SpamClick(nil); |
</OnClick> |
</Scripts> |
</Button> |
<Button name="GLUserButton1" inherits="GLUserButtonTemplate" id="1"> |
<Anchors> |
<Anchor relativeFrom="TOPLEFT" point="TOPLEFT" relativeTo="GLUsersBackground"> |
<Offset> |
<AbsDimension x="1" y="-1" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLUserButton2" inherits="GLUserButtonTemplate" id="2"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLUserButton1" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLUserButton3" inherits="GLUserButtonTemplate" id="3"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLUserButton2" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLUserButton4" inherits="GLUserButtonTemplate" id="4"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLUserButton3" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLUserButton5" inherits="GLUserButtonTemplate" id="5"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLUserButton4" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLUserButton6" inherits="GLUserButtonTemplate" id="6"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLUserButton5" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLUserButton7" inherits="GLUserButtonTemplate" id="7"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLUserButton6" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLUserButton8" inherits="GLUserButtonTemplate" id="8"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLUserButton7" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLUserButton9" inherits="GLUserButtonTemplate" id="9"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLUserButton8" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="GLUserButton10" inherits="GLUserButtonTemplate" id="10"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="GLUserButton9" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="0" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
</Button> |
</Frames> |
</Frame> -- non option frame |
<Button name="$parentTab1" inherits="CharacterFrameTabButtonTemplate" id="1" text="Lottery"> |
<Anchors> |
<Anchor point="CENTER" relativePoint="BOTTOMLEFT"> |
<Offset> |
<AbsDimension x="60" y="-12" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnClick> |
GuildLottery:ToggleClick(0) |
</OnClick> |
</Scripts> |
</Button> |
<Button name="$parentTab2" inherits="CharacterFrameTabButtonTemplate" id="2" text="Raffle"> |
<Anchors> |
<Anchor point="LEFT" relativeTo="$parentTab1" relativePoint="RIGHT"> |
<Offset> |
<AbsDimension x="-16" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnClick> |
GuildLottery:ToggleClick(1) |
</OnClick> |
</Scripts> |
</Button> |
<Button name="$parentTab3" inherits="CharacterFrameTabButtonTemplate" id="3" text="Options"> |
<Anchors> |
<Anchor point="LEFT" relativeTo="$parentTab2" relativePoint="RIGHT"> |
<Offset> |
<AbsDimension x="-16" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnClick> |
GuildLottery:ToggleClick(2) |
</OnClick> |
</Scripts> |
</Button> |
</Frames> |
<Scripts> |
<OnLoad> |
GuildLottery:OnGlobalLoad(self); |
self.elapsed = 0; |
PanelTemplates_SetNumTabs(GLControlFrame, 3); |
PanelTemplates_SetTab(GLControlFrame, 1); |
self:RegisterForDrag("LeftButton"); |
</OnLoad> |
<OnMouseUp> |
if ( self.isMoving ) then |
self:StopMovingOrSizing(); |
self.isMoving = false; |
end |
</OnMouseUp> |
<OnMouseDown> |
if ( ( ( not self.isLocked ) or ( self.isLocked == 0 ) ) and ( arg1 == "LeftButton" ) ) then |
self:StartMoving(); |
self.isMoving = true; |
end |
</OnMouseDown> |
<OnHide> |
if ( self.isMoving ) then |
self:StopMovingOrSizing(); |
self.isMoving = false; |
end |
</OnHide> |
<OnDragStart> |
self:StartMoving(); |
</OnDragStart> |
<OnDragStop> |
self:StopMovingOrSizing(); |
</OnDragStop> |
</Scripts> |
</Frame> |
</Ui> |
GL = {} |
GL.Me = "" |
GL.Command = "Lottery" |
GL.Command2 = "Lotterie" |
GL.Command3 = "Raffle" |
GL.WhisperHistory = {} |
GL.WinningTicket=0 |
GL.WinningRaffleTicket1=0 |
GL.WinningRaffleTicket2=0 |
GL.WinningRaffleTicket3=0 |
GL.RaffleItem1='-1' |
GL.RaffleItem2='-1' |
GL.RaffleItem3='-1' |
GL.WinningEvent=-1 |
GL.WinningPercentage=100 |
GL.SendingWhisper=false |
GL.CommandQueue = {} |
GL.SpamQueue = {} |
GL.OnOpenEvent = nil |
GL.OnPendingEvent = nil |
GL.OnOpenEventData = nil |
GL.OnPendingEventData = nil |
GL_Settings = {} |
GL_Settings.MinimapRadiusOffset = 80 |
GL_Settings.MinimapArcOffset = 343 |
GL_Settings.MinimapTexture = "Spell_Nature_RavenForm" |
GL_Settings.MinimapTextureId = 1 |
GL_Settings.ShowMinimap = 1 |
GL_Settings.UseLotteryAnnouncement = 1 |
GL_Settings.UseWinnerAnnouncement = 1 |
GL_Settings.Tooltips = 1 |
GL_Settings.GuaranteedWinner = 0 |
GL_Settings.AllowInvalidItems = 0 |
GL_Settings.Channel = 1 |
GL_Settings.Debuglevel = 0 |
GuildLottery = LibStub("AceAddon-3.0"):NewAddon("Guild Lottery", "AceConsole-3.0", "AceEvent-3.0", "AceTimer-3.0") |
local L = LibStub("AceLocale-3.0"):GetLocale("Glottery") |
GL_GCHAT = "<<Guild Lottery>> " |
GL_Icons = { |
"Spell_Nature_RavenForm","Ability_Hunter_AspectOfTheMonkey","Ability_Mount_JungleTiger","Ability_Mount_WhiteTiger","Ability_Mount_PinkTiger","Spell_Nature_ProtectionformNature","Ability_Hunter_RunningShot","Ability_EyesOfTheOwl","Ability_Whirlwind", |
"Shadow_RagingScream","Spell_Fire_FireArmor","Shadow_SacrificialShield","Shadow_DemonBreath","Shadow_EvilEye","Shadow_Twilight","Shadow_DetectLesserInvisibility","Shadow_PsychicScream","Shadow_AntiShadow","Shadow_ShadowPact","Shadow_DetectInvisibility","Shadow_GatherShadows", |
"Shadow_DetectInvisibility","Shadow_Shadowform","Shadow_AntiShadow","Shadow_DeadofNight","Spell_Holy_WordFortitude","Spell_Holy_PrayerOfFortitude","Spell_Holy_PowerWordShield","Spell_Holy_Renew","Shadow_ShadowWordDominate","Spell_Holy_InnerFire","Spell_Frost_WindWalkOn","Shadow_Requiem","Spell_Magic_LesserInvisibility", |
"Shadow_Raisedead","Shadow_UnsummonBuilding","Spell_Magic_LesserInvisibilty","Spell_Holy_PowerInfusion","Spell_Holy_GreaterHeal","Spell_Lightning_LightningBolt01","Spell_Holy_Excorcism","Spell_Holy_Restoration","Spell_Holy_HolyProtection","Spell_Holy_Heal","Spell_Holy_BlessingOfAgility","Spell_Holy_ArcaneIntellect", |
"Spell_Holy_MagicalSentry","Spell_Frost_FrostArmor02","Shadow_DetectLesserInvisibility","Spell_Fire_FireArmor","Spell_Frost_Frost","Spell_Ice_Lament","Spell_Frost_FrostWard","Spell_MageArmor","Shadow_ManaBurn","Spell_Nature_EnchantArmor","Spell_Fire_SealOfFire","Spell_Arcane_TeleportOrgrimmar", |
"Shadow_RagingScream","Shadow_SoulGem","Spell_Nature_AbolishMagic","Spell_Holy_FlashHeal","Spell_Nature_Regeneration","Spell_Nature_Rejuvenation","Spell_Nature_NaturesBlessing","Spell_Nature_Thorns","Spell_Nature_Ravenform","Spell_Nature_SpiritWolf","Spell_Nature_StoneSkinTotem","Spell_Nature_Swiftness", |
"Spell_Nature_P","Spell_Nature_ResistNature","Spell_Nature_LightningShield","Racial_Troll_Berserk","Spell_Nature_LightningShield","Spell_Magic_MageArmor","Spell_MiscFood","Ability_Mount_BlackDireWolf","Ability_Mount_WhiteDireWolf","Ability_Mount_Kodo_01","Ability_Mount_Kodo_03","Ability_Mount_Raptor", |
"Ability_Mount_Undeadhorse","Ability_Mount_Dreadsteed","Ability_Rogue_Sprint","Ability_Druid_CatForm","Ability_Ambush","Ability_Mount_JungleTiger","Ability_Druid_Dash","Ability_Warrior_DefensiveStance","Ability_TrueShot","Spell_INV_Jewelry_Talisman_07","Spell_INV_Potion_44","Spell_INV_Potion_58", |
"Spell_INV_Potion_65","Spell_INV_Potion_92","Spell_INV_Potion_93","Spell_INV_Drink_07","Spell_INV_Drink_18","Spell_INV_Misc_Fork&Knive","Spell_Nature_TimeStop","Spell_Holy_DivineIntervention","Ability_Warrior_InnerRage","Spell_Holy_HealingAura","Spell_Holy_RighteousnessAura","Spell_Holy_HolySmite","Ability_ThunderBolt", |
"Spell_Holy_SealOfWrath","Spell_Holy_FistOfJustice","Spell_Holy_SealOfWisdom","Spell_Holy_SealOfSalvation","Spell_Holy_PrayerOfHealing02","Spell_Holy_SealOfValor","Spell_Holy_SealOfProtection","Spell_Holy_GreaterBlessingofKings","Spell_Holy_GreaterBlessingofWisdom","Spell_Holy_GreaterBlessingofSalvation", |
"Spell_Holy_GreaterBlessingofLight","Ability_Warrior_BattleShout","Shadow_Teleport","Ability_Hunter_BeastTraining","Ability_Hunter_MendPet","Ability_Druid_Dash","Ability_Druid_SupriseAttack","Shadow_ImpPhaseShift","Shadow_LifeDrain","Shadow_AntiShadow", |
"Spell_Magic_LesserInvisibility","Shadow_GatherShadows","Spell_Holy_DevotionAura","Spell_Holy_AuraOfLight","Spell_Holy_MindSooth","Shadow_SealOfKings","Spell_Holy_MindVision","Spell_Frost_WizardMark","Spell_Fire_SealOfFire","Shadow_BloodBoil","Shadow_AuraOfDarkness","Spell_Frost_Stun", |
"Ability_Hunter_SniperShot","Ability_Rogue_Trip","Ability_Hunter_Quickshot","Ability_Hunter_CriticalShot","Ability_Hunter_AimedShot","Ability_GolemStormBolt","Ability_GolemStormBolt","Spell_Frost_ChainsOfIce","Spell_Frost_FreezingBreath","Spell_Fire_FlameShock","Spell_Fire_SelfDestruct","Spell_Holy_Dizzy","Spell_Nature_Polymorph", |
"Spell_Frost_FrostBolt02","Spell_Frost_FrostNova","Spell_Frost_FrostArmor","Spell_Fire_SoulBurn","Shadow_AbominationExplosion","Spell_Fire_Immolation","Shadow_Requiem","Shadow_LifeDrain02","Shadow_Haunting","Shadow_SiphonMana","Shadow_CurseOfSargeras","Shadow_CurseOfMannoroth","Shadow_CurseOfAchimonde", |
"Shadow_ChillTouch","Shadow_AuraOfDarkness","Shadow_CurseOfTounges","Shadow_UnholyStrength","Shadow_GrimWard","Shadow_ShadowBolt","Shadow_Possession","Shadow_EnslaveDemon","Shadow_MindSteal *","Shadow_LifeDrain","Shadow_MindRot","Shadow_DeathScream","Shadow_DeathCoil","Ability_Gouge","Spell_Nature_ThunderClap","Shadow_DeathScream", |
"Ability_ShockWave","Spell_Frost_Stun","Spell_Frost_Stun","Spell_Frost_Stun","Ability_Warrior_WarCry","Ability_GolemThunderClap","Ability_Warrior_Sunder","Spell_Holy_AshesToAshes","Shadow_PsychicScream","Spell_Nature_Slow","Ability_Druid_Disembowel","Spell_Nature_StarFall","Spell_Nature_FaerieFire","Spell_Nature_Sleep","Spell_Nature_InsectSwarm", |
"Ability_Gouge","Ability_Rogue_Garrote","Shadow_MindSteal *","Ability_Rogue_Rupture","Ability_CheapShot","Ability_Sap","Ability_Warrior_Riposte","Shadow_LifeDrain","Ability_Rogue_KidneyShot","Spell_Frost_FrostShock","Shadow_DeathScream","Shadow_ShadowWordPain","Shadow_BlackPlague","Shadow_AbonimationExplosion","Shadow_CurseOfSargeras", |
"Fire_FlameBolt","Fire_Fireball02","Frost_Stun","Frost_ChainsOfIce","Nature_StrangleVines","Nature_Starfall","Spell_Holy_SearingLight","Ability_BackStab","Ability_ShockWave","Ability_Vanish","Ability_Warrior_SavageBlow","Misc_Bandage_08" |
} |
-- MenuItem related |
GL_MENUBUTTONSIZEY = 16 |
g_MenuItemSelected = 0 |
-- |
-- Raffle Constants |
GL_LOTTERY = 0 |
GL_RAFFLE = 1 |
-- |
-- Channel Constants |
GL_CHANNEL_GUILD = 1 |
GL_CHANNEL_RAID = 2 |
-- |
local GL_ANSWER_YES = L["UI_YES"] |
local GL_ANSWER_NO = L["UI_NO"] |
local Orig_ChatFrame_OnEvent=nil |
local Orig_ChatEdit_InsertLink=nil |
GL_VERSION_TEXT = GetAddOnMetadata("Glottery", "Version") |
local RED = "|cffff0000" |
local GREEN = "|cff00ff00" |
local BLUE = "|cff0000ff" |
local MAGENTA = "|cffff00ff" |
local YELLOW = "|cffffff00" |
local CYAN = "|cff00ffff" |
local WHITE = "|cffffffff" |
function GuildLottery:Color( color, text ) |
if color==nil then color=WHITE; end |
local coloredtext=color..text.."|r" |
return coloredtext |
end |
function GuildLottery:SlashHandler(msg) |
local argv = {} |
for arg in string.gmatch(string.lower(msg), '[%a%d%-%.]+') do |
table.insert(argv, arg) |
end |
if argv[1] == "toggle" then |
GuildLottery:Toggle(0) |
elseif argv[1] == "spam" then |
if argv[2] == "raffle" then |
GuildLottery:SpamClick(GL_RAFFLE) |
elseif argv[2] == "lottery" then |
GuildLottery:SpamClick(GL_LOTTERY) |
else |
GuildLottery:Error(L["ERR_UNKNOWNCMD"]) |
end |
-- elseif argv[1] == "sell" then |
elseif argv[1] == "roll" then |
GuildLottery:StartRollClick() |
else |
if argv[1]==nil then |
GuildLottery:Help() |
else |
GuildLottery:Error(L["ERR_UNKNOWNCMD"]) |
end |
end |
end |
function GuildLottery:Error( txt ) |
GuildLottery:Print(GuildLottery:Color(RED,txt)) |
end |
function GuildLottery:OnInitialize() |
-- Code that you want to run when the addon is first loaded goes here. |
GuildLottery:RegisterChatCommand("glottery", "SlashHandler") |
GuildLottery:RegisterChatCommand("glot", "SlashHandler") |
GLTooltipCheckBox:SetChecked(GL_Settings.Tooltips) |
GLInvalidItemsCheckBox:SetChecked(GL_Settings.AllowInvalidItems) |
GLCheckBoxLotteryAnnouncement:SetChecked(GL_Settings.UseLotteryAnnouncement) |
GLCheckBoxWinnerAnnouncement:SetChecked(GL_Settings.UseWinnerAnnouncement) |
GLTitleText:SetText(L["UI_TITLE_LOTTERY"]) |
GuildLottery:MinimapButton_Update() |
GL_DataInitialize() |
if GL_Settings.Debuglevel == nil then |
GL_Settings.Debuglevel=0 |
end |
GuildLottery:InitUIText() |
GuildLottery:UpdateScreen() |
GuildLottery:UpdateUserButtons() |
MoneyInputFrame_SetOnValueChangedFunc(GLStartGoldFrame,function() GuildLottery:OnMoneyChanged(GLStartGoldFrame) end) |
MoneyInputFrame_SetOnValueChangedFunc(GLLotteryTicketPriceFrame, function() GuildLottery:OnMoneyChanged(GLLotteryTicketPriceFrame) end) |
MoneyInputFrame_SetOnValueChangedFunc(GLRaffleTicketPriceFrame, function() GuildLottery:OnMoneyChanged(GLRaffleTicketPriceFrame) end) |
GLJackPotFrameGold:SetTextColor(0.5,0.5,0.5) |
GLJackPotFrameSilver:SetTextColor(0.5,0.5,0.5) |
GLJackPotFrameGold:EnableMouse(0) |
GLJackPotFrameSilver:EnableMouse(0) |
GuildLottery:Print("Initialized") |
end |
function GuildLottery:Help() |
GL_printf(GuildLottery:Color(GREEN,L["UI_TITLE_LOTTERY"].." "..L["HLP"])) |
GL_printf(GuildLottery:Color(GREEN,"----------------------------------")) |
GL_printf("/glot "..GuildLottery:Color(YELLOW,"toggle").." - "..L["HLP_TOGGLE"]) |
GL_printf("/glot "..GuildLottery:Color(YELLOW,"spam [lottery | raffle]").." - "..L["HLP_SPAM"]) |
GL_printf("/glot "..GuildLottery:Color(YELLOW,"roll [lottery | raffle]").." - "..L["HLP_ROLL"]) |
end |
--[[ |
local GL_EventDelta=0 |
function GuildLottery:OnGlobalUpdate(delta) |
if #GL.CommandQueue > 0 then |
GL_RunCommand() |
end |
end |
--]] |
function GuildLottery:string( string ) |
if string==nil then |
string="nil" |
end |
return string |
end |
-- |
-- Event Handlers |
-- |
function GuildLottery:CHAT_EVENT_HANDLER(eventName, arg1, arg2) |
GL_debug("GLottery: event "..eventName) |
local text=strupper(arg1) |
if string.find(text,"^"..GL.Command.."$") or string.find(text,"^"..GL.Command2.."$")then |
GuildLottery:SendInfo(arg2, 0) |
end |
if string.find(text,"^"..GL.Command3.."$") then |
GuildLottery:SendInfo(arg2, 1) |
end |
if string.find(text,"^"..GL.Command.." %d+$") then |
local ticketno=string.gsub(text,"^"..GL.Command.." (%d+)$","%1") |
GuildLottery:SendTicketOwnerOf(arg2,ticketno) |
end |
if string.find(text,"^"..GL.Command2.." %d+$") then |
local ticketno=string.gsub(text,"^"..GL.Command2.." (%d+)$","%1") |
GuildLottery:SendTicketOwnerOf(arg2,ticketno) |
end |
if string.find(text,"^"..GL.Command.." HELP$") then |
GuildLottery:SendHelp(arg2) |
end |
if string.find(text,"^"..GL.Command2.." HELP$") then |
GuildLottery:SendHelp(arg2) |
end |
end |
function GuildLottery:CALENDAR_OPEN_EVENT() |
if (GL.OnOpenEvent~=nil) then |
local func = GL.OnOpenEvent |
GL.OnOpenEvent = nil |
func() |
end |
end |
function GuildLottery:CALENDAR_ACTION_PENDING() |
if (GL.OnPendingEvent~=nil) then |
if GL.PendingEventToSkip~= nil then |
if (GL.PendingEventToSkip==0) then |
local func = GL.OnPendingEvent |
GL.OnPendingEvent=nil |
func() |
else |
GL.PendingEventToSkip=GL.PendingEventToSkip-1 |
end |
else |
local func = GL.OnPendingEvent |
GL.OnPendingEvent=nil |
func() |
end |
end |
end |
function GuildLottery:GUILD_ROSTER_UPDATE() |
-- check if ppl came online who need to be notified still |
GuildLottery:CheckNotifications() |
end |
Orig_ChatEdit_InsertLink = ChatEdit_InsertLink |
function ChatEdit_InsertLink(text) |
if text and GLRaffleItemOneEditBox:HasFocus() then |
GLRaffleItemOneEditBox:SetText(text) |
GLRaffleItemOneEditBox:SetCursorPosition(0) |
return true |
elseif text and GLRaffleItemTwoEditBox:HasFocus() then |
GLRaffleItemTwoEditBox:SetText(text) |
GLRaffleItemTwoEditBox:SetCursorPosition(0) |
return true |
elseif text and GLRaffleItemThreeEditBox:HasFocus() then |
GLRaffleItemThreeEditBox:SetText(text) |
GLRaffleItemThreeEditBox:SetCursorPosition(0) |
return true |
else |
Orig_ChatEdit_InsertLink(text) |
end |
end |
Orig_ChatFrame_OnEvent = ChatFrame_OnEvent |
function GL_ChatFrame_OnEvent(self, event, ...) |
local arg1, arg2 = ... |
if event=="CHAT_MSG_WHISPER_INFORM" then |
if GuildLottery:IsGLWhisper(arg1,arg2) then |
return |
end |
end |
if event=="CHAT_MSG_WHISPER" then |
local whisp=string.upper(arg1) |
if string.find(whisp,"^"..GL.Command.." %w+$") or string.find(whisp,"^"..GL.Command.."$") then |
return |
end |
if string.find(whisp,"^"..GL.Command2.." %w+$") or string.find(whisp,"^"..GL.Command2.."$") then |
return |
end |
end |
if event=="CHAT_MSG_SYSTEM" then |
local errmsg=string.gsub(ERR_CHAT_PLAYER_NOT_FOUND_S,"%%s","(%%w+)") |
if string.match(arg1,errmsg) then |
local player = string.gsub(arg1,errmsg,"%1") |
if GuildLottery:DataGetUserIdx(player, GL_LOTTERY)>0 then -- player has lottery tickets, so this message was for us |
GuildLottery:DataSetNotified( GuildLottery:DataGetUserIdx(player, 0), 0, 0 ) -- remember that we could not send message |
return |
end |
if GuildLottery:DataGetUserIdx(player, GL_RAFFLE)>0 then -- player has raffle tickets, so this message was for us |
GuildLottery:DataSetNotified( GuildLottery:DataGetUserIdx(player, 1), 0, 1 ) -- remember that we could not send message |
return |
end |
end |
end |
Orig_ChatFrame_OnEvent(self, event, ...) |
end |
ChatFrame_OnEvent = GL_ChatFrame_OnEvent |
function GuildLottery:OptionsOnShow() |
GLRadiusSliderButtonPos:SetValue(GL_Settings.MinimapRadiusOffset) |
GLArcSliderButtonPos:SetValue(GL_Settings.MinimapArcOffset) |
GLIconSliderButtonPos:SetValue(GL_Settings.MinimapTextureId) |
GL_ChannelDropDownMenu_OnLoad() |
end |
function GuildLottery:IsGLWhisper( text, to ) |
if #GL.WhisperHistory > 0 then |
for n=#GL.WhisperHistory, 1, -1 do |
hist = GL.WhisperHistory[n] |
if (GetTime() - hist.time > 10) then |
table.remove(GL.WhisperHistory,n) |
end |
end |
end |
if #GL.WhisperHistory > 0 then |
for n=1, #GL.WhisperHistory, 1 do |
hist = GL.WhisperHistory[n] |
if hist.to==to and hist.text==text then |
return true |
end |
end |
end |
end |
function GuildLottery:InitUIText() |
if GL_Data.Raffle==GL_RAFFLE then |
PanelTemplates_SetTab(GLControlFrame, 2) |
GLSettingAreaBackground:Hide() |
GLRaffleSettingAreaBackground:Show() |
GLNewLotteryButton:SetText(L["UI_NEWRAFFLE"]) |
else |
PanelTemplates_SetTab(GLControlFrame, 1) |
GLSettingAreaBackground:Show() |
GLRaffleSettingAreaBackground:Hide() |
GLNewLotteryButton:SetText(L["UI_NEWLOTTERY"]) |
end |
GLNewUserFramePlayerName:SetText(L["UI_TYPEPLAYERNAME"]) |
GLNewUserFrameNumTickets:SetText(L["UI_NUMTICKETS"]) |
GLNewUserCancelButton:SetText(L["UI_CANCEL"]) |
GLNewUserOKButton:SetText(L["UI_ACCEPT"]) |
GLQuestionNoButton:SetText(L["UI_NO"]) |
GLQuestionYesButton:SetText(L["UI_YES"]) |
GLTooltipText:SetText(L["UI_OPTION_TOOLTIP"]) |
GLMinimapLabel:SetText(L["UI_OPTION_MINIMAP"]) |
GLInvalidItemsLabel:SetText(L["UI_OPTION_INVALIDITEMS"]) |
GLCheckBoxLotteryLabel:SetText(L["UI_OPTION_LOTEVT"]) |
GLCheckBoxWinnerAnnouncementLabel:SetText(L["UI_OPTION_WINEVT"]) |
GLChannelDropDownLabel:SetText(L["UI_OPTION_CHANNEL"]) |
GLLabelUsers:SetText(L["UI_PLAYERS"]) |
GLLabelTickets:SetText(L["UI_TICKETS"]) |
GLLabelTicketOptions:SetText(L["UI_INFO_OPTIONS"]) |
GLLabelRaffleDate:SetText(L["UI_RAFFLEDATE"]) |
GLLabelRaffleName:SetText(L["UI_RAFFLENAME"]) |
GLLabelMaxRaffleTickets:SetText(L["UI_MAXTICKETS"]) |
GLLabelRaffleItemOneTickets:SetText(L["UI_RAFFLEITEMONE"]) |
GLLabelRaffleItemTwoTickets:SetText(L["UI_RAFFLEITEMTWO"]) |
GLLabelRaffleItemThreeTickets:SetText(L["UI_RAFFLEITEMTHREE"]) |
GLLabelRaffleTicketPrice:SetText(L["UI_TICKETPRICE"]) |
GLLabelLotteryDate:SetText(L["UI_LOTTERYDATE"]) |
GLLabelLotteryName:SetText(L["UI_LOTTERYNAME"]) |
GLLabelStartGold:SetText(L["UI_STARTGOLD"]) |
GLLabelMaxTickets:SetText(L["UI_MAXTICKETS"]) |
GLLabelSecondPrize:SetText(L["UI_SECONDPRIZE"]) |
GLLabelJackpot:SetText(L["UI_JACKPOT"]) |
GLLabelTicketPrice:SetText(L["UI_TICKETPRICE"]) |
GLLabelGuildCut:SetText(L["UI_GUILDCUT"]) |
GLRaffleItemOneButton:SetText(L["UI_OKAY"]) |
GLRaffleItemTwoButton:SetText(L["UI_OKAY"]) |
GLRaffleItemThreeButton:SetText(L["UI_OKAY"]) |
GLStartRollButton:SetText(L["UI_STARTROLLING"]) |
if GL_Settings.Channel == GL_CHANNEL_GUILD then |
GLSpamButton:SetText(L["UI_SPAMGUILD"]) |
else |
GLSpamButton:SetText(L["UI_SPAMRAID"]) |
end |
GLControlVersion:SetText(GL_VERSION_TEXT) |
end |
function GuildLottery:OnMoneyChanged(obj) |
local somethingchanged=false |
value = MoneyInputFrame_GetCopper(GLStartGoldFrame) |
if value ~= GL_Data.StartGold then |
GL_Data.StartGold = value |
somethingchanged=true |
end |
value = MoneyInputFrame_GetCopper(GLLotteryTicketPriceFrame) |
if value ~= GL_Data.LotteryTicketPrice then |
GL_Data.LotteryTicketPrice = value |
somethingchanged=true |
end |
value = MoneyInputFrame_GetCopper(GLRaffleTicketPriceFrame) |
if value ~= GL_Data.RaffleTicketPrice then |
GL_Data.RaffleTicketPrice = value |
somethingchanged=true |
end |
if somethingchanged then |
GuildLottery:UpdateScreen() |
end |
end |
function GuildLottery:OnGlobalLoad(self) |
GL.Me = UnitName("player") |
GL.Command = strupper(GL.Command) |
GL.Command2 = strupper(GL.Command2) |
GL.Command3 = strupper(GL.Command3) |
GuildLottery:RegisterEvent("CHAT_MSG_GUILD", "CHAT_EVENT_HANDLER") |
GuildLottery:RegisterEvent("CHAT_MSG_WHISPER", "CHAT_EVENT_HANDLER") |
GuildLottery:RegisterEvent("CALENDAR_OPEN_EVENT") |
GuildLottery:RegisterEvent("CALENDAR_ACTION_PENDING") |
GuildLottery:RegisterEvent("GUILD_ROSTER_UPDATE") |
GuildLottery:Print(GL_VERSION_TEXT.." loaded") |
-- minimap button |
--GuildLottery:MinimapButton_Update() |
if ButtonHole then |
ButtonHole.application.RegisterMod({id="GLOTTERY", name="Guild Lottery",tooltip="Guild Lottery", buttonFrame="GLMinimapButton", updateFunction="GuildLottery:MinimapButton_Update"}) |
end |
-- end minimap |
tinsert(UISpecialFrames, "GLControlFrame") |
end |
function GuildLottery:Toggle(page) |
GuildLottery:MinimapButton_Update() |
GuildLottery:UpdateScreen() |
GuildLottery:UpdateUserButtons() |
if (GLControlFrame:IsVisible()) then |
GLControlFrame:Hide() |
else |
GLRaffleItemOneButton:Hide() |
GLRaffleItemTwoButton:Hide() |
GLRaffleItemThreeButton:Hide() |
GLControlFrame:Show() |
end |
end |
function GuildLottery:User_OnLoad(self) |
self:RegisterForClicks("LeftButtonDown", "RightButtonDown") |
end |
function GuildLottery:User_OnClick(self, button) |
local id = self:GetID() |
local offset = FauxScrollFrame_GetOffset(GLUsersScrollFrame) |
local idx = id+offset |
HideDropDownMenu(1) |
GLTicketsEditBox:ClearFocus() |
g_MenuItemSelected = idx |
if button=="RightButton" then |
ToggleDropDownMenu(1,nil,GLUserCmdList,"cursor") |
end |
GuildLottery:UpdateScreen() |
GuildLottery:UpdateUserButtons() |
end |
function GL_UserCmdList_OnLoad() |
HideDropDownMenu(1) |
GLUserCmdList.initialize = GL_UserCmdList_Initialize |
GLUserCmdList.displayMode = "MENU" |
GLUserCmdList.name = "Titre" |
end |
function GL_UserCmdList_Initialize() |
local IsUser=false |
if GuildLottery:DataValid(g_MenuItemSelected, GL_Data.Raffle) then |
IsUser=true |
end |
info = { } |
info.text = L["UI_LOTTERYCOMMANDS"] |
info.isTitle = true |
info.notCheckable = 1 |
UIDropDownMenu_AddButton(info,1) |
if (IsUser) then |
info = { } |
info.text = L["UI_ADDTICKETS"] |
info.notCheckable = 1 |
info.value = selectAdminItem |
info.func = GL_UserCmdList_AddTickets_OnClick |
UIDropDownMenu_AddButton(info,1) |
end |
info = { } |
info.text = L["UI_ADDPLAYER"] |
info.notCheckable = 1 |
info.value = selectAdminItem |
info.func = GL_UserCmdList_AddUser_OnClick |
UIDropDownMenu_AddButton(info,1) |
info = { } |
info.text = L["UI_CANCEL"] |
info.notCheckable = 1 |
info.func = GL_UserCmdList_Cancel_OnClick |
UIDropDownMenu_AddButton(info,1) |
end |
function GL_UserCmdList_AddTickets_OnClick() |
GLNewUserTicketsEditBox:SetText("1") |
GLNewUserNameEditBox:SetText(GuildLottery:DataGetUser(g_MenuItemSelected, GL_Data.Raffle)) |
GLNewUserFrame:Show() |
GLNewUserTicketsEditBox:SetFocus() |
GLNewUserTicketsEditBox:HighlightText() |
end |
function GL_UserCmdList_AddUser_OnClick() |
GLNewUserTicketsEditBox:SetText("1") |
GLNewUserNameEditBox:SetText("") |
GLNewUserFrame:Show() |
GLNewUserNameEditBox:SetFocus() |
end |
function GL_UserCmdList_Cancel_OnClick() |
HideDropDownMenu(1) |
end |
function GuildLottery:FormatPrice ( price ) |
if price==nil then price =0 end |
local c= price % 100 |
local s= (math.floor(price/100)) % 100 |
local g= math.floor(price/10000) |
local text=g..L["UI_GOLD"] |
if s>0 then text=text.." "..s..L["UI_SILVER"]; end |
if c>0 then text=text.." "..c..L["UI_COPPER"]; end |
return text |
end |
function GuildLottery:FormatTicket( tickets ) |
if tickets==nil then |
return |
end |
local i,count |
local text="" |
count=0 |
for i=1, table.getn(tickets), 1 do |
text=text..tickets[i] |
count=count+1 |
if count==5 then |
text=text.."\n" |
count=0 |
else |
text=text.." " |
end |
end |
return text |
end |
function GuildLottery:FormatDate( datestamp ) |
local text=date(GL_DATE_FORMAT,datestamp) |
return text |
end |
function GuildLottery:ExtractDate( datestamp ) |
local year, month, day, hour, minute = tonumber(date("%Y",datestamp)),tonumber(date("%m",datestamp)),tonumber(date("%d",datestamp)),tonumber(date("%H",datestamp)),tonumber(date("%M",datestamp)) |
return year, month, day, hour, minute |
end |
function GuildLottery:CalculateJackpot() |
return GL_Data.StartGold+GuildLottery:DataGetTotalTicketCount(0)*GL_Data.LotteryTicketPrice |
end |
function GuildLottery:UpdateScreen() |
local IsUser=false |
local idx=g_MenuItemSelected |
if (GuildLottery:DataValid(idx, GL_Data.Raffle)) then |
IsUser=true |
end |
if (GL_Data.LotteryDate and GL_Data.LotteryDate~=0) then |
GLLotteryDateEditBox:SetText(GuildLottery:FormatDate(GL_Data.LotteryDate)) |
end |
-- Raffle |
if (GL_Data.RaffleDate and GL_Data.RaffleDate~=0) then |
GLRaffleDateEditBox:SetText(GuildLottery:FormatDate(GL_Data.RaffleDate)) |
end |
if (GL_Data.RaffleDate and GL_Data.RaffleDate~=0) then |
GLRaffleDateEditBox:SetText(GuildLottery:FormatDate(GL_Data.RaffleDate)) |
end |
-- Raffle End |
GLLotteryDateEditBox:SetTextColor(0.5,0.5,0.5) |
GLLotteryNameEditBox:SetText(GL_Data.LotteryName) |
GLRaffleNameEditBox:SetText(GL_Data.RaffleName) |
MoneyInputFrame_ResetMoney(GLJackPotFrame) |
MoneyInputFrame_SetCopper(GLJackPotFrame,GuildLottery:CalculateJackpot()) |
MoneyInputFrame_ResetMoney(GLStartGoldFrame) |
MoneyInputFrame_SetCopper(GLStartGoldFrame,GL_Data.StartGold) |
GLMaxTicketsEditBox:SetText(GL_Data.MaxLotteryTickets) |
GLMaxRaffleTicketsEditBox:SetText(GL_Data.MaxRaffleTickets) |
GLSecondPrizeEditBox:SetText(GL_Data.SecondPrize) |
GLGuildCutEditBox:SetText(GL_Data.GuildCut) |
MoneyInputFrame_ResetMoney(GLLotteryTicketPriceFrame) |
MoneyInputFrame_SetCopper(GLLotteryTicketPriceFrame, GL_Data.LotteryTicketPrice) |
MoneyInputFrame_SetCopper(GLRaffleTicketPriceFrame, GL_Data.RaffleTicketPrice) |
GLTicketsEditBox:SetTextColor(1,1,1) |
GLTicketsEditBox:EnableMouse(0) |
if (GL_Data.RaffleItemOne~='0') then |
local itemName, itemLink = GetItemInfo(GL_Data.RaffleItemOne) |
if (itemLink) then |
GLRaffleItemOneEditBox:SetText(itemLink) |
GLRaffleItemOneEditBox:SetCursorPosition(0) |
end |
GLRaffleItemOneButton:Hide() |
end |
if (GL_Data.RaffleItemTwo~='0') then |
local itemName, itemLink = GetItemInfo(GL_Data.RaffleItemTwo) |
if (itemLink) then |
GLRaffleItemTwoEditBox:SetText(itemLink) |
GLRaffleItemTwoEditBox:SetCursorPosition(0) |
end |
GLRaffleItemTwoButton:Hide() |
end |
if (GL_Data.RaffleItemThree~='0') then |
local itemName, itemLink = GetItemInfo(GL_Data.RaffleItemThree) |
if (itemLink) then |
GLRaffleItemThreeEditBox:SetText(itemLink) |
GLRaffleItemThreeEditBox:SetCursorPosition(0) |
end |
GLRaffleItemThreeButton:Hide() |
end |
if (GuildLottery:DataGetTotalTicketCount(GL_Data.Raffle)>0) then |
GLStartRollButton:Enable() |
else |
GLStartRollButton:Disable() |
end |
if ( IsUser ) then |
local TicketText=GuildLottery:FormatTicket(GuildLottery:DataGetTickets(idx, GL_Data.Raffle)) |
GLTicketsEditBox:SetText(TicketText) |
else |
GLTicketsEditBox:SetText("") |
end |
end |
function GL_UpdateUserButtons() |
GuildLottery:UpdateUserButtons() |
end |
function GuildLottery:UpdateUserButtons() |
GL_debug("GuildLottery:UpdateUserButtons") |
local size=GuildLottery:DataCount(GL_Data.Raffle) |
FauxScrollFrame_Update(GLUsersScrollFrame, size, 10, GL_MENUBUTTONSIZEY) |
local offset=FauxScrollFrame_GetOffset(GLUsersScrollFrame) |
local i = 1 |
local button, normaltext, highlight |
for i=1, 10, 1 do |
button = getglobal("GLUserButton"..i) |
buttonText = getglobal("GLUserButton"..i.."Tag") |
idx = i+offset |
if (GuildLottery:DataValid(idx, GL_Data.Raffle)) then |
buttonText:SetText(GuildLottery:DataGetUser(idx, GL_Data.Raffle).." ("..GuildLottery:DataGetTicketCount(idx, GL_Data.Raffle)..")") |
if (GuildLottery:DataGetNotified(idx, GL_Data.Raffle)==0) then |
button.r = 0.9 |
button.g = 0.4 |
button.b = 0.1 |
else |
button.r = 0.3 |
button.g = 0.5 |
button.b = 0.9 |
end |
if ( g_MenuItemSelected and g_MenuItemSelected == idx ) then |
button.r=button.r+0.3 |
button.g=button.g+0.3 |
button.b=button.b+0.3 |
end |
buttonText:SetTextColor(button.r, button.g, button.b) |
button:Show() |
else |
button:Show() |
buttonText:SetText("") |
end |
end |
GuildLottery:RaffleItemOne_OnEscapePressed(GLRaffleItemOneEditBox) |
GuildLottery:RaffleItemTwo_OnEscapePressed(GLRaffleItemTwoEditBox) |
GuildLottery:RaffleItemThree_OnEscapePressed(GLRaffleItemThreeEditBox) |
end |
--||||||||||||||||||||||||||||------ Minimap button ------||||||||||||||||||||||||||||-- |
function GuildLottery:MinimapButton_Update() |
if(GL_Settings.ShowMinimap==1) then |
GLMinimapCheckBox:SetChecked(1) |
local radius = GL_Settings.MinimapRadiusOffset |
local arc = GL_Settings.MinimapArcOffset |
GLMinimapButton:Show() |
GLMinimapButtonText:SetText("") |
GLMinimapButtonText:SetTextColor(1.0,0.1,0.1) |
GLMinimapButton:SetPoint( "TOPLEFT", "Minimap", "TOPLEFT",55 - ( ( radius ) * cos( arc ) ),( ( radius ) * sin( arc ) ) - 55) |
GL_Settings.MinimapTexture = GL_Icons[GL_Settings.MinimapTextureId] |
if (GL_Settings.MinimapTexture==nil) then |
GL_Settings.MinimapTexture=GL_Icons[1] |
end |
GLMinimapButtonTexture:SetTexture("Interface\\Icons\\"..GL_Settings.MinimapTexture) |
GLMinimapButtonTexture:SetAlpha(1.0) |
else |
GLMinimapCheckBox:SetChecked(0) |
GLMinimapButton:Hide() |
end |
end |
function GuildLottery:QuestionYes_Click() |
if GL_Question_Callback~=nil then |
GL_Question_Callback(GL_ANSWER_YES) |
end |
GL_Question_Callback=nil |
GLQuestionFrame:Hide() |
end |
function GuildLottery:QuestionNo_Click() |
if GL_Question_Callback~=nil then |
GL_Question_Callback(GL_ANSWER_NO) |
end |
GL_Question_Callback=nil |
GLQuestionFrame:Hide() |
end |
function GuildLottery:AskQuestion(text,callback) |
GL_ANSWER_NO = L["UI_NO"] |
GL_ANSWER_YES = L["UI_YES"] |
GL_Question_Callback=callback |
GLQuestionEditBox:SetText(text) |
GLQuestionFrame:Show() |
end |
function GuildLottery:BuyTickets( amount ) |
local i,ticket |
local newTickets={} |
if GL_Data.Raffle==GL_RAFFLE then |
if GL_Data.NextRaffleTicket==0 then |
GL_Data.NextRaffleTicket=GL_Data.RaffleTicketSerie |
end |
for i=1, amount, 1 do |
ticket=GL_Data.NextRaffleTicket |
table.insert(newTickets,ticket) |
GL_Data.NextRaffleTicket=ticket+1 |
end |
else |
if GL_Data.NextLotteryTicket==0 then |
GL_Data.NextLotteryTicket=GL_Data.LotteryTicketSerie |
end |
for i=1, amount, 1 do |
ticket=GL_Data.NextLotteryTicket |
table.insert(newTickets,ticket) |
if (GL_Data.GuaranteedWinner == 1) then |
GL_Data.NextLotteryTicket=ticket+1 |
else |
GL_Data.NextLotteryTicket=ticket+2 |
end |
end |
end |
return newTickets |
end |
--||||||||||||||||||||||||||||------ NewUserFrame Button Clicks -----||||||||||||||||||||||||||||-- |
function GuildLottery:NewUserCancel_Click() |
GLNewUserFrame:Hide() |
end |
function GuildLottery:NewUserOK_Click() |
local User=GLNewUserNameEditBox:GetText() |
local numtickets = tonumber(GLNewUserTicketsEditBox:GetText()) |
local i, name |
local found = 0 |
--[[ |
for i=1, GetNumGuildMembers(true) do |
name = GetGuildRosterInfo(i) |
if string.find(name,"^"..User.."$") then |
found = 1 |
end |
end |
if found < 1 then |
GL_printf(GuildLottery:Color(GREEN,"GuildLottery: ").. GuildLottery:Color(RED, L["ERR_NOTINGUILD"])) |
GLNewUserFrame:Hide() |
GuildLottery:UpdateScreen() |
GuildLottery:UpdateUserButtons() |
return |
end |
--]] |
local alreadysold = 0 |
if GuildLottery:DataGetUserIdx(User, GL_Data.Raffle)>0 then |
alreadysold = GuildLottery:DataGetTicketCount(GuildLottery:DataGetUserIdx(User, GL_Data.Raffle), GL_Data.Raffle) |
end |
if GL_Data.Raffle==GL_RAFFLE then |
if (numtickets+alreadysold>GL_Data.MaxRaffleTickets) then |
GL_printf( GuildLottery:Color(GREEN,"GuildRaffle: ")..GuildLottery:Color(RED,L["ERR_EXCEEDTICKET"].." "..GL_Data.MaxRaffleTickets-alreadysold..L["ERR_EXCEEDTICKET2"])..GuildLottery:Color(CYAN,User)) |
return |
end |
else |
if (numtickets+alreadysold>GL_Data.MaxLotteryTickets) then |
GL_printf( GuildLottery:Color(GREEN,"GuildLottery: ")..GuildLottery:Color(RED,L["ERR_EXCEEDTICKET"].." "..GL_Data.MaxLotteryTickets-alreadysold..L["ERR_EXCEEDTICKET2"])..GuildLottery:Color(CYAN,User)) |
return |
end |
end |
local Tickets=GuildLottery:BuyTickets(numtickets) |
local idx=GuildLottery:DataGetUserIdx(User, GL_Data.Raffle) |
if (idx and idx>0) then |
GuildLottery:DataAddTickets(idx, Tickets) |
GuildLottery:SendInfo(User, GL_Data.Raffle) |
else |
if GL_Data.Raffle == 0 then |
LotteryInfo={} |
LotteryInfo.User=User |
LotteryInfo.Tickets=Tickets |
LotteryInfo.Notified=1 |
GuildLottery:InsertData( LotteryInfo ) |
else |
RaffleInfo={} |
RaffleInfo.User=User |
RaffleInfo.Tickets=Tickets |
RaffleInfo.Notified=1 |
GuildLottery:InsertData( RaffleInfo ) |
end |
GuildLottery:SendInfo(User, GL_Data.Raffle) |
end |
GLNewUserFrame:Hide() |
GuildLottery:UpdateScreen() |
GuildLottery:UpdateUserButtons() |
end |
function GuildLottery:NewUserNameAutocomplete(self) |
local text = self:GetText() |
local textlen = strlen(text) |
local numFriends, name |
-- No match, check your guild list |
numFriends = GetNumGuildMembers(true) -- true to include offline members |
if ( numFriends > 0 ) then |
for i=1, numFriends do |
name = GetGuildRosterInfo(i) |
if ( strfind(strupper(name), strupper(text), 1, 1) == 1 ) then |
self:SetText(name) |
self:HighlightText(textlen, -1) |
return |
end |
end |
end |
end |
function GuildLottery:NewUserOnEscapePressed() |
GuildLottery:NewUserCancel_Click() |
end |
function GuildLottery:NewUserOnEnterPressed() |
if GLNewUserNameEditBox:GetText() ~= "" then |
GuildLottery:NewUserOK_Click() |
end |
end |
function GuildLottery:InsertData( info) |
local Position |
if (info~=nil and info.User ~= nil) then |
Position=GuildLottery:DataCount(GL_Data.Raffle)+1 |
GuildLottery:DataInsert(Position,info) |
g_MenuItemSelected = Position |
GuildLottery:UpdateScreen() |
GuildLottery:UpdateUserButtons() |
end |
end |
--||||||||||||||||||||||||||||------ ControlFrame Button Clicks -----||||||||||||||||||||||||||||-- |
function GuildLottery:NewLotteryClick() |
if GuildLottery:DataGetTotalTicketCount(GL_Data.Raffle) > 0 then |
GuildLottery:AskQuestion( L["MSG_NEWLOT"]..GuildLottery:Color(YELLOW,L["MSG_NEWLOTCONFIRM"]),GL_NewLotteryAnswerCallback) |
else |
-- GL.WinningTicket=0 |
-- GL.WinningRaffleTicket1=0 |
-- GL.WinningRaffleTicket2=0 |
-- GL.WinningRaffleTicket3=0 |
-- GL.RaffleItem1='-1' |
-- GL.RaffleItem2='-1' |
-- GL.RaffleItem3='-1' |
-- GL.WinningEvent=-1 |
GuildLottery:RemoveAnnouncement() |
GL_Calendar_PickupDate(GL_NewLotteryCallback) |
if GL_Data.Raffle == GL_LOTTERY then |
GLCalendarGuaranteedWinner:SetText(L["TEXT_CALENDAR_GUARANTEED"]) |
GLGuarantee:SetChecked(GL_Data.GuaranteedWinner) |
else |
GLCalendarGuaranteedWinner:SetText(L["TEXT_CALENDAR_MULTIPLE"]) |
GLGuarantee:SetChecked(GL_Data.MultiWinners) |
end |
end |
end |
function GL_NewLotteryAnswerCallback( answer ) |
if answer==GL_ANSWER_YES then |
GL.WinningTicket=0 |
GL.WinningRaffleTicket1=0 |
GL.WinningRaffleTicket2=0 |
GL.WinningRaffleTicket3=0 |
GL.RaffleItem1='-1' |
GL.RaffleItem2='-1' |
GL.RaffleItem3='-1' |
GL.WinningEvent=-1 |
GuildLottery:RemoveAnnouncement() |
GL_Calendar_PickupDate(GL_NewLotteryCallback) |
if GL_Data.Raffle == GL_LOTTERY then |
GLCalendarGuaranteedWinner:SetText(L["TEXT_CALENDAR_GUARANTEED"]) |
GLGuarantee:SetChecked(GL_Data.GuaranteedWinner) |
else |
GLCalendarGuaranteedWinner:SetText(L["TEXT_CALENDAR_MULTIPLE"]) |
GLGuarantee:SetChecked(GL_Data.MultiWinners) |
end |
end |
end |
function GL_NewLotteryCallback(datetime) |
if GL_Data.Raffle == 0 then |
GL_Data.LotteryDate=datetime |
else |
GL_Data.RaffleDate=datetime |
end |
GuildLottery:DataClear(GL_Data.Raffle) |
GuildLottery:UpdateUserButtons() |
GuildLottery:UpdateScreen() |
GuildLottery:CreateAnnouncement() |
end |
local GLRollState=0 |
function GuildLottery:StartRollClick() |
if GLRollState > 0 then |
GuildLottery:Error(L["ERR_ROLLING"]) |
return |
end |
if GL_Settings.Channel == GL_CHANNEL_RAID then |
local members = GetNumRaidMembers() |
if members == 0 then |
GuildLottery:Error(L["ERR_NOTINRAID"]) |
return |
end |
end |
if GuildLottery:DataGetTotalTicketCount(GL_Data.Raffle) > 0 then |
if (GL_Data.Raffle == GL_LOTTERY) then |
GuildLottery:ScheduleTimer("Rolling_Lottery", 10) |
else |
if (GuildLottery:DataGetTotalTicketCount(1) < GuildLottery:GetNumPrizes()) and (GL_Data.MultiWinners==1) then |
GuildLottery:Error(L["ERR_NOTENOUGHTICKETS"]) |
return |
elseif (GuildLottery:FixPrizes() == 1) then |
GL.RaffleItem1 = GL_Data.RaffleItemOne |
GL.RaffleItem2 = GL_Data.RaffleItemTwo |
GL.RaffleItem3 = GL_Data.RaffleItemThree |
GuildLottery:ScheduleTimer("Rolling_Raffle", 10) |
else |
GuildLottery:Error(L["ERR_PRIZES"]) |
return |
end |
end |
else |
GuildLottery:Error(L["ERR_NOTICKETS"]) |
end |
GuildLottery:RemoveAnnouncement() |
GLRollState=1 |
GuildLottery:Chat(GuildLottery:Parse(L["ROLL_START"])) |
end |
function GuildLottery:GetNumPrizes() |
numPrizes = 0 |
if (GL_Data.RaffleItemOne~='0') then numPrizes=1; end |
if (GL_Data.RaffleItemTwo~='0') then numPrizes = numPrizes+1; end |
if (GL_Data.RaffleItemThree~='0') then numPrizes = numPrizes+1; end |
return numPrizes |
end |
function GuildLottery:FixPrizes() |
if (GL_Data.RaffleItemOne=='0') and (GL_Data.RaffleItemTwo=='0') and (GL_Data.RaffleItemThree=='0') then |
return 0 |
end |
if (GL_Data.RaffleItemOne=='0') then |
if (GL_Data.RaffleItemTwo~='0') then |
GL_Data.RaffleItemOne=GL_Data.RaffleItemTwo |
GL_Data.RaffleItemTwo='0' |
GLRaffleItemOneEditBox:SetText(GL_Data.RaffleItemOne) |
GLRaffleItemTwoEditBox:SetText('') |
elseif (GL_Data.RaffleItemThree~='0') then |
GL_Data.RaffleItemOne=GL_Data.RaffleItemThree |
GL_Data.RaffleItemThree='0' |
GLRaffleItemOneEditBox:SetText(GL_Data.RaffleItemOne) |
GLRaffleItemThreeEditBox:SetText('') |
return 1 |
end |
if (GL_Data.RaffleItemTwo=='0') then |
if (GL_Data.RaffleItemThree~='0') then |
GL_Data.RaffleItemTwo=GL_Data.RaffleItemThree |
GL_Data.RaffleItemThree='0' |
GLRaffleItemTwoEditBox:SetText(GL_Data.RaffleItemTwo) |
GLRaffleItemThreeEditBox:SetText('') |
end |
end |
end |
return 1 |
end |
function GuildLottery:ToggleClick(num) |
if(GLCalendarFrame:IsVisible()) then |
return |
end |
PanelTemplates_SetTab(GLControlFrame, num+1) |
if num == 0 or num == 1 then |
GLNonOptionsFrame:Show() |
GLOptionsFrame:Hide() |
else |
GLNonOptionsFrame:Hide() |
GLOptionsFrame:Show() |
GLRadiusSliderButtonPos:SetValue(GL_Settings.MinimapRadiusOffset) |
GLArcSliderButtonPos:SetValue(GL_Settings.MinimapArcOffset) |
GLIconSliderButtonPos:SetValue(GL_Settings.MinimapTextureId) |
GL_ChannelDropDownMenu_OnLoad() |
return |
end |
if num ~= GL_Data.Raffle then |
if GL_Data.Raffle==GL_RAFFLE then |
GL_Data.Raffle=GL_LOTTERY |
GLSettingAreaBackground:Show() |
GLRaffleSettingAreaBackground:Hide() |
GLNewLotteryButton:SetText(L["UI_NEWLOTTERY"]) |
else |
GL_Data.Raffle=GL_RAFFLE |
GLSettingAreaBackground:Hide() |
GLRaffleSettingAreaBackground:Show() |
GLNewLotteryButton:SetText(L["UI_NEWRAFFLE"]) |
end |
GuildLottery:UpdateScreen() |
GuildLottery:UpdateUserButtons() |
end |
end |
local GLWinAmount=0 |
local GLWinnerName="" |
local GLRaffleWinnerName1="" |
local GLRaffleWinnerName2="" |
local GLRaffleWinnerName3="" |
local GLWinPlayer=0 |
local GLWinGuild=0 |
local GLWinningTicket=0 |
local GLWinningPercentage=0 |
local GLNewLotteryStart=0 |
local GLFirstNumber=0 |
local GLLastNumber=0 |
local GLNumberOfTickets=0 |
-- RollState1 = (announce 10 seconds to roll) |
function GuildLottery:Rolling_Lottery() |
local number |
if (GL_Data.GuaranteedWinner == 1) then |
number = 1 |
else |
number = 2 |
end |
if GLRollState==1 then |
GuildLottery:Chat(GuildLottery:Parse(L["ROLL_TENSECS"])) |
GLRollState=2 |
GuildLottery:ScheduleTimer("Rolling_Lottery",10) |
elseif GLRollState==2 then |
GLNumberOfTickets=GuildLottery:DataGetTotalTicketCount(GL_LOTTERY) |
GLFirstNumber=GL_Data.LotteryTicketSerie |
GLLastNumber=GL_Data.NextLotteryTicket-number |
GuildLottery:Chat(GuildLottery:Parse(L["ROLL_TEXT1"])) -- "Rolling for the Jackpot "..GuildLottery:FormatPrice(GuildLottery:CalculateJackpot())); |
GuildLottery:Chat(GuildLottery:Parse(L["ROLL_TEXT2"],GLNumberOfTickets,GLFirstNumber,GLLastNumber)) |
GLRollState=3 |
GuildLottery:ScheduleTimer("Rolling_Lottery",5) |
elseif GLRollState==3 then |
GLWinningTicket=math.random(GL_Data.LotteryTicketSerie,GL_Data.NextLotteryTicket-number) |
local idx=GuildLottery:DataGetTicketIdx(GLWinningTicket, GL_LOTTERY) |
GuildLottery:Chat(GuildLottery:Parse(L["ROLL_TEXT3"],GLWinningTicket)) |
if (idx==0) then |
GuildLottery:Chat(GuildLottery:Parse(L["ROLL_TEXT4LOSE"])) |
-- No winner |
if GL_Data.SecondPrize>0 then |
GLRollState=4 |
else |
GLRollState=10 |
end |
else |
GuildLottery:Chat(GuildLottery:Parse(L["ROLL_TEXT4WIN"])) |
GLWinningPercentage=100 |
GLRollState=10 |
end |
GuildLottery:ScheduleTimer("Rolling_Lottery",5) |
elseif GLRollState==4 then |
-- Rolling for SecondPrize |
GLWinningTicket=math.random(GL_Data.LotteryTicketSerie,GL_Data.NextLotteryTicket-number) |
GuildLottery:Chat(GuildLottery:Parse(L["ROLL_TEXT5"],GLWinningTicket)) |
local idx=GuildLottery:DataGetTicketIdx(GLWinningTicket, GL_LOTTERY) |
if (idx==0) then |
GuildLottery:Chat(GuildLottery:Parse(L["ROLL_TEXT6LOSE"])) |
GLWinningTicket=0 |
GLRollState=10 |
else |
GuildLottery:Chat(GuildLottery:Parse(L["ROLL_TEXT6WIN"])) |
GLWinningPercentage=GL_Data.SecondPrize |
GLRollState=10 |
end |
GuildLottery:ScheduleTimer("Rolling_Lottery",5) |
elseif GLRollState==10 then |
GLWinAmount=0 |
GLWinnerName="" |
if GLWinningTicket>0 then |
GLWinnerName = GuildLottery:GetUserByTicket(GLWinningTicket, GL_LOTTERY) |
GLWinAmount = (GLWinningPercentage * GuildLottery:CalculateJackpot()) / 100 |
GuildLottery:Chat(GuildLottery:Parse(L["ROLL_TEXT7"],GLWinnerName,GLWinningPercentage)) |
if GL_Data.GuildCut > 0 then |
GLWinPlayer = math.floor(((100-GL_Data.GuildCut)*GLWinAmount)/100) |
GLWinGuild = math.floor(((GL_Data.GuildCut)*GLWinAmount)/100) |
GuildLottery:Chat(GuildLottery:Parse(L["ROLL_TEXT8GUILD"],GuildLottery:FormatPrice( GLWinPlayer),GLWinnerName,GuildLottery:FormatPrice(GLWinGuild))) |
-- TODO: Fix the "You have to pay out, messages, it's not localized! :( |
GL_printf(GuildLottery:Color(GREEN,"GuildLottery:")..GuildLottery:Color(WHITE," You have to pay out: ")..GuildLottery:Color(YELLOW,GuildLottery:FormatPrice(GLWinPlayer))..GuildLottery:Color(WHITE," to: ")..GuildLottery:Color(CYAN,GLWinnerName)) |
GL_printf(GuildLottery:Color(GREEN,"GuildLottery:")..GuildLottery:Color(WHITE," You have to pay out: ")..GuildLottery:Color(YELLOW,GuildLottery:FormatPrice(GLWinGuild))..GuildLottery:Color(WHITE," to the guild")) |
else |
GLWinPlayer = GLWinAmount |
GuildLottery:Chat(GuildLottery:Parse(L["ROLL_TEXT8NORMAL"],GuildLottery:FormatPrice( GLWinPlayer))) |
GL_printf(GuildLottery:Color(GREEN,"GuildLottery:")..GuildLottery:Color(WHITE," You have to pay out: ")..GuildLottery:Color(YELLOW,GuildLottery:FormatPrice(GLWinPlayer))..GuildLottery:Color(WHITE," to: ")..GuildLottery:Color(CYAN,GLWinnerName)) |
end |
end |
GLRollState=11 |
GuildLottery:ScheduleTimer("Rolling_Lottery",5) |
elseif GLRollState==11 then |
GLNewLotteryStart=0 |
GLNewLotteryStart = GuildLottery:CalculateJackpot()-GLWinAmount |
if GLNewLotteryStart>0 then |
GuildLottery:Chat(GuildLottery:Parse(L["ROLL_NEXT"],GuildLottery:FormatPrice(GLNewLotteryStart))) |
end |
GL_Data.StartGold = GLNewLotteryStart |
if GL_Data.Raffle==GL_RAFFLE then |
GuildLottery:ToggleClick() |
end |
if (GL_Settings.UseWinnerAnnouncement == 1) then |
GL.WinningEvent=0 |
GuildLottery:AskQuestion(GuildLottery:Color(YELLOW,L["MSG_CREATEWINNEREVT"]),GL_CreateWinnerCallback) |
else |
GuildLottery:DataClear(GL_LOTTERY) |
GL_printf(GuildLottery:Color(GREEN,"GuildLottery: ")..GuildLottery:Color(WHITE,L["MSG_CHOOSENEXT"])) |
GuildLottery:NewLotteryClick() |
end |
GLRollState=0 |
end |
end |
function GuildLottery:Rolling_Raffle() |
local number; |
number = 1; |
if GLRollState==1 then -- Rolling in 10 seconds |
GLWinningRaffleTicket1='-1' |
GLWinningRaffleTicket2='-1' |
GLWinningRaffleTicket3='-1' |
GLRaffleWinnerName1="" |
GLRaffleWinnerName2="" |
GLRaffleWinnerName3="" |
GuildLottery:Chat(GuildLottery:Parse(L["ROLL_TENSECS"])) |
GLRollState=2 |
GuildLottery:ScheduleTimer("Rolling_Raffle", 10) |
elseif GLRollState==2 then |
GLNumberOfTickets=GuildLottery:DataGetTotalTicketCount(GL_RAFFLE) |
GLFirstNumber=GL_Data.RaffleTicketSerie |
GLLastNumber=GL_Data.NextRaffleTicket-1 |
GuildLottery:Chat(GuildLottery:Parse(L["ROLL_TEXT2"],GLNumberOfTickets,GLFirstNumber,GLLastNumber)) |
if GL.RaffleItem2 =='0' and GL.RaffleItem3 =='0' then |
GuildLottery:Chat(GuildLottery:Parse(L["RAFFLE_ROLL_TEXT3"])) -- "Rolling for the Prizes " (Multiple winners) |
elseif GL.RaffleItem2 ~='0' and GL.RaffleItem3 =='0' then |
GuildLottery:Chat(GuildLottery:Parse(L["RAFFLE_ROLL_TEXT2"])) -- "Rolling for the Prizes " (Multiple winners) |
else |
GuildLottery:Chat(GuildLottery:Parse(L["RAFFLE_ROLL_TEXT1"])) -- "Rolling for the Prizes " (Multiple winners) |
end |
if (GL_Data.MultiWinners==1) then |
GLRollState=3 |
else |
GLRollState=4 |
end |
GuildLottery:ScheduleTimer("Rolling_Raffle", 5) |
elseif GLRollState==3 then -- Multiple winners |
GLWinningRaffleTicket1=math.random(GL_Data.RaffleTicketSerie,GL_Data.NextRaffleTicket-number) |
if GL.RaffleItem2~='0' then |
GLWinningRaffleTicket2=math.random(GL_Data.RaffleTicketSerie,GL_Data.NextRaffleTicket-number) |
else |
GLWinningRaffleTicket2='-1' |
end |
if GL.RaffleItem3~='0' then |
GLWinningRaffleTicket3=math.random(GL_Data.RaffleTicketSerie,GL_Data.NextRaffleTicket-number) |
else |
GLWinningRaffleTicket3='-1' |
end |
while (GLWinningRaffleTicket2==GLWinningRaffleTicket1) do |
GLWinningRaffleTicket2=math.random(GL_Data.RaffleTicketSerie,GL_Data.NextRaffleTicket-number) |
end |
if GLWinningRaffleTicket3~='-1' then |
while (GLWinningRaffleTicket3==GLWinningRaffleTicket2) or (GLWinningRaffleTicket3==GLWinningRaffleTicket1) do |
GLWinningRaffleTicket3=math.random(GL_Data.RaffleTicketSerie,GL_Data.NextRaffleTicket-number) |
end |
end |
if (GLWinningRaffleTicket3=='-1' and GLWinningRaffleTicket2=='-1') then |
GuildLottery:Chat(GuildLottery:Parse(L["RAFFLE_M_ROLL_TEXT5"],GLWinningRaffleTicket1)) |
elseif (GLWinningRaffleTicket3=='-1' and GLWinningRaffleTicket2~='-1') then |
GuildLottery:Chat(GuildLottery:Parse(L["RAFFLE_M_ROLL_TEXT4"],GLWinningRaffleTicket1,GLWinningRaffleTicket2)) |
else |
GuildLottery:Chat(GuildLottery:Parse(L["RAFFLE_M_ROLL_TEXT3"],GLWinningRaffleTicket1,GLWinningRaffleTicket2,GLWinningRaffleTicket3)) |
end |
GLRollState=10 |
GuildLottery:ScheduleTimer("Rolling_Raffle", 5) |
elseif GLRollState==4 then |
-- Single Winner |
GLWinningRaffleTicket1=math.random(GL_Data.RaffleTicketSerie,GL_Data.NextRaffleTicket-number) |
GuildLottery:Chat(GuildLottery:Parse(L["RAFFLE_S_ROLL_TEXT3"],GLWinningRaffleTicket1)) |
local idx=GuildLottery:DataGetTicketIdx(GLWinningRaffleTicket1, GL_RAFFLE) |
GLRollState=10 |
GuildLottery:ScheduleTimer("Rolling_Raffle", 5) |
elseif GLRollState==10 then |
GLRaffleWinnerName1 = GuildLottery:GetUserByTicket(GLWinningRaffleTicket1, GL_RAFFLE) |
if (GL_Data.MultiWinners==1) then |
if (GLWinningRaffleTicket2~='-1') then |
GLRaffleWinnerName2 = GuildLottery:GetUserByTicket(GLWinningRaffleTicket2, GL_RAFFLE) |
end |
if (GLWinningRaffleTicket3~='-1') then |
GLRaffleWinnerName3 = GuildLottery:GetUserByTicket(GLWinningRaffleTicket3, GL_RAFFLE) |
end |
if (GLWinningRaffleTicket3=='-1' and GLWinningRaffleTicket2=='-1') then |
GuildLottery:Chat(GuildLottery:Parse(L["RAFFLE_M_ROLL_TEXT9"],GLRaffleWinnerName1,GL.RaffleItem1)) |
elseif (GLWinningRaffleTicket3=='-1' and GLWinningRaffleTicket2~='-1') then |
GuildLottery:Chat(GuildLottery:Parse(L["RAFFLE_M_ROLL_TEXT8"],GLRaffleWinnerName1,GL.RaffleItem1,GLRaffleWinnerName2,GL.RaffleItem2)) |
else |
GuildLottery:Chat(GuildLottery:Parse(L["RAFFLE_M_ROLL_TEXT9"],GLRaffleWinnerName1,GL.RaffleItem1)) |
GuildLottery:Chat(GuildLottery:Parse(L["RAFFLE_M_ROLL_TEXT9"],GLRaffleWinnerName2,GL.RaffleItem2)) |
GuildLottery:Chat(GuildLottery:Parse(L["RAFFLE_M_ROLL_TEXT9"],GLRaffleWinnerName3,GL.RaffleItem3)) |
end |
else |
GuildLottery:Chat(GuildLottery:Parse(L["RAFFLE_M_ROLL_TEXT10"], GLRaffleWinnerName1)) |
if (GLRaffleItem3=='-1' and GLRaffleItem2=='-1') then |
GuildLottery:Chat(GuildLottery:Parse(L["RAFFLE_M_ROLL_TEXT11"],GL.RaffleItem1)) |
elseif (GLWinningRaffleTicket3=='-1' and GLWinningRaffleTicket2~='-1') then |
GuildLottery:Chat(GuildLottery:Parse(L["RAFFLE_M_ROLL_TEXT11"], GL.RaffleItem1)) |
GuildLottery:Chat(GuildLottery:Parse(L["RAFFLE_M_ROLL_TEXT11"], GL.RaffleItem2)) |
else |
GuildLottery:Chat(GuildLottery:Parse(L["RAFFLE_M_ROLL_TEXT11"], GL.RaffleItem1)) |
GuildLottery:Chat(GuildLottery:Parse(L["RAFFLE_M_ROLL_TEXT11"], GL.RaffleItem2)) |
GuildLottery:Chat(GuildLottery:Parse(L["RAFFLE_M_ROLL_TEXT11"], GL.RaffleItem3)) |
end |
end |
GLRollState=11 |
GuildLottery:ScheduleTimer("Rolling_Raffle", 5) |
elseif GLRollState==11 then |
if GL_Data.Raffle==GL_LOTTERY then |
GuildLottery:ToggleClick() |
end |
if (GL_Settings.UseWinnerAnnouncement == 1) then |
GL.WinningEvent=1; |
GuildLottery:AskQuestion(GuildLottery:Color(YELLOW,L["MSG_CREATEWINNEREVT"]),GL_CreateWinnerCallback) |
else |
GuildLottery:DataClear(GL_RAFFLE) |
GL_printf(GuildLottery:Color(GREEN,"GuildLottery: ")..GuildLottery:Color(WHITE,L["MSG_CHOOSENEXT"])) |
GuildLottery:NewLotteryClick() |
end |
GLRollState=0 |
end |
end |
function GL_CreateWinnerCallback(answer) |
if answer==GL_ANSWER_YES then |
GuildLottery:CreateWinnerAnnouncement() |
end |
end |
function GuildLottery:MaxRaffleTicketsOnEscapePressed(self) |
GLMaxRaffleTicketsEditBox:SetText(GL_Data.MaxRaffleTickets) |
self:ClearFocus() |
self:SetTextColor(1,1,1) |
GuildLottery:UpdateScreen() |
end |
function GuildLottery:MaxRaffleTicketsOnEnterPressed(self) |
GL_Data.MaxRaffleTickets=GLMaxRaffleTicketsEditBox:GetNumber() |
self:ClearFocus() |
self:SetTextColor(1,1,1) |
GuildLottery:UpdateScreen() |
end |
function GuildLottery:MaxTicketsOnEscapePressed(self) |
GLMaxTicketsEditBox:SetText(GL_Data.MaxLotteryTickets) |
self:ClearFocus() |
self:SetTextColor(1,1,1) |
GuildLottery:UpdateScreen() |
end |
function GuildLottery:MaxTicketsOnEnterPressed(self) |
GL_Data.MaxLotteryTickets=GLMaxTicketsEditBox:GetNumber() |
self:ClearFocus() |
self:SetTextColor(1,1,1) |
GuildLottery:UpdateScreen() |
end |
function GuildLottery:SecondPrizeOnEscapePressed(self) |
GLSecondPrizeEditBox:SetText(GL_Data.SecondPrize) |
self:ClearFocus() |
self:SetTextColor(1,1,1) |
GuildLottery:UpdateScreen() |
end |
function GuildLottery:SecondPrizeOnEnterPressed(self) |
local num=GLSecondPrizeEditBox:GetNumber() |
if num~=nil then |
if num>100 then |
num=100; |
end |
if num<0 then |
num=0; |
end |
GL_Data.SecondPrize=num |
end |
self:ClearFocus() |
self:SetTextColor(1,1,1) |
GuildLottery:UpdateScreen() |
end |
function GL_TicketPriceOnEscapePressed() |
GuildLottery:UpdateScreen() |
end |
function GL_TicketPriceOnEnterPressed() |
GL_Data.TicketPrice = GLTicketPriceEditBox:GetNumber() |
GuildLottery:UpdateScreen() |
end |
function GL_StartGoldOnEscapePressed() |
GuildLottery:UpdateScreen() |
end |
function GL_StartGoldOnEnterPressed() |
local value=GLStartGoldEditBox:GetNumber() |
if value then |
GL_Data.StartGold=value |
else |
GL_Data.StartGold=0 |
end |
GuildLottery:UpdateScreen() |
end |
-- Raffle |
function GuildLottery:RaffleItemOne_OnTextChanged(self) |
if (GLRaffleItemOneEditBox:GetText()=='' and GL_Data.RaffleItemOne=='0') then |
return |
end |
if (GLRaffleItemOneEditBox:GetText() ~= GL_Data.RaffleItemOne) then |
GLRaffleItemOneButton:Show() |
end |
end |
function GuildLottery:RaffleItemOne_OnEnterPressed(self) |
GuildLottery:RaffleItemOneButton_OnClick(GLRaffleItemOneButton) |
end |
function GuildLottery:RaffleItemOne_OnEscapePressed(self) |
if (GL_Data.RaffleItemOne~='0') then |
GLRaffleItemOneEditBox:SetText(GL_Data.RaffleItemOne) |
else |
GLRaffleItemOneEditBox:SetText('') |
end |
GLRaffleItemOneEditBox:SetCursorPosition(0) |
GLRaffleItemOneEditBox:ClearFocus() |
GLRaffleItemOneButton:Hide() |
end |
function GuildLottery:RaffleItemOneButton_OnClick(self) |
local text = GLRaffleItemOneEditBox:GetText() |
local itemName, itemLink = GetItemInfo(text) |
if (GLRaffleItemOneEditBox:GetText() == '') then |
GL_Data.RaffleItemOne='0' |
GLRaffleItemOneEditBox:ClearFocus() |
GLRaffleItemOneButton:Hide() |
return; |
end |
if (itemLink == nil and GL_Settings.AllowInvalidItems == 1) then |
itemLink = "["..text.."]" |
end |
if (itemLink) then |
GLRaffleItemOneEditBox:SetText(itemLink) |
GL_Data.RaffleItemOne=itemLink |
GLRaffleItemOneEditBox:ClearFocus() |
else |
GL_printf(GuildLottery:Color(GREEN,"GuildLottery: ").. GuildLottery:Color(RED, L["ERR_INVALIDITEM"])) |
if (GL_Data.RaffleItemOne~='0') then |
GLRaffleItemOneEditBox:SetText(GL_Data.RaffleItemOne) |
else |
GLRaffleItemOneEditBox:SetText('') |
end |
GLRaffleItemOneEditBox:ClearFocus() |
end |
GLRaffleItemOneEditBox:SetCursorPosition(0) |
GLRaffleItemOneButton:Hide() |
end |
-- |
function GuildLottery:RaffleItemTwo_OnTextChanged(self) |
if (GLRaffleItemTwoEditBox:GetText()=='' and GL_Data.RaffleItemTwo=='0') then |
return; |
end |
if (GLRaffleItemTwoEditBox:GetText() ~= GL_Data.RaffleItemTwo) then |
GLRaffleItemTwoButton:Show() |
end |
end |
function GuildLottery:RaffleItemTwo_OnEnterPressed(self) |
GuildLottery:RaffleItemTwoButton_OnClick(Button2) |
end |
function GuildLottery:RaffleItemTwo_OnEscapePressed(self) |
if (GL_Data.RaffleItemTwo~='0') then |
GLRaffleItemTwoEditBox:SetText(GL_Data.RaffleItemTwo) |
else |
GLRaffleItemTwoEditBox:SetText('') |
end |
GLRaffleItemTwoEditBox:SetCursorPosition(0) |
GLRaffleItemTwoEditBox:ClearFocus() |
GLRaffleItemTwoButton:Hide() |
end |
function GuildLottery:RaffleItemTwoButton_OnClick(self) |
local text = GLRaffleItemTwoEditBox:GetText() |
local itemName, itemLink = GetItemInfo(text) |
if (GLRaffleItemTwoEditBox:GetText() == '') then |
GL_Data.RaffleItemTwo='0' |
GLRaffleItemTwoEditBox:ClearFocus() |
GLRaffleItemTwoButton:Hide() |
return |
end |
if (itemLink == nil and GL_Settings.AllowInvalidItems == 1) then |
itemLink = "["..text.."]" |
end |
if (itemLink) then |
GLRaffleItemTwoEditBox:SetText(itemLink) |
GL_Data.RaffleItemTwo=itemLink |
GLRaffleItemTwoEditBox:ClearFocus() |
else |
GL_printf(GuildLottery:Color(GREEN,"GuildLottery: ").. GuildLottery:Color(RED, L["ERR_INVALIDITEM"])) |
if (GL_Data.RaffleItemTwo~='0') then |
GLRaffleItemTwoEditBox:SetText(GL_Data.RaffleItemTwo) |
else |
GLRaffleItemTwoEditBox:SetText('') |
end |
GLRaffleItemTwoEditBox:ClearFocus() |
end |
GLRaffleItemTwoEditBox:SetCursorPosition(0) |
GLRaffleItemTwoButton:Hide() |
end |
-- |
function GuildLottery:RaffleItemThree_OnTextChanged(self) |
if (GLRaffleItemThreeEditBox:GetText()=='' and GL_Data.RaffleItemThree=='0') then |
return |
end |
if (GLRaffleItemThreeEditBox:GetText() ~= GL_Data.RaffleItemThree) then |
GLRaffleItemThreeButton:Show() |
end |
end |
function GuildLottery:RaffleItemThree_OnEnterPressed(self) |
GuildLottery:RaffleItemThreeButton_OnClick(Button2) |
end |
function GuildLottery:RaffleItemThree_OnEscapePressed(self) |
if (GL_Data.RaffleItemThree~='0') then |
GLRaffleItemThreeEditBox:SetText(GL_Data.RaffleItemThree) |
else |
GLRaffleItemThreeEditBox:SetText('') |
end |
GLRaffleItemThreeEditBox:SetCursorPosition(0) |
GLRaffleItemThreeEditBox:ClearFocus() |
GLRaffleItemThreeButton:Hide() |
end |
function GuildLottery:RaffleItemThreeButton_OnClick(self) |
local text = GLRaffleItemThreeEditBox:GetText() |
local itemName, itemLink = GetItemInfo(text) |
if (GLRaffleItemThreeEditBox:GetText() == '') then |
GL_Data.RaffleItemThree='0' |
GLRaffleItemThreeEditBox:ClearFocus() |
GLRaffleItemThreeButton:Hide() |
return; |
end |
if (itemLink == nil and GL_Settings.AllowInvalidItems == 1) then |
itemLink = "["..text.."]" |
end |
if (itemLink) then |
GLRaffleItemThreeEditBox:SetText(itemLink) |
GL_Data.RaffleItemThree=itemLink |
GLRaffleItemThreeEditBox:ClearFocus() |
else |
GL_printf(GuildLottery:Color(GREEN,"GuildLottery: ").. GuildLottery:Color(RED, L["ERR_INVALIDITEM"])) |
if (GL_Data.RaffleItemThree~='0') then |
GLRaffleItemThreeEditBox:SetText(GL_Data.RaffleItemThree) |
else |
GLRaffleItemThreeEditBox:SetText('') |
end |
GLRaffleItemThreeEditBox:ClearFocus() |
end |
GLRaffleItemThreeEditBox:SetCursorPosition(0) |
GLRaffleItemThreeButton:Hide(); |
end |
function GuildLottery:ShowToolTip(self, title, message) |
GameTooltip:SetOwner(self, "ANCHOR_CURSOR") |
GameTooltip:SetText(title) -- This sets the top line of text, in gold. |
GameTooltip:AddLine(message, 1, 1, 1) |
GameTooltip:Show() |
end |
function GL_printf(text) |
if DEFAULT_CHAT_FRAME then |
DEFAULT_CHAT_FRAME:AddMessage(text) |
else |
message(text) |
end |
end |
-- TODO replace this with ace3 print message |
function GL_debug(text) |
if GL_Settings.Debuglevel>0 then |
GL_printf(text) |
end |
end |
local GLRegistered=-1 |
function GuildLottery:SendWhisperLine(to, text ) |
table.insert(GL.WhisperHistory, { to=to, text=text, time=GetTime() }) |
if to == GL.Me then |
GL_printf( GuildLottery:Color(GREEN,text)) |
else |
SendChatMessage( text, "WHISPER", nil, to ) |
end |
end |
function GuildLottery:GetUserByTicket( ticketno, raffle ) |
local idx=GuildLottery:DataGetTicketIdx(tonumber(ticketno), raffle) |
local Name=GuildLottery:DataGetUser(idx, raffle) |
return Name |
end |
function GuildLottery:SendTicketOwnerOf( user, ticketno, raffle ) |
local Name=GuildLottery:GetUserByTicket( ticketno, raffle ) |
GuildLottery:SendWhisperLine(user, "GuildLottery:") |
if Name==nil or Name=="" then |
GuildLottery:SendWhisperLine(user, GuildLottery:Parse(L["TICKETINFO_NOTSOLD"],ticketno)) -- "Ticket number "..ticketno.." is not sold.") |
else |
GuildLottery:SendWhisperLine(user, GuildLottery:Parse(L["TICKETINFO_SOLD"],ticketno,Name)) --"Ticket number "..ticketno.." is sold to: "..Name) |
end |
end |
function GuildLottery:SendWhisperByKey ( key, lines, player) |
local line = 1 |
-- local text = GuildLottery:TextParse( getglobal(L[key..line]), player ) |
local text = GuildLottery:TextParse( L[key..line], player ) |
while ((text ~= nil and #text >0) and (line <= lines) ) do |
for i=1, #text do |
if text[i] ~= "" then |
GuildLottery:SendWhisperLine(player, text[i]) |
end |
end |
line=line+1 |
if (line <= lines) then |
text = GuildLottery:TextParse( L[key..line], player) |
end |
end |
end |
function GuildLottery:SendHelp( player ) |
-- General - part |
local key = "INFO_HELP_LINE" |
GuildLottery:SendWhisperByKey( key, 7, player) |
-- OddEven or guaranteed winner - part |
local key="INFO_HELP_ODDEVEN_LINE"; |
if (GL_Data.GuaranteedWinner == 1) then key = "INFO_HELP_GUARANTEED_LINE"; end |
GuildLottery:SendWhisperByKey( key, 1, player) |
-- Second prize - part |
key = "INFO_HELP_NOSECONDPRIZE_LINE" |
if GL_Data.SecondPrize > 0 then |
key = "INFO_HELP_SECONDPRIZE_LINE" |
GuildLottery:SendWhisperByKey( key, 3, player) |
else |
GuildLottery:SendWhisperByKey( key, 1, player) |
end |
-- Guild cut - part |
key = "INFO_HELP_NOGUILDCUT_LINE"; |
if GL_Data.GuildCut > 0 then key = "INFO_HELP_GUILDCUT_LINE"; end |
GuildLottery:SendWhisperByKey( key, 1, player); |
end |
CF_MessageEventHandler_Orig = CF_MessageEventHandler; |
function GL_CF_MessageEventHandler(self, event, ...) |
if event == "CHAT_MSG_WHISPER_INFORM" then |
local msg = arg1; |
local user = arg2; |
if GuildLottery:IsGLWhisper( msg, user ) then |
return; |
end |
end |
return CF_MessageEventHandler_Orig(self, event, ...) |
end |
CF_MessageEventHandler = GL_CF_MessageEventHandler |
function GuildLottery:SendRaffleInfo( player, raffle ) |
GuildLottery:SendInfo( player, 1 ) |
GuildLottery:RemoveSpam("Raffle", player) |
end |
function GuildLottery:SendLotteryInfo( player, raffle ) |
GuildLottery:SendInfo( player, 0 ) |
GuildLottery:RemoveSpam("Lottery", player) |
end |
function GuildLottery:SendInfo( player, raffle ) |
GL_printf(GuildLottery:Color(GREEN,"GuildLottery ")..GuildLottery:Color(WHITE,GuildLottery:Parse(L["MSG_SENDINFO"]))..GuildLottery:Color(CYAN,player)) |
local idx =GuildLottery:DataGetUserIdx( player, raffle ) |
-- assume he is online, so set the notification done |
GuildLottery:DataSetNotified(idx,1, raffle) |
GuildLottery:UpdateUserButtons() |
if raffle == 0 then |
GuildLottery:SendWhisperByKey( "LOTTERYINFO_TO_USER_ONE_LINE", 3, player) |
if (GuildLottery:DataGetTicketCount(idx, raffle) > 0) then |
GuildLottery:SendWhisperByKey( "LOTTERYINFO_TO_USER_HAS_TICKETS_LINE", 3, player) |
end |
GuildLottery:SendWhisperByKey( "LOTTERYINFO_TO_USER_TWO_LINE", 3, player) |
else |
GuildLottery:SendWhisperByKey( "RAFFLEINFO_TO_USER_ONE_LINE", 3, player) |
if (GuildLottery:DataGetTicketCount(idx, raffle) > 0) then |
GuildLottery:SendWhisperByKey( "RAFFLEINFO_TO_USER_HAS_TICKETS_LINE", 3, player) |
end |
GuildLottery:SendWhisperByKey( "RAFFLEINFO_TO_USER_TWO_LINE", 3, player) |
end |
end |
function GuildLottery:SpamClick(raffle) |
local line=1 |
if GL_Settings.Channel == GL_CHANNEL_RAID then |
local members = GetNumRaidMembers() |
if members == 0 then |
GuildLottery:Error(L["ERR_NOTINRAID"]) |
return |
end |
end |
if (raffle == nil) then |
raffle = GL_Data.Raffle |
end |
if raffle==GL_LOTTERY then |
if (GL_Data.GuaranteedWinner == 1) then |
GuildLottery:Chat(L["UI_GUARANTEEDWINNER"]) |
end |
local spamtext = GuildLottery:TextParse( L["INFO_LOTTERYSPAM_LINE"..line] ) |
count = 1 |
while (spamtext ~= nil and #spamtext>0 and line <= 3 ) do |
for i=1, #spamtext do |
if spamtext[i] ~= "" then |
GuildLottery:Chat( spamtext[i] ) |
end |
end |
line=line+1 |
if (line <= 3) then |
spamtext = GuildLottery:TextParse( L["INFO_LOTTERYSPAM_LINE"..line] ) |
end |
end |
else |
local spamtext = GuildLottery:TextParse( L["INFO_RAFFLESPAM_LINE"..line] ) |
while (spamtext ~= nil and #spamtext>0 and line <= 7 ) do |
for i=1, #spamtext do |
if spamtext[i] ~= "" then |
GuildLottery:Chat( spamtext[i] ) |
end |
end |
line=line+1 |
if (line <= 7) then |
spamtext = GuildLottery:TextParse( L["INFO_RAFFLESPAM_LINE"..line] ) |
end |
end |
end |
end |
function GuildLottery:Chat(text) |
local chatchan |
if GL_Settings.Channel == GL_CHANNEL_RAID then |
chatchan = "RAID" |
else |
chatchan = "GUILD" |
end |
if GL_Data.Raffle==GL_LOTTERY then |
SendChatMessage( "<<"..GL_Data.LotteryName..">> "..text, chatchan, nil, nil ) |
else |
SendChatMessage( "<<"..GL_Data.RaffleName..">> "..text, chatchan, nil, nil ) |
end |
end |
function GuildLottery:AnnouncementText(raffle) |
local text="" |
if (raffle==0) then |
text=text..GL_Data.LotteryName.."\n" |
if (GL_Data.GuaranteedWinner == 1) then |
text=text..L["UI_GUARANTEEDWINNER"].."\n" |
end |
text=text..L["UI_LOTTERYDATE"]..": "..GuildLottery:FormatDate(GL_Data.LotteryDate).."\n" |
text=text..L["UI_STARTGOLD"]..": "..GuildLottery:FormatPrice(GL_Data.StartGold).."\n" |
text=text..L["UI_TICKETPRICE"]..": "..GuildLottery:FormatPrice(GL_Data.LotteryTicketPrice).."\n" |
text=text..L["UI_MAXTICKETS"]..": "..GL_Data.MaxLotteryTickets.."\n" |
if (GL_Data.GuaranteedWinner == 0) then |
if GL_Data.SecondPrize ~= nil and GL_Data.SecondPrize > 0 then |
text=text..L["UI_SECONDPRIZE"]..": "..GL_Data.SecondPrize.."%\n" |
end |
end |
if GL_Data.GuildCut ~= nil and GL_Data.GuildCut > 0 then |
text=text..L["UI_GUILDCUT"]..": "..GL_Data.GuildCut.."%\n" |
end |
text=text.."\n"..L["UI_OWNER"]..": "..GL.Me.."\n" |
return text |
else |
local prizes = "" |
GuildLottery:FixPrizes() |
if (GL_Data.RaffleItemOne~="" and GL_Data.RaffleItemOne~='0') then prizes = prizes..GetItemInfo(GL_Data.RaffleItemOne); end |
if (GL_Data.RaffleItemTwo~="" and GL_Data.RaffleItemTwo~='0') then prizes = prizes..", "..GetItemInfo(GL_Data.RaffleItemTwo); end |
if (GL_Data.RaffleItemThree~="" and GL_Data.RaffleItemThree~='0') then prizes = prizes..", "..GetItemInfo(GL_Data.RaffleItemThree); end |
text=text..GL_Data.RaffleName.."\n" |
text=text..L["UI_RAFFLEDATE"]..": "..GuildLottery:FormatDate(GL_Data.RaffleDate).."\n" |
text=text..L["UI_TICKETPRICE"]..": "..GuildLottery:FormatPrice(GL_Data.RaffleTicketPrice).."\n" |
text=text..L["UI_MAXTICKETS"]..": "..GL_Data.MaxRaffleTickets.."\n" |
text=text..L["UI_PRIZES"]..prizes.."\n" |
text=text.."\n"..L["UI_OWNER"]..": "..GL.Me.."\n" |
return text |
end |
end |
function GuildLottery:WinnerAnnouncementText(raffle) |
local text="" |
local itemName1 ="" |
local itemName2 ="" |
local itemName3 ="" |
if raffle == 1 then |
text=text..GL_Data.RaffleName.."\n" |
text=text..GuildLottery:Parse(L["ROLL_TEXT2"],GLNumberOfTickets,GLFirstNumber,GLLastNumber).."\n" |
if (GLWinningRaffleTicket3=='-1' and GLWinningRaffleTicket2=='-1') then |
text=text..GuildLottery:Parse(L["RAFFLE_M_ROLL_TEXT5"],GLWinningRaffleTicket1).."\n" |
itemName1 = GetItemInfo(GL.RaffleItem1) |
if itemName1 == nil then |
itemName1 = string.sub(GL.RaffleItem1, 2, -2) |
end |
text=text..GuildLottery:Parse(L["RAFFLE_M_ROLL_TEXT9"],GLRaffleWinnerName1,itemName1) |
elseif (GLWinningRaffleTicket3=='-1' and GLWinningRaffleTicket2~='-1') then |
text=text..GuildLottery:Parse(L["RAFFLE_M_ROLL_TEXT4"],GLWinningRaffleTicket1,GLWinningRaffleTicket2).."\n" |
itemName1 = GetItemInfo(GL.RaffleItem1) |
itemName2 = GetItemInfo(GL.RaffleItem2) |
if itemName1 == nil then |
itemName1 = string.sub(GL.RaffleItem1, 2, -2) |
end |
if itemName2 == nil then |
itemName2 = string.sub(GL.RaffleItem2, 2, -2) |
end |
text=text..GuildLottery:Parse(L["RAFFLE_M_ROLL_TEXT9"],GLRaffleWinnerName1,itemName1).."\n" |
text=text..GuildLottery:Parse(L["RAFFLE_M_ROLL_TEXT9"],GLRaffleWinnerName2,itemName2) |
else |
text=text..GuildLottery:Parse(L["RAFFLE_M_ROLL_TEXT3"],GLWinningRaffleTicket1,GLWinningRaffleTicket2,GLWinningRaffleTicket3).."\n" |
itemName1 = GetItemInfo(GL.RaffleItem1) |
itemName2 = GetItemInfo(GL.RaffleItem2) |
itemName3 = GetItemInfo(GL.RaffleItem3) |
if itemName1 == nil then |
itemName1 = string.sub(GL.RaffleItem1, 2, -2) |
end |
if itemName2 == nil then |
itemName2 = string.sub(GL.RaffleItem2, 2, -2) |
end |
if itemName3 == nil then |
itemName3 = string.sub(GL.RaffleItem3, 2, -2) |
end |
text=text..GuildLottery:Parse(L["RAFFLE_M_ROLL_TEXT9"],GLRaffleWinnerName1,itemName1).."\n" |
text=text..GuildLottery:Parse(L["RAFFLE_M_ROLL_TEXT9"],GLRaffleWinnerName2,itemName2).."\n" |
text=text..GuildLottery:Parse(L["RAFFLE_M_ROLL_TEXT9"],GLRaffleWinnerName3,itemName3) |
end |
return text |
else |
text=text..GL_Data.LotteryName.."\n" |
text=text..GuildLottery:Parse(L["ROLL_TEXT2"],GLNumberOfTickets,GLFirstNumber,GLLastNumber).."\n" |
text=text..GuildLottery:Parse(L["ROLL_TEXT3"],GLWinningTicket).."\n" |
if GLWinnerName=="" then |
text=text..GuildLottery:Parse(L["ROLL_TEXT4LOSE"]).."\n" |
else |
text=text..GuildLottery:Parse(L["ROLL_TEXT7"],GLWinnerName,GLWinningPercentage).."\n" |
end |
if GLWinGuild>0 then |
text=text..GuildLottery:Parse(L["ROLL_TEXT8GUILD"],GuildLottery:FormatPrice(GLWinPlayer),GLWinnerName,GuildLottery:FormatPrice(GLWinGuild)).."\n" |
else |
text=text..GuildLottery:Parse(L["ROLL_TEXT8NORMAL"],GuildLottery:FormatPrice(GLWinPlayer)).."\n" |
end |
if GLNewLotteryStart>0 then |
text=text..GuildLottery:Parse(L["ROLL_NEXT"],GuildLottery:FormatPrice(GLNewLotteryStart)).."\n" |
end |
return text |
end |
end |
function GuildLottery:CreateWinnerAnnouncement() |
if GL_Settings.UseWinnerAnnouncement==1 then |
if (CalendarCanAddEvent()) then |
local _, month, day, year = CalendarGetDate() |
local hour, minute = GetGameTime() |
local winnerText = GuildLottery:WinnerAnnouncementText(GL.WinningEvent) |
minute=minute+1 |
CalendarCloseEvent() |
CalendarNewGuildAnnouncement() |
CalendarEventSetDate(month,day,year) |
if GL.WinningEvent==1 then |
CalendarEventSetTitle(L["MSG_RESULT"]..GL_Data.RaffleName) |
else |
CalendarEventSetTitle(L["MSG_RESULT"]..GL_Data.LotteryName) |
end |
CalendarEventSetDescription(winnerText) |
CalendarEventSetTime(hour,minute) |
CalendarEventSetType(5) |
CalendarAddEvent() |
else |
GuildLottery:Error(L["ERR_NOANNOUNCE"]) |
end |
end |
GuildLottery:DataClear(GL.WinningEvent) |
GuildLottery:ScheduleTimer(GL_printf, 5, GuildLottery:Color(GREEN,"GuildLottery: ")..GuildLottery:Color(WHITE,L["MSG_CHOOSENEXT"])) |
GuildLottery:ScheduleTimer("NewLotteryClick", 5) |
end |
function GuildLottery:CreateAnnouncement() |
if GL_Settings.UseLotteryAnnouncement==1 then |
if (CalendarCanAddEvent()) then |
local year, month, day, hour, minute |
CalendarCloseEvent() |
if GL_Data.Raffle == 1 then |
year, month, day, hour, minute = GuildLottery:ExtractDate( GL_Data.RaffleDate) |
GL_Data.AnnouncementTitle = GL_Data.RaffleName |
else |
year, month, day, hour, minute = GuildLottery:ExtractDate( GL_Data.LotteryDate) |
GL_Data.AnnouncementTitle = GL_Data.LotteryName |
end |
CalendarNewGuildAnnouncement() |
CalendarEventSetDate(month,day,year) |
CalendarEventSetTitle(GL_Data.AnnouncementTitle) |
CalendarEventSetDescription(GuildLottery:AnnouncementText(GL_Data.Raffle)) |
CalendarEventSetTime(hour,minute) |
CalendarEventSetType(5) |
CalendarAddEvent() |
else |
GuildLottery:Error(L["ERR_NOANNOUNCE"]) |
end |
end |
end |
function GuildLottery:CalendarFindEvent( title, year, month, day ) |
local monthOffset=0 |
local my,mm |
for i=0, 17 do |
mm,my = CalendarGetMonth(i) |
if ((mm==month) and (my==year)) then |
monthOffset=i |
end |
end |
local numevents=CalendarGetNumDayEvents(monthOffset,day) |
for eventIndex=1, numevents do |
local t = CalendarGetDayEvent(monthOffset, day, eventIndex) |
if t==title then |
return monthOffset, day, eventIndex |
end |
end |
return nil,nil,nil |
end |
function GuildLottery:RemoveAnnouncement() |
if (GL_Settings.UseLotteryAnnouncement==1) then |
local year, month, day |
if GL_Data.Raffle == 1 then |
GL_Data.AnnouncementTitle = GL_Data.RaffleName |
else |
GL_Data.AnnouncementTitle = GL_Data.LotteryName |
end |
if GL_Data.AnnouncementTitle ~= nil and GL_Data.AnnouncementTitle ~= "" then |
if GL_Data.Raffle == 1 then |
year, month, day = GuildLottery:ExtractDate( GL_Data.RaffleDate) |
else |
year, month, day = GuildLottery:ExtractDate( GL_Data.LotteryDate) |
end |
local mo,d,ei = GuildLottery:CalendarFindEvent( GL_Data.AnnouncementTitle, year, month, day ) |
if (mo ~= nil ) then |
GL_Data.AnnouncementTitle="" |
CalendarContextEventRemove(mo, d, ei) |
else |
-- GuildLottery:Error(L["ERR_REMOVEANNOUNCE"]) |
end |
end |
end |
end |
function GuildLottery:Issecure() |
if issecure()~=nil then |
GL_printf("Environment is secure") |
else |
GL_printf("Environment is NOT secure") |
end |
end |
function GuildLottery:LotteryName_OnEnterPressed(self) |
GL_Data.LotteryName=GLLotteryNameEditBox:GetText() |
self:ClearFocus() |
self:SetTextColor(1,1,1) |
GuildLottery:UpdateScreen() |
end |
function GuildLottery:LotteryName_OnEscapePressed(self) |
GLLotteryNameEditBox:SetText(GL_Data.LotteryName) |
self:ClearFocus() |
self:SetTextColor(1,1,1) |
GuildLottery:UpdateScreen() |
end |
function GuildLottery:RaffleName_OnEnterPressed(self) |
GL_Data.RaffleName=GLRaffleNameEditBox:GetText() |
self:ClearFocus() |
GuildLottery:UpdateScreen() |
end |
function GuildLottery:RaffleName_OnEscapePressed(self) |
GLRaffleNameEditBox:SetText(GL_Data.RaffleName) |
self:ClearFocus() |
GuildLottery:UpdateScreen() |
end |
function GuildLottery:GuildCut_OnEnterPressed(self) |
local num=GLGuildCutEditBox:GetNumber() |
if num~=nil then |
if num>100 then |
num=100 |
end |
if num<0 then |
num=0 |
end |
GL_Data.GuildCut=num |
end |
self:ClearFocus() |
self:SetTextColor(1,1,1) |
GuildLottery:UpdateScreen() |
end |
function GuildLottery:GuildCut_OnEscapePressed(self) |
GLGuildCutEditBox:SetText(GL_Data.GuildCut) |
self:ClearFocus() |
self:SetTextColor(1,1,1) |
GuildLottery:UpdateScreen() |
end |
function GuildLottery:Parse(text, ... ) |
local txt=""; |
local tab = GuildLottery:TextParse(text,nil,...) |
if type(tab)=="table" then |
if #tab>0 then |
txt=tab[1] |
end |
end |
return txt |
end |
function GuildLottery:TextParse( text, player, ...) |
local parsed={} |
if text==nil then return nil; end |
local p1,p2,p3,p4,p5,p6,p7,p8,p9,p10=... |
local prizes="" |
if GL_Data.RaffleItemOne~='0' then prizes=prizes..GL_Data.RaffleItemOne; end |
if GL_Data.RaffleItemTwo~='0' then prizes=prizes.." "..GL_Data.RaffleItemTwo; end |
if GL_Data.RaffleItemThree~='0' then prizes=prizes.." "..GL_Data.RaffleItemThree; end |
text = string.gsub(text,"%%lotteryowner%%", GL.Me) |
text = string.gsub(text,"%%me%%", GL.Me) |
text = string.gsub(text,"%%lotteryname%%", GL_Data.LotteryName ) |
text = string.gsub(text,"%%lotterydate%%", GuildLottery:FormatDate(GL_Data.LotteryDate)) |
text = string.gsub(text,"%%jackpot%%", GuildLottery:FormatPrice(GuildLottery:CalculateJackpot()) ) |
text = string.gsub(text,"%%startgold%%", GuildLottery:FormatPrice(GL_Data.StartGold) ) |
text = string.gsub(text,"%%maxlotterytickets%%", GL_Data.MaxLotteryTickets) |
text = string.gsub(text,"%%lotteryticketprice%%", GuildLottery:FormatPrice(GL_Data.LotteryTicketPrice)) |
text = string.gsub(text,"%%secondprize%%", GL_Data.SecondPrize) |
text = string.gsub(text,"%%guildcut%%", GL_Data.GuildCut) |
text = string.gsub(text,"%%raffleowner%%", GL.Me) |
text = string.gsub(text,"%%rafflename%%", GL_Data.RaffleName ) |
text = string.gsub(text,"%%raffledate%%", GuildLottery:FormatDate(GL_Data.RaffleDate)) |
text = string.gsub(text,"%%maxraffletickets%%", GL_Data.MaxRaffleTickets) |
text = string.gsub(text,"%%raffleticketprice%%", GuildLottery:FormatPrice(GL_Data.RaffleTicketPrice)) |
if string.match(text,"%%prize1%%") then |
if (GL_Data.RaffleItemOne ~= "" and GL_Data.RaffleItemOne~='0') then |
text = string.gsub(text,"%%prize1%%", GL_Data.RaffleItemOne) |
else |
text = "" |
end |
end |
if string.match(text,"%%prize2%%") then |
if (GL_Data.RaffleItemTwo ~= "" and GL_Data.RaffleItemTwo~='0') then |
text = string.gsub(text,"%%prize2%%", GL_Data.RaffleItemTwo) |
else |
text = "" |
end |
end |
if string.match(text,"%%prize3%%") then |
if (GL_Data.RaffleItemThree ~= "" and GL_Data.RaffleItemThree~='0') then |
text = string.gsub(text,"%%prize3%%", GL_Data.RaffleItemThree) |
else |
text = "" |
end |
end |
text = string.gsub(text,"%%prizes%%", prizes) |
if (p1) then |
text = string.gsub(text,"%%1%%", p1) |
end |
if (p2) then |
text = string.gsub(text,"%%2%%", p2) |
end |
if (p3) then |
text = string.gsub(text,"%%3%%", p3) |
end |
if (p4) then |
text = string.gsub(text,"%%4%%", p4) |
end |
if (p5) then |
text = string.gsub(text,"%%5%%", p5) |
end |
if (p6) then |
text = string.gsub(text,"%%6%%", p6) |
end |
if (p7) then |
text = string.gsub(text,"%%7%%", p7) |
end |
if (p8) then |
text = string.gsub(text,"%%8%%", p8) |
end |
if (p9) then |
text = string.gsub(text,"%%9%%", p9) |
end |
if string.match(text,"%%availablelotterytickets%%") then |
if player ~= nil and player ~= "" then |
local idx=GuildLottery:DataGetUserIdx( player, GL_LOTTERY ) |
if idx>=0 then |
local availcount = GL_Data.MaxLotteryTickets - GuildLottery:DataGetTicketCount(idx, GL_LOTTERY) |
text = string.gsub(text,"%%availablelotterytickets%%", availcount) |
else |
text = string.gsub(text,"%%availablelotterytickets%%", GL_Data.MaxLotteryTickets) |
end |
else |
text = nil |
end |
end |
if string.match(text,"%%availableraffletickets%%") then |
if player ~= nil and player ~= "" then |
local idx=GuildLottery:DataGetUserIdx( player, GL_RAFFLE ) |
if idx>=0 then |
local availcount = GL_Data.MaxRaffleTickets - GuildLottery:DataGetTicketCount(idx, GL_RAFFLE) |
text = string.gsub(text,"%%availableraffletickets%%", availcount) |
else |
text = string.gsub(text,"%%availableraffletickets%%", GL_Data.MaxLotteryTickets) |
end |
else |
text = nil |
end |
end |
if string.match(text,"%%playername%%") then |
if player ~= nil and player ~= "" then |
text = string.gsub(text,"%%playername%%",player) |
else |
text=nil |
end |
end |
if text~=nil and string.match(text,"%%soldlotterytickets%%") then |
text=nil |
if player ~= nil and player ~= "" then |
local idx=GuildLottery:DataGetUserIdx( player, GL_LOTTERY ) |
local tickets=GuildLottery:DataGetTickets(idx, GL_LOTTERY) |
local i,count |
local tickettext="" |
count=0 |
if (GuildLottery:DataGetTicketCount(idx, GL_LOTTERY) > 0) then |
for i=1, GuildLottery:DataGetTicketCount(idx, GL_LOTTERY), 1 do |
tickettext=tickettext..tickets[i].." " |
count=count+1 |
if count==5 then |
table.insert(parsed,tickettext) |
count=0 |
tickettext="" |
end |
end |
if tickettext~="" then |
table.insert(parsed,tickettext) |
end |
else |
table.insert(parsed,"No Tickets Bought") |
end |
end |
end |
if text~=nil and string.match(text,"%%soldraffletickets%%") then |
text=nil |
if player ~= nil and player ~= "" then |
local idx=GuildLottery:DataGetUserIdx( player, GL_RAFFLE ) |
local tickets=GuildLottery:DataGetTickets(idx, GL_RAFFLE) |
local i,count |
local tickettext="" |
count=0 |
if (GuildLottery:DataGetTicketCount(idx, GL_RAFFLE) > 0) then |
for i=1, GuildLottery:DataGetTicketCount(idx, GL_RAFFLE), 1 do |
tickettext=tickettext..tickets[i].." " |
count=count+1 |
if count==5 then |
table.insert(parsed,tickettext) |
count=0 |
tickettext="" |
end |
end |
if tickettext~="" then |
table.insert(parsed,tickettext) |
end |
else |
table.insert(parsed,"No Tickets Bought") |
end |
end |
end |
if text ~= nil then |
table.insert(parsed,text) |
end |
return parsed |
end |
function GuildLottery:AddSpam(spamType, ...) |
arg1 = ... |
table.insert(GL.SpamQueue, {spam=spamType, person=arg1 }) |
end |
local spamCmd={} |
function GuildLottery:SpamExist(spamType, ... ) |
local arg1 = ... |
for i=1, #GL.SpamQueue do |
spamCmd = GL.SpamQueue[i] |
if (spamCmd.spam == spamType) and (spamCmd.person==arg1) then |
return true |
end |
end |
end |
function GuildLottery:RemoveSpam( spamType, ...) |
local arg1 = ... |
for i=1, #GL.SpamQueue do |
spamCmd = GL.SpamQueue[i] |
if (spamCmd.spam == spamType) and (spamCmd.person==arg1) then |
table.remove(GL.SpamQueue,i) |
end |
end |
end |
function GuildLottery:TooltipCheckBox_OnClick() |
local checked = GLTooltipCheckBox:GetChecked() |
GL_Settings.Tooltips = checked or 0 |
end |
function GuildLottery:InvalidItemsCheckBox_OnClick() |
local checked = GLInvalidItemsCheckBox:GetChecked() |
GL_Settings.AllowInvalidItems = checked or 0 |
end |
function GuildLottery:MinimapCheckBox_OnClick() |
local checked = GLMinimapCheckBox:GetChecked() |
GL_Settings.ShowMinimap = checked or 0 |
GuildLottery:MinimapButton_Update() |
end |
function GuildLottery:LotteryAnnouncement_OnClick() |
local checked = GLCheckBoxLotteryAnnouncement:GetChecked() |
GL_Settings.UseLotteryAnnouncement = checked or 0 |
end |
function GuildLottery:WinnerAnnouncement_OnClick() |
local checked = GLCheckBoxWinnerAnnouncement:GetChecked() |
GL_Settings.UseWinnerAnnouncement = checked or 0 |
end |
function GuildLottery:CheckNotifications() |
local index=1; |
local name,_,_,_,_,_,_,_, online= GetGuildRosterInfo(index) |
local idx |
while (name) do |
idx = GuildLottery:DataGetUserIdx(name, 0) -- lottery |
if (idx>0) then |
-- this user have tickets |
-- is he notified ?? |
if (GuildLottery:DataGetNotified(idx, 0)==0 and online~=nil) then |
-- he was not, schedule a notification in 50 seconds ( gives time to the player if he just was logging on ) |
if (GuildLottery:SpamExist("Raffle", name ) == false ) then |
-- he was not, schedule a notification in 50 seconds ( gives time to the player if he just was logging on ) |
GuildLottery:AddSpam("Raffle", name ) |
GuildLottery:ScheduleTimer("SendRaffleInfo", 15, name) |
end |
end |
end |
idx = GuildLottery:DataGetUserIdx(name, 1) -- raffle |
if (idx>0) then |
-- this user have tickets |
-- is he notified ?? |
if (GuildLottery:DataGetNotified(idx, 1)==0 and online~=nil) then |
if (GuildLottery:SpamExist("Lottery", name ) == false ) then |
-- he was not, schedule a notification in 50 seconds ( gives time to the player if he just was logging on ) |
GuildLottery:AddSpam("Lottery", name ) |
GuildLottery:ScheduleTimer("SendLotteryInfo", 15, name) |
end |
end |
end |
index=index+1 |
name,_,_,_,_,_,_,_, online= GetGuildRosterInfo(index) |
end |
end |
local GLChannelInfo = {}; |
local loading = 1 |
function GL_ChannelDropDownMenu_OnLoad() |
GLChannelInfo.text = "Guild"; |
GLChannelInfo.value = GL_CHANNEL_GUILD; |
GLChannelInfo.func = GL_ChannelChanged |
-- can also be done as function() FunctionCalledWhenOptionIsClicked() end; |
-- Add the above information to the options menu as a button. |
UIDropDownMenu_AddButton(GLChannelInfo); |
GLChannelInfo.text = "Raid"; |
GLChannelInfo.value = GL_CHANNEL_RAID; |
GLChannelInfo.func = GL_ChannelChanged |
-- can also be done as function() FunctionCalledWhenOptionIsClicked() end; |
-- Add the above information to the options menu as a button. |
UIDropDownMenu_AddButton(GLChannelInfo); |
UIDropDownMenu_SetWidth(GLChannelDropDownMenuButton, 80); |
UIDropDownMenu_SetButtonWidth(GLChannelDropDownMenuButton, 100) |
-- TODO: This is a bandaid, for now |
if GL_Settings.Channel ~= nil then |
local channeltext |
UIDropDownMenu_SetSelectedID(GLChannelDropDownMenuButton, GL_Settings.Channel) |
if GL_Settings.Channel == GL_CHANNEL_RAID then |
UIDropDownMenu_SetText(GLChannelDropDownMenuButton,"Raid") |
else |
UIDropDownMenu_SetText(GLChannelDropDownMenuButton,"Guild") |
end |
end |
end |
function GL_ChannelChanged(self) |
UIDropDownMenu_SetSelectedID(GLChannelDropDownMenuButton, self:GetID()) |
GL_Settings.Channel = UIDropDownMenu_GetSelectedID(GLChannelDropDownMenuButton) |
if GL_Settings.Channel == GL_CHANNEL_GUILD then |
GLSpamButton:SetText(L["UI_SPAMGUILD"]) |
else |
GLSpamButton:SetText(L["UI_SPAMRAID"]) |
end |
end |
function GuildLottery:Test() |
-- GuildLottery:ScheduleTimer("SendRaffleInfo", 5, "Mordsbooty") |
GuildLottery:AddSpam("Raffle", "Mordsbooty") |
if (GuildLottery:SpamExist("Raffle", "Mordsbooty")) then |
GuildLottery:Print("Found 1") |
else |
GuildLottery:Print("Not Found 1") |
end |
GuildLottery:RemoveSpam("Raffle", "Mordsbooty") |
if (GuildLottery:SpamExist("Raffle", "Mordsbooty")) then |
GuildLottery:Print("Found 2") |
else |
GuildLottery:Print("Not Found 2") |
end |
end |
function GuildLottery:Debugging() |
if GL_Settings.Debuglevel > 0 then |
GL_Settings.Debuglevel = 0 |
else |
GL_Settings.Debuglevel = 1 |
end |
end |
<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"> |
<Script file="AceEvent-3.0.lua"/> |
</Ui> |
--- AceEvent-3.0 provides event registration and secure dispatching. |
-- All dispatching is done using **CallbackHandler-1.0**. AceEvent is a simple wrapper around |
-- CallbackHandler, and dispatches all game events or addon message to the registrees. |
-- |
-- **AceEvent-3.0** can be embeded into your addon, either explicitly by calling AceEvent:Embed(MyAddon) or by |
-- specifying it as an embeded library in your AceAddon. All functions will be available on your addon object |
-- and can be accessed directly, without having to explicitly call AceEvent itself.\\ |
-- It is recommended to embed AceEvent, otherwise you'll have to specify a custom `self` on all calls you |
-- make into AceEvent. |
-- @class file |
-- @name AceEvent-3.0 |
-- @release $Id: AceEvent-3.0.lua 975 2010-10-23 11:26:18Z nevcairiel $ |
local MAJOR, MINOR = "AceEvent-3.0", 3 |
local AceEvent = LibStub:NewLibrary(MAJOR, MINOR) |
if not AceEvent then return end |
-- Lua APIs |
local pairs = pairs |
local CallbackHandler = LibStub:GetLibrary("CallbackHandler-1.0") |
AceEvent.frame = AceEvent.frame or CreateFrame("Frame", "AceEvent30Frame") -- our event frame |
AceEvent.embeds = AceEvent.embeds or {} -- what objects embed this lib |
-- APIs and registry for blizzard events, using CallbackHandler lib |
if not AceEvent.events then |
AceEvent.events = CallbackHandler:New(AceEvent, |
"RegisterEvent", "UnregisterEvent", "UnregisterAllEvents") |
end |
function AceEvent.events:OnUsed(target, eventname) |
AceEvent.frame:RegisterEvent(eventname) |
end |
function AceEvent.events:OnUnused(target, eventname) |
AceEvent.frame:UnregisterEvent(eventname) |
end |
-- APIs and registry for IPC messages, using CallbackHandler lib |
if not AceEvent.messages then |
AceEvent.messages = CallbackHandler:New(AceEvent, |
"RegisterMessage", "UnregisterMessage", "UnregisterAllMessages" |
) |
AceEvent.SendMessage = AceEvent.messages.Fire |
end |
--- embedding and embed handling |
local mixins = { |
"RegisterEvent", "UnregisterEvent", |
"RegisterMessage", "UnregisterMessage", |
"SendMessage", |
"UnregisterAllEvents", "UnregisterAllMessages", |
} |
--- Register for a Blizzard Event. |
-- The callback will be called with the optional `arg` as the first argument (if supplied), and the event name as the second (or first, if no arg was supplied) |
-- Any arguments to the event will be passed on after that. |
-- @name AceEvent:RegisterEvent |
-- @class function |
-- @paramsig event[, callback [, arg]] |
-- @param event The event to register for |
-- @param callback The callback function to call when the event is triggered (funcref or method, defaults to a method with the event name) |
-- @param arg An optional argument to pass to the callback function |
--- Unregister an event. |
-- @name AceEvent:UnregisterEvent |
-- @class function |
-- @paramsig event |
-- @param event The event to unregister |
--- Register for a custom AceEvent-internal message. |
-- The callback will be called with the optional `arg` as the first argument (if supplied), and the event name as the second (or first, if no arg was supplied) |
-- Any arguments to the event will be passed on after that. |
-- @name AceEvent:RegisterMessage |
-- @class function |
-- @paramsig message[, callback [, arg]] |
-- @param message The message to register for |
-- @param callback The callback function to call when the message is triggered (funcref or method, defaults to a method with the event name) |
-- @param arg An optional argument to pass to the callback function |
--- Unregister a message |
-- @name AceEvent:UnregisterMessage |
-- @class function |
-- @paramsig message |
-- @param message The message to unregister |
--- Send a message over the AceEvent-3.0 internal message system to other addons registered for this message. |
-- @name AceEvent:SendMessage |
-- @class function |
-- @paramsig message, ... |
-- @param message The message to send |
-- @param ... Any arguments to the message |
-- Embeds AceEvent into the target object making the functions from the mixins list available on target:.. |
-- @param target target object to embed AceEvent in |
function AceEvent:Embed(target) |
for k, v in pairs(mixins) do |
target[v] = self[v] |
end |
self.embeds[target] = true |
return target |
end |
-- AceEvent:OnEmbedDisable( target ) |
-- target (object) - target object that is being disabled |
-- |
-- Unregister all events messages etc when the target disables. |
-- this method should be called by the target manually or by an addon framework |
function AceEvent:OnEmbedDisable(target) |
target:UnregisterAllEvents() |
target:UnregisterAllMessages() |
end |
-- Script to fire blizzard events into the event listeners |
local events = AceEvent.events |
AceEvent.frame:SetScript("OnEvent", function(this, event, ...) |
events:Fire(event, ...) |
end) |
--- Finally: upgrade our old embeds |
for target, v in pairs(AceEvent.embeds) do |
AceEvent:Embed(target) |
end |
<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"> |
<Script file="AceConsole-3.0.lua"/> |
</Ui> |
--- **AceConsole-3.0** provides registration facilities for slash commands. |
-- You can register slash commands to your custom functions and use the `GetArgs` function to parse them |
-- to your addons individual needs. |
-- |
-- **AceConsole-3.0** can be embeded into your addon, either explicitly by calling AceConsole:Embed(MyAddon) or by |
-- specifying it as an embeded library in your AceAddon. All functions will be available on your addon object |
-- and can be accessed directly, without having to explicitly call AceConsole itself.\\ |
-- It is recommended to embed AceConsole, otherwise you'll have to specify a custom `self` on all calls you |
-- make into AceConsole. |
-- @class file |
-- @name AceConsole-3.0 |
-- @release $Id: AceConsole-3.0.lua 878 2009-11-02 18:51:58Z nevcairiel $ |
local MAJOR,MINOR = "AceConsole-3.0", 7 |
local AceConsole, oldminor = LibStub:NewLibrary(MAJOR, MINOR) |
if not AceConsole then return end -- No upgrade needed |
AceConsole.embeds = AceConsole.embeds or {} -- table containing objects AceConsole is embedded in. |
AceConsole.commands = AceConsole.commands or {} -- table containing commands registered |
AceConsole.weakcommands = AceConsole.weakcommands or {} -- table containing self, command => func references for weak commands that don't persist through enable/disable |
-- Lua APIs |
local tconcat, tostring, select = table.concat, tostring, select |
local type, pairs, error = type, pairs, error |
local format, strfind, strsub = string.format, string.find, string.sub |
local max = math.max |
-- WoW APIs |
local _G = _G |
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded |
-- List them here for Mikk's FindGlobals script |
-- GLOBALS: DEFAULT_CHAT_FRAME, SlashCmdList, hash_SlashCmdList |
local tmp={} |
local function Print(self,frame,...) |
local n=0 |
if self ~= AceConsole then |
n=n+1 |
tmp[n] = "|cff33ff99"..tostring( self ).."|r:" |
end |
for i=1, select("#", ...) do |
n=n+1 |
tmp[n] = tostring(select(i, ...)) |
end |
frame:AddMessage( tconcat(tmp," ",1,n) ) |
end |
--- Print to DEFAULT_CHAT_FRAME or given ChatFrame (anything with an .AddMessage function) |
-- @paramsig [chatframe ,] ... |
-- @param chatframe Custom ChatFrame to print to (or any frame with an .AddMessage function) |
-- @param ... List of any values to be printed |
function AceConsole:Print(...) |
local frame = ... |
if type(frame) == "table" and frame.AddMessage then -- Is first argument something with an .AddMessage member? |
return Print(self, frame, select(2,...)) |
else |
return Print(self, DEFAULT_CHAT_FRAME, ...) |
end |
end |
--- Formatted (using format()) print to DEFAULT_CHAT_FRAME or given ChatFrame (anything with an .AddMessage function) |
-- @paramsig [chatframe ,] "format"[, ...] |
-- @param chatframe Custom ChatFrame to print to (or any frame with an .AddMessage function) |
-- @param format Format string - same syntax as standard Lua format() |
-- @param ... Arguments to the format string |
function AceConsole:Printf(...) |
local frame = ... |
if type(frame) == "table" and frame.AddMessage then -- Is first argument something with an .AddMessage member? |
return Print(self, frame, format(select(2,...))) |
else |
return Print(self, DEFAULT_CHAT_FRAME, format(...)) |
end |
end |
--- Register a simple chat command |
-- @param command Chat command to be registered WITHOUT leading "/" |
-- @param func Function to call when the slash command is being used (funcref or methodname) |
-- @param persist if false, the command will be soft disabled/enabled when aceconsole is used as a mixin (default: true) |
function AceConsole:RegisterChatCommand( command, func, persist ) |
if type(command)~="string" then error([[Usage: AceConsole:RegisterChatCommand( "command", func[, persist ]): 'command' - expected a string]], 2) end |
if persist==nil then persist=true end -- I'd rather have my addon's "/addon enable" around if the author screws up. Having some extra slash regged when it shouldnt be isn't as destructive. True is a better default. /Mikk |
local name = "ACECONSOLE_"..command:upper() |
if type( func ) == "string" then |
SlashCmdList[name] = function(input, editBox) |
self[func](self, input, editBox) |
end |
else |
SlashCmdList[name] = func |
end |
_G["SLASH_"..name.."1"] = "/"..command:lower() |
AceConsole.commands[command] = name |
-- non-persisting commands are registered for enabling disabling |
if not persist then |
if not AceConsole.weakcommands[self] then AceConsole.weakcommands[self] = {} end |
AceConsole.weakcommands[self][command] = func |
end |
return true |
end |
--- Unregister a chatcommand |
-- @param command Chat command to be unregistered WITHOUT leading "/" |
function AceConsole:UnregisterChatCommand( command ) |
local name = AceConsole.commands[command] |
if name then |
SlashCmdList[name] = nil |
_G["SLASH_" .. name .. "1"] = nil |
hash_SlashCmdList["/" .. command:upper()] = nil |
AceConsole.commands[command] = nil |
end |
end |
--- Get an iterator over all Chat Commands registered with AceConsole |
-- @return Iterator (pairs) over all commands |
function AceConsole:IterateChatCommands() return pairs(AceConsole.commands) end |
local function nils(n, ...) |
if n>1 then |
return nil, nils(n-1, ...) |
elseif n==1 then |
return nil, ... |
else |
return ... |
end |
end |
--- Retreive one or more space-separated arguments from a string. |
-- Treats quoted strings and itemlinks as non-spaced. |
-- @param string The raw argument string |
-- @param numargs How many arguments to get (default 1) |
-- @param startpos Where in the string to start scanning (default 1) |
-- @return Returns arg1, arg2, ..., nextposition\\ |
-- Missing arguments will be returned as nils. 'nextposition' is returned as 1e9 at the end of the string. |
function AceConsole:GetArgs(str, numargs, startpos) |
numargs = numargs or 1 |
startpos = max(startpos or 1, 1) |
local pos=startpos |
-- find start of new arg |
pos = strfind(str, "[^ ]", pos) |
if not pos then -- whoops, end of string |
return nils(numargs, 1e9) |
end |
if numargs<1 then |
return pos |
end |
-- quoted or space separated? find out which pattern to use |
local delim_or_pipe |
local ch = strsub(str, pos, pos) |
if ch=='"' then |
pos = pos + 1 |
delim_or_pipe='([|"])' |
elseif ch=="'" then |
pos = pos + 1 |
delim_or_pipe="([|'])" |
else |
delim_or_pipe="([| ])" |
end |
startpos = pos |
while true do |
-- find delimiter or hyperlink |
local ch,_ |
pos,_,ch = strfind(str, delim_or_pipe, pos) |
if not pos then break end |
if ch=="|" then |
-- some kind of escape |
if strsub(str,pos,pos+1)=="|H" then |
-- It's a |H....|hhyper link!|h |
pos=strfind(str, "|h", pos+2) -- first |h |
if not pos then break end |
pos=strfind(str, "|h", pos+2) -- second |h |
if not pos then break end |
elseif strsub(str,pos, pos+1) == "|T" then |
-- It's a |T....|t texture |
pos=strfind(str, "|t", pos+2) |
if not pos then break end |
end |
pos=pos+2 -- skip past this escape (last |h if it was a hyperlink) |
else |
-- found delimiter, done with this arg |
return strsub(str, startpos, pos-1), AceConsole:GetArgs(str, numargs-1, pos+1) |
end |
end |
-- search aborted, we hit end of string. return it all as one argument. (yes, even if it's an unterminated quote or hyperlink) |
return strsub(str, startpos), nils(numargs-1, 1e9) |
end |
--- embedding and embed handling |
local mixins = { |
"Print", |
"Printf", |
"RegisterChatCommand", |
"UnregisterChatCommand", |
"GetArgs", |
} |
-- Embeds AceConsole into the target object making the functions from the mixins list available on target:.. |
-- @param target target object to embed AceBucket in |
function AceConsole:Embed( target ) |
for k, v in pairs( mixins ) do |
target[v] = self[v] |
end |
self.embeds[target] = true |
return target |
end |
function AceConsole:OnEmbedEnable( target ) |
if AceConsole.weakcommands[target] then |
for command, func in pairs( AceConsole.weakcommands[target] ) do |
target:RegisterChatCommand( command, func, false, true ) -- nonpersisting and silent registry |
end |
end |
end |
function AceConsole:OnEmbedDisable( target ) |
if AceConsole.weakcommands[target] then |
for command, func in pairs( AceConsole.weakcommands[target] ) do |
target:UnregisterChatCommand( command ) -- TODO: this could potentially unregister a command from another application in case of command conflicts. Do we care? |
end |
end |
end |
for addon in pairs(AceConsole.embeds) do |
AceConsole:Embed(addon) |
end |
<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"> |
<Script file="AceAddon-3.0.lua"/> |
</Ui> |
--- **AceAddon-3.0** provides a template for creating addon objects. |
-- It'll provide you with a set of callback functions that allow you to simplify the loading |
-- process of your addon.\\ |
-- Callbacks provided are:\\ |
-- * **OnInitialize**, which is called directly after the addon is fully loaded. |
-- * **OnEnable** which gets called during the PLAYER_LOGIN event, when most of the data provided by the game is already present. |
-- * **OnDisable**, which is only called when your addon is manually being disabled. |
-- @usage |
-- -- A small (but complete) addon, that doesn't do anything, |
-- -- but shows usage of the callbacks. |
-- local MyAddon = LibStub("AceAddon-3.0"):NewAddon("MyAddon") |
-- |
-- function MyAddon:OnInitialize() |
-- -- do init tasks here, like loading the Saved Variables, |
-- -- or setting up slash commands. |
-- end |
-- |
-- function MyAddon:OnEnable() |
-- -- Do more initialization here, that really enables the use of your addon. |
-- -- Register Events, Hook functions, Create Frames, Get information from |
-- -- the game that wasn't available in OnInitialize |
-- end |
-- |
-- function MyAddon:OnDisable() |
-- -- Unhook, Unregister Events, Hide frames that you created. |
-- -- You would probably only use an OnDisable if you want to |
-- -- build a "standby" mode, or be able to toggle modules on/off. |
-- end |
-- @class file |
-- @name AceAddon-3.0.lua |
-- @release $Id: AceAddon-3.0.lua 980 2010-10-27 14:20:11Z nevcairiel $ |
local MAJOR, MINOR = "AceAddon-3.0", 10 |
local AceAddon, oldminor = LibStub:NewLibrary(MAJOR, MINOR) |
if not AceAddon then return end -- No Upgrade needed. |
AceAddon.frame = AceAddon.frame or CreateFrame("Frame", "AceAddon30Frame") -- Our very own frame |
AceAddon.addons = AceAddon.addons or {} -- addons in general |
AceAddon.statuses = AceAddon.statuses or {} -- statuses of addon. |
AceAddon.initializequeue = AceAddon.initializequeue or {} -- addons that are new and not initialized |
AceAddon.enablequeue = AceAddon.enablequeue or {} -- addons that are initialized and waiting to be enabled |
AceAddon.embeds = AceAddon.embeds or setmetatable({}, {__index = function(tbl, key) tbl[key] = {} return tbl[key] end }) -- contains a list of libraries embedded in an addon |
-- Lua APIs |
local tinsert, tconcat, tremove = table.insert, table.concat, table.remove |
local fmt, tostring = string.format, tostring |
local select, pairs, next, type, unpack = select, pairs, next, type, unpack |
local loadstring, assert, error = loadstring, assert, error |
local setmetatable, getmetatable, rawset, rawget = setmetatable, getmetatable, rawset, rawget |
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded |
-- List them here for Mikk's FindGlobals script |
-- GLOBALS: LibStub, IsLoggedIn, geterrorhandler |
--[[ |
xpcall safecall implementation |
]] |
local xpcall = xpcall |
local function errorhandler(err) |
return geterrorhandler()(err) |
end |
local function CreateDispatcher(argCount) |
local code = [[ |
local xpcall, eh = ... |
local method, ARGS |
local function call() return method(ARGS) end |
local function dispatch(func, ...) |
method = func |
if not method then return end |
ARGS = ... |
return xpcall(call, eh) |
end |
return dispatch |
]] |
local ARGS = {} |
for i = 1, argCount do ARGS[i] = "arg"..i end |
code = code:gsub("ARGS", tconcat(ARGS, ", ")) |
return assert(loadstring(code, "safecall Dispatcher["..argCount.."]"))(xpcall, errorhandler) |
end |
local Dispatchers = setmetatable({}, {__index=function(self, argCount) |
local dispatcher = CreateDispatcher(argCount) |
rawset(self, argCount, dispatcher) |
return dispatcher |
end}) |
Dispatchers[0] = function(func) |
return xpcall(func, errorhandler) |
end |
local function safecall(func, ...) |
-- we check to see if the func is passed is actually a function here and don't error when it isn't |
-- this safecall is used for optional functions like OnInitialize OnEnable etc. When they are not |
-- present execution should continue without hinderance |
if type(func) == "function" then |
return Dispatchers[select('#', ...)](func, ...) |
end |
end |
-- local functions that will be implemented further down |
local Enable, Disable, EnableModule, DisableModule, Embed, NewModule, GetModule, GetName, SetDefaultModuleState, SetDefaultModuleLibraries, SetEnabledState, SetDefaultModulePrototype |
-- used in the addon metatable |
local function addontostring( self ) return self.name end |
--- Create a new AceAddon-3.0 addon. |
-- Any libraries you specified will be embeded, and the addon will be scheduled for |
-- its OnInitialize and OnEnable callbacks. |
-- The final addon object, with all libraries embeded, will be returned. |
-- @paramsig [object ,]name[, lib, ...] |
-- @param object Table to use as a base for the addon (optional) |
-- @param name Name of the addon object to create |
-- @param lib List of libraries to embed into the addon |
-- @usage |
-- -- Create a simple addon object |
-- MyAddon = LibStub("AceAddon-3.0"):NewAddon("MyAddon", "AceEvent-3.0") |
-- |
-- -- Create a Addon object based on the table of a frame |
-- local MyFrame = CreateFrame("Frame") |
-- MyAddon = LibStub("AceAddon-3.0"):NewAddon(MyFrame, "MyAddon", "AceEvent-3.0") |
function AceAddon:NewAddon(objectorname, ...) |
local object,name |
local i=1 |
if type(objectorname)=="table" then |
object=objectorname |
name=... |
i=2 |
else |
name=objectorname |
end |
if type(name)~="string" then |
error(("Usage: NewAddon([object,] name, [lib, lib, lib, ...]): 'name' - string expected got '%s'."):format(type(name)), 2) |
end |
if self.addons[name] then |
error(("Usage: NewAddon([object,] name, [lib, lib, lib, ...]): 'name' - Addon '%s' already exists."):format(name), 2) |
end |
object = object or {} |
object.name = name |
local addonmeta = {} |
local oldmeta = getmetatable(object) |
if oldmeta then |
for k, v in pairs(oldmeta) do addonmeta[k] = v end |
end |
addonmeta.__tostring = addontostring |
setmetatable( object, addonmeta ) |
self.addons[name] = object |
object.modules = {} |
object.orderedModules = {} |
object.defaultModuleLibraries = {} |
Embed( object ) -- embed NewModule, GetModule methods |
self:EmbedLibraries(object, select(i,...)) |
-- add to queue of addons to be initialized upon ADDON_LOADED |
tinsert(self.initializequeue, object) |
return object |
end |
--- Get the addon object by its name from the internal AceAddon registry. |
-- Throws an error if the addon object cannot be found (except if silent is set). |
-- @param name unique name of the addon object |
-- @param silent if true, the addon is optional, silently return nil if its not found |
-- @usage |
-- -- Get the Addon |
-- MyAddon = LibStub("AceAddon-3.0"):GetAddon("MyAddon") |
function AceAddon:GetAddon(name, silent) |
if not silent and not self.addons[name] then |
error(("Usage: GetAddon(name): 'name' - Cannot find an AceAddon '%s'."):format(tostring(name)), 2) |
end |
return self.addons[name] |
end |
-- - Embed a list of libraries into the specified addon. |
-- This function will try to embed all of the listed libraries into the addon |
-- and error if a single one fails. |
-- |
-- **Note:** This function is for internal use by :NewAddon/:NewModule |
-- @paramsig addon, [lib, ...] |
-- @param addon addon object to embed the libs in |
-- @param lib List of libraries to embed into the addon |
function AceAddon:EmbedLibraries(addon, ...) |
for i=1,select("#", ... ) do |
local libname = select(i, ...) |
self:EmbedLibrary(addon, libname, false, 4) |
end |
end |
-- - Embed a library into the addon object. |
-- This function will check if the specified library is registered with LibStub |
-- and if it has a :Embed function to call. It'll error if any of those conditions |
-- fails. |
-- |
-- **Note:** This function is for internal use by :EmbedLibraries |
-- @paramsig addon, libname[, silent[, offset]] |
-- @param addon addon object to embed the library in |
-- @param libname name of the library to embed |
-- @param silent marks an embed to fail silently if the library doesn't exist (optional) |
-- @param offset will push the error messages back to said offset, defaults to 2 (optional) |
function AceAddon:EmbedLibrary(addon, libname, silent, offset) |
local lib = LibStub:GetLibrary(libname, true) |
if not lib and not silent then |
error(("Usage: EmbedLibrary(addon, libname, silent, offset): 'libname' - Cannot find a library instance of %q."):format(tostring(libname)), offset or 2) |
elseif lib and type(lib.Embed) == "function" then |
lib:Embed(addon) |
tinsert(self.embeds[addon], libname) |
return true |
elseif lib then |
error(("Usage: EmbedLibrary(addon, libname, silent, offset): 'libname' - Library '%s' is not Embed capable"):format(libname), offset or 2) |
end |
end |
--- Return the specified module from an addon object. |
-- Throws an error if the addon object cannot be found (except if silent is set) |
-- @name //addon//:GetModule |
-- @paramsig name[, silent] |
-- @param name unique name of the module |
-- @param silent if true, the module is optional, silently return nil if its not found (optional) |
-- @usage |
-- -- Get the Addon |
-- MyAddon = LibStub("AceAddon-3.0"):GetAddon("MyAddon") |
-- -- Get the Module |
-- MyModule = MyAddon:GetModule("MyModule") |
function GetModule(self, name, silent) |
if not self.modules[name] and not silent then |
error(("Usage: GetModule(name, silent): 'name' - Cannot find module '%s'."):format(tostring(name)), 2) |
end |
return self.modules[name] |
end |
local function IsModuleTrue(self) return true end |
--- Create a new module for the addon. |
-- The new module can have its own embeded libraries and/or use a module prototype to be mixed into the module.\\ |
-- A module has the same functionality as a real addon, it can have modules of its own, and has the same API as |
-- an addon object. |
-- @name //addon//:NewModule |
-- @paramsig name[, prototype|lib[, lib, ...]] |
-- @param name unique name of the module |
-- @param prototype object to derive this module from, methods and values from this table will be mixed into the module (optional) |
-- @param lib List of libraries to embed into the addon |
-- @usage |
-- -- Create a module with some embeded libraries |
-- MyModule = MyAddon:NewModule("MyModule", "AceEvent-3.0", "AceHook-3.0") |
-- |
-- -- Create a module with a prototype |
-- local prototype = { OnEnable = function(self) print("OnEnable called!") end } |
-- MyModule = MyAddon:NewModule("MyModule", prototype, "AceEvent-3.0", "AceHook-3.0") |
function NewModule(self, name, prototype, ...) |
if type(name) ~= "string" then error(("Usage: NewModule(name, [prototype, [lib, lib, lib, ...]): 'name' - string expected got '%s'."):format(type(name)), 2) end |
if type(prototype) ~= "string" and type(prototype) ~= "table" and type(prototype) ~= "nil" then error(("Usage: NewModule(name, [prototype, [lib, lib, lib, ...]): 'prototype' - table (prototype), string (lib) or nil expected got '%s'."):format(type(prototype)), 2) end |
if self.modules[name] then error(("Usage: NewModule(name, [prototype, [lib, lib, lib, ...]): 'name' - Module '%s' already exists."):format(name), 2) end |
-- modules are basically addons. We treat them as such. They will be added to the initializequeue properly as well. |
-- NewModule can only be called after the parent addon is present thus the modules will be initialized after their parent is. |
local module = AceAddon:NewAddon(fmt("%s_%s", self.name or tostring(self), name)) |
module.IsModule = IsModuleTrue |
module:SetEnabledState(self.defaultModuleState) |
module.moduleName = name |
if type(prototype) == "string" then |
AceAddon:EmbedLibraries(module, prototype, ...) |
else |
AceAddon:EmbedLibraries(module, ...) |
end |
AceAddon:EmbedLibraries(module, unpack(self.defaultModuleLibraries)) |
if not prototype or type(prototype) == "string" then |
prototype = self.defaultModulePrototype or nil |
end |
if type(prototype) == "table" then |
local mt = getmetatable(module) |
mt.__index = prototype |
setmetatable(module, mt) -- More of a Base class type feel. |
end |
safecall(self.OnModuleCreated, self, module) -- Was in Ace2 and I think it could be a cool thing to have handy. |
self.modules[name] = module |
tinsert(self.orderedModules, module) |
return module |
end |
--- Returns the real name of the addon or module, without any prefix. |
-- @name //addon//:GetName |
-- @paramsig |
-- @usage |
-- print(MyAddon:GetName()) |
-- -- prints "MyAddon" |
function GetName(self) |
return self.moduleName or self.name |
end |
--- Enables the Addon, if possible, return true or false depending on success. |
-- This internally calls AceAddon:EnableAddon(), thus dispatching a OnEnable callback |
-- and enabling all modules of the addon (unless explicitly disabled).\\ |
-- :Enable() also sets the internal `enableState` variable to true |
-- @name //addon//:Enable |
-- @paramsig |
-- @usage |
-- -- Enable MyModule |
-- MyAddon = LibStub("AceAddon-3.0"):GetAddon("MyAddon") |
-- MyModule = MyAddon:GetModule("MyModule") |
-- MyModule:Enable() |
function Enable(self) |
self:SetEnabledState(true) |
return AceAddon:EnableAddon(self) |
end |
--- Disables the Addon, if possible, return true or false depending on success. |
-- This internally calls AceAddon:DisableAddon(), thus dispatching a OnDisable callback |
-- and disabling all modules of the addon.\\ |
-- :Disable() also sets the internal `enableState` variable to false |
-- @name //addon//:Disable |
-- @paramsig |
-- @usage |
-- -- Disable MyAddon |
-- MyAddon = LibStub("AceAddon-3.0"):GetAddon("MyAddon") |
-- MyAddon:Disable() |
function Disable(self) |
self:SetEnabledState(false) |
return AceAddon:DisableAddon(self) |
end |
--- Enables the Module, if possible, return true or false depending on success. |
-- Short-hand function that retrieves the module via `:GetModule` and calls `:Enable` on the module object. |
-- @name //addon//:EnableModule |
-- @paramsig name |
-- @usage |
-- -- Enable MyModule using :GetModule |
-- MyAddon = LibStub("AceAddon-3.0"):GetAddon("MyAddon") |
-- MyModule = MyAddon:GetModule("MyModule") |
-- MyModule:Enable() |
-- |
-- -- Enable MyModule using the short-hand |
-- MyAddon = LibStub("AceAddon-3.0"):GetAddon("MyAddon") |
-- MyAddon:EnableModule("MyModule") |
function EnableModule(self, name) |
local module = self:GetModule( name ) |
return module:Enable() |
end |
--- Disables the Module, if possible, return true or false depending on success. |
-- Short-hand function that retrieves the module via `:GetModule` and calls `:Disable` on the module object. |
-- @name //addon//:DisableModule |
-- @paramsig name |
-- @usage |
-- -- Disable MyModule using :GetModule |
-- MyAddon = LibStub("AceAddon-3.0"):GetAddon("MyAddon") |
-- MyModule = MyAddon:GetModule("MyModule") |
-- MyModule:Disable() |
-- |
-- -- Disable MyModule using the short-hand |
-- MyAddon = LibStub("AceAddon-3.0"):GetAddon("MyAddon") |
-- MyAddon:DisableModule("MyModule") |
function DisableModule(self, name) |
local module = self:GetModule( name ) |
return module:Disable() |
end |
--- Set the default libraries to be mixed into all modules created by this object. |
-- Note that you can only change the default module libraries before any module is created. |
-- @name //addon//:SetDefaultModuleLibraries |
-- @paramsig lib[, lib, ...] |
-- @param lib List of libraries to embed into the addon |
-- @usage |
-- -- Create the addon object |
-- MyAddon = LibStub("AceAddon-3.0"):NewAddon("MyAddon") |
-- -- Configure default libraries for modules (all modules need AceEvent-3.0) |
-- MyAddon:SetDefaultModuleLibraries("AceEvent-3.0") |
-- -- Create a module |
-- MyModule = MyAddon:NewModule("MyModule") |
function SetDefaultModuleLibraries(self, ...) |
if next(self.modules) then |
error("Usage: SetDefaultModuleLibraries(...): cannot change the module defaults after a module has been registered.", 2) |
end |
self.defaultModuleLibraries = {...} |
end |
--- Set the default state in which new modules are being created. |
-- Note that you can only change the default state before any module is created. |
-- @name //addon//:SetDefaultModuleState |
-- @paramsig state |
-- @param state Default state for new modules, true for enabled, false for disabled |
-- @usage |
-- -- Create the addon object |
-- MyAddon = LibStub("AceAddon-3.0"):NewAddon("MyAddon") |
-- -- Set the default state to "disabled" |
-- MyAddon:SetDefaultModuleState(false) |
-- -- Create a module and explicilty enable it |
-- MyModule = MyAddon:NewModule("MyModule") |
-- MyModule:Enable() |
function SetDefaultModuleState(self, state) |
if next(self.modules) then |
error("Usage: SetDefaultModuleState(state): cannot change the module defaults after a module has been registered.", 2) |
end |
self.defaultModuleState = state |
end |
--- Set the default prototype to use for new modules on creation. |
-- Note that you can only change the default prototype before any module is created. |
-- @name //addon//:SetDefaultModulePrototype |
-- @paramsig prototype |
-- @param prototype Default prototype for the new modules (table) |
-- @usage |
-- -- Define a prototype |
-- local prototype = { OnEnable = function(self) print("OnEnable called!") end } |
-- -- Set the default prototype |
-- MyAddon:SetDefaultModulePrototype(prototype) |
-- -- Create a module and explicitly Enable it |
-- MyModule = MyAddon:NewModule("MyModule") |
-- MyModule:Enable() |
-- -- should print "OnEnable called!" now |
-- @see NewModule |
function SetDefaultModulePrototype(self, prototype) |
if next(self.modules) then |
error("Usage: SetDefaultModulePrototype(prototype): cannot change the module defaults after a module has been registered.", 2) |
end |
if type(prototype) ~= "table" then |
error(("Usage: SetDefaultModulePrototype(prototype): 'prototype' - table expected got '%s'."):format(type(prototype)), 2) |
end |
self.defaultModulePrototype = prototype |
end |
--- Set the state of an addon or module |
-- This should only be called before any enabling actually happend, e.g. in/before OnInitialize. |
-- @name //addon//:SetEnabledState |
-- @paramsig state |
-- @param state the state of an addon or module (enabled=true, disabled=false) |
function SetEnabledState(self, state) |
self.enabledState = state |
end |
--- Return an iterator of all modules associated to the addon. |
-- @name //addon//:IterateModules |
-- @paramsig |
-- @usage |
-- -- Enable all modules |
-- for name, module in MyAddon:IterateModules() do |
-- module:Enable() |
-- end |
local function IterateModules(self) return pairs(self.modules) end |
-- Returns an iterator of all embeds in the addon |
-- @name //addon//:IterateEmbeds |
-- @paramsig |
local function IterateEmbeds(self) return pairs(AceAddon.embeds[self]) end |
--- Query the enabledState of an addon. |
-- @name //addon//:IsEnabled |
-- @paramsig |
-- @usage |
-- if MyAddon:IsEnabled() then |
-- MyAddon:Disable() |
-- end |
local function IsEnabled(self) return self.enabledState end |
local mixins = { |
NewModule = NewModule, |
GetModule = GetModule, |
Enable = Enable, |
Disable = Disable, |
EnableModule = EnableModule, |
DisableModule = DisableModule, |
IsEnabled = IsEnabled, |
SetDefaultModuleLibraries = SetDefaultModuleLibraries, |
SetDefaultModuleState = SetDefaultModuleState, |
SetDefaultModulePrototype = SetDefaultModulePrototype, |
SetEnabledState = SetEnabledState, |
IterateModules = IterateModules, |
IterateEmbeds = IterateEmbeds, |
GetName = GetName, |
} |
local function IsModule(self) return false end |
local pmixins = { |
defaultModuleState = true, |
enabledState = true, |
IsModule = IsModule, |
} |
-- Embed( target ) |
-- target (object) - target object to embed aceaddon in |
-- |
-- this is a local function specifically since it's meant to be only called internally |
function Embed(target, skipPMixins) |
for k, v in pairs(mixins) do |
target[k] = v |
end |
if not skipPMixins then |
for k, v in pairs(pmixins) do |
target[k] = target[k] or v |
end |
end |
end |
-- - Initialize the addon after creation. |
-- This function is only used internally during the ADDON_LOADED event |
-- It will call the **OnInitialize** function on the addon object (if present), |
-- and the **OnEmbedInitialize** function on all embeded libraries. |
-- |
-- **Note:** Do not call this function manually, unless you're absolutely sure that you know what you are doing. |
-- @param addon addon object to intialize |
function AceAddon:InitializeAddon(addon) |
safecall(addon.OnInitialize, addon) |
local embeds = self.embeds[addon] |
for i = 1, #embeds do |
local lib = LibStub:GetLibrary(embeds[i], true) |
if lib then safecall(lib.OnEmbedInitialize, lib, addon) end |
end |
-- we don't call InitializeAddon on modules specifically, this is handled |
-- from the event handler and only done _once_ |
end |
-- - Enable the addon after creation. |
-- Note: This function is only used internally during the PLAYER_LOGIN event, or during ADDON_LOADED, |
-- if IsLoggedIn() already returns true at that point, e.g. for LoD Addons. |
-- It will call the **OnEnable** function on the addon object (if present), |
-- and the **OnEmbedEnable** function on all embeded libraries.\\ |
-- This function does not toggle the enable state of the addon itself, and will return early if the addon is disabled. |
-- |
-- **Note:** Do not call this function manually, unless you're absolutely sure that you know what you are doing. |
-- Use :Enable on the addon itself instead. |
-- @param addon addon object to enable |
function AceAddon:EnableAddon(addon) |
if type(addon) == "string" then addon = AceAddon:GetAddon(addon) end |
if self.statuses[addon.name] or not addon.enabledState then return false end |
-- set the statuses first, before calling the OnEnable. this allows for Disabling of the addon in OnEnable. |
self.statuses[addon.name] = true |
safecall(addon.OnEnable, addon) |
-- make sure we're still enabled before continueing |
if self.statuses[addon.name] then |
local embeds = self.embeds[addon] |
for i = 1, #embeds do |
local lib = LibStub:GetLibrary(embeds[i], true) |
if lib then safecall(lib.OnEmbedEnable, lib, addon) end |
end |
-- enable possible modules. |
local modules = addon.orderedModules |
for i = 1, #modules do |
self:EnableAddon(modules[i]) |
end |
end |
return self.statuses[addon.name] -- return true if we're disabled |
end |
-- - Disable the addon |
-- Note: This function is only used internally. |
-- It will call the **OnDisable** function on the addon object (if present), |
-- and the **OnEmbedDisable** function on all embeded libraries.\\ |
-- This function does not toggle the enable state of the addon itself, and will return early if the addon is still enabled. |
-- |
-- **Note:** Do not call this function manually, unless you're absolutely sure that you know what you are doing. |
-- Use :Disable on the addon itself instead. |
-- @param addon addon object to enable |
function AceAddon:DisableAddon(addon) |
if type(addon) == "string" then addon = AceAddon:GetAddon(addon) end |
if not self.statuses[addon.name] then return false end |
-- set statuses first before calling OnDisable, this allows for aborting the disable in OnDisable. |
self.statuses[addon.name] = false |
safecall( addon.OnDisable, addon ) |
-- make sure we're still disabling... |
if not self.statuses[addon.name] then |
local embeds = self.embeds[addon] |
for i = 1, #embeds do |
local lib = LibStub:GetLibrary(embeds[i], true) |
if lib then safecall(lib.OnEmbedDisable, lib, addon) end |
end |
-- disable possible modules. |
local modules = addon.orderedModules |
for i = 1, #modules do |
self:DisableAddon(modules[i]) |
end |
end |
return not self.statuses[addon.name] -- return true if we're disabled |
end |
--- Get an iterator over all registered addons. |
-- @usage |
-- -- Print a list of all installed AceAddon's |
-- for name, addon in AceAddon:IterateAddons() do |
-- print("Addon: " .. name) |
-- end |
function AceAddon:IterateAddons() return pairs(self.addons) end |
--- Get an iterator over the internal status registry. |
-- @usage |
-- -- Print a list of all enabled addons |
-- for name, status in AceAddon:IterateAddonStatus() do |
-- if status then |
-- print("EnabledAddon: " .. name) |
-- end |
-- end |
function AceAddon:IterateAddonStatus() return pairs(self.statuses) end |
-- Following Iterators are deprecated, and their addon specific versions should be used |
-- e.g. addon:IterateEmbeds() instead of :IterateEmbedsOnAddon(addon) |
function AceAddon:IterateEmbedsOnAddon(addon) return pairs(self.embeds[addon]) end |
function AceAddon:IterateModulesOfAddon(addon) return pairs(addon.modules) end |
-- Event Handling |
local function onEvent(this, event, arg1) |
if event == "ADDON_LOADED" or event == "PLAYER_LOGIN" then |
-- if a addon loads another addon, recursion could happen here, so we need to validate the table on every iteration |
while(#AceAddon.initializequeue > 0) do |
local addon = tremove(AceAddon.initializequeue, 1) |
-- this might be an issue with recursion - TODO: validate |
if event == "ADDON_LOADED" then addon.baseName = arg1 end |
AceAddon:InitializeAddon(addon) |
tinsert(AceAddon.enablequeue, addon) |
end |
if IsLoggedIn() then |
while(#AceAddon.enablequeue > 0) do |
local addon = tremove(AceAddon.enablequeue, 1) |
AceAddon:EnableAddon(addon) |
end |
end |
end |
end |
AceAddon.frame:RegisterEvent("ADDON_LOADED") |
AceAddon.frame:RegisterEvent("PLAYER_LOGIN") |
AceAddon.frame:SetScript("OnEvent", onEvent) |
-- upgrade embeded |
for name, addon in pairs(AceAddon.addons) do |
Embed(addon, true) |
end |
-- 2010-10-27 nevcairiel - add new "orderedModules" table |
if oldminor and oldminor < 10 then |
for name, addon in pairs(AceAddon.addons) do |
addon.orderedModules = {} |
for module_name, module in pairs(addon.modules) do |
tinsert(addon.orderedModules, module) |
end |
end |
end |
-- LibStub is a simple versioning stub meant for use in Libraries. http://www.wowace.com/wiki/LibStub for more info |
-- LibStub is hereby placed in the Public Domain Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke |
local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 2 -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS! |
local LibStub = _G[LIBSTUB_MAJOR] |
if not LibStub or LibStub.minor < LIBSTUB_MINOR then |
LibStub = LibStub or {libs = {}, minors = {} } |
_G[LIBSTUB_MAJOR] = LibStub |
LibStub.minor = LIBSTUB_MINOR |
function LibStub:NewLibrary(major, minor) |
assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)") |
minor = assert(tonumber(strmatch(minor, "%d+")), "Minor version must either be a number or contain a number.") |
local oldminor = self.minors[major] |
if oldminor and oldminor >= minor then return nil end |
self.minors[major], self.libs[major] = minor, self.libs[major] or {} |
return self.libs[major], oldminor |
end |
function LibStub:GetLibrary(major, silent) |
if not self.libs[major] and not silent then |
error(("Cannot find a library instance of %q."):format(tostring(major)), 2) |
end |
return self.libs[major], self.minors[major] |
end |
function LibStub:IterateLibraries() return pairs(self.libs) end |
setmetatable(LibStub, { __call = LibStub.GetLibrary }) |
end |
<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"> |
<Script file="AceLocale-3.0.lua"/> |
</Ui> |
--- **AceLocale-3.0** manages localization in addons, allowing for multiple locale to be registered with fallback to the base locale for untranslated strings. |
-- @class file |
-- @name AceLocale-3.0 |
-- @release $Id: AceLocale-3.0.lua 1035 2011-07-09 03:20:13Z kaelten $ |
local MAJOR,MINOR = "AceLocale-3.0", 6 |
local AceLocale, oldminor = LibStub:NewLibrary(MAJOR, MINOR) |
if not AceLocale then return end -- no upgrade needed |
-- Lua APIs |
local assert, tostring, error = assert, tostring, error |
local getmetatable, setmetatable, rawset, rawget = getmetatable, setmetatable, rawset, rawget |
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded |
-- List them here for Mikk's FindGlobals script |
-- GLOBALS: GAME_LOCALE, geterrorhandler |
local gameLocale = GetLocale() |
if gameLocale == "enGB" then |
gameLocale = "enUS" |
end |
AceLocale.apps = AceLocale.apps or {} -- array of ["AppName"]=localetableref |
AceLocale.appnames = AceLocale.appnames or {} -- array of [localetableref]="AppName" |
-- This metatable is used on all tables returned from GetLocale |
local readmeta = { |
__index = function(self, key) -- requesting totally unknown entries: fire off a nonbreaking error and return key |
rawset(self, key, key) -- only need to see the warning once, really |
geterrorhandler()(MAJOR..": "..tostring(AceLocale.appnames[self])..": Missing entry for '"..tostring(key).."'") |
return key |
end |
} |
-- This metatable is used on all tables returned from GetLocale if the silent flag is true, it does not issue a warning on unknown keys |
local readmetasilent = { |
__index = function(self, key) -- requesting totally unknown entries: return key |
rawset(self, key, key) -- only need to invoke this function once |
return key |
end |
} |
-- Remember the locale table being registered right now (it gets set by :NewLocale()) |
-- NOTE: Do never try to register 2 locale tables at once and mix their definition. |
local registering |
-- local assert false function |
local assertfalse = function() assert(false) end |
-- This metatable proxy is used when registering nondefault locales |
local writeproxy = setmetatable({}, { |
__newindex = function(self, key, value) |
rawset(registering, key, value == true and key or value) -- assigning values: replace 'true' with key string |
end, |
__index = assertfalse |
}) |
-- This metatable proxy is used when registering the default locale. |
-- It refuses to overwrite existing values |
-- Reason 1: Allows loading locales in any order |
-- Reason 2: If 2 modules have the same string, but only the first one to be |
-- loaded has a translation for the current locale, the translation |
-- doesn't get overwritten. |
-- |
local writedefaultproxy = setmetatable({}, { |
__newindex = function(self, key, value) |
if not rawget(registering, key) then |
rawset(registering, key, value == true and key or value) |
end |
end, |
__index = assertfalse |
}) |
--- Register a new locale (or extend an existing one) for the specified application. |
-- :NewLocale will return a table you can fill your locale into, or nil if the locale isn't needed for the players |
-- game locale. |
-- @paramsig application, locale[, isDefault[, silent]] |
-- @param application Unique name of addon / module |
-- @param locale Name of the locale to register, e.g. "enUS", "deDE", etc. |
-- @param isDefault If this is the default locale being registered (your addon is written in this language, generally enUS) |
-- @param silent If true, the locale will not issue warnings for missing keys. Must be set on the first locale registered. If set to "raw", nils will be returned for unknown keys (no metatable used). |
-- @usage |
-- -- enUS.lua |
-- local L = LibStub("AceLocale-3.0"):NewLocale("TestLocale", "enUS", true) |
-- L["string1"] = true |
-- |
-- -- deDE.lua |
-- local L = LibStub("AceLocale-3.0"):NewLocale("TestLocale", "deDE") |
-- if not L then return end |
-- L["string1"] = "Zeichenkette1" |
-- @return Locale Table to add localizations to, or nil if the current locale is not required. |
function AceLocale:NewLocale(application, locale, isDefault, silent) |
-- GAME_LOCALE allows translators to test translations of addons without having that wow client installed |
local gameLocale = GAME_LOCALE or gameLocale |
local app = AceLocale.apps[application] |
if silent and app and getmetatable(app) ~= readmetasilent then |
geterrorhandler()("Usage: NewLocale(application, locale[, isDefault[, silent]]): 'silent' must be specified for the first locale registered") |
end |
if not app then |
if silent=="raw" then |
app = {} |
else |
app = setmetatable({}, silent and readmetasilent or readmeta) |
end |
AceLocale.apps[application] = app |
AceLocale.appnames[app] = application |
end |
if locale ~= gameLocale and not isDefault then |
return -- nop, we don't need these translations |
end |
registering = app -- remember globally for writeproxy and writedefaultproxy |
if isDefault then |
return writedefaultproxy |
end |
return writeproxy |
end |
--- Returns localizations for the current locale (or default locale if translations are missing). |
-- Errors if nothing is registered (spank developer, not just a missing translation) |
-- @param application Unique name of addon / module |
-- @param silent If true, the locale is optional, silently return nil if it's not found (defaults to false, optional) |
-- @return The locale table for the current language. |
function AceLocale:GetLocale(application, silent) |
if not silent and not AceLocale.apps[application] then |
error("Usage: GetLocale(application[, silent]): 'application' - No locales registered for '"..tostring(application).."'", 2) |
end |
return AceLocale.apps[application] |
end |
<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"> |
<Script file="AceTimer-3.0.lua"/> |
</Ui> |
--- **AceTimer-3.0** provides a central facility for registering timers. |
-- AceTimer supports one-shot timers and repeating timers. All timers are stored in an efficient |
-- data structure that allows easy dispatching and fast rescheduling. Timers can be registered, rescheduled |
-- or canceled at any time, even from within a running timer, without conflict or large overhead.\\ |
-- AceTimer is currently limited to firing timers at a frequency of 0.1s. This constant may change |
-- in the future, but for now it seemed like a good compromise in efficiency and accuracy. |
-- |
-- All `:Schedule` functions will return a handle to the current timer, which you will need to store if you |
-- need to cancel or reschedule the timer you just registered. |
-- |
-- **AceTimer-3.0** can be embeded into your addon, either explicitly by calling AceTimer:Embed(MyAddon) or by |
-- specifying it as an embeded library in your AceAddon. All functions will be available on your addon object |
-- and can be accessed directly, without having to explicitly call AceTimer itself.\\ |
-- It is recommended to embed AceTimer, otherwise you'll have to specify a custom `self` on all calls you |
-- make into AceTimer. |
-- @class file |
-- @name AceTimer-3.0 |
-- @release $Id: AceTimer-3.0.lua 895 2009-12-06 16:28:55Z nevcairiel $ |
--[[ |
Basic assumptions: |
* In a typical system, we do more re-scheduling per second than there are timer pulses per second |
* Regardless of timer implementation, we cannot guarantee timely delivery due to FPS restriction (may be as low as 10) |
This implementation: |
CON: The smallest timer interval is constrained by HZ (currently 1/10s). |
PRO: It will still correctly fire any timer slower than HZ over a length of time, e.g. 0.11s interval -> 90 times over 10 seconds |
PRO: In lag bursts, the system simly skips missed timer intervals to decrease load |
CON: Algorithms depending on a timer firing "N times per minute" will fail |
PRO: (Re-)scheduling is O(1) with a VERY small constant. It's a simple linked list insertion in a hash bucket. |
CAUTION: The BUCKETS constant constrains how many timers can be efficiently handled. With too many hash collisions, performance will decrease. |
Major assumptions upheld: |
- ALLOWS scheduling multiple timers with the same funcref/method |
- ALLOWS scheduling more timers during OnUpdate processing |
- ALLOWS unscheduling ANY timer (including the current running one) at any time, including during OnUpdate processing |
]] |
local MAJOR, MINOR = "AceTimer-3.0", 5 |
local AceTimer, oldminor = LibStub:NewLibrary(MAJOR, MINOR) |
if not AceTimer then return end -- No upgrade needed |
AceTimer.hash = AceTimer.hash or {} -- Array of [0..BUCKET-1] = linked list of timers (using .next member) |
-- Linked list gets around ACE-88 and ACE-90. |
AceTimer.selfs = AceTimer.selfs or {} -- Array of [self]={[handle]=timerobj, [handle2]=timerobj2, ...} |
AceTimer.frame = AceTimer.frame or CreateFrame("Frame", "AceTimer30Frame") |
-- Lua APIs |
local assert, error, loadstring = assert, error, loadstring |
local setmetatable, rawset, rawget = setmetatable, rawset, rawget |
local select, pairs, type, next, tostring = select, pairs, type, next, tostring |
local floor, max, min = math.floor, math.max, math.min |
local tconcat = table.concat |
-- WoW APIs |
local GetTime = GetTime |
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded |
-- List them here for Mikk's FindGlobals script |
-- GLOBALS: DEFAULT_CHAT_FRAME, geterrorhandler |
-- Simple ONE-SHOT timer cache. Much more efficient than a full compost for our purposes. |
local timerCache = nil |
--[[ |
Timers will not be fired more often than HZ-1 times per second. |
Keep at intended speed PLUS ONE or we get bitten by floating point rounding errors (n.5 + 0.1 can be n.599999) |
If this is ever LOWERED, all existing timers need to be enforced to have a delay >= 1/HZ on lib upgrade. |
If this number is ever changed, all entries need to be rehashed on lib upgrade. |
]] |
local HZ = 11 |
--[[ |
Prime for good distribution |
If this number is ever changed, all entries need to be rehashed on lib upgrade. |
]] |
local BUCKETS = 131 |
local hash = AceTimer.hash |
for i=1,BUCKETS do |
hash[i] = hash[i] or false -- make it an integer-indexed array; it's faster than hashes |
end |
--[[ |
xpcall safecall implementation |
]] |
local xpcall = xpcall |
local function errorhandler(err) |
return geterrorhandler()(err) |
end |
local function CreateDispatcher(argCount) |
local code = [[ |
local xpcall, eh = ... -- our arguments are received as unnamed values in "..." since we don't have a proper function declaration |
local method, ARGS |
local function call() return method(ARGS) end |
local function dispatch(func, ...) |
method = func |
if not method then return end |
ARGS = ... |
return xpcall(call, eh) |
end |
return dispatch |
]] |
local ARGS = {} |
for i = 1, argCount do ARGS[i] = "arg"..i end |
code = code:gsub("ARGS", tconcat(ARGS, ", ")) |
return assert(loadstring(code, "safecall Dispatcher["..argCount.."]"))(xpcall, errorhandler) |
end |
local Dispatchers = setmetatable({}, { |
__index=function(self, argCount) |
local dispatcher = CreateDispatcher(argCount) |
rawset(self, argCount, dispatcher) |
return dispatcher |
end |
}) |
Dispatchers[0] = function(func) |
return xpcall(func, errorhandler) |
end |
local function safecall(func, ...) |
return Dispatchers[select('#', ...)](func, ...) |
end |
local lastint = floor(GetTime() * HZ) |
-- -------------------------------------------------------------------- |
-- OnUpdate handler |
-- |
-- traverse buckets, always chasing "now", and fire timers that have expired |
local function OnUpdate() |
local now = GetTime() |
local nowint = floor(now * HZ) |
-- Have we passed into a new hash bucket? |
if nowint == lastint then return end |
local soon = now + 1 -- +1 is safe as long as 1 < HZ < BUCKETS/2 |
-- Pass through each bucket at most once |
-- Happens on e.g. instance loads, but COULD happen on high local load situations also |
for curint = (max(lastint, nowint - BUCKETS) + 1), nowint do -- loop until we catch up with "now", usually only 1 iteration |
local curbucket = (curint % BUCKETS)+1 |
-- Yank the list of timers out of the bucket and empty it. This allows reinsertion in the currently-processed bucket from callbacks. |
local nexttimer = hash[curbucket] |
hash[curbucket] = false -- false rather than nil to prevent the array from becoming a hash |
while nexttimer do |
local timer = nexttimer |
nexttimer = timer.next |
local when = timer.when |
if when < soon then |
-- Call the timer func, either as a method on given object, or a straight function ref |
local callback = timer.callback |
if type(callback) == "string" then |
safecall(timer.object[callback], timer.object, timer.arg) |
elseif callback then |
safecall(callback, timer.arg) |
else |
-- probably nilled out by CancelTimer |
timer.delay = nil -- don't reschedule it |
end |
local delay = timer.delay -- NOW make a local copy, can't do it earlier in case the timer cancelled itself in the callback |
if not delay then |
-- single-shot timer (or cancelled) |
AceTimer.selfs[timer.object][tostring(timer)] = nil |
timerCache = timer |
else |
-- repeating timer |
local newtime = when + delay |
if newtime < now then -- Keep lag from making us firing a timer unnecessarily. (Note that this still won't catch too-short-delay timers though.) |
newtime = now + delay |
end |
timer.when = newtime |
-- add next timer execution to the correct bucket |
local bucket = (floor(newtime * HZ) % BUCKETS) + 1 |
timer.next = hash[bucket] |
hash[bucket] = timer |
end |
else -- if when>=soon |
-- reinsert (yeah, somewhat expensive, but shouldn't be happening too often either due to hash distribution) |
timer.next = hash[curbucket] |
hash[curbucket] = timer |
end -- if when<soon ... else |
end -- while nexttimer do |
end -- for curint=lastint,nowint |
lastint = nowint |
end |
-- --------------------------------------------------------------------- |
-- Reg( callback, delay, arg, repeating ) |
-- |
-- callback( function or string ) - direct function ref or method name in our object for the callback |
-- delay(int) - delay for the timer |
-- arg(variant) - any argument to be passed to the callback function |
-- repeating(boolean) - repeating timer, or oneshot |
-- |
-- returns the handle of the timer for later processing (canceling etc) |
local function Reg(self, callback, delay, arg, repeating) |
if type(callback) ~= "string" and type(callback) ~= "function" then |
local error_origin = repeating and "ScheduleRepeatingTimer" or "ScheduleTimer" |
error(MAJOR..": " .. error_origin .. "(callback, delay, arg): 'callback' - function or method name expected.", 3) |
end |
if type(callback) == "string" then |
if type(self)~="table" then |
local error_origin = repeating and "ScheduleRepeatingTimer" or "ScheduleTimer" |
error(MAJOR..": " .. error_origin .. "(\"methodName\", delay, arg): 'self' - must be a table.", 3) |
end |
if type(self[callback]) ~= "function" then |
local error_origin = repeating and "ScheduleRepeatingTimer" or "ScheduleTimer" |
error(MAJOR..": " .. error_origin .. "(\"methodName\", delay, arg): 'methodName' - method not found on target object.", 3) |
end |
end |
if delay < (1 / (HZ - 1)) then |
delay = 1 / (HZ - 1) |
end |
-- Create and stuff timer in the correct hash bucket |
local now = GetTime() |
local timer = timerCache or {} -- Get new timer object (from cache if available) |
timerCache = nil |
timer.object = self |
timer.callback = callback |
timer.delay = (repeating and delay) |
timer.arg = arg |
timer.when = now + delay |
local bucket = (floor((now+delay)*HZ) % BUCKETS) + 1 |
timer.next = hash[bucket] |
hash[bucket] = timer |
-- Insert timer in our self->handle->timer registry |
local handle = tostring(timer) |
local selftimers = AceTimer.selfs[self] |
if not selftimers then |
selftimers = {} |
AceTimer.selfs[self] = selftimers |
end |
selftimers[handle] = timer |
selftimers.__ops = (selftimers.__ops or 0) + 1 |
return handle |
end |
--- Schedule a new one-shot timer. |
-- The timer will fire once in `delay` seconds, unless canceled before. |
-- @param callback Callback function for the timer pulse (funcref or method name). |
-- @param delay Delay for the timer, in seconds. |
-- @param arg An optional argument to be passed to the callback function. |
-- @usage |
-- MyAddon = LibStub("AceAddon-3.0"):NewAddon("TimerTest", "AceTimer-3.0") |
-- |
-- function MyAddon:OnEnable() |
-- self:ScheduleTimer("TimerFeedback", 5) |
-- end |
-- |
-- function MyAddon:TimerFeedback() |
-- print("5 seconds passed") |
-- end |
function AceTimer:ScheduleTimer(callback, delay, arg) |
return Reg(self, callback, delay, arg) |
end |
--- Schedule a repeating timer. |
-- The timer will fire every `delay` seconds, until canceled. |
-- @param callback Callback function for the timer pulse (funcref or method name). |
-- @param delay Delay for the timer, in seconds. |
-- @param arg An optional argument to be passed to the callback function. |
-- @usage |
-- MyAddon = LibStub("AceAddon-3.0"):NewAddon("TimerTest", "AceTimer-3.0") |
-- |
-- function MyAddon:OnEnable() |
-- self.timerCount = 0 |
-- self.testTimer = self:ScheduleRepeatingTimer("TimerFeedback", 5) |
-- end |
-- |
-- function MyAddon:TimerFeedback() |
-- self.timerCount = self.timerCount + 1 |
-- print(("%d seconds passed"):format(5 * self.timerCount)) |
-- -- run 30 seconds in total |
-- if self.timerCount == 6 then |
-- self:CancelTimer(self.testTimer) |
-- end |
-- end |
function AceTimer:ScheduleRepeatingTimer(callback, delay, arg) |
return Reg(self, callback, delay, arg, true) |
end |
--- Cancels a timer with the given handle, registered by the same addon object as used for `:ScheduleTimer` |
-- Both one-shot and repeating timers can be canceled with this function, as long as the `handle` is valid |
-- and the timer has not fired yet or was canceled before. |
-- @param handle The handle of the timer, as returned by `:ScheduleTimer` or `:ScheduleRepeatingTimer` |
-- @param silent If true, no error is raised if the timer handle is invalid (expired or already canceled) |
-- @return True if the timer was successfully cancelled. |
function AceTimer:CancelTimer(handle, silent) |
if not handle then return end -- nil handle -> bail out without erroring |
if type(handle) ~= "string" then |
error(MAJOR..": CancelTimer(handle): 'handle' - expected a string", 2) -- for now, anyway |
end |
local selftimers = AceTimer.selfs[self] |
local timer = selftimers and selftimers[handle] |
if silent then |
if timer then |
timer.callback = nil -- don't run it again |
timer.delay = nil -- if this is the currently-executing one: don't even reschedule |
-- The timer object is removed in the OnUpdate loop |
end |
return not not timer -- might return "true" even if we double-cancel. we'll live. |
else |
if not timer then |
geterrorhandler()(MAJOR..": CancelTimer(handle[, silent]): '"..tostring(handle).."' - no such timer registered") |
return false |
end |
if not timer.callback then |
geterrorhandler()(MAJOR..": CancelTimer(handle[, silent]): '"..tostring(handle).."' - timer already cancelled or expired") |
return false |
end |
timer.callback = nil -- don't run it again |
timer.delay = nil -- if this is the currently-executing one: don't even reschedule |
return true |
end |
end |
--- Cancels all timers registered to the current addon object ('self') |
function AceTimer:CancelAllTimers() |
if not(type(self) == "string" or type(self) == "table") then |
error(MAJOR..": CancelAllTimers(): 'self' - must be a string or a table",2) |
end |
if self == AceTimer then |
error(MAJOR..": CancelAllTimers(): supply a meaningful 'self'", 2) |
end |
local selftimers = AceTimer.selfs[self] |
if selftimers then |
for handle,v in pairs(selftimers) do |
if type(v) == "table" then -- avoid __ops, etc |
AceTimer.CancelTimer(self, handle, true) |
end |
end |
end |
end |
--- Returns the time left for a timer with the given handle, registered by the current addon object ('self'). |
-- This function will raise a warning when the handle is invalid, but not stop execution. |
-- @param handle The handle of the timer, as returned by `:ScheduleTimer` or `:ScheduleRepeatingTimer` |
-- @return The time left on the timer, or false if the handle is invalid. |
function AceTimer:TimeLeft(handle) |
if not handle then return end |
if type(handle) ~= "string" then |
error(MAJOR..": TimeLeft(handle): 'handle' - expected a string", 2) -- for now, anyway |
end |
local selftimers = AceTimer.selfs[self] |
local timer = selftimers and selftimers[handle] |
if not timer then |
geterrorhandler()(MAJOR..": TimeLeft(handle): '"..tostring(handle).."' - no such timer registered") |
return false |
end |
return timer.when - GetTime() |
end |
-- --------------------------------------------------------------------- |
-- PLAYER_REGEN_ENABLED: Run through our .selfs[] array step by step |
-- and clean it out - otherwise the table indices can grow indefinitely |
-- if an addon starts and stops a lot of timers. AceBucket does this! |
-- |
-- See ACE-94 and tests/AceTimer-3.0-ACE-94.lua |
local lastCleaned = nil |
local function OnEvent(this, event) |
if event~="PLAYER_REGEN_ENABLED" then |
return |
end |
-- Get the next 'self' to process |
local selfs = AceTimer.selfs |
local self = next(selfs, lastCleaned) |
if not self then |
self = next(selfs) |
end |
lastCleaned = self |
if not self then -- should only happen if .selfs[] is empty |
return |
end |
-- Time to clean it out? |
local list = selfs[self] |
if (list.__ops or 0) < 250 then -- 250 slosh indices = ~10KB wasted (max!). For one 'self'. |
return |
end |
-- Create a new table and copy all members over |
local newlist = {} |
local n=0 |
for k,v in pairs(list) do |
newlist[k] = v |
n=n+1 |
end |
newlist.__ops = 0 -- Reset operation count |
-- And since we now have a count of the number of live timers, check that it's reasonable. Emit a warning if not. |
if n>BUCKETS then |
DEFAULT_CHAT_FRAME:AddMessage(MAJOR..": Warning: The addon/module '"..tostring(self).."' has "..n.." live timers. Surely that's not intended?") |
end |
selfs[self] = newlist |
end |
-- --------------------------------------------------------------------- |
-- Embed handling |
AceTimer.embeds = AceTimer.embeds or {} |
local mixins = { |
"ScheduleTimer", "ScheduleRepeatingTimer", |
"CancelTimer", "CancelAllTimers", |
"TimeLeft" |
} |
function AceTimer:Embed(target) |
AceTimer.embeds[target] = true |
for _,v in pairs(mixins) do |
target[v] = AceTimer[v] |
end |
return target |
end |
-- AceTimer:OnEmbedDisable( target ) |
-- target (object) - target object that AceTimer is embedded in. |
-- |
-- cancel all timers registered for the object |
function AceTimer:OnEmbedDisable( target ) |
target:CancelAllTimers() |
end |
for addon in pairs(AceTimer.embeds) do |
AceTimer:Embed(addon) |
end |
-- --------------------------------------------------------------------- |
-- Debug tools (expose copies of internals to test suites) |
AceTimer.debug = AceTimer.debug or {} |
AceTimer.debug.HZ = HZ |
AceTimer.debug.BUCKETS = BUCKETS |
-- --------------------------------------------------------------------- |
-- Finishing touchups |
AceTimer.frame:SetScript("OnUpdate", OnUpdate) |
AceTimer.frame:SetScript("OnEvent", OnEvent) |
AceTimer.frame:RegisterEvent("PLAYER_REGEN_ENABLED") |
-- In theory, we should hide&show the frame based on there being timers or not. |
-- However, this job is fairly expensive, and the chance that there will |
-- actually be zero timers running is diminuitive to say the lest. |