--[[ ############################################################################## _____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# ___\///////////___________\///___________\/////////_____\///////////_# ############################################################################## S U P E R - V I L L A I N - U I By: Munglunch # ############################################################################## ########################################################## LOCALIZED LUA FUNCTIONS ########################################################## ]]-- --[[ GLOBALS ]]-- local _G = _G; local unpack = _G.unpack; local select = _G.select; local math = _G.math; --[[ MATH METHODS ]]-- local random = math.random; --[[ ########################################################## GET ADDON DATA ########################################################## ]]-- local SV = select(2, ...) local L = SV.L local Sequences = { {65, 1000}, --shrug {68, 1000}, --cheer {70, 1000}, --laugh {74, 1000}, --roar {77, 1000}, --cry {84, 1000}, --point {82, 1000}, --flex }; local EgoFrame = CreateFrame("PlayerModel", "SVUI_EgoModel", UIParent); local function rng() return random(1, #Sequences) end local LaunchAnimation = function(self, key) key = key or rng() local emote = Sequences[key][1] self:Show() self.anim[2]:SetOffset(0, 0) self.anim[2]:SetOffset(0, 0) self.anim:Play() self:SetAnimation(emote) end local LaunchFreezeFrame = function(self, key) key = key or rng() local animation = Sequences[key] local size = SVUIParent:GetHeight() self:Show() self.anim[2]:SetOffset(size, -size) self.anim[2]:SetOffset(0, 0) self.anim:Play() self:SetSequenceTime(unpack(animation)) end local ResetPosition = function(self) local size = SVUIParent:GetHeight() self:SetPoint("TOP", SV.UIParent, "TOP", 0, 0) self:SetWidth(size) self:SetHeight(size) self:SetUnit("player") end local Ego_OnEvent = function(self, event) if event == "ACHIEVEMENT_EARNED" then self:LaunchAnimation(4) else self:LaunchAnimation(6) end end function BeAwesome() EgoFrame:LaunchAnimation(4) end function SV:ToggleEgo() if not SV.db.general.ego then EgoFrame:UnregisterEvent("ACHIEVEMENT_EARNED") EgoFrame:UnregisterEvent("SCREENSHOT_SUCCEEDED") EgoFrame:SetScript("OnEvent", nil) else EgoFrame:RegisterEvent("ACHIEVEMENT_EARNED") EgoFrame:RegisterEvent("SCREENSHOT_SUCCEEDED") EgoFrame:SetScript("OnEvent", Ego_OnEvent) end end local EgoPop_OnUpdate = function(self) self.parent:SetAlpha(0) end local function LoadSVEgo() local size = UIParent:GetWidth() EgoFrame:SetParent(SV.UIParent) EgoFrame:SetPoint("TOP", SV.UIParent, "TOP", 0, 0) EgoFrame:SetWidth(size) EgoFrame:SetHeight(size) EgoFrame:SetUnit("player") EgoFrame.LaunchAnimation = LaunchAnimation EgoFrame.LaunchFreezeFrame = LaunchFreezeFrame EgoFrame.ResetPosition = ResetPosition SV.Animate:Slide(EgoFrame, 0, 0, true, 1.5) EgoFrame:SetAlpha(0) EgoFrame.anim[4]:SetScript("OnFinished", EgoPop_OnUpdate) SLASH_SVUI_BADASS1="/badass" SlashCmdList["SVUI_BADASS"] = BeAwesome; EgoFrame:Show() end SV:NewScript(LoadSVEgo)