/
## Interface: 40300 |
## Title: * |cFF33CC66Item Link Recolor|r |
## Author: |cff993366Silvanas |
## Version: 3.0.1 |
## Notes: |cff999999Adds more info in the item chatlinks |n|cffffffffVersion: (|cFF9900003|cFFFFFFFF.|cFF9900000|cFFFFFFFF.|cFF9900001|cFFFFFFFF)|n|cFFFFFFFFAuthor: |cFF993366Silvanas|r |
## eMail: westhof99@zonnet.nl |
## URL: http://www.google.com |
## License: None |
## Secure: 0 |
## DefaultState: Enabled |
## LoadOnDemand: 0 |
## SavedVariablesPerCharacter: ItemLinkRecolorSavedVars |
ItemLinkRecolor.xml |
ItemLinkRecolor_Interface.xml |
--[[ |
--This Lib is made for addons made by Silvanas it gives some commen functions like print,printf,select,varstring |
--i use it so i dont have to redecleare the function so i wont use duoble memory space, if u have multiple addons installed |
--it is not a stand alone addon just a file to include. and other ui mods are welkome to use it aslog as they dont moddify it :P |
]]-- |
SilvanasLibVersion = 5.7 |
if (not Silvanas) or (Silvanas.Version < SilvanasLibVersion) then |
Silvanas = { |
--Libary version |
Version = SilvanasLibVersion, |
--author |
Author = "|cff993366Silvanas|r", |
--hold a list of mods and thier info of registred mods --removed |
LoadedMods = {}, |
--Basic print function |
Print = function(msg) |
if msg and DEFAULT_CHAT_FRAME then |
DEFAULT_CHAT_FRAME:AddMessage(msg) |
else |
Silvanas.Message(msg) |
end |
end, |
--Basic print function to the 2nd chat window |
Print2 = function(msg) |
if msg then |
if ChatFrame2 then |
ChatFrame2:AddMessage(msg) |
elseif DEFAULT_CHAT_FRAME then |
DEFAULT_CHAT_FRAME:AddMessage(msg) |
else |
Silvanas.Message(msg) |
end |
end |
end, |
--Print whit text formatting |
Printf = function(...) |
Silvanas.Print(string.format(unpack(arg))) |
end, |
--Returns a string represention of the variable |
VarString = function(variable) |
local vartype = type(variable) |
if vartype == "string" then |
return variable |
elseif vartype == "number" then |
return tostring(variable) |
elseif vartype == "boolean" then |
if variable then |
return "true" |
else |
return "false" |
end |
else |
return vartype |
end |
end, |
--Placeholder for old function |
VarPrint = function(variable) |
return Silvanas.VarString(variable) |
end, |
--Argument selector |
Select = select, |
--Popup message |
Message = function(msg) |
message("|cFFFFFFFF".. msg .."|r") |
end, |
--/ Command addfunction |
AddCmd = function(Name,Function,CmdTable) |
if (type(CmdTable) == "table") and (type(Function) == "function") and (type(Name) == "string") then |
if #CmdTable > 0 then |
SlashCmdList[Name] = Function |
local i |
for i=1,#CmdTable,1 do |
setglobal("SLASH_".. Name .. i,"/".. CmdTable[i]) |
end |
end |
end |
end, |
--register all events for the frame that are inside the table |
RegisterEvents = function(self,EventArray) |
if type(EventArray) == "table" then |
local Event |
for Event in pairs(EventArray) do |
self:RegisterEvent(Event) |
end |
end |
end, |
--Registers a mod in the libary (removed) |
AddMod = function() end, |
--The player his name (has tobe a function since u can't get UnitName() at load time) |
Me = UnitName("player"), |
--Prints out the entire variable to chat (should be called whitout (dept)) |
DebugVar = function(variable,name,dept) |
local prefix,vartype,key,value,suffix |
if not dept then dept = 0 end |
if dept > 0 then suffix = ',' else suffix = ';' end |
if not name then name = "Variable" end |
prefix = string.rep(' ',(dept*4)) |
vartype = type(variable) |
if vartype == "string" then |
Silvanas.Print(prefix .. name .." = \"".. variable .."\"".. suffix) |
elseif vartype == "number" then |
Silvanas.Print(prefix .. name .." = ".. variable .. suffix) |
elseif vartype == "boolean" then |
if variable then |
Silvanas.Print(prefix .. name .." = true".. suffix) |
else |
Silvanas.Print(prefix .. name .." = false".. suffix) |
end |
elseif vartype == "table" then |
if type(name) == "number" then name = "[".. name .."]" end |
Silvanas.Print(prefix .. name .." = {") |
if dept >= 5 then |
Silvanas.Print(prefix .. string.rep(' ',4) .. "..." .. suffix) |
return |
end |
for key,value in pairs(variable) do |
if(value == variable) then |
Silvanas.DebugVar("SELF-REFERENCE",key,(dept+1)) |
else |
Silvanas.DebugVar(value,key,(dept+1)) |
end |
end |
Silvanas.Print(prefix .."}".. suffix) |
else |
Silvanas.Print(prefix .. name .." = ".. vartype .. suffix) |
end |
end, |
--transform the colored version string into a number for easyer comparisation |
GetVersionNumber = function(version) |
local Vb,Vm,Vs |
Vb,Vm,Vs = string.match(version,"%x%x%x%x%x%x%x%x(%d)|.*%x%x%x%x%x%x%x%x(%d)|.*%x%x%x%x%x%x%x%x(%d)|") |
if Vb then |
return tonumber(Vb .. Vm .. Vs) |
else |
return -1 |
end |
end, |
--queued functions |
DelayTable = {}, |
--timescale hook |
InitTimeDelay = function() |
if not Silvanas.OnUpdate then |
Silvanas.OnUpdate = function() |
Silvanas.DelayCore() |
end |
CreateFrame("Frame"):SetScript("OnUpdate",Silvanas.OnUpdate) |
end |
end, |
DelayCore = function() |
local time = time() |
for k,v in pairs(Silvanas.DelayTable) do |
if time >= v.time then |
local funct = v |
table.remove(Silvanas.DelayTable,k) |
funct.run(unpack(funct.arg)) |
end |
end |
end, |
DelayFunc = function(secs,func,...) |
if not Silvanas.OnUpdate then |
Silvanas.Message("'Silvanas.DelayFunc(secs,func,<params>)' called while not Intialsed whit 'Silvanas.InitTimeDelay()'") |
return |
end |
if type(func) ~= "function" or type(secs) ~= "number" then |
Silvanas.Message("'Silvanas.DelayFunc(secs,func,<params>)' usage: seconds to delay, function to call, optional parametes'") |
return |
end |
table.insert(Silvanas.DelayTable,{ |
time = time() + secs, |
run = func, |
arg = {...}, |
}) |
end, |
RemoveDelayedFunc = function(func) |
if type(func) ~= "function" then |
Silvanas.Message("'Silvanas.RemoveDelayedFunc(func)' usage: function to remove of the list call") |
return |
end |
local newTable = {} |
local _, value |
for _, value in pairs(Silvanas.DelayTable) do |
if value.func ~= func then |
table.insert(newTable, value) |
end |
end |
Silvanas.DelayTable = newTable |
end, |
} |
end |
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ \FrameXML\UI.xsd"> |
<Script file="ItemLinkRecolor.lua"/> |
<Script file="ItemLinkRecolor_Interface.lua"/> |
<Script file="SilvanasAddonsLib.lua"/> |
<!--Our Dummy frame--> |
<Frame name="ItemLinkRecolorDummyFrame"> |
<Scripts> |
<OnLoad>ItemLinkRecolor_Load(self);</OnLoad> |
<OnEvent> ItemLinkRecolor_Event(); </OnEvent> |
</Scripts> |
</Frame> |
<!--Our secr@t scanning tooltip--> |
<GameTooltip name="ItemLinkRecolorScanningTooltip" inherits="GameTooltipTemplate"> |
<Scripts> |
<Onload> self:SetOwner(UIParent,"ANCHOR_NONE"); </Onload> |
</Scripts> |
</GameTooltip> |
</Ui> |
<Ui xmlns="http://www.blizzard.com/wow/ui" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> |
<!--Autogenerated by wowuides, Version=1.0.300.0, Culture=neutral, PublicKeyToken=null--> |
<Frame name="ItemLinkRecolor_Interface" hidden="true"> |
<!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508883-59c2-4f83-ae10-27aaad48391b" />--> |
<Size> |
<AbsDimension x="368" y="337" /> |
</Size> |
<Anchors> |
<Anchor point="CENTER" relativeTo="UIParent"> |
<Offset> |
<AbsDimension x="0" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true"> |
<BackgroundInsets> |
<AbsInset left="11" right="12" top="12" bottom="11" /> |
</BackgroundInsets> |
<TileSize> |
<AbsValue val="32" /> |
</TileSize> |
<EdgeSize> |
<AbsValue val="32" /> |
</EdgeSize> |
</Backdrop> |
<Layers> |
<Layer> |
<Texture name="$parentTitleBorder" file="Interface\DialogFrame\UI-DialogBox-Header"> |
<Size> |
<AbsDimension x="160" y="32" /> |
</Size> |
<Anchors> |
<Anchor point="TOP"> |
<Offset> |
<AbsDimension x="0" y="5" /> |
</Offset> |
</Anchor> |
</Anchors> |
<TexCoords left="0.2" right="0.8" top="0" bottom="0.6" /> |
</Texture> |
<FontString name="$parentTitleString" font="Fonts\FRIZQT__.TTF" text="Item Link Recolor"> |
<Size> |
<AbsDimension x="140" y="0" /> |
</Size> |
<Anchors> |
<Anchor point="TOP"> |
<Offset> |
<AbsDimension x="0" y="-4" /> |
</Offset> |
</Anchor> |
</Anchors> |
<FontHeight> |
<AbsValue val="12" /> |
</FontHeight> |
<Color r="1" g="0.8196079" b="0" /> |
<Shadow> |
<Color r="0" g="0" b="0" /> |
<Offset> |
<AbsDimension x="1" y="-1" /> |
</Offset> |
</Shadow> |
</FontString> |
</Layer> |
</Layers> |
<Frames> |
<Frame name="ItemLinkRecolor_Text_Label1"> |
<!--<FrameSkin skinid="f15d4970-d66d-444e-bb2d-1ad102c87fed" frameid="f15d4978-d66d-444e-bb2d-1ad102c87fed" />--> |
<Size> |
<AbsDimension x="337" y="14" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT"> |
<Offset> |
<AbsDimension x="17" y="-32" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Layers> |
<Layer> |
<FontString name="$parentLabel" setAllPoints="true" font="Fonts\FRIZQT__.TTF" text="Item Link Recolor can show additional information"> |
<FontHeight> |
<AbsValue val="12" /> |
</FontHeight> |
<Color r="1" g="0.8196079" b="0" /> |
<Shadow> |
<Color r="0" g="0" b="0" /> |
<Offset> |
<AbsDimension x="1" y="-1" /> |
</Offset> |
</Shadow> |
</FontString> |
</Layer> |
</Layers> |
</Frame> |
<CheckButton name="ItemLinkRecolor_Enable_Button"> |
<!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508886-59c2-4f83-ae10-27aaad48391b"><Property name="Size"><?xml version="1.0"?> |
<Size xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> |
<Width>200</Width> |
<Height>30</Height> |
</Size></Property></FrameSkin>--> |
<Size> |
<AbsDimension x="32" y="32" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT"> |
<Offset> |
<AbsDimension x="17" y="-77" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Layers> |
<Layer> |
<FontString name="$parentText" font="Fonts\FRIZQT__.TTF" text="Enable Item Link Recolor"> |
<Anchors> |
<Anchor point="LEFT" relativePoint="RIGHT"> |
<Offset> |
<AbsDimension x="-2" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<FontHeight> |
<AbsValue val="10" /> |
</FontHeight> |
<Color r="1" g="0.8196079" b="0" /> |
<Shadow> |
<Color r="0" g="0" b="0" /> |
<Offset> |
<AbsDimension x="1" y="-1" /> |
</Offset> |
</Shadow> |
</FontString> |
</Layer> |
</Layers> |
<Scripts> |
<OnClick>ItemLinkRecolor_Enable_Button_OnClick(); |
</OnClick> |
</Scripts> |
<NormalTexture file="Interface\Buttons\UI-CheckBox-Up" /> |
<PushedTexture file="Interface\Buttons\UI-CheckBox-Down" /> |
<HighlightTexture file="Interface\Buttons\UI-CheckBox-Highlight" alphaMode="ADD" /> |
<CheckedTexture file="Interface\Buttons\UI-CheckBox-Check" /> |
<DisabledCheckedTexture file="Interface\Buttons\UI-CheckBox-Check-Disabled" /> |
</CheckButton> |
<CheckButton name="ItemLinkRecolor_ItemLink_Button"> |
<!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508886-59c2-4f83-ae10-27aaad48391b"><Property name="Size"><?xml version="1.0"?> |
<Size xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> |
<Width>200</Width> |
<Height>30</Height> |
</Size></Property></FrameSkin>--> |
<Size> |
<AbsDimension x="32" y="32" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT"> |
<Offset> |
<AbsDimension x="17" y="-113" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Layers> |
<Layer> |
<FontString name="$parentText" font="Fonts\FRIZQT__.TTF" text="Enable Itemlink Coloring"> |
<Anchors> |
<Anchor point="LEFT" relativePoint="RIGHT"> |
<Offset> |
<AbsDimension x="-2" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<FontHeight> |
<AbsValue val="10" /> |
</FontHeight> |
<Color r="1" g="0.8196079" b="0" /> |
<Shadow> |
<Color r="0" g="0" b="0" /> |
<Offset> |
<AbsDimension x="1" y="-1" /> |
</Offset> |
</Shadow> |
</FontString> |
</Layer> |
</Layers> |
<Scripts> |
<OnClick>ItemLinkRecolor_ItemLink_Button_OnClick(); |
</OnClick> |
</Scripts> |
<NormalTexture file="Interface\Buttons\UI-CheckBox-Up" /> |
<PushedTexture file="Interface\Buttons\UI-CheckBox-Down" /> |
<HighlightTexture file="Interface\Buttons\UI-CheckBox-Highlight" alphaMode="ADD" /> |
<CheckedTexture file="Interface\Buttons\UI-CheckBox-Check" /> |
<DisabledCheckedTexture file="Interface\Buttons\UI-CheckBox-Check-Disabled" /> |
</CheckButton> |
<CheckButton name="ItemLinkRecolor_Money_Button"> |
<!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508886-59c2-4f83-ae10-27aaad48391b"><Property name="Size"><?xml version="1.0"?> |
<Size xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> |
<Width>200</Width> |
<Height>30</Height> |
</Size></Property></FrameSkin>--> |
<Size> |
<AbsDimension x="32" y="32" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT"> |
<Offset> |
<AbsDimension x="17" y="-221" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Layers> |
<Layer> |
<FontString name="$parentText" font="Fonts\FRIZQT__.TTF" text="Enable Money Coloring"> |
<Anchors> |
<Anchor point="LEFT" relativePoint="RIGHT"> |
<Offset> |
<AbsDimension x="-2" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<FontHeight> |
<AbsValue val="10" /> |
</FontHeight> |
<Color r="1" g="0.8196079" b="0" /> |
<Shadow> |
<Color r="0" g="0" b="0" /> |
<Offset> |
<AbsDimension x="1" y="-1" /> |
</Offset> |
</Shadow> |
</FontString> |
</Layer> |
</Layers> |
<Scripts> |
<OnClick>ItemLinkRecolor_Money_Button_OnClick(self); |
</OnClick> |
</Scripts> |
<NormalTexture file="Interface\Buttons\UI-CheckBox-Up" /> |
<PushedTexture file="Interface\Buttons\UI-CheckBox-Down" /> |
<HighlightTexture file="Interface\Buttons\UI-CheckBox-Highlight" alphaMode="ADD" /> |
<CheckedTexture file="Interface\Buttons\UI-CheckBox-Check" /> |
<DisabledCheckedTexture file="Interface\Buttons\UI-CheckBox-Check-Disabled" /> |
</CheckButton> |
<CheckButton name="ItemLinkRecolor_RequiredLevel_Button"> |
<!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508886-59c2-4f83-ae10-27aaad48391b"><Property name="Size"><?xml version="1.0"?> |
<Size xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> |
<Width>200</Width> |
<Height>30</Height> |
</Size></Property></FrameSkin>--> |
<Size> |
<AbsDimension x="32" y="32" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT"> |
<Offset> |
<AbsDimension x="17" y="-149" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Layers> |
<Layer> |
<FontString name="$parentText" font="Fonts\FRIZQT__.TTF" text="Show Required Item Level in Itenlinks"> |
<Anchors> |
<Anchor point="LEFT" relativePoint="RIGHT"> |
<Offset> |
<AbsDimension x="-2" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<FontHeight> |
<AbsValue val="10" /> |
</FontHeight> |
<Color r="1" g="0.8196079" b="0" /> |
<Shadow> |
<Color r="0" g="0" b="0" /> |
<Offset> |
<AbsDimension x="1" y="-1" /> |
</Offset> |
</Shadow> |
</FontString> |
</Layer> |
</Layers> |
<Scripts> |
<OnClick>ItemLinkRecolor_RequiredLevel_Button_OnClick(self); |
</OnClick> |
</Scripts> |
<NormalTexture file="Interface\Buttons\UI-CheckBox-Up" /> |
<PushedTexture file="Interface\Buttons\UI-CheckBox-Down" /> |
<HighlightTexture file="Interface\Buttons\UI-CheckBox-Highlight" alphaMode="ADD" /> |
<CheckedTexture file="Interface\Buttons\UI-CheckBox-Check" /> |
<DisabledCheckedTexture file="Interface\Buttons\UI-CheckBox-Check-Disabled" /> |
</CheckButton> |
<CheckButton name="ItemLinkRecolor_Sockets_Button"> |
<!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508886-59c2-4f83-ae10-27aaad48391b"><Property name="Size"><?xml version="1.0"?> |
<Size xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> |
<Width>200</Width> |
<Height>30</Height> |
</Size></Property></FrameSkin>--> |
<Size> |
<AbsDimension x="32" y="32" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT"> |
<Offset> |
<AbsDimension x="16" y="-185" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Layers> |
<Layer> |
<FontString name="$parentText" font="Fonts\FRIZQT__.TTF" text="Show Sockets Information in Itemlinks"> |
<Anchors> |
<Anchor point="LEFT" relativePoint="RIGHT"> |
<Offset> |
<AbsDimension x="-2" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<FontHeight> |
<AbsValue val="10" /> |
</FontHeight> |
<Color r="1" g="0.8196079" b="0" /> |
<Shadow> |
<Color r="0" g="0" b="0" /> |
<Offset> |
<AbsDimension x="1" y="-1" /> |
</Offset> |
</Shadow> |
</FontString> |
</Layer> |
</Layers> |
<Scripts> |
<OnClick>ItemLinkRecolor_Sockets_Button_OnClick(self); |
</OnClick> |
</Scripts> |
<NormalTexture file="Interface\Buttons\UI-CheckBox-Up" /> |
<PushedTexture file="Interface\Buttons\UI-CheckBox-Down" /> |
<HighlightTexture file="Interface\Buttons\UI-CheckBox-Highlight" alphaMode="ADD" /> |
<CheckedTexture file="Interface\Buttons\UI-CheckBox-Check" /> |
<DisabledCheckedTexture file="Interface\Buttons\UI-CheckBox-Check-Disabled" /> |
</CheckButton> |
<Frame name="NickCompleter_Text_Label2"> |
<!--<FrameSkin skinid="f15d4970-d66d-444e-bb2d-1ad102c87fed" frameid="f15d4978-d66d-444e-bb2d-1ad102c87fed" />--> |
<Size> |
<AbsDimension x="337" y="15" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT"> |
<Offset> |
<AbsDimension x="17" y="-46" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Layers> |
<Layer> |
<FontString name="$parentLabel" setAllPoints="true" font="Fonts\FRIZQT__.TTF" text="About a Item in its ItemLink"> |
<FontHeight> |
<AbsValue val="12" /> |
</FontHeight> |
<Color r="1" g="0.8196079" b="0" /> |
<Shadow> |
<Color r="0" g="0" b="0" /> |
<Offset> |
<AbsDimension x="1" y="-1" /> |
</Offset> |
</Shadow> |
</FontString> |
</Layer> |
</Layers> |
</Frame> |
<Frame name="NickCompleter_Text_Label3"> |
<!--<FrameSkin skinid="f15d4970-d66d-444e-bb2d-1ad102c87fed" frameid="f15d4978-d66d-444e-bb2d-1ad102c87fed" />--> |
<Size> |
<AbsDimension x="338" y="15" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT"> |
<Offset> |
<AbsDimension x="16" y="-60" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Layers> |
<Layer> |
<FontString name="$parentLabel" setAllPoints="true" font="Fonts\FRIZQT__.TTF" text="It can also color Money like "150g""> |
<FontHeight> |
<AbsValue val="12" /> |
</FontHeight> |
<Color r="1" g="0.8196079" b="0" /> |
<Shadow> |
<Color r="0" g="0" b="0" /> |
<Offset> |
<AbsDimension x="1" y="-1" /> |
</Offset> |
</Shadow> |
</FontString> |
</Layer> |
</Layers> |
</Frame> |
<CheckButton name="ItemLinkRecolor_MouseOver_Button"> |
<!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508886-59c2-4f83-ae10-27aaad48391b"><Property name="Size"><?xml version="1.0"?> |
<Size xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> |
<Width>200</Width> |
<Height>30</Height> |
</Size></Property></FrameSkin>--> |
<Size> |
<AbsDimension x="32" y="32" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT"> |
<Offset> |
<AbsDimension x="16" y="-293" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Layers> |
<Layer> |
<FontString name="$parentText" font="Fonts\FRIZQT__.TTF" text="Enable 'Mouseover' Item Ttooltips"> |
<Anchors> |
<Anchor point="LEFT" relativePoint="RIGHT"> |
<Offset> |
<AbsDimension x="-2" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<FontHeight> |
<AbsValue val="10" /> |
</FontHeight> |
<Color r="1" g="0.8196079" b="0" /> |
<Shadow> |
<Color r="0" g="0" b="0" /> |
<Offset> |
<AbsDimension x="1" y="-1" /> |
</Offset> |
</Shadow> |
</FontString> |
</Layer> |
</Layers> |
<Scripts> |
<OnClick>ItemLinkRecolor_MouseOver_Button_OnClick(self); |
</OnClick> |
</Scripts> |
<NormalTexture file="Interface\Buttons\UI-CheckBox-Up" /> |
<PushedTexture file="Interface\Buttons\UI-CheckBox-Down" /> |
<HighlightTexture file="Interface\Buttons\UI-CheckBox-Highlight" alphaMode="ADD" /> |
<CheckedTexture file="Interface\Buttons\UI-CheckBox-Check" /> |
<DisabledCheckedTexture file="Interface\Buttons\UI-CheckBox-Check-Disabled" /> |
</CheckButton> |
<CheckButton name="ItemLinkRecolor_MiniIcon_Button"> |
<!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508886-59c2-4f83-ae10-27aaad48391b"><Property name="Size"><?xml version="1.0"?> |
<Size xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> |
<Width>200</Width> |
<Height>30</Height> |
</Size></Property></FrameSkin>--> |
<Size> |
<AbsDimension x="32" y="32" /> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT"> |
<Offset> |
<AbsDimension x="17" y="-257" /> |
</Offset> |
</Anchor> |
</Anchors> |
<Layers> |
<Layer> |
<FontString name="$parentText" font="Fonts\FRIZQT__.TTF" text="Enable Mini ItemIcons"> |
<Anchors> |
<Anchor point="LEFT" relativePoint="RIGHT"> |
<Offset> |
<AbsDimension x="-2" y="0" /> |
</Offset> |
</Anchor> |
</Anchors> |
<FontHeight> |
<AbsValue val="10" /> |
</FontHeight> |
<Color r="1" g="0.8196079" b="0" /> |
<Shadow> |
<Color r="0" g="0" b="0" /> |
<Offset> |
<AbsDimension x="1" y="-1" /> |
</Offset> |
</Shadow> |
</FontString> |
</Layer> |
</Layers> |
<Scripts> |
<OnClick>ItemLinkRecolor_MiniIcon_Button_OnClick(self); |
</OnClick> |
</Scripts> |
<NormalTexture file="Interface\Buttons\UI-CheckBox-Up" /> |
<PushedTexture file="Interface\Buttons\UI-CheckBox-Down" /> |
<HighlightTexture file="Interface\Buttons\UI-CheckBox-Highlight" alphaMode="ADD" /> |
<CheckedTexture file="Interface\Buttons\UI-CheckBox-Check" /> |
<DisabledCheckedTexture file="Interface\Buttons\UI-CheckBox-Check-Disabled" /> |
</CheckButton> |
</Frames> |
<Scripts> |
<OnShow>ItemLinkRecolor_Interface_OnShow(); |
</OnShow> |
</Scripts> |
</Frame> |
</Ui> |
--[[ |
Changelog: |
Version 3.0.1 |
Now the money colorling of ..K as 1000g should work |
TOC version updated to 4.3 |
Version 3.0.0 |
Updated for WoW 4.2, was about time id update it |
Updated silvanas addonlib |
Moneycoloring of Copper got removed |
Moneycoloring now sepport ..K as 1000g |
Mouseover tooltip now sepports instance lockout info |
Fixed the option to show or hide required levels to work again |
Version 2.4.3 |
some achiements would break when money color was enabled this has been fixed |
Version 2.4.2 |
u can now link BoA items :P |
Version 2.4.1 |
Updated TOC version |
Version 2.4.0 |
Now works on WoW 3.0.2 |
Updated Silvanas Addonlib |
Nolonger errors on player / channel links |
Version 2.3.4 |
Hopefully fixed the bug that cased the settings to reset |
Version 2.3.3 |
fixed a version number bug in silvanas addon lib |
Version 2.3.2 |
fixed a bug reported whit ItemLinkRecolor_ChatFrame_OnHyperlinkEnter() |
Version 2.3.1 |
updated for wow version 2.4.3 |
updated silvanas addonlib |
fixed time delay functions in silvanas addonlib |
Version 2.3.0 |
now works even on itmes u havent seen before |
updated for wow version 2.4.1 |
added abelity to show mini item icons |
interface moved to the wow option panel |
when an item link is not your local cache it will be load for next time |
Version 2.2.1 |
made compatable whit SuperiorEpix |
Version 2.2.0 |
code updated for WoW 2.3 |
added optional sepport for the Superior Epix addon |
version 2.1.9 |
minor bugfix where items whit 3 sockets got showns asif they had 4 |
Version 2.1.8 |
Specail items id's are now also colored |
toc updated for patch 2.1.3 |
updated silvanas addonlib |
Version 2.1.7 |
Added a new optional function to enable 'mouseover' item tooltips |
Version 2.1.6 |
Updated toc version for patch 2.1.2 |
New scanning methot for recipies and seppport for the yellow colored links |
Version 2.1.4 |
Updated toc version for patch 2.0.8 |
Fixed coloring of recipy that allow the user ot create socketed item |
Version 2.1.3 |
Fixed relinking of socketed item links |
Refixed missing auctioneer tooltips |
Version 2.1.1 |
Updated toc version for patch 2.0.4 |
Version 2.1.0 |
Fixed for wow version 2.0.3 |
Version 2.0.2 |
Fixed bug in the new SilvanasAddonLib |
Version 2.0.1 |
Updated code for WoW 2.0 |
Updated SilvanasAddonLib |
Updated interfcecode |
Version 2.0.0 |
Burning Crusade Compatable |
nolonger colors m8s as 8 silver |
Added abiletie to show sockets info |
Added interface / removed commands |
money coloring now defauls to enabled |
updated silvanas addonlib |
Version 1.2.3 |
nolonger shows the item level if item if minium level is 1 |
orange now matches the orange color of legendairy items |
Version 1.2.2 |
fixed shiftclick relinking of colored links |
this also fixed auctioneer item link tooltip bug and other posable addons bugs |
autiocneer compatabiletie removed since its nologer needed after the bugs have been fixed |
optimsied code a litle bit |
now also colors outgoing whispers |
Version 1.2.1 |
fixed actioneer 3.6.1 compatibiletie |
optimsied OnEvent system |
Version 1.2.0 |
fixed compeltely disapaering messages by a big moddification in the hook |
updated toc |
updated silvanaslib |
Version 1.1.8 |
fixed a small scanning bug that would some unenquipable items show up as useable |
Version 1.1.7 |
fixed 2 overflown bugs but in a bad way so the might be new probs atleast i tryed to fix it :p |
Version 1.1.5 |
Fixed a small version number witch i forgot to update |
Version 1.1.4 |
now only works on chat messages or loot message |
Version 1.1.1 |
small bug fix for iems whitout a level got shown whit a () level witch is now gone again |
Version 1.1.0 |
basic sepport added for customiseable colors for some items witch can be set in the "CustomRecolor.lua" |
Money coloring now default to off becase of the many unforseen problems... :( |
added a new comand to get he number of an item |
actioneer sepport fixed for actionneer version 3.6.1 |
Setting now get saved and loaded back instead of jsut saved |
Version 1.0.8 |
Fixed money coloring inside color strings |
Hopefully fixed the german stack overflow |
Fixed money enable or disable cmds |
Version 1.0.5 |
Fixed money coloring system trigering on g2g |
Fixed error when a nil message was send |
Fixed compatibiltie whit Nerfed Combatlog (but not the actual prob that was casing the bug) |
Version 1.0.3 |
Fixed bug where some item strings where nolonger localised |
Fixed a bug where multiple item links in 1 chat message all would link to the first item |
Money / itemlink coloing can now be turned on / off seperately |
Version 1.0.0 |
First working version, after lots of debugging :p |
Known Bugs: |
Sometimes the itemlinks dont get colored but there is nothing i can do about it |
Todo: |
None |
--]] |
--main global var |
ItemLinkRecolor = { |
["NAME"] = "|TInterface\\Icons\\Spell_unused:0|t |cFF33CC66Item Link Recolor|r", |
["VERSION"] = "(|cFF9900003|cFFFFFFFF.|cFF9900000|cFFFFFFFF.|cFF9900001|cFFFFFFFF)|r", |
} |
-- |
--events that we will color |
local ItemLinkRecolor_AllowedEvents = { |
["CHAT_MSG_CHANNEL"] = true, |
["CHAT_MSG_LOOT"] = true, |
["CHAT_MSG_OFFICER"] = true, |
["CHAT_MSG_PARTY"] = true, |
["CHAT_MSG_RAID"] = true, |
["CHAT_MSG_RAID_LEADER"] = true, |
["CHAT_MSG_SAY"] = true, |
["CHAT_MSG_WHISPER"] = true, |
["CHAT_MSG_YELL"] = true, |
["CHAT_MSG_GUILD"] = true, |
["CHAT_MSG_WHISPER_INFORM"] = true, |
} |
local ItemLinkRecolor_AllowedLinks = { |
["item:"] = true, |
["spell"] = true, |
["encha"] = true, |
["talen"] = true, |
["achie"] = true, |
["quest"] = true, |
["insta"] = true, |
} |
-- |
--local hook pointers |
local ILR_ChatFrame_MessageEventHandler_Hook --hooks chatframe events |
local ILR_ChatFrame_OnHyperlinkShow_Hook --hooks clicked chat hyper links |
-- |
--local global vars |
local ItemLinkRecolor_MissingData = false |
-- |
------------------- |
--event triggered-- |
------------------- |
--onload |
function ItemLinkRecolor_Load(self) |
--register events |
self:RegisterEvent("VARIABLES_LOADED") |
end |
--on event |
function ItemLinkRecolor_Event() |
--basic chatframe event hook |
ILR_ChatFrame_MessageEventHandler_Hook = ChatFrame_MessageEventHandler |
ChatFrame_MessageEventHandler = ItemLinkRecolor_ChatFrame_MessageEventHandler |
--basic chatframe hyper link hook |
ILR_ChatFrame_OnHyperlinkShow_Hook = ChatFrame_OnHyperlinkShow |
ChatFrame_OnHyperlinkShow = ItemLinkRecolor_ChatFrame_OnHyperlinkShow |
--hook event for mouse over hyperlinks |
local i,cframe |
--for each chat window |
for i=1,NUM_CHAT_WINDOWS do |
--get the chatframe |
cframe = getglobal("ChatFrame".. i) |
--if the chat frame exists |
if cframe then |
--overwrite general xml chat hooks |
cframe:SetScript("OnHyperlinkEnter",function(self,var1,var2,...) ItemLinkRecolor_ChatFrame_OnHyperlinkEnter(self,var1,var2,...); end) |
cframe:SetScript("OnHyperlinkLeave",function(self,...) ItemLinkRecolor_ChatFrame_OnHyperlinkLeave(self,...); end) |
end |
end |
--call other files |
ItemLinkRecolor_Interface_Event() |
--load up saved variables |
if not ItemLinkRecolorSavedVars then |
--if there are no saved vars then well reload the default |
ItemLinkRecolor_Reset() |
else |
if not ItemLinkRecolorSavedVars["VERSION"] or (ItemLinkRecolorSavedVars["VERSION"] ~= ItemLinkRecolor["VERSION"]) then |
--if there are saved vars but under the wrong version then reload the default |
ItemLinkRecolor_Reset() |
end |
end |
--use delayed functions |
Silvanas.InitTimeDelay() |
--set up commands |
Silvanas.AddCmd("ITEMLINKRECOLOR_CMD",ItemLinkRecolor_Cmd_ItemLinkRecolor,{"ilr","ItemLinkRecolor"}) |
Silvanas.AddCmd("ITEMLINKRECOLOR_CMD_INSTACETEST",ItemLinkRecolor_Cmd_FakeInstanceLock,{"it"}) |
--loaded message |
Silvanas.Print(ItemLinkRecolor["NAME"] .." |cFFFFFFFFBy: ".. Silvanas.Author .." |cFFFFFFFFversion: ".. ItemLinkRecolor["VERSION"] .." |cFFFFFFFFloaded.|r") |
end |
------------------- |
------------------- |
------------------- |
----------------------- |
--chat hook functions-- |
----------------------- |
--this function takes over the real "ChatFrame_MessageEventHandler" and calls the real one afterwards |
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 |
msg = string.gsub(msg,"([%.,gGkK]-%d+%s-[kKgGsS]%a*)",ItemLinkRecolor_Moneyrize) |
end |
--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) |
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) |
if ItemLinkRecolor_MissingData then |
--call dalayed function |
Silvanas.DelayFunc(1,ItemLinkRecolor_ChatFrame_MessageEventHandler_Delayed,frame,event,msg,1,...) |
--dont call the hook we do it at the delayed 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) |
end |
end |
end |
end |
ILR_ChatFrame_MessageEventHandler_Hook(frame,event,msg,...) |
end |
--not realy hooked just called between the click and the normal function |
function ItemLinkRecolor_ChatFrame_OnHyperlinkShow(frame,link,text,button,...) |
--ILR format = |Hitem:itemlink|h ..bracket color ..[|r.. levelcolor ..(level)|r.. itemcolor .. text ..|r.. bracketcolor ..]|r|h |
--normal format = qaulitycolor .. |Hitem:itemlink|htext|h|r |
--first see if its an itemlinkfrom ILR |
if (string.sub(link,1,4) == "item") then |
--get the normal item link |
local itemlink |
--parse the normallink off the itemidlink |
x,itemlink = GetItemInfo(link) |
if itemlink then |
--give the normal style link |
text = itemlink |
end |
end |
--call the hook |
ILR_ChatFrame_OnHyperlinkShow_Hook(frame,link,text,button,...) |
end |
function ItemLinkRecolor_ChatFrame_OnHyperlinkEnter(self,link) |
--if we got mouseover hyperlinks enabled |
if ItemLinkRecolorSavedVars["MOUSEOVERLINK"] then |
--if something went wrong |
if not link then return; end |
--if its an acceptable link |
local shortlink = string.sub(link,1,5) |
if ItemLinkRecolor_AllowedLinks[shortlink] then |
--create the tooltip on cursor |
GameTooltip:ClearLines() |
GameTooltip:SetOwner(UIParent,"ANCHOR_NONE") |
GameTooltip:SetPoint("TOPLEFT",UIParent,"BOTTOMLEFT",GetCursorPosition()) |
GameTooltip:SetHyperlink(link) |
end |
end |
end |
function ItemLinkRecolor_ChatFrame_OnHyperlinkLeave(self) |
--if we got mouseover hyperlinks enabled |
if ItemLinkRecolorSavedVars["MOUSEOVERLINK"] then |
GameTooltip:Hide() |
end |
end |
----------------------- |
----------------------- |
----------------------- |
---------------------- |
--coloring functions-- |
---------------------- |
function ItemLinkRecolor_Colorize(texty) |
--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") |
--renumber |
linklvl = tonumber(linklvl) |
--get the item atributes |
local x,itemquality,itemlevel,itemname,trys |
itemname,x,itemquality,x,itemlevel = GetItemInfo(link) |
--see if the item needs tobe request from server first |
if not itemquality then |
--data was not found so lets forget about it >.< |
return texty |
end |
--superior epix seppport |
--incase its superior epix |
if SuperiorEpix_Quality and SuperiorEpix_Quality(link) then |
itemquality = SUPERIOREPIX_QUALITY_SUPERIOR |
end |
-- |
--get the quality color |
local itemqualitycolor |
itemqualitycolor = "|c".. Silvanas.Select(4,GetItemQualityColor(itemquality)) --|c was removed in 4.2 |
--build the level display |
local itemlevelcolor,playerlevel |
playerlevel = UnitLevel("player") |
itemlevelcolor = nil |
if itemlevel == 0 or itemlevel == 1 then |
--see if its bind on acount |
if itemquality == 7 then |
itemlevel = linklvl |
itemlevelcolor = "|cFFFFFFFF" |
else |
--items that dont have a min level |
itemlevel = 0 |
itemlevelcolor = "" |
end |
else |
if itemlevel > (playerlevel + 5) then |
itemlevelcolor = "FF0000" |
elseif itemlevel > playerlevel then |
itemlevelcolor = "FF9933" |
elseif itemlevel == playerlevel then |
itemlevelcolor = "FFFF00" |
elseif itemlevel > (playerlevel - 5) then |
itemlevelcolor = "00FF00" |
else |
itemlevelcolor = "999999" |
end |
--finish the itemlevelcolor |
itemlevelcolor = "|cFF".. itemlevelcolor |
end |
--check if we can use it or not |
local brakcetcolor |
--if it isnt already se by the customiseable part |
if itemlevel > playerlevel then |
--if the level is already to high then make the brackets red |
brakcetcolor = "|cFFFF0000" |
else |
--use tooltip scanning |
--set the tooltiplink |
ItemLinkRecolor_SetToolTipLink(link) |
--see if its enquipable |
if ItemLinkRecolor_CanEnquip(link) then |
brakcetcolor = itemqualitycolor |
else |
brakcetcolor = "|cFFFF0000" |
end |
end |
--socketinfo |
local socketinfo |
socketinfo = "" |
--if we got socketinfo enabled |
if ItemLinkRecolorSavedVars["SENABLED"] then |
--first see if the item is already filled so we dont have to scan the tooltip, only works on item that have 3 filled slots |
--scan backwards bcase its more likely to have a 0 at the 3rd slot instead of the first |
if (tonumber(socket3) > 0) and (tonumber(socket2) > 0) and (tonumber(socket1) > 0) then |
socketinfo = "|r |cFFFFFFFF*|r |cFFFFFFFF*|r |cFFFFFFFF*|r" |
else |
--set the tooltiplink |
ItemLinkRecolor_SetToolTipLink(link) |
--we got to scan the itemtooltip |
socketinfo = ItemLinkRecolor_GetSocketInfo(link) |
end |
end |
--build and return the return value |
if (itemlevel == 0) or not ItemLinkRecolorSavedVars["LENABLED"] then |
--dont dispaly he level for item whitout a minuim level |
return "|r|H".. link .."|h".. brakcetcolor .."[|r".. itemqualitycolor .. itemname .. socketinfo .."|r".. brakcetcolor .."]|r|h" |
else |
return "|r|H".. link .."|h".. brakcetcolor .."[|r".. itemlevelcolor .."(".. itemlevel ..")|r" .. itemqualitycolor .. itemname .. socketinfo .."|r".. brakcetcolor .."]|r|h" |
end |
end |
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") |
--get the item atributes |
local itemquality |
itemquality = select(3,GetItemInfo(link)) |
--see if the item needs tobe request from server first |
if not itemquality then |
--data was not found so lets request it from the server |
--forcing it to display on a tooltip will case data tobe loaded |
ItemLinkRecolor_SetToolTipLink(link) |
--set the variable so we got to delay this message |
ItemLinkRecolor_MissingData = true |
else |
--see if the tooltip data is already available |
ItemLinkRecolor_SetToolTipLink(link) |
--see if we are still getting the red message on the tooltop |
if ItemLinkRecolorScanningTooltip:NumLines() == 1 then |
local TooltipTextFrame = getglobal("ItemLinkRecolorScanningTooltipTextLeft1") |
if ItemLinkRecolor_ToolTipTextIsRed(TooltipTextFrame) then |
--set the variable so we got to delay this message |
ItemLinkRecolor_MissingData = true |
end |
end |
end |
return texty |
end |
--the coloring fuction of money |
function ItemLinkRecolor_Moneyrize(texty) |
--if it isnt a g2g or m8s message or a section of a link seperated whit a : |
if string.find(texty,":") or string.find(texty,"[gG]2[gG]") or string.find(texty,"[mM]8[sS]")then |
return texty |
end |
--if its contains a color code |
local colorcode,returntext |
colorcode = string.match(texty,"^|c(%x+)") |
--if we are trying to color inside the colorcode then ignore this money and return wutever txt we had |
if colorcode then |
if string.len(colorcode) < 8 then |
return texty |
else |
--cut off the color code but still and it in the end |
colorcode = string.sub(texty,1,10) |
returntext = string.sub(texty,11) |
end |
else |
returntext = texty |
colorcode = "" |
end |
--parse money |
local money1,money2,moneytype,moneystr |
money1,money2,moneytype,moneystr = string.match(texty,"^(%d-)[%.,]-(%d+)%s-([kKgGsS])(%a*)$") |
--if something went wrong ignore this chat link and return wutever text we recieved |
if moneytype then |
moneytype = string.upper(moneytype) |
else |
--if something went wrong ignore this chat link and return wutever text we recieved |
return texty |
end |
--see if moneystr is part of an other word |
if moneystr ~= "" then |
moneystr = string.lower(moneystr) |
--see if our moneytype and moneystr are valid |
if moneytype == "K" then |
if moneystr ~= 'g' then |
return texty |
end |
elseif moneytype == "G" then |
if moneystr ~= "old" then |
return texty |
end |
elseif moneytype == "S" then |
if moneystr ~= "ilver" then |
return texty |
end |
end |
end |
--if there is no comma or dot but only 1 number |
if money1 == "" then |
--if something went wrong ignore this chat link and return wutever text we recieved |
if money2 == "" then |
return texty |
end |
--if there is only 1 number then store it in money1 and make money2 0 |
money1 = money2 |
money2 = 0 |
end |
--calc the money in copper |
local moneycopper,mcalc |
mcalc = { |
["K"] = 10000000, |
["G"] = 10000, |
["S"] = 100, |
} |
moneycopper = (tonumber(money1)*mcalc[moneytype]) + (tonumber(money2)*(mcalc[moneytype] / 100)) |
--get the player his money |
local playermoney |
playermoney = GetMoney() |
--do the money compare |
local moneycoler, quartplayermoney |
quartplayermoney = playermoney / 4 |
if moneycopper > (playermoney + quartplayermoney) then |
moneycoler = "FF0000" |
elseif moneycopper > playermoney then |
moneycoler = "FF9933" |
elseif (moneycopper <= playermoney) and (moneycopper > (playermoney - quartplayermoney)) then |
moneycoler = "FFFF00" |
elseif (moneycopper <= (playermoney - quartplayermoney)) and (moneycopper > quartplayermoney) then |
moneycoler = "00FF00" |
else |
moneycoler = "999999" |
end |
--return the new text |
return "|cFF".. moneycoler .. returntext .."|r".. colorcode |
end |
--the fucntion to add item icons |
function ItemLinkRecolor_Iconise(texty) |
--parse elements of the link |
local itemid |
itemid = string.match(texty,"^|H(item:%d+)") |
--see if it went correct |
if not itemid then |
return texty |
end |
return "|T".. GetItemIcon(itemid) ..":0|t".. texty |
end |
---------------------- |
---------------------- |
---------------------- |
--------------------- |
--Checkup Functions-- |
--------------------- |
function ItemLinkRecolor_CanEnquip() |
--oke we search in a hidden tooltip to find if there are any red lines so we cant use it :p |
local TooltipTextFrame,i |
--go over each line in the tooltip and search for things that are in red |
for i=1,ItemLinkRecolorScanningTooltip:NumLines(),1 do --go over each line |
--get one left text object |
TooltipTextFrame = getglobal("ItemLinkRecolorScanningTooltipTextLeft".. i) |
--if the text is red we return false since we assume we cant enquip it |
if ItemLinkRecolor_ToolTipTextIsRed(TooltipTextFrame) then |
return false |
end |
if (i == 2) or (i == 3) then --2,3 RIGHT can be the armor type |
--get the right text object |
TooltipTextFrame = getglobal("ItemLinkRecolorScanningTooltipTextRight".. i) |
--if the text is red we return false since we assume we cant enquip it |
if ItemLinkRecolor_ToolTipTextIsRed(TooltipTextFrame) then |
return false |
end |
end |
end |
--if nothing in red was found we assume we can use use it |
return true |
end |
function ItemLinkRecolor_GetSocketInfo() |
--build the string shit sockets info to return |
local i,SocketString |
SocketString = "" |
--get over all sockets |
--MAX_NUM_SOCKETS = 3; |
for i=1,3,1 do |
--get one socket icon object |
TooltipIconFrame = getglobal("ItemLinkRecolorScanningTooltipTexture".. i) |
--get the color |
local scolor |
scolor = ItemLinkRecolor_GetSocketColor(TooltipIconFrame) |
--see if we got a color or something went wrong |
if scolor then |
SocketString = SocketString .." |cFF".. scolor .."*" |
end |
end |
--cancel the color of the itemlink |
if string.len(SocketString) > 0 then |
SocketString = "|r".. SocketString |
end |
--return the socketstring |
return SocketString |
end |
--------------------- |
--------------------- |
--------------------- |
------------------------------ |
--tooltip scanning functions-- |
------------------------------ |
function ItemLinkRecolor_SetToolTipLink(link) |
--if its a different link |
if ItemLinkRecolorScanningTooltip.curentlink ~= link then |
--set new link |
ItemLinkRecolorScanningTooltip.curentlink = link |
--first clear the tooltip |
ItemLinkRecolorScanningTooltip:ClearLines() |
--set the link |
ItemLinkRecolorScanningTooltip:SetHyperlink(link) |
end |
end |
function ItemLinkRecolor_ToolTipTextIsRed(TooltipFrame) |
--if we got a real frame |
if TooltipFrame and TooltipFrame:IsVisible() then --dont scan colors of invisable frames |
--gets its colors |
local ttca,ttcr,ttcg,ttcb |
ttcr,ttcg,ttcb,ttca = TooltipFrame:GetTextColor() |
--if its red then we assume we cant use this item (yes its not a clean and save way but it saves cpu usage) |
--if (ttcr == 0.99999780301005) and (ttcg == 0.12548992037773) and (ttcb == 0.12548992037773) and (ttca == 0.99999779462814) then |
if (ttcr > 0.999) and (ttcg > 0.125 and ttcg < 0.126) and (ttcb > 0.125 and ttcb < 0.126) and (ttca > 0.99) then |
return true |
end |
end |
return false |
end |
function ItemLinkRecolor_GetSocketColor(TooltipFrame) |
--table to convert strings to hexidecimal colors |
local ItemLinkRecolor_Socketcolors = { |
["Red"] = "FF0000", |
["Blue"] = "0000FF", |
["Yellow"] = "FFFF00", |
["Meta"] = "666666" |
} |
--if we got a real frame |
if TooltipFrame and TooltipFrame:IsVisible() then --dont scan hidden icon frames |
--get the texture |
local IconTexture,Socketcolor |
IconTexture = TooltipFrame:GetTexture() |
--get the socketcolor |
Socketcolor = string.match(IconTexture,"UI%-EmptySocket%-(%a+)$") |
if Socketcolor then |
--convert to hexidecimal color and see if something went wrong |
return ItemLinkRecolor_Socketcolors[Socketcolor] or false |
else |
--if socket if filled |
return "FFFFFF" |
end |
else |
--if that frame doesnt exist or item doesnt got a socket / gem |
return false |
end |
end |
------------------------------ |
------------------------------ |
------------------------------ |
------------------- |
--timed functions-- |
------------------- |
function ItemLinkRecolor_ChatFrame_MessageEventHandler_Delayed(frame,event,msg,count,...) |
--if we already delayed it 5 times we skip it |
if count <= 5 then |
--increment delay counter |
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) |
--if the data still didnt arive we delay it a bit more |
if ItemLinkRecolor_MissingData then |
--call dalayed function |
Silvanas.DelayFunc(1,ItemLinkRecolor_ChatFrame_MessageEventHandler_Delayed,frame,event,msg,count,...) |
return |
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) |
end |
--Call the orriginal function |
ILR_ChatFrame_MessageEventHandler_Hook(frame,event,msg,...) |
end |
------------------- |
------------------- |
------------------- |
--------- |
--reset-- |
--------- |
function ItemLinkRecolor_Reset() |
ItemLinkRecolorSavedVars = { |
["VERSION"] = ItemLinkRecolor["VERSION"], |
["ENABLED"] = true, |
["ILENABLED"] = true, |
["MLENABLED"] = true, |
["MIENABLED"] = true, |
["LENABLED"] = true, |
["SENABLED"] = false, |
["MOUSEOVERLINK"] = false, |
} |
end |
--------- |
--------- |
--------- |
------------ |
--commands-- |
------------ |
function ItemLinkRecolor_Cmd_ItemLinkRecolor() |
--show the options menu |
ShowUIPanel(InterfaceOptionsFrame) |
InterfaceOptionsFrame.lastFrame = GameMenuFrame |
--select our frame |
InterfaceOptionsFrame.selectedTab = 2 --addontab |
InterfaceOptionsFrame_TabOnClick() |
--find out our addonbutton and click on it |
local i = 1 |
while InterfaceOptionsFrameAddOns.buttons[i] do |
--if its our button then clikc on it |
if InterfaceOptionsFrameAddOns.buttons[i]:GetText() == ItemLinkRecolor["NAME"] then |
InterfaceOptionsFrameAddOns.buttons[i]:Click() |
return |
end |
i = i + 1 |
end |
end |
------------ |
------------ |
------------ |
--interface functions for item Link Recolor |
------------ |
--on event-- |
------------ |
function ItemLinkRecolor_Interface_Event() |
--register option menu |
local panel = ItemLinkRecolor_Interface |
panel.name = ItemLinkRecolor["NAME"] |
--panel.parent = UIParent |
panel.okay = ItemLinkRecolor_Ok_Button_OnClick |
panel.cancel = ItemLinkRecolor_Close_Button_OnClick |
panel.default = ItemLinkRecolor_Default_Button_OnClick |
InterfaceOptions_AddCategory(panel) |
end |
function ItemLinkRecolor_Interface_OnShow() |
--set the state of the buttons |
ItemLinkRecolor_Enable_Button:SetChecked(ItemLinkRecolorSavedVars["ENABLED"]) |
ItemLinkRecolor_ItemLink_Button:SetChecked(ItemLinkRecolorSavedVars["ILENABLED"]) |
ItemLinkRecolor_Money_Button:SetChecked(ItemLinkRecolorSavedVars["MLENABLED"]) |
ItemLinkRecolor_MiniIcon_Button:SetChecked(ItemLinkRecolorSavedVars["MIENABLED"]) |
ItemLinkRecolor_RequiredLevel_Button:SetChecked(ItemLinkRecolorSavedVars["LENABLED"]) |
ItemLinkRecolor_Sockets_Button:SetChecked(ItemLinkRecolorSavedVars["SENABLED"]) |
ItemLinkRecolor_MouseOver_Button:SetChecked(ItemLinkRecolorSavedVars["MOUSEOVERLINK"]) |
--set the enable / disabled state |
ItemLinkRecolor_Interface_Enable_Buttons() |
end |
function ItemLinkRecolor_Interface_OnHide() |
end |
------------ |
------------ |
------------ |
------------ |
--on click-- |
------------ |
function ItemLinkRecolor_Enable_Button_OnClick() |
--get the bottun state to the variable |
ItemLinkRecolorSavedVars["ENABLED"] = ItemLinkRecolor_Enable_Button:GetChecked() |
--set the enable / disabled state |
ItemLinkRecolor_Interface_Enable_Buttons() |
end |
function ItemLinkRecolor_ItemLink_Button_OnClick() |
--get the bottun state to the variable |
ItemLinkRecolorSavedVars["ILENABLED"] = ItemLinkRecolor_ItemLink_Button:GetChecked() |
--set the enable / disabled state |
ItemLinkRecolor_Interface_Enable_Buttons() |
end |
function ItemLinkRecolor_Money_Button_OnClick(self) |
--get the bottun state to the variable |
ItemLinkRecolorSavedVars["MLENABLED"] = self:GetChecked() |
end |
function ItemLinkRecolor_MiniIcon_Button_OnClick(self) |
--get the bottun state to the variable |
ItemLinkRecolorSavedVars["MIENABLED"] = self:GetChecked() |
end |
function ItemLinkRecolor_RequiredLevel_Button_OnClick(self) |
--get the bottun state to the variable |
ItemLinkRecolorSavedVars["LENABLED"] = self:GetChecked() |
end |
function ItemLinkRecolor_Sockets_Button_OnClick(self) |
--get the bottun state to the variable |
ItemLinkRecolorSavedVars["SENABLED"] = self:GetChecked() |
end |
function ItemLinkRecolor_MouseOver_Button_OnClick(self) |
--get the bottun state to the variable |
ItemLinkRecolorSavedVars["MOUSEOVERLINK"] = self:GetChecked() |
end |
function ItemLinkRecolor_Close_Button_OnClick() |
--close the interface |
ItemLinkRecolor_Interface:Hide() |
end |
function ItemLinkRecolor_Ok_Button_OnClick() |
--save the new settings |
end |
function ItemLinkRecolor_Default_Button_OnClick() |
--reset settings |
ItemLinkRecolor_Reset() |
--redraw |
ItemLinkRecolor_Interface_OnShow() |
end |
------------ |
------------ |
------------ |
------------------- |
--other functions-- |
------------------- |
function ItemLinkRecolor_Interface_Enable_Buttons() |
--if we got nickcompleter enabled |
if ItemLinkRecolorSavedVars["ENABLED"] then |
--enable checkboxes |
ItemLinkRecolor_ItemLink_Button:Enable() |
ItemLinkRecolor_Money_Button:Enable() |
ItemLinkRecolor_MiniIcon_Button:Enable() |
--if we got itemlinks enabled |
if ItemLinkRecolorSavedVars["ILENABLED"] then |
--enable itemlink options |
ItemLinkRecolor_RequiredLevel_Button:Enable() |
ItemLinkRecolor_Sockets_Button:Enable() |
else |
--disable itemlnik options |
ItemLinkRecolor_RequiredLevel_Button:Disable() |
ItemLinkRecolor_Sockets_Button:Disable() |
end |
else |
--disable all check boxes |
ItemLinkRecolor_ItemLink_Button:Disable() |
ItemLinkRecolor_Money_Button:Disable() |
ItemLinkRecolor_MiniIcon_Button:Disable() |
ItemLinkRecolor_RequiredLevel_Button:Disable() |
ItemLinkRecolor_Sockets_Button:Disable() |
end |
end |
------------------- |
------------------- |
------------------- |