-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTransmission.lua
More file actions
145 lines (113 loc) · 3.74 KB
/
Transmission.lua
File metadata and controls
145 lines (113 loc) · 3.74 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
local function boolToNumber(value)
return value and 1 or 0
end
local function numberToBool(number)
if number == 0 then
return false
end
return true
end
function convertTrackerToString(index,typeOfTracker)
local string = ""
--typeOfTracker
--0 debuff
--1 buff
--2 cooldown
if typeOfTracker == 0 then
local tracker = HTTsavedVars[HTT_variables.currentlySelectedProfile].debuffTable[index]
string = string..typeOfTracker.."#"..tracker.name.."#"..","..tracker.color[1]..","..tracker.color[2]..","..tracker.color[3]..","..(tracker.color[4] or 1)..",#"
for k,v in pairs(tracker.IDs) do
string = string..","..v
end
string = string..",#"..tracker.icon.."#"
for k,v in pairs(tracker.skill) do
string = string..","..v
end
string = string..",#"
for k,v in pairs(tracker.itemSet[1]) do
string = string..","..v
end
string = string..",#"..(tracker.itemSet[2] or 0).."#"..tracker.text.."#"..tracker.textWhenMissing.."#"..boolToNumber(tracker.onlyCastByPlayer).."#"
end
d(string)
return string
end
function loadTrackerFromString(string)
local typeOfTracker = tonumber(string.sub(string, 1, 1))
local t = {}
local i = 0
while true do
i = string.find(string, "#", i+1)
if i == nil then break end
table.insert(t, i)
end
if typeOfTracker == 0 then
--name
local name = string.sub(string, t[1]+1, t[2]-2)
--color
local t1 = {}
local i1 = 0
local colorString = string.sub(string, t[2]+1, t[3]-1)
while true do
i1 = string.find(colorString, ",", i1+1)
if i1 == nil then break end
table.insert(t1, i1)
end
local color1 = string.sub(colorString, t1[1]+1, t1[2]-1)
local color2 = string.sub(colorString, t1[2]+1, t1[3]-1)
local color3 = string.sub(colorString, t1[3]+1, t1[4]-1)
local color4 = string.sub(colorString, t1[4]+1, t1[5]-1)
local color = {color1,color2,color3,color4}
--IDs
local IDs = {}
local t2 = {}
local i2 = 0
local idString = string.sub(string, t[3]+1, t[4]-1)
while true do
i2 = string.find(idString, ",", i2+1)
if i2 == nil then break end
table.insert(t2, i2)
end
for x=1, #t2-1 do
table.insert(IDs,tonumber(string.sub(idString, t2[x]+1, t2[x+1]-1)))
end
--icon
local icon = string.sub(string, t[4]+1, t[5]-1)
--skills
local skills = {}
local t3 = {}
local i3 = 0
local skillString = string.sub(string, t[5]+1, t[6]-1)
while true do
i3 = string.find(skillString, ",", i3+1)
if i3 == nil then break end
table.insert(t3, i3)
end
for x=1, #t3-1 do
table.insert(IDs,tonumber(string.sub(idString, t3[x]+1, t3[x+1]-1)))
end
--itemSets
local itemSets = {}
local t4 = {}
local i4 = 0
local itemSetsString = string.sub(string, t[6]+1, t[7]-1)
while true do
i4 = string.find(itemSetsString, ",", i4+1)
if i4 == nil then break end
table.insert(t4, i4)
end
for x=1, #t4-1 do
table.insert(IDs,tonumber(string.sub(idString, t4[x]+1, t4[x+1]-1)))
end
--itemSetsNumber
local itemSetsNumber = tonumber(string.sub(string, t[7]+1, t[8]-1))
--text
local text = string.sub(string, t[8]+1, t[9]-1)
--textWhenMissing
local textWhenMissing = string.sub(string, t[9]+1, t[10]-1)
--onlyCastByPlayer
local onlyCastByPlayer = numberToBool(tonumber(string.sub(string, t[10]+1, t[11]-1)))
local tableSlot = HTT_functions.findFreeSlotInTable(HTTsavedVars[HTT_variables.currentlySelectedProfile].debuffTable)
HTT_functions.addDebuff(name,IDs,tableSlot,text,textWhenMissing,color,nil,nil,onlyCastByPlayer,skill,itemSets,itemSetsNumber,icon)
end
end