r13483 - trunk/XLootMonitor

0 views
Skip to first unread message

ace...@svn.wowace.com

unread,
Oct 9, 2006, 10:04:39 PM10/9/06
to clad...@gmail.com, wow...@googlegroups.com
Author: xuerian
Date: 2006-10-09 22:04:39 -0400 (Mon, 09 Oct 2006)
New Revision: 13483

Modified:
trunk/XLootMonitor/XLootMonitor.lua
trunk/XLootMonitor/XLootMonitorOptions.lua
trunk/XLootMonitor/localization.enUS.lua
Log:
XLootMonitor: Added group money loot (Not group loot yet >_<) to handled messages. Fixed lack of pairs() in a couple places. Fixed per-anchor locking.

Modified: trunk/XLootMonitor/XLootMonitor.lua
===================================================================
--- trunk/XLootMonitor/XLootMonitor.lua 2006-10-10 01:50:27 UTC (rev 13482)
+++ trunk/XLootMonitor/XLootMonitor.lua 2006-10-10 02:04:39 UTC (rev 13483)
@@ -14,6 +14,7 @@
lock = false,
qualitythreshold = 1,
selfqualitythreshold = 0,
+ money = true,
texcolor = true,
strata = "LOW",
layout = 1,
@@ -40,7 +41,7 @@
function XLootMonitor:OnEnable()
self:RegisterEvent("CHAT_MSG_LOOT", "MsgHandler")
--self:Hook("GroupLootFrame_OpenNewFrame")
- --self:RegisterEvent(" CHAT_MSG_MONEY", "MsgHandler")
+ self:RegisterEvent("CHAT_MSG_MONEY", "MsgHandler")
if not self.stacks.loot then
self:BuildFrame("loot", "Loot Monitor")
end
@@ -55,13 +56,14 @@
return "^"..string.gsub(string.gsub(string.gsub(handler, "%.", "%%."), "(%%s)", "(.+)"), "(%%d)", "(%%d+)").."$"
end

-function XLootMonitor:BuildHandler(pat, targ, thing, num, rtype, rnum)
+function XLootMonitor:BuildHandler(pat, targ, thing, num)
return { pattern = self:Capturize(pat), recipient = targ, item = thing, count = num }
end

