-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.lua
60 lines (55 loc) · 1.32 KB
/
functions.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
local addonName, NS = ...
NS.functions={}
local function stringReplaceIndex(str,a,b,replace)
return strsub(str,0,a-1) .. replace .. strsub(str, b+1)
end
NS.functions.stringReplaceIndex=stringReplaceIndex
M_ChatPainter.stringReplaceIndex=stringReplaceIndex
local function addTexture(text,texture,color)
local t= "Interface\\Icons\\ability_warrior_shieldwall";
if(texture ) then
t= texture;
end
if(color) then
text="|CFF"..color..text.."|r"
end
return "|T"..t..":0|t"..text;
end
M_ChatPainter.addTexture=addTexture
NS.functions.addTexture=addTexture
local function colorText(text,lvlDiffMin,lvlDiffMax,isHC)
local orange="fc8c03"
local yellow="fce703"
local green="00b530"
local hcColor="7fffac"
local darkRed="c00700"
local txt=orange
if(lvlDiffMin and lvlDiffMin<1) then
txt=yellow
end
if(lvlDiffMax and lvlDiffMax<0) then
txt=green
end
if(lvlDiffMin and lvlDiffMin>4) then
txt=darkRed
end
if isHC then
txt=hcColor
end
return "|CFF"..txt..text.."|r" --|cAARRGGBB https://wowwiki.fandom.com/wiki/UI_escape_sequences
end
NS.functions.colorText=colorText
local function tContains(table, item)
if(table == nil) then
return nil
end
local index = 1;
while table[index] do
if ( item == table[index] ) then
return 1;
end
index = index + 1;
end
return nil;
end
NS.functions.tContains = tContains