SSoA.lua

-- some variables --
local sso = 0
local ssh = 0
local ssm = 0
-- Scrolling Functions --
local function ScrollFrame_OnMouseWheel (self, delta)
if delta == 1 then self:ScrollUp() elseif delta == -1 then self:ScrollDown() end
end
-- Main Frame BackGround --
local SoSFrameTextBG = CreateFrame("ScrollingMessageFrame", "SSoATextyFrame", UIParent, "SecureHandlerStateTemplate")
SoSFrameTextBG:RegisterEvent("PLAYER_LOGIN")
SoSFrameTextBG:RegisterEvent("PLAYER_ENTERING_WORLD")
SoSFrameTextBG:RegisterEvent("AUCTION_HOUSE_SHOW_FORMATTED_NOTIFICATION")
SoSFrameTextBG:RegisterEvent("AUCTION_HOUSE_SHOW_COMMODITY_WON_NOTIFICATION")
SoSFrameTextBG:SetFrameStrata ("BACKGROUND")
SoSFrameTextBG:SetFrameLevel(1)
SoSFrameTextBG:SetAlpha(1)
RegisterStateDriver(SoSFrameTextBG, "SoSCombat", "[combat]show1; [nocombat]show2")
SoSFrameTextBG:Hide()
-- Text of the Basic Frame --
local SoSFrameTextBGtitle = SoSFrameTextBG:CreateFontString(nil)
SoSFrameTextBGtitle:SetPoint("BOTTOM", SoSFrameTextBG, "TOP", 0, -10)
SoSFrameTextBGtitle:SetDrawLayer("BACKGROUND")
SoSFrameTextBGtitle:SetFont("Fonts\\skurri.TTF", 20, "OUTLINE")
SoSFrameTextBGtitle:SetText("|cffF0E68CSweet Sound of Auction House|r")
-- Texture of the BackGround --
local SSoAbgTexture = SoSFrameTextBG:CreateTexture(nil)
SSoAbgTexture:SetPoint("TOPLEFT", SoSFrameTextBG, "TOPLEFT", 0, 0)
SSoAbgTexture:SetPoint("BOTTOMRIGHT", SoSFrameTextBG, "BOTTOMRIGHT", 0, 0)
SSoAbgTexture:SetDrawLayer("BACKGROUND")
SSoAbgTexture:SetColorTexture(0, 0, 0)
SSoAbgTexture:SetGradientAlpha("VERTICAL", 0, 0, 0, 0, 0, 0, 0, 0.65)
SSoAbgTexture:Show()
-- Texture of the BackGround Top Left --
local SSoAbgTextureTL = SoSFrameTextBG:CreateTexture(nil)
SSoAbgTextureTL:SetPoint("TOPLEFT", SoSFrameTextBG, "TOPLEFT", 0, 0)
SSoAbgTextureTL:SetWidth(64)
SSoAbgTextureTL:SetHeight(64)
SSoAbgTextureTL:SetDrawLayer("BORDER")
SSoAbgTextureTL:SetAtlas("Talent-TopLeftCurlies")
SSoAbgTextureTL:SetGradientAlpha("HORIZONTAL", 1, 1, 1, 1, 1, 1, 1, 0)
SSoAbgTextureTL:Show()
-- Texture of the BackGround Top Right --
local SSoAbgTextureTR = SoSFrameTextBG:CreateTexture(nil)
SSoAbgTextureTR:SetPoint("TOPRIGHT", SoSFrameTextBG, "TOPRIGHT", 0, 0)
SSoAbgTextureTR:SetWidth(64)
SSoAbgTextureTR:SetHeight(64)
SSoAbgTextureTR:SetDrawLayer("BORDER")
SSoAbgTextureTR:SetAtlas("Talent-TopRightCurlies")
SSoAbgTextureTR:SetGradientAlpha("HORIZONTAL", 1, 1, 1, 0, 1, 1, 1, 1)
SSoAbgTextureTR:Show()
-- Main Frame Texty --
local SoSFrameText = CreateFrame("ScrollingMessageFrame", nil, SoSFrameTextBG)
SoSFrameText:SetFrameStrata ("BACKGROUND")
SoSFrameText:SetFrameLevel(0)
SoSFrameText:SetPoint("TOPLEFT", SoSFrameTextBG, "TOPLEFT", 8, -8)
SoSFrameText:SetPoint("BOTTOMRIGHT", SoSFrameTextBG, "BOTTOMRIGHT", -8, 8)
SoSFrameText:SetInsertMode(0)
SoSFrameText:SetTimeVisible(180)
SoSFrameText:SetFont("Fonts\\ARIALN.ttf", 16, "OUTLINE")
SoSFrameText:SetJustifyH("LEFT")
SoSFrameText:SetScript("OnMouseWheel", ScrollFrame_OnMouseWheel)
SoSFrameText:Show()
-- Events Time --
local function SoSFrameEvents(self, event, arg1, arg2, arg3, ...)
if event == "PLAYER_LOGIN" then
if CB1 == nil or CB1 == 0 or CB1 == 1 then CB1 = "None" end
if CB2 == nil or CB2 == 0 or CB2 == 1 then CB2 = "None" end
if CB3 == nil then CB3 = 0 end
if CB4 == nil then CB4 = 0 end
if SSoAframeBGx == nil then SSoAframeBGx = 0 end
if SSoAframeBGy == nil then SSoAframeBGy = 0 end
if SSoAframeBGw == nil then SSoAframeBGw = 375 end
if SSoAframeBGh == nil then SSoAframeBGh = 80 end
if CB4 == 1 then
SoSFrameTextBG:SetAttribute("_onstate-SoSCombat", [[if newstate == "show1" or newstate == "show2" then self:Show() end]])
SoSFrameTextBG:Show()
elseif CB4 == 0 then
SoSFrameTextBG:SetAttribute("_onstate-SoSCombat", [[if newstate == "show1" or newstate == "show2" then self:Hide() end]])
SoSFrameTextBG:Hide()
end
SoSFrameTextBG:SetPoint("CENTER", UIParent, "CENTER", SSoAframeBGx, SSoAframeBGy)
SoSFrameTextBG:SetWidth(SSoAframeBGw)
SoSFrameTextBG:SetHeight(SSoAframeBGh)
elseif event == "AUCTION_HOUSE_SHOW_FORMATTED_NOTIFICATION" and arg1 == 4 then
sso, ssh, ssm = GameTime_GetTime(false)
if CB1 == "In Game Auction House's Sound" then
PlaySound(5275, "Master")
elseif CB1 == "Cash Register Machine" then
PlaySoundFile("Interface\\AddOns\\SSoA\\Sounds\\CashRegisterSound.mp3", "Master")
end
if CB2 == "Cheer" then
DoEmote("CHEER","none")
elseif CB2 == "Congratulate" then
DoEmote("Congratulate","none")
end
if CB3 == 1 then DEFAULT_CHAT_FRAME:AddMessage(sso.. " Your Auction for |cffDAA520".. arg2.. "|r has been |cffFFD700sold|r") end
if CB4 == 1 then SoSFrameText:AddMessage(sso.. " Your Auction for |cffDAA520".. arg2.. "|r has been |cffFFD700sold|r") end
end
end
SoSFrameTextBG:SetScript("OnEvent", SoSFrameEvents)