/
--[[ |
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 |
--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", |
} |
-- |
--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 |
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 |
--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 |
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 |
--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) |
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 |
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 |
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 |
## 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 |
## LoadOnDemand: 0 |
## SavedVariablesPerCharacter: ItemLinkRecolorSavedVars |
ItemLinkRecolor.xml |
ItemLinkRecolor_Interface.xml |