function XLootMonitor:LocalizeLootHandlers()
local s = "self"
- return {
+ return {
+ self:BuildHandler(LOOT_MONEY_SPLIT, s, "coin", 1),
self:BuildHandler(LOOT_ITEM_MULTIPLE, 1, 2, 3),
self:BuildHandler(LOOT_ITEM, 1, 2),
self:BuildHandler(LOOT_ITEM_SELF_MULTIPLE, s, 1, 2),
@@ -72,29 +74,40 @@
end

function XLootMonitor:MsgHandler(text) -- Thanks to Looto code
+ --DEFAULT_CHAT_FRAME:AddMessage("|cff7fff7fXLootMonitor|r: "..text)
local item, recipient, found
- for i in ipairs(self.filters.loot) do
- local currentFilter = self.filters.loot[i]
+ for i, v in pairs(self.filters.loot) do
+ local currentFilter = v
local matches = {}
+ --DEFAULT_CHAT_FRAME:AddMessage("|cff7fff7fXLootMonitor|r: "..currentFilter.pattern)
found,_,matches[1],matches[2],matches[3], matches[4], matches[5] = string.find(text, currentFilter.pattern)
- --DEFAULT_CHAT_FRAME:AddMessage("|cff7fff7fXLootMonitor|r: "..currentFilter.pattern)

if found then
- if self.filters.loot[i].recipient == "self" then
+ if v.recipient == "self" then
recipient = UnitName("player")
else
- recipient = matches[self.filters.loot[i].recipient]
+ recipient = matches[v.recipient]
end
- item = matches[self.filters.loot[i].item]
-
+ if v.item == "coin" then
+ item = "coin"
+ else
+ item = matches[v.item]
+ end

local count = 1
- if self.filters.loot[i].count ~= nil then
- count = matches[self.filters.loot[i].count]
+ if item == "coin" then
+ count = { }
+ for k2, v2 in pairs({GOLD, SILVER, COPPER}) do
+ _, _, count[v2] = string.find(matches[v.count], "(%d+) "..v2)
+ count[v2] = tonumber(count[v2])
+ end
+ else
+ if v.count ~= nil then
+ count = matches[v.count]
+ end
end

self:AddLoot(item, recipient, count)
-
break
end
end
@@ -109,14 +122,21 @@
end

function XLootMonitor:AddLoot(item, recipient, count)
- local itemid = XLoot:LinkToID(item)
- local itemName, itemLink, itemQuality, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemTexture = XLoot:ItemInfo(itemid)
- if recipient == UnitName("player") then
- if itemQuality < self.db.profile.selfqualitythreshold then
- return
+ local itemName, itemLink, itemQuality, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemTexture
+ if item ~= "coin" then
+ local itemid = XLoot:LinkToID(item)
+ itemName, itemLink, itemQuality, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemTexture = XLoot:ItemInfo(itemid)
+ if recipient == UnitName("player") then
+ if itemQuality < self.db.profile.selfqualitythreshold then
+ return
+ end
+ else
+ if itemQuality < self.db.profile.qualitythreshold then
+ return
+ end
end
else
- if itemQuality < self.db.profile.qualitythreshold then
+ if not self.db.profile.money then
return
end
end
@@ -142,35 +162,55 @@
end
end

+ local loottext = ""
+ if item == "coin" then
+ loottext, count.total = self:ParseMoney(count, {{GOLD, 10000, "ffd700"}, {SILVER, 100, "c7c7cf"}, {COPPER, 1, "eda55f"}})
+ elseif tonumber(count) > 1 then
+ loottext = count.."x ["..itemName.."]"
+ else
+ loottext = "["..itemName.."]"
+ end

stack.rows[id].recipient = recipient
- stack.rows[id].item = itemName
+ stack.rows[id].item = itemName or "coin"
stack.rows[id].count = count
stack.rows[id].link = item
stack.rows[id].itemid = itemid
-
- local loottext
- if tonumber(count) > 1 then
- loottext = count.."x ["..itemName.."]"
+
+ if item == "coin" then
+ stack.rows[id].fsplayer:SetText(loottext)
+ stack.rows[id].fsloot:SetText("")
+ SetItemButtonTexture(stack.rows[id].button, GetCoinIcon(count.total))
else
- loottext = "["..itemName.."]"
+ stack.rows[id].fsplayer:SetText(recipient)
+ stack.rows[id].fsloot:SetText(loottext)
+ SetItemButtonTexture(stack.rows[id].button, itemTexture)
+ stack.rows[id].fsloot:SetVertexColor(GetItemQualityColor(itemQuality))
+ local _, class = UnitClass(self:idFromPlayerName(recipient))
+ local c = RAID_CLASS_COLORS[class]
+ stack.rows[id].fsplayer:SetVertexColor(c.r, c.g, c.b)
end
-
- stack.rows[id].fsplayer:SetText(recipient)
- stack.rows[id].fsloot:SetText(loottext)
--stack.rows[id].fsdebug:SetText(tostring(id))
-
- stack.rows[id].fsloot:SetVertexColor(GetItemQualityColor(itemQuality))
- local _, class = UnitClass(self:idFromPlayerName(recipient))
- local c = RAID_CLASS_COLORS[class]
- stack.rows[id].fsplayer:SetVertexColor(c.r, c.g, c.b)
-
- SetItemButtonTexture(stack.rows[id].button, itemTexture)
-
+
self:SizeRow(stack, id)
self:PushRow(stack, id)
end

+function XLootMonitor:ParseMoney(var, values)
+ local string, total = "", 0
+ for k, v in pairs(values) do
+ if var[v[1]] then
+ total = total + (var[v[1]] * v[2])
+ if string ~= "" then
+ string = string..", |cFF"..v[3]..v[2].." "..v[1].."|r"
+ else
+ string = v[2].." "..v[1]
+ end
+ end
+ end
+ return string, total
+end
+
function XLootMonitor:NewStack(stackname)
local db = self.db.profile
if not db.stacks[stackname] then
@@ -204,10 +244,10 @@
end

function XLootMonitor:Restack(stack)
- for k, v in stack.rowstack do
+ for k, v in pairs(stack.rowstack) do
v:ClearAllPoints();
end
- for k, v in stack.rowstack do
+ for k, v in pairs(stack.rowstack) do
if k == 1 then
self:StackRow(stack, stack.rowstack[k], stack.frame, k)
else
@@ -289,7 +329,7 @@
end

function XLootMonitor:DragStart(stack, culprit)
- if not self.db.profile.lock then
+ if not self.db.profile.lock and not self.db.profile.stacks[stack.name].lock then
stack.frame:StartMoving()
if culprit then
culprit.dragging = true
@@ -318,6 +358,8 @@
local frame, button, overlay
frame = CreateFrame("Frame", "XLMonitorRow"..id, UIParent)
button = CreateFrame("Button", "XLMonitorRowButton"..id, frame, "ItemButtonTemplate")
+ _G[button:GetName().."NormalTexture"]:SetWidth(66)
+ _G[button:GetName().."NormalTexture"]:SetHeight(66)
overlay = CreateFrame("Button", "XLMonitorRowOverlay"..id, frame)

frame.fsplayer = frame:CreateFontString("XLMonitorRow"..id.."Player", "ARTWORK", "GameFontNormalSmall")

Modified: trunk/XLootMonitor/XLootMonitorOptions.lua
===================================================================
--- trunk/XLootMonitor/XLootMonitorOptions.lua 2006-10-10 01:50:27 UTC (rev 13482)
+++ trunk/XLootMonitor/XLootMonitorOptions.lua 2006-10-10 02:04:39 UTC (rev 13483)
@@ -58,8 +58,16 @@
name = L["optSelfQualThreshold"],
desc = L["descSelfQualThreshold"],
args = { },
- order = 15
+ order = 16
},
+ money = {
+ type = "toggle",
+ name = L["optMoney"],
+ desc = L["descMoney"],
+ set = function(v) db.money = v end,
+ get = function() return db.money end,
+ order = 17,
+ },
xlootspacer = {
type = "header",
order = 85

Modified: trunk/XLootMonitor/localization.enUS.lua
===================================================================
--- trunk/XLootMonitor/localization.enUS.lua 2006-10-10 01:50:27 UTC (rev 13482)
+++ trunk/XLootMonitor/localization.enUS.lua 2006-10-10 02:04:39 UTC (rev 13483)
@@ -22,6 +22,7 @@
optSelfQualThreshold = "Own quality threshold",
optUp = "Up",
optDown = "Down",
+ optMoney = "Show coins looted",

descStacks = "Set options for each individual stack, such as anchor visibility or timeout.",
descPositioning = "Position and attachment of rows in the stack",
@@ -34,6 +35,7 @@
descThreshold = "Maximum number of rows displayed at any given time",
descQualThreshold = "The lowest quality of everyone else's that will be shown by the monitor",
descSelfQualThreshold = "The lowest quality of your own loot that will be shown by the monitor",
+ descMoney = "Show share of coins looted while in a group |cFFFF0000Does NOT include solo coins yet.|r",

optPos = {
TOPLEFT = "Top left corner",

Reply all
Reply to author
Forward
0 new messages