From 4ac6b9808df51efef87f5890498fa6202bb8e73b Mon Sep 17 00:00:00 2001 From: Darthpred Date: Mon, 18 Nov 2013 03:30:44 +0400 Subject: [PATCH] Even more. Everything seems ok so far. But I feel we'll need to run some tests and stuff before releasing shit. --- ElvUI_SLE/modules/exprepbar/exprepbar.lua | 58 ++--- ElvUI_SLE/modules/farm/farm.lua | 8 +- ElvUI_SLE/modules/loot/loot.lua | 268 +++++++++++----------- ElvUI_SLE/modules/unitframes/update_elements.lua | 52 +---- 4 files changed, 180 insertions(+), 206 deletions(-) diff --git a/ElvUI_SLE/modules/exprepbar/exprepbar.lua b/ElvUI_SLE/modules/exprepbar/exprepbar.lua index 49b87f7..7ad7e5c 100755 --- a/ElvUI_SLE/modules/exprepbar/exprepbar.lua +++ b/ElvUI_SLE/modules/exprepbar/exprepbar.lua @@ -2,15 +2,21 @@ local E, L, V, P, G, _ = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, Pr local M = E:GetModule('Misc'); local strMatchCombat = {} -tinsert(strMatchCombat, (string.gsub(FACTION_STANDING_INCREASED,"%%%d?%$?s", "(.+)"))) -tinsert(strMatchCombat, (string.gsub(FACTION_STANDING_INCREASED_GENERIC,"%%%d?%$?s", "(.+)"))) -tinsert(strMatchCombat, (string.gsub(FACTION_STANDING_INCREASED_BONUS,"%%%d?%$?s", "(.+)"))) -tinsert(strMatchCombat, (string.gsub(FACTION_STANDING_INCREASED_DOUBLE_BONUS,"%%%d?%$?s", "(.+)"))) -tinsert(strMatchCombat, (string.gsub(FACTION_STANDING_INCREASED_ACH_BONUS,"%%%d?%$?s", "(.+)"))) -local strChangeMatch = (string.gsub(FACTION_STANDING_CHANGED,"%%%d?%$?s", "(.+)")) +local tinsert, gsub, format = tinsert, string.gsub, format +local GetXPExhaustion = GetXPExhaustion +local SetMinMaxValues = SetMinMaxValues +local GetFactionInfo = GetFactionInfo +local GetGuildInfo = GetGuildInfo + +tinsert(strMatchCombat, (gsub(FACTION_STANDING_INCREASED,"%%%d?%$?s", "(.+)"))) +tinsert(strMatchCombat, (gsub(FACTION_STANDING_INCREASED_GENERIC,"%%%d?%$?s", "(.+)"))) +tinsert(strMatchCombat, (gsub(FACTION_STANDING_INCREASED_BONUS,"%%%d?%$?s", "(.+)"))) +tinsert(strMatchCombat, (gsub(FACTION_STANDING_INCREASED_DOUBLE_BONUS,"%%%d?%$?s", "(.+)"))) +tinsert(strMatchCombat, (gsub(FACTION_STANDING_INCREASED_ACH_BONUS,"%%%d?%$?s", "(.+)"))) +local strChangeMatch = (gsub(FACTION_STANDING_CHANGED,"%%%d?%$?s", "(.+)")) local strGuildChangeMatch = {} -tinsert(strGuildChangeMatch, (string.gsub(FACTION_STANDING_CHANGED_GUILD,"%%%d?%$?s", "(.+)"))) -tinsert(strGuildChangeMatch, (string.gsub(FACTION_STANDING_CHANGED_GUILDNAME,"%%%d?%$?s", "(.+)"))) +tinsert(strGuildChangeMatch, (gsub(FACTION_STANDING_CHANGED_GUILD,"%%%d?%$?s", "(.+)"))) +tinsert(strGuildChangeMatch, (gsub(FACTION_STANDING_CHANGED_GUILDNAME,"%%%d?%$?s", "(.+)"))) local collapsed = {} local guildName @@ -38,19 +44,19 @@ function M:UpdateExperience(event) if E.db.sle.exprep.explong then if textFormat == 'PERCENT' then - text = string.format('%d%% '..L['Rested:']..' %d%%', cur / max * 100, rested / max * 100) + text = format('%d%% '..L['Rested:']..' %d%%', cur / max * 100, rested / max * 100) elseif textFormat == 'CURMAX' then - text = string.format('%s - %s '..L['Rested:']..' %s', cur, max, rested) + text = format('%s - %s '..L['Rested:']..' %s', cur, max, rested) elseif textFormat == 'CURPERC' then - text = string.format('%s - %d%% '..L['Rested:']..' %s [%d%%]', cur, cur / max * 100, rested, rested / max * 100) + text = format('%s - %d%% '..L['Rested:']..' %s [%d%%]', cur, cur / max * 100, rested, rested / max * 100) end else if textFormat == 'PERCENT' then - text = string.format('%d%% R:%d%%', cur / max * 100, rested / max * 100) + text = format('%d%% R:%d%%', cur / max * 100, rested / max * 100) elseif textFormat == 'CURMAX' then - text = string.format('%s - %s R:%s', E:ShortValue(cur), E:ShortValue(max), E:ShortValue(rested)) + text = format('%s - %s R:%s', E:ShortValue(cur), E:ShortValue(max), E:ShortValue(rested)) elseif textFormat == 'CURPERC' then - text = string.format('%s - %d%% R:%s [%d%%]', E:ShortValue(cur), cur / max * 100, E:ShortValue(rested), rested / max * 100) + text = format('%s - %d%% R:%s [%d%%]', E:ShortValue(cur), cur / max * 100, E:ShortValue(rested), rested / max * 100) end end else @@ -59,19 +65,19 @@ function M:UpdateExperience(event) if E.db.sle.exprep.explong then if textFormat == 'PERCENT' then - text = string.format('%d%%', cur / max * 100) + text = format('%d%%', cur / max * 100) elseif textFormat == 'CURMAX' then - text = string.format('%s - %s', cur, max) + text = format('%s - %s', cur, max) elseif textFormat == 'CURPERC' then - text = string.format('%s - %d%%', cur, cur / max * 100) + text = format('%s - %d%%', cur, cur / max * 100) end else if textFormat == 'PERCENT' then - text = string.format('%d%%', cur / max * 100) + text = format('%d%%', cur / max * 100) elseif textFormat == 'CURMAX' then - text = string.format('%s - %s', E:ShortValue(cur), E:ShortValue(max)) + text = format('%s - %s', E:ShortValue(cur), E:ShortValue(max)) elseif textFormat == 'CURPERC' then - text = string.format('%s - %d%%', E:ShortValue(cur), cur / max * 100) + text = format('%s - %d%%', E:ShortValue(cur), cur / max * 100) end end end @@ -112,19 +118,19 @@ function M:UpdateReputation(event) if E.db.sle.exprep.replong then if textFormat == 'PERCENT' then - text = string.format('%d%% [%s]', ((value - min) / (max - min) * 100), _G['FACTION_STANDING_LABEL'..ID]) + text = format('%d%% [%s]', ((value - min) / (max - min) * 100), _G['FACTION_STANDING_LABEL'..ID]) elseif textFormat == 'CURMAX' then - text = string.format('%s - %s [%s]', value - min, max - min, _G['FACTION_STANDING_LABEL'..ID]) + text = format('%s - %s [%s]', value - min, max - min, _G['FACTION_STANDING_LABEL'..ID]) elseif textFormat == 'CURPERC' then - text = string.format('%s - %d%% [%s]', value - min, ((value - min) / (max - min) * 100), _G['FACTION_STANDING_LABEL'..ID]) + text = format('%s - %d%% [%s]', value - min, ((value - min) / (max - min) * 100), _G['FACTION_STANDING_LABEL'..ID]) end else if textFormat == 'PERCENT' then - text = string.format('%d%% [%s]', ((value - min) / (max - min) * 100), _G['FACTION_STANDING_LABEL'..ID]) + text = format('%d%% [%s]', ((value - min) / (max - min) * 100), _G['FACTION_STANDING_LABEL'..ID]) elseif textFormat == 'CURMAX' then - text = string.format('%s - %s [%s]', E:ShortValue(value - min), E:ShortValue(max - min), _G['FACTION_STANDING_LABEL'..ID]) + text = format('%s - %s [%s]', E:ShortValue(value - min), E:ShortValue(max - min), _G['FACTION_STANDING_LABEL'..ID]) elseif textFormat == 'CURPERC' then - text = string.format('%s: %s - %d%% [%s]', name, E:ShortValue(value - min), ((value - min) / (max - min) * 100), _G['FACTION_STANDING_LABEL'..ID]) + text = format('%s: %s - %d%% [%s]', name, E:ShortValue(value - min), ((value - min) / (max - min) * 100), _G['FACTION_STANDING_LABEL'..ID]) end end diff --git a/ElvUI_SLE/modules/farm/farm.lua b/ElvUI_SLE/modules/farm/farm.lua index 8088993..001f32c 100755 --- a/ElvUI_SLE/modules/farm/farm.lua +++ b/ElvUI_SLE/modules/farm/farm.lua @@ -5,10 +5,16 @@ local F = E:NewModule('Farm', 'AceHook-3.0', 'AceEvent-3.0'); local SLE = E:GetModule('SLE'); local SeedAnchor, ToolAnchor, PortalAnchor -local tsort = table.sort +local tsort, format = table.sort, format local farmzones = { BL["Sunsong Ranch"], BL["The Halfhill Market"] } local size local Zcheck = false +local GetSubZoneText = GetSubZoneText +local InCombatLockdown = InCombatLockdown +local GetItemCount = GetItemCount +local Point = Point +local GetItemInfo = GetItemInfo + FseedButtons = {} FtoolButtons = {} diff --git a/ElvUI_SLE/modules/loot/loot.lua b/ElvUI_SLE/modules/loot/loot.lua index e7e21e0..8acbc5b 100755 --- a/ElvUI_SLE/modules/loot/loot.lua +++ b/ElvUI_SLE/modules/loot/loot.lua @@ -1,131 +1,139 @@ ---Raid mark bar. Similar to quickmark which just semms to be impossible to skin -local E, L, V, P, G, _ = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB, Localize Underscore -local LT = E:NewModule('Loot', 'AceHook-3.0', 'AceEvent-3.0') -local check = false -local t = 0 -local loottemp = {} - -function LT:Check() - local name, rank, isML - for x = 1, GetNumGroupMembers() do - name, rank, _, _, _, _, _, _, _, _, isML = GetRaidRosterInfo(x) - if name == UnitName("player") and isML then - return true - elseif name == UnitName("player") and rank == 1 then - return true - elseif name == UnitName("player") and rank == 2 then - return true - end - end - return false -end - -function LT:Announce() - local name = {} - local loot = {} - local numbers = {} - local m = 0 - local q = E.db.sle.loot.quality == "EPIC" and 4 or E.db.sle.loot.quality == "RARE" and 3 or E.db.sle.loot.quality == "UNCOMMON" and 2 - local n = 0 - local inGroup, inRaid, inPartyLFG = IsInGroup(), IsInRaid(), IsPartyLFG() - local p, chat - if not inGroup then return end -- not in group, exit. - if (LT:Check() and E.db.sle.loot.auto) or (IsLeftControlKeyDown() and (IsInGroup() or IsInRaid())) then - for i = 1, GetNumLootItems() do - if GetLootSlotType(i) == 1 then - for j = 1, t do - if GetLootSlotLink(i) == loottemp[j] then - check = true - end - end - end - end - if check == false or IsLeftControlKeyDown() then - for i = 1, GetNumLootItems() do - if GetLootSlotType(i) ~= 1 then - m = m + 1 - else - local _, item, quantity, quality = GetLootSlotInfo(i) - if quality >= q then - name[i] = item - - k = 1 - while name[i] ~= name[k] do - k = k + 1 - end - - if i == k then - n = n + 1 - loot[n] = GetLootSlotLink(i) - numbers[n] = quantity - else - - p = 1 - while GetLootSlotLink(k) ~= loot[p] do - p = p + 1 - end - numbers[p] = numbers[p] + quantity - - end - end - end - end - if n ~= 0 then - if E.db.sle.loot.chat == "PARTY" then - SendChatMessage(L["Loot Dropped:"], inPartyLFG and "INSTANCE_CHAT" or "PARTY") - elseif E.db.sle.loot.chat == "RAID" then - if inRaid then - SendChatMessage(L["Loot Dropped:"], inPartyLFG and "INSTANCE_CHAT" or "RAID") - else - SendChatMessage(L["Loot Dropped:"], inPartyLFG and "INSTANCE_CHAT" or "PARTY") - end - elseif E.db.sle.loot.chat == "SAY" then - SendChatMessage(L["Loot Dropped:"], "SAY") - end - end - for i = 1, n do - if E.db.sle.loot.chat == "PARTY" then - if numbers[i] == 1 then - SendChatMessage(i..". "..loot[i], inPartyLFG and "INSTANCE_CHAT" or "PARTY") - elseif numbers[i] > 1 then - SendChatMessage(i..". "..loot[i].."x"..numbers[i], inPartyLFG and "INSTANCE_CHAT" or "PARTY") - end - elseif E.db.sle.loot.chat == "RAID" then - if inRaid then - if numbers[i] == 1 then - SendChatMessage(i..". "..loot[i], inPartyLFG and "INSTANCE_CHAT" or "RAID") - elseif numbers[i] > 1 then - SendChatMessage(i..". "..loot[i].."x"..numbers[i], inPartyLFG and "INSTANCE_CHAT" or "RAID") - end - else - if numbers[i] == 1 then - SendChatMessage(i..". "..loot[i], inPartyLFG and "INSTANCE_CHAT" or "PARTY") - elseif numbers[i] > 1 then - SendChatMessage(i..". "..loot[i].."x"..numbers[i], inPartyLFG and "INSTANCE_CHAT" or "PARTY") - end - end - elseif E.db.sle.loot.chat == "SAY" then - if numbers[i] == 1 then - SendChatMessage(i..". "..loot[i], "SAY") - elseif numbers[i] > 1 then - SendChatMessage(i..". "..loot[i].."x"..numbers[i], "SAY") - end - end - end - end - for i = 1, GetNumLootItems() do - if GetLootSlotType(i) == 1 then - loottemp[i] = GetLootSlotLink(i) - end - end - t = GetNumLootItems() - check = false - end -end - -function LT:Initialize() - if not E.private.sle.loot.enable then return end - self:RegisterEvent("LOOT_OPENED", "Announce") -end - +--Raid mark bar. Similar to quickmark which just semms to be impossible to skin +local E, L, V, P, G, _ = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB, Localize Underscore +local LT = E:NewModule('Loot', 'AceHook-3.0', 'AceEvent-3.0') +local check = false +local t = 0 +local loottemp = {} +local MyName = E.myname +local IsInGroup, IsInRaid, IsPartyLFG = IsInGroup, IsInRaid, IsPartyLFG +local GetNumGroupMembers, GetRaidRosterInfo = GetNumGroupMembers, GetRaidRosterInfo +local GetLootSlotType = GetLootSlotType +local GetNumLootItems = GetNumLootItems +local IsLeftControlKeyDown = IsLeftControlKeyDown +local GetLootSlotLink = GetLootSlotLink +local GetLootSlotInfo = GetLootSlotInfo + +function LT:Check() + local name, rank, isML + for x = 1, GetNumGroupMembers() do + name, rank, _, _, _, _, _, _, _, _, isML = GetRaidRosterInfo(x) + if name == MyName and isML then + return true + elseif name == MyName and rank == 1 then + return true + elseif name == MyName and rank == 2 then + return true + end + end + return false +end + +function LT:Announce() + local name = {} + local loot = {} + local numbers = {} + local m = 0 + local q = E.db.sle.loot.quality == "EPIC" and 4 or E.db.sle.loot.quality == "RARE" and 3 or E.db.sle.loot.quality == "UNCOMMON" and 2 + local n = 0 + --local inGroup, inRaid, inPartyLFG = IsInGroup(), IsInRaid(), IsPartyLFG() + local p, chat + if not IsInGroup() then return end -- not in group, exit. + if (LT:Check() and E.db.sle.loot.auto) or (IsLeftControlKeyDown() and (IsInGroup() or IsInRaid())) then + for i = 1, GetNumLootItems() do + if GetLootSlotType(i) == 1 then + for j = 1, t do + if GetLootSlotLink(i) == loottemp[j] then + check = true + end + end + end + end + if check == false or IsLeftControlKeyDown() then + for i = 1, GetNumLootItems() do + if GetLootSlotType(i) ~= 1 then + m = m + 1 + else + local _, item, quantity, quality = GetLootSlotInfo(i) + if quality >= q then + name[i] = item + + k = 1 + while name[i] ~= name[k] do + k = k + 1 + end + + if i == k then + n = n + 1 + loot[n] = GetLootSlotLink(i) + numbers[n] = quantity + else + + p = 1 + while GetLootSlotLink(k) ~= loot[p] do + p = p + 1 + end + numbers[p] = numbers[p] + quantity + + end + end + end + end + if n ~= 0 then + if E.db.sle.loot.chat == "PARTY" then + SendChatMessage(L["Loot Dropped:"], IsPartyLFG() and "INSTANCE_CHAT" or "PARTY") + elseif E.db.sle.loot.chat == "RAID" then + if IsInRaid() then + SendChatMessage(L["Loot Dropped:"], IsPartyLFG() and "INSTANCE_CHAT" or "RAID") + else + SendChatMessage(L["Loot Dropped:"], IsPartyLFG() and "INSTANCE_CHAT" or "PARTY") + end + elseif E.db.sle.loot.chat == "SAY" then + SendChatMessage(L["Loot Dropped:"], "SAY") + end + end + for i = 1, n do + if E.db.sle.loot.chat == "PARTY" then + if numbers[i] == 1 then + SendChatMessage(i..". "..loot[i], IsPartyLFG() and "INSTANCE_CHAT" or "PARTY") + elseif numbers[i] > 1 then + SendChatMessage(i..". "..loot[i].."x"..numbers[i], IsPartyLFG() and "INSTANCE_CHAT" or "PARTY") + end + elseif E.db.sle.loot.chat == "RAID" then + if IsInRaid() then + if numbers[i] == 1 then + SendChatMessage(i..". "..loot[i], IsPartyLFG() and "INSTANCE_CHAT" or "RAID") + elseif numbers[i] > 1 then + SendChatMessage(i..". "..loot[i].."x"..numbers[i], IsPartyLFG() and "INSTANCE_CHAT" or "RAID") + end + else + if numbers[i] == 1 then + SendChatMessage(i..". "..loot[i], IsPartyLFG() and "INSTANCE_CHAT" or "PARTY") + elseif numbers[i] > 1 then + SendChatMessage(i..". "..loot[i].."x"..numbers[i], IsPartyLFG() and "INSTANCE_CHAT" or "PARTY") + end + end + elseif E.db.sle.loot.chat == "SAY" then + if numbers[i] == 1 then + SendChatMessage(i..". "..loot[i], "SAY") + elseif numbers[i] > 1 then + SendChatMessage(i..". "..loot[i].."x"..numbers[i], "SAY") + end + end + end + end + for i = 1, GetNumLootItems() do + if GetLootSlotType(i) == 1 then + loottemp[i] = GetLootSlotLink(i) + end + end + t = GetNumLootItems() + check = false + end +end + +function LT:Initialize() + if not E.private.sle.loot.enable then return end + self:RegisterEvent("LOOT_OPENED", "Announce") +end + E:RegisterModule(LT:GetName()) \ No newline at end of file diff --git a/ElvUI_SLE/modules/unitframes/update_elements.lua b/ElvUI_SLE/modules/unitframes/update_elements.lua index f3395c1..78e41b3 100755 --- a/ElvUI_SLE/modules/unitframes/update_elements.lua +++ b/ElvUI_SLE/modules/unitframes/update_elements.lua @@ -2,6 +2,8 @@ local E, L, V, P, G, _ = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, Pr if not E.private.unitframe.enable then return end local UF = E:GetModule('UnitFrames'); +local format = format + --Replacement of text formats on unitframes. local styles = { ['CURRENT'] = '%s', @@ -36,52 +38,4 @@ function E:GetFormattedTextSLE(style, min, max) elseif style == 'CURRENT_MAX_PERCENT' then return format(useStyle, min, max, format("%.1f", min / max * 100)) end -end - ---[[if E.myclass == "WARLOCK" then - ElvUF_Player.ShardBar.PostUpdate = function(self, spec) - local maxBars = self.number - local db = self:GetParent().db - local frame = self:GetParent() - - for i=1, UF['classMaxResourceBar'][E.myclass] do - if self[i]:IsShown() and db.classbar.fill == 'spaced' then - self[i].backdrop:Show() - else - self[i].backdrop:Hide() - end - end - - if not E.db.unitframe.units.player.classbar.offset then - if db.classbar.fill == 'spaced' and maxBars == 1 then - self:ClearAllPoints() - self:Point("LEFT", frame.Health.backdrop, "TOPLEFT", 8, 0) - elseif db.classbar.fill == 'spaced' then - self:ClearAllPoints() - self:Point("CENTER", frame.Health.backdrop, "TOP", -12, -2) - end - else - if db.classbar.fill == 'spaced' and maxBars == 1 then - self:ClearAllPoints() - self:Point("CENTER", frame.Health.backdrop, "TOP", db.classbar.xOffset -(E:Scale(2)*3 + 6), db.classbar.yOffset -E:Scale(1)) - elseif db.classbar.fill == 'spaced' then - self:ClearAllPoints() - self:Point("CENTER", frame.Health.backdrop, "TOP", db.classbar.xOffset -(E:Scale(2)*3 + 6), db.classbar.yOffset -E:Scale(1)) - end - end - - local SPACING = db.classbar.fill == 'spaced' and 13 or 1 - for i = 1, maxBars do - self[i]:SetHeight(self:GetHeight()) - self[i]:SetWidth((self:GetWidth() - (maxBars - 1)) / maxBars) - self[i]:ClearAllPoints() - if i == 1 then - self[i]:SetPoint("LEFT", self) - else - self[i]:Point("LEFT", self[i-1], "RIGHT", SPACING , 0) - end - end - - UF:UpdatePlayerFrameAnchors(frame, self:IsShown()) - end -end]] \ No newline at end of file +end \ No newline at end of file -- 1.7.9.5