remove temp folder structure

This commit is contained in:
Crum
2018-02-19 21:03:21 -06:00
parent 85a2a5bcf7
commit 611f11aff9
408 changed files with 0 additions and 0 deletions
+330
View File
@@ -0,0 +1,330 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local AFK = E:NewModule("AFK", "AceEvent-3.0", "AceTimer-3.0");
-- local CH = E:GetModule("Chat")
--Cache global variables
--Lua functions
local _G = _G
local GetTime = GetTime
local floor = math.floor
--WoW API / Variables
local CinematicFrame = CinematicFrame
local CreateFrame = CreateFrame
local GetBattlefieldStatus = GetBattlefieldStatus
local GetGuildInfo = GetGuildInfo
local GetScreenHeight = GetScreenHeight
local GetScreenWidth = GetScreenWidth
local UnitAffectingCombat = UnitAffectingCombat
local IsInGuild = IsInGuild
local IsShiftKeyDown = IsShiftKeyDown
local Screenshot = Screenshot
local SetCVar = SetCVar
local UnitFactionGroup = UnitFactionGroup
local CUSTOM_CLASS_COLORS = CUSTOM_CLASS_COLORS
local MAX_BATTLEFIELD_QUEUES = MAX_BATTLEFIELD_QUEUES
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
local AFK_SPEED = 7.35
local ignoreKeys = {
LALT = true,
LSHIFT = true,
RSHIFT = true
}
local printKeys = {
["PRINTSCREEN"] = true,
}
if IsMacClient() then
printKeys[_G["KEY_PRINTSCREEN_MAC"]] = true
end
function AFK:UpdateTimer()
local time = GetTime() - self.startTime
self.AFKMode.bottom.time:SetText(format("%02d:%02d", floor(time / 60), time - floor(time / 60) * 60))
end
local function StopAnimation(self)
self:SetSequenceTime(0, 0)
self:SetScript("OnUpdate", nil)
self:SetScript("OnAnimFinished", nil)
end
local function UpdateAnimation(...)
this.animTime = this.animTime + (arg1 * 1000)
this:SetSequenceTime(67, this.animTime)
if this.animTime >= 3000 then
StopAnimation(this)
end
end
local function OnAnimFinished(self)
if self.animTime > 500 then
StopAnimation(self)
end
end
local recountVis
local function RecountVisability(save)
if Recount and Recount.db and Recount.db.profile then
if save then
recountVis = Recount.db.profile.MainWindowVis
else
Recount.db.profile.MainWindowVis = recountVis
RecountDB.profiles[Recount.db.keys.profile].MainWindowVis = recountVis
end
end
end
local LRC
local function RockConfigFix()
if not LRC then
LRC = LibStub("LibRockConfig-1.0", true)
end
if LRC then
if LRC.base and LRC.base:IsShown() then
LRC.base.addonChooser:Select(LRC.base.addonChooser.value)
end
end
end
function AFK:SetAFK(status)
if status and not self.isAFK then
if InspectFrame then
InspectPaperDollFrame:Hide()
end
RecountVisability(true)
UIParent:Hide()
self.AFKMode:Show()
RecountVisability()
E.global.afkEnabled = true
E.global.afkCameraSpeedYaw = GetCVar("cameraYawMoveSpeed")
E.global.afkCameraSpeedPitch = GetCVar("cameraPitchMoveSpeed")
MoveViewLeftStart()
SetCVar("cameraYawMoveSpeed", AFK_SPEED)
SetCVar("cameraPitchMoveSpeed", E.global.afkCameraSpeedPitch)
if IsInGuild() then
local guildName, guildRankName = GetGuildInfo("player")
self.AFKMode.bottom.guild:SetText(format("%s - %s", guildName, guildRankName))
else
self.AFKMode.bottom.guild:SetText(L["No Guild"])
end
self.startTime = GetTime()
self.timer = self:ScheduleRepeatingTimer("UpdateTimer", 1)
self.AFKMode.chat:RegisterEvent("CHAT_MSG_WHISPER")
self.AFKMode.chat:RegisterEvent("CHAT_MSG_GUILD")
self.AFKMode.bottom.model:SetModelScale(1)
self.AFKMode.bottom.model:RefreshUnit()
self.AFKMode.bottom.model:SetModelScale(0.8)
self.AFKMode.bottom.model.animTime = 0
self.AFKMode.bottom.model:SetScript("OnUpdate", UpdateAnimation)
self.AFKMode.bottom.model:SetScript("OnAnimFinished", OnAnimFinished)
self.isAFK = true
elseif not status and self.isAFK then
self.AFKMode:Hide()
UIParent:Show()
E.global.afkEnabled = nil
SetCVar("cameraYawMoveSpeed", E.global.afkCameraSpeedYaw)
SetCVar("cameraPitchMoveSpeed", E.global.afkCameraSpeedPitch)
MoveViewLeftStop()
self:CancelTimer(self.timer)
self.AFKMode.bottom.time:SetText("00:00")
self.AFKMode.chat:UnregisterAllEvents()
self.AFKMode.chat:Clear()
self.isAFK = false
RockConfigFix()
end
end
function AFK:OnEvent(event, ...)
if event == "PLAYER_REGEN_DISABLED" or event == "UPDATE_BATTLEFIELD_STATUS" then
if event == "UPDATE_BATTLEFIELD_STATUS" then
local status, _, instanceID
for i = 1, MAX_BATTLEFIELD_QUEUES do
status, _, instanceID = GetBattlefieldStatus(i)
if instanceID ~= 0 then
status = status
end
end
local status = status
if status == "confirm" then
self:SetAFK(false)
end
else
self:SetAFK(false)
end
if event == "PLAYER_REGEN_DISABLED" then
self:RegisterEvent("PLAYER_REGEN_ENABLED", "OnEvent")
end
return
end
if event == "PLAYER_REGEN_ENABLED" then
self:UnregisterEvent("PLAYER_REGEN_ENABLED")
end
if not E.db.general.afk then return end
if UnitAffectingCombat("player") or CinematicFrame:IsShown() then return end
-- if UnitCastingInfo("player") ~= nil then
-- --Don't activate afk if player is crafting stuff, check back in 30 seconds
-- self:ScheduleTimer("OnEvent", 30)
-- return
-- end
if arg1 == format(MARKED_AFK_MESSAGE, DEFAULT_AFK_MESSAGE) then
self:SetAFK(true)
elseif arg1 == CLEARED_AFK then
self:SetAFK(false)
end
end
function AFK:Toggle()
if E.db.general.afk then
self:RegisterEvent("CHAT_MSG_SYSTEM", "OnEvent")
self:RegisterEvent("PLAYER_FLAGS_CHANGED", "OnEvent")
self:RegisterEvent("PLAYER_REGEN_DISABLED", "OnEvent")
self:RegisterEvent("UPDATE_BATTLEFIELD_STATUS", "OnEvent")
SetCVar("autoClearAFK", "1")
else
self:UnregisterEvent("CHAT_MSG_SYSTEM")
self:UnregisterEvent("PLAYER_FLAGS_CHANGED")
self:UnregisterEvent("PLAYER_REGEN_DISABLED")
self:UnregisterEvent("UPDATE_BATTLEFIELD_STATUS")
self:CancelAllTimers()
end
end
local function OnKeyDown(_, key)
if ignoreKeys[key] then return end
if printKeys[key] then
Screenshot()
else
AFK:SetAFK(false)
AFK:ScheduleTimer("OnEvent", 60)
end
end
local function Chat_OnMouseWheel(self, delta)
if delta == 1 and IsShiftKeyDown() then
self:ScrollToTop()
elseif delta == -1 and IsShiftKeyDown() then
self:ScrollToBottom()
elseif delta == -1 then
self:ScrollDown()
else
self:ScrollUp()
end
end
function AFK:Initialize()
if E.global.afkEnabled then
SetCVar("cameraYawMoveSpeed", E.global.afkCameraSpeedYaw)
SetCVar("cameraPitchMoveSpeed", E.global.afkCameraSpeedPitch)
E.global.afkEnabled = nil
end
local _, class = UnitClass("player")
local classColor = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[class] or RAID_CLASS_COLORS[class]
self.AFKMode = CreateFrame("Frame", "ElvUIAFKFrame")
self.AFKMode:SetFrameLevel(1)
self.AFKMode:SetScale(UIParent:GetScale())
self.AFKMode:SetAllPoints(UIParent)
self.AFKMode:Hide()
self.AFKMode:EnableKeyboard(true)
self.AFKMode:SetScript("OnKeyDown", OnKeyDown)
self.AFKMode.chat = CreateFrame("ScrollingMessageFrame", "AFKChat", self.AFKMode)
self.AFKMode.chat:SetWidth(500)
self.AFKMode.chat:SetHeight(200)
self.AFKMode.chat:SetPoint("TOPLEFT", self.AFKMode, "TOPLEFT", 4, -3)
E:FontTemplate(self.AFKMode.chat)
self.AFKMode.chat:SetJustifyH("LEFT")
self.AFKMode.chat:SetMaxLines(500)
self.AFKMode.chat:EnableMouseWheel(true)
self.AFKMode.chat:SetFading(false)
self.AFKMode.chat:SetMovable(true)
self.AFKMode.chat:EnableMouse(true)
self.AFKMode.chat:SetClampedToScreen(true)
-- self.AFKMode.chat:SetClampRectInsets(-4, 3, 3, -4)
self.AFKMode.chat:RegisterForDrag("LeftButton")
self.AFKMode.chat:SetScript("OnDragStart", self.AFKMode.chat.StartMoving)
self.AFKMode.chat:SetScript("OnDragStop", self.AFKMode.chat.StopMovingOrSizing)
self.AFKMode.chat:SetScript("OnMouseWheel", Chat_OnMouseWheel)
-- self.AFKMode.chat:SetScript("OnEvent", CH.ChatFrame_OnEvent)
self.AFKMode.bottom = CreateFrame("Frame", nil, self.AFKMode)
self.AFKMode.bottom:SetFrameLevel(0)
E:SetTemplate(self.AFKMode.bottom, "Transparent")
self.AFKMode.bottom:SetPoint("BOTTOM", self.AFKMode, "BOTTOM", 0, -E.Border)
self.AFKMode.bottom:SetWidth(GetScreenWidth() + (E.Border*2))
self.AFKMode.bottom:SetHeight(GetScreenHeight() * 0.1)
self.AFKMode.bottom.logo = self.AFKMode:CreateTexture(nil, "OVERLAY")
self.AFKMode.bottom.logo:SetWidth(320)
self.AFKMode.bottom.logo:SetHeight(150)
self.AFKMode.bottom.logo:SetPoint("CENTER", self.AFKMode.bottom, "CENTER", 0, 50)
self.AFKMode.bottom.logo:SetTexture("Interface\\AddOns\\ElvUI\\media\\textures\\logo")
local factionGroup = UnitFactionGroup("player")
self.AFKMode.bottom.faction = self.AFKMode.bottom:CreateTexture(nil, "OVERLAY")
self.AFKMode.bottom.faction:SetPoint("BOTTOMLEFT", self.AFKMode.bottom, "BOTTOMLEFT", -20, -16)
self.AFKMode.bottom.faction:SetTexture("Interface\\AddOns\\ElvUI\\media\\textures\\"..factionGroup.."-Logo")
self.AFKMode.bottom.faction:SetWidth(140)
self.AFKMode.bottom.faction:SetHeight(140)
self.AFKMode.bottom.name = self.AFKMode.bottom:CreateFontString(nil, "OVERLAY")
E:FontTemplate(self.AFKMode.bottom.name, nil, 20)
self.AFKMode.bottom.name:SetText(format("%s - %s", E.myname, E.myrealm))
self.AFKMode.bottom.name:SetPoint("TOPLEFT", self.AFKMode.bottom.faction, "TOPRIGHT", -10, -28)
self.AFKMode.bottom.name:SetTextColor(classColor.r, classColor.g, classColor.b)
self.AFKMode.bottom.guild = self.AFKMode.bottom:CreateFontString(nil, "OVERLAY")
E:FontTemplate(self.AFKMode.bottom.guild, nil, 20)
self.AFKMode.bottom.guild:SetText(L["No Guild"])
self.AFKMode.bottom.guild:SetPoint("TOPLEFT", self.AFKMode.bottom.name, "BOTTOMLEFT", 0, -6)
self.AFKMode.bottom.guild:SetTextColor(0.7, 0.7, 0.7)
self.AFKMode.bottom.time = self.AFKMode.bottom:CreateFontString(nil, "OVERLAY")
E:FontTemplate(self.AFKMode.bottom.time, nil, 20)
self.AFKMode.bottom.time:SetText("00:00")
self.AFKMode.bottom.time:SetPoint("TOPLEFT", self.AFKMode.bottom.guild, "BOTTOMLEFT", 0, -6)
self.AFKMode.bottom.time:SetTextColor(0.7, 0.7, 0.7)
self.AFKMode.bottom.model = CreateFrame("PlayerModel", "ElvUIAFKPlayerModel", self.AFKMode.bottom)
self.AFKMode.bottom.model:SetPoint("BOTTOMRIGHT", self.AFKMode.bottom, "BOTTOMRIGHT", 120, -100)
self.AFKMode.bottom.model:SetWidth(800)
self.AFKMode.bottom.model:SetHeight(800)
self.AFKMode.bottom.model:SetFacing(6)
self.AFKMode.bottom.model:SetUnit("player")
self:Toggle()
end
local function InitializeCallback()
AFK:Initialize()
end
E:RegisterModule(AFK:GetName(), InitializeCallback)
+203
View File
@@ -0,0 +1,203 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local M = E:GetModule("Misc");
local CH = E:GetModule("Chat");
local CC = E:GetModule("ClassCache");
--Cache global variables
--Lua functions
local select, unpack, type = select, unpack, type
local format, gsub, match, gmatch = string.format, string.gsub, string.match, string.gmatch
local strlower = strlower
--WoW API / Variables
local CreateFrame = CreateFrame
function M:UpdateBubbleBorder()
if not this.text then return end
if E.private.general.chatBubbles == "backdrop" then
if E.PixelMode then
this:SetBackdropBorderColor(this.text:GetTextColor())
else
local r, g, b = this.text:GetTextColor()
this.bordertop:SetTexture(r, g, b)
this.borderbottom:SetTexture(r, g, b)
this.borderleft:SetTexture(r, g, b)
this.borderright:SetTexture(r, g, b)
end
end
if E.private.chat.enable and E.private.general.classCache and E.private.general.classColorMentionsSpeech then
local classColorTable, isFirstWord, rebuiltString, lowerCaseWord, tempWord, wordMatch, classMatch
local text = this.text:GetText()
if text and match(text, "%s-[^%s]+%s*") then
for word in gmatch(text, "%s-[^%s]+%s*") do
tempWord = gsub(word, "^[%s%p]-([^%s%p]+)([%-]?[^%s%p]-)[%s%p]*$","%1%2")
lowerCaseWord = strlower(tempWord)
classMatch = CC:GetCacheTable()[E.myrealm][tempWord]
wordMatch = classMatch and lowerCaseWord
if wordMatch and not E.global.chat.classColorMentionExcludedNames[wordMatch] then
classColorTable = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[classMatch] or RAID_CLASS_COLORS[classMatch]
word = gsub(word, gsub(tempWord, "%-","%%-"), format("\124cff%.2x%.2x%.2x%s\124r", classColorTable.r*255, classColorTable.g*255, classColorTable.b*255, tempWord))
end
if not isFirstWord then
rebuiltString = word
isFirstWord = true
else
rebuiltString = format("%s%s", rebuiltString, word)
end
end
if rebuiltString ~= nil then
this.text:SetText(rebuiltString)
end
end
end
end
function M:SkinBubble(frame)
local mult = E.mult * UIParent:GetScale()
for i = 1, frame:GetNumRegions() do
local region = select(i, frame:GetRegions())
if region:GetObjectType() == "Texture" then
region:SetTexture(nil)
elseif region:GetObjectType() == "FontString" then
frame.text = region
end
end
if frame.text then
if E.private.general.chatBubbles == "backdrop" then
if E.PixelMode then
E:SetTemplate(frame, "Transparent", true)
frame:SetBackdropColor(unpack(E.media.backdropfadecolor))
frame:SetBackdropBorderColor(0, 0, 0)
else
frame:SetBackdrop(nil)
end
local r, g, b = frame.text:GetTextColor()
if not E.PixelMode then
if not frame.backdrop then
frame.backdrop = frame:CreateTexture(nil, "BACKGROUND")
frame.backdrop:SetAllPoints(frame)
frame.backdrop:SetTexture(unpack(E.media.backdropfadecolor))
frame.bordertop = frame:CreateTexture(nil, "OVERLAY")
frame.bordertop:SetPoint("TOPLEFT", frame, "TOPLEFT", -mult*2, mult*2)
frame.bordertop:SetPoint("TOPRIGHT", frame, "TOPRIGHT", mult*2, mult*2)
frame.bordertop:SetHeight(mult)
frame.bordertop:SetTexture(r, g, b)
frame.bordertop.backdrop = frame:CreateTexture(nil, "BORDER")
frame.bordertop.backdrop:SetPoint("TOPLEFT", frame.bordertop, "TOPLEFT", -mult, mult)
frame.bordertop.backdrop:SetPoint("TOPRIGHT", frame.bordertop, "TOPRIGHT", mult, mult)
frame.bordertop.backdrop:SetHeight(mult * 3)
frame.bordertop.backdrop:SetTexture(0, 0, 0)
frame.borderbottom = frame:CreateTexture(nil, "OVERLAY")
frame.borderbottom:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", -mult*2, -mult*2)
frame.borderbottom:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", mult*2, -mult*2)
frame.borderbottom:SetHeight(mult)
frame.borderbottom:SetTexture(r, g, b)
frame.borderbottom.backdrop = frame:CreateTexture(nil, "BORDER")
frame.borderbottom.backdrop:SetPoint("BOTTOMLEFT", frame.borderbottom, "BOTTOMLEFT", -mult, -mult)
frame.borderbottom.backdrop:SetPoint("BOTTOMRIGHT", frame.borderbottom, "BOTTOMRIGHT", mult, -mult)
frame.borderbottom.backdrop:SetHeight(mult * 3)
frame.borderbottom.backdrop:SetTexture(0, 0, 0)
frame.borderleft = frame:CreateTexture(nil, "OVERLAY")
frame.borderleft:SetPoint("TOPLEFT", frame, "TOPLEFT", -mult*2, mult*2)
frame.borderleft:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", mult*2, -mult*2)
frame.borderleft:SetWidth(mult)
frame.borderleft:SetTexture(r, g, b)
frame.borderleft.backdrop = frame:CreateTexture(nil, "BORDER")
frame.borderleft.backdrop:SetPoint("TOPLEFT", frame.borderleft, "TOPLEFT", -mult, mult)
frame.borderleft.backdrop:SetPoint("BOTTOMLEFT", frame.borderleft, "BOTTOMLEFT", -mult, -mult)
frame.borderleft.backdrop:SetWidth(mult * 3)
frame.borderleft.backdrop:SetTexture(0, 0, 0)
frame.borderright = frame:CreateTexture(nil, "OVERLAY")
frame.borderright:SetPoint("TOPRIGHT", frame, "TOPRIGHT", mult*2, mult*2)
frame.borderright:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -mult*2, -mult*2)
frame.borderright:SetWidth(mult)
frame.borderright:SetTexture(r, g, b)
frame.borderright.backdrop = frame:CreateTexture(nil, "BORDER")
frame.borderright.backdrop:SetPoint("TOPRIGHT", frame.borderright, "TOPRIGHT", mult, mult)
frame.borderright.backdrop:SetPoint("BOTTOMRIGHT", frame.borderright, "BOTTOMRIGHT", mult, -mult)
frame.borderright.backdrop:SetWidth(mult * 3)
frame.borderright.backdrop:SetTexture(0, 0, 0)
end
else
frame:SetBackdropColor(unpack(E.media.backdropfadecolor))
frame:SetBackdropBorderColor(r, g, b)
end
E:FontTemplate(frame.text, E.LSM:Fetch("font", E.private.general.chatBubbleFont), E.private.general.chatBubbleFontSize, E.private.general.chatBubbleFontOutline)
elseif E.private.general.chatBubbles == "backdrop_noborder" then
frame:SetBackdrop(nil)
if not frame.backdrop then
frame.backdrop = frame:CreateTexture(nil, "ARTWORK")
E:SetInside(frame.backdrop, frame, 4, 4)
frame.backdrop:SetTexture(unpack(E.media.backdropfadecolor))
end
E:FontTemplate(frame.text, E.LSM:Fetch("font", E.private.general.chatBubbleFont), E.private.general.chatBubbleFontSize, E.private.general.chatBubbleFontOutline)
frame:SetClampedToScreen(false)
elseif E.private.general.chatBubbles == "nobackdrop" then
frame:SetBackdrop(nil)
E:FontTemplate(frame.text, E.LSM:Fetch("font", E.private.general.chatBubbleFont), E.private.general.chatBubbleFontSize, E.private.general.chatBubbleFontOutline)
frame:SetClampedToScreen(false)
end
end
HookScript(frame, "OnShow", M.UpdateBubbleBorder)
frame:SetFrameStrata("DIALOG")
M.UpdateBubbleBorder(frame)
frame.isBubblePowered = true
end
function M:IsChatBubble(frame)
for i = 1, frame:GetNumRegions() do
local region = select(i, frame:GetRegions())
if region.GetTexture and region:GetTexture() and type(region:GetTexture() == "string" and strlower(region:GetTexture()) == [[interface\tooltips\chatbubble-background]]) then return true end
end
return false
end
local numChildren = 0
function M:LoadChatBubbles()
if E.private.general.bubbles == false then
E.private.general.chatBubbles = "disabled"
E.private.general.bubbles = nil
end
if E.private.general.chatBubbles == "disabled" then return end
local frame = CreateFrame("Frame")
frame.lastupdate = -2
frame:SetScript("OnUpdate", function()
this.lastupdate = this.lastupdate + arg1
if this.lastupdate < .1 then return end
this.lastupdate = 0
local count = WorldFrame:GetNumChildren()
if count ~= numChildren then
for i = numChildren + 1, count do
local frame = select(i, WorldFrame:GetChildren())
if frame.GetObjectType and frame:GetObjectType() == "Frame" and M:IsChatBubble(frame) then
M:SkinBubble(frame)
end
end
numChildren = count
end
end)
end
+8
View File
@@ -0,0 +1,8 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="Misc.lua"/>
<Script file="AFK.lua"/>
<Script file="ChatBubbles.lua"/>
<Script file="Loot.lua"/>
<Script file="LootRoll.lua"/>
<Script file="RaidMarker.lua"/>
</Ui>
+328
View File
@@ -0,0 +1,328 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local M = E:GetModule("Misc");
--Cache global variables
--Lua functions
local max = math.max
local tinsert = table.insert
local unpack, pairs = unpack, pairs
--WoW API / Variables
local CloseLoot = CloseLoot
local CursorOnUpdate = CursorOnUpdate
local CursorUpdate = CursorUpdate
local GetCVar = GetCVar
local GetCursorPosition = GetCursorPosition
local GetLootSlotInfo = GetLootSlotInfo
local GetLootSlotLink = GetLootSlotLink
local GetNumLootItems = GetNumLootItems
local GiveMasterLoot = GiveMasterLoot
local IsFishingLoot = IsFishingLoot
local LootSlot = LootSlot
local LootSlotIsCoin = LootSlotIsCoin
local LootSlotIsItem = LootSlotIsItem
local ResetCursor = ResetCursor
local UnitIsDead = UnitIsDead
local UnitIsFriend = UnitIsFriend
local UnitName = UnitName
local ITEM_QUALITY_COLORS = ITEM_QUALITY_COLORS
local LOOT = LOOT
-- Credit Haste
local lootFrame, lootFrameHolder
local iconSize = 30
local sq, ss, sn
local OnEnter = function()
local slot = this:GetID()
if(LootSlotIsItem(slot)) then
GameTooltip:SetOwner(this, "ANCHOR_RIGHT")
GameTooltip:SetLootItem(slot)
CursorUpdate(this)
end
this.drop:Show()
this.drop:SetVertexColor(1, 1, 0)
end
local OnLeave = function()
if this.quality and (this.quality > 1) then
local color = ITEM_QUALITY_COLORS[this.quality]
this.drop:SetVertexColor(color.r, color.g, color.b)
else
this.drop:Hide()
end
GameTooltip:Hide()
ResetCursor()
end
local OnClick = function()
LootFrame.selectedQuality = this.quality
LootFrame.selectedItemName = this.name:GetText()
LootFrame.selectedSlot = this:GetID()
LootFrame.selectedLootButton = this:GetName()
StaticPopup_Hide("CONFIRM_LOOT_DISTRIBUTION")
ss = this:GetID()
sq = this.quality
sn = this.name:GetText()
--LootSlot(ss)
end
local OnShow = function()
if(GameTooltip:IsOwned(this)) then
GameTooltip:SetOwner(this, "ANCHOR_RIGHT")
GameTooltip:SetLootItem(this:GetID())
CursorOnUpdate(this)
end
end
local function anchorSlots(self)
local shownSlots = 0
for i = 1, getn(self.slots) do
local frame = self.slots[i]
if(frame:IsShown()) then
shownSlots = shownSlots + 1
frame:SetPoint("TOP", lootFrame, 4, (-8 + iconSize) - (shownSlots * iconSize))
end
end
self:SetHeight(max(shownSlots * iconSize + 16, 20))
end
local function createSlot(id)
local frame = CreateFrame("LootButton", "ElvLootSlot"..id, lootFrame)
frame:SetPoint("LEFT", 8, 0)
frame:SetPoint("RIGHT", -8, 0)
frame:SetHeight(iconSize - 2)
frame:SetID(id)
frame:SetScript("OnEnter", OnEnter)
frame:SetScript("OnLeave", OnLeave)
frame:SetScript("OnClick", OnClick)
frame:SetScript("OnShow", OnShow)
local iconFrame = CreateFrame("Frame", nil, frame)
iconFrame:SetWidth(iconSize - 2)
iconFrame:SetHeight(iconSize - 2)
iconFrame:SetPoint("RIGHT", frame)
E:SetTemplate(iconFrame, "Default")
frame.iconFrame = iconFrame
E["frames"][iconFrame] = nil
local icon = iconFrame:CreateTexture(nil, "ARTWORK")
icon:SetTexCoord(unpack(E.TexCoords))
E:SetInside(icon)
frame.icon = icon
local count = iconFrame:CreateFontString(nil, "OVERLAY")
count:SetJustifyH("RIGHT")
count:SetPoint("BOTTOMRIGHT", iconFrame, -2, 2)
E:FontTemplate(count, nil, nil, "OUTLINE")
count:SetText(1)
frame.count = count
local name = frame:CreateFontString(nil, "OVERLAY")
name:SetJustifyH("LEFT")
name:SetPoint("LEFT", frame)
name:SetPoint("RIGHT", icon, "LEFT")
name:SetNonSpaceWrap(true)
E:FontTemplate(name, nil, nil, "OUTLINE")
frame.name = name
local drop = frame:CreateTexture(nil, "ARTWORK")
drop:SetTexture("Interface\\QuestFrame\\UI-QuestLogTitleHighlight")
drop:SetPoint("LEFT", icon, "RIGHT", 0, 0)
drop:SetPoint("RIGHT", frame)
drop:SetAllPoints(frame)
drop:SetAlpha(.3)
frame.drop = drop
lootFrame.slots[id] = frame
return frame
end
function M:LOOT_SLOT_CLEARED()
if not lootFrame:IsShown() then return end
lootFrame.slots[arg1]:Hide()
anchorSlots(lootFrame)
end
function M:LOOT_CLOSED()
StaticPopup_Hide("LOOT_BIND")
lootFrame:Hide()
for _, v in pairs(lootFrame.slots) do
v:Hide()
end
end
function M:OPEN_MASTER_LOOT_LIST()
ToggleDropDownMenu(1, nil, GroupLootDropDown, lootFrame.slots[ss], 0, 0)
end
function M:UPDATE_MASTER_LOOT_LIST()
UIDropDownMenu_Refresh(GroupLootDropDown)
end
function M:LOOT_OPENED(_, autoLoot)
lootFrame:Show()
if(not lootFrame:IsShown()) then
CloseLoot(autoLoot == 0)
end
local items = GetNumLootItems()
if(IsFishingLoot()) then
lootFrame.title:SetText(L["Fishy Loot"])
elseif(not UnitIsFriend("player", "target") and UnitIsDead("target")) then
lootFrame.title:SetText(UnitName("target"))
else
lootFrame.title:SetText(LOOT)
end
-- Blizzard uses strings here
if E.private.general.lootUnderMouse then
local x, y = GetCursorPosition()
x = x / lootFrame:GetEffectiveScale()
y = y / lootFrame:GetEffectiveScale()
lootFrame:ClearAllPoints()
lootFrame:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", x - 40, y + 20)
lootFrame:GetCenter()
lootFrame:Raise()
else
lootFrame:ClearAllPoints()
lootFrame:SetPoint("TOPLEFT", lootFrameHolder, "TOPLEFT")
end
local m, w, t = 0, 0, lootFrame.title:GetStringWidth()
if(items > 0) then
for i = 1, items do
local slot = lootFrame.slots[i] or createSlot(i)
local texture, item, quantity, quality = GetLootSlotInfo(i)
local color = ITEM_QUALITY_COLORS[quality]
if(LootSlotIsCoin(i)) then
item = item:gsub("\n", ", ")
end
if quantity and (quantity > 1) then
slot.count:SetText(quantity)
slot.count:Show()
else
slot.count:Hide()
end
if quality and (quality > 1) then
slot.drop:SetVertexColor(color.r, color.g, color.b)
slot.drop:Show()
else
slot.drop:Hide()
end
slot.quality = quality
slot.name:SetText(item)
if color then
slot.name:SetTextColor(color.r, color.g, color.b)
end
slot.icon:SetTexture(texture)
if quality then
m = max(m, quality)
end
w = max(w, slot.name:GetStringWidth())
slot:SetID(i)
slot:SetSlot(i)
slot:Enable()
slot:Show()
end
else
local slot = lootFrame.slots[1] or createSlot(1)
local color = ITEM_QUALITY_COLORS[0]
slot.name:SetText(L["Empty Slot"])
if color then
slot.name:SetTextColor(color.r, color.g, color.b)
end
slot.icon:SetTexture[[Interface\Icons\INV_Misc_Herb_AncientLichen]]
items = 1
w = max(w, slot.name:GetStringWidth())
slot.count:Hide()
slot.drop:Hide()
slot:Disable()
slot:Show()
end
anchorSlots(lootFrame)
w = w + 60
t = t + 5
local color = ITEM_QUALITY_COLORS[m]
lootFrame:SetBackdropBorderColor(color.r, color.g, color.b, .8)
lootFrame:SetWidth(max(w, t))
end
function M:LoadLoot()
if not E.private.general.loot then return end
lootFrameHolder = CreateFrame("Frame", "ElvLootFrameHolder", E.UIParent)
lootFrameHolder:SetPoint("TOPLEFT", 36, -195)
lootFrameHolder:SetWidth(150)
lootFrameHolder:SetHeight(22)
lootFrame = CreateFrame("Button", "ElvLootFrame", lootFrameHolder)
lootFrame:SetClampedToScreen(true)
lootFrame:SetPoint("TOPLEFT", 0, 0)
lootFrame:SetWidth(256)
lootFrame:SetHeight(64)
E:SetTemplate(lootFrame, "Transparent")
lootFrame:SetFrameStrata("FULLSCREEN")
lootFrame:SetToplevel(true)
lootFrame.title = lootFrame:CreateFontString(nil, "OVERLAY")
E:FontTemplate(lootFrame.title, nil, nil, "OUTLINE")
lootFrame.title:SetPoint("BOTTOMLEFT", lootFrame, "TOPLEFT", 0, 1)
lootFrame.slots = {}
lootFrame:SetScript("OnHide", function()
StaticPopup_Hide("CONFIRM_LOOT_DISTRIBUTION")
CloseLoot()
end)
E["frames"][lootFrame] = nil
self:RegisterEvent("LOOT_OPENED")
self:RegisterEvent("LOOT_SLOT_CLEARED")
self:RegisterEvent("LOOT_CLOSED")
self:RegisterEvent("OPEN_MASTER_LOOT_LIST")
self:RegisterEvent("UPDATE_MASTER_LOOT_LIST")
E:CreateMover(lootFrameHolder, "LootFrameMover", L["Loot Frame"])
-- Fuzz
LootFrame:UnregisterAllEvents()
ElvLootFrame:Hide() -- May need another fix. Frame shows without.
tinsert(UISpecialFrames, "ElvLootFrame")
function _G.GroupLootDropDown_GiveLoot()
if(sq >= MASTER_LOOT_THREHOLD) then
local dialog = StaticPopup_Show("CONFIRM_LOOT_DISTRIBUTION", ITEM_QUALITY_COLORS[sq].hex..sn..FONT_COLOR_CODE_CLOSE, this:GetText())
if (dialog) then
dialog.data = this.value
end
else
GiveMasterLoot(ss, this.value)
end
CloseDropDownMenus()
end
E.PopupDialogs["CONFIRM_LOOT_DISTRIBUTION"].OnAccept = function(data)
GiveMasterLoot(ss, data)
end
StaticPopupDialogs["CONFIRM_LOOT_DISTRIBUTION"].preferredIndex = 3
end
+323
View File
@@ -0,0 +1,323 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local M = E:GetModule("Misc");
--Cache global variables
--Lua functions
local find = string.find
local pairs, unpack, ipairs, next, tonumber = pairs, unpack, ipairs, next, tonumber
local tinsert = table.insert
--WoW API / Variables
local CursorOnUpdate = CursorOnUpdate
local DressUpItemLink = DressUpItemLink
local GetLootRollItemInfo = GetLootRollItemInfo
local GetLootRollItemLink = GetLootRollItemLink
local GetLootRollTimeLeft = GetLootRollTimeLeft
local IsModifiedClick = IsModifiedClick
local IsShiftKeyDown = IsShiftKeyDown
local ResetCursor = ResetCursor
local RollOnLoot = RollOnLoot
local ShowInspectCursor = ShowInspectCursor
local CUSTOM_CLASS_COLORS = CUSTOM_CLASS_COLORS
local ITEM_QUALITY_COLORS = ITEM_QUALITY_COLORS
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
local pos = "TOP"
local cancelled_rolls = {}
local FRAME_WIDTH, FRAME_HEIGHT = 328, 28
M.RollBars = {}
local locale = GetLocale()
local rollpairs = locale == "deDE" and {
["(.*) würfelt nicht für: (.+|r)$"] = "pass",
["(.*) hat für (.+) 'Gier' ausgewählt"] = "greed",
["(.*) hat für (.+) 'Bedarf' ausgewählt"] = "need",
} or locale == "frFR" and {
["(.*) a passé pour : (.+)"] = "pass",
["(.*) a choisi Cupidité pour : (.+)"] = "greed",
["(.*) a choisi Besoin pour : (.+)"] = "need",
} or locale == "zhTW" and {
["(.*)放棄了:(.+)"] = "pass",
["(.*)選擇了貪婪:(.+)"] = "greed",
["(.*)選擇了需求:(.+)"] = "need",
} or locale == "ruRU" and {
["(.*) отказывается от предмета (.+)%."] = "pass",
["Разыгрывается: (.+)%. (.*): \"Не откажусь\""] = "greed",
["Разыгрывается: (.+)%. (.*): \"Мне это нужно\""] = "need",
} or locale == "koKR" and {
["(.*)님이 주사위 굴리기를 포기했습니다: (.+)"] = "pass",
["(.*)님이 차비를 선택했습니다: (.+)"] = "greed",
["(.*)님이 입찰을 선택했습니다: (.+)"] = "need",
} or locale == "esES" and {
["^(.*) pasó de: (.+|r)$"] = "pass",
["(.*) eligió Codicia para: (.+)"] = "greed",
["(.*) eligió Necesidad para: (.+)"] = "need",
} or locale == "esMX" and {
["^(.*) pasó de: (.+|r)$"] = "pass",
["(.*) eligió Codicia para: (.+)"] = "greed",
["(.*) eligió Necesidad para: (.+)"] = "need",
} or {
["^(.*) passed on: (.+|r)$"] = "pass",
["(.*) has selected Greed for: (.+)"] = "greed",
["(.*) has selected Need for: (.+)"] = "need",
}
local function ClickRoll(frame)
RollOnLoot(frame.parent.rollID, frame.rolltype)
end
local function HideTip() GameTooltip:Hide() end
local function HideTip2() GameTooltip:Hide() ResetCursor() end
local rolltypes = {"need", "greed", [0] = "pass"}
local function SetTip(frame)
GameTooltip:SetOwner(frame, "ANCHOR_RIGHT")
GameTooltip:SetText(frame.tiptext)
if(frame:IsEnabled() == 0) then
GameTooltip:AddLine("|cffff3333"..L["Can't Roll"])
end
for name, tbl in pairs(frame.parent.rolls) do
if(tbl[1] == rolltypes[frame.rolltype] and tbl[2]) then
local classColor = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[tbl[2]] or RAID_CLASS_COLORS[tbl[2]]
GameTooltip:AddLine(name, classColor.r, classColor.g, classColor.b)
end
end
GameTooltip:Show()
end
local function SetItemTip(frame)
if(not frame.link) then return end
GameTooltip:SetOwner(frame, "ANCHOR_TOPLEFT")
GameTooltip:SetHyperlink(frame.link)
if(IsShiftKeyDown()) then
GameTooltip_ShowCompareItem()
end
if(IsModifiedClick("DRESSUP")) then
ShowInspectCursor()
else
ResetCursor()
end
end
local function ItemOnUpdate(self)
if(IsShiftKeyDown()) then
GameTooltip_ShowCompareItem()
end
CursorOnUpdate(self)
end
local function LootClick(frame)
if(IsControlKeyDown()) then
DressUpItemLink(frame.link)
elseif(IsShiftKeyDown()) then
ChatEdit_InsertLink(frame.link)
end
end
local function OnEvent(frame, _, rollID)
cancelled_rolls[rollID] = true
if(frame.rollID ~= rollID) then return end
frame.rollID = nil
frame.time = nil
frame:Hide()
end
local function StatusUpdate(frame)
if(not frame.parent.rollID) then return end
local t = GetLootRollTimeLeft(frame.parent.rollID)
local perc = t / frame.parent.time
frame.spark:Point("CENTER", frame, "LEFT", perc * frame:GetWidth(), 0)
frame:SetValue(t)
if(t > 1000000000) then
frame:GetParent():Hide()
end
end
local function CreateRollButton(parent, ntex, ptex, htex, rolltype, tiptext)
local f = CreateFrame("Button", nil, parent)
E:Point(f, unpack(args))
f:Size(FRAME_HEIGHT - 4)
f:SetNormalTexture(ntex)
if(ptex) then f:SetPushedTexture(ptex) end
f:SetHighlightTexture(htex)
f.rolltype = rolltype
f.parent = parent
f.tiptext = tiptext
f:SetScript("OnEnter", SetTip)
f:SetScript("OnLeave", HideTip)
f:SetScript("OnClick", ClickRoll)
local txt = f:CreateFontString(nil, nil)
txt:FontTemplate(nil, nil, "OUTLINE")
txt:Point("CENTER", 0, rolltype == 2 and 1 or rolltype == 0 and -1.2 or 0)
return f, txt
end
function M:CreateRollFrame()
local frame = CreateFrame("Frame", nil, E.UIParent)
frame:Size(FRAME_WIDTH, FRAME_HEIGHT)
frame:SetTemplate("Default")
frame:SetScript("OnEvent", OnEvent)
frame:RegisterEvent("CANCEL_LOOT_ROLL")
frame:Hide()
local button = CreateFrame("Button", nil, frame)
button:Point("RIGHT", frame, "LEFT", -(E.Spacing*3), 0)
button:Size(FRAME_HEIGHT - (E.Border * 2))
button:CreateBackdrop("Default")
button:SetScript("OnEnter", SetItemTip)
button:SetScript("OnLeave", HideTip2)
button:SetScript("OnUpdate", ItemOnUpdate)
button:SetScript("OnClick", LootClick)
frame.button = button
button.icon = button:CreateTexture(nil, "OVERLAY")
button.icon:SetAllPoints()
button.icon:SetTexCoord(unpack(E.TexCoords))
local tfade = frame:CreateTexture(nil, "BORDER")
tfade:Point("TOPLEFT", frame, "TOPLEFT", 4, 0)
tfade:Point("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -4, 0)
tfade:SetTexture("Interface\\ChatFrame\\ChatFrameBackground")
tfade:SetBlendMode("ADD")
tfade:SetGradientAlpha("VERTICAL", .1, .1, .1, 0, .1, .1, .1, 0)
local status = CreateFrame("StatusBar", nil, frame)
status:SetInside()
status:SetScript("OnUpdate", StatusUpdate)
status:SetFrameLevel(status:GetFrameLevel() - 1)
status:SetStatusBarTexture(E["media"].normTex)
E:RegisterStatusBar(status)
status:SetStatusBarColor(.8, .8, .8, .9)
status.parent = frame
frame.status = status
status.bg = status:CreateTexture(nil, "BACKGROUND")
status.bg:SetAlpha(0.1)
status.bg:SetAllPoints()
local spark = frame:CreateTexture(nil, "OVERLAY")
spark:Size(14, FRAME_HEIGHT)
spark:SetTexture("Interface\\CastingBar\\UI-CastingBar-Spark")
spark:SetBlendMode("ADD")
status.spark = spark
local need, needtext = CreateRollButton(frame, "Interface\\Buttons\\UI-GroupLoot-Dice-Up", "Interface\\Buttons\\UI-GroupLoot-Dice-Highlight", "Interface\\Buttons\\UI-GroupLoot-Dice-Down", 1, NEED, "LEFT", frame.button, "RIGHT", 5, -1)
local greed, greedtext = CreateRollButton(frame, "Interface\\Buttons\\UI-GroupLoot-Coin-Up", "Interface\\Buttons\\UI-GroupLoot-Coin-Highlight", "Interface\\Buttons\\UI-GroupLoot-Coin-Down", 2, GREED, "LEFT", need, "RIGHT", 0, -1)
local pass, passtext = CreateRollButton(frame, "Interface\\AddOns\\ElvUI\\media\\textures\\UI-GroupLoot-Pass-Up", nil, "Interface\\AddOns\\ElvUI\\media\\textures\\UI-GroupLoot-Pass-Down", 0, PASS, "LEFT", greed, "RIGHT", 0, 2)
frame.needbutt, frame.greedbutt = need, greed
frame.need, frame.greed, frame.pass = needtext, greedtext, passtext
local bind = frame:CreateFontString()
bind:Point("LEFT", pass, "RIGHT", 3, 1)
bind:FontTemplate(nil, nil, "OUTLINE")
frame.fsbind = bind
local loot = frame:CreateFontString(nil, "ARTWORK")
loot:FontTemplate(nil, nil, "OUTLINE")
loot:Point("LEFT", bind, "RIGHT", 0, 0)
loot:Point("RIGHT", frame, "RIGHT", -5, 0)
loot:Size(200, 10)
loot:SetJustifyH("LEFT")
frame.fsloot = loot
frame.rolls = {}
return frame
end
local function GetFrame()
for _, f in ipairs(M.RollBars) do
if(not f.rollID) then
return f
end
end
local f = M:CreateRollFrame()
if(pos == "TOP") then
f:Point("TOP", next(M.RollBars) and M.RollBars[getn(M.RollBars)] or AlertFrameHolder, "BOTTOM", 0, -4)
else
f:Point("BOTTOM", next(M.RollBars) and M.RollBars[getn(M.RollBars)] or AlertFrameHolder, "TOP", 0, 4)
end
tinsert(M.RollBars, f)
return f
end
function M:START_LOOT_ROLL(_, rollID, time)
if(cancelled_rolls[rollID]) then return end
local f = GetFrame()
f.rollID = rollID
f.time = time
for i in pairs(f.rolls) do f.rolls[i] = nil end
f.need:SetText(0)
f.greed:SetText(0)
f.pass:SetText(0)
local texture, name, count, quality, bindOnPickUp = GetLootRollItemInfo(rollID)
f.button.icon:SetTexture(texture)
f.button.link = GetLootRollItemLink(rollID)
f.needbutt:Enable()
f.greedbutt:Enable()
SetDesaturation(f.needbutt:GetNormalTexture())
SetDesaturation(f.greedbutt:GetNormalTexture())
f.needbutt:SetAlpha(1)
f.greedbutt:SetAlpha(1)
f.fsbind:SetText(bindOnPickUp and "BoP" or "BoE")
f.fsbind:SetVertexColor(bindOnPickUp and 1 or .3, bindOnPickUp and .3 or 1, bindOnPickUp and .1 or .3)
local color = ITEM_QUALITY_COLORS[quality]
f.fsloot:SetText(name)
f.status:SetStatusBarColor(color.r, color.g, color.b, .7)
f.status.bg:SetTexture(color.r, color.g, color.b)
f.status:SetMinMaxValues(0, time)
f.status:SetValue(time)
f:SetPoint("CENTER", WorldFrame, "CENTER")
f:Show()
if(E.db.general.autoRoll and UnitLevel("player") == MAX_PLAYER_LEVEL and quality == 2 and not bindOnPickUp) then
RollOnLoot(rollID, 2)
end
end
function M:ParseRollChoice(msg)
if not msg then return end
for i, v in pairs(rollpairs) do
local _, _, playername, itemname = find(msg, i)
if(locale == "ruRU" and (v == "greed" or v == "need")) then
local temp = playername
playername = itemname
itemname = temp
end
if(playername and itemname and playername ~= "Everyone") then return playername, itemname, v end
end
end
function M:CHAT_MSG_LOOT(_, msg)
local playername, itemname, rolltype = self:ParseRollChoice(msg)
if(playername and itemname and rolltype) then
local class = select(2, UnitClass(playername))
for _, f in ipairs(M.RollBars) do
if(f.rollID and f.button.link == itemname and not f.rolls[playername]) then
f.rolls[playername] = { rolltype, class }
f[rolltype]:SetText(tonumber(f[rolltype]:GetText()) + 1)
return
end
end
end
end
function M:LoadLootRoll()
if(not E.private.general.lootRoll) then return end
self:RegisterEvent("CHAT_MSG_LOOT")
self:RegisterEvent("START_LOOT_ROLL")
UIParent:UnregisterEvent("START_LOOT_ROLL")
UIParent:UnregisterEvent("CANCEL_LOOT_ROLL")
end
+194
View File
@@ -0,0 +1,194 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local M = E:NewModule("Misc", "AceEvent-3.0", "AceTimer-3.0");
E.Misc = M
--Cache global variables
--Lua functions
local format, gsub = string.format, string.gsub
--WoW API / Variables
local CanMerchantRepair = CanMerchantRepair
local GetFriendInfo = GetFriendInfo
local GetGuildRosterInfo = GetGuildRosterInfo
local GetNumFriends = GetNumFriends
local GetNumGuildMembers = GetNumGuildMembers
local GetNumPartyMembers = GetNumPartyMembers
local GetNumRaidMembers = GetNumRaidMembers
local GetPartyMember = GetPartyMember
local GetRepairAllCost = GetRepairAllCost
local GuildRoster = GuildRoster
local IsInGuild = IsInGuild
local IsInInstance = IsInInstance
local IsShiftKeyDown = IsShiftKeyDown
local RepairAllItems = RepairAllItems
local UninviteUnit = UninviteUnit
local UnitInRaid = UnitInRaid
local UnitName = UnitName
local UIErrorsFrame = UIErrorsFrame
local MAX_PARTY_MEMBERS = MAX_PARTY_MEMBERS
local interruptMsg = INTERRUPTED.." %s's \124cff71d5ff\124Hspell:%d\124h[%s]\124h\124r!"
function M:ErrorFrameToggle(event)
if not E.db.general.hideErrorFrame then return end
if event == "PLAYER_REGEN_DISABLED" then
UIErrorsFrame:UnregisterEvent("UI_ERROR_MESSAGE")
else
UIErrorsFrame:RegisterEvent("UI_ERROR_MESSAGE")
end
end
function M:COMBAT_LOG_EVENT_UNFILTERED(_, _, event, _, sourceName, _, _, destName, _, _, _, _, spellID, spellName)
if E.db.general.interruptAnnounce == "NONE" then return end
if not (event == "SPELL_INTERRUPT" and sourceName == UnitName("player")) then return end
local party = GetNumPartyMembers()
if E.db.general.interruptAnnounce == "SAY" then
if party > 0 then
SendChatMessage(format(interruptMsg, destName, spellID, spellName), "SAY")
end
elseif E.db.general.interruptAnnounce == "EMOTE" then
if party > 0 then
SendChatMessage(format(interruptMsg, destName, spellID, spellName), "EMOTE")
end
else
local raid = GetNumRaidMembers()
local _, instanceType = IsInInstance()
local battleground = instanceType == "pvp"
if E.db.general.interruptAnnounce == "PARTY" then
if party > 0 then
SendChatMessage(format(interruptMsg, destName, spellID, spellName), battleground and "BATTLEGROUND" or "PARTY")
end
elseif E.db.general.interruptAnnounce == "RAID" then
if raid > 0 then
SendChatMessage(format(interruptMsg, destName, spellID, spellName), battleground and "BATTLEGROUND" or "RAID")
elseif party > 0 then
SendChatMessage(format(interruptMsg, destName, spellID, spellName), battleground and "BATTLEGROUND" or "PARTY")
end
elseif E.db.general.interruptAnnounce == "RAID_ONLY" then
if raid > 0 then
SendChatMessage(format(interruptMsg, destName, spellID, spellName), battleground and "BATTLEGROUND" or "RAID")
end
end
end
end
function M:MERCHANT_SHOW()
if E.db.general.vendorGrays then
E:GetModule("Bags"):VendorGrays(nil, true)
end
local autoRepair = E.db.general.autoRepair
if IsShiftKeyDown() or autoRepair == "NONE" or not CanMerchantRepair() then return end
local cost, possible = GetRepairAllCost()
if cost > 0 then
if possible then
RepairAllItems(autoRepair == "PLAYER")
E:Print(L["Your items have been repaired for: "]..E:FormatMoney(cost, "BLIZZARD"))
else
E:Print(L["You don't have enough money to repair."])
end
end
end
function M:DisbandRaidGroup()
if UnitInRaid("player") then
for i = 1, GetNumRaidMembers() do
local name, _, _, _, _, _, _, online = GetRaidRosterInfo(i)
if online and name ~= E.myname then
UninviteUnit(name)
end
end
else
for i = MAX_PARTY_MEMBERS, 1, -1 do
if GetPartyMember(i) then
UninviteUnit(UnitName("party"..i))
end
end
end
LeaveParty()
end
function M:PVPMessageEnhancement(_, msg)
if not E.db.general.enhancedPvpMessages then return end
local _, instanceType = IsInInstance()
if instanceType == "pvp" or instanceType == "arena" then
RaidNotice_AddMessage(RaidBossEmoteFrame, msg, ChatTypeInfo["RAID_BOSS_EMOTE"])
end
end
local hideStatic = false
function M:AutoInvite(event, leaderName)
if not E.db.general.autoAcceptInvite then return end
if event == "PARTY_INVITE_REQUEST" then
if GetNumPartyMembers() > 0 or GetNumRaidMembers() > 0 then return end
hideStatic = true
-- Update Guild and Friendlist
local numFriends = GetNumFriends()
if numFriends > 0 then ShowFriends() end
if IsInGuild() then GuildRoster() end
local inGroup = false
for friendIndex = 1, numFriends do
local friendName = gsub(GetFriendInfo(friendIndex), "-.*", "")
if friendName == leaderName then
AcceptGroup()
inGroup = true
break
end
end
if not inGroup then
for guildIndex = 1, GetNumGuildMembers(true) do
local guildMemberName = gsub(GetGuildRosterInfo(guildIndex), "-.*", "")
if guildMemberName == leaderName then
AcceptGroup()
inGroup = true
break
end
end
end
elseif event == "PARTY_MEMBERS_CHANGED" and hideStatic == true then
StaticPopup_Hide("PARTY_INVITE")
hideStatic = false
end
end
function M:ForceCVars()
if E.private.general.loot then
if E.private.general.lootUnderMouse then
E:DisableMover("LootFrameMover")
else
E:EnableMover("LootFrameMover")
end
end
end
function M:Initialize()
self:LoadRaidMarker()
self:LoadLoot()
self:LoadLootRoll()
self:LoadChatBubbles()
self:RegisterEvent("MERCHANT_SHOW")
self:RegisterEvent("PLAYER_REGEN_DISABLED", "ErrorFrameToggle")
self:RegisterEvent("PLAYER_REGEN_ENABLED", "ErrorFrameToggle")
-- self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
self:RegisterEvent("CHAT_MSG_BG_SYSTEM_HORDE", "PVPMessageEnhancement")
self:RegisterEvent("CHAT_MSG_BG_SYSTEM_ALLIANCE", "PVPMessageEnhancement")
self:RegisterEvent("CHAT_MSG_BG_SYSTEM_NEUTRAL", "PVPMessageEnhancement")
self:RegisterEvent("PARTY_INVITE_REQUEST", "AutoInvite")
self:RegisterEvent("PARTY_MEMBERS_CHANGED", "AutoInvite")
self:RegisterEvent("CVAR_UPDATE", "ForceCVars")
self:RegisterEvent("PLAYER_ENTERING_WORLD", "ForceCVars")
end
local function InitializeCallback()
M:Initialize()
end
E:RegisterModule(M:GetName(), InitializeCallback)
+107
View File
@@ -0,0 +1,107 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local M = E:GetModule("Misc");
--Cache global variables
--Lua functions
local sin, cos, pi = math.sin, math.cos, math.pi
--WoW API / Variables
local CreateFrame = CreateFrame
local GetNumPartyMembers = GetNumPartyMembers
local UnitInRaid = UnitInRaid
local UnitIsPartyLeader = UnitIsPartyLeader
local UnitExists, UnitIsDead = UnitExists, UnitIsDead
local GetCursorPosition = GetCursorPosition
local PlaySound = PlaySound
local SetRaidTarget = SetRaidTarget
local SetRaidTargetIconTexture = SetRaidTargetIconTexture
local UIErrorsFrame = UIErrorsFrame
local ButtonIsDown
function M:RaidMarkCanMark()
if not self.RaidMarkFrame then return false end
if GetNumPartyMembers() > 0 then
if UnitIsPartyLeader("player") or UnitInRaid("player") and not UnitIsPartyLeader("player") then
return true
else
UIErrorsFrame:AddMessage(L["You don't have permission to mark targets."], 1.0, 0.1, 0.1, 1.0)
return false
end
else
return true
end
end
function M:RaidMarkShowIcons()
if not UnitExists("target") or UnitIsDead("target") then
return
end
local x, y = GetCursorPosition()
local scale = E.UIParent:GetEffectiveScale()
self.RaidMarkFrame:SetPoint("CENTER", E.UIParent, "BOTTOMLEFT", x / scale, y / scale)
self.RaidMarkFrame:Show()
end
function RaidMark_HotkeyPressed(keystate)
ButtonIsDown = keystate == "down" and M:RaidMarkCanMark()
if ButtonIsDown and M.RaidMarkFrame then
M:RaidMarkShowIcons()
elseif M.RaidMarkFrame then
M.RaidMarkFrame:Hide()
end
end
function M:RaidMark_OnEvent()
if ButtonIsDown and self.RaidMarkFrame then
self:RaidMarkShowIcons()
end
end
M:RegisterEvent("PLAYER_TARGET_CHANGED", "RaidMark_OnEvent")
function M:RaidMarkButton_OnEnter()
this.Texture:ClearAllPoints()
this.Texture:SetPoint("TOPLEFT", -10, 10)
this.Texture:SetPoint("BOTTOMRIGHT", 10, -10)
end
function M:RaidMarkButton_OnLeave()
this.Texture:SetAllPoints()
end
function M:RaidMarkButton_OnClick(button)
PlaySound("UChatScrollButton")
SetRaidTarget("target", button ~= "RightButton" and this:GetID() or 0)
this:GetParent():Hide()
end
function M:LoadRaidMarker()
local marker = CreateFrame("Frame", nil, E.UIParent)
marker:EnableMouse(true)
marker:SetWidth(100)
marker:SetHeight(100)
marker:SetFrameStrata("DIALOG")
for i = 1, 8 do
local button = CreateFrame("Button", "RaidMarkIconButton" .. i, marker)
button:SetWidth(40)
button:SetHeight(40)
button:SetID(i)
button.Texture = button:CreateTexture(button:GetName() .. "NormalTexture", "ARTWORK")
button.Texture:SetTexture("Interface\\TargetingFrame\\UI-RaidTargetingIcons")
button.Texture:SetAllPoints()
SetRaidTargetIconTexture(button.Texture, i)
button:RegisterForClicks("LeftbuttonUp","RightbuttonUp")
button:SetScript("OnClick", M.RaidMarkButton_OnClick)
button:SetScript("OnEnter", M.RaidMarkButton_OnEnter)
button:SetScript("OnLeave", M.RaidMarkButton_OnLeave)
if i == 8 then
button:SetPoint("CENTER", 0, 0)
else
local angle = pi / 0.7 * i
button:SetPoint("CENTER", sin(angle) * 60, cos(angle) * 60)
end
end
M.RaidMarkFrame = marker
end