Quantcast

new fun stuff

Munglunch [04-03-15 - 16:46]
new fun stuff
Filename
SVUI_!Core/system/core.lua
SVUI_!Core/system/credits.lua
SVUI_!Core/xml/widgets.xml
diff --git a/SVUI_!Core/system/core.lua b/SVUI_!Core/system/core.lua
index 8643468..5a837bf 100644
--- a/SVUI_!Core/system/core.lua
+++ b/SVUI_!Core/system/core.lua
@@ -428,7 +428,7 @@ SV.Options = {
                 new = {
                     order = 1,
                     type = "description",
-                    name = function() return SV.Credits end
+                    name = function() return SV:PrintCredits() end
                 }
             }
         }
@@ -872,6 +872,8 @@ function SV:Initialize()
     --print(p1 .. ", " .. p2:GetName() .. ", " .. p3 .. ", " .. p4 .. ", " .. p5)

     collectgarbage("collect");
+
+    self.Timers:ExecuteTimer(self.RollCredits, 5)
 end
 --[[
 ##########################################################
diff --git a/SVUI_!Core/system/credits.lua b/SVUI_!Core/system/credits.lua
index 22d4d49..d60a515 100644
--- a/SVUI_!Core/system/credits.lua
+++ b/SVUI_!Core/system/credits.lua
@@ -7,13 +7,16 @@ S V U I   By: Munglunch
 --[[ GLOBALS ]]--

 local _G = _G;
-
+local table = _G.table;
+local math = _G.math;
+local concat = table.concat;
+local random = math.random;
 --[[ ADDON ]]--

 local SV = _G["SVUI"];
 local L = SV.L;

-SV.Credits = [[
+local PRINTED_TEMPLATE = [[
 |cffff9900SUPERVILLAIN CREDITS:|r
 |cff4f4f4f---------------------------------------------|r
 |cffff9900CREATED BY:|r  Munglunch
@@ -27,43 +30,118 @@ SV.Credits = [[
 |cff4f4f4f---------------------------------------------|r

 |cffFFFF00THE HIGH COUNCIL  (aka EXECUTIVES):|r
-|cff33FF33PENGUINSANE|r - (The ace up my sleeve)
-|cff33FF33BLOODEAGLE|r - (The artisan tester)
-|cff33FF33HOTLUCK|r - (The profiler)
-|cff33FF33CROMAX|r - (The relentless)
-|cff33FF33DOONGA|r - (The man who keeps me busy)
+%s
 |cff4f4f4f---------------------------------------------|r

 |cff99ff33KINGPINS  (aka INVESTORS):|r
-Movster, Meggalo, Penguinsane, FaolanKing, Doonga
-Cazart506, Moondoggy, Necroo, Chief Pullin, lkj61
-BloodEagle, Egbert, Jerry Ferguson, Hyti, Elton
-James Watson, Lathron, Adam Vargas, Daphne, Dave (Naméra)
-Soulkrusher-Shu-Halo, Talirrine, Gaeline, Malinche, StealthyMangos
-Monger, JoeyMagz
+%s
 Other Silent Partners.. (Let me know if I have forgotten you)
 |cff4f4f4f---------------------------------------------|r

 |cff3399ffCODE MONKEYS  (aka CONTRIBUTORS):|r
-Azilroka, Sortokk, Kkthnx, Vyntrox, Mydraal, Profitz
-AlleyKat, Quokka, Duugu, Zork, Haleth, P3lim
-Haste, Totalpackage, Kryso, Thepilli, Phanx
-|cff4f4f4f---------------------------------------------|r
-
-|cffaa33ffPERFECTIONISTS  (aka TESTING TEAM):|r
-Sinnisterr - (My wife, the MOST ruthless Warlock you will ever meet!)
-Daigan - (Quality control with NO MERCY!)
-FaolanKing - (King of the bug report portal)
+%s
 |cff4f4f4f---------------------------------------------|r

 |cffaa33ffMINIONS  (aka COMMUNITY TESTERS):|r
-Movster, Judicate, Cazart506, MuffinMonster, Joelsoul
-Trendkill09, Luamar, Zharooz, Lyn3x5, Madh4tt3r
-Xarioth, AtomicKiller, Meljen, Moondoggy, Stormblade
-Schreibstift, Anj, Risien, Cromax, Nitro_Turtle
-Shinzou, Autolykus, Taotao, ColorsGaming, Necroo
+%s
 The Wowinterface Community
 |cff4f4f4f---------------------------------------------|r

 |cff00ccffTheme Song By: Fingathing [taken from the song: SuperHero Music]|r
 ]];
+
+local CreditFrame = _G["SVUI_CreditFrame"];
+local CreditTitle = _G["SVUI_CreditFrameTitle"];
+local CreditList = _G["SVUI_CreditFrameList"];
+
+SV.Credits = {};
+
+SV.Credits["author"] = {
+  "Munglunch",
+};
+
+SV.Credits["council"] = {
+  "|cff33FF33SINNISTERR|r - (My wife, the MOST ruthless Warlock you will ever meet!)",
+  "|cff33FF33PENGUINSANE|r - (The ace up my sleeve)",
+  "|cff33FF33BLOODEAGLE|r - (The artisan tester)",
+  "|cff33FF33HOTLUCK|r - (The profiler)",
+  "|cff33FF33CROMAX|r - (The relentless)",
+  "|cff33FF33DOONGA|r - (The man who keeps me busy)",
+  "|cff33FF33DAIGAN|r - (Quality control with NO MERCY!)",
+  "|cff33FF33FAOLANKING|r - (King of the bug report portal)"
+};
+
+SV.Credits["investors"] = {
+  "Movster", "Meggalo", "Penguinsane", "FaolanKing", "Doonga",
+  "Cazart506", "Moondoggy", "Necroo", "Chief Pullin", "lkj61",
+  "BloodEagle", "Egbert", "Jerry Ferguson", "Hyti", "Elton",
+  "James Watson", "Lathron", "Adam Vargas", "Daphne", "Dave (Naméra)",
+  "Soulkrusher-Shu-Halo", "Talirrine", "Gaeline", "Malinche", "StealthyMangos",
+  "Monger", "JoeyMagz"
+};
+
+SV.Credits["contributors"] = {
+  "Azilroka", "Sortokk", "Kkthnx", "Vyntrox", "Mydraal", "Profitz",
+  "AlleyKat", "Quokka", "Duugu", "Zork", "Haleth", "P3lim",
+  "Haste", "Totalpackage", "Kryso", "Thepilli", "Phanx"
+};
+
+SV.Credits["community"] = {
+  "Movster", "Judicate", "Cazart506", "MuffinMonster", "Joelsoul",
+  "Trendkill09", "Luamar", "Zharooz", "Lyn3x5", "Madh4tt3r",
+  "Xarioth", "AtomicKiller", "Meljen", "Moondoggy", "Stormblade",
+  "Schreibstift", "Anj", "Risien", "Cromax", "Nitro_Turtle",
+  "Shinzou", "Autolykus", "Taotao", "ColorsGaming", "Necroo"
+};
+
+local ShowNextCredit, CreditFrame_OnUpdate;
+local ROLLED_CREDITS = 0;
+local CREDITS_DATA = {
+  {"Produced By: ", "council"},
+  {"Sponsored In Part By: ", "investors"},
+  {"Contributions Provided By: ", "contributors"},
+  {"Community Support From: ", "community"},
+  {"Written By: ", "author"},
+};
+
+function ShowNextCredit()
+  if(ROLLED_CREDITS <= #CREDITS_DATA) then
+    local credit = CREDITS_DATA[ROLLED_CREDITS]
+    local list = SV.Credits[credit[2]];
+    local name = list[random(1, #list)];
+    CreditTitle:SetText(credit[1]);
+    CreditList:SetText(name);
+    CreditFrame:FadeIn();
+    ROLLED_CREDITS = ROLLED_CREDITS + 1;
+    self:SetScript("OnUpdate", CreditFrame_OnUpdate)
+  else
+    ROLLED_CREDITS = 0;
+    CreditFrame:Hide();
+  end
+end
+
+function CreditFrame_OnUpdate(self, elapsed)
+  if(elapsed < 5) then return end
+  if(elapsed <= 5.5) then
+    CreditFrame:FadeOut();
+  elseif(elapsed <= 10) then
+    self:SetScript("OnUpdate", nil)
+    ShowNextCredit()
+  end
+end
+
+function SV:PrintCredits()
+  local council, investors, contributors, community;
+  council = concat(self.Credits["council"]);
+  investors = concat(self.Credits["investors"]);
+  contributors = concat(self.Credits["contributors"]);
+  community = concat(self.Credits["community"]);
+  return PRINTED_TEMPLATE:format(council, investors, contributors, community)
+end
+
+function SV:RollCredits()
+  ROLLED_CREDITS = 0;
+  CreditFrame:SetAlpha(0);
+  CreditFrame:Show();
+  ShowNextCredit();
+end
diff --git a/SVUI_!Core/xml/widgets.xml b/SVUI_!Core/xml/widgets.xml
index 0bb7390..0cfee48 100644
--- a/SVUI_!Core/xml/widgets.xml
+++ b/SVUI_!Core/xml/widgets.xml
@@ -1,5 +1,25 @@
 <Ui xmlns="http://www.blizzard.com/wow/ui/">

+    <Frame name="SVUI_CreditFrame" frameStrata="DIALOG" hidden="true">
+      <Size x="400" y="75"/>
+        <Layers>
+            <Layer level="ARTWORK">
+              <FontString name="$parentTitle" inherits="GameFontNormal">
+                <Size x="400" y="75"/>
+                  <Anchors>
+                      <Anchor point="TOPLEFT" relativePoint="TOPLEFT" x="0" y="0" />
+                  </Anchors>
+              </FontString>
+              <FontString name="$parentList" font="GameFontNormalCenter">
+                <Size x="400" y="75"/>
+                <Anchors>
+                    <Anchor point="TOPLEFT" relativeTo="$parentTitle" relativePoint="BOTTOMLEFT" x="0" y="-6" />
+                </Anchors>
+              </FontString>
+          </Layer>
+        </Layers>
+    </Frame>
+
     <Frame name="SVUI_DropdownFrame" frameStrata="DIALOG" hidden="true" />

     <Frame name="SVUI_MailMinion" parent="InboxFrame" hidden="true">