WoWInterface SVN ItemLinkRecolor

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 5 to Rev 6
    Reverse comparison

Rev 5 → Rev 6

ItemLinkRecolor.lua
1,5 → 1,9
--[[
Changelog:
Version 3.0.3
Updated TOC version number
Fixed for MoP 11 sections itemlinks
 
Version 3.0.2
Tested on MoP
Make two hooks secure
175,7 → 179,7
--main global var
ItemLinkRecolor = {
["NAME"] = "|TInterface\\Icons\\Spell_unused:0|t |cFF33CC66Item Link Recolor|r",
["VERSION"] = "(|cFF9900003|cFFFFFFFF.|cFF9900000|cFFFFFFFF.|cFF9900002|cFFFFFFFF)|r",
["VERSION"] = "(|cFF9900003|cFFFFFFFF.|cFF9900000|cFFFFFFFF.|cFF9900003|cFFFFFFFF)|r",
}
--
 
225,6 → 229,9
--on event
function ItemLinkRecolor_Event()
--basic chatframe event hook
 
Silvanas.DebugVar(ChatFrame_MessageEventHandler, "Hooking")
 
ILR_ChatFrame_MessageEventHandler_Hook = ChatFrame_MessageEventHandler
ChatFrame_MessageEventHandler = ItemLinkRecolor_ChatFrame_MessageEventHandler
 
279,8 → 286,10
function ItemLinkRecolor_ChatFrame_MessageEventHandler(frame,event,msg,...)
--if we got this addon enabled
if ItemLinkRecolorSavedVars["ENABLED"] then
 
--if we allow this event
if (string.sub(event,1,8) == "CHAT_MSG") and ItemLinkRecolor_AllowedEvents[event] then
 
--if we got money coloring enabled
if ItemLinkRecolorSavedVars["MLENABLED"] then
--Parse money strings and return them in color
289,13 → 298,13
--if we got item icons enabled
if ItemLinkRecolorSavedVars["MIENABLED"] then
--find an item links and return a new item link whit an icon
msg = string.gsub(msg,"(|Hitem:%d+:%d+:%d+:%d+:%d+:%d+:[-%d]+:[-%d]+:%d+:%d+|h)",ItemLinkRecolor_Iconise)
msg = string.gsub(msg,"(|Hitem:%d+:%d+:%d+:%d+:%d+:%d+:[-%d]+:[-%d]+:%d+:%d+:%d+|h)",ItemLinkRecolor_Iconise)
end
 
--if we got itemlink coloring enabled
if ItemLinkRecolorSavedVars["ILENABLED"] then
ItemLinkRecolor_MissingData = false
msg = string.gsub(msg,"(|Hitem:%d+:%d+:%d+:%d+:%d+:%d+:[-%d]+:[-%d]+:%d+:%d+|h[^:]-|h)",ItemLinkRecolor_FindMissingData)
msg = string.gsub(msg,"(|Hitem:%d+:%d+:%d+:%d+:%d+:%d+:[-%d]+:[-%d]+:%d+:%d+:%d+|h[^:]-|h)",ItemLinkRecolor_FindMissingData)
 
if ItemLinkRecolor_MissingData then
--call dalayed function
305,7 → 314,7
return
else
--find an item links and return new colored ones
msg = string.gsub(msg,"(|Hitem:%d+:%d+:%d+:%d+:%d+:%d+:[-%d]+:[-%d]+:%d+:%d+|h[^:]-|h)",ItemLinkRecolor_Colorize)
msg = string.gsub(msg,"(|Hitem:%d+:%d+:%d+:%d+:%d+:%d+:[-%d]+:[-%d]+:%d+:%d+:%d+|h[^:]-|h)",ItemLinkRecolor_Colorize)
end
end
end
347,9 → 356,11
--coloring functions--
----------------------
function ItemLinkRecolor_Colorize(texty)
Silvanas.DebugVar(texty:gsub("|","||"), "Colorising")
 
--parse elements of the link
local link,itemnum,socket1,socket2,socket3,linklvl
link,itemnum,socket1,socket2,socket3,linklvl = string.match(texty,"^|H(item:(%d+):%d+:(%d+):(%d+):(%d+):%d+:[-%d]+:[-%d]+:(%d+):%d+)|h")
link,itemnum,socket1,socket2,socket3,linklvl = string.match(texty,"^|H(item:(%d+):%d+:(%d+):(%d+):(%d+):%d+:[-%d]+:[-%d]+:(%d+):%d+:%d+)|h")
 
--renumber
linklvl = tonumber(linklvl)
458,7 → 469,7
function ItemLinkRecolor_FindMissingData(texty)
--parse elements of the link
local link
link = string.match(texty,"^|H(item:%d+:%d+:%d+:%d+:%d+:%d+:[-%d]+:[-%d]+:%d+:%d+)|h")
link = string.match(texty,"^|H(item:%d+:%d+:%d+:%d+:%d+:%d+:[-%d]+:[-%d]+:%d+:%d+:%d+)|h")
 
--get the item atributes
local itemquality
751,7 → 762,7
count = count + 1
 
ItemLinkRecolor_MissingData = false
msg = string.gsub(msg,"(|Hitem:%d+:%d+:%d+:%d+:%d+:%d+:[-%d]+:[-%d]+:%d+:%d+|h[^:]-|h)",ItemLinkRecolor_FindMissingData)
msg = string.gsub(msg,"(|Hitem:%d+:%d+:%d+:%d+:%d+:%d+:[-%d]+:[-%d]+:%d+:%d+:%d+|h[^:]-|h)",ItemLinkRecolor_FindMissingData)
 
--if the data still didnt arive we delay it a bit more
if ItemLinkRecolor_MissingData then
761,7 → 772,7
end
 
--find an item links and return new colored ones
msg = string.gsub(msg,"(|Hitem:%d+:%d+:%d+:%d+:%d+:%d+:[-%d]+:[-%d]+:%d+|h[^:]-|h)",ItemLinkRecolor_Colorize)
msg = string.gsub(msg,"(|Hitem:%d+:%d+:%d+:%d+:%d+:%d+:[-%d]+:[-%d]+:%d+:%d+|h[^:]-|h)",ItemLinkRecolor_Colorize)
end
 
--Call the orriginal function
ItemLinkRecolor.toc
1,8 → 1,8
## Interface: 40300
## Interface: 50001
## Title: * |cFF33CC66Item Link Recolor|r
## Author: |cff993366Silvanas
## Version: 3.0.2
## Notes: |cff999999Adds more info in the item chatlinks |n|cffffffffVersion: (|cFF9900003|cFFFFFFFF.|cFF9900000|cFFFFFFFF.|cFF9900002|cFFFFFFFF)|n|cFFFFFFFFAuthor: |cFF993366Silvanas|r
## Version: 3.0.3
## Notes: |cff999999Adds more info in the item chatlinks |n|cffffffffVersion: (|cFF9900003|cFFFFFFFF.|cFF9900000|cFFFFFFFF.|cFF9900003|cFFFFFFFF)|n|cFFFFFFFFAuthor: |cFF993366Silvanas|r
## eMail: westhof99@zonnet.nl
## URL: http://www.google.com
## License: None
11,4 → 11,4
## LoadOnDemand: 0
## SavedVariablesPerCharacter: ItemLinkRecolorSavedVars
ItemLinkRecolor.xml
ItemLinkRecolor_Interface.xml
\ No newline at end of file +ItemLinkRecolor_Interface.xml