1 |
2 |
Thurallor-7095 |
SequenceEditor = class(Turbine.UI.Lotro.Window); |
2 |
|
Thurallor-7095 |
|
3 |
7 |
Thurallor-7095 |
-- Class variable keeping track of all SequenceEditor instances: |
4 |
|
Thurallor-7095 |
SequenceEditor.instances = {}; |
5 |
|
Thurallor-7095 |
|
6 |
2 |
Thurallor-7095 |
function SequenceEditor:Constructor(bar, settings) |
7 |
|
Thurallor-7095 |
Turbine.UI.Lotro.Window.Constructor(self); |
8 |
7 |
Thurallor-7095 |
SequenceEditor.instances[self] = true; |
9 |
2 |
Thurallor-7095 |
|
10 |
|
Thurallor-7095 |
self.bar = bar; |
11 |
|
Thurallor-7095 |
self.manager = self.bar.manager; |
12 |
|
Thurallor-7095 |
self.settings = settings; |
13 |
20 |
Thurallor-7095 |
self.globals = self.manager.settings; |
14 |
2 |
Thurallor-7095 |
|
15 |
|
Thurallor-7095 |
self:SetText(bar:GetName()); |
16 |
13 |
Thurallor-7095 |
self:SetZOrder(2); |
17 |
2 |
Thurallor-7095 |
|
18 |
33 |
Thurallor-7095 |
local minWidth = L:GetText("/SequenceEditor/MinWidth"); |
19 |
2 |
Thurallor-7095 |
if (not self.settings.sequenceEditor) then |
20 |
|
Thurallor-7095 |
self.settings.sequenceEditor = {}; |
21 |
7 |
Thurallor-7095 |
self.settings.sequenceEditor.defaultIcon = resources.BlankIcons[3]; |
22 |
2 |
Thurallor-7095 |
end |
23 |
|
Thurallor-7095 |
if (self.settings.sequenceEditor.position) then |
24 |
|
Thurallor-7095 |
self:SetPosition(unpack(self.settings.sequenceEditor.position)); |
25 |
|
Thurallor-7095 |
else |
26 |
|
Thurallor-7095 |
self:SetPosition(self.bar:GetPosition()); |
27 |
|
Thurallor-7095 |
end |
28 |
|
Thurallor-7095 |
if (self.settings.sequenceEditor.size) then |
29 |
|
Thurallor-7095 |
self:SetSize(unpack(self.settings.sequenceEditor.size)); |
30 |
|
Thurallor-7095 |
else |
31 |
33 |
Thurallor-7095 |
self:SetSize(minWidth, 187); |
32 |
2 |
Thurallor-7095 |
end |
33 |
13 |
Thurallor-7095 |
|
34 |
16 |
Thurallor-7095 |
self.relatedSlots = {}; |
35 |
|
Thurallor-7095 |
|
36 |
13 |
Thurallor-7095 |
-- Enforce minimum size |
37 |
33 |
Thurallor-7095 |
self:SetMinimumWidth(minWidth); |
38 |
|
Thurallor-7095 |
if (self:GetWidth() < minWidth) then |
39 |
|
Thurallor-7095 |
self:SetWidth(minWidth); |
40 |
|
Thurallor-7095 |
end |
41 |
13 |
Thurallor-7095 |
self:SetMinimumHeight(142); |
42 |
|
Thurallor-7095 |
self:SetResizable(true); |
43 |
|
Thurallor-7095 |
|
44 |
2 |
Thurallor-7095 |
self:Redraw(); |
45 |
178 |
Thurallor-7095 |
self.horizontalLines = {}; |
46 |
18 |
Thurallor-7095 |
AddCallback(self, "SizeChanged", function() |
47 |
47 |
Thurallor-7095 |
self.skipUpdates = 2; |
48 |
|
Thurallor-7095 |
self:SetWantsUpdates(true); --redraw during update cycle |
49 |
18 |
Thurallor-7095 |
end); |
50 |
20 |
Thurallor-7095 |
|
51 |
|
Thurallor-7095 |
self:SelectSlot(nil); |
52 |
158 |
Thurallor-7095 |
self:SetVisible(true); |
53 |
2 |
Thurallor-7095 |
end |
54 |
|
Thurallor-7095 |
|
55 |
177 |
Thurallor-7095 |
function SequenceEditor:UpdateBar(updateEventDirectory) |
56 |
16 |
Thurallor-7095 |
self.bar:ShortcutChanged(); |
57 |
|
Thurallor-7095 |
self.manager:NotifyIncluders(self.bar:GetID()); |
58 |
177 |
Thurallor-7095 |
if (updateEventDirectory) then |
59 |
|
Thurallor-7095 |
self.manager:SaveSettings(false, true); |
60 |
|
Thurallor-7095 |
end |
61 |
16 |
Thurallor-7095 |
end |
62 |
|
Thurallor-7095 |
|
63 |
7 |
Thurallor-7095 |
function SequenceEditor:Activated() |
64 |
|
Thurallor-7095 |
-- Find the maximum Z order among all other Sequence Editors. |
65 |
|
Thurallor-7095 |
local maxZ = self:GetZOrder() - 1; |
66 |
|
Thurallor-7095 |
for editor in keys(SequenceEditor.instances) do |
67 |
|
Thurallor-7095 |
if (editor ~= self) then |
68 |
|
Thurallor-7095 |
local z = editor:GetZOrder(); |
69 |
|
Thurallor-7095 |
if (z > maxZ) then |
70 |
|
Thurallor-7095 |
maxZ = z; |
71 |
|
Thurallor-7095 |
end |
72 |
|
Thurallor-7095 |
end |
73 |
|
Thurallor-7095 |
end |
74 |
|
Thurallor-7095 |
|
75 |
|
Thurallor-7095 |
if (maxZ == 2147483647) then |
76 |
|
Thurallor-7095 |
-- Move all other SequenceEditors back to make room at the front. |
77 |
|
Thurallor-7095 |
for editor in keys(SequenceEditor.instances) do |
78 |
|
Thurallor-7095 |
editor:SetZOrder(editor:GetZOrder() - 1); |
79 |
|
Thurallor-7095 |
end |
80 |
|
Thurallor-7095 |
maxZ = maxZ - 1; |
81 |
|
Thurallor-7095 |
end |
82 |
|
Thurallor-7095 |
|
83 |
|
Thurallor-7095 |
-- Move the newly-activated Sequence Editor to the front of the stack. |
84 |
|
Thurallor-7095 |
self:SetZOrder(maxZ + 1); |
85 |
|
Thurallor-7095 |
end |
86 |
|
Thurallor-7095 |
|
87 |
2 |
Thurallor-7095 |
function SequenceEditor:SetText(barName) |
88 |
|
Thurallor-7095 |
local title = L:GetText("/SequenceEditor/Title"); |
89 |
|
Thurallor-7095 |
title = string.gsub(title, "<name>", barName); |
90 |
|
Thurallor-7095 |
Turbine.UI.Lotro.Window.SetText(self, title); |
91 |
|
Thurallor-7095 |
end |
92 |
|
Thurallor-7095 |
|
93 |
|
Thurallor-7095 |
function SequenceEditor:SaveSettings() |
94 |
|
Thurallor-7095 |
self.bar:SaveSettings(); |
95 |
|
Thurallor-7095 |
end |
96 |
|
Thurallor-7095 |
|
97 |
|
Thurallor-7095 |
function SequenceEditor:Redraw() |
98 |
46 |
Thurallor-7095 |
if (self.noRedraw) then |
99 |
|
Thurallor-7095 |
return; |
100 |
|
Thurallor-7095 |
end |
101 |
2 |
Thurallor-7095 |
local width, height = self:GetSize(); |
102 |
|
Thurallor-7095 |
local xMargin = 16; |
103 |
|
Thurallor-7095 |
local topMargin = 35; |
104 |
|
Thurallor-7095 |
local bottomMargin = 42; |
105 |
47 |
Thurallor-7095 |
local minSlotTabCardWidth = L:GetNumber("/SequenceEditor/SlotTabCardWidth"); |
106 |
|
Thurallor-7095 |
|
107 |
2 |
Thurallor-7095 |
if (not self.slotTabCard) then |
108 |
|
Thurallor-7095 |
self.slotTabCard = Thurallor.UI.TabCard(); |
109 |
|
Thurallor-7095 |
self.slotTabCard:SetParent(self); |
110 |
|
Thurallor-7095 |
self.slotTabCard:SetTabText(L:GetText("/SequenceEditor/SlotTab")); |
111 |
20 |
Thurallor-7095 |
|
112 |
|
Thurallor-7095 |
-- When mouse reenters the area, redisplay the current slot in case options have changed. |
113 |
|
Thurallor-7095 |
self.slotTabCard.MouseEnter = function(ctl) |
114 |
|
Thurallor-7095 |
if (not ctl.mouseInside) then |
115 |
|
Thurallor-7095 |
ctl.mouseInside = true; |
116 |
|
Thurallor-7095 |
self:DisplaySlot(self.selectedSlot); |
117 |
|
Thurallor-7095 |
end |
118 |
|
Thurallor-7095 |
end |
119 |
|
Thurallor-7095 |
self.MouseEnter = function() |
120 |
|
Thurallor-7095 |
if (self.slotTabCard.mouseInside) then |
121 |
|
Thurallor-7095 |
local left, top = self.slotTabCard:GetMousePosition(); |
122 |
|
Thurallor-7095 |
local width, height = self.slotTabCard:GetSize(); |
123 |
|
Thurallor-7095 |
if ((left < 0) or (left >= width) or (top < 0) or (top >= height)) then |
124 |
|
Thurallor-7095 |
self.slotTabCard.mouseInside = false; |
125 |
|
Thurallor-7095 |
end |
126 |
|
Thurallor-7095 |
end |
127 |
|
Thurallor-7095 |
end |
128 |
47 |
Thurallor-7095 |
|
129 |
|
Thurallor-7095 |
-- When slot properties card size changes, redisplay the current slot |
130 |
|
Thurallor-7095 |
self.slotTabCard.SizeChanged = function() |
131 |
|
Thurallor-7095 |
self:DisplaySlot(self.selectedSlot); |
132 |
|
Thurallor-7095 |
end |
133 |
2 |
Thurallor-7095 |
end |
134 |
|
Thurallor-7095 |
|
135 |
|
Thurallor-7095 |
if (not self.sequenceTabCard) then |
136 |
|
Thurallor-7095 |
self.sequenceTabCard = Thurallor.UI.TabCard(); |
137 |
|
Thurallor-7095 |
self.sequenceTabCard:SetTabText(L:GetText("/SequenceEditor/SequenceTab")); |
138 |
13 |
Thurallor-7095 |
self.slotPanel = Turbine.UI.Control(); |
139 |
|
Thurallor-7095 |
self.sequenceTabCard:SetInteriorControl(self.slotPanel); |
140 |
|
Thurallor-7095 |
self.sequenceTabCard:SetInteriorAlignment(Turbine.UI.ContentAlignment.TopLeft); |
141 |
47 |
Thurallor-7095 |
|
142 |
|
Thurallor-7095 |
-- When sequence card size changes, update the slot grid layout |
143 |
|
Thurallor-7095 |
self.sequenceTabCard.SizeChanged = function() |
144 |
|
Thurallor-7095 |
self:DeleteEmptyTrailingSlots(); |
145 |
|
Thurallor-7095 |
local slotPanelWidth = self.sequenceTabCard:GetWidth() - 6; |
146 |
|
Thurallor-7095 |
self.slotSize = self.settings.slotSize + self.settings.slotSpacing; |
147 |
|
Thurallor-7095 |
self.slotsWide = math.floor((slotPanelWidth - 3) / self.slotSize); |
148 |
|
Thurallor-7095 |
self.slotsHigh = math.max(math.ceil(#self.settings.sequenceItemInfo / self.slotsWide) + 1, 2); |
149 |
|
Thurallor-7095 |
self:ExtendSequenceTo(self.slotsHigh * self.slotsWide); |
150 |
|
Thurallor-7095 |
self.slotPanel:SetSize(self.slotsWide * self.slotSize + 3, self.slotsHigh * self.slotSize + 3); |
151 |
|
Thurallor-7095 |
self.slotPanel:SetBackColor(self.bar.color); |
152 |
|
Thurallor-7095 |
|
153 |
|
Thurallor-7095 |
-- Draw some quickslots |
154 |
|
Thurallor-7095 |
if (not self.sequenceItems) then |
155 |
|
Thurallor-7095 |
self.sequenceItems = {}; |
156 |
|
Thurallor-7095 |
end |
157 |
|
Thurallor-7095 |
local s = 1; |
158 |
|
Thurallor-7095 |
for y = 1, self.slotsHigh, 1 do |
159 |
|
Thurallor-7095 |
for x = 1, self.slotsWide, 1 do |
160 |
|
Thurallor-7095 |
self:RebuildSlot(s, x, y); |
161 |
|
Thurallor-7095 |
s = s + 1; |
162 |
|
Thurallor-7095 |
end |
163 |
|
Thurallor-7095 |
end |
164 |
|
Thurallor-7095 |
end |
165 |
|
Thurallor-7095 |
|
166 |
2 |
Thurallor-7095 |
end |
167 |
|
Thurallor-7095 |
|
168 |
47 |
Thurallor-7095 |
if (not self.splitControl) then |
169 |
|
Thurallor-7095 |
self.splitControl = Thurallor.UI.SplitControl(Turbine.UI.Orientation.Horizontal, self.sequenceTabCard, self.slotTabCard); |
170 |
|
Thurallor-7095 |
self.splitControl:SetParent(self); |
171 |
|
Thurallor-7095 |
self.splitControl:SetPosition(xMargin, topMargin); |
172 |
|
Thurallor-7095 |
self.splitControl:SetSashSize(5); |
173 |
|
Thurallor-7095 |
self.splitControl:SetSpacing(3); |
174 |
|
Thurallor-7095 |
if (self.settings.sequenceEditor.sashPosition == nil) then |
175 |
|
Thurallor-7095 |
self.splitControl:SetSashPosition(1); |
176 |
|
Thurallor-7095 |
self.settings.sequenceEditor.sashPosition = self.splitControl:GetSashPosition(); |
177 |
|
Thurallor-7095 |
else |
178 |
|
Thurallor-7095 |
self.splitControl:SetSashPosition(self.settings.sequenceEditor.sashPosition); |
179 |
2 |
Thurallor-7095 |
end |
180 |
48 |
Thurallor-7095 |
AddCallback(self.splitControl, "SashPositionChanged", function() |
181 |
47 |
Thurallor-7095 |
self.settings.sequenceEditor.sashPosition = self.splitControl:GetSashPosition(); |
182 |
|
Thurallor-7095 |
self:SaveSettings(); |
183 |
48 |
Thurallor-7095 |
end); |
184 |
2 |
Thurallor-7095 |
end |
185 |
47 |
Thurallor-7095 |
local splitControlWidth = width - (2 * xMargin); |
186 |
|
Thurallor-7095 |
self.splitControl:SetSize(splitControlWidth, height - (topMargin + bottomMargin)); |
187 |
|
Thurallor-7095 |
self.sequenceTabCard:SizeChanged(); |
188 |
|
Thurallor-7095 |
|
189 |
|
Thurallor-7095 |
-- Enforce minimum width for slot properties card |
190 |
|
Thurallor-7095 |
self.splitControl:SetMaximumSashPosition((splitControlWidth - minSlotTabCardWidth - 5.5) / splitControlWidth); |
191 |
|
Thurallor-7095 |
-- Enforce minimum width for sequence card |
192 |
|
Thurallor-7095 |
self.splitControl:SetMinimumSashPosition(124 / splitControlWidth); |
193 |
|
Thurallor-7095 |
|
194 |
2 |
Thurallor-7095 |
if (not self.instructions) then |
195 |
|
Thurallor-7095 |
self.instructions = Turbine.UI.Label(); |
196 |
|
Thurallor-7095 |
self.instructions:SetParent(self); |
197 |
|
Thurallor-7095 |
self.instructions:SetMouseVisible(false); |
198 |
|
Thurallor-7095 |
self.instructions:SetTextAlignment(Turbine.UI.ContentAlignment.MiddleCenter); |
199 |
|
Thurallor-7095 |
self.instructions:SetFont(Turbine.UI.Lotro.Font.TrajanPro15); |
200 |
|
Thurallor-7095 |
self.instructions:SetMultiline(true); |
201 |
|
Thurallor-7095 |
self.instructions:SetForeColor(Turbine.UI.Color.PaleGoldenrod); |
202 |
|
Thurallor-7095 |
self.instructions:SetText(L:GetText("/SequenceEditor/Instructions")); |
203 |
|
Thurallor-7095 |
end |
204 |
|
Thurallor-7095 |
self.instructions:SetSize(self:GetWidth() - 2 * xMargin, 30); |
205 |
|
Thurallor-7095 |
self.instructions:SetPosition(xMargin, self:GetHeight() - 40); |
206 |
13 |
Thurallor-7095 |
|
207 |
|
Thurallor-7095 |
if (self.selectedSlot) then |
208 |
|
Thurallor-7095 |
self:SelectSlot(self.selectedSlot); |
209 |
2 |
Thurallor-7095 |
end |
210 |
|
Thurallor-7095 |
end |
211 |
|
Thurallor-7095 |
|
212 |
15 |
Thurallor-7095 |
function SequenceEditor:SetMinimumHeight(height) |
213 |
|
Thurallor-7095 |
Turbine.UI.Window.SetMinimumHeight(self, height); |
214 |
|
Thurallor-7095 |
if (self:GetHeight() < height) then |
215 |
|
Thurallor-7095 |
self:SetHeight(height); |
216 |
47 |
Thurallor-7095 |
self.skipUpdates = 0; |
217 |
|
Thurallor-7095 |
self:SetWantsUpdates(true); |
218 |
15 |
Thurallor-7095 |
end |
219 |
|
Thurallor-7095 |
end |
220 |
|
Thurallor-7095 |
|
221 |
47 |
Thurallor-7095 |
function SequenceEditor:Update() |
222 |
|
Thurallor-7095 |
if (self.skipUpdates > 0) then |
223 |
|
Thurallor-7095 |
self.skipUpdates = self.skipUpdates - 1; |
224 |
|
Thurallor-7095 |
else |
225 |
|
Thurallor-7095 |
self:Redraw(); |
226 |
|
Thurallor-7095 |
self.settings.sequenceEditor.size = {self:GetSize()}; |
227 |
|
Thurallor-7095 |
self:SaveSettings(); |
228 |
|
Thurallor-7095 |
self:SetWantsUpdates(false); |
229 |
|
Thurallor-7095 |
end |
230 |
2 |
Thurallor-7095 |
end |
231 |
|
Thurallor-7095 |
|
232 |
|
Thurallor-7095 |
function SequenceEditor:PositionChanged() |
233 |
|
Thurallor-7095 |
self.settings.sequenceEditor.position = {self:GetPosition()}; |
234 |
|
Thurallor-7095 |
self:SaveSettings(); |
235 |
|
Thurallor-7095 |
end |
236 |
|
Thurallor-7095 |
|
237 |
158 |
Thurallor-7095 |
function SequenceEditor:MoveOntoScreen() |
238 |
|
Thurallor-7095 |
local screenWidth, screenHeight = Turbine.UI.Display:GetWidth(), Turbine.UI.Display:GetHeight(); |
239 |
|
Thurallor-7095 |
local left, top = self:GetPosition(); |
240 |
|
Thurallor-7095 |
local right, bottom = left + self:GetWidth(), top + self:GetHeight(); |
241 |
|
Thurallor-7095 |
local deltaX, deltaY = 0, 0; |
242 |
|
Thurallor-7095 |
if (left < 0) then |
243 |
|
Thurallor-7095 |
deltaX = -left; |
244 |
|
Thurallor-7095 |
elseif (right > screenWidth) then |
245 |
|
Thurallor-7095 |
deltaX = screenWidth - right; |
246 |
|
Thurallor-7095 |
end |
247 |
|
Thurallor-7095 |
if (top < 0) then |
248 |
|
Thurallor-7095 |
deltaY = -top; |
249 |
|
Thurallor-7095 |
elseif (bottom > screenHeight) then |
250 |
|
Thurallor-7095 |
deltaY = screenHeight - bottom; |
251 |
|
Thurallor-7095 |
end |
252 |
|
Thurallor-7095 |
self:SetPosition(left + deltaX, top + deltaY); |
253 |
|
Thurallor-7095 |
end |
254 |
|
Thurallor-7095 |
|
255 |
|
Thurallor-7095 |
function SequenceEditor:SetVisible(visible) |
256 |
|
Thurallor-7095 |
Turbine.UI.Lotro.Window.SetVisible(self, visible); |
257 |
|
Thurallor-7095 |
if (visible) then |
258 |
|
Thurallor-7095 |
self:MoveOntoScreen(); |
259 |
|
Thurallor-7095 |
end |
260 |
|
Thurallor-7095 |
end |
261 |
|
Thurallor-7095 |
|
262 |
2 |
Thurallor-7095 |
function SequenceEditor:DisplaySlot(s) |
263 |
20 |
Thurallor-7095 |
if (self.ItemMovedCallback) then |
264 |
|
Thurallor-7095 |
RemoveCallback(Thurallor.Utils.Watcher, "ItemMoved", self.ItemMovedCallback); |
265 |
|
Thurallor-7095 |
self.ItemMovedCallback = nil; |
266 |
|
Thurallor-7095 |
end |
267 |
|
Thurallor-7095 |
|
268 |
2 |
Thurallor-7095 |
self.slotTabCard:SetInteriorControl(nil); |
269 |
178 |
Thurallor-7095 |
for _, control in pairs(self.horizontalLines) do |
270 |
|
Thurallor-7095 |
control:SetParent(nil); |
271 |
|
Thurallor-7095 |
end |
272 |
|
Thurallor-7095 |
self.horizontalLines = {}; |
273 |
2 |
Thurallor-7095 |
self.slotTabCard:SetTabText(L:GetText("/SequenceEditor/SlotTab")); |
274 |
7 |
Thurallor-7095 |
if ((s == nil) or (s > #self.settings.sequenceItemInfo)) then |
275 |
|
Thurallor-7095 |
self.slotTabCard:SetVisible(false); |
276 |
2 |
Thurallor-7095 |
return; |
277 |
7 |
Thurallor-7095 |
else |
278 |
|
Thurallor-7095 |
self.slotTabCard:SetVisible(true); |
279 |
2 |
Thurallor-7095 |
end |
280 |
|
Thurallor-7095 |
self:ExtendSequenceTo(s); |
281 |
|
Thurallor-7095 |
local info = self.settings.sequenceItemInfo[s]; |
282 |
47 |
Thurallor-7095 |
local slotTabCardWidth = self.slotTabCard:GetWidth(); |
283 |
2 |
Thurallor-7095 |
|
284 |
|
Thurallor-7095 |
-- Update slot tab caption and create properties container |
285 |
|
Thurallor-7095 |
self.slotTabCard:SetTabText(L:GetText("/SequenceEditor/SlotTab") .. " " .. tostring(s)); |
286 |
|
Thurallor-7095 |
self.slotProperties = Turbine.UI.Control(); |
287 |
|
Thurallor-7095 |
self.slotTabCard:SetInteriorControl(self.slotProperties); |
288 |
47 |
Thurallor-7095 |
self.slotProperties:SetWidth(slotTabCardWidth - 17); |
289 |
13 |
Thurallor-7095 |
|
290 |
7 |
Thurallor-7095 |
local function UpdateIcon() |
291 |
35 |
Thurallor-7095 |
local center = math.floor((slotTabCardWidth - 20) / 2); |
292 |
34 |
Thurallor-7095 |
self.selectedIcon = self:BuildSlot(s, self.slotProperties, self.selectedIcon, center - 16, 10); |
293 |
13 |
Thurallor-7095 |
self.selectedIcon.numLabel:SetText(nil); -- don't display slot number overlay |
294 |
|
Thurallor-7095 |
self.selectedIcon.numLabel.MouseClick = nil; -- disable right-click menu |
295 |
|
Thurallor-7095 |
self.selectedIcon.numLabel.MouseDown = nil; -- disable dragging |
296 |
15 |
Thurallor-7095 |
self.selectedIcon:SetActionEnabled(true); |
297 |
|
Thurallor-7095 |
self.selectedIcon:SetAllowDrop(true); |
298 |
7 |
Thurallor-7095 |
self:RebuildSlot(s, nil, nil, true); |
299 |
|
Thurallor-7095 |
end |
300 |
|
Thurallor-7095 |
UpdateIcon(); |
301 |
2 |
Thurallor-7095 |
|
302 |
|
Thurallor-7095 |
-- Create a function for adding a centered line of text to the properties control |
303 |
|
Thurallor-7095 |
local AddLabel = function(top, text, color) |
304 |
|
Thurallor-7095 |
local label = Turbine.UI.Label(); |
305 |
|
Thurallor-7095 |
label:SetParent(self.slotProperties); |
306 |
|
Thurallor-7095 |
label:SetPosition(0, top); |
307 |
35 |
Thurallor-7095 |
label:SetSize(slotTabCardWidth - 20, 16); |
308 |
2 |
Thurallor-7095 |
top = top + 16; |
309 |
|
Thurallor-7095 |
label:SetTextAlignment(Turbine.UI.ContentAlignment.MiddleCenter); |
310 |
|
Thurallor-7095 |
label:SetFont(Turbine.UI.Lotro.Font.TrajanPro14); |
311 |
|
Thurallor-7095 |
label:SetForeColor(color); |
312 |
|
Thurallor-7095 |
label:SetMarkupEnabled(true); |
313 |
|
Thurallor-7095 |
label:SetText(text); |
314 |
|
Thurallor-7095 |
return top, label; |
315 |
|
Thurallor-7095 |
end |
316 |
20 |
Thurallor-7095 |
|
317 |
|
Thurallor-7095 |
-- Create a function for adding a centered button to the properties control |
318 |
47 |
Thurallor-7095 |
local AddButton = function(top, width, text, font) |
319 |
20 |
Thurallor-7095 |
local button = Turbine.UI.Lotro.Button(); |
320 |
|
Thurallor-7095 |
button:SetParent(self.slotProperties); |
321 |
|
Thurallor-7095 |
local left = math.floor((self.slotProperties:GetWidth() - width) / 2); |
322 |
|
Thurallor-7095 |
button:SetPosition(left, top + 2); |
323 |
|
Thurallor-7095 |
button:SetWidth(width); |
324 |
47 |
Thurallor-7095 |
if (font == nil) then |
325 |
|
Thurallor-7095 |
font = Turbine.UI.Lotro.Font.TrajanPro14; |
326 |
|
Thurallor-7095 |
end |
327 |
|
Thurallor-7095 |
button:SetFont(font); |
328 |
20 |
Thurallor-7095 |
button:SetText(text); |
329 |
|
Thurallor-7095 |
top = top + 2 + button:GetHeight(); |
330 |
|
Thurallor-7095 |
return top, button; |
331 |
|
Thurallor-7095 |
end |
332 |
|
Thurallor-7095 |
|
333 |
2 |
Thurallor-7095 |
-- Create a function for adding a centered text box to the properties control |
334 |
47 |
Thurallor-7095 |
local AddTextBox = function(top, text, color, resizable, textBoxSize) |
335 |
2 |
Thurallor-7095 |
local textBox = Turbine.UI.Lotro.TextBox(); |
336 |
|
Thurallor-7095 |
textBox:SetParent(self.slotProperties); |
337 |
|
Thurallor-7095 |
textBox:SetPosition(0, top); |
338 |
35 |
Thurallor-7095 |
textBox:SetSize(slotTabCardWidth - 20, 20); |
339 |
47 |
Thurallor-7095 |
if (textBoxSize) then |
340 |
|
Thurallor-7095 |
textBox:SetHeight(textBoxSize[2]); |
341 |
|
Thurallor-7095 |
end |
342 |
|
Thurallor-7095 |
top = top + textBox:GetHeight(); |
343 |
2 |
Thurallor-7095 |
textBox:SetTextAlignment(Turbine.UI.ContentAlignment.MiddleLeft); |
344 |
7 |
Thurallor-7095 |
textBox:SetMultiline(false); |
345 |
2 |
Thurallor-7095 |
textBox:SetFont(Turbine.UI.Lotro.Font.TrajanPro14); |
346 |
|
Thurallor-7095 |
textBox:SetForeColor(color); |
347 |
|
Thurallor-7095 |
textBox:SetText(text); |
348 |
47 |
Thurallor-7095 |
if (resizable) then |
349 |
|
Thurallor-7095 |
textBox.resizer = Thurallor.UI.Resizer(textBox); |
350 |
|
Thurallor-7095 |
textBox.resizer:SetMinimumHeight(20); |
351 |
|
Thurallor-7095 |
textBox.resizer:SetMinimumWidth(slotTabCardWidth - 20); |
352 |
|
Thurallor-7095 |
textBox.resizer:SetMaximumWidth(slotTabCardWidth - 20); |
353 |
|
Thurallor-7095 |
end |
354 |
2 |
Thurallor-7095 |
return top, textBox; |
355 |
|
Thurallor-7095 |
end |
356 |
6 |
Thurallor-7095 |
|
357 |
20 |
Thurallor-7095 |
-- Create a function for adding a left-justified checkbox to the properties control |
358 |
6 |
Thurallor-7095 |
local AddCheckBox = function(top, text, color, checked) |
359 |
|
Thurallor-7095 |
local checkBox = Turbine.UI.Lotro.CheckBox(); |
360 |
|
Thurallor-7095 |
checkBox:SetParent(self.slotProperties); |
361 |
|
Thurallor-7095 |
checkBox:SetPosition(0, top); |
362 |
35 |
Thurallor-7095 |
checkBox:SetSize(slotTabCardWidth - 20, 20); |
363 |
6 |
Thurallor-7095 |
top = top + 20; |
364 |
|
Thurallor-7095 |
checkBox:SetTextAlignment(Turbine.UI.ContentAlignment.MiddleLeft); |
365 |
|
Thurallor-7095 |
checkBox:SetFont(Turbine.UI.Lotro.Font.TrajanPro14); |
366 |
|
Thurallor-7095 |
checkBox:SetForeColor(color); |
367 |
|
Thurallor-7095 |
checkBox:SetText(text); |
368 |
|
Thurallor-7095 |
if (checked) then |
369 |
|
Thurallor-7095 |
checkBox:SetChecked(true); |
370 |
|
Thurallor-7095 |
end |
371 |
|
Thurallor-7095 |
return top, checkBox; |
372 |
|
Thurallor-7095 |
end |
373 |
2 |
Thurallor-7095 |
|
374 |
6 |
Thurallor-7095 |
-- Create a function for adding a left-justified radio button to the properties control |
375 |
|
Thurallor-7095 |
local AddRadioButton = function(top, text, color, checked) |
376 |
|
Thurallor-7095 |
local button = Thurallor.UI.RadioButton(self.slotProperties, text, checked); |
377 |
|
Thurallor-7095 |
button:SetPosition(0, top); |
378 |
35 |
Thurallor-7095 |
button:SetSize(slotTabCardWidth - 20, 16); |
379 |
6 |
Thurallor-7095 |
top = top + 16; |
380 |
|
Thurallor-7095 |
button:SetFont(Turbine.UI.Lotro.Font.TrajanPro14); |
381 |
|
Thurallor-7095 |
button:SetForeColor(color); |
382 |
|
Thurallor-7095 |
return top, button; |
383 |
|
Thurallor-7095 |
end |
384 |
|
Thurallor-7095 |
|
385 |
|
Thurallor-7095 |
-- Create a function for adding a drop-down listbox to the properties control |
386 |
16 |
Thurallor-7095 |
local AddDropDown = function(top, items, default) |
387 |
128 |
Thurallor-7095 |
local dropDown = Thurallor.UI.DropDown(items, default or items[1]); |
388 |
6 |
Thurallor-7095 |
dropDown:SetParent(self.slotProperties); |
389 |
|
Thurallor-7095 |
dropDown:SetPosition(0, top); |
390 |
35 |
Thurallor-7095 |
dropDown:SetWidth(slotTabCardWidth - 20); |
391 |
6 |
Thurallor-7095 |
top = top + dropDown:GetHeight(); |
392 |
|
Thurallor-7095 |
return top, dropDown; |
393 |
|
Thurallor-7095 |
end |
394 |
7 |
Thurallor-7095 |
|
395 |
16 |
Thurallor-7095 |
-- Create a function for adding a pull-down hierarchical menu to the properties control |
396 |
|
Thurallor-7095 |
local AddPullDown = function(top, items, default) |
397 |
|
Thurallor-7095 |
local pullDown = Thurallor.UI.PullDownMenu(items, default); |
398 |
|
Thurallor-7095 |
pullDown:SetParent(self.slotProperties); |
399 |
|
Thurallor-7095 |
pullDown:SetPosition(0, top); |
400 |
35 |
Thurallor-7095 |
pullDown:SetWidth(slotTabCardWidth - 20); |
401 |
16 |
Thurallor-7095 |
top = top + pullDown:GetHeight(); |
402 |
|
Thurallor-7095 |
return top, pullDown; |
403 |
|
Thurallor-7095 |
end |
404 |
|
Thurallor-7095 |
|
405 |
7 |
Thurallor-7095 |
-- Create a function for adding a horizontal scrollbar to the properties control |
406 |
|
Thurallor-7095 |
local AddSlider = function(top, minimum, maximum, value) |
407 |
|
Thurallor-7095 |
local scrollBar = Turbine.UI.Lotro.ScrollBar(); |
408 |
|
Thurallor-7095 |
scrollBar:SetParent(self.slotProperties); |
409 |
|
Thurallor-7095 |
scrollBar:SetPosition(0, top); |
410 |
35 |
Thurallor-7095 |
scrollBar:SetSize(slotTabCardWidth - 20, 10); |
411 |
7 |
Thurallor-7095 |
scrollBar:SetMinimum(minimum); |
412 |
|
Thurallor-7095 |
scrollBar:SetMaximum(maximum); |
413 |
|
Thurallor-7095 |
scrollBar:SetSmallChange(1); |
414 |
|
Thurallor-7095 |
scrollBar:SetValue(value); |
415 |
|
Thurallor-7095 |
top = top + 10; |
416 |
|
Thurallor-7095 |
return top, scrollBar; |
417 |
|
Thurallor-7095 |
end |
418 |
34 |
Thurallor-7095 |
|
419 |
178 |
Thurallor-7095 |
local AddHorizontalLine = function(top) |
420 |
|
Thurallor-7095 |
top = top + 32; |
421 |
|
Thurallor-7095 |
local control = Turbine.UI.Control() |
422 |
|
Thurallor-7095 |
control:SetBackColor(Turbine.UI.Color(1, 0.161, 0.188, 0.286)); |
423 |
|
Thurallor-7095 |
control:SetParent(self.slotTabCard); |
424 |
|
Thurallor-7095 |
control:SetPosition(0, top + 8); |
425 |
|
Thurallor-7095 |
control:SetSize(slotTabCardWidth, 1); |
426 |
|
Thurallor-7095 |
table.insert(self.horizontalLines, control); |
427 |
|
Thurallor-7095 |
return top + 1, control; |
428 |
|
Thurallor-7095 |
end |
429 |
|
Thurallor-7095 |
|
430 |
34 |
Thurallor-7095 |
-- Create a function for adding an expand/collapse section header to the properties control |
431 |
|
Thurallor-7095 |
local AddSection = function(top, text, color, expanded) |
432 |
178 |
Thurallor-7095 |
top = AddHorizontalLine(top); |
433 |
34 |
Thurallor-7095 |
local button = Turbine.UI.Control(); |
434 |
|
Thurallor-7095 |
button:SetParent(self.slotProperties); |
435 |
|
Thurallor-7095 |
button:SetPosition(0, top); |
436 |
|
Thurallor-7095 |
button:SetSize(16, 16); |
437 |
|
Thurallor-7095 |
button:SetBlendMode(Turbine.UI.BlendMode.Overlay); |
438 |
|
Thurallor-7095 |
local label = Turbine.UI.Label(); |
439 |
|
Thurallor-7095 |
label:SetParent(self.slotProperties); |
440 |
|
Thurallor-7095 |
label:SetPosition(18, top); |
441 |
35 |
Thurallor-7095 |
label:SetSize(slotTabCardWidth - 20 - 18, 16); |
442 |
34 |
Thurallor-7095 |
top = top + 16; |
443 |
|
Thurallor-7095 |
label:SetTextAlignment(Turbine.UI.ContentAlignment.MiddleLeft); |
444 |
|
Thurallor-7095 |
label:SetFont(Turbine.UI.Lotro.Font.TrajanPro14); |
445 |
|
Thurallor-7095 |
label:SetForeColor(color); |
446 |
|
Thurallor-7095 |
label:SetMarkupEnabled(true); |
447 |
|
Thurallor-7095 |
label:SetText(text); |
448 |
|
Thurallor-7095 |
function button.MouseClick() |
449 |
|
Thurallor-7095 |
if (button.expanded) then |
450 |
|
Thurallor-7095 |
button:SetBackground(resources.Icon.Expand); |
451 |
|
Thurallor-7095 |
button.expanded = false; |
452 |
|
Thurallor-7095 |
DoCallbacks(button, "ExpandedChanged", false); |
453 |
|
Thurallor-7095 |
else |
454 |
|
Thurallor-7095 |
button:SetBackground(resources.Icon.Collapse); |
455 |
|
Thurallor-7095 |
button.expanded = true; |
456 |
|
Thurallor-7095 |
DoCallbacks(button, "ExpandedChanged", true); |
457 |
|
Thurallor-7095 |
end |
458 |
|
Thurallor-7095 |
end |
459 |
|
Thurallor-7095 |
label.MouseClick = button.MouseClick; |
460 |
|
Thurallor-7095 |
button.expanded = not expanded; |
461 |
|
Thurallor-7095 |
button:MouseClick(); |
462 |
|
Thurallor-7095 |
return top, button; |
463 |
|
Thurallor-7095 |
end |
464 |
6 |
Thurallor-7095 |
|
465 |
2 |
Thurallor-7095 |
-- Draw the caption |
466 |
|
Thurallor-7095 |
local top = 54; |
467 |
|
Thurallor-7095 |
if (info.class == "Turbine.UI.Lotro.Quickslot") then |
468 |
|
Thurallor-7095 |
top = AddLabel(top, L:GetText("/SequenceEditor/StandardQuickslot"), Turbine.UI.Color.PaleGoldenrod); |
469 |
135 |
Thurallor-7095 |
elseif ((info.class == "Turbine.UI.Control") or (info.class == "Turbine.UI.Lotro.EntityControl")) then |
470 |
2 |
Thurallor-7095 |
top = AddLabel(top, L:GetText("/SequenceEditor/SpecialSlot") .. ":", Turbine.UI.Color.PaleGoldenrod); |
471 |
32 |
Thurallor-7095 |
local label; |
472 |
|
Thurallor-7095 |
top, label = AddLabel(top, info.toolTip, Turbine.UI.Color.PaleGoldenrod); |
473 |
|
Thurallor-7095 |
-- Some German strings need line wrapping here. |
474 |
|
Thurallor-7095 |
label:SetHeight(32); |
475 |
|
Thurallor-7095 |
label:SetTextAlignment(Turbine.UI.ContentAlignment.TopCenter); |
476 |
2 |
Thurallor-7095 |
end |
477 |
|
Thurallor-7095 |
|
478 |
|
Thurallor-7095 |
-- Draw the arguments |
479 |
|
Thurallor-7095 |
if (info.class == "Turbine.UI.Lotro.Quickslot") then |
480 |
|
Thurallor-7095 |
for key, value in pairs(Turbine.UI.Lotro.ShortcutType) do |
481 |
|
Thurallor-7095 |
if (info.type == value) then |
482 |
|
Thurallor-7095 |
top = AddLabel(top, L:GetText("/SequenceEditor/ShortcutType") .. ": " .. L:GetText("/SequenceEditor/ShortcutTypes/" .. key), Turbine.UI.Color.Goldenrod); |
483 |
|
Thurallor-7095 |
break; |
484 |
|
Thurallor-7095 |
end |
485 |
|
Thurallor-7095 |
end |
486 |
7 |
Thurallor-7095 |
|
487 |
|
Thurallor-7095 |
if (info.type == Turbine.UI.Lotro.ShortcutType.Alias) then |
488 |
|
Thurallor-7095 |
-- Allow the user to specify the command |
489 |
178 |
Thurallor-7095 |
top = AddHorizontalLine(top); |
490 |
7 |
Thurallor-7095 |
top = AddLabel(top, L:GetText("/SequenceEditor/ChatCommand") .. ":", Turbine.UI.Color.Goldenrod); |
491 |
|
Thurallor-7095 |
local textBox; |
492 |
|
Thurallor-7095 |
top, textBox = AddTextBox(top, info.Data, Turbine.UI.Color.White); |
493 |
|
Thurallor-7095 |
textBox.TextChanged = function(sender, args) |
494 |
|
Thurallor-7095 |
local text = sender:GetText(); |
495 |
|
Thurallor-7095 |
-- Remove carriage returns |
496 |
|
Thurallor-7095 |
local stripped = string.gsub(text, "\n", ""); |
497 |
|
Thurallor-7095 |
if (stripped ~= text) then |
498 |
|
Thurallor-7095 |
sender:SetText(stripped); |
499 |
|
Thurallor-7095 |
text = stripped; |
500 |
|
Thurallor-7095 |
end |
501 |
|
Thurallor-7095 |
info.Data = text; |
502 |
16 |
Thurallor-7095 |
self:UpdateBar(); |
503 |
7 |
Thurallor-7095 |
end |
504 |
20 |
Thurallor-7095 |
elseif (info.type == Turbine.UI.Lotro.ShortcutType.Item) then |
505 |
|
Thurallor-7095 |
local shortcut = Turbine.UI.Lotro.Shortcut(info.type, info.Data); |
506 |
|
Thurallor-7095 |
local item = shortcut:GetItem(); |
507 |
128 |
Thurallor-7095 |
if (pcall(item.GetMaxStackSize, item)) then |
508 |
|
Thurallor-7095 |
if (item:GetMaxStackSize() == 1) then -- equippable |
509 |
|
Thurallor-7095 |
|
510 |
|
Thurallor-7095 |
-- Allow the user to specify immediate advance, or wait-for-equip |
511 |
178 |
Thurallor-7095 |
top = AddHorizontalLine(top); |
512 |
128 |
Thurallor-7095 |
top = AddLabel(top, L:GetText("/SequenceEditor/AdvanceToNextSlot") .. ":", Turbine.UI.Color.Goldenrod); |
513 |
|
Thurallor-7095 |
local button1, button2; |
514 |
|
Thurallor-7095 |
top, button1 = AddRadioButton(top, L:GetText("/SequenceEditor/WithLeftClick"), Turbine.UI.Color.DarkGoldenrod, (not info.advanceEvent)); |
515 |
|
Thurallor-7095 |
top, button2 = AddRadioButton(top, L:GetText("/SequenceEditor/WhenItemEquipped"), Turbine.UI.Color.DarkGoldenrod, info.advanceEvent); |
516 |
|
Thurallor-7095 |
Thurallor.UI.RadioButton.LinkPeers({button1, button2}); |
517 |
|
Thurallor-7095 |
|
518 |
|
Thurallor-7095 |
button1.Clicked = function() |
519 |
|
Thurallor-7095 |
info.advanceEvent = nil; |
520 |
|
Thurallor-7095 |
self:UpdateBar(); |
521 |
|
Thurallor-7095 |
end |
522 |
|
Thurallor-7095 |
button2.Clicked = function() |
523 |
|
Thurallor-7095 |
info.advanceEvent = "ItemEquipped"; |
524 |
|
Thurallor-7095 |
self:UpdateBar(); |
525 |
|
Thurallor-7095 |
end |
526 |
20 |
Thurallor-7095 |
end |
527 |
128 |
Thurallor-7095 |
-- else "invalid entity" -- probably an item that no longer exists in your inventory |
528 |
20 |
Thurallor-7095 |
end |
529 |
143 |
Thurallor-7095 |
elseif (info.type == Turbine.UI.Lotro.ShortcutType.Skill) then |
530 |
182 |
Thurallor-7095 |
-- Allow the user to specify immediate advance, or wait-for-execute |
531 |
|
Thurallor-7095 |
top = AddHorizontalLine(top); |
532 |
|
Thurallor-7095 |
top = AddLabel(top, L:GetText("/SequenceEditor/AdvanceToNextSlot") .. ":", Turbine.UI.Color.Goldenrod); |
533 |
143 |
Thurallor-7095 |
local skillName = self.selectedIcon:GetSkillName(); |
534 |
|
Thurallor-7095 |
if (skillName) then |
535 |
|
Thurallor-7095 |
local button1, button2; |
536 |
|
Thurallor-7095 |
top, button1 = AddRadioButton(top, L:GetText("/SequenceEditor/WithLeftClick"), Turbine.UI.Color.DarkGoldenrod, (not info.advanceEvent)); |
537 |
|
Thurallor-7095 |
top, button2 = AddRadioButton(top, L:GetText("/SequenceEditor/WhenSkillExecuted"), Turbine.UI.Color.DarkGoldenrod, info.advanceEvent); |
538 |
|
Thurallor-7095 |
Thurallor.UI.RadioButton.LinkPeers({button1, button2}); |
539 |
154 |
Thurallor-7095 |
if (button2:IsChecked()) then |
540 |
|
Thurallor-7095 |
top, checkBox = AddCheckBox(top, L:GetText("/SequenceEditor/UseAlternateDetectMethod"), Turbine.UI.Color.DarkGoldenrod, info.executeDetectByChat); |
541 |
|
Thurallor-7095 |
checkBox:SetLeft(16); -- indent |
542 |
|
Thurallor-7095 |
checkBox:SetSize(checkBox:GetWidth() - 16, 28); |
543 |
|
Thurallor-7095 |
top = top + 8; |
544 |
|
Thurallor-7095 |
checkBox.CheckedChanged = function(cb) |
545 |
|
Thurallor-7095 |
info.executeDetectByChat = cb:IsChecked(); |
546 |
|
Thurallor-7095 |
self:UpdateBar(); |
547 |
|
Thurallor-7095 |
end |
548 |
|
Thurallor-7095 |
end |
549 |
|
Thurallor-7095 |
|
550 |
143 |
Thurallor-7095 |
button1.Clicked = function() |
551 |
|
Thurallor-7095 |
info.advanceEvent = nil; |
552 |
154 |
Thurallor-7095 |
self:DisplaySlot(self.selectedSlot); |
553 |
143 |
Thurallor-7095 |
self:UpdateBar(); |
554 |
|
Thurallor-7095 |
end |
555 |
|
Thurallor-7095 |
button2.Clicked = function() |
556 |
|
Thurallor-7095 |
info.advanceEvent = "SkillExecuted"; |
557 |
154 |
Thurallor-7095 |
self:DisplaySlot(self.selectedSlot); |
558 |
143 |
Thurallor-7095 |
self:UpdateBar(); |
559 |
|
Thurallor-7095 |
end |
560 |
182 |
Thurallor-7095 |
-- else this skill isn't in moebius92's SkillData database |
561 |
143 |
Thurallor-7095 |
end |
562 |
7 |
Thurallor-7095 |
end |
563 |
|
Thurallor-7095 |
|
564 |
135 |
Thurallor-7095 |
elseif (info.class == "Turbine.UI.Lotro.EntityControl") then |
565 |
|
Thurallor-7095 |
if (info.type == "SelectTarget") then |
566 |
|
Thurallor-7095 |
|
567 |
|
Thurallor-7095 |
local getTargetFuncs = { |
568 |
157 |
Thurallor-7095 |
-- args are: watcher, localPlayer, info.raidMemberName, info.number |
569 |
135 |
Thurallor-7095 |
["Self"] = "local _, player = ...; return player;"; |
570 |
136 |
Thurallor-7095 |
["CurrentTarget"] = "local watcher = ...; return watcher:GetPlayerTarget();"; |
571 |
|
Thurallor-7095 |
["CurrentTargetsTarget"] = "local watcher = ...; return watcher:GetTargetsTarget();"; |
572 |
135 |
Thurallor-7095 |
["Pet"] = "local _, player = ...; return player:GetPet();"; |
573 |
164 |
Thurallor-7095 |
["RaidLeader"] = "local watcher = ...; local party = watcher.GetParty(); return (party and party:GetLeader());"; |
574 |
135 |
Thurallor-7095 |
["RaidMemberByName"] = "local watcher, _, name = ...; return watcher.GetPartyMemberByName(name, true);"; |
575 |
|
Thurallor-7095 |
["NextRaidMember"] = "local watcher = ...; return watcher.GetNextPartyMember();"; |
576 |
|
Thurallor-7095 |
["FirstAssistee"] = "local watcher = ...; return watcher.GetPartyAssistTarget(1);"; |
577 |
|
Thurallor-7095 |
["SecondAssistee"] = "local watcher = ...; return watcher.GetPartyAssistTarget(2);"; |
578 |
|
Thurallor-7095 |
["ThirdAssistee"] = "local watcher = ...; return watcher.GetPartyAssistTarget(3);"; |
579 |
|
Thurallor-7095 |
["FourthAssistee"] = "local watcher = ...; return watcher.GetPartyAssistTarget(4);"; |
580 |
|
Thurallor-7095 |
["NextAssistee"] = "local watcher = ...; return watcher.GetNextAssistTarget();"; |
581 |
|
Thurallor-7095 |
["FirstAssisteesTarget"] = "local watcher = ...; local target = watcher.GetPartyAssistTarget(1); return (target and target:GetTarget());"; |
582 |
|
Thurallor-7095 |
["SecondAssisteesTarget"] = "local watcher = ...; local target = watcher.GetPartyAssistTarget(2); return (target and target:GetTarget());"; |
583 |
|
Thurallor-7095 |
["ThirdAssisteesTarget"] = "local watcher = ...; local target = watcher.GetPartyAssistTarget(3); return (target and target:GetTarget());"; |
584 |
|
Thurallor-7095 |
["FourthAssisteesTarget"] = "local watcher = ...; local target = watcher.GetPartyAssistTarget(4); return (target and target:GetTarget());"; |
585 |
|
Thurallor-7095 |
["NextAssisteesTarget"] = "local watcher = ...; local target = watcher.GetNextAssistTarget(); return (target and target:GetTarget());"; |
586 |
157 |
Thurallor-7095 |
["SavedTarget"] = "local watcher, _, _, number = ...; return watcher.GetSavedTarget(number);"; |
587 |
135 |
Thurallor-7095 |
}; |
588 |
|
Thurallor-7095 |
|
589 |
|
Thurallor-7095 |
-- Allow the user to choose the target category |
590 |
178 |
Thurallor-7095 |
top = AddHorizontalLine(top); |
591 |
135 |
Thurallor-7095 |
top = AddLabel(top, L:GetText("/SequenceEditor/Target") .. ":", Turbine.UI.Color.Goldenrod); |
592 |
|
Thurallor-7095 |
|
593 |
|
Thurallor-7095 |
local currentItem = info.target; |
594 |
|
Thurallor-7095 |
info.getTargetFunc = getTargetFuncs[currentItem]; |
595 |
|
Thurallor-7095 |
local prevContext; |
596 |
|
Thurallor-7095 |
prevContext = L:SetContext("/SequenceEditor/TargetMenu"); |
597 |
|
Thurallor-7095 |
local targs, localTargs = L:GetItems(), {}; |
598 |
|
Thurallor-7095 |
for targ in values(targs) do |
599 |
|
Thurallor-7095 |
table.insert(localTargs, L:GetText(targ)); |
600 |
|
Thurallor-7095 |
end |
601 |
|
Thurallor-7095 |
table.sort(localTargs); |
602 |
|
Thurallor-7095 |
local dropDown; |
603 |
|
Thurallor-7095 |
top, dropDown = AddDropDown(top, localTargs, L:GetText(currentItem)); |
604 |
|
Thurallor-7095 |
dropDown:SetAlignment(Turbine.UI.ContentAlignment.MiddleLeft); |
605 |
|
Thurallor-7095 |
dropDown:SetExpandedWidth(math.max(220, slotTabCardWidth - 20)); |
606 |
|
Thurallor-7095 |
dropDown.ItemChanged = function(sender, args) |
607 |
|
Thurallor-7095 |
for targ in values(targs) do |
608 |
|
Thurallor-7095 |
if (L:GetText(targ) == args.Text) then |
609 |
|
Thurallor-7095 |
info.target = targ; |
610 |
|
Thurallor-7095 |
self:DisplaySlot(self.selectedSlot); |
611 |
|
Thurallor-7095 |
self:UpdateBar(); |
612 |
|
Thurallor-7095 |
break; |
613 |
|
Thurallor-7095 |
end |
614 |
|
Thurallor-7095 |
end |
615 |
|
Thurallor-7095 |
end |
616 |
|
Thurallor-7095 |
|
617 |
|
Thurallor-7095 |
-- If "Raid Member" is chosen, allow the user to select raid member by name |
618 |
|
Thurallor-7095 |
if (info.target == "RaidMemberByName") then |
619 |
157 |
Thurallor-7095 |
info.raidMemberName = info.raidMemberName or ""; |
620 |
|
Thurallor-7095 |
|
621 |
135 |
Thurallor-7095 |
local textBox; |
622 |
|
Thurallor-7095 |
top, textBox = AddTextBox(top, info.raidMemberName, Turbine.UI.Color.White); |
623 |
|
Thurallor-7095 |
textBox.TextChanged = function(sender, args) |
624 |
|
Thurallor-7095 |
local text = sender:GetText(); |
625 |
|
Thurallor-7095 |
-- Remove carriage returns |
626 |
|
Thurallor-7095 |
local stripped = string.gsub(text, "\n", ""); |
627 |
|
Thurallor-7095 |
if (stripped ~= text) then |
628 |
|
Thurallor-7095 |
sender:SetText(stripped); |
629 |
|
Thurallor-7095 |
text = stripped; |
630 |
|
Thurallor-7095 |
end |
631 |
|
Thurallor-7095 |
info.raidMemberName = text; |
632 |
|
Thurallor-7095 |
self:UpdateBar(); |
633 |
|
Thurallor-7095 |
end |
634 |
157 |
Thurallor-7095 |
|
635 |
|
Thurallor-7095 |
-- Allow the user to easily select the currently-targeted raid member, if not already selected |
636 |
|
Thurallor-7095 |
local selectedMember = Thurallor.Utils.Watcher.TargetIsPartyMember(); |
637 |
|
Thurallor-7095 |
local selectedMemberName = selectedMember and selectedMember:GetName(); |
638 |
|
Thurallor-7095 |
if (selectedMemberName and (selectedMemberName:lower() ~= info.raidMemberName:lower())) then |
639 |
|
Thurallor-7095 |
top = textBox:GetTop(); |
640 |
|
Thurallor-7095 |
local button1, button2; |
641 |
|
Thurallor-7095 |
top, button1 = AddRadioButton(top, selectedMemberName, Turbine.UI.Color.DarkGoldenrod); |
642 |
|
Thurallor-7095 |
_, button2 = AddRadioButton(top, "", Turbine.UI.Color.DarkGoldenrod, true); |
643 |
|
Thurallor-7095 |
function button1.Clicked() |
644 |
|
Thurallor-7095 |
info.raidMemberName = selectedMemberName; |
645 |
|
Thurallor-7095 |
self:UpdateBar(); |
646 |
|
Thurallor-7095 |
end |
647 |
|
Thurallor-7095 |
|
648 |
|
Thurallor-7095 |
Thurallor.UI.RadioButton.LinkPeers({button1, button2}); |
649 |
|
Thurallor-7095 |
textBox:SetZOrder(1); |
650 |
|
Thurallor-7095 |
textBox:SetTop(button2:GetTop()); |
651 |
|
Thurallor-7095 |
textBox:SetLeft(12); |
652 |
|
Thurallor-7095 |
textBox:SetWidth(textBox:GetWidth() - 12); |
653 |
|
Thurallor-7095 |
function textBox.FocusGained() |
654 |
|
Thurallor-7095 |
button2:MouseClick(); |
655 |
|
Thurallor-7095 |
textBox:TextChanged(); |
656 |
|
Thurallor-7095 |
end |
657 |
|
Thurallor-7095 |
top = top + textBox:GetHeight(); |
658 |
|
Thurallor-7095 |
end |
659 |
|
Thurallor-7095 |
|
660 |
|
Thurallor-7095 |
-- If "Saved target" is chosen, allow the user to select saved target number |
661 |
|
Thurallor-7095 |
elseif (info.target == "SavedTarget") then |
662 |
|
Thurallor-7095 |
info.number = info.number or 1; |
663 |
|
Thurallor-7095 |
|
664 |
|
Thurallor-7095 |
local numbers = {}; |
665 |
|
Thurallor-7095 |
for n = 1, 10 do |
666 |
|
Thurallor-7095 |
table.insert(numbers, tostring(n)); |
667 |
|
Thurallor-7095 |
end |
668 |
|
Thurallor-7095 |
local dropDown; |
669 |
|
Thurallor-7095 |
top, dropDown = AddDropDown(top, numbers, tostring(info.number)); |
670 |
|
Thurallor-7095 |
dropDown:SetWidth(40); |
671 |
|
Thurallor-7095 |
dropDown:SetLeft(math.floor((slotTabCardWidth - 20) / 2) - 20); |
672 |
|
Thurallor-7095 |
dropDown.ItemChanged = function(sender, args) |
673 |
|
Thurallor-7095 |
info.number = tonumber(args.Text); |
674 |
|
Thurallor-7095 |
self:UpdateBar(); |
675 |
|
Thurallor-7095 |
end |
676 |
135 |
Thurallor-7095 |
end |
677 |
|
Thurallor-7095 |
|
678 |
|
Thurallor-7095 |
-- Evaluate the target selection and display the name of the targeted entity |
679 |
159 |
Thurallor-7095 |
top, self.targetLabel = AddLabel(top, "", Turbine.UI.Color.Goldenrod); |
680 |
|
Thurallor-7095 |
self.targetLabel.Update = function(obj) |
681 |
157 |
Thurallor-7095 |
local entity = loadstring(info.getTargetFunc)(self.manager.watcher, self.manager.player, info.raidMemberName, info.number); |
682 |
135 |
Thurallor-7095 |
if (entity) then |
683 |
157 |
Thurallor-7095 |
obj:SetText("(" .. entity:GetName() .. ")"); |
684 |
|
Thurallor-7095 |
obj:SetForeColor(Turbine.UI.Color.Lime); |
685 |
135 |
Thurallor-7095 |
else |
686 |
157 |
Thurallor-7095 |
obj:SetText(L:GetText("/SequenceEditor/NoTarget")); |
687 |
|
Thurallor-7095 |
obj:SetForeColor(Turbine.UI.Color.Red); |
688 |
135 |
Thurallor-7095 |
end |
689 |
|
Thurallor-7095 |
end |
690 |
159 |
Thurallor-7095 |
self.targetLabel:SetWantsUpdates(true); |
691 |
135 |
Thurallor-7095 |
end |
692 |
178 |
Thurallor-7095 |
|
693 |
|
Thurallor-7095 |
top = AddHorizontalLine(top); |
694 |
|
Thurallor-7095 |
top = AddLabel(top, L:GetText("/SequenceEditor/AdvanceToNextSlot") .. ":", Turbine.UI.Color.Goldenrod); |
695 |
135 |
Thurallor-7095 |
|
696 |
2 |
Thurallor-7095 |
elseif (info.class == "Turbine.UI.Control") then |
697 |
34 |
Thurallor-7095 |
if (info.type == "Delay") then |
698 |
|
Thurallor-7095 |
|
699 |
|
Thurallor-7095 |
-- Allow the user to specify the delay period |
700 |
178 |
Thurallor-7095 |
top = AddHorizontalLine(top); |
701 |
34 |
Thurallor-7095 |
top = AddLabel(top, L:GetText("/SequenceEditor/DelayPeriod") .. ":", Turbine.UI.Color.Goldenrod); |
702 |
|
Thurallor-7095 |
local textBox; |
703 |
|
Thurallor-7095 |
_, textBox = AddTextBox(top, info.delay, Turbine.UI.Color.White); |
704 |
|
Thurallor-7095 |
textBox:SetTextAlignment(Turbine.UI.ContentAlignment.MiddleRight); |
705 |
35 |
Thurallor-7095 |
local center = math.floor((slotTabCardWidth - 20) / 2); |
706 |
34 |
Thurallor-7095 |
textBox:SetWidth(50); |
707 |
|
Thurallor-7095 |
textBox:SetLeft(center - 2 - 50); |
708 |
|
Thurallor-7095 |
top, label = AddLabel(top + 2, L:GetText("/SequenceEditor/Seconds"), Turbine.UI.Color.DarkGoldenrod); |
709 |
|
Thurallor-7095 |
label:SetLeft(center + 2); |
710 |
|
Thurallor-7095 |
label:SetTextAlignment(Turbine.UI.ContentAlignment.MiddleLeft); |
711 |
|
Thurallor-7095 |
textBox.TextChanged = function(sender, args) |
712 |
|
Thurallor-7095 |
info.delay = tonumber(sender:GetText()); |
713 |
147 |
Thurallor-7095 |
info.action = "local item, s = ...; item.bar:StartSlotCooldown(s, " .. tostring(info.delay):gsub(",", ".") .. ");"; |
714 |
34 |
Thurallor-7095 |
self:UpdateBar(); |
715 |
|
Thurallor-7095 |
end |
716 |
157 |
Thurallor-7095 |
elseif (info.type == "SaveTarget") then |
717 |
|
Thurallor-7095 |
|
718 |
|
Thurallor-7095 |
-- Allow the user to specify the target number |
719 |
178 |
Thurallor-7095 |
top = AddHorizontalLine(top); |
720 |
157 |
Thurallor-7095 |
top = AddLabel(top, L:GetText("/SequenceEditor/TargetNumber") .. ":", Turbine.UI.Color.Goldenrod); |
721 |
|
Thurallor-7095 |
|
722 |
|
Thurallor-7095 |
local numbers = {}; |
723 |
|
Thurallor-7095 |
for n = 1, 10 do |
724 |
|
Thurallor-7095 |
table.insert(numbers, tostring(n)); |
725 |
|
Thurallor-7095 |
end |
726 |
|
Thurallor-7095 |
local dropDown; |
727 |
|
Thurallor-7095 |
top, dropDown = AddDropDown(top, numbers, tostring(info.number)); |
728 |
|
Thurallor-7095 |
dropDown:SetWidth(40); |
729 |
|
Thurallor-7095 |
dropDown:SetLeft(math.floor((slotTabCardWidth - 20) / 2) - 20); |
730 |
|
Thurallor-7095 |
dropDown.ItemChanged = function(sender, args) |
731 |
|
Thurallor-7095 |
info.number = tonumber(args.Text); |
732 |
|
Thurallor-7095 |
info.action = "Thurallor.Utils.Watcher.SaveTarget(" .. info.number .. ");"; |
733 |
|
Thurallor-7095 |
self:UpdateBar(); |
734 |
|
Thurallor-7095 |
end |
735 |
159 |
Thurallor-7095 |
|
736 |
|
Thurallor-7095 |
top = top + 16; -- skip a line |
737 |
|
Thurallor-7095 |
_, label = AddLabel(top, L:GetText("/SequenceEditor/SaveTargetWarning"), Turbine.UI.Color.Silver); |
738 |
|
Thurallor-7095 |
label:SetTextAlignment(Turbine.UI.ContentAlignment.LeftCenter); |
739 |
|
Thurallor-7095 |
label:SetHeight(14 * L:GetText("/SequenceEditor/SaveTargetWarningHeight")); |
740 |
|
Thurallor-7095 |
top = top + label:GetHeight(); |
741 |
|
Thurallor-7095 |
|
742 |
34 |
Thurallor-7095 |
elseif (info.type == "GenerateEvent") then |
743 |
6 |
Thurallor-7095 |
|
744 |
|
Thurallor-7095 |
-- Allow the user to specify the event name |
745 |
178 |
Thurallor-7095 |
top = AddHorizontalLine(top); |
746 |
6 |
Thurallor-7095 |
top = AddLabel(top, L:GetText("/SequenceEditor/EventName") .. ":", Turbine.UI.Color.Goldenrod); |
747 |
2 |
Thurallor-7095 |
local textBox; |
748 |
|
Thurallor-7095 |
top, textBox = AddTextBox(top, info.eventName, Turbine.UI.Color.White); |
749 |
|
Thurallor-7095 |
textBox.TextChanged = function(sender, args) |
750 |
5 |
Thurallor-7095 |
local text = sender:GetText(); |
751 |
|
Thurallor-7095 |
-- Remove carriage returns |
752 |
|
Thurallor-7095 |
local stripped = string.gsub(text, "\n", ""); |
753 |
|
Thurallor-7095 |
if (stripped ~= text) then |
754 |
|
Thurallor-7095 |
sender:SetText(stripped); |
755 |
|
Thurallor-7095 |
text = stripped; |
756 |
|
Thurallor-7095 |
end |
757 |
|
Thurallor-7095 |
info.eventName = text; |
758 |
177 |
Thurallor-7095 |
self:UpdateBar(true); |
759 |
2 |
Thurallor-7095 |
end |
760 |
6 |
Thurallor-7095 |
elseif (info.type == "SetUnequipDestination") then |
761 |
|
Thurallor-7095 |
|
762 |
20 |
Thurallor-7095 |
-- Temporary method to allow users to discover bag slot numbers. |
763 |
|
Thurallor-7095 |
self.ItemMovedCallback = function(sender, args) |
764 |
|
Thurallor-7095 |
local str = L:GetText("/ItemMoved"); |
765 |
|
Thurallor-7095 |
str = string.gsub(str, "<source>", tostring(args.OldIndex)); |
766 |
|
Thurallor-7095 |
str = string.gsub(str, "<destination>", tostring(args.NewIndex)); |
767 |
|
Thurallor-7095 |
Puts(str); |
768 |
|
Thurallor-7095 |
end |
769 |
|
Thurallor-7095 |
AddCallback(Thurallor.Utils.Watcher, "ItemMoved", self.ItemMovedCallback); |
770 |
|
Thurallor-7095 |
|
771 |
6 |
Thurallor-7095 |
-- Allow the user to specify the desired bag slot |
772 |
178 |
Thurallor-7095 |
top = AddHorizontalLine(top); |
773 |
6 |
Thurallor-7095 |
top = AddLabel(top, L:GetText("/SequenceEditor/PreferredBagSlot") .. ":", Turbine.UI.Color.Goldenrod); |
774 |
|
Thurallor-7095 |
|
775 |
114 |
Thurallor-7095 |
top, textBox = AddTextBox(top, tostring(info.bagSlot), Turbine.UI.Color.White); |
776 |
|
Thurallor-7095 |
textBox:SetFont(Turbine.UI.Lotro.Font.Verdana14); |
777 |
|
Thurallor-7095 |
textBox.TextChanged = function(sender, args) |
778 |
|
Thurallor-7095 |
local series = Thurallor.Utils.Series(sender:GetText()) |
779 |
|
Thurallor-7095 |
info.bagSlot = series:tostring(); |
780 |
16 |
Thurallor-7095 |
self:UpdateBar(); |
781 |
6 |
Thurallor-7095 |
end |
782 |
|
Thurallor-7095 |
elseif (string.match(info.type, "^Remove ")) then |
783 |
|
Thurallor-7095 |
|
784 |
|
Thurallor-7095 |
-- Allow the user to edit choose the item to be unequipped |
785 |
178 |
Thurallor-7095 |
top = AddHorizontalLine(top); |
786 |
6 |
Thurallor-7095 |
top = AddLabel(top, L:GetText("/SequenceEditor/EquipmentType") .. ":", Turbine.UI.Color.Goldenrod); |
787 |
|
Thurallor-7095 |
|
788 |
|
Thurallor-7095 |
local currentItem = string.sub(info.type, 8); |
789 |
|
Thurallor-7095 |
local prevContext = L:SetContext("/SequenceEditor/EquipmentSlots"); |
790 |
|
Thurallor-7095 |
local eqSlots, localEqSlots = L:GetItems(), {}; |
791 |
|
Thurallor-7095 |
for slot in values(eqSlots) do |
792 |
|
Thurallor-7095 |
table.insert(localEqSlots, L:GetText(slot)); |
793 |
|
Thurallor-7095 |
end |
794 |
|
Thurallor-7095 |
table.sort(localEqSlots); |
795 |
|
Thurallor-7095 |
local dropDown; |
796 |
16 |
Thurallor-7095 |
top, dropDown = AddDropDown(top, localEqSlots, L:GetText(currentItem)); |
797 |
122 |
Thurallor-7095 |
dropDown:SetExpandedWidth(math.max(220, slotTabCardWidth - 20)); |
798 |
6 |
Thurallor-7095 |
dropDown.ItemChanged = function(sender, args) |
799 |
|
Thurallor-7095 |
for slot in values(eqSlots) do |
800 |
|
Thurallor-7095 |
if (L:GetText(slot) == args.Text) then |
801 |
122 |
Thurallor-7095 |
self:DeleteSlot(s); |
802 |
6 |
Thurallor-7095 |
self:CreateRemovalSlot(s, slot, info.bagSlot); |
803 |
|
Thurallor-7095 |
break; |
804 |
|
Thurallor-7095 |
end |
805 |
|
Thurallor-7095 |
end |
806 |
|
Thurallor-7095 |
end |
807 |
16 |
Thurallor-7095 |
elseif (info.type == "If") then |
808 |
|
Thurallor-7095 |
|
809 |
|
Thurallor-7095 |
-- Allow the user to specify the conditional expression |
810 |
178 |
Thurallor-7095 |
top = AddHorizontalLine(top); |
811 |
16 |
Thurallor-7095 |
top = AddLabel(top, L:GetText("/SequenceEditor/Condition") .. ":", Turbine.UI.Color.Goldenrod); |
812 |
|
Thurallor-7095 |
|
813 |
|
Thurallor-7095 |
local prevContext = L:SetContext("/SequenceEditor/ConditionTypes"); |
814 |
|
Thurallor-7095 |
local condInfo = { |
815 |
20 |
Thurallor-7095 |
["Always"] = { expr = "return true;" }; |
816 |
|
Thurallor-7095 |
["Never"] = { expr = "return false;" }; |
817 |
165 |
Thurallor-7095 |
["Random"] = { arg = "x"; |
818 |
|
Thurallor-7095 |
expr = "return (math.random() < (<x> / 100));" }; |
819 |
43 |
Thurallor-7095 |
["SkillReady"] = { arg = "skillName"; |
820 |
|
Thurallor-7095 |
expr = "return (Thurallor.Utils.Watcher.SkillReady(<skillName>));" }; |
821 |
|
Thurallor-7095 |
["SkillNotReady"] = { arg = "skillName"; |
822 |
|
Thurallor-7095 |
expr = "return (not Thurallor.Utils.Watcher.SkillReady(<skillName>));" }; |
823 |
48 |
Thurallor-7095 |
["SkillUsable"] = { arg = "skillName"; |
824 |
|
Thurallor-7095 |
expr = "return (Thurallor.Utils.Watcher.SkillUsable(<skillName>));" }; |
825 |
|
Thurallor-7095 |
["SkillNotUsable"] = { arg = "skillName"; |
826 |
|
Thurallor-7095 |
expr = "return (not Thurallor.Utils.Watcher.SkillUsable(<skillName>));" }; |
827 |
41 |
Thurallor-7095 |
["SkillTrained"] = { arg = "skillName"; |
828 |
|
Thurallor-7095 |
expr = "return (Thurallor.Utils.Watcher.SkillTrained(<skillName>));" }; |
829 |
|
Thurallor-7095 |
["SkillNotTrained"] = { arg = "skillName"; |
830 |
|
Thurallor-7095 |
expr = "return (not Thurallor.Utils.Watcher.SkillTrained(<skillName>));" }; |
831 |
20 |
Thurallor-7095 |
["PlayerEffectDisease"] = { expr = "return Thurallor.Utils.Watcher.PlayerHasEffectCategory(Turbine.Gameplay.EffectCategory.Disease);" }; |
832 |
158 |
Thurallor-7095 |
["PlayerEffectDiseaseCurable"] = { expr = "return Thurallor.Utils.Watcher.PlayerHasEffectCategory(Turbine.Gameplay.EffectCategory.Disease, true);" }; |
833 |
20 |
Thurallor-7095 |
["PlayerEffectFear"] = { expr = "return Thurallor.Utils.Watcher.PlayerHasEffectCategory(Turbine.Gameplay.EffectCategory.Fear);" }; |
834 |
158 |
Thurallor-7095 |
["PlayerEffectFearCurable"] = { expr = "return Thurallor.Utils.Watcher.PlayerHasEffectCategory(Turbine.Gameplay.EffectCategory.Fear, true);" }; |
835 |
20 |
Thurallor-7095 |
["PlayerEffectPoison"] = { expr = "return Thurallor.Utils.Watcher.PlayerHasEffectCategory(Turbine.Gameplay.EffectCategory.Poison);" }; |
836 |
158 |
Thurallor-7095 |
["PlayerEffectPoisonCurable"] = { expr = "return Thurallor.Utils.Watcher.PlayerHasEffectCategory(Turbine.Gameplay.EffectCategory.Poison, true);" }; |
837 |
20 |
Thurallor-7095 |
["PlayerEffectWound"] = { expr = "return Thurallor.Utils.Watcher.PlayerHasEffectCategory(Turbine.Gameplay.EffectCategory.Wound);" }; |
838 |
163 |
Thurallor-7095 |
["PlayerEffectWoundCurable"] = { expr = "return Thurallor.Utils.Watcher.PlayerHasEffectCategory(Turbine.Gameplay.EffectCategory.Wound, true);" }; |
839 |
20 |
Thurallor-7095 |
["PlayerEffectOther"] = { arg = "effect"; |
840 |
|
Thurallor-7095 |
expr = "return Thurallor.Utils.Watcher.PlayerHasEffect(<effect>);" }; |
841 |
|
Thurallor-7095 |
["NotPlayerEffectOther"] = { arg = "effect"; |
842 |
|
Thurallor-7095 |
expr = "return (not Thurallor.Utils.Watcher.PlayerHasEffect(<effect>));" }; |
843 |
163 |
Thurallor-7095 |
["TargetEffectDisease"] = { expr = "return Thurallor.Utils.Watcher.TargetHasEffectCategory(Turbine.Gameplay.EffectCategory.Disease);" }; |
844 |
|
Thurallor-7095 |
["TargetEffectFear"] = { expr = "return Thurallor.Utils.Watcher.TargetHasEffectCategory(Turbine.Gameplay.EffectCategory.Fear);" }; |
845 |
|
Thurallor-7095 |
["TargetEffectPoison"] = { expr = "return Thurallor.Utils.Watcher.TargetHasEffectCategory(Turbine.Gameplay.EffectCategory.Poison);" }; |
846 |
|
Thurallor-7095 |
["TargetEffectWound"] = { expr = "return Thurallor.Utils.Watcher.TargetHasEffectCategory(Turbine.Gameplay.EffectCategory.Wound);" }; |
847 |
|
Thurallor-7095 |
["TargetEffectOther"] = { arg = "effect"; |
848 |
|
Thurallor-7095 |
expr = "return Thurallor.Utils.Watcher.TargetHasEffect(<effect>);" }; |
849 |
|
Thurallor-7095 |
["NotTargetEffectOther"] = { arg = "effect"; |
850 |
|
Thurallor-7095 |
expr = "return (not Thurallor.Utils.Watcher.TargetHasEffect(<effect>));" }; |
851 |
111 |
Thurallor-7095 |
["PlayerInCombat"] = { expr = "local _, player = ...; return player:IsInCombat();" }; |
852 |
|
Thurallor-7095 |
["PlayerOutOfCombat"] = { expr = "local _, player = ...; return not player:IsInCombat();" }; |
853 |
20 |
Thurallor-7095 |
["PlayerMorale < x"] = { arg = "x"; |
854 |
|
Thurallor-7095 |
expr = "local _, player = ...; return (player:GetMorale() < <x>)" }; |
855 |
|
Thurallor-7095 |
["PlayerMorale < x%"] = { arg = "x"; |
856 |
|
Thurallor-7095 |
expr = "local _, player = ...; return (player:GetMorale() < player:GetBaseMaxMorale() * <x> / 100)" }; |
857 |
|
Thurallor-7095 |
["PlayerMorale > x"] = { arg = "x"; |
858 |
|
Thurallor-7095 |
expr = "local _, player = ...; return (player:GetMorale() > <x>)" }; |
859 |
|
Thurallor-7095 |
["PlayerMorale > x%"] = { arg = "x"; |
860 |
|
Thurallor-7095 |
expr = "local _, player = ...; return (player:GetMorale() > player:GetBaseMaxMorale() * <x> / 100)" }; |
861 |
140 |
Thurallor-7095 |
["TargetIsFellow"] = { expr = "local _, player = ...; return Thurallor.Utils.Watcher.TargetIsPartyMember();" }; |
862 |
|
Thurallor-7095 |
["TargetNotFellow"] = { expr = "local _, player = ...; return not Thurallor.Utils.Watcher.TargetIsPartyMember();" }; |
863 |
20 |
Thurallor-7095 |
["TargetMorale < x"] = { arg = "x"; |
864 |
117 |
Thurallor-7095 |
expr = "local _, player = ...; local target = player:GetTarget(); return (target and target.GetMorale and (target:GetMorale() < <x>))" }; |
865 |
20 |
Thurallor-7095 |
["TargetMorale < x%"] = { arg = "x"; |
866 |
117 |
Thurallor-7095 |
expr = "local _, player = ...; local target = player:GetTarget(); return (target and target.GetMorale and (target:GetMorale() < target:GetBaseMaxMorale() * <x> / 100))" }; |
867 |
20 |
Thurallor-7095 |
["TargetMorale > x"] = { arg = "x"; |
868 |
117 |
Thurallor-7095 |
expr = "local _, player = ...; local target = player:GetTarget(); return (target and target.GetMorale and (target:GetMorale() > <x>))" }; |
869 |
20 |
Thurallor-7095 |
["TargetMorale > x%"] = { arg = "x"; |
870 |
117 |
Thurallor-7095 |
expr = "local _, player = ...; local target = player:GetTarget(); return (target and target.GetMorale and (target:GetMorale() > target:GetBaseMaxMorale() * <x> / 100))" }; |
871 |
20 |
Thurallor-7095 |
["PlayerPower < x"] = { arg = "x"; |
872 |
|
Thurallor-7095 |
expr = "local _, player = ...; return (player:GetPower() < <x>)" }; |
873 |
|
Thurallor-7095 |
["PlayerPower < x%"] = { arg = "x"; |
874 |
|
Thurallor-7095 |
expr = "local _, player = ...; return (player:GetPower() < player:GetBaseMaxPower() * <x> / 100)" }; |
875 |
|
Thurallor-7095 |
["PlayerPower > x"] = { arg = "x"; |
876 |
|
Thurallor-7095 |
expr = "local _, player = ...; return (player:GetPower() > <x>)" }; |
877 |
|
Thurallor-7095 |
["PlayerPower > x%"] = { arg = "x"; |
878 |
|
Thurallor-7095 |
expr = "local _, player = ...; return (player:GetPower() > player:GetBaseMaxPower() * <x> / 100)" }; |
879 |
|
Thurallor-7095 |
["TargetPower < x"] = { arg = "x"; |
880 |
117 |
Thurallor-7095 |
expr = "local _, player = ...; local target = player:GetTarget(); return (target and target.GetPower and (target:GetPower() < <x>))" }; |
881 |
20 |
Thurallor-7095 |
["TargetPower < x%"] = { arg = "x"; |
882 |
117 |
Thurallor-7095 |
expr = "local _, player = ...; local target = player:GetTarget(); return (target and target.GetPower and (target:GetPower() < target:GetBaseMaxPower() * <x> / 100))" }; |
883 |
20 |
Thurallor-7095 |
["TargetPower > x"] = { arg = "x"; |
884 |
117 |
Thurallor-7095 |
expr = "local _, player = ...; local target = player:GetTarget(); return (target and target.GetPower and (target:GetPower() > <x>))" }; |
885 |
20 |
Thurallor-7095 |
["TargetPower > x%"] = { arg = "x"; |
886 |
117 |
Thurallor-7095 |
expr = "local _, player = ...; local target = player:GetTarget(); return (target and target.GetPower and (target:GetPower() > target:GetBaseMaxPower() * <x> / 100))" }; |
887 |
111 |
Thurallor-7095 |
["ChampionPlayerFervor < x"] = { arg = "x"; |
888 |
|
Thurallor-7095 |
expr = "local _, player = ...; local attribs = player:GetClassAttributes(); return attribs.GetFervor and (attribs:GetFervor() < <x>);" }; |
889 |
|
Thurallor-7095 |
["ChampionPlayerFervor > x"] = { arg = "x"; |
890 |
|
Thurallor-7095 |
expr = "local _, player = ...; local attribs = player:GetClassAttributes(); return attribs.GetFervor and (attribs:GetFervor() > <x>);" }; |
891 |
20 |
Thurallor-7095 |
["BeorningPlayerWrath < x%"] = { arg = "x"; |
892 |
|
Thurallor-7095 |
expr = "local _, player = ...; local attribs = player:GetClassAttributes(); return attribs.GetWrath and (attribs:GetWrath() < <x>);" }; |
893 |
|
Thurallor-7095 |
["BeorningPlayerWrath > x%"] = { arg = "x"; |
894 |
|
Thurallor-7095 |
expr = "local _, player = ...; local attribs = player:GetClassAttributes(); return attribs.GetWrath and (attribs:GetWrath() > <x>);" }; |
895 |
|
Thurallor-7095 |
["BeorningInBearForm"] = { expr = "local _, player = ...; local attribs = player:GetClassAttributes(); return attribs.IsInBearForm and attribs:IsInBearForm();" }; |
896 |
|
Thurallor-7095 |
["BeorningNotInBearForm"] = { expr = "local _, player = ...; local attribs = player:GetClassAttributes(); return attribs.IsInBearForm and (not attribs:IsInBearForm());" }; |
897 |
40 |
Thurallor-7095 |
["HunterFocus < x"] = { arg = "x"; |
898 |
|
Thurallor-7095 |
expr = "local _, player = ...; local attribs = player:GetClassAttributes(); return attribs.GetFocus and (attribs:GetFocus() < <x>);" }; |
899 |
|
Thurallor-7095 |
["HunterFocus > x"] = { arg = "x"; |
900 |
|
Thurallor-7095 |
expr = "local _, player = ...; local attribs = player:GetClassAttributes(); return attribs.GetFocus and (attribs:GetFocus() > <x>);" }; |
901 |
166 |
Thurallor-7095 |
["BrawlerMettle < x"] = { arg = "x"; |
902 |
|
Thurallor-7095 |
expr = "return (Thurallor.Utils.Watcher.GetPlayerMettle() < <x>);" }; |
903 |
|
Thurallor-7095 |
["BrawlerMettle > x"] = { arg = "x"; |
904 |
|
Thurallor-7095 |
expr = "return (Thurallor.Utils.Watcher.GetPlayerMettle() > <x>);" }; |
905 |
124 |
Thurallor-7095 |
["RunekeeperAttunement < x"] = { arg = "x"; |
906 |
|
Thurallor-7095 |
expr = "local _, player = ...; local attribs = player:GetClassAttributes(); return attribs.GetAttunement and (attribs:GetAttunement() < <x>);" }; |
907 |
|
Thurallor-7095 |
["RunekeeperAttunement > x"] = { arg = "x"; |
908 |
|
Thurallor-7095 |
expr = "local _, player = ...; local attribs = player:GetClassAttributes(); return attribs.GetAttunement and (attribs:GetAttunement() > <x>);" }; |
909 |
|
Thurallor-7095 |
["RunekeeperCharged"] = { expr = "local _, player = ...; local attribs = player:GetClassAttributes(); return attribs.IsCharged and attribs:IsCharged();" }; |
910 |
|
Thurallor-7095 |
["RunekeeperNotCharged"] = { expr = "local _, player = ...; local attribs = player:GetClassAttributes(); return attribs.IsCharged and (not attribs:IsCharged());" }; |
911 |
199 |
Thurallor-7095 |
["MountPresent"] = { arg = "mountName"; |
912 |
|
Thurallor-7095 |
expr = "local _, player = ...; local mount, name = player:GetMount(), '<mountName>'; return mount and ((name == '') or (mount:GetName() == name));" }; |
913 |
|
Thurallor-7095 |
["MountAbsent"] = { expr = "local _, player = ...; local mount = player:GetMount(); return (mount == nil)" }; |
914 |
|
Thurallor-7095 |
["PetPresent"] = { arg = "petName"; |
915 |
|
Thurallor-7095 |
expr = "local _, player = ...; local pet, name = player:GetPet(), '<petName>'; return pet and ((name == '') or (pet:GetName() == name));" }; |
916 |
|
Thurallor-7095 |
["PetAbsent"] = { expr = "local _, player = ...; local pet = player:GetPet(); return (pet == nil)" }; |
917 |
20 |
Thurallor-7095 |
["ItemEquipped"] = { arg = { "eqItemName", "eqSlot" }; |
918 |
|
Thurallor-7095 |
expr = "return IsEquipped(<eqItemName>, <eqSlot>);" }; |
919 |
|
Thurallor-7095 |
["ItemNotEquipped"] = { arg = { "eqItemName", "eqSlot" }; |
920 |
|
Thurallor-7095 |
expr = "return (not IsEquipped(<eqItemName>, <eqSlot>));" }; |
921 |
30 |
Thurallor-7095 |
["ItemQuantity > x"] = { arg = { "stackItemName", "x" }; |
922 |
|
Thurallor-7095 |
expr = "return (Thurallor.Utils.Watcher.GetItemQuantity(<stackItemName>) > <x>);" }; |
923 |
|
Thurallor-7095 |
["ItemQuantity < x"] = { arg = { "stackItemName", "x" }; |
924 |
|
Thurallor-7095 |
expr = "return (Thurallor.Utils.Watcher.GetItemQuantity(<stackItemName>) < <x>);" }; |
925 |
111 |
Thurallor-7095 |
["StanceSelected"] = { arg = "stance"; |
926 |
119 |
Thurallor-7095 |
expr = "return (Thurallor.Utils.Watcher.GetStance() == <stance>);" }; |
927 |
20 |
Thurallor-7095 |
["LuaScript"] = { arg = "script"; |
928 |
|
Thurallor-7095 |
expr = "<script>" }; |
929 |
16 |
Thurallor-7095 |
}; |
930 |
|
Thurallor-7095 |
local condNames = {}; |
931 |
|
Thurallor-7095 |
for k in keys(condInfo) do |
932 |
|
Thurallor-7095 |
table.insert(condNames, L:GetText(k)); |
933 |
|
Thurallor-7095 |
end |
934 |
|
Thurallor-7095 |
table.sort(condNames); |
935 |
|
Thurallor-7095 |
|
936 |
20 |
Thurallor-7095 |
local function SwitchArgs(arg) |
937 |
16 |
Thurallor-7095 |
if (not info.condArgs) then |
938 |
|
Thurallor-7095 |
info.condArgs = {}; |
939 |
|
Thurallor-7095 |
end |
940 |
|
Thurallor-7095 |
if (not arg) then |
941 |
|
Thurallor-7095 |
info.condArgs = nil; |
942 |
|
Thurallor-7095 |
elseif ((arg == "x") and not info.condArgs.x) then |
943 |
|
Thurallor-7095 |
info.condArgs = { x = 0 }; |
944 |
41 |
Thurallor-7095 |
elseif ((arg == "skillName") and not info.condArgs.skillName) then |
945 |
|
Thurallor-7095 |
info.condArgs = { skillName = "nil" }; |
946 |
199 |
Thurallor-7095 |
elseif ((arg == "petName") and not info.condArgs.petName) then |
947 |
|
Thurallor-7095 |
local pet = Turbine.Gameplay.LocalPlayer:GetInstance():GetPet(); |
948 |
|
Thurallor-7095 |
local petName = pet and pet:GetName(); |
949 |
|
Thurallor-7095 |
info.condArgs = { petName = (petName or "") }; |
950 |
|
Thurallor-7095 |
elseif ((arg == "mountName") and not info.condArgs.mountName) then |
951 |
|
Thurallor-7095 |
local mount = Turbine.Gameplay.LocalPlayer:GetInstance():GetMount(); |
952 |
|
Thurallor-7095 |
local mountName = mount and mount:GetName(); |
953 |
|
Thurallor-7095 |
info.condArgs = { mountName = (mountName or "") }; |
954 |
16 |
Thurallor-7095 |
elseif ((arg == "skill") and not info.condArgs.skill) then |
955 |
|
Thurallor-7095 |
info.condArgs = { skill = 0 }; |
956 |
20 |
Thurallor-7095 |
elseif ((arg == "effect") and not info.condArgs.effect) then |
957 |
22 |
Thurallor-7095 |
info.condArgs = { effect = "nil" }; |
958 |
111 |
Thurallor-7095 |
elseif ((arg == "stance") and not info.condArgs.stance) then |
959 |
|
Thurallor-7095 |
info.condArgs = { stance = 0 }; |
960 |
16 |
Thurallor-7095 |
elseif ((arg == "script") and not info.condArgs.script) then |
961 |
|
Thurallor-7095 |
if (info.condExpr) then |
962 |
|
Thurallor-7095 |
local script = info.condExpr; |
963 |
|
Thurallor-7095 |
if (info.condArgs) then |
964 |
|
Thurallor-7095 |
for name, value in pairs(info.condArgs) do |
965 |
|
Thurallor-7095 |
script = string.gsub(script, "<" .. name .. ">", tostring(value)); |
966 |
|
Thurallor-7095 |
end |
967 |
|
Thurallor-7095 |
end |
968 |
|
Thurallor-7095 |
info.condArgs = { script = script }; |
969 |
|
Thurallor-7095 |
else |
970 |
|
Thurallor-7095 |
info.condArgs = { script = "return true;" }; |
971 |
|
Thurallor-7095 |
end |
972 |
20 |
Thurallor-7095 |
elseif (type(arg) == "table") then |
973 |
|
Thurallor-7095 |
-- Multiple args |
974 |
|
Thurallor-7095 |
local prevArgs = info.condArgs; |
975 |
|
Thurallor-7095 |
info.condArgs = {}; |
976 |
|
Thurallor-7095 |
for argName in values(arg) do |
977 |
|
Thurallor-7095 |
if (prevArgs[argName]) then |
978 |
|
Thurallor-7095 |
info.condArgs[argName] = prevArgs[argName]; |
979 |
16 |
Thurallor-7095 |
end |
980 |
20 |
Thurallor-7095 |
if ((argName == "eqItemName") and not info.condArgs.eqItemName) then |
981 |
|
Thurallor-7095 |
info.condArgs.eqItemName = "nil"; |
982 |
30 |
Thurallor-7095 |
elseif ((argName == "stackItemName") and not info.condArgs.stackItemName) then |
983 |
|
Thurallor-7095 |
info.condArgs.stackItemName = "nil"; |
984 |
20 |
Thurallor-7095 |
elseif ((argName == "eqSlot") and not info.condArgs.eqSlot) then |
985 |
|
Thurallor-7095 |
info.condArgs.eqSlot = "nil"; |
986 |
30 |
Thurallor-7095 |
elseif ((argName == "x") and not info.condArgs.x) then |
987 |
|
Thurallor-7095 |
info.condArgs.x = 0; |
988 |
16 |
Thurallor-7095 |
end |
989 |
|
Thurallor-7095 |
end |
990 |
|
Thurallor-7095 |
end |
991 |
20 |
Thurallor-7095 |
info.condExpr = condInfo[info.condName].expr; |
992 |
16 |
Thurallor-7095 |
end |
993 |
|
Thurallor-7095 |
|
994 |
|
Thurallor-7095 |
local dropDown; |
995 |
|
Thurallor-7095 |
top, dropDown = AddDropDown(top, condNames, L:GetText(info.condName)); |
996 |
47 |
Thurallor-7095 |
dropDown:SetExpandedWidth(math.max(300, slotTabCardWidth - 20)); |
997 |
16 |
Thurallor-7095 |
dropDown:SetAlignment(Turbine.UI.ContentAlignment.MiddleLeft); |
998 |
|
Thurallor-7095 |
dropDown.ItemChanged = function(sender, args) |
999 |
|
Thurallor-7095 |
local prevContext = L:SetContext("/SequenceEditor/ConditionTypes"); |
1000 |
|
Thurallor-7095 |
info.condName = L:GetItem(args.Text); |
1001 |
|
Thurallor-7095 |
L:SetContext(prevContext); |
1002 |
|
Thurallor-7095 |
local arg = condInfo[info.condName].arg; |
1003 |
20 |
Thurallor-7095 |
SwitchArgs(arg); |
1004 |
16 |
Thurallor-7095 |
self:UpdateBar(); |
1005 |
20 |
Thurallor-7095 |
self:DisplaySlot(self.selectedSlot); |
1006 |
16 |
Thurallor-7095 |
end |
1007 |
|
Thurallor-7095 |
|
1008 |
20 |
Thurallor-7095 |
SwitchArgs(condInfo[info.condName].arg); |
1009 |
|
Thurallor-7095 |
L:SetContext(prevContext); |
1010 |
16 |
Thurallor-7095 |
|
1011 |
20 |
Thurallor-7095 |
-- Display additional arguments depending on the current condition type |
1012 |
|
Thurallor-7095 |
if (info.condArgs) then |
1013 |
30 |
Thurallor-7095 |
if (info.condArgs.stackItemName) then |
1014 |
|
Thurallor-7095 |
local function GetStackableItems() |
1015 |
|
Thurallor-7095 |
local hash = {}; |
1016 |
|
Thurallor-7095 |
local backpack = self.manager.player:GetBackpack(); |
1017 |
|
Thurallor-7095 |
for i = 1, backpack:GetSize(), 1 do |
1018 |
|
Thurallor-7095 |
local item = backpack:GetItem(i); |
1019 |
|
Thurallor-7095 |
if (item and (item:GetMaxStackSize() > 1)) then |
1020 |
|
Thurallor-7095 |
hash[item:GetName()] = true; |
1021 |
|
Thurallor-7095 |
end |
1022 |
|
Thurallor-7095 |
end |
1023 |
|
Thurallor-7095 |
local items = {}; |
1024 |
|
Thurallor-7095 |
for key in sorted_keys(hash) do |
1025 |
|
Thurallor-7095 |
table.insert(items, key); |
1026 |
|
Thurallor-7095 |
end |
1027 |
|
Thurallor-7095 |
return items; |
1028 |
|
Thurallor-7095 |
end |
1029 |
|
Thurallor-7095 |
local stackItemNames = GetStackableItems(); |
1030 |
|
Thurallor-7095 |
local dropDown; |
1031 |
|
Thurallor-7095 |
top, dropDown = AddDropDown(top + 2, stackItemNames); |
1032 |
47 |
Thurallor-7095 |
dropDown:SetExpandedWidth(math.max(400, slotTabCardWidth - 20)); |
1033 |
30 |
Thurallor-7095 |
dropDown.ItemChanged = function(sender, args) |
1034 |
|
Thurallor-7095 |
info.condArgs.stackItemName = "\"" .. args.Text .. "\""; |
1035 |
|
Thurallor-7095 |
self:UpdateBar(); |
1036 |
|
Thurallor-7095 |
end |
1037 |
|
Thurallor-7095 |
dropDown:SetParent(self.slotProperties); |
1038 |
41 |
Thurallor-7095 |
local name = info.condArgs.stackItemName; |
1039 |
|
Thurallor-7095 |
if (name == "nil") then |
1040 |
|
Thurallor-7095 |
name = stackItemNames[1]; |
1041 |
|
Thurallor-7095 |
if (name) then |
1042 |
|
Thurallor-7095 |
dropDown:ItemChanged({Text = name}); |
1043 |
|
Thurallor-7095 |
end |
1044 |
|
Thurallor-7095 |
else |
1045 |
|
Thurallor-7095 |
dropDown:SetText(string.sub(name, 2, -2)); |
1046 |
30 |
Thurallor-7095 |
end |
1047 |
|
Thurallor-7095 |
end |
1048 |
20 |
Thurallor-7095 |
if (info.condArgs.x) then |
1049 |
|
Thurallor-7095 |
local _, xLabel = AddLabel(top + 3, "", Turbine.UI.Color.DarkGoldenrod); |
1050 |
|
Thurallor-7095 |
xLabel:SetWidth(30); |
1051 |
|
Thurallor-7095 |
xLabel:SetFont(Turbine.UI.Lotro.Font.Verdana16); |
1052 |
|
Thurallor-7095 |
xLabel:SetText("x ="); |
1053 |
|
Thurallor-7095 |
|
1054 |
|
Thurallor-7095 |
local xField; |
1055 |
|
Thurallor-7095 |
top, xField = AddTextBox(top + 2, "", Turbine.UI.Color.White); |
1056 |
|
Thurallor-7095 |
xField:SetLeft(30); |
1057 |
35 |
Thurallor-7095 |
xField:SetWidth(slotTabCardWidth - 50); |
1058 |
20 |
Thurallor-7095 |
xField.TextChanged = function(sender) |
1059 |
|
Thurallor-7095 |
info.condArgs.x = tonumber(sender:GetText()); |
1060 |
23 |
Thurallor-7095 |
if (not info.condArgs.x) then |
1061 |
|
Thurallor-7095 |
info.condArgs.x = 0; |
1062 |
|
Thurallor-7095 |
end |
1063 |
20 |
Thurallor-7095 |
self:UpdateBar(); |
1064 |
|
Thurallor-7095 |
end |
1065 |
|
Thurallor-7095 |
xField:SetText(info.condArgs.x); |
1066 |
|
Thurallor-7095 |
xLabel:SetParent(self.slotProperties); |
1067 |
|
Thurallor-7095 |
xField:SetText(tostring(info.condArgs.x)); |
1068 |
|
Thurallor-7095 |
xField:SetParent(self.slotProperties); |
1069 |
|
Thurallor-7095 |
end |
1070 |
199 |
Thurallor-7095 |
if (info.condArgs.petName) then |
1071 |
|
Thurallor-7095 |
local _, nameLabel = AddLabel(top + 5, L:GetText("/SequenceEditor/PetName"), Turbine.UI.Color.DarkGoldenrod); |
1072 |
|
Thurallor-7095 |
nameLabel:AutoSize(); |
1073 |
|
Thurallor-7095 |
nameLabel:SetParent(self.slotProperties); |
1074 |
|
Thurallor-7095 |
|
1075 |
|
Thurallor-7095 |
local nameField; |
1076 |
|
Thurallor-7095 |
top, nameField = AddTextBox(top + 2, "", Turbine.UI.Color.White); |
1077 |
|
Thurallor-7095 |
nameField:SetLeft(nameLabel:GetWidth()); |
1078 |
|
Thurallor-7095 |
nameField:SetWidth(slotTabCardWidth - nameField:GetLeft() - 20); |
1079 |
|
Thurallor-7095 |
nameField.TextChanged = function(sender) |
1080 |
|
Thurallor-7095 |
info.condArgs.petName = sender:GetText(); |
1081 |
|
Thurallor-7095 |
self:UpdateBar(); |
1082 |
|
Thurallor-7095 |
end |
1083 |
|
Thurallor-7095 |
nameField:SetText(info.condArgs.petName); |
1084 |
|
Thurallor-7095 |
nameField:SetParent(self.slotProperties); |
1085 |
|
Thurallor-7095 |
end |
1086 |
|
Thurallor-7095 |
if (info.condArgs.mountName) then |
1087 |
|
Thurallor-7095 |
local _, nameLabel = AddLabel(top + 5, L:GetText("/SequenceEditor/PetName"), Turbine.UI.Color.DarkGoldenrod); |
1088 |
|
Thurallor-7095 |
nameLabel:AutoSize(); |
1089 |
|
Thurallor-7095 |
nameLabel:SetParent(self.slotProperties); |
1090 |
|
Thurallor-7095 |
|
1091 |
|
Thurallor-7095 |
local nameField; |
1092 |
|
Thurallor-7095 |
top, nameField = AddTextBox(top + 2, "", Turbine.UI.Color.White); |
1093 |
|
Thurallor-7095 |
nameField:SetLeft(nameLabel:GetWidth()); |
1094 |
|
Thurallor-7095 |
nameField:SetWidth(slotTabCardWidth - nameField:GetLeft() - 20); |
1095 |
|
Thurallor-7095 |
nameField.TextChanged = function(sender) |
1096 |
|
Thurallor-7095 |
info.condArgs.mountName = sender:GetText(); |
1097 |
|
Thurallor-7095 |
self:UpdateBar(); |
1098 |
|
Thurallor-7095 |
end |
1099 |
|
Thurallor-7095 |
nameField:SetText(info.condArgs.mountName); |
1100 |
|
Thurallor-7095 |
nameField:SetParent(self.slotProperties); |
1101 |
|
Thurallor-7095 |
end |
1102 |
41 |
Thurallor-7095 |
if (info.condArgs.skillName) then |
1103 |
43 |
Thurallor-7095 |
local trainedSkills = Thurallor.Utils.Watcher.GetTrainedSkillsInfo(); |
1104 |
|
Thurallor-7095 |
local skills = Thurallor.Utils.Watcher.GetSkillsInfo(true); |
1105 |
|
Thurallor-7095 |
local displayNames = {}; |
1106 |
|
Thurallor-7095 |
local untrained = L:GetText("/SequenceEditor/Untrained"); |
1107 |
|
Thurallor-7095 |
for n = 1, #skills.names, 1 do |
1108 |
|
Thurallor-7095 |
local name = skills.names[n]; |
1109 |
166 |
Thurallor-7095 |
local displayName = name; |
1110 |
|
Thurallor-7095 |
local altNames = Turbine.Gameplay.Skill.GetAltNames(name); |
1111 |
|
Thurallor-7095 |
if (altNames) then |
1112 |
|
Thurallor-7095 |
displayName = displayName .. " / " .. altNames; |
1113 |
|
Thurallor-7095 |
end |
1114 |
43 |
Thurallor-7095 |
if (not trainedSkills.byName[name]) then |
1115 |
166 |
Thurallor-7095 |
displayName = displayName .. " (" .. untrained .. ")"; |
1116 |
43 |
Thurallor-7095 |
end |
1117 |
166 |
Thurallor-7095 |
table.insert(displayNames, displayName); |
1118 |
43 |
Thurallor-7095 |
end |
1119 |
20 |
Thurallor-7095 |
local dropDown; |
1120 |
43 |
Thurallor-7095 |
top, dropDown = AddDropDown(top + 2, displayNames); |
1121 |
47 |
Thurallor-7095 |
dropDown:SetExpandedWidth(math.max(300, slotTabCardWidth - 20)); |
1122 |
20 |
Thurallor-7095 |
dropDown.ItemChanged = function(sender, args) |
1123 |
166 |
Thurallor-7095 |
local text = args.Text:gsub(" %(" .. L:GetText("/SequenceEditor/Untrained") .. "%)$", ""); |
1124 |
|
Thurallor-7095 |
text = text:gsub(" / .*$", ""); |
1125 |
43 |
Thurallor-7095 |
dropDown:SetText(text); |
1126 |
|
Thurallor-7095 |
info.condArgs.skillName = "\"" .. text .. "\""; |
1127 |
41 |
Thurallor-7095 |
self:UpdateBar(); |
1128 |
|
Thurallor-7095 |
end |
1129 |
|
Thurallor-7095 |
dropDown:SetParent(self.slotProperties); |
1130 |
|
Thurallor-7095 |
local skillName = info.condArgs.skillName; |
1131 |
|
Thurallor-7095 |
if (skillName == "nil") then |
1132 |
43 |
Thurallor-7095 |
skillName = skills.names[1]; -- first one always will be a trained skill |
1133 |
41 |
Thurallor-7095 |
dropDown:ItemChanged({Text = skillName}); |
1134 |
|
Thurallor-7095 |
else |
1135 |
|
Thurallor-7095 |
skillName = string.gsub(skillName, "\"", "") |
1136 |
|
Thurallor-7095 |
dropDown:SetText(skillName); |
1137 |
|
Thurallor-7095 |
end |
1138 |
|
Thurallor-7095 |
end |
1139 |
20 |
Thurallor-7095 |
if (info.condArgs.effect) then |
1140 |
|
Thurallor-7095 |
local effectNames = Thurallor.Utils.Watcher.GetKnownEffectNames(); |
1141 |
|
Thurallor-7095 |
if (#effectNames >= 1) then |
1142 |
|
Thurallor-7095 |
table.insert(effectNames, 1, L:GetText("/SequenceEditor/ConditionTypes/OtherEffect")); |
1143 |
|
Thurallor-7095 |
local dropDown; |
1144 |
|
Thurallor-7095 |
top, dropDown = AddDropDown(top + 2, effectNames); |
1145 |
47 |
Thurallor-7095 |
dropDown:SetExpandedWidth(math.max(300, slotTabCardWidth - 20)); |
1146 |
23 |
Thurallor-7095 |
function dropDown.ItemChanged(ctl, args) |
1147 |
22 |
Thurallor-7095 |
local effectNames = Thurallor.Utils.Watcher.GetKnownEffectNames(); |
1148 |
|
Thurallor-7095 |
local other = L:GetText("/SequenceEditor/ConditionTypes/OtherEffect"); |
1149 |
|
Thurallor-7095 |
table.insert(effectNames, 1, other); |
1150 |
20 |
Thurallor-7095 |
if (args.Text == other) then |
1151 |
|
Thurallor-7095 |
local ok = L:GetText("/ExportWindow/OK"); |
1152 |
|
Thurallor-7095 |
local window = Alert(other, |
1153 |
|
Thurallor-7095 |
L:GetText("/SequenceEditor/ConditionTypes/OtherEffectHelp"), |
1154 |
|
Thurallor-7095 |
ok); |
1155 |
|
Thurallor-7095 |
CenterWindow(window); |
1156 |
|
Thurallor-7095 |
window.label:SetFont(Turbine.UI.Lotro.Font.Verdana14); |
1157 |
|
Thurallor-7095 |
window.label:SetText(window.label:GetText()); |
1158 |
|
Thurallor-7095 |
window.buttons[ok].Click = function() |
1159 |
|
Thurallor-7095 |
window:Close(); |
1160 |
|
Thurallor-7095 |
end |
1161 |
|
Thurallor-7095 |
dropDown:SetText(string.gsub(info.condArgs.effect, "\"", "")); |
1162 |
22 |
Thurallor-7095 |
elseif (not args.Text) then |
1163 |
|
Thurallor-7095 |
return; |
1164 |
20 |
Thurallor-7095 |
else |
1165 |
|
Thurallor-7095 |
info.condArgs.effect = "\"" .. args.Text .. "\""; |
1166 |
|
Thurallor-7095 |
self:UpdateBar(); |
1167 |
|
Thurallor-7095 |
end |
1168 |
|
Thurallor-7095 |
end |
1169 |
|
Thurallor-7095 |
dropDown:SetParent(self.slotProperties); |
1170 |
|
Thurallor-7095 |
local effect = info.condArgs.effect; |
1171 |
22 |
Thurallor-7095 |
if (effect == "nil") then |
1172 |
20 |
Thurallor-7095 |
effect = effectNames[2]; |
1173 |
41 |
Thurallor-7095 |
dropDown:SetText(effect); |
1174 |
|
Thurallor-7095 |
dropDown:ItemChanged({Text = effect}); |
1175 |
22 |
Thurallor-7095 |
else |
1176 |
|
Thurallor-7095 |
effect = string.gsub(effect, "\"", "") |
1177 |
41 |
Thurallor-7095 |
dropDown:SetText(effect); |
1178 |
20 |
Thurallor-7095 |
end |
1179 |
|
Thurallor-7095 |
end |
1180 |
|
Thurallor-7095 |
end |
1181 |
111 |
Thurallor-7095 |
if (info.condArgs.stance) then |
1182 |
|
Thurallor-7095 |
local stanceNames = L:GetSortedTexts("/SequenceEditor/Stance"); |
1183 |
|
Thurallor-7095 |
local dropDown; |
1184 |
|
Thurallor-7095 |
top, dropDown = AddDropDown(top + 2, stanceNames); |
1185 |
|
Thurallor-7095 |
dropDown:SetExpandedWidth(math.max(500, slotTabCardWidth - 20)); |
1186 |
|
Thurallor-7095 |
function dropDown.ItemChanged(ctl, args) |
1187 |
|
Thurallor-7095 |
local prevContext = L:SetContext("/SequenceEditor/Stance"); |
1188 |
|
Thurallor-7095 |
local stance = L:GetItem(args.Text); |
1189 |
|
Thurallor-7095 |
info.condArgs.stance = tonumber(stance); |
1190 |
|
Thurallor-7095 |
self:UpdateBar(); |
1191 |
|
Thurallor-7095 |
end |
1192 |
|
Thurallor-7095 |
dropDown:SetParent(self.slotProperties); |
1193 |
|
Thurallor-7095 |
local stance = info.condArgs.stance; |
1194 |
|
Thurallor-7095 |
dropDown:SetText(L:GetText("/SequenceEditor/Stance/" .. tostring(stance))); |
1195 |
|
Thurallor-7095 |
end |
1196 |
20 |
Thurallor-7095 |
if (info.condArgs.script) then |
1197 |
47 |
Thurallor-7095 |
top, self.scriptBox = AddTextBox(top + 2, info.condArgs.script, Turbine.UI.Color.White, true, self.settings.sequenceEditor.scriptBoxSize); |
1198 |
|
Thurallor-7095 |
self.scriptBox:SetZOrder(1); |
1199 |
|
Thurallor-7095 |
self.scriptBox:SetMultiline(true); |
1200 |
|
Thurallor-7095 |
self.scriptBox:SetTextAlignment(Turbine.UI.ContentAlignment.TopLeft); |
1201 |
|
Thurallor-7095 |
self.scriptBox:SetFont(Turbine.UI.Lotro.Font.Verdana12); |
1202 |
169 |
Thurallor-7095 |
self.scriptBox:SetText(info.condArgs.script); |
1203 |
20 |
Thurallor-7095 |
self.scriptBox:SetWantsUpdates(true); |
1204 |
47 |
Thurallor-7095 |
function self.scriptBox.Resized() |
1205 |
|
Thurallor-7095 |
self.settings.sequenceEditor.scriptBoxSize = {self.scriptBox:GetSize()}; |
1206 |
|
Thurallor-7095 |
self:SaveSettings(); |
1207 |
|
Thurallor-7095 |
self:DisplaySlot(self.selectedSlot); |
1208 |
|
Thurallor-7095 |
end |
1209 |
20 |
Thurallor-7095 |
self.scriptBox.Update = function(sender) |
1210 |
|
Thurallor-7095 |
local script = sender:GetText(); |
1211 |
|
Thurallor-7095 |
if (script ~= sender.prevText) then |
1212 |
|
Thurallor-7095 |
local success, errorMsg = loadstring(script, "Slot " .. tostring(s)); |
1213 |
|
Thurallor-7095 |
if (success) then |
1214 |
|
Thurallor-7095 |
self.scriptBox:SetBackColor(Turbine.UI.Color.Black); |
1215 |
|
Thurallor-7095 |
info.condArgs.script = script; |
1216 |
|
Thurallor-7095 |
self:UpdateBar(); |
1217 |
|
Thurallor-7095 |
else |
1218 |
|
Thurallor-7095 |
self.scriptBox:SetBackColor(Turbine.UI.Color.Red); |
1219 |
|
Thurallor-7095 |
end |
1220 |
|
Thurallor-7095 |
end |
1221 |
|
Thurallor-7095 |
sender.prevText = script; |
1222 |
|
Thurallor-7095 |
end |
1223 |
|
Thurallor-7095 |
end |
1224 |
|
Thurallor-7095 |
if (info.condArgs.eqItemName) then |
1225 |
|
Thurallor-7095 |
local function GetEquippableItems() |
1226 |
|
Thurallor-7095 |
local hash = { [L:GetText("/SequenceEditor/AnyEqItem")] = true }; |
1227 |
|
Thurallor-7095 |
for container in values({ self.manager.player:GetBackpack(), self.manager.player:GetEquipment() }) do |
1228 |
|
Thurallor-7095 |
for i = 1, container:GetSize(), 1 do |
1229 |
|
Thurallor-7095 |
local item = container:GetItem(i); |
1230 |
30 |
Thurallor-7095 |
if (item and (item:GetMaxStackSize() == 1)) then |
1231 |
|
Thurallor-7095 |
hash[item:GetName()] = true; |
1232 |
20 |
Thurallor-7095 |
end |
1233 |
|
Thurallor-7095 |
end |
1234 |
|
Thurallor-7095 |
end |
1235 |
|
Thurallor-7095 |
local items = {}; |
1236 |
|
Thurallor-7095 |
for key in sorted_keys(hash) do |
1237 |
|
Thurallor-7095 |
table.insert(items, key); |
1238 |
|
Thurallor-7095 |
end |
1239 |
|
Thurallor-7095 |
return items; |
1240 |
|
Thurallor-7095 |
end |
1241 |
|
Thurallor-7095 |
local eqItemNames = GetEquippableItems(); |
1242 |
|
Thurallor-7095 |
local anyItem = L:GetText("/SequenceEditor/AnyEqItem"); |
1243 |
|
Thurallor-7095 |
local dropDown; |
1244 |
|
Thurallor-7095 |
top, dropDown = AddDropDown(top + 2, eqItemNames); |
1245 |
47 |
Thurallor-7095 |
dropDown:SetExpandedWidth(math.max(400, slotTabCardWidth - 20)); |
1246 |
20 |
Thurallor-7095 |
dropDown.ItemChanged = function(sender, args) |
1247 |
|
Thurallor-7095 |
local anyItem = L:GetText("/SequenceEditor/AnyEqItem"); |
1248 |
|
Thurallor-7095 |
if (args.Text == anyItem) then |
1249 |
|
Thurallor-7095 |
info.condArgs.eqItemName = "nil"; |
1250 |
|
Thurallor-7095 |
else |
1251 |
|
Thurallor-7095 |
info.condArgs.eqItemName = "\"" .. args.Text .. "\""; |
1252 |
|
Thurallor-7095 |
end |
1253 |
|
Thurallor-7095 |
self:UpdateBar(); |
1254 |
|
Thurallor-7095 |
end |
1255 |
|
Thurallor-7095 |
dropDown:SetParent(self.slotProperties); |
1256 |
|
Thurallor-7095 |
if (info.condArgs.eqItemName == "nil") then |
1257 |
|
Thurallor-7095 |
dropDown:SetText(anyItem); |
1258 |
|
Thurallor-7095 |
else |
1259 |
|
Thurallor-7095 |
local name = string.sub(info.condArgs.eqItemName, 2, -2); |
1260 |
|
Thurallor-7095 |
dropDown:SetText(name); |
1261 |
|
Thurallor-7095 |
end |
1262 |
|
Thurallor-7095 |
end |
1263 |
|
Thurallor-7095 |
if (info.condArgs.eqSlot) then |
1264 |
|
Thurallor-7095 |
local prevContext = L:SetContext("/SequenceEditor/EquipmentSlots"); |
1265 |
|
Thurallor-7095 |
local eqSlotNames, localEqSlotNames, eqSlotValues = L:GetItems(), {}, {}; |
1266 |
|
Thurallor-7095 |
for slot in values(eqSlotNames) do |
1267 |
|
Thurallor-7095 |
local text = L:GetText(slot); |
1268 |
|
Thurallor-7095 |
table.insert(localEqSlotNames, text); |
1269 |
|
Thurallor-7095 |
eqSlotValues[text] = tostring(Turbine.Gameplay.Equipment[slot]); |
1270 |
|
Thurallor-7095 |
end |
1271 |
|
Thurallor-7095 |
local anySlot = L:GetText("/SequenceEditor/AnyEqSlot"); |
1272 |
|
Thurallor-7095 |
eqSlotValues[anySlot] = "nil"; |
1273 |
|
Thurallor-7095 |
table.insert(localEqSlotNames, anySlot); |
1274 |
|
Thurallor-7095 |
table.sort(localEqSlotNames); |
1275 |
|
Thurallor-7095 |
local dropDown; |
1276 |
|
Thurallor-7095 |
top, dropDown = AddDropDown(top + 2, localEqSlotNames); |
1277 |
|
Thurallor-7095 |
dropDown.ItemChanged = function(sender, args) |
1278 |
|
Thurallor-7095 |
info.condArgs.eqSlot = eqSlotValues[args.Text]; |
1279 |
|
Thurallor-7095 |
self:UpdateBar(); |
1280 |
|
Thurallor-7095 |
end |
1281 |
|
Thurallor-7095 |
dropDown:SetParent(self.slotProperties); |
1282 |
|
Thurallor-7095 |
if (info.condArgs.eqSlot == "nil") then |
1283 |
|
Thurallor-7095 |
dropDown:SetText(anySlot); |
1284 |
|
Thurallor-7095 |
else |
1285 |
|
Thurallor-7095 |
local slotName = Search(Turbine.Gameplay.Equipment, tonumber(info.condArgs.eqSlot)); |
1286 |
|
Thurallor-7095 |
dropDown:SetText(L:GetText(slotName)); |
1287 |
|
Thurallor-7095 |
end |
1288 |
|
Thurallor-7095 |
L:SetContext(prevContext); |
1289 |
|
Thurallor-7095 |
end |
1290 |
|
Thurallor-7095 |
end |
1291 |
47 |
Thurallor-7095 |
|
1292 |
|
Thurallor-7095 |
-- Evaluate the condition and display the current value |
1293 |
|
Thurallor-7095 |
local function GetValueStr() |
1294 |
|
Thurallor-7095 |
local sequence = self.bar.sequence; |
1295 |
|
Thurallor-7095 |
local slot = sequence:GetSlot(sequence:GetNewIndex(s)); |
1296 |
49 |
Thurallor-7095 |
if (slot and slot.condFunc) then |
1297 |
146 |
Thurallor-7095 |
local text; |
1298 |
|
Thurallor-7095 |
local success, value = pcall(slot.condFunc, slot, self.manager.player); |
1299 |
|
Thurallor-7095 |
if (success) then |
1300 |
|
Thurallor-7095 |
if (value) then |
1301 |
|
Thurallor-7095 |
text = L:GetText("/SequenceEditor/True"); |
1302 |
|
Thurallor-7095 |
else |
1303 |
|
Thurallor-7095 |
text = L:GetText("/SequenceEditor/False"); |
1304 |
|
Thurallor-7095 |
end |
1305 |
|
Thurallor-7095 |
else |
1306 |
|
Thurallor-7095 |
text = "Error: " .. value; |
1307 |
49 |
Thurallor-7095 |
end |
1308 |
|
Thurallor-7095 |
return "(" .. text .. ")"; |
1309 |
47 |
Thurallor-7095 |
end |
1310 |
|
Thurallor-7095 |
end |
1311 |
|
Thurallor-7095 |
if (info.condArgs and info.condArgs.script) then |
1312 |
146 |
Thurallor-7095 |
top, self.playButton = AddButton(top, 40, "â–º", Turbine.UI.Lotro.Font.Arial12); |
1313 |
47 |
Thurallor-7095 |
top, label = AddLabel(top, "", Turbine.UI.Color.Goldenrod); |
1314 |
146 |
Thurallor-7095 |
AddCallback(self.playButton, "Click", function() |
1315 |
47 |
Thurallor-7095 |
label:SetText(GetValueStr()); |
1316 |
|
Thurallor-7095 |
end); |
1317 |
146 |
Thurallor-7095 |
AddCallback(self.playButton, "MouseLeave", function() |
1318 |
47 |
Thurallor-7095 |
label:SetText(""); |
1319 |
|
Thurallor-7095 |
end); |
1320 |
|
Thurallor-7095 |
else |
1321 |
159 |
Thurallor-7095 |
top, self.resultLabel = AddLabel(top, "", Turbine.UI.Color.Goldenrod); |
1322 |
|
Thurallor-7095 |
self.resultLabel.Update = function(obj) |
1323 |
|
Thurallor-7095 |
obj:SetText(GetValueStr()); |
1324 |
47 |
Thurallor-7095 |
end |
1325 |
159 |
Thurallor-7095 |
self.resultLabel:SetWantsUpdates(true); |
1326 |
47 |
Thurallor-7095 |
end |
1327 |
146 |
Thurallor-7095 |
|
1328 |
178 |
Thurallor-7095 |
local isTargetEffectCondition = { |
1329 |
|
Thurallor-7095 |
["TargetEffectDisease"] = true; |
1330 |
|
Thurallor-7095 |
["TargetEffectFear"] = true; |
1331 |
|
Thurallor-7095 |
["TargetEffectPoison"] = true; |
1332 |
|
Thurallor-7095 |
["TargetEffectWound"] = true; |
1333 |
|
Thurallor-7095 |
["TargetEffectOther"] = true; |
1334 |
|
Thurallor-7095 |
["NotTargetEffectOther"] = true; |
1335 |
|
Thurallor-7095 |
}; |
1336 |
|
Thurallor-7095 |
if (isTargetEffectCondition[info.condName]) then |
1337 |
|
Thurallor-7095 |
top = top + 16; -- skip a line |
1338 |
|
Thurallor-7095 |
_, label = AddLabel(top, L:GetText("/SequenceEditor/TargetEffectWarning"), Turbine.UI.Color.Silver); |
1339 |
|
Thurallor-7095 |
label:SetTextAlignment(Turbine.UI.ContentAlignment.LeftCenter); |
1340 |
|
Thurallor-7095 |
label:SetHeight(14 * L:GetNumber("/SequenceEditor/TargetEffectWarningHeight")); |
1341 |
|
Thurallor-7095 |
top = top + label:GetHeight(); |
1342 |
|
Thurallor-7095 |
end |
1343 |
|
Thurallor-7095 |
|
1344 |
146 |
Thurallor-7095 |
elseif (info.type == "LuaScript") then |
1345 |
|
Thurallor-7095 |
|
1346 |
|
Thurallor-7095 |
-- Display script editor box |
1347 |
|
Thurallor-7095 |
top, self.scriptBox = AddTextBox(top + 2, info.action, Turbine.UI.Color.White, true, self.settings.sequenceEditor.scriptBoxSize); |
1348 |
|
Thurallor-7095 |
self.scriptBox:SetZOrder(1); |
1349 |
|
Thurallor-7095 |
self.scriptBox:SetMultiline(true); |
1350 |
|
Thurallor-7095 |
self.scriptBox:SetTextAlignment(Turbine.UI.ContentAlignment.TopLeft); |
1351 |
|
Thurallor-7095 |
self.scriptBox:SetFont(Turbine.UI.Lotro.Font.Verdana12); |
1352 |
169 |
Thurallor-7095 |
self.scriptBox:SetText(info.action); |
1353 |
146 |
Thurallor-7095 |
self.scriptBox:SetWantsUpdates(true); |
1354 |
|
Thurallor-7095 |
function self.scriptBox.Resized() |
1355 |
|
Thurallor-7095 |
self.settings.sequenceEditor.scriptBoxSize = {self.scriptBox:GetSize()}; |
1356 |
|
Thurallor-7095 |
self:SaveSettings(); |
1357 |
|
Thurallor-7095 |
self:DisplaySlot(self.selectedSlot); |
1358 |
|
Thurallor-7095 |
end |
1359 |
|
Thurallor-7095 |
self.scriptBox.Update = function(sender) |
1360 |
|
Thurallor-7095 |
local script = sender:GetText(); |
1361 |
|
Thurallor-7095 |
if (script ~= sender.prevText) then |
1362 |
|
Thurallor-7095 |
local success, errorMsg = loadstring(script, "Slot " .. tostring(s)); |
1363 |
|
Thurallor-7095 |
if (success) then |
1364 |
|
Thurallor-7095 |
self.scriptBox:SetBackColor(Turbine.UI.Color.Black); |
1365 |
|
Thurallor-7095 |
self.playButton:SetEnabled(true); |
1366 |
|
Thurallor-7095 |
info.action = script; |
1367 |
|
Thurallor-7095 |
self:UpdateBar(); |
1368 |
|
Thurallor-7095 |
else |
1369 |
|
Thurallor-7095 |
self.scriptBox:SetBackColor(Turbine.UI.Color.Red); |
1370 |
|
Thurallor-7095 |
self.playButton:SetEnabled(false); |
1371 |
|
Thurallor-7095 |
end |
1372 |
|
Thurallor-7095 |
end |
1373 |
|
Thurallor-7095 |
sender.prevText = script; |
1374 |
|
Thurallor-7095 |
end |
1375 |
|
Thurallor-7095 |
|
1376 |
|
Thurallor-7095 |
-- Create a button for executing the script |
1377 |
|
Thurallor-7095 |
top, self.playButton = AddButton(top, 40, "â–º", Turbine.UI.Lotro.Font.Arial12); |
1378 |
|
Thurallor-7095 |
top, label = AddLabel(top, "", Turbine.UI.Color.Goldenrod); |
1379 |
|
Thurallor-7095 |
AddCallback(self.playButton, "Click", function() |
1380 |
|
Thurallor-7095 |
local script = self.scriptBox:GetText(); |
1381 |
181 |
Thurallor-7095 |
local success, result = pcall(loadstring("setfenv(1, _G);" .. script, "Slot " .. tostring(s))); |
1382 |
146 |
Thurallor-7095 |
if (success) then |
1383 |
|
Thurallor-7095 |
if (type(result) == "string") then |
1384 |
|
Thurallor-7095 |
result = "\"" .. result .. "\""; |
1385 |
|
Thurallor-7095 |
else |
1386 |
|
Thurallor-7095 |
result = tostring(result); -- or "nil"; |
1387 |
|
Thurallor-7095 |
end |
1388 |
|
Thurallor-7095 |
label:SetText("returned: " .. result); |
1389 |
|
Thurallor-7095 |
else |
1390 |
|
Thurallor-7095 |
label:SetText("error: " .. result); |
1391 |
|
Thurallor-7095 |
end |
1392 |
|
Thurallor-7095 |
end); |
1393 |
|
Thurallor-7095 |
AddCallback(self.playButton, "MouseLeave", function() |
1394 |
|
Thurallor-7095 |
label:SetText(""); |
1395 |
|
Thurallor-7095 |
end); |
1396 |
|
Thurallor-7095 |
|
1397 |
16 |
Thurallor-7095 |
elseif (info.type == "Include") then |
1398 |
178 |
Thurallor-7095 |
top = AddHorizontalLine(top); |
1399 |
16 |
Thurallor-7095 |
top = AddLabel(top, L:GetText("/SequenceEditor/OtherSequence") .. ":", Turbine.UI.Color.Goldenrod); |
1400 |
|
Thurallor-7095 |
local function GetObjectTree() |
1401 |
|
Thurallor-7095 |
-- Get a list of all bar IDs. |
1402 |
|
Thurallor-7095 |
local objectIDs = self.manager:FindAllDescendentIDs(nil, true, false); |
1403 |
|
Thurallor-7095 |
|
1404 |
|
Thurallor-7095 |
-- Including self doesn't make sense, so prevent that. |
1405 |
217 |
Thurallor-7095 |
local barID = self.bar:GetID(); |
1406 |
16 |
Thurallor-7095 |
local foundSelf; |
1407 |
217 |
Thurallor-7095 |
for n, id in ipairs(objectIDs) do |
1408 |
|
Thurallor-7095 |
if (id == barID) then |
1409 |
|
Thurallor-7095 |
foundSelf = n; |
1410 |
|
Thurallor-7095 |
break; |
1411 |
16 |
Thurallor-7095 |
end |
1412 |
|
Thurallor-7095 |
end |
1413 |
|
Thurallor-7095 |
if (foundSelf) then |
1414 |
|
Thurallor-7095 |
table.remove(objectIDs, foundSelf); |
1415 |
|
Thurallor-7095 |
end |
1416 |
|
Thurallor-7095 |
|
1417 |
|
Thurallor-7095 |
-- Add nonempty groups. |
1418 |
17 |
Thurallor-7095 |
local groupIDs = {}; |
1419 |
217 |
Thurallor-7095 |
for n, id in ipairs(objectIDs) do |
1420 |
|
Thurallor-7095 |
local object = self.manager:GetObject(id); |
1421 |
|
Thurallor-7095 |
while (object.parent and (object.parent ~= self.manager)) do |
1422 |
17 |
Thurallor-7095 |
object = object.parent; |
1423 |
217 |
Thurallor-7095 |
groupIDs[object:GetID()] = true; |
1424 |
16 |
Thurallor-7095 |
end |
1425 |
17 |
Thurallor-7095 |
end |
1426 |
|
Thurallor-7095 |
for groupID in keys(groupIDs) do |
1427 |
|
Thurallor-7095 |
table.insert(objectIDs, groupID); |
1428 |
|
Thurallor-7095 |
end |
1429 |
16 |
Thurallor-7095 |
|
1430 |
|
Thurallor-7095 |
-- Create item list for PullDownMenu. |
1431 |
|
Thurallor-7095 |
local items = {}; |
1432 |
217 |
Thurallor-7095 |
for _, id in ipairs(objectIDs) do |
1433 |
|
Thurallor-7095 |
local object = self.manager:GetObject(id); |
1434 |
16 |
Thurallor-7095 |
local parentID = nil; |
1435 |
217 |
Thurallor-7095 |
if (object.parent and (object.parent ~= self.manager)) then |
1436 |
16 |
Thurallor-7095 |
parentID = object.parent:GetID(); |
1437 |
|
Thurallor-7095 |
end |
1438 |
217 |
Thurallor-7095 |
table.insert(items, { id, object:GetName(), parentID }); |
1439 |
16 |
Thurallor-7095 |
end |
1440 |
|
Thurallor-7095 |
return items; |
1441 |
|
Thurallor-7095 |
end |
1442 |
|
Thurallor-7095 |
local pullDown; |
1443 |
|
Thurallor-7095 |
top, pullDown = AddPullDown(top, GetObjectTree(), info.include); |
1444 |
|
Thurallor-7095 |
pullDown.SelectionChanged = function(sender, id) |
1445 |
|
Thurallor-7095 |
info.include = id; |
1446 |
|
Thurallor-7095 |
self:UpdateBar(); |
1447 |
20 |
Thurallor-7095 |
self:SelectSlot(s); |
1448 |
16 |
Thurallor-7095 |
end |
1449 |
20 |
Thurallor-7095 |
AddCallback(pullDown, "MouseClick", function(sender, args) |
1450 |
|
Thurallor-7095 |
-- Right-click displays the bar menu. |
1451 |
|
Thurallor-7095 |
if (args.Button == Turbine.UI.MouseButton.Right) then |
1452 |
|
Thurallor-7095 |
if (info.include) then |
1453 |
|
Thurallor-7095 |
local bar = self.manager.objects[info.include]; |
1454 |
|
Thurallor-7095 |
if (bar) then |
1455 |
|
Thurallor-7095 |
bar:ShowSettingsMenu(); |
1456 |
|
Thurallor-7095 |
end |
1457 |
|
Thurallor-7095 |
end |
1458 |
|
Thurallor-7095 |
end |
1459 |
|
Thurallor-7095 |
end); |
1460 |
6 |
Thurallor-7095 |
|
1461 |
20 |
Thurallor-7095 |
-- Add the "unlink" button if a sequence is selected. |
1462 |
|
Thurallor-7095 |
if (info.include) then |
1463 |
|
Thurallor-7095 |
local button; |
1464 |
|
Thurallor-7095 |
local text, width = L:GetText("/SequenceEditor/Unlink"), L:GetNumber("/SequenceEditor/UnlinkButtonWidth"); |
1465 |
|
Thurallor-7095 |
top, button = AddButton(top, width, text); |
1466 |
|
Thurallor-7095 |
AddCallback(button, "Click", function() |
1467 |
|
Thurallor-7095 |
self:UnlinkIncludedSequence(s); |
1468 |
|
Thurallor-7095 |
end); |
1469 |
|
Thurallor-7095 |
end |
1470 |
|
Thurallor-7095 |
end |
1471 |
|
Thurallor-7095 |
|
1472 |
16 |
Thurallor-7095 |
-- Allow the user to specify whether activation is click-based or automatic. |
1473 |
|
Thurallor-7095 |
if (info.type ~= "Include") then |
1474 |
178 |
Thurallor-7095 |
top = AddHorizontalLine(top); |
1475 |
6 |
Thurallor-7095 |
top = AddLabel(top, L:GetText("/SequenceEditor/Activation") .. ":", Turbine.UI.Color.Goldenrod); |
1476 |
|
Thurallor-7095 |
local button1, button2; |
1477 |
|
Thurallor-7095 |
top, button1 = AddRadioButton(top, L:GetText("/SequenceEditor/WithLeftClick"), Turbine.UI.Color.DarkGoldenrod, (not info.automatic)); |
1478 |
|
Thurallor-7095 |
top, button2 = AddRadioButton(top, L:GetText("/SequenceEditor/Automatic"), Turbine.UI.Color.DarkGoldenrod, info.automatic); |
1479 |
|
Thurallor-7095 |
Thurallor.UI.RadioButton.LinkPeers({button1, button2}); |
1480 |
|
Thurallor-7095 |
button1.Clicked = function() |
1481 |
|
Thurallor-7095 |
info.automatic = nil; |
1482 |
16 |
Thurallor-7095 |
self:UpdateBar(); |
1483 |
182 |
Thurallor-7095 |
self:DisplaySlot(self.selectedSlot); |
1484 |
6 |
Thurallor-7095 |
end |
1485 |
|
Thurallor-7095 |
button2.Clicked = function() |
1486 |
|
Thurallor-7095 |
info.automatic = true; |
1487 |
16 |
Thurallor-7095 |
self:UpdateBar(); |
1488 |
182 |
Thurallor-7095 |
self:DisplaySlot(self.selectedSlot); |
1489 |
6 |
Thurallor-7095 |
end |
1490 |
2 |
Thurallor-7095 |
end |
1491 |
|
Thurallor-7095 |
end |
1492 |
|
Thurallor-7095 |
|
1493 |
136 |
Thurallor-7095 |
-- Allow the user to specify that advancement should not occur until there is a target |
1494 |
|
Thurallor-7095 |
if ((info.type == Turbine.UI.Lotro.ShortcutType.Skill) or (info.type == "SelectTarget")) then |
1495 |
|
Thurallor-7095 |
local checkbox; |
1496 |
178 |
Thurallor-7095 |
top, checkbox = AddCheckBox(top, L:GetText("/SequenceEditor/RequireTarget"), Turbine.UI.Color.DarkGoldenrod, info.requireTarget); |
1497 |
136 |
Thurallor-7095 |
|
1498 |
|
Thurallor-7095 |
checkbox.CheckedChanged = function(chkbx) |
1499 |
|
Thurallor-7095 |
if (chkbx:IsChecked()) then |
1500 |
|
Thurallor-7095 |
info.requireTarget = true; |
1501 |
|
Thurallor-7095 |
else |
1502 |
|
Thurallor-7095 |
info.requireTarget = nil; |
1503 |
|
Thurallor-7095 |
end |
1504 |
|
Thurallor-7095 |
self:UpdateBar(); |
1505 |
|
Thurallor-7095 |
end |
1506 |
182 |
Thurallor-7095 |
elseif ((info.type == "If") and (info.automatic)) then |
1507 |
|
Thurallor-7095 |
top, checkbox = AddCheckBox(top, L:GetText("/SequenceEditor/ReevaluateContinuously"), Turbine.UI.Color.DarkGoldenrod, info.reevaluate); |
1508 |
|
Thurallor-7095 |
checkbox:SetLeft(16); -- indent |
1509 |
|
Thurallor-7095 |
checkbox:SetSize(checkbox:GetWidth() - 16, 42); |
1510 |
|
Thurallor-7095 |
top = top + 22; |
1511 |
|
Thurallor-7095 |
checkbox.CheckedChanged = function(chkbx) |
1512 |
|
Thurallor-7095 |
info.reevaluate = chkbx:IsChecked() or nil; |
1513 |
|
Thurallor-7095 |
self:UpdateBar(); |
1514 |
|
Thurallor-7095 |
end |
1515 |
136 |
Thurallor-7095 |
end |
1516 |
|
Thurallor-7095 |
|
1517 |
34 |
Thurallor-7095 |
-- Allow the user to modify slot appearance (text, icon) |
1518 |
|
Thurallor-7095 |
local button; |
1519 |
|
Thurallor-7095 |
top, button = AddSection(top, L:GetText("/SequenceEditor/Appearance"), Turbine.UI.Color.Goldenrod, self.appearanceExpanded); |
1520 |
|
Thurallor-7095 |
function button.ExpandedChanged(sender, expanded) |
1521 |
|
Thurallor-7095 |
self.appearanceExpanded = expanded; |
1522 |
|
Thurallor-7095 |
self:DisplaySlot(self.selectedSlot); |
1523 |
|
Thurallor-7095 |
end |
1524 |
|
Thurallor-7095 |
|
1525 |
|
Thurallor-7095 |
if (self.appearanceExpanded) then |
1526 |
|
Thurallor-7095 |
|
1527 |
|
Thurallor-7095 |
-- Allow the user to optionally overlay some text |
1528 |
|
Thurallor-7095 |
top = top + 16; -- skip a line |
1529 |
|
Thurallor-7095 |
top = AddLabel(top, L:GetText("/SequenceEditor/TextOverlay") .. ":", Turbine.UI.Color.Goldenrod); |
1530 |
|
Thurallor-7095 |
local textBox; |
1531 |
|
Thurallor-7095 |
top, textBox = AddTextBox(top, info.textOverlay, Turbine.UI.Color.White); |
1532 |
|
Thurallor-7095 |
textBox:SetFont(Turbine.UI.Lotro.Font.Verdana12); |
1533 |
|
Thurallor-7095 |
textBox.TextChanged = function(sender, args) |
1534 |
|
Thurallor-7095 |
local text = sender:GetText(); |
1535 |
|
Thurallor-7095 |
if (text == "") then |
1536 |
|
Thurallor-7095 |
text = nil; |
1537 |
|
Thurallor-7095 |
end |
1538 |
|
Thurallor-7095 |
info.textOverlay = text; |
1539 |
|
Thurallor-7095 |
UpdateIcon(); |
1540 |
|
Thurallor-7095 |
self:UpdateBar(); |
1541 |
7 |
Thurallor-7095 |
end |
1542 |
34 |
Thurallor-7095 |
|
1543 |
|
Thurallor-7095 |
-- Allow the user to optionally change the icon |
1544 |
|
Thurallor-7095 |
top = top + 16; -- skip a line |
1545 |
|
Thurallor-7095 |
top = AddLabel(top, L:GetText("/SequenceEditor/ChangeIcon") .. ":", Turbine.UI.Color.Goldenrod); |
1546 |
|
Thurallor-7095 |
local button1, button2, slider2, button3, slider3, button4, textbox; |
1547 |
|
Thurallor-7095 |
top, button1 = AddRadioButton(top, L:GetText("/SequenceEditor/DefaultIcon"), Turbine.UI.Color.DarkGoldenrod); |
1548 |
|
Thurallor-7095 |
top, button2 = AddRadioButton(top, L:GetText("/SequenceEditor/BlankIcon"), Turbine.UI.Color.DarkGoldenrod); |
1549 |
|
Thurallor-7095 |
top, slider2 = AddSlider(top, 1, #resources.BlankIcons, 1); |
1550 |
|
Thurallor-7095 |
slider2:SetLeft(12); |
1551 |
|
Thurallor-7095 |
slider2:SetWidth(slider2:GetWidth() - 12); |
1552 |
|
Thurallor-7095 |
top, button3 = AddRadioButton(top, L:GetText("/SequenceEditor/SkillIcon"), Turbine.UI.Color.DarkGoldenrod); |
1553 |
|
Thurallor-7095 |
local skillsInfo = Thurallor.Utils.Watcher.GetSkillsInfo(); |
1554 |
|
Thurallor-7095 |
local gambitsInfo = Thurallor.Utils.Watcher.GetGambitsInfo(); |
1555 |
|
Thurallor-7095 |
self.skillIcons = {}; |
1556 |
|
Thurallor-7095 |
for id in sorted_keys(skillsInfo.byIcon) do |
1557 |
|
Thurallor-7095 |
table.insert(self.skillIcons, id); |
1558 |
|
Thurallor-7095 |
end |
1559 |
|
Thurallor-7095 |
for id in sorted_keys(gambitsInfo.byIcon) do |
1560 |
|
Thurallor-7095 |
table.insert(self.skillIcons, id); |
1561 |
|
Thurallor-7095 |
end |
1562 |
|
Thurallor-7095 |
top, slider3 = AddSlider(top, 1, #self.skillIcons, 1); |
1563 |
|
Thurallor-7095 |
slider3:SetLeft(12); |
1564 |
|
Thurallor-7095 |
slider3:SetWidth(slider3:GetWidth() - 12); |
1565 |
|
Thurallor-7095 |
top, button4 = AddRadioButton(top, L:GetText("/SequenceEditor/SpecificIconID"), Turbine.UI.Color.DarkGoldenrod); |
1566 |
|
Thurallor-7095 |
top, textBox = AddTextBox(top, "", Turbine.UI.Color.White); |
1567 |
47 |
Thurallor-7095 |
textBox:SetFont(Turbine.UI.Lotro.Font.Verdana12); |
1568 |
34 |
Thurallor-7095 |
textBox:SetLeft(12); |
1569 |
|
Thurallor-7095 |
textBox:SetWidth(textBox:GetWidth() - 12); |
1570 |
|
Thurallor-7095 |
if (info.altIcon == nil) then |
1571 |
|
Thurallor-7095 |
button1:SetChecked(true); |
1572 |
|
Thurallor-7095 |
else |
1573 |
|
Thurallor-7095 |
local blankIcon = Search(resources.BlankIcons, info.altIcon); |
1574 |
|
Thurallor-7095 |
if (blankIcon) then |
1575 |
|
Thurallor-7095 |
button2:SetChecked(true); |
1576 |
|
Thurallor-7095 |
slider2:SetValue(blankIcon); |
1577 |
|
Thurallor-7095 |
else |
1578 |
|
Thurallor-7095 |
local skillIcon = Search(self.skillIcons, info.altIcon); |
1579 |
|
Thurallor-7095 |
if (skillIcon) then |
1580 |
|
Thurallor-7095 |
button3:SetChecked(true); |
1581 |
|
Thurallor-7095 |
slider3:SetValue(skillIcon); |
1582 |
|
Thurallor-7095 |
else |
1583 |
|
Thurallor-7095 |
button4:SetChecked(true); |
1584 |
|
Thurallor-7095 |
end |
1585 |
|
Thurallor-7095 |
end |
1586 |
|
Thurallor-7095 |
end |
1587 |
|
Thurallor-7095 |
local function UpdateIconID() |
1588 |
|
Thurallor-7095 |
local id = info.altIcon; |
1589 |
|
Thurallor-7095 |
if (id == nil) then |
1590 |
|
Thurallor-7095 |
id = info.background; |
1591 |
|
Thurallor-7095 |
end |
1592 |
|
Thurallor-7095 |
if (type(id) == "number") then |
1593 |
|
Thurallor-7095 |
textBox:SetText(string.format("0x%8.8X", id)); |
1594 |
|
Thurallor-7095 |
elseif (type(id) == "string") then |
1595 |
|
Thurallor-7095 |
textBox:SetText(id); |
1596 |
|
Thurallor-7095 |
else |
1597 |
|
Thurallor-7095 |
-- Get icon ID from quickslot |
1598 |
|
Thurallor-7095 |
|
1599 |
|
Thurallor-7095 |
end |
1600 |
|
Thurallor-7095 |
end |
1601 |
|
Thurallor-7095 |
UpdateIconID(); |
1602 |
|
Thurallor-7095 |
Thurallor.UI.RadioButton.LinkPeers({button1, button2, button3, button4}); |
1603 |
|
Thurallor-7095 |
function button1.Clicked() |
1604 |
|
Thurallor-7095 |
info.altIcon = nil; |
1605 |
|
Thurallor-7095 |
UpdateIcon(); |
1606 |
|
Thurallor-7095 |
UpdateIconID(); |
1607 |
|
Thurallor-7095 |
self:UpdateBar(); |
1608 |
|
Thurallor-7095 |
end |
1609 |
|
Thurallor-7095 |
function button2.Clicked() |
1610 |
|
Thurallor-7095 |
slider2:ValueChanged(); |
1611 |
|
Thurallor-7095 |
end |
1612 |
|
Thurallor-7095 |
function button3.Clicked() |
1613 |
|
Thurallor-7095 |
slider3:ValueChanged(); |
1614 |
|
Thurallor-7095 |
end |
1615 |
|
Thurallor-7095 |
function button4.Clicked() |
1616 |
|
Thurallor-7095 |
textBox:TextChanged(); |
1617 |
|
Thurallor-7095 |
end |
1618 |
|
Thurallor-7095 |
slider2.ValueChanged = function(sender) |
1619 |
|
Thurallor-7095 |
if (not button2:IsChecked()) then |
1620 |
|
Thurallor-7095 |
button2:MouseClick(); |
1621 |
|
Thurallor-7095 |
return; |
1622 |
|
Thurallor-7095 |
end |
1623 |
|
Thurallor-7095 |
info.altIcon = resources.BlankIcons[sender:GetValue()]; |
1624 |
|
Thurallor-7095 |
UpdateIcon(); |
1625 |
|
Thurallor-7095 |
UpdateIconID(); |
1626 |
|
Thurallor-7095 |
self:UpdateBar(); |
1627 |
|
Thurallor-7095 |
self.settings.sequenceEditor.defaultIcon = info.altIcon; |
1628 |
|
Thurallor-7095 |
end |
1629 |
|
Thurallor-7095 |
slider3.ValueChanged = function(sender) |
1630 |
|
Thurallor-7095 |
if (not button3:IsChecked()) then |
1631 |
|
Thurallor-7095 |
button3:MouseClick(); |
1632 |
|
Thurallor-7095 |
return; |
1633 |
|
Thurallor-7095 |
end |
1634 |
|
Thurallor-7095 |
info.altIcon = self.skillIcons[sender:GetValue()]; |
1635 |
|
Thurallor-7095 |
UpdateIcon(); |
1636 |
|
Thurallor-7095 |
UpdateIconID(); |
1637 |
|
Thurallor-7095 |
self:UpdateBar(); |
1638 |
|
Thurallor-7095 |
self.settings.sequenceEditor.defaultIcon = info.altIcon; |
1639 |
|
Thurallor-7095 |
end |
1640 |
|
Thurallor-7095 |
function textBox.FocusGained() |
1641 |
|
Thurallor-7095 |
button4:MouseClick(); |
1642 |
|
Thurallor-7095 |
end |
1643 |
|
Thurallor-7095 |
textBox.TextChanged = function(sender) |
1644 |
|
Thurallor-7095 |
if (not button4:IsChecked()) then |
1645 |
|
Thurallor-7095 |
return; |
1646 |
|
Thurallor-7095 |
end |
1647 |
|
Thurallor-7095 |
local id = sender:GetText(); |
1648 |
|
Thurallor-7095 |
if (tonumber(id) ~= nil) then |
1649 |
|
Thurallor-7095 |
id = tonumber(id); |
1650 |
|
Thurallor-7095 |
end |
1651 |
|
Thurallor-7095 |
local valid = pcall(GetAssetSize, id); |
1652 |
|
Thurallor-7095 |
if (valid) then |
1653 |
|
Thurallor-7095 |
textBox:SetForeColor(Turbine.UI.Color.White); |
1654 |
|
Thurallor-7095 |
info.altIcon = id; |
1655 |
|
Thurallor-7095 |
UpdateIcon(); |
1656 |
|
Thurallor-7095 |
self:UpdateBar(); |
1657 |
|
Thurallor-7095 |
else |
1658 |
|
Thurallor-7095 |
textBox:SetForeColor(Turbine.UI.Color.Red); |
1659 |
|
Thurallor-7095 |
end |
1660 |
|
Thurallor-7095 |
end |
1661 |
2 |
Thurallor-7095 |
end |
1662 |
|
Thurallor-7095 |
|
1663 |
|
Thurallor-7095 |
self.slotProperties:SetHeight(top); |
1664 |
15 |
Thurallor-7095 |
self:SetMinimumHeight(top + 110); |
1665 |
2 |
Thurallor-7095 |
end |
1666 |
|
Thurallor-7095 |
|
1667 |
13 |
Thurallor-7095 |
function SequenceEditor:FindSlotAtPosition(x, y, drawCaret) |
1668 |
7 |
Thurallor-7095 |
local originX, originY = self.slotPanel:GetParent():PointToScreen(self.slotPanel:GetPosition()); |
1669 |
13 |
Thurallor-7095 |
local relX, relY = x - originX, y - originY + 3; |
1670 |
|
Thurallor-7095 |
local posX, posY = 1 + math.floor(relX / self.slotSize + 0.5), 1 + math.floor(relY / self.slotSize); |
1671 |
7 |
Thurallor-7095 |
local s = nil; |
1672 |
13 |
Thurallor-7095 |
if ((posX >= 1) and (posX <= self.slotsWide + 1) and (posY >= 1) and (posY <= self.slotsHigh)) then |
1673 |
7 |
Thurallor-7095 |
s = ((posY - 1) * self.slotsWide) + posX; |
1674 |
|
Thurallor-7095 |
end |
1675 |
13 |
Thurallor-7095 |
if ((posX == self.slotsWide + 1) and (posY == self.slotsHigh)) then |
1676 |
|
Thurallor-7095 |
s = nil; |
1677 |
|
Thurallor-7095 |
end |
1678 |
7 |
Thurallor-7095 |
|
1679 |
|
Thurallor-7095 |
-- Update caret position. |
1680 |
|
Thurallor-7095 |
if ((not drawCaret) or (not s)) then |
1681 |
|
Thurallor-7095 |
-- Hide carets in all Sequence Editors |
1682 |
|
Thurallor-7095 |
for editor in keys(SequenceEditor.instances) do |
1683 |
|
Thurallor-7095 |
if (editor.caret) then |
1684 |
|
Thurallor-7095 |
editor.caret:SetParent(nil); |
1685 |
|
Thurallor-7095 |
editor.caret = nil; |
1686 |
|
Thurallor-7095 |
end |
1687 |
|
Thurallor-7095 |
end |
1688 |
|
Thurallor-7095 |
else |
1689 |
|
Thurallor-7095 |
if (not self.caret) then |
1690 |
|
Thurallor-7095 |
self.caret = Turbine.UI.Control(); |
1691 |
|
Thurallor-7095 |
self.caret:SetParent(self.slotPanel); |
1692 |
|
Thurallor-7095 |
self.caret:SetBackground(resources.Icon.Caret); |
1693 |
|
Thurallor-7095 |
self.caret:SetBlendMode(Turbine.UI.BlendMode.AlphaBlend); |
1694 |
|
Thurallor-7095 |
self.caret:SetSize(3, 36) |
1695 |
|
Thurallor-7095 |
end |
1696 |
|
Thurallor-7095 |
self.caret:SetPosition((posX - 1) * self.slotSize, (posY - 1) * self.slotSize); |
1697 |
|
Thurallor-7095 |
end |
1698 |
|
Thurallor-7095 |
|
1699 |
|
Thurallor-7095 |
return s; |
1700 |
|
Thurallor-7095 |
end |
1701 |
|
Thurallor-7095 |
|
1702 |
13 |
Thurallor-7095 |
function SequenceEditor:FindForeignSlotAtPosition(x, y, drawCaret) |
1703 |
7 |
Thurallor-7095 |
|
1704 |
|
Thurallor-7095 |
-- Find the frontmost SequenceEditor under the mouse cursor |
1705 |
|
Thurallor-7095 |
local frontEditor = self; |
1706 |
|
Thurallor-7095 |
local maxZ = -2147483648; |
1707 |
|
Thurallor-7095 |
for editor in keys(SequenceEditor.instances) do |
1708 |
|
Thurallor-7095 |
if (editor ~= self) then |
1709 |
|
Thurallor-7095 |
local left, top = editor:GetPosition(); |
1710 |
|
Thurallor-7095 |
local width, height = editor:GetSize(); |
1711 |
13 |
Thurallor-7095 |
if ((x >= left) and (x <= left + width) and (y >= top) and (y <= top + height)) then |
1712 |
7 |
Thurallor-7095 |
if (editor:GetZOrder() >= maxZ) then |
1713 |
|
Thurallor-7095 |
frontEditor = editor; |
1714 |
|
Thurallor-7095 |
maxZ = editor:GetZOrder(); |
1715 |
|
Thurallor-7095 |
end |
1716 |
|
Thurallor-7095 |
end |
1717 |
|
Thurallor-7095 |
end |
1718 |
|
Thurallor-7095 |
end |
1719 |
|
Thurallor-7095 |
|
1720 |
13 |
Thurallor-7095 |
return frontEditor, frontEditor:FindSlotAtPosition(x, y, drawCaret); |
1721 |
7 |
Thurallor-7095 |
end |
1722 |
|
Thurallor-7095 |
|
1723 |
13 |
Thurallor-7095 |
function SequenceEditor:BuildSlot(slot, parent, object, left, top) |
1724 |
|
Thurallor-7095 |
--Puts("BuildSlot(" .. tostring(slot) .. ", " .. tostring(parent) .. ", " .. tostring(object) .. ", " .. tostring(left) .. ", " .. tostring(top)); |
1725 |
2 |
Thurallor-7095 |
|
1726 |
|
Thurallor-7095 |
-- Get slot info, or initialize to default |
1727 |
13 |
Thurallor-7095 |
local info = self.settings.sequenceItemInfo[slot]; |
1728 |
|
Thurallor-7095 |
if (object) then |
1729 |
|
Thurallor-7095 |
-- Reuse the existing object |
1730 |
|
Thurallor-7095 |
object:SetParent(parent); |
1731 |
|
Thurallor-7095 |
object:SetInfo(info); |
1732 |
|
Thurallor-7095 |
object:SetPosition(left, top); |
1733 |
|
Thurallor-7095 |
object:SetNumLabel(slot); |
1734 |
|
Thurallor-7095 |
return object; |
1735 |
2 |
Thurallor-7095 |
end |
1736 |
|
Thurallor-7095 |
|
1737 |
13 |
Thurallor-7095 |
-- Need to create a new object |
1738 |
|
Thurallor-7095 |
object = Slot(info); |
1739 |
|
Thurallor-7095 |
object:SetPosition(left, top); |
1740 |
|
Thurallor-7095 |
object:SetNumLabel(slot); |
1741 |
2 |
Thurallor-7095 |
object:SetParent(parent); |
1742 |
13 |
Thurallor-7095 |
object:SetActionEnabled(false); |
1743 |
|
Thurallor-7095 |
object:SetAllowDrop(true); |
1744 |
|
Thurallor-7095 |
object:SetDraggable(true); |
1745 |
2 |
Thurallor-7095 |
|
1746 |
7 |
Thurallor-7095 |
-- Desired mouse behaviors: |
1747 |
|
Thurallor-7095 |
-- Left-click selects the slot and shows its properties in the "Slot" tab. |
1748 |
|
Thurallor-7095 |
-- Right-click displays the settings menu. |
1749 |
|
Thurallor-7095 |
-- Left-button-drag initiates a drag-and-drop (move) operation. |
1750 |
2 |
Thurallor-7095 |
|
1751 |
13 |
Thurallor-7095 |
object.ShortcutChanged = function(sender, shortcutType, shortcutData) |
1752 |
|
Thurallor-7095 |
local s = sender:GetNumLabel(); |
1753 |
2 |
Thurallor-7095 |
self:ExtendSequenceTo(s); |
1754 |
13 |
Thurallor-7095 |
local info = sender:GetInfo(); |
1755 |
|
Thurallor-7095 |
self.settings.sequenceItemInfo[s] = info; |
1756 |
|
Thurallor-7095 |
|
1757 |
|
Thurallor-7095 |
if (shortcutType == Turbine.UI.Lotro.ShortcutType.Alias) then |
1758 |
7 |
Thurallor-7095 |
info.textOverlay = string.gsub(info.Data, "^/", ""); |
1759 |
|
Thurallor-7095 |
info.textOverlay = string.gsub(info.textOverlay, "%s.*$", ""); |
1760 |
|
Thurallor-7095 |
info.background = self.settings.sequenceEditor.defaultIcon; |
1761 |
13 |
Thurallor-7095 |
sender:SetInfo(info); |
1762 |
7 |
Thurallor-7095 |
end |
1763 |
13 |
Thurallor-7095 |
|
1764 |
16 |
Thurallor-7095 |
self:UpdateBar(); |
1765 |
122 |
Thurallor-7095 |
self:Redraw(); |
1766 |
2 |
Thurallor-7095 |
self:SelectSlot(s); |
1767 |
|
Thurallor-7095 |
end |
1768 |
|
Thurallor-7095 |
|
1769 |
13 |
Thurallor-7095 |
object.MouseClick = function(sender, args) |
1770 |
2 |
Thurallor-7095 |
-- Left-click selects the slot and shows its properties in the "Slot" tab. |
1771 |
|
Thurallor-7095 |
if (args.Button == Turbine.UI.MouseButton.Left) then |
1772 |
13 |
Thurallor-7095 |
self:SelectSlot(sender:GetNumLabel()); |
1773 |
2 |
Thurallor-7095 |
|
1774 |
|
Thurallor-7095 |
-- Right-click displays the settings menu. |
1775 |
|
Thurallor-7095 |
elseif (args.Button == Turbine.UI.MouseButton.Right) then |
1776 |
13 |
Thurallor-7095 |
self.clickedItem = sender:GetNumLabel(); |
1777 |
2 |
Thurallor-7095 |
self:ShowContextMenu(); |
1778 |
|
Thurallor-7095 |
end |
1779 |
|
Thurallor-7095 |
end |
1780 |
|
Thurallor-7095 |
|
1781 |
13 |
Thurallor-7095 |
object.DropPositionValid = function(sender, left, top) |
1782 |
|
Thurallor-7095 |
local s = sender:GetNumLabel(); |
1783 |
|
Thurallor-7095 |
|
1784 |
|
Thurallor-7095 |
-- Draw a "caret" showing where the slot will be inserted. |
1785 |
|
Thurallor-7095 |
local editor = self; |
1786 |
|
Thurallor-7095 |
local newSlot = self:FindSlotAtPosition(left, top, true); |
1787 |
|
Thurallor-7095 |
if (not newSlot) then |
1788 |
|
Thurallor-7095 |
editor, newSlot = self:FindForeignSlotAtPosition(left, top, true); |
1789 |
7 |
Thurallor-7095 |
end |
1790 |
13 |
Thurallor-7095 |
if ((editor == self) and ((newSlot == s) or (newSlot == s + 1))) then |
1791 |
|
Thurallor-7095 |
self:FindSlotAtPosition(0, 0, false); -- hide caret if returning to the same position |
1792 |
|
Thurallor-7095 |
end |
1793 |
|
Thurallor-7095 |
return newSlot; -- if newSlot is nil, a red "X" will be shown |
1794 |
7 |
Thurallor-7095 |
end |
1795 |
|
Thurallor-7095 |
|
1796 |
13 |
Thurallor-7095 |
object.DragDropComplete = function(sender, left, top) |
1797 |
|
Thurallor-7095 |
local s = sender:GetNumLabel(); |
1798 |
2 |
Thurallor-7095 |
|
1799 |
13 |
Thurallor-7095 |
-- Select destination slot. Hide the caret. |
1800 |
|
Thurallor-7095 |
local editor = self; |
1801 |
|
Thurallor-7095 |
local newSlot = self:FindSlotAtPosition(left, top, false); |
1802 |
|
Thurallor-7095 |
if (not newSlot) then |
1803 |
|
Thurallor-7095 |
editor, newSlot = self:FindForeignSlotAtPosition(left, top, false); |
1804 |
|
Thurallor-7095 |
end |
1805 |
|
Thurallor-7095 |
|
1806 |
|
Thurallor-7095 |
-- Do the move operation, and redraw. |
1807 |
|
Thurallor-7095 |
if (newSlot and (editor ~= self)) then |
1808 |
|
Thurallor-7095 |
editor:InsertSlot(newSlot, self.settings.sequenceItemInfo[s]); |
1809 |
|
Thurallor-7095 |
self:DeleteSlot(s); |
1810 |
|
Thurallor-7095 |
elseif (newSlot and (newSlot ~= s) and (newSlot ~= s + 1)) then |
1811 |
|
Thurallor-7095 |
self:MoveSlot(s, newSlot); |
1812 |
|
Thurallor-7095 |
else |
1813 |
|
Thurallor-7095 |
self:Redraw(); |
1814 |
|
Thurallor-7095 |
end |
1815 |
|
Thurallor-7095 |
end |
1816 |
|
Thurallor-7095 |
|
1817 |
2 |
Thurallor-7095 |
return object; |
1818 |
|
Thurallor-7095 |
end |
1819 |
|
Thurallor-7095 |
|
1820 |
7 |
Thurallor-7095 |
function SequenceEditor:RebuildSlot(s, x, y, alreadyDisplaying) |
1821 |
2 |
Thurallor-7095 |
local oldObject = self.sequenceItems[s]; |
1822 |
|
Thurallor-7095 |
|
1823 |
|
Thurallor-7095 |
-- If x and y aren't specified, then presumably the object has already been positioned previously |
1824 |
|
Thurallor-7095 |
if (x == nil) then |
1825 |
|
Thurallor-7095 |
x = oldObject.x; |
1826 |
|
Thurallor-7095 |
y = oldObject.y; |
1827 |
|
Thurallor-7095 |
end |
1828 |
|
Thurallor-7095 |
local left, top = self:GetSlotPosition(x, y); |
1829 |
|
Thurallor-7095 |
|
1830 |
|
Thurallor-7095 |
local newObject = self:BuildSlot(s, self.slotPanel, oldObject, left, top); |
1831 |
|
Thurallor-7095 |
newObject.x = x; |
1832 |
|
Thurallor-7095 |
newObject.y = y; |
1833 |
|
Thurallor-7095 |
self.sequenceItems[s] = newObject; |
1834 |
|
Thurallor-7095 |
|
1835 |
7 |
Thurallor-7095 |
if (not alreadyDisplaying and (self.selectedSlot == s)) then |
1836 |
2 |
Thurallor-7095 |
self:DisplaySlot(s); |
1837 |
|
Thurallor-7095 |
end |
1838 |
|
Thurallor-7095 |
end |
1839 |
|
Thurallor-7095 |
|
1840 |
|
Thurallor-7095 |
function SequenceEditor:SelectSlot(s) |
1841 |
13 |
Thurallor-7095 |
--Puts("SelectSlot(" .. tostring(s) .. "): self.selectedSlot = " .. tostring(self.selectedSlot)); |
1842 |
2 |
Thurallor-7095 |
if (self.selectedSlot) then |
1843 |
13 |
Thurallor-7095 |
local object = self.sequenceItems[self.selectedSlot]; |
1844 |
|
Thurallor-7095 |
object:SetSelected(false); |
1845 |
|
Thurallor-7095 |
local info = self.settings.sequenceItemInfo[self.selectedSlot]; |
1846 |
|
Thurallor-7095 |
if (info and (info.class == "Turbine.UI.Lotro.Quickslot") and (not info.type)) then |
1847 |
2 |
Thurallor-7095 |
-- Delete empty shortcut |
1848 |
13 |
Thurallor-7095 |
info.class = nil; |
1849 |
2 |
Thurallor-7095 |
end |
1850 |
|
Thurallor-7095 |
end |
1851 |
16 |
Thurallor-7095 |
for o = 1, #self.relatedSlots, 1 do |
1852 |
|
Thurallor-7095 |
local otherSlot, otherObject = unpack(self.relatedSlots[o]); |
1853 |
|
Thurallor-7095 |
otherObject:SetSelected(nil); |
1854 |
|
Thurallor-7095 |
self.relatedSlots[o] = nil; |
1855 |
|
Thurallor-7095 |
end |
1856 |
2 |
Thurallor-7095 |
if (s ~= nil) then |
1857 |
7 |
Thurallor-7095 |
local info = self.settings.sequenceItemInfo[s]; |
1858 |
13 |
Thurallor-7095 |
if ((not info) or (not info.class)) then |
1859 |
7 |
Thurallor-7095 |
s = nil; |
1860 |
|
Thurallor-7095 |
else |
1861 |
13 |
Thurallor-7095 |
local object = self.sequenceItems[s]; |
1862 |
|
Thurallor-7095 |
object:SetSelected(true); |
1863 |
16 |
Thurallor-7095 |
local sequence = self.bar:GetSequence(); |
1864 |
|
Thurallor-7095 |
local barObject = sequence:GetSlot(sequence:GetNewIndex(s)); |
1865 |
|
Thurallor-7095 |
if (barObject) then |
1866 |
|
Thurallor-7095 |
for otherSlot, _ in pairs({ifSlot = 1; elseSlot = 1; endIfSlot = 1}) do |
1867 |
|
Thurallor-7095 |
if (barObject[otherSlot]) then |
1868 |
|
Thurallor-7095 |
local otherObject = self.sequenceItems[sequence:GetOldIndex(barObject[otherSlot])]; |
1869 |
|
Thurallor-7095 |
otherObject:SetSelected(true, Turbine.UI.Color.Yellow); |
1870 |
|
Thurallor-7095 |
table.insert(self.relatedSlots, {otherSlot, otherObject}); |
1871 |
|
Thurallor-7095 |
end |
1872 |
|
Thurallor-7095 |
end |
1873 |
|
Thurallor-7095 |
end |
1874 |
7 |
Thurallor-7095 |
end |
1875 |
2 |
Thurallor-7095 |
end |
1876 |
|
Thurallor-7095 |
self.selectedSlot = s; |
1877 |
|
Thurallor-7095 |
self:DisplaySlot(s); |
1878 |
|
Thurallor-7095 |
end |
1879 |
|
Thurallor-7095 |
|
1880 |
|
Thurallor-7095 |
function SequenceEditor:GetSlotPosition(x, y) |
1881 |
|
Thurallor-7095 |
local left = (x - 1) * (self.settings.slotSize + self.settings.slotSpacing) - self.settings.slotSpacing; |
1882 |
|
Thurallor-7095 |
local top = (y - 1) * (self.settings.slotSize + self.settings.slotSpacing) - self.settings.slotSpacing; |
1883 |
|
Thurallor-7095 |
return left, top; |
1884 |
|
Thurallor-7095 |
end |
1885 |
|
Thurallor-7095 |
|
1886 |
|
Thurallor-7095 |
function SequenceEditor:Closing() |
1887 |
7 |
Thurallor-7095 |
SequenceEditor.instances[self] = nil; |
1888 |
2 |
Thurallor-7095 |
self:DeleteEmptyTrailingSlots(); |
1889 |
16 |
Thurallor-7095 |
self:UpdateBar(); |
1890 |
20 |
Thurallor-7095 |
if (self.ItemMovedCallback) then |
1891 |
|
Thurallor-7095 |
RemoveCallback(Thurallor.Utils.Watcher, "ItemMoved", self.ItemMovedCallback); |
1892 |
|
Thurallor-7095 |
self.ItemMovedCallback = nil; |
1893 |
|
Thurallor-7095 |
end |
1894 |
2 |
Thurallor-7095 |
end |
1895 |
|
Thurallor-7095 |
|
1896 |
|
Thurallor-7095 |
function SequenceEditor:Close() |
1897 |
|
Thurallor-7095 |
Turbine.UI.Lotro.Window.Close(self); |
1898 |
|
Thurallor-7095 |
end |
1899 |
|
Thurallor-7095 |
|
1900 |
|
Thurallor-7095 |
function SequenceEditor:ShowContextMenu() |
1901 |
|
Thurallor-7095 |
-- Build the settings menu. |
1902 |
18 |
Thurallor-7095 |
self.settingsMenu = Turbine.UI.ContextMenu(); |
1903 |
2 |
Thurallor-7095 |
local prevContext = L:SetContext("/SequenceEditor/RightClickMenu"); |
1904 |
200 |
Thurallor-7095 |
self:AddSettingsMenuItem(self.settingsMenu, "Root"); |
1905 |
2 |
Thurallor-7095 |
L:SetContext(prevContext); |
1906 |
|
Thurallor-7095 |
self.settingsMenu:ShowMenu(); |
1907 |
|
Thurallor-7095 |
end |
1908 |
|
Thurallor-7095 |
|
1909 |
|
Thurallor-7095 |
function SequenceEditor:AddSettingsMenuItem(parent, itemName) |
1910 |
|
Thurallor-7095 |
local item = Turbine.UI.MenuItem(L:GetText(itemName), true, false); |
1911 |
|
Thurallor-7095 |
parent:GetItems():Add(item); |
1912 |
|
Thurallor-7095 |
|
1913 |
|
Thurallor-7095 |
if (itemName == "Root") then |
1914 |
|
Thurallor-7095 |
parent:GetItems():Clear(); |
1915 |
34 |
Thurallor-7095 |
self:AddSettingsMenuItem(parent, "CreateSpecialSlot"); |
1916 |
|
Thurallor-7095 |
self:AddSettingsMenuItem(parent, "InsertEmptySlot"); |
1917 |
7 |
Thurallor-7095 |
self:AddSettingsMenuItem(parent, "CloneSlot"); |
1918 |
2 |
Thurallor-7095 |
self:AddSettingsMenuItem(parent, "DeleteSlot"); |
1919 |
7 |
Thurallor-7095 |
elseif (itemName == "CloneSlot") then |
1920 |
121 |
Thurallor-7095 |
item.Click = function() |
1921 |
7 |
Thurallor-7095 |
self:CloneSlot(self.clickedItem); |
1922 |
|
Thurallor-7095 |
end |
1923 |
2 |
Thurallor-7095 |
elseif (itemName == "InsertEmptySlot") then |
1924 |
121 |
Thurallor-7095 |
item.Click = function() |
1925 |
2 |
Thurallor-7095 |
self:InsertEmptySlot(self.clickedItem); |
1926 |
|
Thurallor-7095 |
end |
1927 |
|
Thurallor-7095 |
elseif (itemName == ("DeleteSlot")) then |
1928 |
121 |
Thurallor-7095 |
item.Click = function() |
1929 |
2 |
Thurallor-7095 |
self:DeleteSlot(self.clickedItem); |
1930 |
|
Thurallor-7095 |
end |
1931 |
|
Thurallor-7095 |
elseif (itemName == "CreateSpecialSlot") then |
1932 |
|
Thurallor-7095 |
local prevContext = L:SetContext("SpecialSlotMenu"); |
1933 |
34 |
Thurallor-7095 |
local texts = L:GetSortedTexts(); |
1934 |
|
Thurallor-7095 |
for i = 1, #texts, 1 do |
1935 |
|
Thurallor-7095 |
self:AddSettingsMenuItem(item, L:GetItem(texts[i])); |
1936 |
|
Thurallor-7095 |
end |
1937 |
2 |
Thurallor-7095 |
L:SetContext(prevContext); |
1938 |
199 |
Thurallor-7095 |
elseif (string.find("StopAnimating|Reset|GenerateEvent|SetUnequipDestination", itemName)) then |
1939 |
121 |
Thurallor-7095 |
item.Click = function() |
1940 |
2 |
Thurallor-7095 |
self:CreateCommandSlot(self.clickedItem, itemName, item:GetText()); |
1941 |
|
Thurallor-7095 |
end |
1942 |
7 |
Thurallor-7095 |
elseif (itemName == "ChatCommand") then |
1943 |
|
Thurallor-7095 |
local commands = Turbine.Shell.GetCommands(); |
1944 |
|
Thurallor-7095 |
local index = math.random(#commands); |
1945 |
121 |
Thurallor-7095 |
item.Click = function() |
1946 |
7 |
Thurallor-7095 |
self:CreateAliasSlot(self.clickedItem, "/" .. commands[index]); |
1947 |
|
Thurallor-7095 |
end |
1948 |
2 |
Thurallor-7095 |
elseif (itemName == "RemoveEquipment") then |
1949 |
121 |
Thurallor-7095 |
item.Click = function() |
1950 |
6 |
Thurallor-7095 |
self:CreateRemovalSlot(self.clickedItem, "Gloves"); |
1951 |
2 |
Thurallor-7095 |
end |
1952 |
16 |
Thurallor-7095 |
elseif ((itemName == "IfThen") or (itemName == "IfThenElse")) then |
1953 |
121 |
Thurallor-7095 |
item.Click = function() |
1954 |
16 |
Thurallor-7095 |
self:CreateConditional(self.clickedItem, itemName); |
1955 |
|
Thurallor-7095 |
end |
1956 |
|
Thurallor-7095 |
elseif (itemName == "Include") then |
1957 |
121 |
Thurallor-7095 |
item.Click = function() |
1958 |
16 |
Thurallor-7095 |
self:CreateIncludeSlot(self.clickedItem); |
1959 |
|
Thurallor-7095 |
end |
1960 |
34 |
Thurallor-7095 |
elseif (itemName == "Delay") then |
1961 |
121 |
Thurallor-7095 |
item.Click = function() |
1962 |
34 |
Thurallor-7095 |
self:CreateDelaySlot(self.clickedItem); |
1963 |
|
Thurallor-7095 |
end |
1964 |
135 |
Thurallor-7095 |
elseif (itemName == "SelectTarget") then |
1965 |
|
Thurallor-7095 |
item.Click = function() |
1966 |
|
Thurallor-7095 |
self:CreateSelectTargetSlot(self.clickedItem); |
1967 |
|
Thurallor-7095 |
end |
1968 |
157 |
Thurallor-7095 |
elseif (itemName == "SaveTarget") then |
1969 |
|
Thurallor-7095 |
item.Click = function() |
1970 |
|
Thurallor-7095 |
self:CreateSaveTargetSlot(self.clickedItem); |
1971 |
|
Thurallor-7095 |
end |
1972 |
146 |
Thurallor-7095 |
elseif (itemName == "LuaScript") then |
1973 |
|
Thurallor-7095 |
item.Click = function() |
1974 |
|
Thurallor-7095 |
self:CreateLuaScriptSlot(self.clickedItem); |
1975 |
|
Thurallor-7095 |
end |
1976 |
2 |
Thurallor-7095 |
end |
1977 |
|
Thurallor-7095 |
end |
1978 |
|
Thurallor-7095 |
|
1979 |
7 |
Thurallor-7095 |
function SequenceEditor:CreateAliasSlot(s, command) |
1980 |
34 |
Thurallor-7095 |
self:InsertEmptySlot(s); |
1981 |
7 |
Thurallor-7095 |
local info = self.settings.sequenceItemInfo[s]; |
1982 |
|
Thurallor-7095 |
info.class = "Turbine.UI.Lotro.Quickslot"; |
1983 |
|
Thurallor-7095 |
info.background = nil; |
1984 |
|
Thurallor-7095 |
info.type = Turbine.UI.Lotro.ShortcutType.Alias; |
1985 |
|
Thurallor-7095 |
info.Data = command; |
1986 |
34 |
Thurallor-7095 |
info.altIcon = self.settings.sequenceEditor.defaultIcon; |
1987 |
16 |
Thurallor-7095 |
if (info.background) then |
1988 |
|
Thurallor-7095 |
info.textOverlay = string.gsub(info.Data, "^/", ""); |
1989 |
|
Thurallor-7095 |
info.textOverlay = string.gsub(info.textOverlay, "%s.*$", ""); |
1990 |
|
Thurallor-7095 |
end |
1991 |
7 |
Thurallor-7095 |
self:RebuildSlot(s); |
1992 |
16 |
Thurallor-7095 |
self:UpdateBar(); |
1993 |
7 |
Thurallor-7095 |
self:Redraw(); |
1994 |
|
Thurallor-7095 |
self:SelectSlot(s); |
1995 |
|
Thurallor-7095 |
end |
1996 |
|
Thurallor-7095 |
|
1997 |
34 |
Thurallor-7095 |
function SequenceEditor:CreateDelaySlot(s) |
1998 |
|
Thurallor-7095 |
self:InsertEmptySlot(s); |
1999 |
|
Thurallor-7095 |
local info = self.settings.sequenceItemInfo[s]; |
2000 |
|
Thurallor-7095 |
info.class = "Turbine.UI.Control"; |
2001 |
|
Thurallor-7095 |
info.background = resources.Icon.Clock; |
2002 |
|
Thurallor-7095 |
info.altIcon = nil; |
2003 |
|
Thurallor-7095 |
info.type = "Delay"; |
2004 |
|
Thurallor-7095 |
info.toolTip = L:GetText("/SequenceEditor/RightClickMenu/SpecialSlotMenu/Delay"); |
2005 |
|
Thurallor-7095 |
info.delay = 0.25; |
2006 |
147 |
Thurallor-7095 |
info.action = "local item, s = ...; item.bar:StartSlotCooldown(s, " .. tostring(info.delay):gsub(",", ".") .. ");"; |
2007 |
34 |
Thurallor-7095 |
info.advanceEvent = "DelayComplete"; |
2008 |
|
Thurallor-7095 |
|
2009 |
|
Thurallor-7095 |
self:RebuildSlot(s); |
2010 |
|
Thurallor-7095 |
self:UpdateBar(); |
2011 |
|
Thurallor-7095 |
self:Redraw(); |
2012 |
|
Thurallor-7095 |
self:SelectSlot(s); |
2013 |
|
Thurallor-7095 |
end |
2014 |
|
Thurallor-7095 |
|
2015 |
135 |
Thurallor-7095 |
function SequenceEditor:CreateSelectTargetSlot(s) |
2016 |
|
Thurallor-7095 |
self:InsertEmptySlot(s); |
2017 |
|
Thurallor-7095 |
local info = self.settings.sequenceItemInfo[s]; |
2018 |
|
Thurallor-7095 |
info.class = "Turbine.UI.Lotro.EntityControl"; |
2019 |
|
Thurallor-7095 |
info.altIcon = nil; |
2020 |
|
Thurallor-7095 |
info.type = "SelectTarget"; |
2021 |
|
Thurallor-7095 |
info.toolTip = L:GetText("/SequenceEditor/RightClickMenu/SpecialSlotMenu/SelectTarget"); |
2022 |
|
Thurallor-7095 |
info.target = "Self"; |
2023 |
|
Thurallor-7095 |
info.getTargetFunc = "local _, player = ...; return player;"; |
2024 |
|
Thurallor-7095 |
|
2025 |
|
Thurallor-7095 |
self:RebuildSlot(s); |
2026 |
|
Thurallor-7095 |
self:UpdateBar(); |
2027 |
|
Thurallor-7095 |
self:Redraw(); |
2028 |
|
Thurallor-7095 |
self:SelectSlot(s); |
2029 |
|
Thurallor-7095 |
|
2030 |
|
Thurallor-7095 |
end |
2031 |
|
Thurallor-7095 |
|
2032 |
157 |
Thurallor-7095 |
function SequenceEditor:CreateSaveTargetSlot(s) |
2033 |
|
Thurallor-7095 |
self:InsertEmptySlot(s); |
2034 |
|
Thurallor-7095 |
local info = self.settings.sequenceItemInfo[s]; |
2035 |
|
Thurallor-7095 |
info.class = "Turbine.UI.Control"; |
2036 |
|
Thurallor-7095 |
info.background = resources.Icon.SaveTarget; |
2037 |
|
Thurallor-7095 |
info.altIcon = nil; |
2038 |
|
Thurallor-7095 |
info.type = "SaveTarget"; |
2039 |
|
Thurallor-7095 |
info.toolTip = L:GetText("/SequenceEditor/RightClickMenu/SpecialSlotMenu/SaveTarget"); |
2040 |
|
Thurallor-7095 |
info.number = 1; |
2041 |
|
Thurallor-7095 |
info.action = "Thurallor.Utils.Watcher.SaveTarget(1);"; |
2042 |
|
Thurallor-7095 |
|
2043 |
|
Thurallor-7095 |
self:RebuildSlot(s); |
2044 |
|
Thurallor-7095 |
self:UpdateBar(); |
2045 |
|
Thurallor-7095 |
self:Redraw(); |
2046 |
|
Thurallor-7095 |
self:SelectSlot(s); |
2047 |
|
Thurallor-7095 |
|
2048 |
|
Thurallor-7095 |
end |
2049 |
|
Thurallor-7095 |
|
2050 |
16 |
Thurallor-7095 |
function SequenceEditor:CreateIncludeSlot(s) |
2051 |
34 |
Thurallor-7095 |
self:InsertEmptySlot(s); |
2052 |
16 |
Thurallor-7095 |
local info = self.settings.sequenceItemInfo[s]; |
2053 |
|
Thurallor-7095 |
info.class = "Turbine.UI.Control"; |
2054 |
|
Thurallor-7095 |
info.background = resources.Icon.Include; |
2055 |
34 |
Thurallor-7095 |
info.altIcon = nil; |
2056 |
16 |
Thurallor-7095 |
info.type = "Include"; |
2057 |
|
Thurallor-7095 |
info.toolTip = L:GetText("/SequenceEditor/RightClickMenu/SpecialSlotMenu/Include"); |
2058 |
|
Thurallor-7095 |
|
2059 |
|
Thurallor-7095 |
self:RebuildSlot(s); |
2060 |
|
Thurallor-7095 |
self:UpdateBar(); |
2061 |
|
Thurallor-7095 |
self:Redraw(); |
2062 |
|
Thurallor-7095 |
self:SelectSlot(s); |
2063 |
|
Thurallor-7095 |
end |
2064 |
7 |
Thurallor-7095 |
|
2065 |
146 |
Thurallor-7095 |
function SequenceEditor:CreateLuaScriptSlot(s) |
2066 |
|
Thurallor-7095 |
self:InsertEmptySlot(s); |
2067 |
|
Thurallor-7095 |
local info = self.settings.sequenceItemInfo[s]; |
2068 |
|
Thurallor-7095 |
info.class = "Turbine.UI.Control"; |
2069 |
|
Thurallor-7095 |
info.background = resources.Icon.LuaScript; |
2070 |
|
Thurallor-7095 |
info.altIcon = nil; |
2071 |
|
Thurallor-7095 |
info.type = "LuaScript"; |
2072 |
|
Thurallor-7095 |
info.toolTip = L:GetText("/SequenceEditor/RightClickMenu/SpecialSlotMenu/LuaScript"); |
2073 |
|
Thurallor-7095 |
info.action = "Turbine.Shell.WriteLine(\"Hello, world!\");"; |
2074 |
|
Thurallor-7095 |
|
2075 |
|
Thurallor-7095 |
self:RebuildSlot(s); |
2076 |
|
Thurallor-7095 |
self:UpdateBar(); |
2077 |
|
Thurallor-7095 |
self:Redraw(); |
2078 |
|
Thurallor-7095 |
self:SelectSlot(s); |
2079 |
|
Thurallor-7095 |
end |
2080 |
|
Thurallor-7095 |
|
2081 |
20 |
Thurallor-7095 |
function SequenceEditor:UnlinkIncludedSequence(s) |
2082 |
|
Thurallor-7095 |
local info = self.settings.sequenceItemInfo[s]; |
2083 |
|
Thurallor-7095 |
if (not info.include) then |
2084 |
|
Thurallor-7095 |
return; |
2085 |
|
Thurallor-7095 |
end |
2086 |
|
Thurallor-7095 |
local otherSequenceSettings = self.globals.bars[info.include]; |
2087 |
|
Thurallor-7095 |
if (not otherSequenceSettings) then |
2088 |
|
Thurallor-7095 |
return; |
2089 |
|
Thurallor-7095 |
end |
2090 |
|
Thurallor-7095 |
local otherItemInfo = otherSequenceSettings.sequenceItemInfo; |
2091 |
|
Thurallor-7095 |
self:DeleteSlot(s); |
2092 |
|
Thurallor-7095 |
for i = 1, #otherItemInfo, 1 do |
2093 |
|
Thurallor-7095 |
if (otherItemInfo[i].class) then |
2094 |
|
Thurallor-7095 |
table.insert(self.settings.sequenceItemInfo, s + i - 1, {}); |
2095 |
|
Thurallor-7095 |
DeepTableCopy(otherItemInfo[i], self.settings.sequenceItemInfo[s + i - 1]); |
2096 |
|
Thurallor-7095 |
end |
2097 |
|
Thurallor-7095 |
end |
2098 |
|
Thurallor-7095 |
self:Redraw(); |
2099 |
|
Thurallor-7095 |
self:SelectSlot(s); |
2100 |
|
Thurallor-7095 |
end |
2101 |
|
Thurallor-7095 |
|
2102 |
16 |
Thurallor-7095 |
function SequenceEditor:CreateConditional(s, condType) |
2103 |
34 |
Thurallor-7095 |
local prevContext = L:SetContext("/SequenceEditor"); |
2104 |
16 |
Thurallor-7095 |
local ifSlot = s; |
2105 |
46 |
Thurallor-7095 |
self.noRedraw = true; |
2106 |
20 |
Thurallor-7095 |
self:InsertEmptySlot(s); |
2107 |
16 |
Thurallor-7095 |
if (condType == "IfThenElse") then |
2108 |
20 |
Thurallor-7095 |
self:InsertEmptySlot(s); |
2109 |
16 |
Thurallor-7095 |
end |
2110 |
20 |
Thurallor-7095 |
self:InsertEmptySlot(s); |
2111 |
16 |
Thurallor-7095 |
local info = self.settings.sequenceItemInfo[s]; |
2112 |
|
Thurallor-7095 |
info.class = "Turbine.UI.Control"; |
2113 |
|
Thurallor-7095 |
info.background = resources.Icon["If"]; |
2114 |
34 |
Thurallor-7095 |
info.altIcon = nil; |
2115 |
16 |
Thurallor-7095 |
info.type = "If"; |
2116 |
|
Thurallor-7095 |
info.condName = "Always"; |
2117 |
|
Thurallor-7095 |
info.condExpr = "return true;"; |
2118 |
|
Thurallor-7095 |
info.toolTip = L:GetText("If"); |
2119 |
|
Thurallor-7095 |
info.automatic = true; |
2120 |
|
Thurallor-7095 |
if (condType == "IfThenElse") then |
2121 |
|
Thurallor-7095 |
s = s + 1; |
2122 |
|
Thurallor-7095 |
info = self.settings.sequenceItemInfo[s]; |
2123 |
|
Thurallor-7095 |
info.class = "Turbine.UI.Control"; |
2124 |
|
Thurallor-7095 |
info.background = resources.Icon["Else"]; |
2125 |
34 |
Thurallor-7095 |
info.altIcon = nil; |
2126 |
16 |
Thurallor-7095 |
info.type = "Else"; |
2127 |
|
Thurallor-7095 |
info.toolTip = L:GetText("Else"); |
2128 |
|
Thurallor-7095 |
info.automatic = true; |
2129 |
|
Thurallor-7095 |
end |
2130 |
|
Thurallor-7095 |
s = s + 1; |
2131 |
|
Thurallor-7095 |
info = self.settings.sequenceItemInfo[s]; |
2132 |
|
Thurallor-7095 |
info.class = "Turbine.UI.Control"; |
2133 |
|
Thurallor-7095 |
info.background = resources.Icon["EndIf"]; |
2134 |
34 |
Thurallor-7095 |
info.altIcon = nil; |
2135 |
16 |
Thurallor-7095 |
info.type = "EndIf"; |
2136 |
|
Thurallor-7095 |
info.toolTip = L:GetText("EndIf"); |
2137 |
|
Thurallor-7095 |
info.automatic = true; |
2138 |
46 |
Thurallor-7095 |
self.noRedraw = false; |
2139 |
16 |
Thurallor-7095 |
self:Redraw(); |
2140 |
|
Thurallor-7095 |
self:UpdateBar(); |
2141 |
|
Thurallor-7095 |
self:SelectSlot(ifSlot); |
2142 |
|
Thurallor-7095 |
L:SetContext(prevContext); |
2143 |
|
Thurallor-7095 |
end |
2144 |
|
Thurallor-7095 |
|
2145 |
2 |
Thurallor-7095 |
function SequenceEditor:CreateCommandSlot(s, slotName, toolTip) |
2146 |
34 |
Thurallor-7095 |
self:InsertEmptySlot(s); |
2147 |
2 |
Thurallor-7095 |
local info = self.settings.sequenceItemInfo[s]; |
2148 |
|
Thurallor-7095 |
info.class = "Turbine.UI.Control"; |
2149 |
|
Thurallor-7095 |
info.background = resources.Icon[slotName]; |
2150 |
34 |
Thurallor-7095 |
info.altIcon = nil; |
2151 |
2 |
Thurallor-7095 |
if (slotName == "StopAnimating") then |
2152 |
43 |
Thurallor-7095 |
info.action = "local item = ...; item.bar.animationStopped = true; "; |
2153 |
199 |
Thurallor-7095 |
elseif (slotName == "Reset") then |
2154 |
|
Thurallor-7095 |
-- Nothing to do here. Handled in Bar:SlotClick(). |
2155 |
2 |
Thurallor-7095 |
elseif (slotName == "GenerateEvent") then |
2156 |
32 |
Thurallor-7095 |
info.eventName = L:GetText("/SequenceEditor/NewEvent"); |
2157 |
34 |
Thurallor-7095 |
info.action = "local item = ...; item.bar.manager:PropagateEvent(item.info.eventName);"; |
2158 |
6 |
Thurallor-7095 |
elseif (slotName == "SetUnequipDestination") then |
2159 |
|
Thurallor-7095 |
info.bagSlot = 1; |
2160 |
34 |
Thurallor-7095 |
info.action = "local item = ...; item.bar.manager:SetUnequipDestination(item.info.bagSlot);"; |
2161 |
2 |
Thurallor-7095 |
end |
2162 |
|
Thurallor-7095 |
info.type = slotName; |
2163 |
|
Thurallor-7095 |
info.toolTip = toolTip; |
2164 |
|
Thurallor-7095 |
self:RebuildSlot(s); |
2165 |
16 |
Thurallor-7095 |
self:UpdateBar(); |
2166 |
2 |
Thurallor-7095 |
self:Redraw(); |
2167 |
|
Thurallor-7095 |
self:SelectSlot(s); |
2168 |
|
Thurallor-7095 |
end |
2169 |
|
Thurallor-7095 |
|
2170 |
6 |
Thurallor-7095 |
function SequenceEditor:CreateRemovalSlot(s, eqSlotName, bagSlot) |
2171 |
34 |
Thurallor-7095 |
self:InsertEmptySlot(s); |
2172 |
2 |
Thurallor-7095 |
local info = self.settings.sequenceItemInfo[s]; |
2173 |
|
Thurallor-7095 |
info.class = "Turbine.UI.Control"; |
2174 |
6 |
Thurallor-7095 |
info.background = resources.Icon["Unequip" .. eqSlotName]; |
2175 |
34 |
Thurallor-7095 |
info.altIcon = nil; |
2176 |
|
Thurallor-7095 |
info.action = "local item = ...; item.bar.manager:Unequip(Turbine.Gameplay.Equipment." .. eqSlotName .. ");"; |
2177 |
6 |
Thurallor-7095 |
info.type = "Remove " .. eqSlotName; |
2178 |
|
Thurallor-7095 |
|
2179 |
|
Thurallor-7095 |
local prevContext = L:SetContext("/SequenceEditor"); |
2180 |
|
Thurallor-7095 |
local toolTip = L:GetText("RemoveItem"); |
2181 |
|
Thurallor-7095 |
L:SetContext("EquipmentSlots"); |
2182 |
|
Thurallor-7095 |
local localEqSlotName = L:GetText(eqSlotName); |
2183 |
|
Thurallor-7095 |
info.toolTip = string.gsub(toolTip, "<item>", localEqSlotName); |
2184 |
|
Thurallor-7095 |
L:SetContext(prevContext); |
2185 |
|
Thurallor-7095 |
|
2186 |
2 |
Thurallor-7095 |
self:RebuildSlot(s); |
2187 |
16 |
Thurallor-7095 |
self:UpdateBar(); |
2188 |
2 |
Thurallor-7095 |
self:Redraw(); |
2189 |
|
Thurallor-7095 |
self:SelectSlot(s); |
2190 |
|
Thurallor-7095 |
end |
2191 |
|
Thurallor-7095 |
|
2192 |
|
Thurallor-7095 |
function SequenceEditor:ExtendSequenceTo(s) |
2193 |
|
Thurallor-7095 |
if (s <= #self.settings.sequenceItemInfo) then |
2194 |
|
Thurallor-7095 |
return false; |
2195 |
|
Thurallor-7095 |
end |
2196 |
|
Thurallor-7095 |
while (s > #self.settings.sequenceItemInfo) do |
2197 |
|
Thurallor-7095 |
table.insert(self.settings.sequenceItemInfo, {}); |
2198 |
|
Thurallor-7095 |
end |
2199 |
|
Thurallor-7095 |
return true; |
2200 |
|
Thurallor-7095 |
end |
2201 |
|
Thurallor-7095 |
|
2202 |
|
Thurallor-7095 |
function SequenceEditor:DeleteEmptyTrailingSlots() |
2203 |
|
Thurallor-7095 |
local sequenceItemInfo = self.settings.sequenceItemInfo; |
2204 |
|
Thurallor-7095 |
for s = #sequenceItemInfo, 1, -1 do |
2205 |
|
Thurallor-7095 |
local info = sequenceItemInfo[s]; |
2206 |
|
Thurallor-7095 |
if (not info.class) then |
2207 |
|
Thurallor-7095 |
table.remove(sequenceItemInfo, s); |
2208 |
5 |
Thurallor-7095 |
-- Remove empty slot displays |
2209 |
|
Thurallor-7095 |
if (self.sequenceItems) then |
2210 |
|
Thurallor-7095 |
local object = self.sequenceItems[s]; |
2211 |
|
Thurallor-7095 |
if (object) then |
2212 |
|
Thurallor-7095 |
if (object.numLabel) then |
2213 |
|
Thurallor-7095 |
object.numLabel:SetParent(nil); |
2214 |
|
Thurallor-7095 |
end |
2215 |
|
Thurallor-7095 |
object:SetParent(nil); |
2216 |
|
Thurallor-7095 |
self.sequenceItems[s] = nil; |
2217 |
|
Thurallor-7095 |
end |
2218 |
|
Thurallor-7095 |
end |
2219 |
2 |
Thurallor-7095 |
else |
2220 |
|
Thurallor-7095 |
break; |
2221 |
|
Thurallor-7095 |
end |
2222 |
|
Thurallor-7095 |
end |
2223 |
|
Thurallor-7095 |
end |
2224 |
|
Thurallor-7095 |
|
2225 |
7 |
Thurallor-7095 |
function SequenceEditor:CloneSlot(s) |
2226 |
|
Thurallor-7095 |
self:InsertEmptySlot(s); |
2227 |
|
Thurallor-7095 |
DeepTableCopy(self.settings.sequenceItemInfo[s + 1], self.settings.sequenceItemInfo[s]); |
2228 |
|
Thurallor-7095 |
self:RebuildSlot(s); |
2229 |
16 |
Thurallor-7095 |
self:UpdateBar(); |
2230 |
7 |
Thurallor-7095 |
self:Redraw(); |
2231 |
|
Thurallor-7095 |
self:SelectSlot(s); |
2232 |
|
Thurallor-7095 |
end |
2233 |
|
Thurallor-7095 |
|
2234 |
|
Thurallor-7095 |
function SequenceEditor:MoveSlot(sourceSlot, destSlot) |
2235 |
|
Thurallor-7095 |
self:InsertEmptySlot(destSlot); |
2236 |
|
Thurallor-7095 |
if (sourceSlot >= destSlot) then |
2237 |
|
Thurallor-7095 |
sourceSlot = sourceSlot + 1; |
2238 |
|
Thurallor-7095 |
end |
2239 |
|
Thurallor-7095 |
DeepTableCopy(self.settings.sequenceItemInfo[sourceSlot], self.settings.sequenceItemInfo[destSlot]); |
2240 |
|
Thurallor-7095 |
self:RebuildSlot(destSlot); |
2241 |
|
Thurallor-7095 |
self:DeleteSlot(sourceSlot); |
2242 |
|
Thurallor-7095 |
if (sourceSlot <= destSlot) then |
2243 |
|
Thurallor-7095 |
destSlot = destSlot - 1; |
2244 |
|
Thurallor-7095 |
end |
2245 |
16 |
Thurallor-7095 |
self:UpdateBar(); |
2246 |
7 |
Thurallor-7095 |
self:Redraw(); |
2247 |
|
Thurallor-7095 |
self:SelectSlot(destSlot); |
2248 |
|
Thurallor-7095 |
end |
2249 |
|
Thurallor-7095 |
|
2250 |
|
Thurallor-7095 |
function SequenceEditor:InsertSlot(s, info) |
2251 |
2 |
Thurallor-7095 |
if (s > #self.settings.sequenceItemInfo) then |
2252 |
|
Thurallor-7095 |
self:ExtendSequenceTo(s); |
2253 |
|
Thurallor-7095 |
else |
2254 |
|
Thurallor-7095 |
table.insert(self.settings.sequenceItemInfo, s, {}); |
2255 |
|
Thurallor-7095 |
end |
2256 |
7 |
Thurallor-7095 |
if (info) then |
2257 |
|
Thurallor-7095 |
DeepTableCopy(info, self.settings.sequenceItemInfo[s]); |
2258 |
|
Thurallor-7095 |
end |
2259 |
2 |
Thurallor-7095 |
self:Redraw(); |
2260 |
16 |
Thurallor-7095 |
self:UpdateBar(); |
2261 |
2 |
Thurallor-7095 |
self:SelectSlot(s); |
2262 |
|
Thurallor-7095 |
end |
2263 |
|
Thurallor-7095 |
|
2264 |
7 |
Thurallor-7095 |
function SequenceEditor:InsertEmptySlot(s) |
2265 |
|
Thurallor-7095 |
self:InsertSlot(s, nil); |
2266 |
|
Thurallor-7095 |
end |
2267 |
|
Thurallor-7095 |
|
2268 |
2 |
Thurallor-7095 |
function SequenceEditor:DeleteSlot(s) |
2269 |
|
Thurallor-7095 |
table.remove(self.settings.sequenceItemInfo, s); |
2270 |
|
Thurallor-7095 |
self:Redraw(); |
2271 |
16 |
Thurallor-7095 |
self:UpdateBar(); |
2272 |
2 |
Thurallor-7095 |
self:ExtendSequenceTo(s); |
2273 |
|
Thurallor-7095 |
self:SelectSlot(nil); |
2274 |
|
Thurallor-7095 |
end |