vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | --[[ |
2 | |||
3 | SKMap Lua file |
||
4 | ]] |
||
5 | |||
6 | -- Configuration variables |
||
7 | |||
8 | -- Local variables |
||
9 | -- any variables declared local will not be available for use outside this module |
||
10 | |||
11 | SKM_VERSION = "1.6"; |
||
12 | SKM_LOADED_MSG = "SKMap "..SKM_VERSION.." AddOn loaded" |
||
13 | |||
14 | SKM_TITLE = "SKMap "..SKM_VERSION; |
||
15 | |||
16 | |||
17 | |||
18 | StaticPopupDialogs["SKMAP_CONFIRM"] = { |
||
19 | button1 = TEXT(OKAY), |
||
20 | button2 = TEXT(CANCEL), |
||
21 | OnShow = nil, |
||
22 | OnAccept = nil, |
||
23 | OnCancel = function() SKMap_DeleteButton_Cancel() end, |
||
24 | hasMoneyFrame = nil, |
||
25 | showAlert = 1, |
||
26 | exclusive = 1, |
||
27 | whileDead = 1, |
||
28 | interruptCinematic = 1, |
||
29 | timeout = 0 |
||
30 | }; |
||
31 | |||
32 | |||
33 | -- complete list of recorded global settings |
||
34 | SKM_OPTION_LIST = { |
||
35 | "ShowTargetInfo", |
||
36 | "SmallTargetInfo", |
||
37 | "WarSoundWarning", |
||
38 | "WarFloatingMessage", |
||
39 | "WarAutoTarget", |
||
40 | "RecordPlayerKill", |
||
41 | "RecordCreatureKill", |
||
42 | "RecordPlayerDeath", |
||
43 | "DisplayKillRecord", |
||
44 | "DisplayCreatureKillRecord", |
||
45 | "DisplayDeathRecord", |
||
46 | "MapDisplayRecords", |
||
47 | "CreatureKillRecordsByZone", |
||
48 | "IgnoreLowerEnemies", |
||
49 | "IgnoreLevelThreshold", |
||
50 | "ShowTargetGuildInfo", |
||
51 | "ShowTargetClassInfo", |
||
52 | "ShowWorldMapControl", |
||
53 | "ShowMinimapButton", |
||
54 | "MinimapButtonPosition", |
||
55 | "MinimapButtonOffset", |
||
56 | "IgnoreNoPvPFlag", |
||
57 | "StoreEnemyPlayers", |
||
58 | "StoreDuels", |
||
59 | "AssistKillStat", |
||
60 | "LockedTargetInfo", |
||
61 | "TooltipTargetInfo", |
||
62 | "WarEnableFilter", |
||
63 | "WarFilterDelay", |
||
64 | "WarChatMessage", |
||
65 | "WarShowNote", |
||
66 | "DataCleanUp", |
||
67 | "DataCleanUpInterval", |
||
68 | "CleanInactiveEnemies", |
||
69 | "CleanInactiveEnemiesDelay", |
||
70 | "SharedWarMode", |
||
71 | "TooltipPlayerNote", |
||
72 | "EnemyListAutoUpdate", |
||
73 | "EnemyListAutoUpdateDelay", |
||
74 | "CleanEmptyGuilds", |
||
75 | "RecordPlayerDeathNonPvP", |
||
76 | "ReportPlayerDeath", |
||
77 | "EnemyList_SortType", |
||
78 | "EnemyList_SortTypes", |
||
79 | "EnemyList_ReverseSort", |
||
80 | "GuildList_SortType", |
||
81 | "GuildList_SortTypes", |
||
82 | "GuildList_ReverseSort", |
||
83 | "DuelList_SortType", |
||
84 | "DuelList_SortTypes", |
||
85 | "DuelList_ReverseSort" |
||
86 | }; |
||
87 | |||
88 | |||
89 | |||
90 | |||
91 | SKM_MAX_CREEP_RECORD_BY_ZONE = 100; |
||
92 | |||
93 | |||
94 | local SKM_TAB_SUBFRAMES = { "SKMap_ListFrame", "SKMap_DuelFrame", "SKMap_ReportFrame", "SKMap_OptionsFrame" }; |
||
95 | |||
96 | local SKM_OptionsFrameCheckButtons = { |
||
97 | [1] = { Option = "ShowTargetInfo", Text = SKM_UI_STRINGS.Options_Check_ShowTargetInfo, Tooltip = SKM_UI_STRINGS.Options_Tooltip_ShowTargetInfo }; |
||
98 | [2] = { Option = "SmallTargetInfo", Text = SKM_UI_STRINGS.Options_Button_SmallTargetInfo, Tooltip = SKM_UI_STRINGS.Options_Tooltip_SmallTargetInfo }; |
||
99 | [3] = { Option = "MapDisplayRecords", Text = SKM_UI_STRINGS.Options_Button_MapDisplayRecords, Tooltip = SKM_UI_STRINGS.Options_Tooltip_MapDisplayRecords }; |
||
100 | [4] = { Option = "WarSoundWarning", Text = SKM_UI_STRINGS.Options_Button_WarSoundWarning, Tooltip = SKM_UI_STRINGS.Options_Tooltip_WarSoundWarning }; |
||
101 | [5] = { Option = "WarFloatingMessage", Text = SKM_UI_STRINGS.Options_Button_WarFloatingMessage, Tooltip = SKM_UI_STRINGS.Options_Tooltip_WarFloatingMessage }; |
||
102 | [6] = { Option = "WarAutoTarget", Text = SKM_UI_STRINGS.Options_Button_WarAutoTarget, Tooltip = SKM_UI_STRINGS.Options_Tooltip_WarAutoTarget }; |
||
103 | [7] = { Option = "RecordPlayerDeath", Text = SKM_UI_STRINGS.Options_Button_RecordPlayerDeath, Tooltip = SKM_UI_STRINGS.Options_Tooltip_RecordPlayerDeath }; |
||
104 | [8] = { Option = "DisplayDeathRecord", Text = SKM_UI_STRINGS.Options_Button_DisplayDeathRecord, Tooltip = SKM_UI_STRINGS.Options_Tooltip_DisplayDeathRecord }; |
||
105 | [9] = { Option = "RecordPlayerKill", Text = SKM_UI_STRINGS.Options_Button_RecordPlayerKill, Tooltip = SKM_UI_STRINGS.Options_Tooltip_RecordPlayerKill }; |
||
106 | [10] = { Option = "DisplayKillRecord", Text = SKM_UI_STRINGS.Options_Button_DisplayKillRecord, Tooltip = SKM_UI_STRINGS.Options_Tooltip_DisplayKillRecord }; |
||
107 | [11] = { Option = "RecordCreatureKill", Text = SKM_UI_STRINGS.Options_Button_RecordCreatureKill, Tooltip = SKM_UI_STRINGS.Options_Tooltip_RecordCreatureKill }; |
||
108 | [12] = { Option = "DisplayCreatureKillRecord", Text = SKM_UI_STRINGS.Options_Button_DisplayCreatureKillRecord, Tooltip = SKM_UI_STRINGS.Options_Tooltip_DisplayCreatureKillRecord }; |
||
109 | [13] = { Option = "IgnoreLowerEnemies", Text = SKM_UI_STRINGS.Options_Button_IgnoreLowerEnemies, Tooltip = SKM_UI_STRINGS.Options_Tooltip_IgnoreLowerEnemies }; |
||
110 | [14] = { Option = "ShowTargetGuildInfo", Text = SKM_UI_STRINGS.Options_Button_ShowTargetGuildInfo, Tooltip = SKM_UI_STRINGS.Options_Tooltip_ShowTargetGuildInfo }; |
||
111 | [15] = { Option = "ShowWorldMapControl", Text = SKM_UI_STRINGS.Options_Button_ShowWorldMapControl, Tooltip = SKM_UI_STRINGS.Options_Tooltip_ShowWorldMapControl }; |
||
112 | [16] = { Option = "ShowTargetClassInfo", Text = SKM_UI_STRINGS.Options_Button_ShowTargetClassInfo, Tooltip = SKM_UI_STRINGS.Options_Tooltip_ShowTargetClassInfo }; |
||
113 | [17] = { Option = "ShowMinimapButton", Text = SKM_UI_STRINGS.Options_Button_ShowMinimapButton, Tooltip = SKM_UI_STRINGS.Options_Tooltip_ShowMinimapButton }; |
||
114 | [18] = { Option = "IgnoreNoPvPFlag", Text = SKM_UI_STRINGS.Options_Button_IgnoreNoPvPFlag, Tooltip = SKM_UI_STRINGS.Options_Tooltip_IgnoreNoPvPFlag }; |
||
115 | [19] = { Option = "StoreEnemyPlayers", Text = SKM_UI_STRINGS.Options_Button_StoreEnemyPlayers, Tooltip = SKM_UI_STRINGS.Options_Tooltip_StoreEnemyPlayers }; |
||
116 | [20] = { Option = "StoreDuels", Text = SKM_UI_STRINGS.Options_Button_StoreDuels, Tooltip = SKM_UI_STRINGS.Options_Tooltip_StoreDuels }; |
||
117 | [21] = { Option = "LockedTargetInfo", Text = SKM_UI_STRINGS.Options_Button_LockedTargetInfo, Tooltip = SKM_UI_STRINGS.Options_Tooltip_LockedTargetInfo }; |
||
118 | [22] = { Option = "TooltipTargetInfo", Text = SKM_UI_STRINGS.Options_Button_TooltipTargetInfo, Tooltip = SKM_UI_STRINGS.Options_Tooltip_TooltipTargetInfo }; |
||
119 | [23] = { Option = "WarEnableFilter", Text = SKM_UI_STRINGS.Options_Button_WarEnableFilter, Tooltip = SKM_UI_STRINGS.Options_Tooltip_WarEnableFilter }; |
||
120 | [24] = { Option = "WarChatMessage", Text = SKM_UI_STRINGS.Options_Button_WarChatMessage, Tooltip = SKM_UI_STRINGS.Options_Tooltip_WarChatMessage }; |
||
121 | [25] = { Option = "WarShowNote", Text = SKM_UI_STRINGS.Options_Button_WarShowNote, Tooltip = SKM_UI_STRINGS.Options_Tooltip_WarShowNote }; |
||
122 | [26] = { Option = "DataCleanUp", Text = SKM_UI_STRINGS.Options_Button_DataCleanUp, Tooltip = SKM_UI_STRINGS.Options_Tooltip_DataCleanUp }; |
||
123 | [27] = { Option = "CleanInactiveEnemies", Text = SKM_UI_STRINGS.Options_Button_CleanInactiveEnemies, Tooltip = SKM_UI_STRINGS.Options_Tooltip_CleanInactiveEnemies }; |
||
124 | [28] = { Option = "SharedWarMode", Text = SKM_UI_STRINGS.Options_Button_SharedWarMode, Tooltip = SKM_UI_STRINGS.Options_Tooltip_SharedWarMode }; |
||
125 | [29] = { Option = "TooltipPlayerNote", Text = SKM_UI_STRINGS.Options_Button_TooltipPlayerNote, Tooltip = SKM_UI_STRINGS.Options_Tooltip_TooltipPlayerNote }; |
||
126 | [30] = { Option = "EnemyListAutoUpdate", Text = SKM_UI_STRINGS.Options_Button_EnemyListAutoUpdate, Tooltip = SKM_UI_STRINGS.Options_Tooltip_EnemyListAutoUpdate }; |
||
127 | [31] = { Option = "CleanEmptyGuilds", Text = SKM_UI_STRINGS.Options_Button_CleanEmptyGuilds, Tooltip = SKM_UI_STRINGS.Options_Tooltip_CleanEmptyGuilds }; |
||
128 | [32] = { Option = "RecordPlayerDeathNonPvP", Text = SKM_UI_STRINGS.Options_Button_RecordPlayerDeathNonPvP, Tooltip = SKM_UI_STRINGS.Options_Tooltip_RecordPlayerDeathNonPvP }; |
||
129 | [33] = { Option = "ReportPlayerDeath", Text = SKM_UI_STRINGS.Options_Button_ReportPlayerDeath, Tooltip = SKM_UI_STRINGS.Options_Tooltip_ReportPlayerDeath }; |
||
130 | |||
131 | }; |
||
132 | |||
133 | local SKM_OptionsFrameSliders = { |
||
134 | [1] = { Option = "CreatureKillRecordsByZone", valueStep = 1, minValue = 0, maxValue = SKM_MAX_CREEP_RECORD_BY_ZONE, Text = SKM_UI_STRINGS.Options_Slider_CreatureKillRecordsByZone, Tooltip = SKM_UI_STRINGS.Options_Tooltip_CreatureKillRecordsByZone }; |
||
135 | [2] = { Option = "IgnoreLevelThreshold", valueStep = 1, minValue = 0, maxValue = 100, Text = SKM_UI_STRINGS.Options_Slider_IgnoreLevelThreshold, Tooltip = SKM_UI_STRINGS.Options_Tooltip_IgnoreLevelThreshold }; |
||
136 | [3] = { Option = "MinimapButtonPosition", valueStep = 1, minValue = 0, maxValue = 100, Text = SKM_UI_STRINGS.Options_Slider_MinimapButtonPosition, Tooltip = SKM_UI_STRINGS.Options_Tooltip_MinimapButtonPosition }; |
||
137 | [4] = { Option = "MinimapButtonOffset", valueStep = 1, minValue = 50, maxValue = 120, Text = SKM_UI_STRINGS.Options_Slider_MinimapButtonOffset, Tooltip = SKM_UI_STRINGS.Options_Tooltip_MinimapButtonOffset }; |
||
138 | [5] = { Option = "WarFilterDelay", valueStep = 1, minValue = 1, maxValue = 60, Text = SKM_UI_STRINGS.Options_Slider_WarFilterDelay, Tooltip = SKM_UI_STRINGS.Options_Tooltip_WarFilterDelay }; |
||
139 | [6] = { Option = "DataCleanUpInterval", valueStep = 1, minValue = 1, maxValue = 100, Text = SKM_UI_STRINGS.Options_Slider_DataCleanUpInterval, Tooltip = SKM_UI_STRINGS.Options_Tooltip_DataCleanUpInterval }; |
||
140 | [7] = { Option = "CleanInactiveEnemiesDelay", valueStep = 1, minValue = 1, maxValue = 150, Text = SKM_UI_STRINGS.Options_Slider_CleanInactiveEnemiesDelay, Tooltip = SKM_UI_STRINGS.Options_Tooltip_CleanInactiveEnemiesDelay }; |
||
141 | [8] = { Option = "EnemyListAutoUpdateDelay", valueStep = 1, minValue = 0, maxValue = 300, Text = SKM_UI_STRINGS.Options_Slider_EnemyListAutoUpdateDelay, Tooltip = SKM_UI_STRINGS.Options_Tooltip_EnemyListAutoUpdateDelay }; |
||
142 | |||
143 | }; |
||
144 | |||
145 | local SKM_OptionFrameLabels = { |
||
146 | [1] = { Text = SKM_UI_STRINGS.Options_Label_General }; |
||
147 | [2] = { Text = SKM_UI_STRINGS.Options_Label_Map }; |
||
148 | [3] = { Text = SKM_UI_STRINGS.Options_Label_War }; |
||
149 | [4] = { Text = SKM_UI_STRINGS.Options_Label_Record }; |
||
150 | [5] = { Text = SKM_UI_STRINGS.Options_Label_Minimap }; |
||
151 | [6] = { Text = SKM_UI_STRINGS.Options_Label_Cleanup }; |
||
152 | }; |
||
153 | |||
154 | |||
155 | -- new option management |
||
156 | SKM_OptionsList = { |
||
157 | [1] = { |
||
158 | Title = SKM_OptionFrameLabels[1]; |
||
159 | Lines = { |
||
160 | [1] = { |
||
161 | Left = { |
||
162 | Type = _SKM._checkButton; |
||
163 | Offset = 20; |
||
164 | Value = SKM_OptionsFrameCheckButtons[1]; |
||
165 | }; |
||
166 | Right = { |
||
167 | Type = _SKM._checkButton; |
||
168 | Offset = 20; |
||
169 | Value = SKM_OptionsFrameCheckButtons[19]; |
||
170 | }; |
||
171 | }; |
||
172 | [2] = { |
||
173 | Left = { |
||
174 | Type = _SKM._checkButton; |
||
175 | Offset = 30; |
||
176 | Value = SKM_OptionsFrameCheckButtons[21]; |
||
177 | }; |
||
178 | Right = { |
||
179 | Type = _SKM._checkButton; |
||
180 | Offset = 30; |
||
181 | Value = SKM_OptionsFrameCheckButtons[18]; |
||
182 | }; |
||
183 | }; |
||
184 | [3] = { |
||
185 | Left = { |
||
186 | Type = _SKM._checkButton; |
||
187 | Offset = 30; |
||
188 | Value = SKM_OptionsFrameCheckButtons[2]; |
||
189 | }; |
||
190 | Right = { |
||
191 | Type = _SKM._checkButton; |
||
192 | Offset = 30; |
||
193 | Value = SKM_OptionsFrameCheckButtons[13]; |
||
194 | }; |
||
195 | }; |
||
196 | [4] = { |
||
197 | Left = { |
||
198 | Type = _SKM._checkButton; |
||
199 | Offset = 20; |
||
200 | Value = SKM_OptionsFrameCheckButtons[16]; |
||
201 | }; |
||
202 | Right = { |
||
203 | Type = _SKM._slider; |
||
204 | Offset = 40; |
||
205 | Value = SKM_OptionsFrameSliders[2]; |
||
206 | }; |
||
207 | }; |
||
208 | [5] = { |
||
209 | Left = { |
||
210 | Type = _SKM._checkButton; |
||
211 | Offset = 20; |
||
212 | Value = SKM_OptionsFrameCheckButtons[14]; |
||
213 | }; |
||
214 | Right = { |
||
215 | Type = _SKM._checkButton; |
||
216 | Offset = 20; |
||
217 | Value = SKM_OptionsFrameCheckButtons[20]; |
||
218 | }; |
||
219 | }; |
||
220 | [6] = { |
||
221 | Left = { |
||
222 | Type = _SKM._checkButton; |
||
223 | Offset = 20; |
||
224 | Value = SKM_OptionsFrameCheckButtons[22]; |
||
225 | }; |
||
226 | Right = { |
||
227 | Type = _SKM._checkButton; |
||
228 | Offset = 20; |
||
229 | Value = SKM_OptionsFrameCheckButtons[30]; |
||
230 | }; |
||
231 | }; |
||
232 | [7] = { |
||
233 | Left = { |
||
234 | Type = _SKM._checkButton; |
||
235 | Offset = 20; |
||
236 | Value = SKM_OptionsFrameCheckButtons[29]; |
||
237 | }; |
||
238 | Right = { |
||
239 | Type = _SKM._slider; |
||
240 | Offset = 30; |
||
241 | Value = SKM_OptionsFrameSliders[8]; |
||
242 | }; |
||
243 | }; |
||
244 | [8] = { |
||
245 | Left = { |
||
246 | Type = _SKM._checkButton; |
||
247 | Offset = 20; |
||
248 | Value = SKM_OptionsFrameCheckButtons[33]; |
||
249 | }; |
||
250 | Right = nil; |
||
251 | }; |
||
252 | }; |
||
253 | }; |
||
254 | |||
255 | [2] = { |
||
256 | Title = SKM_OptionFrameLabels[2]; |
||
257 | Lines = { |
||
258 | [1] = { |
||
259 | Left = { |
||
260 | Type = _SKM._checkButton; |
||
261 | Offset = 20; |
||
262 | Value = SKM_OptionsFrameCheckButtons[3]; |
||
263 | }; |
||
264 | Right = { |
||
265 | Type = _SKM._checkButton; |
||
266 | Offset = 20; |
||
267 | Value = SKM_OptionsFrameCheckButtons[15]; |
||
268 | }; |
||
269 | }; |
||
270 | }; |
||
271 | }; |
||
272 | |||
273 | [3] = { |
||
274 | Title = SKM_OptionFrameLabels[3]; |
||
275 | Lines = { |
||
276 | [1] = { |
||
277 | Left = { |
||
278 | Type = _SKM._checkButton; |
||
279 | Offset = 20; |
||
280 | Value = SKM_OptionsFrameCheckButtons[4]; |
||
281 | }; |
||
282 | Right = { |
||
283 | Type = _SKM._checkButton; |
||
284 | Offset = 20; |
||
285 | Value = SKM_OptionsFrameCheckButtons[23]; |
||
286 | }; |
||
287 | }; |
||
288 | [2] = { |
||
289 | Left = { |
||
290 | Type = _SKM._checkButton; |
||
291 | Offset = 20; |
||
292 | Value = SKM_OptionsFrameCheckButtons[5]; |
||
293 | }; |
||
294 | Right = { |
||
295 | Type = _SKM._slider; |
||
296 | Offset = 30; |
||
297 | Value = SKM_OptionsFrameSliders[5]; |
||
298 | }; |
||
299 | }; |
||
300 | [3] = { |
||
301 | Left = { |
||
302 | Type = _SKM._checkButton; |
||
303 | Offset = 20; |
||
304 | Value = SKM_OptionsFrameCheckButtons[24]; |
||
305 | }; |
||
306 | Right = { |
||
307 | Type = _SKM._checkButton; |
||
308 | Offset = 20; |
||
309 | Value = SKM_OptionsFrameCheckButtons[6]; |
||
310 | }; |
||
311 | }; |
||
312 | [4] = { |
||
313 | Left = { |
||
314 | Type = _SKM._checkButton; |
||
315 | Offset = 30; |
||
316 | Value = SKM_OptionsFrameCheckButtons[25]; |
||
317 | }; |
||
318 | Right = { |
||
319 | Type = _SKM._checkButton; |
||
320 | Offset = 20; |
||
321 | Value = SKM_OptionsFrameCheckButtons[28]; |
||
322 | }; |
||
323 | }; |
||
324 | |||
325 | }; |
||
326 | }; |
||
327 | |||
328 | [4] = { |
||
329 | Title = SKM_OptionFrameLabels[4]; |
||
330 | Lines = { |
||
331 | [1] = { |
||
332 | Left = { |
||
333 | Type = _SKM._checkButton; |
||
334 | Offset = 20; |
||
335 | Value = SKM_OptionsFrameCheckButtons[7]; |
||
336 | }; |
||
337 | Right = { |
||
338 | Type = _SKM._checkButton; |
||
339 | Offset = 20; |
||
340 | Value = SKM_OptionsFrameCheckButtons[11]; |
||
341 | }; |
||
342 | }; |
||
343 | [2] = { |
||
344 | Left = { |
||
345 | Type = _SKM._checkButton; |
||
346 | Offset = 20; |
||
347 | Value = SKM_OptionsFrameCheckButtons[32]; |
||
348 | }; |
||
349 | Right = { |
||
350 | Type = _SKM._slider; |
||
351 | Offset = 30; |
||
352 | Value = SKM_OptionsFrameSliders[1]; |
||
353 | }; |
||
354 | }; |
||
355 | [3] = { |
||
356 | Left = { |
||
357 | Type = _SKM._checkButton; |
||
358 | Offset = 30; |
||
359 | Value = SKM_OptionsFrameCheckButtons[8]; |
||
360 | }; |
||
361 | Right = { |
||
362 | Type = _SKM._checkButton; |
||
363 | Offset = 30; |
||
364 | Value = SKM_OptionsFrameCheckButtons[12]; |
||
365 | }; |
||
366 | }; |
||
367 | [4] = { |
||
368 | Left = { |
||
369 | Type = _SKM._checkButton; |
||
370 | Offset = 20; |
||
371 | Value = SKM_OptionsFrameCheckButtons[9]; |
||
372 | }; |
||
373 | }; |
||
374 | [5] = { |
||
375 | Left = { |
||
376 | Type = _SKM._checkButton; |
||
377 | Offset = 30; |
||
378 | Value = SKM_OptionsFrameCheckButtons[10]; |
||
379 | }; |
||
380 | }; |
||
381 | }; |
||
382 | }; |
||
383 | |||
384 | [5] = { |
||
385 | Title = SKM_OptionFrameLabels[5]; |
||
386 | Lines = { |
||
387 | [1] = { |
||
388 | Left = { |
||
389 | Type = _SKM._checkButton; |
||
390 | Offset = 20; |
||
391 | Value = SKM_OptionsFrameCheckButtons[17]; |
||
392 | }; |
||
393 | Right = { |
||
394 | Type = _SKM._slider; |
||
395 | Offset = 30; |
||
396 | Value = SKM_OptionsFrameSliders[3]; |
||
397 | }; |
||
398 | }; |
||
399 | [2] = { |
||
400 | Right = { |
||
401 | Type = _SKM._slider; |
||
402 | Offset = 30; |
||
403 | Value = SKM_OptionsFrameSliders[4]; |
||
404 | }; |
||
405 | }; |
||
406 | }; |
||
407 | }; |
||
408 | |||
409 | [6] = { |
||
410 | Title = SKM_OptionFrameLabels[6]; |
||
411 | Lines = { |
||
412 | [1] = { |
||
413 | Left = { |
||
414 | Type = _SKM._checkButton; |
||
415 | Offset = 20; |
||
416 | Value = SKM_OptionsFrameCheckButtons[26]; |
||
417 | }; |
||
418 | Right = { |
||
419 | Type = _SKM._checkButton; |
||
420 | Offset = 30; |
||
421 | Value = SKM_OptionsFrameCheckButtons[27]; |
||
422 | }; |
||
423 | }; |
||
424 | [2] = { |
||
425 | Left = { |
||
426 | Type = _SKM._slider; |
||
427 | Offset = 30; |
||
428 | Value = SKM_OptionsFrameSliders[6]; |
||
429 | }; |
||
430 | Right = { |
||
431 | Type = _SKM._slider; |
||
432 | Offset = 40; |
||
433 | Value = SKM_OptionsFrameSliders[7]; |
||
434 | }; |
||
435 | }; |
||
436 | [3] = { |
||
437 | Left = nil; |
||
438 | Right = { |
||
439 | Type = _SKM._checkButton; |
||
440 | Offset = 30; |
||
441 | Value = SKM_OptionsFrameCheckButtons[31]; |
||
442 | }; |
||
443 | }; |
||
444 | }; |
||
445 | }; |
||
446 | |||
447 | } |
||
448 | |||
449 | SKM_List_Options = { }; |
||
450 | |||
451 | |||
452 | SKM_LISTFRAME_ROWS = 13; |
||
453 | SKM_LISTFRAME_ROWHEIGHT = 16; |
||
454 | |||
455 | SKM_DUELFRAME_ROWS = 13; |
||
456 | SKM_DUELFRAME_ROWHEIGHT = 16; |
||
457 | |||
458 | SKM_OPTIONFRAME_ROWS = 11; |
||
459 | SKM_OPTIONFRAME_ROWHEIGHT = 30; |
||
460 | |||
461 | -- lists contents |
||
462 | SKM_List_Content = { }; |
||
463 | SKM_GuildList_Content = { }; |
||
464 | SKM_DuelList_Content = { }; |
||
465 | |||
466 | -- enemy list sort options |
||
467 | --SKM_List_SortType = "Name"; |
||
468 | --SKM_List_SortTypes = { SKM_List_SortType }; |
||
469 | --SKM_List_ReverseSort = false; |
||
470 | |||
471 | -- guild list sort options |
||
472 | --SKM_GuildList_SortType = "Name"; |
||
473 | --SKM_GuildList_SortTypes = { SKM_GuildList_SortType }; |
||
474 | --SKM_GuildList_ReverseSort = false; |
||
475 | |||
476 | -- duel list sort options |
||
477 | --SKM_DuelList_SortType = "Name"; |
||
478 | --SKM_DuelList_SortTypes = { SKM_DuelList_SortType }; |
||
479 | --SKM_DuelList_ReverseSort = false; |
||
480 | |||
481 | -- which of the two lists is currently active |
||
482 | SKM_List_ActiveList = _SKM._players; |
||
483 | |||
484 | -- remember the selected player or guild from the lists |
||
485 | SKM_List_SelectedPlayer = nil; |
||
486 | SKM_List_SelectedGuild = nil; |
||
487 | |||
488 | SKM_EditNoteContext = { List = nil, Element = nil }; |
||
489 | |||
490 | SKM_LISTFRAME_DETAIL_ROWS = 8; |
||
491 | SKM_DUELFRAME_DETAIL_ROWS = 8; |
||
492 | |||
493 | SKM_BOOKFRAME_ROWS = 20; |
||
494 | SKM_BOOKFRAME_COLUMNS = 4; |
||
495 | |||
496 | SKM_BookPages = { }; |
||
497 | SKM_BookCurPage = nil; |
||
498 | SKM_CurrentBook = nil; |
||
499 | |||
500 | SKM_BOOK_SEPARATOR = "_________________________________________________________________"; |
||
501 | |||
502 | |||
503 | SKM_ActivePopup = false; |
||
504 | |||
505 | |||
506 | |||
507 | local SKMap_Original_ChatFrame_OnEvent; |
||
508 | |||
509 | |||
510 | --Stolen from TextFilter.lua |
||
511 | function SKMap_FilterChatEvent(event) |
||
512 | chatEvents = { |
||
513 | --possible filtered events |
||
514 | "CHAT_MSG_SAY", |
||
515 | "CHAT_MSG_YELL", |
||
516 | "CHAT_MSG_PARTY", |
||
517 | "CHAT_MSG_RAID", |
||
518 | "CHAT_MSG_WHISPER", |
||
519 | "CHAT_MSG_WHISPER_INFORM", |
||
520 | "CHAT_MSG_EMOTE", |
||
521 | "CHAT_MSG_TEXT_EMOTE", |
||
522 | "CHAT_MSG_GUILD", |
||
523 | "CHAT_MSG_OFFICER", |
||
524 | "GUILD_MOTD", |
||
525 | "CHAT_MSG_CHANNEL", |
||
526 | "CHAT_MSG_SYSTEM", |
||
527 | }; |
||
528 | for key,value in chatEvents do |
||
529 | if(event == value) then |
||
530 | return true; |
||
531 | end |
||
532 | end |
||
533 | return false; |
||
534 | end |
||
535 | |||
536 | |||
537 | function SKMap_ChatFrame_OnEvent(event) |
||
538 | SKMap_Original_ChatFrame_OnEvent(event); -- call the real ChatFrame_OnEvent function |
||
539 | |||
540 | --if we haven't already done so, hook the AddMessage function |
||
541 | if (not this.SKMap_ChatColor_Original_AddMessage) then |
||
542 | this.SKMap_ChatColor_Original_AddMessage = this.AddMessage; |
||
543 | this.AddMessage = SKMap_ChatColor_AddMessage; |
||
544 | end |
||
545 | end |
||
546 | |||
547 | |||
548 | -- test |
||
549 | SKM_Karma = { |
||
550 | ["Tanae"] = { [_SKM._name] = "Tanae" }; |
||
551 | --["Lumen"] = { [_SKM._name] = "Lumen" }; |
||
552 | ["Tyronia"] = { [_SKM._name] = "Tyronia" }; |
||
553 | }; |
||
554 | |||
555 | |||
556 | function SKMap_KarmaNameColor(sMsg) |
||
557 | local sNewMsg = sMsg; |
||
558 | local idx, val; |
||
559 | for idx, val in SKM_Karma do |
||
560 | local sName = val[_SKM._name]; |
||
561 | local red=255; |
||
562 | local green=0; |
||
563 | local blue=0; |
||
564 | local sRep = string.format("|c00%02x%02x%02x%s|r", red, green, blue, sName); |
||
565 | sNewMsg = string.gsub(sNewMsg, sName, sRep); |
||
566 | end |
||
567 | return sNewMsg; |
||
568 | end |
||
569 | |||
570 | |||
571 | function SKMap_ChatColor_AddMessage(this, msg, r, g, b, id) |
||
572 | local FName = "SKMap_ChatColor_AddMessage"; |
||
573 | |||
574 | local sNewMsg = msg; |
||
575 | |||
576 | if (SKMap_FilterChatEvent(event)) then |
||
577 | --hmm, don't use SkM_Trace here or this would generate an infinite loop and a stack overflow :) |
||
578 | --SkM_Trace(FName, 1, "r="..snil(r)..", g="..snil(g)..", b="..snil(b)..", msg="..snil(msg)); |
||
579 | --UIErrorsFrame:AddMessage("r="..snil(r)..", g="..snil(g)..", b="..snil(b)..", msg="..snil(msg), 1.0, 1.0, 1.0, 1.0, UIERRORS_HOLD_TIME); |
||
580 | |||
581 | for sStart, sPlayer, sEnd in string.gfind(msg, "(.*)|Hplayer:(.+)%[(.+)") do |
||
582 | sNewMsg = sStart.."|Hplayer:"..sPlayer.."["..SKMap_KarmaNameColor(sEnd); |
||
583 | this:SKMap_ChatColor_Original_AddMessage(sNewMsg, r, g, b, id); |
||
584 | return; |
||
585 | end |
||
586 | |||
587 | -- pattern "|Hplayer:"... not found, so just replace in whole message |
||
588 | sNewMsg = SKMap_KarmaNameColor(sNewMsg); |
||
589 | end |
||
590 | |||
591 | this:SKMap_ChatColor_Original_AddMessage(sNewMsg, r, g, b, id); |
||
592 | end |
||
593 | |||
594 | |||
595 | |||
596 | -- -------------------------------------------------------------------------------------- |
||
597 | -- SKMap_OnLoad |
||
598 | -- -------------------------------------------------------------------------------------- |
||
599 | -- Global OnLoad event for the loading frame. |
||
600 | -- Declare slash handlers. |
||
601 | -- Register all events we need. |
||
602 | -- Initialize module. |
||
603 | -- -------------------------------------------------------------------------------------- |
||
604 | function SKMap_OnLoad() |
||
605 | |||
606 | SlashCmdList["SKMAPCOMMAND"] = SKMap_SlashHandler; |
||
607 | SLASH_SKMAPCOMMAND1 = "/skm"; |
||
608 | --SLASH_SKMAPCOMMAND2 = nil; |
||
609 | |||
610 | |||
611 | -- Hook ChatFrame_OnEvent so we can hook AddMessage |
||
612 | --SKMap_Original_ChatFrame_OnEvent = ChatFrame_OnEvent; |
||
613 | --ChatFrame_OnEvent = SKMap_ChatFrame_OnEvent; |
||
614 | |||
615 | |||
616 | -- to respond to events (in OnEvent) you must first register to receive them |
||
617 | -- with this:RegisterEvent("EVENT_NAME"). A list of events can be found |
||
618 | -- at the cosmos site. You can get to it directly by going through WoWWiki.com |
||
619 | |||
620 | -- If we've saved config variables, we'll almost always want to respond to |
||
621 | -- the variables loaded event. Prior to this, the saved variables are NOT in |
||
622 | -- memory, don't try to use them. |
||
623 | this:RegisterEvent("VARIABLES_LOADED"); |
||
624 | this:RegisterEvent("UNIT_NAME_UPDATE"); |
||
625 | this:RegisterEvent("PLAYER_TARGET_CHANGED"); |
||
626 | this:RegisterEvent("UPDATE_MOUSEOVER_UNIT"); |
||
627 | this:RegisterEvent("UNIT_HEALTH"); |
||
628 | this:RegisterEvent("PLAYER_DEAD"); |
||
629 | this:RegisterEvent("PLAYER_ALIVE"); |
||
630 | this:RegisterEvent("PLAYER_LEVEL_UP"); |
||
631 | this:RegisterEvent("CHAT_MSG_SPELL_SELF_BUFF"); |
||
632 | this:RegisterEvent("WORLD_MAP_UPDATE"); |
||
633 | this:RegisterEvent("CLOSE_WORLD_MAP"); |
||
634 | this:RegisterEvent("PARTY_MEMBERS_CHANGED"); |
||
635 | this:RegisterEvent("CHAT_MSG_COMBAT_SELF_HITS"); |
||
636 | this:RegisterEvent("CHAT_MSG_SPELL_SELF_DAMAGE"); |
||
637 | this:RegisterEvent("CHAT_MSG_COMBAT_PET_HITS"); |
||
638 | this:RegisterEvent("CHAT_MSG_SPELL_PET_DAMAGE"); |
||
639 | this:RegisterEvent("CHAT_MSG_COMBAT_HOSTILEPLAYER_HITS"); |
||
640 | this:RegisterEvent("CHAT_MSG_SPELL_HOSTILEPLAYER_DAMAGE"); |
||
641 | this:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_HOSTILEPLAYER_DAMAGE"); |
||
642 | this:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_SELF_DAMAGE"); |
||
643 | this:RegisterEvent("CHAT_MSG_COMBAT_FRIENDLYPLAYER_HITS"); |
||
644 | this:RegisterEvent("CHAT_MSG_SPELL_FRIENDLYPLAYER_DAMAGE"); |
||
645 | this:RegisterEvent("CHAT_MSG_COMBAT_CREATURE_VS_SELF_HITS"); |
||
646 | this:RegisterEvent("CHAT_MSG_SPELL_CREATURE_VS_SELF_DAMAGE"); |
||
647 | this:RegisterEvent("CHAT_MSG_COMBAT_HOSTILE_DEATH"); |
||
648 | this:RegisterEvent("CHAT_MSG_COMBAT_XP_GAIN"); |
||
649 | this:RegisterEvent("CHAT_MSG_COMBAT_HONOR_GAIN"); |
||
650 | |||
651 | this:RegisterEvent("DUEL_FINISHED"); |
||
652 | this:RegisterEvent("DUEL_REQUESTED"); -- does not seem to be triggered at all !! |
||
653 | this:RegisterEvent("CHAT_MSG_SYSTEM"); |
||
654 | |||
655 | |||
656 | |||
657 | --this:RegisterEvent("CHAT_MSG_CHANNEL"); |
||
658 | --this:RegisterEvent("GUILD_ROSTER_UPDATE"); |
||
659 | --this:RegisterEvent("GUILD_ROSTER_SHOW"); |
||
660 | --this:RegisterEvent("PLAYER_GUILD_UPDATE"); |
||
661 | |||
662 | |||
663 | -- to catch the ESC key |
||
664 | tinsert(UISpecialFrames,"SKMapFrame"); |
||
665 | |||
666 | if ( DEFAULT_CHAT_FRAME ) then |
||
667 | DEFAULT_CHAT_FRAME:AddMessage(SKM_LOADED_MSG); |
||
668 | end |
||
669 | |||
670 | -- module initializations |
||
671 | SkM_Initialize(); |
||
672 | |||
673 | --UIErrorsFrame:AddMessage(SKM_LOADED_MSG, 1.0, 1.0, 1.0, 1.0, UIERRORS_HOLD_TIME); |
||
674 | end |
||
675 | |||
676 | |||
677 | -- -------------------------------------------------------------------------------------- |
||
678 | -- SKMap_OnEvent |
||
679 | -- -------------------------------------------------------------------------------------- |
||
680 | -- Global OnEvent events caught by the loading frame |
||
681 | -- -------------------------------------------------------------------------------------- |
||
682 | function SKMap_OnEvent() |
||
683 | local FName = "SKMap_OnEvent"; |
||
684 | |||
685 | -- whatever the event is, check that data has been initialized |
||
686 | -- (this doesn't do anything if it's the case) |
||
687 | SkM_InitData(false); |
||
688 | |||
689 | --SkM_Trace(FName, 0, event.." : arg1 = "..snil(arg1)); |
||
690 | |||
691 | -- This is called when one of the events we registered for actually fires |
||
692 | -- the specific event is in the variable event |
||
693 | if (event == "VARIABLES_LOADED") then |
||
694 | |||
695 | if( DEFAULT_CHAT_FRAME ) then |
||
696 | --DEFAULT_CHAT_FRAME:AddMessage("SKMap variables loaded"); |
||
697 | end |
||
698 | |||
699 | SkM_Initialize(); |
||
700 | SkM_DataCleanUp(); |
||
701 | SkM_DataFixMapIndexes(); |
||
702 | SkM_DataModelMigration(); |
||
703 | SkM_MapShiftMigration(); |
||
704 | |||
705 | -- if the option has not been set at all yet, don't touch minimap icon |
||
706 | if (SkM_GetOption("ShowMinimapButton") ~= nil) then |
||
707 | SKMap_SetMiniMapIcon(); |
||
708 | end |
||
709 | |||
710 | |||
711 | elseif (event == "UNIT_NAME_UPDATE") then |
||
712 | |||
713 | -- ok, character has been loaded, here we can query his level ! |
||
714 | if (arg1 == SKM_UNIT_PLAYER) then |
||
715 | SKM_Context.PlayerLevel = UnitLevel(SKM_UNIT_PLAYER); |
||
716 | end |
||
717 | |||
718 | elseif (event == "WORLD_MAP_UPDATE") then |
||
719 | SkM_WorldMapUpdate(); |
||
720 | |||
721 | elseif ( event == "CLOSE_WORLD_MAP" ) then |
||
722 | SkM_CloseWorldMap(); |
||
723 | |||
724 | elseif ( event == "PARTY_MEMBERS_CHANGED" ) then |
||
725 | SkM_BuildGroupList(); |
||
726 | |||
727 | elseif ( event == "PLAYER_TARGET_CHANGED" ) then |
||
728 | SkM_UpdateUnitData(); |
||
729 | SkM_SetTargetInfo(); |
||
730 | |||
731 | elseif ( event == "UPDATE_MOUSEOVER_UNIT" ) then |
||
732 | SkM_MouseOverUnit(); |
||
733 | |||
734 | elseif (event == "UNIT_HEALTH") then |
||
735 | if (arg1 == SKM_UNIT_TARGET) then |
||
736 | SkM_TargetHealthUpdated(); |
||
737 | end |
||
738 | |||
739 | elseif (event == "CHAT_MSG_COMBAT_XP_GAIN") then |
||
740 | SkM_Trace(FName, 1, event.." : arg1 = "..snil(arg1)); |
||
741 | SkM_ParseCombatChat_XpGain(arg1); |
||
742 | |||
743 | elseif (event == "PLAYER_DEAD") then |
||
744 | SkM_Trace(FName, 1, event.." : arg1 = "..snil(arg1)); |
||
745 | SkM_PlayerDeath(); |
||
746 | |||
747 | elseif (event == "PLAYER_ALIVE") then |
||
748 | SkM_Trace(FName, 1, event.." : arg1 = "..snil(arg1)); |
||
749 | SkM_PlayerAlive(); |
||
750 | |||
751 | elseif (event == "PLAYER_LEVEL_UP") then |
||
752 | SkM_PlayerLevelUp(); |
||
753 | |||
754 | elseif (event == "CHAT_MSG_COMBAT_HOSTILE_DEATH") then |
||
755 | SkM_Trace(FName, 1, event.." : arg1 = "..snil(arg1)); |
||
756 | SkM_ParseCombatChat_HostileDeath(arg1); |
||
757 | |||
758 | elseif ( event == "CHAT_MSG_COMBAT_FRIENDLYPLAYER_HITS" -- friend hits an enemy |
||
759 | ) then |
||
760 | SkM_Trace(FName, 1, event.." : arg1 = "..snil(arg1)); |
||
761 | SkM_ParseCombatChat_FriendCombatHit(arg1); |
||
762 | |||
763 | elseif ( event == "CHAT_MSG_SPELL_FRIENDLYPLAYER_DAMAGE" -- friend damages an enemy with a spell |
||
764 | ) then |
||
765 | SkM_Trace(FName, 1, event.." : arg1 = "..snil(arg1)); |
||
766 | SkM_ParseCombatChat_FriendCombatSpell(arg1); |
||
767 | |||
768 | elseif ( event == "CHAT_MSG_COMBAT_SELF_HITS" -- player hits an enemy |
||
769 | ) then |
||
770 | SkM_Trace(FName, 1, event.." : arg1 = "..snil(arg1)); |
||
771 | SkM_ParseCombatChat_SelfCombatHit(arg1); |
||
772 | |||
773 | elseif ( event == "CHAT_MSG_SPELL_SELF_DAMAGE" -- player damages an enemy with a spell |
||
774 | ) then |
||
775 | SkM_Trace(FName, 1, event.." : arg1 = "..snil(arg1)); |
||
776 | SkM_ParseCombatChat_SelfCombatSpell(arg1); |
||
777 | |||
778 | elseif ( event == "CHAT_MSG_COMBAT_PET_HITS" |
||
779 | ) then |
||
780 | SkM_Trace(FName, 1, event.." : arg1 = "..snil(arg1)); |
||
781 | SkM_ParseCombatChat_PetCombatHit(arg1); |
||
782 | |||
783 | elseif ( event == "CHAT_MSG_SPELL_PET_DAMAGE" |
||
784 | ) then |
||
785 | SkM_Trace(FName, 1, event.." : arg1 = "..snil(arg1)); |
||
786 | SkM_ParseCombatChat_PetCombatSpell(arg1); |
||
787 | |||
788 | elseif ( event == "CHAT_MSG_COMBAT_HOSTILEPLAYER_HITS" |
||
789 | ) then |
||
790 | SkM_Trace(FName, 1, event.." : arg1 = "..snil(arg1)); |
||
791 | SkM_ParseCombatChat_EnemyCombatHit(arg1); |
||
792 | |||
793 | elseif ( event == "CHAT_MSG_SPELL_HOSTILEPLAYER_DAMAGE" |
||
794 | ) then |
||
795 | SkM_Trace(FName, 1, event.." : arg1 = "..snil(arg1)); |
||
796 | SkM_ParseCombatChat_EnemyCombatSpell(arg1); |
||
797 | |||
798 | elseif ( event == "CHAT_MSG_COMBAT_CREATURE_VS_SELF_HITS" |
||
799 | ) then |
||
800 | SkM_Trace(FName, 1, event.." : arg1 = "..snil(arg1)); |
||
801 | SkM_ParseCombatChat_CreatureCombatHit(arg1); |
||
802 | |||
803 | elseif ( event == "CHAT_MSG_SPELL_CREATURE_VS_SELF_DAMAGE" |
||
804 | ) then |
||
805 | SkM_Trace(FName, 1, event.." : arg1 = "..snil(arg1)); |
||
806 | SkM_ParseCombatChat_CreatureCombatSpell(arg1); |
||
807 | |||
808 | elseif ( event == "CHAT_MSG_SPELL_PERIODIC_HOSTILEPLAYER_DAMAGE" |
||
809 | ) then |
||
810 | SkM_Trace(FName, 1, event.." : arg1 = "..snil(arg1)); |
||
811 | SkM_ParseCombatChat_EnemyDot(arg1); |
||
812 | |||
813 | elseif ( event == "CHAT_MSG_SPELL_PERIODIC_SELF_DAMAGE" |
||
814 | ) then |
||
815 | SkM_Trace(FName, 1, event.." : arg1 = "..snil(arg1)); |
||
816 | SkM_ParseCombatChat_SelfDot(arg1); |
||
817 | |||
818 | elseif ( event == "CHAT_MSG_SYSTEM") then |
||
819 | --SkM_Trace(FName, 1, event.." : arg1 = "..snil(arg1)); |
||
820 | SkM_ParseDuelResult(arg1); |
||
821 | |||
822 | -- elseif ( event == "DUEL_FINISHED" or event == "DUEL_REQUESTED" or event == "DUEL_INBOUNDS" or event == "DUEL_OUTOFBOUNDS" |
||
823 | -- or event == "CHAT_MSG" or event == "CHAT_MSG_SYSTEM" |
||
824 | -- |
||
825 | -- ) then |
||
826 | -- SkM_Trace(FName, 1, event.." : arg1 = "..snil(arg1)); |
||
827 | -- |
||
828 | |||
829 | elseif ( event == "CHAT_MSG_COMBAT_HONOR_GAIN") then |
||
830 | SkM_Trace(FName, 0, event.." : arg1 = "..snil(arg1)); |
||
831 | |||
832 | SkM_ParseCombatChat_HonorKill(arg1); |
||
833 | |||
834 | |||
835 | elseif (event == "GUILD_ROSTER_SHOW" or event == "GUILD_ROSTER_UPDATE" or event == "PLAYER_GUILD_UPDATE") then |
||
836 | SkM_Trace(FName, 1, event.." : arg1 = "..snil(arg1)); |
||
837 | SkM_BuildGuildList(); |
||
838 | |||
839 | else |
||
840 | SkM_Trace(FName, 1, "Non handled event : "..event..", arg1 = "..snil(arg1)); |
||
841 | end |
||
842 | |||
843 | end |
||
844 | |||
845 | |||
846 | function SKMap_MiniMapIcon(frame, pPos, pRadius) |
||
847 | frame:ClearAllPoints(); |
||
848 | frame:SetFrameLevel(Minimap:GetFrameLevel() + 10); |
||
849 | frame:SetPoint("TOPLEFT", "Minimap", "TOPLEFT", 52 - (pRadius * cos(pPos)), (pRadius * sin(pPos)) - 52); |
||
850 | end |
||
851 | |||
852 | |||
853 | function SKMap_MoveMiniMapIcon(iValue, iOffsetValue) |
||
854 | local iPosition; |
||
855 | |||
856 | if (not iValue) or (not iOffsetValue) then |
||
857 | return; |
||
858 | end |
||
859 | |||
860 | iPosition = math.floor( (iValue / 100) * (377 - 256) ) + 256; |
||
861 | |||
862 | --SKMap_MiniMapIcon(SKMapMinimapButton, iPosition, SKM_Config.MinimapButtonOffset); |
||
863 | SKMap_MiniMapIcon(SKMapMinimapButton, iPosition, iOffsetValue); |
||
864 | end |
||
865 | |||
866 | |||
867 | function SKMap_SetMiniMapIcon(iPosition, iOffset) |
||
868 | if (not SkM_GetOption("ShowMinimapButton")) then |
||
869 | SKMapMinimapButton:Hide(); |
||
870 | else |
||
871 | SKMapMinimapButton:Show(); |
||
872 | local iValue, iOffsetValue; |
||
873 | if (iPosition) then |
||
874 | iValue = iPosition; |
||
875 | else |
||
876 | iValue = SkM_GetOption("MinimapButtonPosition"); |
||
877 | end |
||
878 | if (iOffset) then |
||
879 | iOffsetValue = iOffset; |
||
880 | else |
||
881 | iOffsetValue = SkM_GetOption("MinimapButtonOffset"); |
||
882 | end |
||
883 | SKMap_MoveMiniMapIcon(iValue, iOffsetValue); |
||
884 | end |
||
885 | end |
||
886 | |||
887 | |||
888 | function SKMap_WorldMapPOI_OnEnter(id) |
||
889 | local FName = "SKMap_OnEnter"; |
||
890 | |||
891 | SkM_InitData(false); |
||
892 | SkM_WorldMapEnterPOI(id); |
||
893 | end |
||
894 | |||
895 | function SKMap_WorldMapPOI_OnLeave(id) |
||
896 | local FName = "SKMap_OnLeave"; |
||
897 | |||
898 | SkM_InitData(false); |
||
899 | SkM_WorldMapLeavePOI(id); |
||
900 | end |
||
901 | |||
902 | |||
903 | |||
904 | function SKMap_SlashHandler(msg) |
||
905 | -- This function is called when a user types one of your slash commands |
||
906 | -- the text they enter after the command comes in msg |
||
907 | |||
908 | SkM_InitData(false); |
||
909 | |||
910 | if ( ( not msg) or ( strlen(msg) <= 0 ) ) then |
||
911 | SKMap_ToggleUI(); |
||
912 | return; |
||
913 | end |
||
914 | |||
915 | --UIErrorsFrame:AddMessage(msg, 1.0, 1.0, 1.0, 1.0, UIERRORS_HOLD_TIME); |
||
916 | |||
917 | |||
918 | local sCmd, sParams = SkM_ExtractParam(msg); |
||
919 | local sParamStr = sParams; |
||
920 | |||
921 | if ( (sCmd) and (string.len(sCmd) > 0) ) then |
||
922 | sCmd = string.lower(sCmd); |
||
923 | else |
||
924 | sCmd = ""; |
||
925 | end |
||
926 | |||
927 | local iNbParam = 0; |
||
928 | local sParam = {}; |
||
929 | while (sParams ~= "") do |
||
930 | iNbParam = iNbParam + 1; |
||
931 | sParam[iNbParam], sParams = SkM_ExtractParam(sParams); |
||
932 | end |
||
933 | |||
934 | if (SkM_IdentifyCommand(sCmd, "debug")) then |
||
935 | local iLevel = -1; |
||
936 | if (iNbParam == 0) then |
||
937 | SkM_SetDebugLevel(iLevel); |
||
938 | else |
||
939 | |||
940 | if (sParam[1] == "startrec") then |
||
941 | SkM_StartDebugRecord(); |
||
942 | elseif (sParam[1] == "stoprec") then |
||
943 | SkM_StopDebugRecord(); |
||
944 | elseif (sParam[1] == "clearrec") then |
||
945 | SkM_ClearDebugRecord(); |
||
946 | |||
947 | else |
||
948 | if (sParam[1] ~= "off") then |
||
949 | iLevel = tonumber(sParam[1]); |
||
950 | end |
||
951 | SkM_SetDebugLevel(iLevel); |
||
952 | end |
||
953 | |||
954 | end |
||
955 | |||
956 | |||
957 | elseif (SkM_IdentifyCommand(sCmd, "war")) then |
||
958 | if (iNbParam == 1) then |
||
959 | local sName = sParam[1]; |
||
960 | SkM_UnknownEnemyWar(sName, true, true); |
||
961 | else |
||
962 | SkM_ChatMessageCol("Usage : /skm war <player name>"); |
||
963 | end |
||
964 | |||
965 | elseif (SkM_IdentifyCommand(sCmd, "peace")) then |
||
966 | if (iNbParam == 1) then |
||
967 | local sName = sParam[1]; |
||
968 | SkM_UnknownEnemyWar(sName, false, true); |
||
969 | else |
||
970 | SkM_ChatMessageCol("Usage : /skm peace <player name>"); |
||
971 | end |
||
972 | |||
973 | elseif (SkM_IdentifyCommand(sCmd, "swar")) then |
||
974 | if (iNbParam == 0) then |
||
975 | SkM_ShowUnknownEnemyWar(); |
||
976 | else |
||
977 | SkM_ChatMessageCol("Usage : /skm swar"); |
||
978 | end |
||
979 | |||
980 | elseif (SkM_IdentifyCommand(sCmd, "cwar")) then |
||
981 | if (iNbParam == 0) then |
||
982 | SkM_ClearUnknownEnemyWar(); |
||
983 | else |
||
984 | SkM_ChatMessageCol("Usage : /skm cwar"); |
||
985 | end |
||
986 | |||
987 | elseif (SkM_IdentifyCommand(sCmd, "inf")) then |
||
988 | if (iNbParam >= 1) and (iNbParam <= 3) then |
||
989 | local sName = sParam[1]; |
||
990 | local bMatchFullName = false; |
||
991 | local bMatchSpecialChar = false; |
||
992 | if (iNbParam >= 2) then |
||
993 | if (sParam[2] == "1") then |
||
994 | bMatchFullName = true; |
||
995 | end |
||
996 | end |
||
997 | if (iNbParam >= 3) then |
||
998 | if (sParam[3] == "1") then |
||
999 | bMatchSpecialChar = true; |
||
1000 | end |
||
1001 | end |
||
1002 | SkM_GetEnemyInfo(sName, bMatchFullName, bMatchSpecialChar); |
||
1003 | else |
||
1004 | SkM_ChatMessageCol("Usage : /skm inf <player name> [<full name match> [<special char match>]]"); |
||
1005 | end |
||
1006 | |||
1007 | else |
||
1008 | SkM_ChatMessageCol("Unknown command"); |
||
1009 | end |
||
1010 | |||
1011 | end |
||
1012 | |||
1013 | |||
1014 | function SKMap_ToggleUI(tab) |
||
1015 | local FName = "SKMap_ToggleUI"; |
||
1016 | SkM_InitData(false); |
||
1017 | |||
1018 | if (not SKMapFrame) then |
||
1019 | SkM_ChatMessageCol("Error : SKMapFrame not loaded"); |
||
1020 | return; |
||
1021 | end |
||
1022 | |||
1023 | if (not tab) then |
||
1024 | if (SKMapFrame:IsVisible()) then |
||
1025 | HideUIPanel(SKMapFrame); |
||
1026 | --SKMapFrame:Hide(); |
||
1027 | else |
||
1028 | ShowUIPanel(SKMapFrame); |
||
1029 | --SKMapFrame:Show(); |
||
1030 | |||
1031 | local selectedFrameName = SKM_TAB_SUBFRAMES[SKMapFrame.selectedTab]; |
||
1032 | SkM_Trace(FName, 1, "Selected frame name = "..snil(selectedFrameName)); |
||
1033 | |||
1034 | local selectedFrame = getglobal(selectedFrameName); |
||
1035 | |||
1036 | -- NCHNCH : the following line sometimes generates error because selectedFrame is nil !!! |
||
1037 | -- then it's required to ReloadUI(); |
||
1038 | -- see if there's a solution ! |
||
1039 | if ( not selectedFrame:IsVisible() ) then |
||
1040 | selectedFrame:Show() |
||
1041 | end |
||
1042 | end |
||
1043 | else |
||
1044 | |||
1045 | local subFrame = getglobal(tab); |
||
1046 | if ( subFrame ) then |
||
1047 | PanelTemplates_SetTab(SKMapFrame, subFrame:GetID()); |
||
1048 | if ( SKMapFrame:IsVisible() ) then |
||
1049 | if ( subFrame:IsVisible() ) then |
||
1050 | HideUIPanel(SKMapFrame); |
||
1051 | else |
||
1052 | PlaySound("igCharacterInfoTab"); |
||
1053 | SKMap_ShowSubFrame(tab); |
||
1054 | end |
||
1055 | else |
||
1056 | ShowUIPanel(SKMapFrame); |
||
1057 | SKMap_ShowSubFrame(tab); |
||
1058 | end |
||
1059 | end |
||
1060 | end |
||
1061 | |||
1062 | end |
||
1063 | |||
1064 | |||
1065 | function SKMap_ShowSubFrame(frameName) |
||
1066 | local FName = "SKMap_ShowSubFrame"; |
||
1067 | |||
1068 | for index, value in SKM_TAB_SUBFRAMES do |
||
1069 | MyFrame = getglobal(value); |
||
1070 | if (MyFrame) then |
||
1071 | if ( value == frameName ) then |
||
1072 | MyFrame:Show(); |
||
1073 | else |
||
1074 | MyFrame:Hide(); |
||
1075 | end |
||
1076 | end |
||
1077 | end |
||
1078 | end |
||
1079 | |||
1080 | |||
1081 | function SKMapFrame_OnLoad() |
||
1082 | -- Tab Handling code |
||
1083 | PanelTemplates_SetNumTabs(this, 4); |
||
1084 | PanelTemplates_SetTab(this, 1); |
||
1085 | --PanelTemplates_DisableTab(this, 4); |
||
1086 | end |
||
1087 | |||
1088 | |||
1089 | function SKMapFrame_OnShow() |
||
1090 | PlaySound("igCharacterInfoOpen"); |
||
1091 | end |
||
1092 | |||
1093 | |||
1094 | function SKMapFrame_OnHide() |
||
1095 | PlaySound("igCharacterInfoClose"); |
||
1096 | end |
||
1097 | |||
1098 | |||
1099 | function SKMapTab_OnClick() |
||
1100 | local FName = "SKMapTab_OnClick"; |
||
1101 | |||
1102 | local TabName = this:GetName(); |
||
1103 | |||
1104 | SkM_Trace(FName, 1, "Tab Name = "..snil(TabName)); |
||
1105 | |||
1106 | if (TabName == "SKMapFrameTab1") then |
||
1107 | SKMap_ToggleUI("SKMap_ListFrame"); |
||
1108 | elseif (TabName == "SKMapFrameTab2") then |
||
1109 | SKMap_ToggleUI("SKMap_DuelFrame"); |
||
1110 | elseif (TabName == "SKMapFrameTab3") then |
||
1111 | SKMap_ToggleUI("SKMap_ReportFrame"); |
||
1112 | elseif (TabName == "SKMapFrameTab4") then |
||
1113 | SKMap_ToggleUI("SKMap_OptionsFrame"); |
||
1114 | else |
||
1115 | SkM_Trace(FName, 1, "Unknown tab : "..snil(TabName)); |
||
1116 | end |
||
1117 | |||
1118 | PlaySound("igCharacterInfoTab"); |
||
1119 | end |
||
1120 | |||
1121 | |||
1122 | function SKMap_SetCheckOption(i, OptionDef, Column) |
||
1123 | local MyCheckButton = getglobal("SKMap_Options_Button"..i..Column.."Check"); |
||
1124 | local CheckText = getglobal("SKMap_Options_Button"..i..Column.."Check".."Text"); |
||
1125 | |||
1126 | local Option = OptionDef.Value; |
||
1127 | |||
1128 | local bValue = SkM_GetOption(Option.Option); |
||
1129 | CheckText:SetText(Option.Text); |
||
1130 | MyCheckButton.tooltipText = Option.Tooltip; |
||
1131 | |||
1132 | if (bValue) then |
||
1133 | checked = 1; |
||
1134 | else |
||
1135 | checked = 0; |
||
1136 | end |
||
1137 | MyCheckButton:SetChecked(checked); |
||
1138 | |||
1139 | --SKMapSmallTargetInfoFrame:SetPoint("TOPLEFT","SKMapTargetInfoFrame","TOPLEFT",0,0); |
||
1140 | MyCheckButton:SetPoint("TOPLEFT", "SKMap_Options_Button"..i..Column, "TOPLEFT", OptionDef.Offset, 1); |
||
1141 | |||
1142 | MyCheckButton:Show(); |
||
1143 | end |
||
1144 | |||
1145 | function SKMap_SetSliderOption(i, OptionDef, Column) |
||
1146 | local MySlider = getglobal("SKMap_Options_Button"..i..Column.."Slider"); |
||
1147 | local SliderText = getglobal("SKMap_Options_Button"..i..Column.."Slider".."Text"); |
||
1148 | |||
1149 | local Option = OptionDef.Value; |
||
1150 | local iValue = ifnil(SkM_GetOption(Option.Option), 0); |
||
1151 | |||
1152 | MySlider:SetMinMaxValues(Option.minValue, Option.maxValue); |
||
1153 | MySlider:SetValueStep(Option.valueStep); |
||
1154 | MySlider:SetValue(iValue); |
||
1155 | MySlider.tooltipText = Option.Tooltip; |
||
1156 | SliderText:SetText(iValue); |
||
1157 | |||
1158 | MySlider:SetPoint("TOPLEFT", "SKMap_Options_Button"..i..Column, "TOPLEFT", OptionDef.Offset, 1); |
||
1159 | |||
1160 | MySlider:Show(); |
||
1161 | end |
||
1162 | |||
1163 | |||
1164 | |||
1165 | function HideLineOption(i) |
||
1166 | local OptionLabel = getglobal("SKMap_Options_Button"..i.."Label"); |
||
1167 | local MySlider = getglobal("SKMap_Options_Button"..i.."Slider"); |
||
1168 | local MyCheckButton = getglobal("SKMap_Options_Button"..i.."Check"); |
||
1169 | local MyIconTexture = getglobal("SKMap_Options_Button"..i.."IconTexture"); |
||
1170 | |||
1171 | OptionLabel:Hide(); |
||
1172 | MySlider:Hide(); |
||
1173 | MyCheckButton:Hide(); |
||
1174 | MyIconTexture:Hide(); |
||
1175 | |||
1176 | local OptionLabelR = getglobal("SKMap_Options_Button"..i.."R".."Label"); |
||
1177 | local MySliderR = getglobal("SKMap_Options_Button"..i.."R".."Slider"); |
||
1178 | local MyCheckButtonR = getglobal("SKMap_Options_Button"..i.."R".."Check"); |
||
1179 | local MyIconTextureR = getglobal("SKMap_Options_Button"..i.."R".."IconTexture"); |
||
1180 | |||
1181 | OptionLabelR:Hide(); |
||
1182 | MySliderR:Hide(); |
||
1183 | MyCheckButtonR:Hide(); |
||
1184 | MyIconTextureR:Hide(); |
||
1185 | end |
||
1186 | |||
1187 | function SKMap_GetOptionLineCount() |
||
1188 | local iCount = 0; |
||
1189 | for i=1,table.getn(SKM_OptionsList),1 do |
||
1190 | if (SKM_OptionsList[i].Expanded) then |
||
1191 | iCount = iCount + table.getn(SKM_OptionsList[i].Lines) + 2; |
||
1192 | else |
||
1193 | iCount = iCount + 1; |
||
1194 | end |
||
1195 | end |
||
1196 | return iCount; |
||
1197 | end |
||
1198 | |||
1199 | function SKMap_OptionsFrame_Load() |
||
1200 | local FName = "SKMap_OptionsFrame_Load"; |
||
1201 | |||
1202 | SkM_Trace(FName, 4, "Loading frame options values"); |
||
1203 | |||
1204 | local iScrollOffset = FauxScrollFrame_GetOffset(SKMap_OptionsScrollFrame); |
||
1205 | |||
1206 | SkM_Trace(FName, 0, "Scroll offset = "..snil(iScrollOffset)); |
||
1207 | |||
1208 | local iSkipped = 0; |
||
1209 | |||
1210 | SKM_List_Options = { }; |
||
1211 | |||
1212 | local i; |
||
1213 | for i=1,SKM_OPTIONFRAME_ROWS, 1 do |
||
1214 | HideLineOption(i); |
||
1215 | end |
||
1216 | |||
1217 | local iOptionCateg = 1; |
||
1218 | local iOptionElem = 0; |
||
1219 | local i = 0; |
||
1220 | while (true) do |
||
1221 | i = i + 1; |
||
1222 | if (i > SKM_OPTIONFRAME_ROWS) then |
||
1223 | do break end; |
||
1224 | end |
||
1225 | |||
1226 | |||
1227 | if (iOptionCateg > table.getn(SKM_OptionsList)) then |
||
1228 | do break end; |
||
1229 | end |
||
1230 | |||
1231 | if (iOptionCateg <= table.getn(SKM_OptionsList)) then |
||
1232 | |||
1233 | -- initially set all categories to expanded mode |
||
1234 | if (SKM_OptionsList[iOptionCateg].Expanded == nil) then |
||
1235 | SKM_OptionsList[iOptionCateg].Expanded = true; |
||
1236 | end |
||
1237 | |||
1238 | local bSkip = false; |
||
1239 | |||
1240 | if (iSkipped < iScrollOffset) then |
||
1241 | iSkipped = iSkipped + 1; |
||
1242 | i = i - 1; |
||
1243 | bSkip = true; |
||
1244 | end |
||
1245 | |||
1246 | if (iOptionElem == -1) then |
||
1247 | -- skip line |
||
1248 | iOptionElem = iOptionElem + 1; |
||
1249 | elseif (iOptionElem == 0) then |
||
1250 | |||
1251 | if (not bSkip) then |
||
1252 | -- set category label |
||
1253 | local OptionLabel = getglobal("SKMap_Options_Button"..i.."Label"); |
||
1254 | local MyIconTexture = getglobal("SKMap_Options_Button"..i.."IconTexture"); |
||
1255 | |||
1256 | OptionLabel:SetText(SKM_OptionsList[iOptionCateg].Title.Text); |
||
1257 | OptionLabel:Show(); |
||
1258 | |||
1259 | local sTexture; |
||
1260 | if (SKM_OptionsList[iOptionCateg].Expanded) then |
||
1261 | --sTexture = SKM_Config.IconPath.."\\"..SKM_Config.Buttons.CollapseButton; |
||
1262 | sTexture = "Interface\\Buttons\\UI-MinusButton-Up" |
||
1263 | else |
||
1264 | --sTexture = SKM_Config.IconPath.."\\"..SKM_Config.Buttons.ExpandButton; |
||
1265 | sTexture = "Interface\\Buttons\\UI-PlusButton-Up" |
||
1266 | end |
||
1267 | MyIconTexture:SetTexture(sTexture); |
||
1268 | |||
1269 | --MyIconTexture:SetTexture("Interface\\Buttons\\UI-MinusButton-Up"); |
||
1270 | --MyIconTexture:SetNormalTexture("Interface\\Buttons\\UI-MinusButton-Up"); |
||
1271 | |||
1272 | MyIconTexture:Show(); |
||
1273 | |||
1274 | SKM_List_Options[i] = { }; |
||
1275 | SKM_List_Options[i].Category = iOptionCateg; |
||
1276 | end |
||
1277 | |||
1278 | if (SKM_OptionsList[iOptionCateg].Expanded) then |
||
1279 | iOptionElem = iOptionElem + 1; |
||
1280 | else |
||
1281 | iOptionCateg = iOptionCateg + 1; |
||
1282 | end |
||
1283 | |||
1284 | else |
||
1285 | |||
1286 | local Line = SKM_OptionsList[iOptionCateg].Lines[iOptionElem]; |
||
1287 | if (Line and (not bSkip)) then |
||
1288 | |||
1289 | SKM_List_Options[i] = { }; |
||
1290 | |||
1291 | if (Line.Left) then |
||
1292 | SKM_List_Options[i].Left = Line.Left.Value.Option; |
||
1293 | |||
1294 | if (Line.Left.Type == _SKM._checkButton) then |
||
1295 | SKMap_SetCheckOption(i, Line.Left, ""); |
||
1296 | elseif (Line.Left.Type == _SKM._slider) then |
||
1297 | SKMap_SetSliderOption(i, Line.Left, ""); |
||
1298 | end |
||
1299 | |||
1300 | end |
||
1301 | if (Line.Right) then |
||
1302 | SKM_List_Options[i].Right = Line.Right.Value.Option; |
||
1303 | |||
1304 | if (Line.Right.Type == _SKM._checkButton) then |
||
1305 | SKMap_SetCheckOption(i, Line.Right, "R"); |
||
1306 | elseif (Line.Right.Type == _SKM._slider) then |
||
1307 | SKMap_SetSliderOption(i, Line.Right, "R"); |
||
1308 | end |
||
1309 | end |
||
1310 | |||
1311 | end |
||
1312 | iOptionElem = iOptionElem + 1; |
||
1313 | |||
1314 | if (iOptionElem > table.getn(SKM_OptionsList[iOptionCateg].Lines)) then |
||
1315 | iOptionElem = -1; |
||
1316 | iOptionCateg = iOptionCateg + 1; |
||
1317 | end |
||
1318 | |||
1319 | |||
1320 | end |
||
1321 | |||
1322 | end |
||
1323 | end |
||
1324 | |||
1325 | local iLineCount = SKMap_GetOptionLineCount() + 1; |
||
1326 | SkM_Trace(FName, 3, "Option Lines = "..snil(iLineCount)); |
||
1327 | |||
1328 | FauxScrollFrame_Update(SKMap_OptionsScrollFrame, iLineCount, SKM_OPTIONFRAME_ROWS, SKM_OPTIONFRAME_ROWHEIGHT); |
||
1329 | end |
||
1330 | |||
1331 | |||
1332 | |||
1333 | function SKMap_OptionsFrame_Load_old() |
||
1334 | local FName = "SKMap_OptionsFrame_Load"; |
||
1335 | |||
1336 | SkM_Trace(FName, 2, "Loading frame options values"); |
||
1337 | |||
1338 | -- check buttons |
||
1339 | for idx, val in SKM_OptionsFrameCheckButtons do |
||
1340 | local bValue = SkM_GetOption(val.Option); |
||
1341 | |||
1342 | SkM_Trace(FName, 3, "Option : "..snil(val.Option)..", Value = "..snil(bValue)); |
||
1343 | |||
1344 | local MyButton = getglobal("SKMap_OptionsFrameCheckButton"..idx); |
||
1345 | local ButtonText = getglobal("SKMap_OptionsFrameCheckButton"..idx.."Text"); |
||
1346 | local checked; |
||
1347 | |||
1348 | ButtonText:SetText(val.Text); |
||
1349 | MyButton.tooltipText = val.Tooltip; |
||
1350 | |||
1351 | if (bValue) then |
||
1352 | checked = 1; |
||
1353 | else |
||
1354 | checked = 0; |
||
1355 | end |
||
1356 | |||
1357 | MyButton:SetChecked(checked); |
||
1358 | |||
1359 | end |
||
1360 | |||
1361 | -- sliders |
||
1362 | for idx, val in SKM_OptionsFrameSliders do |
||
1363 | local iValue = ifnil(SkM_GetOption(val.Option), 0); |
||
1364 | |||
1365 | local MySlider = getglobal("SKMap_OptionsFrameSlider"..idx); |
||
1366 | local SliderText = getglobal("SKMap_OptionsFrameSlider"..idx.."Text"); |
||
1367 | |||
1368 | MySlider:SetMinMaxValues(val.minValue, val.maxValue); |
||
1369 | MySlider:SetValueStep(val.valueStep); |
||
1370 | MySlider:SetValue(iValue); |
||
1371 | MySlider.tooltipText = val.Tooltip; |
||
1372 | SliderText:SetText(iValue); |
||
1373 | |||
1374 | end |
||
1375 | |||
1376 | -- labels |
||
1377 | for idx, val in SKM_OptionFrameLabels do |
||
1378 | |||
1379 | local MyLabel = getglobal("SKMap_OptionsFrameLabel"..idx.."Text"); |
||
1380 | |||
1381 | MyLabel:SetText(val.Text); |
||
1382 | end |
||
1383 | |||
1384 | end |
||
1385 | |||
1386 | |||
1387 | |||
1388 | -- obsolete in 1.1.4 |
||
1389 | function SKMap_OptionsFrame_Save() |
||
1390 | local FName = "SKMap_OptionsFrame_Save"; |
||
1391 | local MyButton; |
||
1392 | |||
1393 | SkM_Trace(FName, 1, "Saving options"); |
||
1394 | |||
1395 | -- check buttons |
||
1396 | for idx, val in SKM_OptionsFrameCheckButtons do |
||
1397 | local MyButton = getglobal("SKMap_OptionsFrameCheckButton"..idx); |
||
1398 | |||
1399 | if (not MyButton:GetChecked()) then |
||
1400 | SkM_SetOption(val.Option, false); |
||
1401 | else |
||
1402 | SkM_SetOption(val.Option, true); |
||
1403 | end |
||
1404 | end |
||
1405 | |||
1406 | -- sliders |
||
1407 | for idx, val in SKM_OptionsFrameSliders do |
||
1408 | local MySlider = getglobal("SKMap_OptionsFrameSlider"..idx); |
||
1409 | local iValue = MySlider:GetValue(); |
||
1410 | |||
1411 | SkM_SetOption(val.Option, iValue); |
||
1412 | end |
||
1413 | |||
1414 | end |
||
1415 | |||
1416 | |||
1417 | function SKMap_OptionsFrame_Cancel() |
||
1418 | SKMap_OptionsFrame_Load(); |
||
1419 | end |
||
1420 | |||
1421 | |||
1422 | -- obsolete since 1.1.4 |
||
1423 | function SKMap_SetSliderTextToValue() |
||
1424 | local FName = "SKMap_SetSliderTextToValue"; |
||
1425 | |||
1426 | local SliderName = this:GetName(); |
||
1427 | SkM_Trace(FName, 4, "Slider name = "..SliderName); |
||
1428 | |||
1429 | local MySlider = getglobal(SliderName); |
||
1430 | local SliderText = getglobal(SliderName.."Text"); |
||
1431 | |||
1432 | iValue = MySlider:GetValue(); |
||
1433 | SliderText:SetText(iValue); |
||
1434 | |||
1435 | |||
1436 | if (SliderName == "SKMap_OptionsFrameSlider3") then |
||
1437 | SkM_SetOption("MinimapButtonPosition", iValue); |
||
1438 | --SKMap_SetMiniMapIcon(iValue); |
||
1439 | SKMap_SetMiniMapIcon(); |
||
1440 | end |
||
1441 | |||
1442 | if (SliderName == "SKMap_OptionsFrameSlider4") then |
||
1443 | SkM_SetOption("MinimapButtonOffset", iValue); |
||
1444 | --SKMap_SetMiniMapIcon(iValue); |
||
1445 | SKMap_SetMiniMapIcon(); |
||
1446 | end |
||
1447 | |||
1448 | end |
||
1449 | |||
1450 | |||
1451 | function SKMap_MinimapOption() |
||
1452 | local FName = "SKMap_MinimapOption"; |
||
1453 | |||
1454 | local OptionName = this:GetName(); |
||
1455 | SkM_Trace(FName, 4, "Option name = "..OptionName); |
||
1456 | |||
1457 | local MyButton = getglobal(OptionName); |
||
1458 | |||
1459 | if (not MyButton:GetChecked()) then |
||
1460 | SkM_SetOption("ShowMinimapButton", false); |
||
1461 | |||
1462 | else |
||
1463 | SkM_SetOption("ShowMinimapButton", true); |
||
1464 | end |
||
1465 | SKMap_SetMiniMapIcon(); |
||
1466 | |||
1467 | end |
||
1468 | |||
1469 | |||
1470 | function SKMap_ListFrame_Load() |
||
1471 | local FName = "SKMap_ListFrame_Load"; |
||
1472 | |||
1473 | SkM_Trace(FName, 1, "Loading ListFrame"); |
||
1474 | |||
1475 | local idx = 1; |
||
1476 | local MyButton = getglobal("SKMap_ListFrameCheckButton"..idx); |
||
1477 | local ButtonText = getglobal("SKMap_ListFrameCheckButton"..idx.."Text"); |
||
1478 | ButtonText:SetText(SKM_UI_STRINGS.List_Button_FilterNoWar); |
||
1479 | MyButton.tooltipText = SKM_UI_STRINGS.List_Tooltip_FilterNoWar; |
||
1480 | |||
1481 | if (SKM_List_ActiveList == _SKM._players) then |
||
1482 | |||
1483 | if (SKMap_PlayerListUpdateNeeded()) then |
||
1484 | SKMap_SetListContent(); |
||
1485 | SKMap_ListFrame_UpdateList(); |
||
1486 | SKMap_ListFrame_SortList(); |
||
1487 | end |
||
1488 | |||
1489 | elseif (SKM_List_ActiveList == _SKM._guilds) then |
||
1490 | SKMap_SetGuildListContent(); |
||
1491 | SKMap_ListFrame_UpdateGuildList(); |
||
1492 | SKMap_ListFrame_SortGuildList(); |
||
1493 | end |
||
1494 | |||
1495 | |||
1496 | end |
||
1497 | |||
1498 | |||
1499 | function SKMap_Column_SetWidth(width, frame) |
||
1500 | if ( not frame ) then |
||
1501 | frame = this; |
||
1502 | end |
||
1503 | frame:SetWidth(width); |
||
1504 | getglobal(frame:GetName().."Middle"):SetWidth(width - 9); |
||
1505 | end |
||
1506 | |||
1507 | |||
1508 | |||
1509 | function SKMap_ListFrame_UpdateList() |
||
1510 | local FName = "SKMap_ListFrame_UpdateList"; |
||
1511 | |||
1512 | local iScrollOffset = FauxScrollFrame_GetOffset(SKMap_ListScrollFrame); |
||
1513 | |||
1514 | SkM_Trace(FName, 4, "Scrollbar offset = "..snil(iScrollOffset)); |
||
1515 | |||
1516 | |||
1517 | local iEnemyCount = table.getn(SKM_List_Content); |
||
1518 | SkM_Trace(FName, 4, "Enemy Count = "..snil(iEnemyCount)); |
||
1519 | |||
1520 | local iEnemyIndex = iScrollOffset + 1; |
||
1521 | |||
1522 | SkM_Trace(FName, 4, "Enemy Index = "..snil(iEnemyIndex)); |
||
1523 | |||
1524 | local i; |
||
1525 | for i=1, SKM_LISTFRAME_ROWS, 1 do |
||
1526 | local RowButton = getglobal("SKMap_ListFrameButton"..i); |
||
1527 | |||
1528 | if (iEnemyIndex <= iEnemyCount) then |
||
1529 | |||
1530 | RowButtonName = getglobal("SKMap_ListFrameButton"..i.."Name"); |
||
1531 | RowButtonGuild = getglobal("SKMap_ListFrameButton"..i.."Guild"); |
||
1532 | RowButtonLevel = getglobal("SKMap_ListFrameButton"..i.."Level"); |
||
1533 | RowButtonRace = getglobal("SKMap_ListFrameButton"..i.."Race"); |
||
1534 | RowButtonClass = getglobal("SKMap_ListFrameButton"..i.."Class"); |
||
1535 | RowButtonKill = getglobal("SKMap_ListFrameButton"..i.."Kill"); |
||
1536 | RowButtonDeath = getglobal("SKMap_ListFrameButton"..i.."Death"); |
||
1537 | RowButtonMet = getglobal("SKMap_ListFrameButton"..i.."Met"); |
||
1538 | RowButtonLastSeen = getglobal("SKMap_ListFrameButton"..i.."LastSeen"); |
||
1539 | RowButtonAtWar = getglobal("SKMap_ListFrameButton"..i.."AtWar"); |
||
1540 | |||
1541 | local sName = ifnil(SKM_List_Content[iEnemyIndex][_SKM._name], "??"); |
||
1542 | local sGuild = ifnil(SKM_List_Content[iEnemyIndex][_SKM._guild], "??"); |
||
1543 | local sLevel = ifnil(SKM_List_Content[iEnemyIndex][_SKM._level], "??"); |
||
1544 | |||
1545 | local sRace = ifnil(SKM_List_Content[iEnemyIndex][_SKM._race], "??"); |
||
1546 | local sClass = ifnil(SKM_List_Content[iEnemyIndex][_SKM._class], "??"); |
||
1547 | local sLastSeen = ifnil(SKM_List_Content[iEnemyIndex][_SKM._lastView], "??"); |
||
1548 | |||
1549 | local bAtWar = SKM_List_Content[iEnemyIndex][_SKM._atWar]; |
||
1550 | |||
1551 | local sGuild = SKM_List_Content[iEnemyIndex][_SKM._guild]; |
||
1552 | |||
1553 | local Guild; |
||
1554 | if (sGuild ~= nil) and (sGuild ~= "") then |
||
1555 | Guild = SKM_Data[_RealmName][_PlayerName].GuildHistory[sGuild]; |
||
1556 | end |
||
1557 | |||
1558 | local bGuildWar; |
||
1559 | if (Guild) then |
||
1560 | bGuildWar = Guild[_SKM._atWar]; |
||
1561 | end |
||
1562 | |||
1563 | if (bAtWar) then |
||
1564 | sName = SKM_Config.Col_PlayerWar..sName; |
||
1565 | end |
||
1566 | if (bGuildWar) then |
||
1567 | sGuild = SKM_Config.Col_PlayerWar..sGuild; |
||
1568 | end |
||
1569 | |||
1570 | local sWar = ""; |
||
1571 | -- 0.08.1 Begin of modification: localization |
||
1572 | if (bAtWar and bGuildWar) then |
||
1573 | sWar = SKM_Config.Col_PlayerWar..SKMAP_COLUMN_ATWAR_ALL; |
||
1574 | elseif (bAtWar) then |
||
1575 | sWar = SKM_Config.Col_PlayerWar..SKMAP_COLUMN_ATWAR_PLAYER; |
||
1576 | elseif (bGuildWar) then |
||
1577 | sWar = SKM_Config.Col_PlayerWar..SKMAP_COLUMN_ATWAR_GUILD; |
||
1578 | end |
||
1579 | -- 0.08.1 End of modification: localization |
||
1580 | |||
1581 | |||
1582 | local iKill = ifnil(SKM_List_Content[iEnemyIndex][_SKM._playerKill], 0) + ifnil(SKM_List_Content[iEnemyIndex][_SKM._playerAssistKill], 0) + ifnil(SKM_List_Content[iEnemyIndex][_SKM._playerFullKill], 0); |
||
1583 | local iDeath = ifnil(SKM_List_Content[iEnemyIndex][_SKM._enemyKillPlayer], 0); |
||
1584 | local iMet = ifnil(SKM_List_Content[iEnemyIndex][_SKM._meetCount], 0); |
||
1585 | |||
1586 | if (sLevel == -1) then |
||
1587 | sLevel = "++"; |
||
1588 | end |
||
1589 | |||
1590 | RowButtonName:SetText(sName); |
||
1591 | RowButtonGuild:SetText(sGuild); |
||
1592 | RowButtonLevel:SetText(sLevel); |
||
1593 | RowButtonRace:SetText(sRace); |
||
1594 | RowButtonClass:SetText(sClass); |
||
1595 | |||
1596 | RowButtonKill:SetText(iKill); |
||
1597 | RowButtonDeath:SetText(iDeath); |
||
1598 | RowButtonMet:SetText(iMet); |
||
1599 | RowButtonLastSeen:SetText(sLastSeen); |
||
1600 | RowButtonAtWar:SetText(sWar); |
||
1601 | |||
1602 | RowButton:Show(); |
||
1603 | |||
1604 | iEnemyIndex = iEnemyIndex + 1; |
||
1605 | else |
||
1606 | RowButton:Hide(); |
||
1607 | end |
||
1608 | end |
||
1609 | |||
1610 | FauxScrollFrame_Update(SKMap_ListScrollFrame, iEnemyCount, SKM_LISTFRAME_ROWS, SKM_LISTFRAME_ROWHEIGHT); |
||
1611 | end |
||
1612 | |||
1613 | |||
1614 | function SKMap_List_CompareElem(v1, v2, ReverseSort) |
||
1615 | local FName = "SKMap_List_CompareElem"; |
||
1616 | |||
1617 | SkM_Trace(FName, 4, "v1 = "..snil(v1)); |
||
1618 | SkM_Trace(FName, 4, "v2 = "..snil(v2)); |
||
1619 | |||
1620 | if (v1 == nil) and (v2 ~= nil) then |
||
1621 | return true; |
||
1622 | elseif (v2 == nil) and (v1 ~= nil) then |
||
1623 | return false; |
||
1624 | elseif (v1 ~= nil) and (v2 ~= nil) then |
||
1625 | |||
1626 | if (ReverseSort) then |
||
1627 | if (v1 < v2) then |
||
1628 | return false; |
||
1629 | elseif (v2 < v1) then |
||
1630 | return true; |
||
1631 | end |
||
1632 | else |
||
1633 | if (v1 < v2) then |
||
1634 | return true; |
||
1635 | elseif (v2 < v1) then |
||
1636 | return false; |
||
1637 | end |
||
1638 | end |
||
1639 | end |
||
1640 | |||
1641 | return; |
||
1642 | end |
||
1643 | |||
1644 | |||
1645 | function SKMap_ListFrame_SubSort(e1, e2, SortType, ReverseSort) |
||
1646 | local FName = "SKMap_ListFrame_SubSort"; |
||
1647 | |||
1648 | SkM_Trace(FName, 4, "SortType = "..snil(SortType)); |
||
1649 | |||
1650 | if (SortType == "Name") then |
||
1651 | --local sName1 = string.upper(e1[_SKM._name]); |
||
1652 | local sName1 = SkM_NormalizeString(e1[_SKM._name]); |
||
1653 | --local sName2 = string.upper(e2[_SKM._name]); |
||
1654 | local sName2 = SkM_NormalizeString(e2[_SKM._name]); |
||
1655 | local bCmp = SKMap_List_CompareElem(sName1, sName2, ReverseSort); |
||
1656 | if (bCmp ~= nil) then |
||
1657 | return bCmp; |
||
1658 | end |
||
1659 | |||
1660 | elseif (SortType == "Guild") then |
||
1661 | -- some dumb people started their guild name with a lowercase character. convert it to upper |
||
1662 | -- before sorting |
||
1663 | --local sGuild1 = string.upper(ifnil(e1[_SKM._guild], "??")); |
||
1664 | local sGuild1 = SkM_NormalizeString(ifnil(e1[_SKM._guild], "??")); |
||
1665 | --local sGuild2 = string.upper(ifnil(e2[_SKM._guild], "??")); |
||
1666 | local sGuild2 = SkM_NormalizeString(ifnil(e2[_SKM._guild], "??")); |
||
1667 | local bCmp = SKMap_List_CompareElem(sGuild1, sGuild2, ReverseSort); |
||
1668 | if (bCmp ~= nil) then |
||
1669 | return bCmp; |
||
1670 | end |
||
1671 | |||
1672 | elseif (SortType == "Level") then |
||
1673 | local iLevel1 = ifnil(e1[_SKM._level], 0); |
||
1674 | local iLevel2 = ifnil(e2[_SKM._level], 0); |
||
1675 | if (iLevel1 == -1) then |
||
1676 | iLevel1 = 500; |
||
1677 | end |
||
1678 | if (iLevel2 == -1) then |
||
1679 | iLevel2 = 500; |
||
1680 | end |
||
1681 | local bCmp = SKMap_List_CompareElem(iLevel1, iLevel2, ReverseSort); |
||
1682 | if (bCmp ~= nil) then |
||
1683 | return bCmp; |
||
1684 | end |
||
1685 | |||
1686 | elseif (SortType == "Race") then |
||
1687 | local bCmp = SKMap_List_CompareElem(ifnil(e1[_SKM._race], ""), ifnil(e2[_SKM._race], ""), ReverseSort); |
||
1688 | if (bCmp ~= nil) then |
||
1689 | return bCmp; |
||
1690 | end |
||
1691 | |||
1692 | elseif (SortType == "Class") then |
||
1693 | local bCmp = SKMap_List_CompareElem(ifnil(e1[_SKM._class], ""), ifnil(e2[_SKM._class], ""), ReverseSort); |
||
1694 | if (bCmp ~= nil) then |
||
1695 | return bCmp; |
||
1696 | end |
||
1697 | |||
1698 | elseif (SortType == "Kill") then |
||
1699 | local iKill1 = ifnil(e1[_SKM._playerKill], 0) + ifnil(e1[_SKM._playerAssistKill], 0) + ifnil(e1[_SKM._playerFullKill], 0); |
||
1700 | local iKill2 = ifnil(e2[_SKM._playerKill], 0) + ifnil(e2[_SKM._playerAssistKill], 0) + ifnil(e2[_SKM._playerFullKill], 0); |
||
1701 | |||
1702 | local bCmp = SKMap_List_CompareElem(iKill1, iKill2, ReverseSort); |
||
1703 | if (bCmp ~= nil) then |
||
1704 | return bCmp; |
||
1705 | end |
||
1706 | |||
1707 | elseif (SortType == "Death") then |
||
1708 | local iDeath1 = ifnil(e1[_SKM._enemyKillPlayer], 0); |
||
1709 | local iDeath2 = ifnil(e2[_SKM._enemyKillPlayer], 0); |
||
1710 | |||
1711 | local bCmp = SKMap_List_CompareElem(iDeath1, iDeath2, ReverseSort); |
||
1712 | if (bCmp ~= nil) then |
||
1713 | return bCmp; |
||
1714 | end |
||
1715 | |||
1716 | elseif (SortType == "Met") then |
||
1717 | local iMet1 = ifnil(e1[_SKM._meetCount], 0); |
||
1718 | local iMet2 = ifnil(e2[_SKM._meetCount], 0); |
||
1719 | |||
1720 | local bCmp = SKMap_List_CompareElem(iMet1, iMet2, ReverseSort); |
||
1721 | if (bCmp ~= nil) then |
||
1722 | return bCmp; |
||
1723 | end |
||
1724 | |||
1725 | elseif (SortType == "LastSeen") then |
||
1726 | local sDate1 = SkM_GetSortableDate(e1[_SKM._lastView]); |
||
1727 | local sDate2 = SkM_GetSortableDate(e2[_SKM._lastView]); |
||
1728 | |||
1729 | local bCmp = SKMap_List_CompareElem(ifnil(sDate1, ""), ifnil(sDate2, ""), ReverseSort); |
||
1730 | if (bCmp ~= nil) then |
||
1731 | return bCmp; |
||
1732 | end |
||
1733 | |||
1734 | elseif (SortType == "AtWar") then |
||
1735 | local sWar1 = ""; |
||
1736 | local sWar2 = ""; |
||
1737 | if (e1[_SKM._atWar]) or (e1[_SKM._guildAtWar]) then |
||
1738 | sWar1 = "WAR"; |
||
1739 | end |
||
1740 | if (e2[_SKM._atWar]) or (e2[_SKM._guildAtWar]) then |
||
1741 | sWar2 = "WAR"; |
||
1742 | end |
||
1743 | |||
1744 | local bCmp = SKMap_List_CompareElem(sWar1, sWar2, ReverseSort); |
||
1745 | if (bCmp ~= nil) then |
||
1746 | return bCmp; |
||
1747 | end |
||
1748 | |||
1749 | elseif (SortType == "Members") then |
||
1750 | local iMembers1 = ifnil(e1[_SKM._members], 0); |
||
1751 | local iMembers2 = ifnil(e2[_SKM._members], 0); |
||
1752 | |||
1753 | local bCmp = SKMap_List_CompareElem(iMembers1, iMembers2, ReverseSort); |
||
1754 | if (bCmp ~= nil) then |
||
1755 | return bCmp; |
||
1756 | end |
||
1757 | |||
1758 | elseif (SortType == "Win") then |
||
1759 | local iWin1 = ifnil(e1[_SKM._win], 0); |
||
1760 | local iWin2 = ifnil(e2[_SKM._win], 0); |
||
1761 | |||
1762 | local bCmp = SKMap_List_CompareElem(iWin1, iWin2, ReverseSort); |
||
1763 | if (bCmp ~= nil) then |
||
1764 | return bCmp; |
||
1765 | end |
||
1766 | |||
1767 | elseif (SortType == "Loss") then |
||
1768 | local iLoss1 = ifnil(e1[_SKM._loss], 0); |
||
1769 | local iLoss2 = ifnil(e2[_SKM._loss], 0); |
||
1770 | |||
1771 | local bCmp = SKMap_List_CompareElem(iLoss1, iLoss2, ReverseSort); |
||
1772 | if (bCmp ~= nil) then |
||
1773 | return bCmp; |
||
1774 | end |
||
1775 | |||
1776 | elseif (SortType == "Duel") then |
||
1777 | local iDuel1 = ifnil(e1[_SKM._duel], 0); |
||
1778 | local iDuel2 = ifnil(e2[_SKM._duel], 0); |
||
1779 | |||
1780 | local bCmp = SKMap_List_CompareElem(iDuel1, iDuel2, ReverseSort); |
||
1781 | if (bCmp ~= nil) then |
||
1782 | return bCmp; |
||
1783 | end |
||
1784 | |||
1785 | elseif (SortType == "LastDuel") then |
||
1786 | local sDate1 = SkM_GetSortableDate(e1[_SKM._lastDuel]); |
||
1787 | local sDate2 = SkM_GetSortableDate(e2[_SKM._lastDuel]); |
||
1788 | |||
1789 | local bCmp = SKMap_List_CompareElem(ifnil(sDate1, ""), ifnil(sDate2, ""), ReverseSort); |
||
1790 | if (bCmp ~= nil) then |
||
1791 | return bCmp; |
||
1792 | end |
||
1793 | |||
1794 | elseif (SortType == "Score") then |
||
1795 | local iScore1 = ifnil(e1[_SKM._score], 0); |
||
1796 | local iScore2 = ifnil(e2[_SKM._score], 0); |
||
1797 | |||
1798 | local bCmp = SKMap_List_CompareElem(iScore1, iScore2, ReverseSort); |
||
1799 | if (bCmp ~= nil) then |
||
1800 | return bCmp; |
||
1801 | end |
||
1802 | |||
1803 | end |
||
1804 | return nil; |
||
1805 | end |
||
1806 | |||
1807 | |||
1808 | function SKMap_ListFrame_Sort(e1, e2) |
||
1809 | local FName = "SKMap_ListFrame_Sort"; |
||
1810 | |||
1811 | SkM_Trace(FName, 4, "Begin"); |
||
1812 | |||
1813 | if (e1 == nil) then |
||
1814 | if (e2 == nil) then |
||
1815 | return false; |
||
1816 | else |
||
1817 | return true; |
||
1818 | end |
||
1819 | elseif (e2 == nil) then |
||
1820 | return false; |
||
1821 | end |
||
1822 | |||
1823 | --local iSortTypes = table.getn(SKM_List_SortTypes); |
||
1824 | local iSortTypes = table.getn( SkM_GetOption("EnemyList_SortTypes") ); |
||
1825 | |||
1826 | local i; |
||
1827 | for i=1, iSortTypes, 1 do |
||
1828 | local bReverseSort = false; |
||
1829 | --if (i == 1) and (SKM_List_ReverseSort == true) then |
||
1830 | if (i == 1) and ( SkM_GetOption("EnemyList_ReverseSort") ) then |
||
1831 | bReverseSort = true; |
||
1832 | end |
||
1833 | --local bCmp = SKMap_ListFrame_SubSort(e1, e2, SKM_List_SortTypes[i], bReverseSort); |
||
1834 | local bCmp = SKMap_ListFrame_SubSort(e1, e2, SkM_GetOption("EnemyList_SortTypes")[i], bReverseSort); |
||
1835 | if (bCmp ~= nil) then |
||
1836 | return bCmp; |
||
1837 | end |
||
1838 | end |
||
1839 | return false; |
||
1840 | end |
||
1841 | |||
1842 | |||
1843 | function SKMap_ListFrame_SortList(sSortType) |
||
1844 | local FName = "SKMap_ListFrame_SortList"; |
||
1845 | |||
1846 | if (sSortType) then |
||
1847 | --if (sSortType == SKM_List_SortType) then |
||
1848 | if (sSortType == SkM_GetOption("EnemyList_SortType")) then |
||
1849 | --if (SKM_List_ReverseSort) then |
||
1850 | if ( SkM_GetOption("EnemyList_ReverseSort") ) then |
||
1851 | --SKM_List_ReverseSort = false; |
||
1852 | SkM_SetOption("EnemyList_ReverseSort", false); |
||
1853 | else |
||
1854 | --SKM_List_ReverseSort = true; |
||
1855 | SkM_SetOption("EnemyList_ReverseSort", true); |
||
1856 | end |
||
1857 | else |
||
1858 | --SKM_List_SortType = sSortType; |
||
1859 | SkM_SetOption("EnemyList_SortType", sSortType); |
||
1860 | |||
1861 | --SKM_List_SortTypes = removefromlist(sSortType, SKM_List_SortTypes); |
||
1862 | SKM_Settings.EnemyList_SortTypes = removefromlist(sSortType, SkM_GetOption("EnemyList_SortTypes") ); |
||
1863 | --table.insert(SKM_List_SortTypes, 1, sSortType); |
||
1864 | table.insert(SKM_Settings.EnemyList_SortTypes, 1, sSortType); |
||
1865 | end |
||
1866 | end |
||
1867 | |||
1868 | if (SKM_List_Content) then |
||
1869 | table.sort(SKM_List_Content, SKMap_ListFrame_Sort); |
||
1870 | end |
||
1871 | |||
1872 | SKMap_ListFrame_UpdateList(); |
||
1873 | end |
||
1874 | |||
1875 | |||
1876 | function SKMap_SetListContent() |
||
1877 | local FName = "SKMap_SetListContent"; |
||
1878 | |||
1879 | SKM_List_Content = { }; |
||
1880 | |||
1881 | local idx, val; |
||
1882 | for idx, val in SKM_Data[_RealmName][_PlayerName].EnemyHistory do |
||
1883 | local Elem = copytable(val); |
||
1884 | |||
1885 | if (Elem[_SKM._guild] == "not in a guild") then |
||
1886 | SKM_Data[_RealmName][_PlayerName].EnemyHistory[idx][_SKM._guild] = ""; |
||
1887 | end |
||
1888 | |||
1889 | Elem[_SKM._class] = SkM_GetClassText(Elem[_SKM._class]); |
||
1890 | Elem[_SKM._race] = SkM_GetRaceText(Elem[_SKM._race]); |
||
1891 | |||
1892 | -- also retrieve guild "at war" status |
||
1893 | local Guild; |
||
1894 | if (Elem[_SKM._guild] ~= nil) and (Elem[_SKM._guild] ~= "") then |
||
1895 | Guild = SKM_Data[_RealmName][_PlayerName].GuildHistory[val[_SKM._guild]]; |
||
1896 | end |
||
1897 | if (Guild) and (Guild[_SKM._atWar]) then |
||
1898 | Elem[_SKM._guildAtWar] = true; |
||
1899 | end |
||
1900 | |||
1901 | -- check if element has to be filtered out or not |
||
1902 | local bFilter = false; |
||
1903 | if (SKM_Config.FilterNotAtWar == true) then |
||
1904 | if ( not ((Elem[_SKM._atWar]) or (Elem[_SKM._guildAtWar])) ) then |
||
1905 | bFilter = true; |
||
1906 | end |
||
1907 | end |
||
1908 | |||
1909 | if (bFilter == false) then |
||
1910 | table.insert(SKM_List_Content, Elem); |
||
1911 | end |
||
1912 | end |
||
1913 | |||
1914 | end |
||
1915 | |||
1916 | |||
1917 | function SKMap_ListFrame_SelectElement(sPlayerName) |
||
1918 | local FName = "SKMap_ListFrame_SelectElement"; |
||
1919 | |||
1920 | local sName; |
||
1921 | |||
1922 | if (sPlayerName ~= nil) then |
||
1923 | sName = sPlayerName; |
||
1924 | else |
||
1925 | local id = this:GetID(); |
||
1926 | local iScrollOffset = FauxScrollFrame_GetOffset(SKMap_ListScrollFrame); |
||
1927 | local iEnemyCount = table.getn(SKM_List_Content); |
||
1928 | |||
1929 | SkM_Trace(FName, 3, "Scroll offset = "..iScrollOffset); |
||
1930 | SkM_Trace(FName, 3, "Line id = "..id); |
||
1931 | |||
1932 | local iEnemyIndex = iScrollOffset + id; |
||
1933 | SkM_Trace(FName, 3, "Enemy Index = "..iEnemyIndex); |
||
1934 | |||
1935 | if (iEnemyIndex <= iEnemyCount) then |
||
1936 | sName = SKM_List_Content[iEnemyIndex][_SKM._name]; |
||
1937 | end |
||
1938 | |||
1939 | end |
||
1940 | |||
1941 | local Enemy; |
||
1942 | if (sName ~= nil) then |
||
1943 | Enemy = SKM_Data[_RealmName][_PlayerName].EnemyHistory[sName]; |
||
1944 | end |
||
1945 | |||
1946 | local Lines = { }; |
||
1947 | |||
1948 | if (Enemy ~= nil) then |
||
1949 | SKM_List_SelectedPlayer = sName; |
||
1950 | |||
1951 | local Guild; |
||
1952 | |||
1953 | local sGuild = ifnil(Enemy[_SKM._guild], "??"); |
||
1954 | local sLevel = ifnil(Enemy[_SKM._level], "??"); |
||
1955 | local sRace = ifnil(SkM_GetRaceText(Enemy[_SKM._race]), "??"); |
||
1956 | local sClass = ifnil(SkM_GetClassText(Enemy[_SKM._class]), "??"); |
||
1957 | local sLastSeen = ifnil(Enemy[_SKM._lastView], "??"); |
||
1958 | |||
1959 | local iKill = ifnil(Enemy[_SKM._playerKill], 0); |
||
1960 | local iAssistKill = ifnil(Enemy[_SKM._playerAssistKill], 0); |
||
1961 | local iFullKill = ifnil(Enemy[_SKM._playerFullKill], 0); |
||
1962 | local iTotalKill = iKill + iAssistKill + iFullKill; |
||
1963 | local iDeath = ifnil(Enemy[_SKM._enemyKillPlayer], 0); |
||
1964 | local iMet = ifnil(Enemy[_SKM._meetCount], 0); |
||
1965 | local iLoneWolf = ifnil(Enemy[_SKM._loneWolfKill], 0); |
||
1966 | local iBGKill = ifnil(Enemy[_SKM._playerBGKill], 0); |
||
1967 | local iBGDeath = ifnil(Enemy[_SKM._enemyKillBG], 0); |
||
1968 | |||
1969 | if (sLevel == -1) then |
||
1970 | sLevel = "++"; |
||
1971 | end |
||
1972 | |||
1973 | local bAtWar; |
||
1974 | if (Enemy[_SKM._atWar]) then |
||
1975 | bAtWar = true; |
||
1976 | else |
||
1977 | bAtWar = false; |
||
1978 | end |
||
1979 | |||
1980 | SKMap_ListFrame_ShowWarButton(bAtWar); |
||
1981 | |||
1982 | local bGuildWar; |
||
1983 | if (Enemy[_SKM._guild] ~= nil) and (Enemy[_SKM._guild] ~= "") then |
||
1984 | Guild = SKM_Data[_RealmName][_PlayerName].GuildHistory[sGuild]; |
||
1985 | end |
||
1986 | if (Guild ~= nil) then |
||
1987 | bGuildWar = Guild[_SKM._atWar]; |
||
1988 | SKMap_ListFrame_ShowPlayerGuildButton:Show(); |
||
1989 | else |
||
1990 | SKMap_ListFrame_ShowPlayerGuildButton:Hide(); |
||
1991 | end |
||
1992 | |||
1993 | SKMap_ListFrame_EditNote:Show(); |
||
1994 | SKMap_ListFrame_ReportButton:Show(); |
||
1995 | SKMap_ListFrame_DeleteButton:Show(); |
||
1996 | SKMap_ListFrame_BackToPlayersButton:Hide(); |
||
1997 | |||
1998 | -- line 1 : player name and (optional) war status |
||
1999 | local sLine = ""; |
||
2000 | |||
2001 | sLine = sLine..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_Player; -- 0.08.2 Add localization |
||
2002 | if (Enemy[_SKM._rank]) then |
||
2003 | sLine = sLine..SKM_Config.Col_Rank..Enemy[_SKM._rank].." "; |
||
2004 | end |
||
2005 | if (bAtWar) then |
||
2006 | sLine = sLine..SKM_Config.Col_PlayerWar; |
||
2007 | else |
||
2008 | sLine = sLine..SKM_Config.Col_Label; |
||
2009 | end |
||
2010 | sLine = sLine..sName..SKM_Config.Col_Label; |
||
2011 | if (bAtWar) then |
||
2012 | sLine = sLine.." - "..SKM_Config.Col_PlayerWar..SKM_UI_STRINGS.Small_Target_War; |
||
2013 | if (Enemy[_SKM._warDate]) then |
||
2014 | --local sDisplayDate = string.sub(Enemy[_SKM._warDate], 1, 10); |
||
2015 | local sDisplayDate = Enemy[_SKM._warDate]; |
||
2016 | sLine = sLine.." "..SKM_UI_STRINGS.Since..sDisplayDate; |
||
2017 | end |
||
2018 | end |
||
2019 | |||
2020 | table.insert(Lines, sLine); |
||
2021 | |||
2022 | |||
2023 | -- line 2 (optional) : player guild and (optional) war status |
||
2024 | if (Guild ~= nil) then |
||
2025 | |||
2026 | local sLine = ""; |
||
2027 | sLine = sLine..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_Guild; -- 0.08.2 Add localization |
||
2028 | |||
2029 | if (bGuildWar) then |
||
2030 | sLine = sLine..SKM_Config.Col_PlayerWar; |
||
2031 | else |
||
2032 | sLine = sLine..SKM_Config.Col_Label; |
||
2033 | end |
||
2034 | |||
2035 | sLine = sLine..sGuild..SKM_Config.Col_Label; |
||
2036 | if (bGuildWar) then |
||
2037 | sLine = sLine.." - "..SKM_Config.Col_PlayerWar..SKM_UI_STRINGS.Small_Target_War; |
||
2038 | if (Guild[_SKM._warDate]) then |
||
2039 | --local sDisplayDate = string.sub(Guild[_SKM._warDate], 1, 10); |
||
2040 | local sDisplayDate = Guild[_SKM._warDate]; |
||
2041 | sLine = sLine.." "..SKM_UI_STRINGS.Since..sDisplayDate; |
||
2042 | end |
||
2043 | --sLine = sLine..SKM_Config.Col_Label.."]"; |
||
2044 | end |
||
2045 | |||
2046 | table.insert(Lines, sLine); |
||
2047 | end |
||
2048 | |||
2049 | |||
2050 | -- line 3 (optional, not shown if info not available) : level race class |
||
2051 | if (Enemy[_SKM._level] ~= nil) and (Enemy[_SKM._race] ~= nil) and (Enemy[_SKM._class] ~= nil) then |
||
2052 | |||
2053 | local sLine = ""; |
||
2054 | sLine = sLine..SKM_Config.Col_Label..SKM_UI_STRINGS.List_Frame_Level..sLevel.." "..sRace.." "..sClass; -- 0.08.2 Add localization |
||
2055 | |||
2056 | table.insert(Lines, sLine); |
||
2057 | end |
||
2058 | |||
2059 | |||
2060 | -- line 4 : last seen time and location |
||
2061 | if (Enemy[_SKM._lastView] ~= nil) then |
||
2062 | |||
2063 | local sLine = ""; |
||
2064 | |||
2065 | sLine = sLine..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_Last_Seen; -- 0.08.2 Add localization |
||
2066 | sLine = sLine..SKM_Config.Col_Label..Enemy[_SKM._lastView]; |
||
2067 | |||
2068 | if (Enemy[_SKM._continent] ~= nil) and (Enemy[_SKM._zone] ~= nil) then |
||
2069 | --local sZoneText = SKM_Context.Zones[Enemy[_SKM._continent]][Enemy[_SKM._zone]]; |
||
2070 | local sZoneText = SkM_GetZoneTextFromIndex(Enemy[_SKM._continent], Enemy[_SKM._zone]); |
||
2071 | sLine = sLine.." - "..sZoneText; |
||
2072 | elseif (Enemy[_SKM._zoneName] ~= nil) then |
||
2073 | sLine = sLine.." - "..Enemy[_SKM._zoneName]; |
||
2074 | end |
||
2075 | |||
2076 | table.insert(Lines, sLine); |
||
2077 | end |
||
2078 | |||
2079 | |||
2080 | -- line 5 : last update time (optional, only if different from last seen time) |
||
2081 | -- if (Enemy[_lastUpdate] ~= nil) and (not Enemy[_lastUpdate] == Enemy[_SKM._lastView]) then |
||
2082 | -- local sLine = ""; |
||
2083 | -- sLine = sLine..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_Last_Updated; -- 0.08.2 Add localization |
||
2084 | -- sLine = sLine..SKM_Config.Col_Label..Enemy[_lastUpdate]; |
||
2085 | -- table.insert(Lines, sLine); |
||
2086 | -- end |
||
2087 | |||
2088 | |||
2089 | -- line 6 : meet and death counts |
||
2090 | local sLine = ""; |
||
2091 | |||
2092 | sLine = sLine..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_Met..SKM_Config.Col_PlayerMet..iMet; -- 0.08.2 Add localization |
||
2093 | sLine = sLine.." "..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_Death..SKM_Config.Col_PlayerDeath .. iDeath; -- 0.08.2 Add localization |
||
2094 | sLine = sLine.." "..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_LoneWolf..SKM_Config.Col_LoneWolfKill .. iLoneWolf; |
||
2095 | |||
2096 | table.insert(Lines, sLine); |
||
2097 | |||
2098 | |||
2099 | -- line 7 : kill counts |
||
2100 | local sLine = ""; |
||
2101 | |||
2102 | sLine = sLine..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_Kill..SKM_Config.Col_PlayerTotalKill..iTotalKill; -- 0.08.2 Add localization |
||
2103 | sLine = sLine.." "..SKM_Config.Col_Label.."( "; |
||
2104 | sLine = sLine..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_Full..SKM_Config.Col_PlayerFullKill..iFullKill; -- 0.08.2 Add localization |
||
2105 | sLine = sLine..SKM_Config.Col_Label.." + "..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_Standard..SKM_Config.Col_PlayerKill..iKill; -- 0.08.2 Add localization |
||
2106 | sLine = sLine..SKM_Config.Col_Label.." + "..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_Assist..SKM_Config.Col_PlayerAssistKill..iAssistKill..SKM_Config.Col_Label.." )"; -- 0.08.2 Add localization |
||
2107 | |||
2108 | table.insert(Lines, sLine); |
||
2109 | |||
2110 | |||
2111 | -- Line : honor kills and remaining potential kills today |
||
2112 | local sLine = ""; |
||
2113 | |||
2114 | if (ifnil(Enemy[_SKM._honorKill], 0) > 0) then |
||
2115 | local iRemaining = SkM_GetHonorRemainingKills(sName); |
||
2116 | sLine = sLine..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_HonorKill..SKM_Config.Col_HonorKill..Enemy[_SKM._honorKill]; |
||
2117 | if (iRemaining == 0) then |
||
2118 | sLine = sLine..SKM_Config.Col_Label.." ( "..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_RemainHonor..SKM_Config.Col_Honorless..iRemaining..SKM_Config.Col_Label.." )"; |
||
2119 | else |
||
2120 | sLine = sLine..SKM_Config.Col_Label.." ( "..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_RemainHonor..SKM_Config.Col_HonorKill..iRemaining..SKM_Config.Col_Label.." )"; |
||
2121 | end |
||
2122 | sLine = sLine.." "; |
||
2123 | end |
||
2124 | |||
2125 | if (iBGKill > 0 or iBGDeath > 0) then |
||
2126 | sLine = sLine..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_BGKill..SKM_Config.Col_BGKill .. iBGKill; |
||
2127 | sLine = sLine.." "; |
||
2128 | sLine = sLine..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_BGDeath..SKM_Config.Col_BGDeath .. iBGDeath; |
||
2129 | end |
||
2130 | |||
2131 | if (sLine ~= "") then |
||
2132 | table.insert(Lines, sLine); |
||
2133 | end |
||
2134 | |||
2135 | -- line 8 : player notes |
||
2136 | if (Enemy[_SKM._playerNote] ~= nil) and (Enemy[_SKM._playerNote] ~= "") then |
||
2137 | local sLine = ""; |
||
2138 | |||
2139 | sLine = sLine..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_Note; -- 0.08.2 Add localization |
||
2140 | sLine = sLine..SKM_Config.Col_Label..Enemy[_SKM._playerNote]; |
||
2141 | |||
2142 | table.insert(Lines, sLine); |
||
2143 | end |
||
2144 | |||
2145 | |||
2146 | local i; |
||
2147 | for i=1, SKM_LISTFRAME_DETAIL_ROWS, 1 do |
||
2148 | local ButtonText = getglobal("SKMap_ListFrameDetailButton"..i.."Text"); |
||
2149 | |||
2150 | if (i <= getn(Lines)) then |
||
2151 | SkM_Trace(FName, 2, i.." : "..Lines[i]); |
||
2152 | |||
2153 | if (ButtonText) then |
||
2154 | ButtonText:SetText(Lines[i]); |
||
2155 | end |
||
2156 | else |
||
2157 | ButtonText:SetText(""); |
||
2158 | end |
||
2159 | end |
||
2160 | end |
||
2161 | |||
2162 | end |
||
2163 | |||
2164 | |||
2165 | function SKMap_ListFrame_ClearDetail() |
||
2166 | local i; |
||
2167 | for i=1, SKM_LISTFRAME_DETAIL_ROWS, 1 do |
||
2168 | local ButtonText = getglobal("SKMap_ListFrameDetailButton"..i.."Text"); |
||
2169 | if (ButtonText) then |
||
2170 | ButtonText:SetText(""); |
||
2171 | end |
||
2172 | end |
||
2173 | |||
2174 | SKMap_ListFrameTruceButton:Hide(); |
||
2175 | SKMap_ListFrameWarButton:Hide(); |
||
2176 | |||
2177 | SKMap_ListFrame_ShowPlayerGuildButton:Hide(); |
||
2178 | SKMap_ListFrame_BackToPlayersButton:Hide(); |
||
2179 | SKMap_ListFrame_EditNote:Hide(); |
||
2180 | SKMap_ListFrame_ReportButton:Hide(); |
||
2181 | SKMap_ListFrame_DeleteButton:Hide(); |
||
2182 | end |
||
2183 | |||
2184 | |||
2185 | function SKMap_ListFrame_GuildSort(e1, e2) |
||
2186 | local FName = "SKMap_ListFrame_GuildSort"; |
||
2187 | |||
2188 | SkM_Trace(FName, 4, "Begin"); |
||
2189 | |||
2190 | if (e1 == nil) then |
||
2191 | if (e2 == nil) then |
||
2192 | return false; |
||
2193 | else |
||
2194 | return true; |
||
2195 | end |
||
2196 | elseif (e2 == nil) then |
||
2197 | return false; |
||
2198 | end |
||
2199 | |||
2200 | --local iSortTypes = table.getn(SKM_GuildList_SortTypes); |
||
2201 | local iSortTypes = table.getn( SkM_GetOption("GuildList_SortTypes") ); |
||
2202 | |||
2203 | local i; |
||
2204 | for i=1, iSortTypes, 1 do |
||
2205 | local bReverseSort = false; |
||
2206 | --if (i == 1) and (SKM_GuildList_ReverseSort) then |
||
2207 | if (i == 1) and ( SkM_GetOption("GuildList_ReverseSort") ) then |
||
2208 | bReverseSort = true; |
||
2209 | end |
||
2210 | --local bCmp = SKMap_ListFrame_SubSort(e1, e2, SKM_GuildList_SortTypes[i], bReverseSort); |
||
2211 | local bCmp = SKMap_ListFrame_SubSort(e1, e2, SkM_GetOption("GuildList_SortTypes")[i], bReverseSort); |
||
2212 | if (bCmp ~= nil) then |
||
2213 | return bCmp; |
||
2214 | end |
||
2215 | end |
||
2216 | return false; |
||
2217 | end |
||
2218 | |||
2219 | |||
2220 | function SKMap_ListFrame_SortGuildList(sSortType) |
||
2221 | local FName = "SKMap_ListFrame_SortGuildList"; |
||
2222 | |||
2223 | SkM_Trace(FName, 3, "Sort by : "..snil(sSortType)); |
||
2224 | |||
2225 | if (sSortType) then |
||
2226 | --if (sSortType == SKM_GuildList_SortType) then |
||
2227 | if (sSortType == SkM_GetOption("GuildList_SortType") ) then |
||
2228 | |||
2229 | --if (SKM_GuildList_ReverseSort) then |
||
2230 | if ( SkM_GetOption("GuildList_ReverseSort") ) then |
||
2231 | --SKM_GuildList_ReverseSort = false; |
||
2232 | SkM_SetOption("GuildList_ReverseSort", false); |
||
2233 | else |
||
2234 | --SKM_GuildList_ReverseSort = true; |
||
2235 | SkM_SetOption("GuildList_ReverseSort", true); |
||
2236 | end |
||
2237 | else |
||
2238 | --SKM_GuildList_SortType = sSortType; |
||
2239 | SkM_SetOption("GuildList_SortType", sSortType); |
||
2240 | |||
2241 | --SKM_GuildList_SortTypes = removefromlist(sSortType, SKM_GuildList_SortTypes); |
||
2242 | SKM_Settings.GuildList_SortTypes = removefromlist(sSortType, SkM_GetOption("GuildList_SortTypes") ); |
||
2243 | --table.insert(SKM_GuildList_SortTypes, 1, sSortType); |
||
2244 | table.insert(SKM_Settings.GuildList_SortTypes, 1, sSortType); |
||
2245 | end |
||
2246 | end |
||
2247 | |||
2248 | if (SKM_GuildList_Content) then |
||
2249 | SkM_Trace(FName, 3, "Now sorting guild list"); |
||
2250 | table.sort(SKM_GuildList_Content, SKMap_ListFrame_GuildSort); |
||
2251 | end |
||
2252 | |||
2253 | SKMap_ListFrame_UpdateGuildList(); |
||
2254 | end |
||
2255 | |||
2256 | |||
2257 | function SKMap_ListFrame_UpdateGuildList() |
||
2258 | local FName = "SKMap_ListFrame_UpdateGuildList"; |
||
2259 | |||
2260 | local iScrollOffset = FauxScrollFrame_GetOffset(SKMap_ListGuildScrollFrame); |
||
2261 | |||
2262 | SkM_Trace(FName, 4, "Scrollbar offset = "..snil(iScrollOffset)); |
||
2263 | |||
2264 | local iGuildCount = table.getn(SKM_GuildList_Content); |
||
2265 | SkM_Trace(FName, 4, "Guild Count = "..snil(iGuildCount)); |
||
2266 | |||
2267 | local iIndex = iScrollOffset + 1; |
||
2268 | |||
2269 | SkM_Trace(FName, 4, "Guild Index = "..snil(iIndex)); |
||
2270 | |||
2271 | local i; |
||
2272 | for i=1, SKM_LISTFRAME_ROWS, 1 do |
||
2273 | local RowButton = getglobal("SKMap_ListFrameGuildButton"..i); |
||
2274 | |||
2275 | if (iIndex <= iGuildCount) then |
||
2276 | |||
2277 | RowButtonName = getglobal("SKMap_ListFrameGuildButton"..i.."Name"); |
||
2278 | RowButtonMembers = getglobal("SKMap_ListFrameGuildButton"..i.."Members"); |
||
2279 | RowButtonKill = getglobal("SKMap_ListFrameGuildButton"..i.."Kill"); |
||
2280 | RowButtonDeath = getglobal("SKMap_ListFrameGuildButton"..i.."Death"); |
||
2281 | RowButtonMet = getglobal("SKMap_ListFrameGuildButton"..i.."Met"); |
||
2282 | RowButtonLastSeen = getglobal("SKMap_ListFrameGuildButton"..i.."LastSeen"); |
||
2283 | RowButtonAtWar = getglobal("SKMap_ListFrameGuildButton"..i.."AtWar"); |
||
2284 | |||
2285 | local sName = ifnil(SKM_GuildList_Content[iIndex][_SKM._name], "??"); |
||
2286 | local sLastSeen = ifnil(SKM_GuildList_Content[iIndex][_SKM._lastView], "??"); |
||
2287 | |||
2288 | local bAtWar = SKM_GuildList_Content[iIndex][_SKM._atWar]; |
||
2289 | |||
2290 | local sWar = ""; |
||
2291 | if (bAtWar) then |
||
2292 | sName = SKM_Config.Col_PlayerWar..sName; |
||
2293 | sWar = SKM_Config.Col_PlayerWar..SKMAP_COLUMN_ATWAR_GUILD; -- 0.08.1 Add localization |
||
2294 | end |
||
2295 | |||
2296 | local iKill = ifnil(SKM_GuildList_Content[iIndex][_SKM._playerKill], 0) + ifnil(SKM_GuildList_Content[iIndex][_SKM._playerAssistKill], 0) + ifnil(SKM_GuildList_Content[iIndex][_SKM._playerFullKill], 0); |
||
2297 | local iDeath = ifnil(SKM_GuildList_Content[iIndex][_SKM._enemyKillPlayer], 0); |
||
2298 | local iMet = ifnil(SKM_GuildList_Content[iIndex][_SKM._meetCount], 0); |
||
2299 | local iMembers = ifnil(SKM_GuildList_Content[iIndex][_SKM._members], 0); |
||
2300 | |||
2301 | RowButtonName:SetText(sName); |
||
2302 | RowButtonMembers:SetText(iMembers); |
||
2303 | RowButtonKill:SetText(iKill); |
||
2304 | RowButtonDeath:SetText(iDeath); |
||
2305 | RowButtonMet:SetText(iMet); |
||
2306 | RowButtonLastSeen:SetText(sLastSeen); |
||
2307 | RowButtonAtWar:SetText(sWar); |
||
2308 | |||
2309 | RowButton:Show(); |
||
2310 | |||
2311 | iIndex = iIndex + 1; |
||
2312 | else |
||
2313 | RowButton:Hide(); |
||
2314 | end |
||
2315 | |||
2316 | end |
||
2317 | |||
2318 | FauxScrollFrame_Update(SKMap_ListGuildScrollFrame, iGuildCount, SKM_LISTFRAME_ROWS, SKM_LISTFRAME_ROWHEIGHT); |
||
2319 | end |
||
2320 | |||
2321 | |||
2322 | function SKMap_SetGuildListContent() |
||
2323 | local FName = "SKMap_SetGuildListContent"; |
||
2324 | |||
2325 | SKM_GuildList_Content = { }; |
||
2326 | |||
2327 | local idx, val; |
||
2328 | for idx, val in SKM_Data[_RealmName][_PlayerName].GuildHistory do |
||
2329 | local Elem = copytable(val); |
||
2330 | |||
2331 | Elem[_SKM._members] = SkM_CountGuildMembers(idx); |
||
2332 | |||
2333 | -- check if element has to be filtered out or not |
||
2334 | local bFilter = false; |
||
2335 | if (SKM_Config.FilterNotAtWar == true) then |
||
2336 | if ( not (Elem[_SKM._atWar]) ) then |
||
2337 | bFilter = true; |
||
2338 | end |
||
2339 | end |
||
2340 | |||
2341 | if (bFilter == false) then |
||
2342 | table.insert(SKM_GuildList_Content, Elem); |
||
2343 | end |
||
2344 | |||
2345 | end |
||
2346 | |||
2347 | end |
||
2348 | |||
2349 | |||
2350 | function SKMap_ListFrame_SelectGuild(sGuildName) |
||
2351 | local FName = "SKMap_ListFrame_SelectGuild"; |
||
2352 | |||
2353 | local sName; |
||
2354 | |||
2355 | if (sGuildName ~= nil) then |
||
2356 | sName = sGuildName; |
||
2357 | else |
||
2358 | local id = this:GetID(); |
||
2359 | local iScrollOffset = FauxScrollFrame_GetOffset(SKMap_ListGuildScrollFrame); |
||
2360 | local iGuildCount = table.getn(SKM_GuildList_Content); |
||
2361 | |||
2362 | SkM_Trace(FName, 3, "Scroll offset = "..iScrollOffset); |
||
2363 | SkM_Trace(FName, 3, "Line id = "..id); |
||
2364 | |||
2365 | local iGuildIndex = iScrollOffset + id; |
||
2366 | SkM_Trace(FName, 3, "Guild Index = "..iGuildIndex); |
||
2367 | |||
2368 | if (iGuildIndex <= iGuildCount) then |
||
2369 | sName = SKM_GuildList_Content[iGuildIndex][_SKM._name]; |
||
2370 | end |
||
2371 | end |
||
2372 | |||
2373 | local Guild; |
||
2374 | if (sName ~= nil) and (sName ~= "") then |
||
2375 | Guild = SKM_Data[_RealmName][_PlayerName].GuildHistory[sName]; |
||
2376 | end |
||
2377 | |||
2378 | |||
2379 | |||
2380 | local Lines = { }; |
||
2381 | |||
2382 | if (Guild ~= nil) then |
||
2383 | SKM_List_SelectedGuild = sName; |
||
2384 | |||
2385 | local sLastSeen = ifnil(Guild[_SKM._lastView], "??"); |
||
2386 | |||
2387 | local iKill = ifnil(Guild[_SKM._playerKill], 0); |
||
2388 | local iAssistKill = ifnil(Guild[_SKM._playerAssistKill], 0); |
||
2389 | local iFullKill = ifnil(Guild[_SKM._playerFullKill], 0); |
||
2390 | local iTotalKill = iKill + iAssistKill + iFullKill; |
||
2391 | local iDeath = ifnil(Guild[_SKM._enemyKillPlayer], 0); |
||
2392 | local iMet = ifnil(Guild[_SKM._meetCount], 0); |
||
2393 | local iLoneWolf = ifnil(Guild[_SKM._loneWolfKill], 0); |
||
2394 | |||
2395 | local iBGKill = ifnil(Guild[_SKM._playerBGKill], 0); |
||
2396 | local iBGDeath = ifnil(Guild[_SKM._enemyKillBG], 0); |
||
2397 | |||
2398 | local iMembers = SkM_CountGuildMembers(sName); |
||
2399 | |||
2400 | local bAtWar; |
||
2401 | if (Guild[_SKM._atWar]) then |
||
2402 | bAtWar = true; |
||
2403 | else |
||
2404 | bAtWar = false; |
||
2405 | end |
||
2406 | |||
2407 | SKMap_ListFrame_ShowWarButton(bAtWar); |
||
2408 | |||
2409 | SKMap_ListFrame_ShowPlayerGuildButton:Hide(); |
||
2410 | SKMap_ListFrame_BackToPlayersButton:Hide(); |
||
2411 | SKMap_ListFrame_EditNote:Show(); |
||
2412 | SKMap_ListFrame_ReportButton:Show(); |
||
2413 | SKMap_ListFrame_DeleteButton:Hide(); |
||
2414 | |||
2415 | |||
2416 | -- line 1 : guild name and (optional) war status |
||
2417 | local sLine = ""; |
||
2418 | |||
2419 | sLine = sLine..SKM_Config.Col_LabelTitle.."Guild : "; |
||
2420 | if (bAtWar) then |
||
2421 | sLine = sLine..SKM_Config.Col_PlayerWar; |
||
2422 | else |
||
2423 | sLine = sLine..SKM_Config.Col_Label; |
||
2424 | end |
||
2425 | sLine = sLine..sName..SKM_Config.Col_Label; |
||
2426 | if (bAtWar) then |
||
2427 | sLine = sLine.." - "..SKM_Config.Col_PlayerWar..SKM_UI_STRINGS.Small_Target_War; |
||
2428 | if (Guild[_SKM._warDate]) then |
||
2429 | --local sDisplayDate = string.sub(Enemy[_SKM._warDate], 1, 10); |
||
2430 | local sDisplayDate = Guild[_SKM._warDate]; |
||
2431 | sLine = sLine.." "..SKM_UI_STRINGS.Since..sDisplayDate; |
||
2432 | end |
||
2433 | end |
||
2434 | |||
2435 | table.insert(Lines, sLine); |
||
2436 | |||
2437 | |||
2438 | -- Line 2 : members |
||
2439 | local sLine = ""; |
||
2440 | |||
2441 | sLine = sLine..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_Guild_Member; -- 0.08.2 Add localization |
||
2442 | sLine = sLine..SKM_Config.Col_Label..iMembers; |
||
2443 | |||
2444 | table.insert(Lines, sLine); |
||
2445 | |||
2446 | |||
2447 | -- line 3 : last seen time and last player viewed |
||
2448 | if (Guild[_SKM._lastView] ~= nil) then |
||
2449 | |||
2450 | local sLine = ""; |
||
2451 | |||
2452 | sLine = sLine..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_Last_Seen; -- 0.08.2 Add localization |
||
2453 | |||
2454 | if (Guild[_SKM._lastPlayerViewed] ~= nil) then |
||
2455 | sLine = sLine..SKM_Config.Col_Label..Guild[_SKM._lastPlayerViewed].." - "; |
||
2456 | end |
||
2457 | |||
2458 | sLine = sLine..SKM_Config.Col_Label..Guild[_SKM._lastView]; |
||
2459 | |||
2460 | table.insert(Lines, sLine); |
||
2461 | end |
||
2462 | |||
2463 | |||
2464 | -- line 4 : meet and death counts |
||
2465 | local sLine = ""; |
||
2466 | |||
2467 | sLine = sLine..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_Met..SKM_Config.Col_PlayerMet..iMet; -- 0.08.2 Add localization |
||
2468 | sLine = sLine.." "..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_Death..SKM_Config.Col_PlayerDeath .. iDeath; -- 0.08.2 Add localization |
||
2469 | sLine = sLine.." "..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_LoneWolf..SKM_Config.Col_LoneWolfKill .. iLoneWolf; |
||
2470 | |||
2471 | table.insert(Lines, sLine); |
||
2472 | |||
2473 | |||
2474 | -- line 5 : kill counts |
||
2475 | local sLine = ""; |
||
2476 | |||
2477 | sLine = sLine..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_Kill..SKM_Config.Col_PlayerTotalKill..iTotalKill; -- 0.08.2 Add localization |
||
2478 | sLine = sLine.." "..SKM_Config.Col_Label.."( "; |
||
2479 | sLine = sLine..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_Full..SKM_Config.Col_PlayerFullKill..iFullKill; -- 0.08.2 Add localization |
||
2480 | sLine = sLine..SKM_Config.Col_Label.." + "..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_Standard..SKM_Config.Col_PlayerKill..iKill; -- 0.08.2 Add localization |
||
2481 | sLine = sLine..SKM_Config.Col_Label.." + "..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_Assist..SKM_Config.Col_PlayerAssistKill..iAssistKill..SKM_Config.Col_Label.." )"; -- 0.08.2 Add localization |
||
2482 | |||
2483 | table.insert(Lines, sLine); |
||
2484 | |||
2485 | |||
2486 | -- Line : honor kills |
||
2487 | local sLine = ""; |
||
2488 | |||
2489 | if (ifnil(Guild[_SKM._honorKill], 0) > 0) then |
||
2490 | sLine = sLine..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_HonorKill..SKM_Config.Col_HonorKill..Guild[_SKM._honorKill]; |
||
2491 | sLine = sLine.." "; |
||
2492 | end |
||
2493 | |||
2494 | if (iBGKill > 0 or iBGDeath > 0) then |
||
2495 | sLine = sLine..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_BGKill..SKM_Config.Col_BGKill .. iBGKill; |
||
2496 | sLine = sLine.." "; |
||
2497 | sLine = sLine..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_BGDeath..SKM_Config.Col_BGDeath .. iBGDeath; |
||
2498 | end |
||
2499 | |||
2500 | if (sLine ~= "") then |
||
2501 | table.insert(Lines, sLine); |
||
2502 | end |
||
2503 | |||
2504 | |||
2505 | |||
2506 | -- line 6 : player notes |
||
2507 | if (Guild[_SKM._playerNote] ~= nil) and (Guild[_SKM._playerNote] ~= "") then |
||
2508 | local sLine = ""; |
||
2509 | |||
2510 | sLine = sLine..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_Note; -- 0.08.2 Add localization |
||
2511 | sLine = sLine..SKM_Config.Col_Label..Guild[_SKM._playerNote]; |
||
2512 | |||
2513 | table.insert(Lines, sLine); |
||
2514 | end |
||
2515 | |||
2516 | |||
2517 | local i; |
||
2518 | for i=1, SKM_LISTFRAME_DETAIL_ROWS, 1 do |
||
2519 | local ButtonText = getglobal("SKMap_ListFrameDetailButton"..i.."Text"); |
||
2520 | |||
2521 | if (i <= getn(Lines)) then |
||
2522 | SkM_Trace(FName, 2, i.." : "..Lines[i]); |
||
2523 | |||
2524 | if (ButtonText) then |
||
2525 | ButtonText:SetText(Lines[i]); |
||
2526 | end |
||
2527 | else |
||
2528 | ButtonText:SetText(""); |
||
2529 | end |
||
2530 | end |
||
2531 | end |
||
2532 | |||
2533 | end |
||
2534 | |||
2535 | |||
2536 | function SKMap_ListFrame_ToggleLists() |
||
2537 | local FName = "SKMap_ListFrame_ToggleLists"; |
||
2538 | |||
2539 | if (SKM_List_ActiveList == _SKM._players) then |
||
2540 | |||
2541 | SKM_List_ActiveList = _SKM._guilds; |
||
2542 | |||
2543 | SKMap_ListFrame_Load(); |
||
2544 | |||
2545 | SKMap_ListFrameMainList:Hide(); |
||
2546 | SKMap_ListFrameGuildList:Show(); |
||
2547 | |||
2548 | SKMap_ListFrame_UpdateListButton:Hide(); |
||
2549 | |||
2550 | SKMap_ListFrame_ToggleButton:SetText(SKMAP_PLAYERS); |
||
2551 | |||
2552 | if (SKM_List_SelectedGuild ~= nil) then |
||
2553 | SKMap_ListFrame_SelectGuild(SKM_List_SelectedGuild); |
||
2554 | else |
||
2555 | SKMap_ListFrame_ClearDetail(); |
||
2556 | end |
||
2557 | |||
2558 | else |
||
2559 | |||
2560 | SKM_List_ActiveList = _SKM._players; |
||
2561 | |||
2562 | SKMap_ListFrame_Load(); |
||
2563 | |||
2564 | SKMap_ListFrameGuildList:Hide(); |
||
2565 | SKMap_ListFrameMainList:Show(); |
||
2566 | |||
2567 | SKMap_ListFrame_UpdateListButton:Show(); |
||
2568 | |||
2569 | SKMap_ListFrame_ToggleButton:SetText(SKMAP_GUILDS); |
||
2570 | |||
2571 | if (SKM_List_SelectedPlayer ~= nil) then |
||
2572 | SKMap_ListFrame_SelectElement(SKM_List_SelectedPlayer); |
||
2573 | else |
||
2574 | SKMap_ListFrame_ClearDetail(); |
||
2575 | end |
||
2576 | |||
2577 | end |
||
2578 | |||
2579 | end |
||
2580 | |||
2581 | |||
2582 | function SKMap_ListFrame_Filter() |
||
2583 | local FName = "SKMap_ListFrame_Filter"; |
||
2584 | |||
2585 | local MyButton = getglobal("SKMap_ListFrameCheckButton1"); |
||
2586 | |||
2587 | SKM_Config.FilterNotAtWar = false; |
||
2588 | if (MyButton:GetChecked()) then |
||
2589 | SKM_Config.FilterNotAtWar = true; |
||
2590 | end |
||
2591 | |||
2592 | SKMap_ListFrame_Load(); |
||
2593 | end |
||
2594 | |||
2595 | |||
2596 | function SKMap_ListDetail_SetWar() |
||
2597 | local FName = "SKMap_ListDetailWar"; |
||
2598 | |||
2599 | if (SKM_List_ActiveList == _SKM._players) then |
||
2600 | if (SKM_List_SelectedPlayer ~= nil) then |
||
2601 | local Enemy = SKM_Data[_RealmName][_PlayerName].EnemyHistory[SKM_List_SelectedPlayer]; |
||
2602 | if (Enemy) then |
||
2603 | local bWar; |
||
2604 | if (Enemy[_SKM._atWar]) then |
||
2605 | bWar = false; |
||
2606 | else |
||
2607 | bWar = true; |
||
2608 | end |
||
2609 | |||
2610 | local sDate = SkM_GetDate(); |
||
2611 | |||
2612 | SkM_UpdateEnemy_SetWar(SKM_List_SelectedPlayer, bWar, sDate); |
||
2613 | SKMap_ListFrame_ShowWarButton(bWar); |
||
2614 | |||
2615 | SKMap_ListFrame_UpdateList(); |
||
2616 | SKMap_ListFrame_SelectElement(SKM_List_SelectedPlayer); |
||
2617 | end |
||
2618 | end |
||
2619 | else |
||
2620 | if (SKM_List_SelectedGuild ~= nil) and (SKM_List_SelectedGuild ~= "") then |
||
2621 | local Guild = SKM_Data[_RealmName][_PlayerName].GuildHistory[SKM_List_SelectedGuild]; |
||
2622 | if (Guild) then |
||
2623 | local bWar; |
||
2624 | if (Guild[_SKM._atWar]) then |
||
2625 | bWar = false; |
||
2626 | else |
||
2627 | bWar = true; |
||
2628 | end |
||
2629 | |||
2630 | local sDate = SkM_GetDate(); |
||
2631 | |||
2632 | SkM_UpdateGuild_SetWar(SKM_List_SelectedGuild, bWar, sDate); |
||
2633 | SKMap_ListFrame_ShowWarButton(bWar); |
||
2634 | |||
2635 | SKMap_ListFrame_UpdateGuildList(); |
||
2636 | SKMap_ListFrame_SelectGuild(SKM_List_SelectedGuild); |
||
2637 | end |
||
2638 | end |
||
2639 | end |
||
2640 | |||
2641 | end |
||
2642 | |||
2643 | |||
2644 | function SKMap_ListFrame_ShowWarButton(bWar) |
||
2645 | local FName = "SKMap_ListFrame_ShowWarButton"; |
||
2646 | |||
2647 | SkM_Trace(FName, 2, "War = "..snil(bWar)); |
||
2648 | |||
2649 | if (bWar == nil) then |
||
2650 | SKMap_ListFrameTruceButton:Hide(); |
||
2651 | SKMap_ListFrameWarButton:Hide(); |
||
2652 | elseif (bWar == true) then |
||
2653 | SKMap_ListFrameTruceButton:Show(); |
||
2654 | SKMap_ListFrameWarButton:Hide(); |
||
2655 | |||
2656 | elseif (bWar == false) then |
||
2657 | SKMap_ListFrameTruceButton:Hide(); |
||
2658 | SKMap_ListFrameWarButton:Show(); |
||
2659 | end |
||
2660 | end |
||
2661 | |||
2662 | |||
2663 | |||
2664 | function SKMap_List_ShowPlayerGuild() |
||
2665 | if (SKM_List_ActiveList == _SKM._players) then |
||
2666 | if (SKM_List_SelectedPlayer ~= nil) then |
||
2667 | local Enemy = SKM_Data[_RealmName][_PlayerName].EnemyHistory[SKM_List_SelectedPlayer]; |
||
2668 | if (Enemy) then |
||
2669 | local sGuild = Enemy[_SKM._guild]; |
||
2670 | if (sGuild ~= nil) and (sGuild ~= "") then |
||
2671 | local Guild = SKM_Data[_RealmName][_PlayerName].GuildHistory[sGuild]; |
||
2672 | if (Guild) then |
||
2673 | SKM_List_SelectedGuild = sGuild; |
||
2674 | SKMap_ListFrame_ToggleLists(); |
||
2675 | SKMap_ListFrame_BackToPlayersButton:Show(); |
||
2676 | |||
2677 | end |
||
2678 | end |
||
2679 | end |
||
2680 | end |
||
2681 | end |
||
2682 | end |
||
2683 | |||
2684 | |||
2685 | function SKMap_List_BackToPlayers() |
||
2686 | SKMap_ListFrame_ToggleLists(); |
||
2687 | end |
||
2688 | |||
2689 | |||
2690 | function SKMap_Report_WriteBook(Lines) |
||
2691 | local FName = "SKMap_Report_WriteBook"; |
||
2692 | |||
2693 | local i, j; |
||
2694 | local iNbLines = table.getn(Lines); |
||
2695 | for i=1, SKM_BOOKFRAME_ROWS, 1 do |
||
2696 | |||
2697 | local ButtonText = getglobal("SKMap_ReportFrameBookButton"..i.."Text"); |
||
2698 | local ButtonCols = { }; |
||
2699 | |||
2700 | for j=1, SKM_BOOKFRAME_COLUMNS, 1 do |
||
2701 | local ButtonCol = getglobal("SKMap_ReportFrameBookButton"..i.."Col"..j); |
||
2702 | table.insert(ButtonCols, ButtonCol); |
||
2703 | end |
||
2704 | |||
2705 | if (i <= iNbLines) then |
||
2706 | local CurrentLine = Lines[i]; |
||
2707 | |||
2708 | if (type(CurrentLine) == "string" ) then |
||
2709 | ButtonText:SetText(Lines[i]); |
||
2710 | ButtonText:Show(); |
||
2711 | for j=1, SKM_BOOKFRAME_COLUMNS, 1 do |
||
2712 | ButtonCols[j]:SetText(""); |
||
2713 | ButtonCols[j]:Hide(); |
||
2714 | end |
||
2715 | |||
2716 | elseif (type(CurrentLine) == "table" ) then |
||
2717 | |||
2718 | local iNbCols = table.getn(Lines[i]); |
||
2719 | |||
2720 | for j=1, SKM_BOOKFRAME_COLUMNS, 1 do |
||
2721 | if (j <= iNbCols) then |
||
2722 | ButtonCols[j]:SetText(Lines[i][j]); |
||
2723 | else |
||
2724 | ButtonCols[j]:SetText(""); |
||
2725 | end |
||
2726 | ButtonCols[j]:Show(); |
||
2727 | end |
||
2728 | |||
2729 | ButtonText:SetText(""); |
||
2730 | ButtonText:Hide(); |
||
2731 | |||
2732 | else |
||
2733 | -- unknown variable type !!! |
||
2734 | SkM_Trace(FName, 1, "Unknown variable type for line "..i); |
||
2735 | end |
||
2736 | |||
2737 | |||
2738 | else |
||
2739 | -- no more to write, hide our text strings |
||
2740 | ButtonText:SetText(""); |
||
2741 | ButtonText:Hide(); |
||
2742 | for j=1, SKM_BOOKFRAME_COLUMNS, 1 do |
||
2743 | ButtonCols[j]:SetText(""); |
||
2744 | ButtonCols[j]:Hide(); |
||
2745 | end |
||
2746 | |||
2747 | end |
||
2748 | end |
||
2749 | end |
||
2750 | |||
2751 | |||
2752 | function SKMap_ReportFrame_Load() |
||
2753 | local FName = "SKMap_ReportFrame_Load"; |
||
2754 | |||
2755 | local idx = 1; |
||
2756 | local MyButton = getglobal("SKMap_ReportFrameCheckButton"..idx); |
||
2757 | local ButtonText = getglobal("SKMap_ReportFrameCheckButton"..idx.."Text"); |
||
2758 | ButtonText:SetText(SKM_UI_STRINGS.Report_Button_UseAssist); |
||
2759 | MyButton.tooltipText = SKM_UI_STRINGS.Report_Tooltip_UseAssist; |
||
2760 | |||
2761 | local checked; |
||
2762 | local bValue = SkM_GetOption("AssistKillStat"); |
||
2763 | if (bValue) then |
||
2764 | checked = 1; |
||
2765 | else |
||
2766 | checked = 0; |
||
2767 | end |
||
2768 | |||
2769 | MyButton:SetChecked(checked); |
||
2770 | |||
2771 | --SkM_ComputeStatistics(); |
||
2772 | --SKMap_Report_LoadBook(SKM_CurrentBook); |
||
2773 | end |
||
2774 | |||
2775 | |||
2776 | function SKMap_Book_PrevPage() |
||
2777 | local FName = "SKMap_Book_PrevPage"; |
||
2778 | |||
2779 | if (not SKM_BookCurPage) or (not SKM_BookPages) then |
||
2780 | return; |
||
2781 | end |
||
2782 | |||
2783 | local iPages = table.getn(SKM_BookPages); |
||
2784 | |||
2785 | if (iPages < 1) then |
||
2786 | return; |
||
2787 | end |
||
2788 | |||
2789 | if (SKM_BookCurPage > 1) then |
||
2790 | SKM_BookCurPage = SKM_BookCurPage - 1; |
||
2791 | end |
||
2792 | |||
2793 | SKMap_Book_ShowCurrentPage(); |
||
2794 | end |
||
2795 | |||
2796 | |||
2797 | function SKMap_Book_NextPage() |
||
2798 | local FName = "SKMap_Book_NextPage"; |
||
2799 | |||
2800 | if (not SKM_BookCurPage) or (not SKM_BookPages) then |
||
2801 | return; |
||
2802 | end |
||
2803 | |||
2804 | local iPages = table.getn(SKM_BookPages); |
||
2805 | |||
2806 | if (iPages < 1) then |
||
2807 | return; |
||
2808 | end |
||
2809 | |||
2810 | if (SKM_BookCurPage < iPages) then |
||
2811 | SKM_BookCurPage = SKM_BookCurPage + 1; |
||
2812 | end |
||
2813 | |||
2814 | SKMap_Book_ShowCurrentPage(); |
||
2815 | end |
||
2816 | |||
2817 | |||
2818 | function SKMap_Book_HidePage() |
||
2819 | local FName = "SKMap_Book_HidePage"; |
||
2820 | |||
2821 | SKMap_ReportFrame_PrevPageButton:Hide(); |
||
2822 | SKMap_ReportFrame_NextPageButton:Hide(); |
||
2823 | SKMap_ReportFrame_PageText:Hide(); |
||
2824 | |||
2825 | local i; |
||
2826 | for i=1, SKM_BOOKFRAME_ROWS, 1 do |
||
2827 | local ButtonText = getglobal("SKMap_ReportFrameBookButton"..i.."Text"); |
||
2828 | if (ButtonText) then |
||
2829 | ButtonText:SetText(""); |
||
2830 | end |
||
2831 | |||
2832 | local j; |
||
2833 | for j=1, SKM_BOOKFRAME_COLUMNS, 1 do |
||
2834 | local ButtonCol = getglobal("SKMap_ReportFrameBookButton"..i.."Col"..j); |
||
2835 | if (ButtonCol) then |
||
2836 | ButtonCol:SetText(""); |
||
2837 | end |
||
2838 | end |
||
2839 | end |
||
2840 | |||
2841 | end |
||
2842 | |||
2843 | |||
2844 | function SKMap_Book_ShowCurrentPage() |
||
2845 | local FName = "SKMap_Book_ShowCurrentPage"; |
||
2846 | |||
2847 | if (not SKM_BookPages) then |
||
2848 | SKMap_Book_HidePage(); |
||
2849 | return; |
||
2850 | end |
||
2851 | |||
2852 | local iPages = table.getn(SKM_BookPages); |
||
2853 | if (iPages < 1) then |
||
2854 | SKMap_Book_HidePage(); |
||
2855 | return; |
||
2856 | end |
||
2857 | |||
2858 | local sPageText = ""; |
||
2859 | |||
2860 | if (not SKM_BookCurPage) then |
||
2861 | SKM_BookCurPage = 1; |
||
2862 | elseif (SKM_BookCurPage > iPages) then |
||
2863 | SKM_BookCurPage = iPages; |
||
2864 | end |
||
2865 | |||
2866 | sPageText = SKM_UI_STRINGS.Book_Page.." "..SKM_BookCurPage.." / "..iPages; |
||
2867 | |||
2868 | if (SKM_BookCurPage == 1) then |
||
2869 | SKMap_ReportFrame_PrevPageButton:Disable(); |
||
2870 | else |
||
2871 | SKMap_ReportFrame_PrevPageButton:Enable(); |
||
2872 | end |
||
2873 | |||
2874 | if (SKM_BookCurPage == iPages) then |
||
2875 | SKMap_ReportFrame_NextPageButton:Disable(); |
||
2876 | else |
||
2877 | SKMap_ReportFrame_NextPageButton:Enable(); |
||
2878 | end |
||
2879 | |||
2880 | SKMap_ReportFrame_PageText:SetText(sPageText); |
||
2881 | |||
2882 | SKMap_ReportFrame_PrevPageButton:Show(); |
||
2883 | SKMap_ReportFrame_NextPageButton:Show(); |
||
2884 | SKMap_ReportFrame_PageText:Show(); |
||
2885 | |||
2886 | SKMap_Report_WriteBook(SKM_BookPages[SKM_BookCurPage]); |
||
2887 | end |
||
2888 | |||
2889 | |||
2890 | function SKMap_BuildBook(p_BookHeader, p_BookText) |
||
2891 | local FName = "SKMap_BuildBook"; |
||
2892 | |||
2893 | SKM_BookPages = { }; |
||
2894 | |||
2895 | local iHeaderLn = 0; |
||
2896 | if (p_BookHeader) then |
||
2897 | SkM_Trace(FName, 3, "Book Header not nil : "..getn(p_BookHeader)); |
||
2898 | iHeaderLn = getn(p_BookHeader); |
||
2899 | end |
||
2900 | |||
2901 | local iTextLn = 0; |
||
2902 | if (p_BookText) then |
||
2903 | SkM_Trace(FName, 3, "Book Text not nil : "..getn(p_BookText)); |
||
2904 | iTextLn = getn(p_BookText); |
||
2905 | end |
||
2906 | |||
2907 | if (iHeaderLn >= SKM_BOOKFRAME_ROWS) then |
||
2908 | SkM_Trace(FName, 1, "Too many header lines : "..iHeaderLn..", Book rows = "..SKM_BOOKFRAME_ROWS); |
||
2909 | return; |
||
2910 | end |
||
2911 | |||
2912 | SkM_Trace(FName, 3, "Header lines = "..iHeaderLn..", Text lines = "..iTextLn); |
||
2913 | |||
2914 | local CurrentPage = { }; |
||
2915 | local i, j; |
||
2916 | |||
2917 | if (iTextLn > 0) then |
||
2918 | |||
2919 | for i=1, iTextLn, 1 do |
||
2920 | local CurrentLine = p_BookText[i]; |
||
2921 | |||
2922 | if (table.getn(CurrentPage) == 0) then |
||
2923 | if (iHeaderLn > 0) then |
||
2924 | |||
2925 | -- beginning a new page : write header |
||
2926 | for j=1, iHeaderLn, 1 do |
||
2927 | table.insert(CurrentPage, p_BookHeader[j]); |
||
2928 | end |
||
2929 | end |
||
2930 | end |
||
2931 | |||
2932 | if ( (type(CurrentLine) == "string") or (type(CurrentLine) == "number") ) then |
||
2933 | -- basic line, insert it as is |
||
2934 | table.insert(CurrentPage, CurrentLine); |
||
2935 | |||
2936 | elseif (type(CurrentLine) == "table" ) then |
||
2937 | if (CurrentLine.Type == nil) then |
||
2938 | -- table with no type specified, it is a list of columns |
||
2939 | -- insert it as is |
||
2940 | table.insert(CurrentPage, CurrentLine); |
||
2941 | |||
2942 | else |
||
2943 | if (CurrentLine.Type == "Line") then |
||
2944 | -- standard line or list of columns, insert value as is |
||
2945 | table.insert(CurrentPage, CurrentLine.Value); |
||
2946 | |||
2947 | elseif (CurrentLine.Type == "NextPage") then |
||
2948 | -- directive specifying to start the following page |
||
2949 | table.insert(SKM_BookPages, CurrentPage); |
||
2950 | CurrentPage = { }; |
||
2951 | |||
2952 | elseif (CurrentLine.Type == "MultiLine") then |
||
2953 | -- directive specifying a group of undivisible lines, |
||
2954 | -- check if there's enough space on current page |
||
2955 | local iNbLines = CurrentLine.Value; |
||
2956 | if (table.getn(CurrentPage) + iNbLines > SKM_BOOKFRAME_ROWS) then |
||
2957 | table.insert(SKM_BookPages, CurrentPage); |
||
2958 | CurrentPage = { }; |
||
2959 | end |
||
2960 | |||
2961 | else |
||
2962 | -- unknown case, skip |
||
2963 | SkM_Trace(FName, 1, "Unknown type : "..snil(CurrentLine.Type)); |
||
2964 | end |
||
2965 | |||
2966 | end |
||
2967 | end |
||
2968 | |||
2969 | if (table.getn(CurrentPage) == SKM_BOOKFRAME_ROWS) then |
||
2970 | table.insert(SKM_BookPages, CurrentPage); |
||
2971 | CurrentPage = { }; |
||
2972 | end |
||
2973 | |||
2974 | end |
||
2975 | |||
2976 | else |
||
2977 | if (iHeaderLn > 0) then |
||
2978 | -- text empty, but there is a header : create a single page with the header |
||
2979 | for j=1, iHeaderLn, 1 do |
||
2980 | table.insert(CurrentPage, p_BookHeader[j]); |
||
2981 | end |
||
2982 | end |
||
2983 | |||
2984 | end |
||
2985 | |||
2986 | -- insert last page |
||
2987 | if (table.getn(CurrentPage) > 0) then |
||
2988 | table.insert(SKM_BookPages, CurrentPage); |
||
2989 | CurrentPage = { }; |
||
2990 | end |
||
2991 | |||
2992 | if (table.getn(SKM_BookPages) > 0) then |
||
2993 | SKM_BookCurPage = 1; |
||
2994 | else |
||
2995 | SKM_BookCurPage = 0; |
||
2996 | end |
||
2997 | |||
2998 | end |
||
2999 | |||
3000 | |||
3001 | function SKMap_Report_LoadBook(sBookType) |
||
3002 | local FName = "SKMap_Report_LoadBook"; |
||
3003 | |||
3004 | |||
3005 | SkM_Trace(FName, 2, "Loading book type = "..snil(sBookType)); |
||
3006 | |||
3007 | SKM_CurrentBook = sBookType; |
||
3008 | |||
3009 | if (sBookType == _SKM._bookCredits) then |
||
3010 | SKMap_BuildBook(nil, SKMAP_CREDITS); |
||
3011 | |||
3012 | elseif (sBookType == _SKM._bookGeneralStat) then |
||
3013 | SKMap_BuildBook_GeneralStat(); |
||
3014 | |||
3015 | elseif (sBookType == _SKM._bookClassStat) then |
||
3016 | SKMap_BuildBook_CategoryStat("ClassList", SKM_UI_STRINGS.Book_ClassStat_Header, SKM_UI_STRINGS.Book_Label_Class); |
||
3017 | |||
3018 | elseif (sBookType == _SKM._bookRaceStat) then |
||
3019 | SKMap_BuildBook_CategoryStat("RaceList", SKM_UI_STRINGS.Book_RaceStat_Header, SKM_UI_STRINGS.Book_Label_Race); |
||
3020 | |||
3021 | elseif (sBookType == _SKM._bookPlayerStat) then |
||
3022 | SKMap_BuildBook_CategoryStat("EnemyList", SKM_UI_STRINGS.Book_EnemyStat_Header, SKM_UI_STRINGS.Book_Label_Enemy); |
||
3023 | |||
3024 | elseif (sBookType == _SKM._bookGuildStat) then |
||
3025 | SKMap_BuildBook_CategoryStat("GuildList", SKM_UI_STRINGS.Book_GuildStat_Header, SKM_UI_STRINGS.Book_Label_Guild); |
||
3026 | |||
3027 | elseif (sBookType == _SKM._bookMapStat) then |
||
3028 | SKMap_BuildBook_CategoryStat("ZoneList", SKM_UI_STRINGS.Book_ZoneStat_Header, SKM_UI_STRINGS.Book_Label_Zone); |
||
3029 | |||
3030 | elseif (sBookType == _SKM._bookDateStat) then |
||
3031 | SKMap_BuildBook_CategoryStat("DateList", SKM_UI_STRINGS.Book_DateStat_Header, SKM_UI_STRINGS.Book_Label_Date); |
||
3032 | |||
3033 | elseif (sBookType == _SKM._bookBGDateStat) then |
||
3034 | SKMap_BuildBook_CategoryStat("BGDateList", SKM_UI_STRINGS.Book_BGDateStat_Header, SKM_UI_STRINGS.Book_Label_Date); |
||
3035 | |||
3036 | elseif (sBookType == _SKM._bookBGMapStat) then |
||
3037 | SKMap_BuildBook_CategoryStat("BGZoneList", SKM_UI_STRINGS.Book_BGZoneStat_Header, SKM_UI_STRINGS.Book_Label_Zone); |
||
3038 | |||
3039 | elseif (sBookType == _SKM._bookBGDateMapStat) then |
||
3040 | SKMap_BuildBook_CategoryStat("BGDateZoneList", SKM_UI_STRINGS.Book_BGDateZoneStat_Header, SKM_UI_STRINGS.Book_Label_DateZone); |
||
3041 | |||
3042 | else |
||
3043 | SkM_Trace(FName, 1, "Unknown book type"); |
||
3044 | SKM_CurrentBook = nil; |
||
3045 | SKMap_BuildBook(nil, nil); |
||
3046 | end |
||
3047 | |||
3048 | SKMap_Book_ShowCurrentPage(); |
||
3049 | end |
||
3050 | |||
3051 | |||
3052 | function SKMap_BuildBook_GeneralStat() |
||
3053 | local FName = "SKMap_BuildBook_GeneralStat"; |
||
3054 | |||
3055 | -- recompute statistics to be sure they're up to date |
||
3056 | SkM_ComputeStatistics(); |
||
3057 | |||
3058 | -- preparing header |
||
3059 | local BookHeader = { }; |
||
3060 | table.insert(BookHeader, SKM_UI_STRINGS.Book_GeneralStat_Header); |
||
3061 | table.insert(BookHeader, ""); |
||
3062 | table.insert(BookHeader, SKM_BOOK_SEPARATOR); |
||
3063 | table.insert(BookHeader, ""); |
||
3064 | |||
3065 | -- book content |
||
3066 | local BookText = { }; |
||
3067 | |||
3068 | local iKill = ifnil(SKM_Context.Statistics.Globals.Kill, 0); |
||
3069 | local iDeath = ifnil(SKM_Context.Statistics.Globals.Death, 0); |
||
3070 | local sRatio; |
||
3071 | if (iDeath + iKill > 0) then |
||
3072 | sRatio = math.floor( 100 * iKill / (iDeath + iKill) ) .. " %"; |
||
3073 | end |
||
3074 | |||
3075 | local Line = { SKM_UI_STRINGS.Book_TotalKill, iKill }; |
||
3076 | table.insert(BookText, Line); |
||
3077 | |||
3078 | local Line = { SKM_UI_STRINGS.Book_TotalDeath, iDeath }; |
||
3079 | table.insert(BookText, Line); |
||
3080 | |||
3081 | table.insert(BookText, ""); |
||
3082 | |||
3083 | local Line = { SKM_UI_STRINGS.Book_TotalRatio, sRatio }; |
||
3084 | table.insert(BookText, Line); |
||
3085 | |||
3086 | table.insert(BookText, ""); |
||
3087 | |||
3088 | local Line = { SKM_UI_STRINGS.Book_AverageKillLevel, SKM_Context.Statistics.Globals.KillAverageLevel }; |
||
3089 | table.insert(BookText, Line); |
||
3090 | |||
3091 | local Line = { SKM_UI_STRINGS.Book_AverageDeathLevel, SKM_Context.Statistics.Globals.DeathAverageLevel }; |
||
3092 | table.insert(BookText, Line); |
||
3093 | |||
3094 | table.insert(BookText, ""); |
||
3095 | |||
3096 | local Line = { SKM_UI_STRINGS.Book_EnemyPlayers, SKM_Context.Statistics.Globals.EnemyPlayers }; |
||
3097 | table.insert(BookText, Line); |
||
3098 | |||
3099 | local Line = { SKM_UI_STRINGS.Book_EnemyGuilds, SKM_Context.Statistics.Globals.EnemyGuilds }; |
||
3100 | table.insert(BookText, Line); |
||
3101 | |||
3102 | table.insert(BookText, ""); |
||
3103 | |||
3104 | local Line = { SKM_UI_STRINGS.Book_MapRecords, SKM_Context.Statistics.Globals.MapRecords }; |
||
3105 | table.insert(BookText, Line); |
||
3106 | |||
3107 | SKMap_BuildBook(BookHeader, BookText); |
||
3108 | end |
||
3109 | |||
3110 | |||
3111 | function SKMap_BuildBook_EnemyStat() |
||
3112 | local FName = "SKMap_BuildBook_EnemyStat"; |
||
3113 | |||
3114 | -- recompute statistics to be sure they're up to date |
||
3115 | SkM_ComputeStatistics(); |
||
3116 | |||
3117 | -- preparing header |
||
3118 | local BookHeader = { }; |
||
3119 | table.insert(BookHeader, SKM_UI_STRINGS.Book_EnemyStat_Header); |
||
3120 | table.insert(BookHeader, ""); |
||
3121 | |||
3122 | local sLine = { SKM_UI_STRINGS.Book_Label_Enemy, SKM_UI_STRINGS.Book_Label_Kill, SKM_UI_STRINGS.Book_Label_Death, SKM_UI_STRINGS.Book_Label_Ratio }; |
||
3123 | table.insert(BookHeader, sLine); |
||
3124 | |||
3125 | table.insert(BookHeader, SKM_BOOK_SEPARATOR); |
||
3126 | table.insert(BookHeader, ""); |
||
3127 | |||
3128 | |||
3129 | -- book content |
||
3130 | local BookText = { }; |
||
3131 | |||
3132 | local val; |
||
3133 | local i; |
||
3134 | for i=1, getn(SKM_Context.Statistics.EnemyList), 1 do |
||
3135 | val = SKM_Context.Statistics.EnemyList[i]; |
||
3136 | local sEnemy = val.Key; |
||
3137 | local iDeath = val.Death; |
||
3138 | local iKill = val.Kill; |
||
3139 | |||
3140 | local sRatio; |
||
3141 | if (iDeath + iKill > 0) then |
||
3142 | sRatio = math.floor( 100 * iKill / (iDeath + iKill) ) .. " %"; |
||
3143 | end |
||
3144 | |||
3145 | local Line = { sRace, iKill, iDeath, sRatio }; |
||
3146 | |||
3147 | table.insert(BookText, Line); |
||
3148 | end |
||
3149 | |||
3150 | if (getn(BookText) == 0) then |
||
3151 | table.insert(BookText, SKM_UI_STRINGS.Book_NoData); |
||
3152 | end |
||
3153 | |||
3154 | SKMap_BuildBook(BookHeader, BookText); |
||
3155 | end |
||
3156 | |||
3157 | |||
3158 | function SKMap_BuildBook_CategoryStat(sCategory, sTitle, sLabel) |
||
3159 | local FName = "SKMap_BuildBook_CategoryStat"; |
||
3160 | |||
3161 | -- recompute statistics to be sure they're up to date |
||
3162 | SkM_ComputeStatistics(); |
||
3163 | |||
3164 | -- preparing header |
||
3165 | local BookHeader = { }; |
||
3166 | table.insert(BookHeader, sTitle); |
||
3167 | table.insert(BookHeader, ""); |
||
3168 | |||
3169 | local sLine = { sLabel, SKM_UI_STRINGS.Book_Label_Kill, SKM_UI_STRINGS.Book_Label_Death, SKM_UI_STRINGS.Book_Label_Ratio }; |
||
3170 | table.insert(BookHeader, sLine); |
||
3171 | |||
3172 | table.insert(BookHeader, SKM_BOOK_SEPARATOR); |
||
3173 | table.insert(BookHeader, ""); |
||
3174 | |||
3175 | |||
3176 | |||
3177 | -- book content |
||
3178 | local BookText = { }; |
||
3179 | |||
3180 | local val; |
||
3181 | local i; |
||
3182 | for i=1, getn(SKM_Context.Statistics[sCategory]), 1 do |
||
3183 | val = SKM_Context.Statistics[sCategory][i]; |
||
3184 | local sElem = val.Key; |
||
3185 | |||
3186 | local iDeath = val.Death; |
||
3187 | local iKill = val.Kill; |
||
3188 | |||
3189 | local sRatio; |
||
3190 | if (iDeath + iKill > 0) then |
||
3191 | sRatio = math.floor( 100 * iKill / (iDeath + iKill) ) .. " %"; |
||
3192 | end |
||
3193 | |||
3194 | local Line = { sElem, iKill, iDeath, sRatio }; |
||
3195 | |||
3196 | table.insert(BookText, Line); |
||
3197 | end |
||
3198 | |||
3199 | if (getn(BookText) == 0) then |
||
3200 | table.insert(BookText, SKM_UI_STRINGS.Book_NoData); |
||
3201 | end |
||
3202 | |||
3203 | SKMap_BuildBook(BookHeader, BookText); |
||
3204 | end |
||
3205 | |||
3206 | |||
3207 | function SKMap_ReportButton_OnClick() |
||
3208 | |||
3209 | if (SKM_List_ActiveList == _SKM._players) then |
||
3210 | |||
3211 | if (SKM_List_SelectedPlayer ~= nil) then |
||
3212 | SKMap_Report_EnemyRecords(SKM_List_SelectedPlayer); |
||
3213 | SKMap_ToggleUI("SKMap_ReportFrame"); |
||
3214 | end |
||
3215 | |||
3216 | elseif (SKM_List_ActiveList == _SKM._guilds) then |
||
3217 | |||
3218 | if (SKM_List_SelectedGuild ~= nil) then |
||
3219 | SKMap_Report_EnemyGuildRecords(SKM_List_SelectedGuild); |
||
3220 | SKMap_ToggleUI("SKMap_ReportFrame"); |
||
3221 | end |
||
3222 | end |
||
3223 | |||
3224 | end |
||
3225 | |||
3226 | |||
3227 | function SKMap_Report_EnemyRecords(sName) |
||
3228 | local FName = "SKMap_Report_EnemyRecords"; |
||
3229 | |||
3230 | SKM_CurrentBook = nil; |
||
3231 | |||
3232 | -- preparing header |
||
3233 | local BookHeader = { }; |
||
3234 | table.insert(BookHeader, string.format("%s vs %s", _PlayerName, sName)); |
||
3235 | table.insert(BookHeader, ""); |
||
3236 | table.insert(BookHeader, SKM_BOOK_SEPARATOR); |
||
3237 | table.insert(BookHeader, ""); |
||
3238 | |||
3239 | -- book content |
||
3240 | local BookText = { }; |
||
3241 | |||
3242 | local i; |
||
3243 | |||
3244 | local iNbNotes = table.getn(SKM_Data[_RealmName][_PlayerName].GlobalMapData); |
||
3245 | for i=iNbNotes, 1, -1 do |
||
3246 | local Note = SKM_Data[_RealmName][_PlayerName].GlobalMapData[i]; |
||
3247 | |||
3248 | local StoredInfo = Note[_SKM._storedInfo]; |
||
3249 | |||
3250 | if (StoredInfo) and (StoredInfo[_SKM._name] == sName) then |
||
3251 | |||
3252 | if (StoredInfo[_SKM._type] == _SKM._playerKill) |
||
3253 | or (StoredInfo[_SKM._type] == _SKM._playerFullKill) |
||
3254 | or (StoredInfo[_SKM._type] == _SKM._playerAssistKill and SkM_GetOption("AssistKillStat")) |
||
3255 | or (StoredInfo[_SKM._type] == _SKM._playerDeathPvP) |
||
3256 | then |
||
3257 | table.insert(BookText, {Type = "MultiLine", Value = 3 } ); |
||
3258 | |||
3259 | --local sZoneText = SKM_Context.Zones[Note[_SKM._continent]][Note[_SKM._zone]]; |
||
3260 | local sZoneText = SkM_GetZoneTextFromIndex(Note[_SKM._continent], Note[_SKM._zone]); |
||
3261 | local sDate = StoredInfo[_SKM._date]; |
||
3262 | table.insert(BookText, sDate.." - "..sZoneText); |
||
3263 | |||
3264 | local sLine; |
||
3265 | if (StoredInfo[_SKM._type] == _SKM._playerAssistKill) then |
||
3266 | sLine = string.format(SKM_UI_STRINGS.Book_Format_AssistKill, sName); |
||
3267 | elseif (StoredInfo[_SKM._type] == _SKM._playerKill) then |
||
3268 | sLine = string.format(SKM_UI_STRINGS.Book_Format_Kill, sName); |
||
3269 | elseif (StoredInfo[_SKM._type] == _SKM._playerFullKill) then |
||
3270 | if (StoredInfo[_SKM._loneWolfKill]) then |
||
3271 | sLine = string.format(SKM_UI_STRINGS.Book_Format_LoneWolfKill, sName); |
||
3272 | else |
||
3273 | sLine = string.format(SKM_UI_STRINGS.Book_Format_FullKill, sName); |
||
3274 | end |
||
3275 | elseif (StoredInfo[_SKM._type] == _SKM._playerDeathPvP) then |
||
3276 | sLine = string.format(SKM_UI_STRINGS.Book_Format_Death, sName); |
||
3277 | end |
||
3278 | table.insert(BookText, sLine); |
||
3279 | |||
3280 | table.insert(BookText, ""); |
||
3281 | end |
||
3282 | |||
3283 | end |
||
3284 | end |
||
3285 | |||
3286 | if (getn(BookText) == 0) then |
||
3287 | table.insert(BookText, SKM_UI_STRINGS.Book_NoData); |
||
3288 | end |
||
3289 | |||
3290 | SKMap_BuildBook(BookHeader, BookText); |
||
3291 | |||
3292 | SKMap_Book_ShowCurrentPage(); |
||
3293 | end |
||
3294 | |||
3295 | |||
3296 | function SKMap_Report_EnemyGuildRecords(sGuildName) |
||
3297 | local FName = "SKMap_Report_EnemyGuildRecords"; |
||
3298 | |||
3299 | SKM_CurrentBook = nil; |
||
3300 | |||
3301 | -- preparing header |
||
3302 | local BookHeader = { }; |
||
3303 | |||
3304 | table.insert(BookHeader, string.format("%s vs <%s>", _PlayerName, sGuildName)); |
||
3305 | table.insert(BookHeader, ""); |
||
3306 | table.insert(BookHeader, SKM_BOOK_SEPARATOR); |
||
3307 | table.insert(BookHeader, ""); |
||
3308 | |||
3309 | -- book content |
||
3310 | local BookText = { }; |
||
3311 | |||
3312 | local i; |
||
3313 | local iNbNotes = table.getn(SKM_Data[_RealmName][_PlayerName].GlobalMapData); |
||
3314 | for i=iNbNotes, 1, -1 do |
||
3315 | local Note = SKM_Data[_RealmName][_PlayerName].GlobalMapData[i]; |
||
3316 | |||
3317 | local StoredInfo = Note[_SKM._storedInfo]; |
||
3318 | |||
3319 | local sName; |
||
3320 | local Enemy; |
||
3321 | local sPlayerGuild; |
||
3322 | |||
3323 | if (StoredInfo) then |
||
3324 | sName = StoredInfo[_SKM._name]; |
||
3325 | end |
||
3326 | |||
3327 | if (sName) then |
||
3328 | Enemy = SKM_Data[_RealmName][_PlayerName].EnemyHistory[sName]; |
||
3329 | if (Enemy) then |
||
3330 | sPlayerGuild = Enemy[_SKM._guild]; |
||
3331 | end |
||
3332 | end |
||
3333 | |||
3334 | if (sPlayerGuild == sGuildName) then |
||
3335 | |||
3336 | if (StoredInfo[_SKM._type] == _SKM._playerKill) |
||
3337 | or (StoredInfo[_SKM._type] == _SKM._playerFullKill) |
||
3338 | -- or (StoredInfo[_SKM._type] == _SKM._playerAssistKill) |
||
3339 | or (StoredInfo[_SKM._type] == _SKM._playerDeathPvP) |
||
3340 | then |
||
3341 | table.insert(BookText, {Type = "MultiLine", Value = 3 } ); |
||
3342 | |||
3343 | --local sZoneText = SKM_Context.Zones[Note[_SKM._continent]][Note[_SKM._zone]]; |
||
3344 | local sZoneText = SkM_GetZoneTextFromIndex(Note[_SKM._continent], Note[_SKM._zone]); |
||
3345 | local sDate = StoredInfo[_SKM._date]; |
||
3346 | table.insert(BookText, sDate.." - "..sZoneText); |
||
3347 | |||
3348 | local sLine; |
||
3349 | if (StoredInfo[_SKM._type] == _SKM._playerKill) then |
||
3350 | sLine = string.format(SKM_UI_STRINGS.Book_Format_Kill, sName); |
||
3351 | elseif (StoredInfo[_SKM._type] == _SKM._playerFullKill) then |
||
3352 | if (StoredInfo[_SKM._loneWolfKill]) then |
||
3353 | sLine = string.format(SKM_UI_STRINGS.Book_Format_LoneWolfKill, sName); |
||
3354 | else |
||
3355 | sLine = string.format(SKM_UI_STRINGS.Book_Format_FullKill, sName); |
||
3356 | end |
||
3357 | elseif (StoredInfo[_SKM._type] == _SKM._playerDeathPvP) then |
||
3358 | sLine = string.format(SKM_UI_STRINGS.Book_Format_Death, sName); |
||
3359 | end |
||
3360 | table.insert(BookText, sLine); |
||
3361 | |||
3362 | table.insert(BookText, ""); |
||
3363 | end |
||
3364 | |||
3365 | end |
||
3366 | end |
||
3367 | |||
3368 | if (getn(BookText) == 0) then |
||
3369 | table.insert(BookText, SKM_UI_STRINGS.Book_NoData); |
||
3370 | end |
||
3371 | |||
3372 | SKMap_BuildBook(BookHeader, BookText); |
||
3373 | |||
3374 | SKMap_Book_ShowCurrentPage(); |
||
3375 | end |
||
3376 | |||
3377 | |||
3378 | function SKMap_DeleteButton_Accept(ActiveList, sName) |
||
3379 | local FName = "SKMap_DeleteButton_Accept"; |
||
3380 | |||
3381 | SkM_Trace(FName, 2, "Delete confirmed : list = "..snil(ActiveList)..", Name = "..snil(sName)); |
||
3382 | |||
3383 | if (sName ~= nil) then |
||
3384 | |||
3385 | if (ActiveList == _SKM._players) then |
||
3386 | SkM_DeleteEnemy(sName); |
||
3387 | |||
3388 | if (SKM_List_SelectedPlayer == sName) then |
||
3389 | SKM_List_SelectedPlayer = nil; |
||
3390 | if (SKM_List_ActiveList == _SKM._players) then |
||
3391 | SKMap_ListFrame_ClearDetail(); |
||
3392 | end |
||
3393 | end |
||
3394 | end |
||
3395 | |||
3396 | SKMap_ListFrame_Load(); |
||
3397 | end |
||
3398 | |||
3399 | SKM_ActivePopup = false; |
||
3400 | end |
||
3401 | |||
3402 | |||
3403 | function SKMap_DeleteButton_Cancel() |
||
3404 | SKM_ActivePopup = false; |
||
3405 | end |
||
3406 | |||
3407 | |||
3408 | function SKMap_DeleteButton_OnClick() |
||
3409 | local FName = "SKMap_DeleteButton_OnClick"; |
||
3410 | |||
3411 | SkM_Trace(FName, 1, "Delete requested"); |
||
3412 | |||
3413 | if (SKM_ActivePopup) then |
||
3414 | return; |
||
3415 | end |
||
3416 | |||
3417 | local sName; |
||
3418 | local ActiveList = SKM_List_ActiveList; |
||
3419 | |||
3420 | if (SKM_List_ActiveList == _SKM._players) then |
||
3421 | sName = SKM_List_SelectedPlayer; |
||
3422 | end |
||
3423 | |||
3424 | if (sName == nil) then |
||
3425 | return; |
||
3426 | end |
||
3427 | |||
3428 | local sPlayerColor = SKM_Config.Col_LabelTitle; |
||
3429 | local Enemy = SKM_Data[_RealmName][_PlayerName].EnemyHistory[SKM_List_SelectedPlayer]; |
||
3430 | if (Enemy) and (Enemy[_SKM._atWar]) then |
||
3431 | sPlayerColor = SKM_Config.Col_PlayerWar; |
||
3432 | end |
||
3433 | |||
3434 | local dialogdef = StaticPopupDialogs["SKMAP_CONFIRM"]; |
||
3435 | |||
3436 | dialogdef.text = string.format(SKM_UI_STRINGS.List_ConfirmDeletePlayer, SKM_Config.Col_Label, sPlayerColor, sName, SKM_Config.Col_Label); |
||
3437 | |||
3438 | --dialogdef.OnAccept = function() SKMap_DeleteButton_Accept(SKM_List_ActiveList, sName) end; |
||
3439 | dialogdef.OnAccept = function() SKMap_DeleteButton_Accept(ActiveList, sName) end; |
||
3440 | |||
3441 | SKM_ActivePopup = true; |
||
3442 | StaticPopup_Show("SKMAP_CONFIRM"); |
||
3443 | end |
||
3444 | |||
3445 | |||
3446 | function SKMap_EditBox_Accept() |
||
3447 | local FName = "SKMap_EditBox_Accept"; |
||
3448 | |||
3449 | SkM_Trace(FName, 1, "Edit accepted"); |
||
3450 | |||
3451 | local MyEditBox = getglobal(this:GetParent():GetName().."EditBox"); |
||
3452 | if (MyEditBox) then |
||
3453 | local sValue = MyEditBox:GetText(); |
||
3454 | |||
3455 | SkM_Trace(FName, 2, "Value : "..snil(sValue)); |
||
3456 | |||
3457 | local sName = SKM_EditNoteContext.Element; |
||
3458 | |||
3459 | if (SKM_EditNoteContext.List == _SKM._players) then |
||
3460 | SKM_Data[_RealmName][_PlayerName].EnemyHistory[sName][_SKM._playerNote] = sValue; |
||
3461 | elseif (SKM_EditNoteContext.List == _SKM._guilds) then |
||
3462 | SKM_Data[_RealmName][_PlayerName].GuildHistory[sName][_SKM._playerNote] = sValue; |
||
3463 | elseif (SKM_EditNoteContext.List == _SKM._duels) then |
||
3464 | SKM_Data[_RealmName][_PlayerName].DuelHistory[sName][_SKM._playerNote] = sValue; |
||
3465 | end |
||
3466 | |||
3467 | end |
||
3468 | |||
3469 | local bVisible, sFrame = SKMap_IsUIVisible(); |
||
3470 | |||
3471 | if (sFrame == "SKMap_ListFrame") and (SKM_List_ActiveList == SKM_EditNoteContext.List) then |
||
3472 | --if (SKM_List_ActiveList == SKM_EditNoteContext.List) then |
||
3473 | |||
3474 | if (SKM_EditNoteContext.List == _SKM._players) and (SKM_EditNoteContext.Element == SKM_List_SelectedPlayer) then |
||
3475 | SKMap_ListFrame_SelectElement(SKM_EditNoteContext.Element); |
||
3476 | elseif (SKM_EditNoteContext.List == _SKM._guilds) and (SKM_EditNoteContext.Element == SKM_List_SelectedGuild) then |
||
3477 | |||
3478 | SKMap_ListFrame_SelectGuild(SKM_EditNoteContext.Element); |
||
3479 | end |
||
3480 | |||
3481 | elseif (sFrame == "SKMap_DuelFrame") then |
||
3482 | SKMap_DuelFrame_SelectElement(SKM_EditNoteContext.Element); |
||
3483 | end |
||
3484 | |||
3485 | SKM_EditNoteContext = { }; |
||
3486 | |||
3487 | |||
3488 | SKMapStaticPopupEdit:Hide(); |
||
3489 | SKM_ActivePopup = false; |
||
3490 | end |
||
3491 | |||
3492 | function SKMap_EditBox_Cancel() |
||
3493 | local FName = "SKMap_EditBox_Cancel"; |
||
3494 | |||
3495 | SkM_Trace(FName, 1, "Edit canceled"); |
||
3496 | |||
3497 | SKMapStaticPopupEdit:Hide(); |
||
3498 | SKM_ActivePopup = false; |
||
3499 | end |
||
3500 | |||
3501 | |||
3502 | function SKMap_EditBox_Clear() |
||
3503 | local sPopupEdit = "SKMapStaticPopupEdit"; |
||
3504 | local MyEditBox = getglobal(sPopupEdit.."EditBox"); |
||
3505 | MyEditBox:SetText(""); |
||
3506 | end |
||
3507 | |||
3508 | |||
3509 | function SKMap_EditBox_OnShow() |
||
3510 | local FName = "SKMap_EditBox_OnShow"; |
||
3511 | |||
3512 | SkM_Trace(FName, 3, "OnShow"); |
||
3513 | |||
3514 | getglobal(this:GetName().."EditBox"):SetFocus(); |
||
3515 | end |
||
3516 | |||
3517 | |||
3518 | function SKMap_EditNote() |
||
3519 | local FName = "SKMap_EditNote"; |
||
3520 | |||
3521 | SkM_Trace(FName, 1, "Edit Note"); |
||
3522 | |||
3523 | if (SKM_ActivePopup) then |
||
3524 | return; |
||
3525 | end |
||
3526 | |||
3527 | local sPopupEdit = "SKMapStaticPopupEdit"; |
||
3528 | local MyEditBox = getglobal(sPopupEdit.."EditBox"); |
||
3529 | local MyTitle = getglobal(sPopupEdit.."Title"); |
||
3530 | local MyPrompt = getglobal(sPopupEdit.."Prompt"); |
||
3531 | |||
3532 | MyTitle:SetText(SKM_UI_STRINGS.List_EditNote_Title); |
||
3533 | |||
3534 | local bVisible, sFrame = SKMap_IsUIVisible(); |
||
3535 | |||
3536 | if (sFrame == "SKMap_ListFrame") then |
||
3537 | |||
3538 | if (SKM_List_ActiveList == _SKM._players) then |
||
3539 | if (SKM_List_SelectedPlayer == nil) then |
||
3540 | SkM_Trace(FName, 2, "No selected player !"); |
||
3541 | return; |
||
3542 | end |
||
3543 | |||
3544 | local Enemy = SKM_Data[_RealmName][_PlayerName].EnemyHistory[SKM_List_SelectedPlayer]; |
||
3545 | if (Enemy == nil) then |
||
3546 | SkM_Trace(FName, 2, "Enemy not found : "..snil(SKM_List_SelectedPlayer)); |
||
3547 | return; |
||
3548 | end |
||
3549 | |||
3550 | local sPlayerColor = SKM_Config.Col_LabelTitle; |
||
3551 | if (Enemy) and (Enemy[_SKM._atWar]) then |
||
3552 | sPlayerColor = SKM_Config.Col_PlayerWar; |
||
3553 | end |
||
3554 | |||
3555 | MyPrompt:SetText(string.format(SKM_UI_STRINGS.List_EditPlayerNote_Prompt, SKM_Config.Col_Label, sPlayerColor, SKM_List_SelectedPlayer, SKM_Config.Col_Label)); |
||
3556 | |||
3557 | MyEditBox:SetText(ifnil(Enemy[_SKM._playerNote], "")); |
||
3558 | |||
3559 | SKM_EditNoteContext = { List = _SKM._players, Element = SKM_List_SelectedPlayer }; |
||
3560 | |||
3561 | SKM_ActivePopup = true; |
||
3562 | SKMapStaticPopupEdit:Show(); |
||
3563 | |||
3564 | elseif (SKM_List_ActiveList == _SKM._guilds) then |
||
3565 | if (SKM_List_SelectedGuild == nil) then |
||
3566 | return; |
||
3567 | end |
||
3568 | |||
3569 | local Guild = SKM_Data[_RealmName][_PlayerName].GuildHistory[SKM_List_SelectedGuild]; |
||
3570 | if (Guild == nil) then |
||
3571 | return; |
||
3572 | end |
||
3573 | |||
3574 | local sGuildColor = SKM_Config.Col_LabelTitle; |
||
3575 | if (Guild) and (Guild[_SKM._atWar]) then |
||
3576 | sGuildColor = SKM_Config.Col_PlayerWar; |
||
3577 | end |
||
3578 | |||
3579 | MyPrompt:SetText(string.format(SKM_UI_STRINGS.List_EditGuildNote_Prompt, SKM_Config.Col_Label, sGuildColor, SKM_List_SelectedGuild, SKM_Config.Col_Label)); |
||
3580 | |||
3581 | MyEditBox:SetText(ifnil(Guild[_SKM._playerNote], "")); |
||
3582 | |||
3583 | SKM_EditNoteContext = { List = _SKM._guilds, Element = SKM_List_SelectedGuild }; |
||
3584 | |||
3585 | SKM_ActivePopup = true; |
||
3586 | SKMapStaticPopupEdit:Show(); |
||
3587 | end |
||
3588 | |||
3589 | elseif (sFrame == "SKMap_DuelFrame") then |
||
3590 | |||
3591 | if (SKM_DuelList_SelectedPlayer == nil) then |
||
3592 | SkM_Trace(FName, 2, "No selected player !"); |
||
3593 | return; |
||
3594 | end |
||
3595 | |||
3596 | local Enemy = SKM_Data[_RealmName][_PlayerName].DuelHistory[SKM_DuelList_SelectedPlayer]; |
||
3597 | if (Enemy == nil) then |
||
3598 | SkM_Trace(FName, 2, "Enemy not found : "..snil(SKM_DuelList_SelectedPlayer)); |
||
3599 | return; |
||
3600 | end |
||
3601 | |||
3602 | local sPlayerColor = SKM_Config.Col_LabelTitle; |
||
3603 | |||
3604 | MyPrompt:SetText(string.format(SKM_UI_STRINGS.List_EditPlayerNote_Prompt, SKM_Config.Col_Label, sPlayerColor, SKM_DuelList_SelectedPlayer, SKM_Config.Col_Label)); |
||
3605 | |||
3606 | MyEditBox:SetText(ifnil(Enemy[_SKM._playerNote], "")); |
||
3607 | |||
3608 | SKM_EditNoteContext = { List = _SKM._duels, Element = SKM_DuelList_SelectedPlayer }; |
||
3609 | |||
3610 | SKM_ActivePopup = true; |
||
3611 | SKMapStaticPopupEdit:Show(); |
||
3612 | end |
||
3613 | |||
3614 | end |
||
3615 | |||
3616 | |||
3617 | function SKMap_WorldControlHide_OnClick() |
||
3618 | local FName = "SKMap_WorldControlHide_OnClick"; |
||
3619 | |||
3620 | SkM_SetOption("ShowWorldMapControl", false); |
||
3621 | SKMapWorldMapControl:Hide(); |
||
3622 | end |
||
3623 | |||
3624 | |||
3625 | function SKMap_WorldControlShowRecords_OnClick() |
||
3626 | local FName = "SKMap_WorldControlShowRecords_OnClick"; |
||
3627 | |||
3628 | local idx=1; |
||
3629 | local MyButton = getglobal("SKMapWorldMapControl_CheckButton"..idx); |
||
3630 | |||
3631 | if (not MyButton:GetChecked()) then |
||
3632 | SkM_SetOption("MapDisplayRecords", false); |
||
3633 | else |
||
3634 | SkM_SetOption("MapDisplayRecords", true); |
||
3635 | end |
||
3636 | |||
3637 | SkM_MainDraw(); |
||
3638 | end |
||
3639 | |||
3640 | |||
3641 | |||
3642 | |||
3643 | function SKMap_IsUIVisible() |
||
3644 | local bVisible = false; |
||
3645 | local sSubFrame = nil; |
||
3646 | |||
3647 | if (SKMapFrame:IsVisible()) then |
||
3648 | bVisible = true; |
||
3649 | |||
3650 | for idx, val in SKM_TAB_SUBFRAMES do |
||
3651 | local tabFrame = getglobal(val); |
||
3652 | if (tabFrame:IsVisible()) then |
||
3653 | sSubFrame = val; |
||
3654 | end |
||
3655 | end |
||
3656 | end |
||
3657 | |||
3658 | return bVisible, sSubFrame; |
||
3659 | end |
||
3660 | |||
3661 | |||
3662 | function SKMap_DuelFrame_Load() |
||
3663 | local FName = "SKMap_DuelFrame_Load"; |
||
3664 | |||
3665 | SkM_Trace(FName, 1, "Loading DuelFrame"); |
||
3666 | |||
3667 | SKMap_SetDuelListContent(); |
||
3668 | SKMap_DuelFrame_UpdateList(); |
||
3669 | SKMap_DuelFrame_SortList(); |
||
3670 | |||
3671 | end |
||
3672 | |||
3673 | |||
3674 | function SKMap_SetDuelListContent() |
||
3675 | local FName = "SKMap_SetDuelListContent"; |
||
3676 | |||
3677 | SKM_DuelList_Content = { }; |
||
3678 | |||
3679 | local idx, val; |
||
3680 | for idx, val in SKM_Data[_RealmName][_PlayerName].DuelHistory do |
||
3681 | local Elem = copytable(val); |
||
3682 | |||
3683 | Elem[_SKM._class] = SkM_GetClassText(Elem[_SKM._class]); |
||
3684 | Elem[_SKM._race] = SkM_GetRaceText(Elem[_SKM._race]); |
||
3685 | |||
3686 | if (Elem[_SKM._duel]) then |
||
3687 | Elem[_SKM._score] = math.floor(100 * 100 * ifnil(Elem[_SKM._win], 0)/Elem[_SKM._duel]) / 100; |
||
3688 | end |
||
3689 | table.insert(SKM_DuelList_Content, Elem); |
||
3690 | end |
||
3691 | |||
3692 | end |
||
3693 | |||
3694 | |||
3695 | function SKMap_DuelFrame_UpdateList() |
||
3696 | local FName = "SKMap_DuelFrame_UpdateList"; |
||
3697 | |||
3698 | local iScrollOffset = FauxScrollFrame_GetOffset(SKMap_DuelScrollFrame); |
||
3699 | |||
3700 | SkM_Trace(FName, 4, "Scrollbar offset = "..snil(iScrollOffset)); |
||
3701 | |||
3702 | local iEnemyCount = table.getn(SKM_DuelList_Content); |
||
3703 | SkM_Trace(FName, 4, "Enemy Count = "..snil(iEnemyCount)); |
||
3704 | |||
3705 | local iEnemyIndex = iScrollOffset + 1; |
||
3706 | |||
3707 | SkM_Trace(FName, 4, "Enemy Index = "..snil(iEnemyIndex)); |
||
3708 | |||
3709 | local i; |
||
3710 | for i=1, SKM_DUELFRAME_ROWS, 1 do |
||
3711 | local RowButton = getglobal("SKMap_DuelFrameButton"..i); |
||
3712 | |||
3713 | if (iEnemyIndex <= iEnemyCount) then |
||
3714 | |||
3715 | RowButtonName = getglobal("SKMap_DuelFrameButton"..i.."Name"); |
||
3716 | RowButtonGuild = getglobal("SKMap_DuelFrameButton"..i.."Guild"); |
||
3717 | RowButtonLevel = getglobal("SKMap_DuelFrameButton"..i.."Level"); |
||
3718 | RowButtonRace = getglobal("SKMap_DuelFrameButton"..i.."Race"); |
||
3719 | RowButtonClass = getglobal("SKMap_DuelFrameButton"..i.."Class"); |
||
3720 | |||
3721 | RowButtonWin = getglobal("SKMap_DuelFrameButton"..i.."Win"); |
||
3722 | RowButtonLoss = getglobal("SKMap_DuelFrameButton"..i.."Loss"); |
||
3723 | RowButtonDuel = getglobal("SKMap_DuelFrameButton"..i.."Duel"); |
||
3724 | RowButtonLastDuel = getglobal("SKMap_DuelFrameButton"..i.."LastDuel"); |
||
3725 | RowButtonScore = getglobal("SKMap_DuelFrameButton"..i.."Score"); |
||
3726 | |||
3727 | local sName = ifnil(SKM_DuelList_Content[iEnemyIndex][_SKM._name], "??"); |
||
3728 | local sLevel = ifnil(SKM_DuelList_Content[iEnemyIndex][_SKM._level], "??"); |
||
3729 | local sRace = ifnil(SKM_DuelList_Content[iEnemyIndex][_SKM._race], "??"); |
||
3730 | local sClass = ifnil(SKM_DuelList_Content[iEnemyIndex][_SKM._class], "??"); |
||
3731 | local sLastDuel = ifnil(SKM_DuelList_Content[iEnemyIndex][_SKM._lastDuel], "??"); |
||
3732 | |||
3733 | |||
3734 | local sGuild = SKM_DuelList_Content[iEnemyIndex][_SKM._guild]; |
||
3735 | |||
3736 | local iWin = ifnil(SKM_DuelList_Content[iEnemyIndex][_SKM._win], 0); |
||
3737 | local iLoss = ifnil(SKM_DuelList_Content[iEnemyIndex][_SKM._loss], 0); |
||
3738 | |||
3739 | local iDuel = ifnil(SKM_DuelList_Content[iEnemyIndex][_SKM._duel], 0); |
||
3740 | |||
3741 | if (sLevel == -1) then |
||
3742 | sLevel = "++"; |
||
3743 | end |
||
3744 | |||
3745 | local iScore = SKM_DuelList_Content[iEnemyIndex][_SKM._score]; |
||
3746 | |||
3747 | RowButtonName:SetText(sName); |
||
3748 | RowButtonGuild:SetText(sGuild); |
||
3749 | RowButtonLevel:SetText(sLevel); |
||
3750 | RowButtonRace:SetText(sRace); |
||
3751 | RowButtonClass:SetText(sClass); |
||
3752 | RowButtonWin:SetText(iWin); |
||
3753 | RowButtonLoss:SetText(iLoss); |
||
3754 | RowButtonDuel:SetText(iDuel); |
||
3755 | RowButtonLastDuel:SetText(sLastDuel); |
||
3756 | RowButtonScore:SetText(iScore); |
||
3757 | |||
3758 | RowButton:Show(); |
||
3759 | |||
3760 | iEnemyIndex = iEnemyIndex + 1; |
||
3761 | else |
||
3762 | RowButton:Hide(); |
||
3763 | end |
||
3764 | end |
||
3765 | |||
3766 | FauxScrollFrame_Update(SKMap_DuelScrollFrame, iEnemyCount, SKM_DUELFRAME_ROWS, SKM_DUELFRAME_ROWHEIGHT); |
||
3767 | end |
||
3768 | |||
3769 | |||
3770 | function SKMap_DuelFrame_SortList(sSortType) |
||
3771 | local FName = "SKMap_DuelFrame_SortList"; |
||
3772 | |||
3773 | if (sSortType) then |
||
3774 | --if (sSortType == SKM_DuelList_SortType) then |
||
3775 | if (sSortType == SkM_GetOption("DuelList_SortType") ) then |
||
3776 | --if (SKM_DuelList_ReverseSort) then |
||
3777 | if ( SkM_GetOption("DuelList_ReverseSort") ) then |
||
3778 | --SKM_DuelList_ReverseSort = false; |
||
3779 | SkM_SetOption("DuelList_ReverseSort", false); |
||
3780 | else |
||
3781 | --SKM_DuelList_ReverseSort = true; |
||
3782 | SkM_SetOption("DuelList_ReverseSort", true); |
||
3783 | end |
||
3784 | else |
||
3785 | --SKM_DuelList_SortType = sSortType; |
||
3786 | SkM_SetOption("DuelList_SortType", sSortType); |
||
3787 | |||
3788 | --SKM_DuelList_SortTypes = removefromlist(sSortType, SKM_DuelList_SortTypes); |
||
3789 | SKM_Settings.DuelList_SortTypes = removefromlist(sSortType, SkM_GetOption("DuelList_SortTypes") ); |
||
3790 | --table.insert(SKM_DuelList_SortTypes, 1, sSortType); |
||
3791 | table.insert(SKM_Settings.DuelList_SortTypes, 1, sSortType); |
||
3792 | end |
||
3793 | end |
||
3794 | |||
3795 | if (SKM_DuelList_Content) then |
||
3796 | table.sort(SKM_DuelList_Content, SKMap_DuelFrame_Sort); |
||
3797 | end |
||
3798 | |||
3799 | SKMap_DuelFrame_UpdateList(); |
||
3800 | end |
||
3801 | |||
3802 | |||
3803 | |||
3804 | function SKMap_DuelFrame_Sort(e1, e2) |
||
3805 | local FName = "SKMap_DuelFrame_Sort"; |
||
3806 | |||
3807 | SkM_Trace(FName, 4, "Begin"); |
||
3808 | |||
3809 | if (e1 == nil) then |
||
3810 | if (e2 == nil) then |
||
3811 | return false; |
||
3812 | else |
||
3813 | return true; |
||
3814 | end |
||
3815 | elseif (e2 == nil) then |
||
3816 | return false; |
||
3817 | end |
||
3818 | |||
3819 | --local iSortTypes = table.getn(SKM_DuelList_SortTypes); |
||
3820 | local iSortTypes = table.getn( SkM_GetOption("DuelList_SortTypes") ); |
||
3821 | |||
3822 | local i; |
||
3823 | for i=1, iSortTypes, 1 do |
||
3824 | local bReverseSort = false; |
||
3825 | --if (i == 1) and (SKM_DuelList_ReverseSort == true) then |
||
3826 | if (i == 1) and ( SkM_GetOption("DuelList_ReverseSort") ) then |
||
3827 | bReverseSort = true; |
||
3828 | end |
||
3829 | --local bCmp = SKMap_ListFrame_SubSort(e1, e2, SKM_DuelList_SortTypes[i], bReverseSort); |
||
3830 | local bCmp = SKMap_ListFrame_SubSort(e1, e2, SkM_GetOption("DuelList_SortTypes")[i], bReverseSort); |
||
3831 | if (bCmp ~= nil) then |
||
3832 | return bCmp; |
||
3833 | end |
||
3834 | end |
||
3835 | return false; |
||
3836 | |||
3837 | end |
||
3838 | |||
3839 | |||
3840 | function SKMap_DuelFrame_SelectElement(sPlayerName) |
||
3841 | local FName = "SKMap_DuelFrame_SelectElement"; |
||
3842 | |||
3843 | local sName; |
||
3844 | |||
3845 | if (sPlayerName ~= nil) then |
||
3846 | sName = sPlayerName; |
||
3847 | else |
||
3848 | local id = this:GetID(); |
||
3849 | local iScrollOffset = FauxScrollFrame_GetOffset(SKMap_DuelScrollFrame); |
||
3850 | local iEnemyCount = table.getn(SKM_DuelList_Content); |
||
3851 | |||
3852 | SkM_Trace(FName, 3, "Scroll offset = "..iScrollOffset); |
||
3853 | SkM_Trace(FName, 3, "Line id = "..id); |
||
3854 | |||
3855 | local iEnemyIndex = iScrollOffset + id; |
||
3856 | SkM_Trace(FName, 3, "Enemy Index = "..iEnemyIndex); |
||
3857 | |||
3858 | if (iEnemyIndex <= iEnemyCount) then |
||
3859 | sName = SKM_DuelList_Content[iEnemyIndex][_SKM._name]; |
||
3860 | end |
||
3861 | |||
3862 | end |
||
3863 | |||
3864 | local Enemy; |
||
3865 | if (sName ~= nil) then |
||
3866 | Enemy = SKM_Data[_RealmName][_PlayerName].DuelHistory[sName]; |
||
3867 | end |
||
3868 | |||
3869 | local Lines = { }; |
||
3870 | |||
3871 | if (Enemy ~= nil) then |
||
3872 | SKM_DuelList_SelectedPlayer = sName; |
||
3873 | |||
3874 | local Guild; |
||
3875 | |||
3876 | local sGuild = Enemy[_SKM._guild]; |
||
3877 | local sLevel = ifnil(Enemy[_SKM._level], "??"); |
||
3878 | local sRace = ifnil(SkM_GetRaceText(Enemy[_SKM._race]), "??"); |
||
3879 | local sClass = ifnil(SkM_GetClassText(Enemy[_SKM._class]), "??"); |
||
3880 | local sLastDuel = ifnil(Enemy[_SKM._lastDuel], "??"); |
||
3881 | |||
3882 | local iWin = ifnil(Enemy[_SKM._win], 0); |
||
3883 | local iLoss = ifnil(Enemy[_SKM._loss], 0); |
||
3884 | local iDuel = ifnil(Enemy[_SKM._duel], 0); |
||
3885 | |||
3886 | local iScore = math.floor(100 * 100 * ifnil(Enemy[_SKM._win], 0)/Enemy[_SKM._duel]) / 100; |
||
3887 | |||
3888 | if (sLevel == -1) then |
||
3889 | sLevel = "++"; |
||
3890 | end |
||
3891 | |||
3892 | |||
3893 | SKMap_DuelFrame_EditNote:Show(); |
||
3894 | --SKMap_DuelFrame_ReportButton:Show(); |
||
3895 | SKMap_DuelFrame_DeleteButton:Show(); |
||
3896 | |||
3897 | |||
3898 | -- line 1 : player name |
||
3899 | local sLine = ""; |
||
3900 | |||
3901 | sLine = sLine..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_Player; |
||
3902 | sLine = sLine..SKM_Config.Col_Label; |
||
3903 | sLine = sLine..sName..SKM_Config.Col_Label; |
||
3904 | |||
3905 | |||
3906 | table.insert(Lines, sLine); |
||
3907 | |||
3908 | |||
3909 | -- line 2 (optional) : player guild |
||
3910 | if (sGuild ~= nil) and (sGuild ~= "") then |
||
3911 | |||
3912 | local sLine = ""; |
||
3913 | sLine = sLine..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_Guild; |
||
3914 | sLine = sLine..SKM_Config.Col_Label; |
||
3915 | sLine = sLine..sGuild..SKM_Config.Col_Label; |
||
3916 | |||
3917 | table.insert(Lines, sLine); |
||
3918 | end |
||
3919 | |||
3920 | |||
3921 | -- line 3 (optional, not shown if info not available) : level race class |
||
3922 | if (Enemy[_SKM._level] ~= nil) and (Enemy[_SKM._race] ~= nil) and (Enemy[_SKM._class] ~= nil) then |
||
3923 | |||
3924 | local sLine = ""; |
||
3925 | sLine = sLine..SKM_Config.Col_Label..SKM_UI_STRINGS.List_Frame_Level..sLevel.." "..sRace.." "..sClass; -- 0.08.2 Add localization |
||
3926 | |||
3927 | table.insert(Lines, sLine); |
||
3928 | end |
||
3929 | |||
3930 | |||
3931 | -- line 4 : last duel time |
||
3932 | if (Enemy[_SKM._lastDuel] ~= nil) then |
||
3933 | |||
3934 | local sLine = ""; |
||
3935 | |||
3936 | sLine = sLine..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_Last_Duel; |
||
3937 | sLine = sLine..SKM_Config.Col_Label..Enemy[_SKM._lastDuel]; |
||
3938 | |||
3939 | if (Enemy[_SKM._continent] ~= nil) and (Enemy[_SKM._zone] ~= nil) then |
||
3940 | --local sZoneText = SKM_Context.Zones[Enemy[_SKM._continent]][Enemy[_SKM._zone]]; |
||
3941 | local sZoneText = SkM_GetZoneTextFromIndex(Enemy[_SKM._continent], Enemy[_SKM._zone]); |
||
3942 | sLine = sLine.." - "..sZoneText; |
||
3943 | end |
||
3944 | |||
3945 | table.insert(Lines, sLine); |
||
3946 | end |
||
3947 | |||
3948 | |||
3949 | -- line 6 : meet and death counts |
||
3950 | local sLine = ""; |
||
3951 | |||
3952 | sLine = sLine..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_Duel..SKM_Config.Col_Label..iDuel; |
||
3953 | sLine = sLine.." "..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_Win..SKM_Config.Col_DuelWin .. iWin; |
||
3954 | sLine = sLine.." "..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_Loss..SKM_Config.Col_DuelLoss .. iLoss; |
||
3955 | sLine = sLine.." "..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_Score..SKM_Config.Col_Label .. iScore; |
||
3956 | |||
3957 | table.insert(Lines, sLine); |
||
3958 | |||
3959 | |||
3960 | |||
3961 | -- line 8 : player notes |
||
3962 | if (Enemy[_SKM._playerNote] ~= nil) and (Enemy[_SKM._playerNote] ~= "") then |
||
3963 | local sLine = ""; |
||
3964 | |||
3965 | sLine = sLine..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_Note; -- 0.08.2 Add localization |
||
3966 | sLine = sLine..SKM_Config.Col_Label..Enemy[_SKM._playerNote]; |
||
3967 | |||
3968 | table.insert(Lines, sLine); |
||
3969 | end |
||
3970 | |||
3971 | |||
3972 | local i; |
||
3973 | for i=1, SKM_DUELFRAME_DETAIL_ROWS, 1 do |
||
3974 | local ButtonText = getglobal("SKMap_DuelFrameDetailButton"..i.."Text"); |
||
3975 | |||
3976 | if (i <= getn(Lines)) then |
||
3977 | SkM_Trace(FName, 2, i.." : "..Lines[i]); |
||
3978 | |||
3979 | if (ButtonText) then |
||
3980 | ButtonText:SetText(Lines[i]); |
||
3981 | end |
||
3982 | else |
||
3983 | ButtonText:SetText(""); |
||
3984 | end |
||
3985 | end |
||
3986 | end |
||
3987 | |||
3988 | end |
||
3989 | |||
3990 | |||
3991 | function SKMap_DuelEditNote() |
||
3992 | local FName = "SKMap_DuelEditNote"; |
||
3993 | |||
3994 | if (SKM_ActivePopup) then |
||
3995 | return; |
||
3996 | end |
||
3997 | |||
3998 | local sPopupEdit = "SKMapStaticPopupEdit"; |
||
3999 | local MyEditBox = getglobal(sPopupEdit.."EditBox"); |
||
4000 | local MyTitle = getglobal(sPopupEdit.."Title"); |
||
4001 | local MyPrompt = getglobal(sPopupEdit.."Prompt"); |
||
4002 | |||
4003 | MyTitle:SetText(SKM_UI_STRINGS.List_EditNote_Title); |
||
4004 | |||
4005 | |||
4006 | if (SKM_DuelList_SelectedPlayer == nil) then |
||
4007 | SkM_Trace(FName, 2, "No selected player !"); |
||
4008 | return; |
||
4009 | end |
||
4010 | |||
4011 | local Enemy = SKM_Data[_RealmName][_PlayerName].DuelHistory[SKM_DuelList_SelectedPlayer]; |
||
4012 | if (Enemy == nil) then |
||
4013 | SkM_Trace(FName, 2, "Enemy not found : "..snil(SKM_DuelList_SelectedPlayer)); |
||
4014 | return; |
||
4015 | end |
||
4016 | |||
4017 | local sPlayerColor = SKM_Config.Col_LabelTitle; |
||
4018 | |||
4019 | MyPrompt:SetText(string.format(SKM_UI_STRINGS.List_EditPlayerNote_Prompt, SKM_Config.Col_Label, sPlayerColor, SKM_List_SelectedPlayer, SKM_Config.Col_Label)); |
||
4020 | |||
4021 | MyEditBox:SetText(ifnil(Enemy[_SKM._playerNote], "")); |
||
4022 | |||
4023 | SKM_EditNoteContext = { List = _SKM._duels, Element = SKM_DuelList_SelectedPlayer }; |
||
4024 | |||
4025 | SKM_ActivePopup = true; |
||
4026 | SKMapStaticPopupEdit:Show(); |
||
4027 | |||
4028 | end |
||
4029 | |||
4030 | |||
4031 | function SKMap_DeleteDuel_Accept(sName) |
||
4032 | local FName = "SKMap_DeleteDuel_Accept"; |
||
4033 | |||
4034 | SkM_Trace(FName, 2, "Delete confirmed : Name = "..snil(sName)); |
||
4035 | |||
4036 | if (sName ~= nil) then |
||
4037 | |||
4038 | SkM_DeleteDuelEnemy(sName); |
||
4039 | |||
4040 | if (SKM_DuelList_SelectedPlayer == sName) then |
||
4041 | SKM_DuelList_SelectedPlayer = nil; |
||
4042 | SKMap_DuelFrame_ClearDetail(); |
||
4043 | end |
||
4044 | |||
4045 | SKMap_DuelFrame_Load(); |
||
4046 | end |
||
4047 | |||
4048 | SKM_ActivePopup = false; |
||
4049 | end |
||
4050 | |||
4051 | |||
4052 | function SKMap_DeleteDuel_OnClick() |
||
4053 | local FName = "SKMap_DeleteDuel_OnClick"; |
||
4054 | |||
4055 | SkM_Trace(FName, 1, "Delete requested"); |
||
4056 | |||
4057 | if (SKM_ActivePopup) then |
||
4058 | return; |
||
4059 | end |
||
4060 | |||
4061 | local sName; |
||
4062 | local ActiveList = SKM_List_ActiveList; |
||
4063 | |||
4064 | sName = SKM_DuelList_SelectedPlayer; |
||
4065 | |||
4066 | if (sName == nil) then |
||
4067 | return; |
||
4068 | end |
||
4069 | |||
4070 | local sPlayerColor = SKM_Config.Col_LabelTitle; |
||
4071 | local Enemy = SKM_Data[_RealmName][_PlayerName].DuelHistory[SKM_DuelList_SelectedPlayer]; |
||
4072 | |||
4073 | local dialogdef = StaticPopupDialogs["SKMAP_CONFIRM"]; |
||
4074 | |||
4075 | dialogdef.text = string.format(SKM_UI_STRINGS.Duel_ConfirmDeletePlayer, SKM_Config.Col_Label, sPlayerColor, sName, SKM_Config.Col_Label); |
||
4076 | |||
4077 | dialogdef.OnAccept = function() SKMap_DeleteDuel_Accept(sName) end; |
||
4078 | |||
4079 | SKM_ActivePopup = true; |
||
4080 | StaticPopup_Show("SKMAP_CONFIRM"); |
||
4081 | end |
||
4082 | |||
4083 | |||
4084 | function SKMap_DuelFrame_ClearDetail() |
||
4085 | local i; |
||
4086 | for i=1, SKM_DUELFRAME_DETAIL_ROWS, 1 do |
||
4087 | local ButtonText = getglobal("SKMap_DuelFrameDetailButton"..i.."Text"); |
||
4088 | if (ButtonText) then |
||
4089 | ButtonText:SetText(""); |
||
4090 | end |
||
4091 | end |
||
4092 | |||
4093 | SKMap_DuelFrame_EditNote:Hide(); |
||
4094 | --SKMap_DuelFrame_ReportButton:Hide(); |
||
4095 | SKMap_DuelFrame_DeleteButton:Hide(); |
||
4096 | end |
||
4097 | |||
4098 | |||
4099 | function SKMap_ReportFrame_UseAssist() |
||
4100 | local FName = "SKMap_ReportFrame_UseAssist"; |
||
4101 | |||
4102 | local MyButton = getglobal("SKMap_ReportFrameCheckButton1"); |
||
4103 | |||
4104 | --SKM_Config.FilterNotAtWar = false; |
||
4105 | --if (MyButton:GetChecked()) then |
||
4106 | -- SKM_Config.FilterNotAtWar = true; |
||
4107 | --end |
||
4108 | |||
4109 | local idx=1; |
||
4110 | local MyButton = getglobal("SKMap_ReportFrameCheckButton"..idx); |
||
4111 | |||
4112 | if (not MyButton:GetChecked()) then |
||
4113 | SkM_SetOption("AssistKillStat", false); |
||
4114 | else |
||
4115 | SkM_SetOption("AssistKillStat", true); |
||
4116 | end |
||
4117 | |||
4118 | if (SKM_CurrentBook ~= nil) then |
||
4119 | SKMap_Report_LoadBook(SKM_CurrentBook); |
||
4120 | |||
4121 | SKMap_ReportFrame_Load(); |
||
4122 | end |
||
4123 | end |
||
4124 | |||
4125 | |||
4126 | function SKMap_TargetFrame_OnDragStart() |
||
4127 | |||
4128 | if (not SkM_GetOption("LockedTargetInfo")) then |
||
4129 | if (SkM_GetOption("SmallTargetInfo")) then |
||
4130 | SKMapSmallTargetInfoFrame:StartMoving(); |
||
4131 | else |
||
4132 | SKMapTargetInfoFrame:StartMoving(); |
||
4133 | end |
||
4134 | end |
||
4135 | end |
||
4136 | |||
4137 | |||
4138 | function SKMap_TargetFrame_OnDragStop() |
||
4139 | --TargetLogHistoryFrame:StopMovingOrSizing(); |
||
4140 | |||
4141 | if (SkM_GetOption("SmallTargetInfo")) then |
||
4142 | SKMapSmallTargetInfoFrame:StopMovingOrSizing(); |
||
4143 | else |
||
4144 | SKMapTargetInfoFrame:StopMovingOrSizing(); |
||
4145 | end |
||
4146 | end |
||
4147 | |||
4148 | |||
4149 | function SKMap_Frame_MouseUp() |
||
4150 | local FName = "SKMap_Frame_MouseUp"; |
||
4151 | |||
4152 | if ( this.isMoving ) then |
||
4153 | this:StopMovingOrSizing(); |
||
4154 | this.isMoving = false; |
||
4155 | |||
4156 | local frameName = this:GetName(); |
||
4157 | |||
4158 | if (frameName == "SKMapTargetInfoFrame" ) then |
||
4159 | SKMapSmallTargetInfoFrame:ClearAllPoints(); |
||
4160 | SKMapSmallTargetInfoFrame:SetPoint("TOPLEFT","SKMapTargetInfoFrame","TOPLEFT",0,0); |
||
4161 | elseif (frameName == "SKMapSmallTargetInfoFrame" ) then |
||
4162 | SKMapTargetInfoFrame:ClearAllPoints(); |
||
4163 | SKMapTargetInfoFrame:SetPoint("TOPLEFT","SKMapSmallTargetInfoFrame","TOPLEFT",0,0); |
||
4164 | end |
||
4165 | |||
4166 | end |
||
4167 | end |
||
4168 | |||
4169 | function SKMap_Frame_MouseDown(bLocked) |
||
4170 | --if ( ( ( not this.isLocked ) or ( this.isLocked == 0 ) ) and ( arg1 == "LeftButton" ) ) then |
||
4171 | if (not bLocked) and ( arg1 == "LeftButton" ) then |
||
4172 | this:StartMoving(); |
||
4173 | this.isMoving = true; |
||
4174 | end |
||
4175 | end |
||
4176 | |||
4177 | --/script SKMapTargetInfoFrame:SetPoint("TOPLEFT","TargetFrame","TOPRIGHT",-32,-52); |
||
4178 | --/script SKMapSmallTargetInfoFrame:SetPoint("TOPLEFT","TargetFrame","TOPRIGHT",-32,-52); |
||
4179 | |||
4180 | |||
4181 | function SKMap_TooltipAddLines(Lines) |
||
4182 | local i; |
||
4183 | for i=1, table.getn(Lines), 1 do |
||
4184 | GameTooltip:AddLine(Lines[i]); |
||
4185 | end |
||
4186 | |||
4187 | --GameTooltip:SetHeight( GameTooltip:GetHeight() + GameTooltip:GetHeight() / GameTooltip:NumLines() ); |
||
4188 | GameTooltip:Show(); |
||
4189 | end |
||
4190 | |||
4191 | |||
4192 | function SKMap_TooltipEnemyInfo(sName) |
||
4193 | local FName = "SKMap_TooltipEnemyInfo"; |
||
4194 | |||
4195 | local Enemy = SKM_Data[_RealmName][_PlayerName].EnemyHistory[sName]; |
||
4196 | if (not Enemy) then |
||
4197 | SkM_Trace(FName, 2, "Unknown enemy : "..snil(sName)); |
||
4198 | return false; |
||
4199 | end |
||
4200 | |||
4201 | local iKill = ifnil(Enemy[_SKM._playerKill], 0); |
||
4202 | local iAssistKill = ifnil(Enemy[_SKM._playerAssistKill], 0); |
||
4203 | local iFullKill = ifnil(Enemy[_SKM._playerFullKill], 0); |
||
4204 | local iTotalKill = iKill + iAssistKill + iFullKill; |
||
4205 | local iDeath = ifnil(Enemy[_SKM._enemyKillPlayer], 0); |
||
4206 | local iMet = ifnil(Enemy[_SKM._meetCount], 0); |
||
4207 | local iLoneWolf = ifnil(Enemy[_SKM._loneWolfKill], 0); |
||
4208 | |||
4209 | local iHonorKill = ifnil(Enemy[_SKM._honorKill], 0); |
||
4210 | local iRemaining = SkM_GetHonorRemainingKills(sName); |
||
4211 | |||
4212 | local Lines = { }; |
||
4213 | |||
4214 | |||
4215 | local sLine = ""; |
||
4216 | sLine = sLine..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_Met..SKM_Config.Col_PlayerMet..iMet; -- 0.08.2 Add localization |
||
4217 | sLine = sLine.." "..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_Death..SKM_Config.Col_PlayerDeath .. iDeath; -- 0.08.2 Add localization |
||
4218 | --sLine = sLine.." "..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_LoneWolf..SKM_Config.Col_LoneWolfKill .. iLoneWolf; |
||
4219 | |||
4220 | table.insert(Lines, sLine); |
||
4221 | |||
4222 | |||
4223 | local sLine = ""; |
||
4224 | sLine = sLine..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_Kill..SKM_Config.Col_PlayerTotalKill..iTotalKill; |
||
4225 | --sLine = sLine.." "..SKM_Config.Col_Label.."( "; |
||
4226 | --sLine = sLine..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_Full..SKM_Config.Col_PlayerFullKill..iFullKill; |
||
4227 | --sLine = sLine..SKM_Config.Col_Label.." + "..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_Standard..SKM_Config.Col_PlayerKill..iKill; -- 0.08.2 Add localization |
||
4228 | --sLine = sLine..SKM_Config.Col_Label.." + "..SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.List_Frame_Assist..SKM_Config.Col_PlayerAssistKill..iAssistKill..SKM_Config.Col_Label.." )"; -- 0.08.2 Add localization |
||
4229 | |||
4230 | local sKillDetail = SKM_Config.Col_LabelTitle..SKM_UI_STRINGS.Small_Target_Honor..SKM_Config.Col_HonorKill..iHonorKill.." "; |
||
4231 | if (iRemaining == 0) then |
||
4232 | sKillDetail = sKillDetail..SKM_Config.Col_Label.."( "..SKM_Config.Col_Honorless..SKM_UI_STRINGS.Small_Target_NoHonor..SKM_Config.Col_Label.." )"; |
||
4233 | else |
||
4234 | sKillDetail = sKillDetail..SKM_Config.Col_Label.."( "..SKM_Config.Col_HonorKill..iRemaining..SKM_Config.Col_Label.." )"; |
||
4235 | end |
||
4236 | sLine = sLine.." "..sKillDetail; |
||
4237 | |||
4238 | table.insert(Lines, sLine); |
||
4239 | |||
4240 | |||
4241 | if (Enemy[_SKM._atWar] == true) then |
||
4242 | local sLine = ""; |
||
4243 | sLine = sLine..SKM_Config.Col_PlayerWar.. SKM_UI_STRINGS.Small_Target_War; |
||
4244 | if (Enemy[_SKM._warDate]) then |
||
4245 | local sDisplayDate = string.sub(Enemy[_SKM._warDate], 1, 10); |
||
4246 | sLine = sLine..SKM_Config.Col_PlayerWar .. SKM_UI_STRINGS.Since .. sDisplayDate; |
||
4247 | end |
||
4248 | |||
4249 | |||
4250 | table.insert(Lines, sLine); |
||
4251 | end |
||
4252 | |||
4253 | SKMap_TooltipAddLines(Lines); |
||
4254 | end |
||
4255 | |||
4256 | |||
4257 | function SKMap_TooltipEnemyNote(sName) |
||
4258 | local FName = "SKMap_TooltipEnemyNote"; |
||
4259 | |||
4260 | local Enemy = SKM_Data[_RealmName][_PlayerName].EnemyHistory[sName]; |
||
4261 | if (not Enemy) then |
||
4262 | SkM_Trace(FName, 2, "Unknown enemy : "..snil(sName)); |
||
4263 | return false; |
||
4264 | end |
||
4265 | |||
4266 | |||
4267 | local Lines = { }; |
||
4268 | if (Enemy[_SKM._playerNote] ~= nil) and (Enemy[_SKM._playerNote] ~= "") then |
||
4269 | local sLine = Enemy[_SKM._playerNote]; |
||
4270 | SkM_TableInsertMaxLengthLine(Lines, sLine, SKM_Config.MaxFormatLineLength, SKM_Config.FormatLineThreshold, SKM_Config.Col_Label); |
||
4271 | end |
||
4272 | |||
4273 | SKMap_TooltipAddLines(Lines); |
||
4274 | end |
||
4275 | |||
4276 | |||
4277 | function SKMap_OptionsFrame_ScrollUpdate() |
||
4278 | SKMap_OptionsFrame_Load(); |
||
4279 | end |
||
4280 | |||
4281 | |||
4282 | function SKMap_GetOptionLine(elemID) |
||
4283 | local lineID = elemID; |
||
4284 | if (not SKM_List_Options) then |
||
4285 | return nil; |
||
4286 | end |
||
4287 | |||
4288 | if (lineID > 100) then |
||
4289 | lineID = lineID - 100; |
||
4290 | |||
4291 | if (SKM_List_Options[lineID]) and (SKM_List_Options[lineID].Right) then |
||
4292 | |||
4293 | return SKM_List_Options[lineID].Right; |
||
4294 | |||
4295 | end |
||
4296 | else |
||
4297 | if (SKM_List_Options[lineID]) and (SKM_List_Options[lineID].Left) then |
||
4298 | return SKM_List_Options[lineID].Left; |
||
4299 | end |
||
4300 | end |
||
4301 | return nil; |
||
4302 | end |
||
4303 | |||
4304 | function SKMap_OptionChecked() |
||
4305 | local FName = "SKMap_OptionChecked"; |
||
4306 | --local id = this:GetID(); |
||
4307 | local id = this:GetParent():GetID(); |
||
4308 | SkM_Trace(FName, 3, "id = "..snil(id)); |
||
4309 | |||
4310 | local sOption = SKMap_GetOptionLine(id); |
||
4311 | SkM_Trace(FName, 2, "Option = "..snil(sOption)); |
||
4312 | |||
4313 | local OptionName = this:GetName(); |
||
4314 | local MyButton = getglobal(OptionName); |
||
4315 | |||
4316 | if (not MyButton:GetChecked()) then |
||
4317 | SkM_SetOption(sOption, false); |
||
4318 | else |
||
4319 | SkM_SetOption(sOption, true); |
||
4320 | end |
||
4321 | |||
4322 | if (sOption == "ShowMinimapButton") then |
||
4323 | SKMap_SetMiniMapIcon(); |
||
4324 | end |
||
4325 | end |
||
4326 | |||
4327 | function SKMap_OptionSliderChange() |
||
4328 | local FName = "SKMap_OptionSliderChange"; |
||
4329 | --local id = this:GetID(); |
||
4330 | local id = this:GetParent():GetID(); |
||
4331 | local sOption = SKMap_GetOptionLine(id); |
||
4332 | |||
4333 | local SliderName = this:GetName(); |
||
4334 | SkM_Trace(FName, 4, "Slider name = "..SliderName); |
||
4335 | |||
4336 | local MySlider = getglobal(SliderName); |
||
4337 | local SliderText = getglobal(SliderName.."Text"); |
||
4338 | |||
4339 | iValue = MySlider:GetValue(); |
||
4340 | SliderText:SetText(iValue); |
||
4341 | |||
4342 | SkM_SetOption(sOption, iValue); |
||
4343 | |||
4344 | if (sOption == "MinimapButtonPosition") or (sOption == "MinimapButtonOffset") then |
||
4345 | SKMap_SetMiniMapIcon(); |
||
4346 | end |
||
4347 | |||
4348 | end |
||
4349 | |||
4350 | |||
4351 | function SKMap_IconButtonClicked() |
||
4352 | --local id = this:GetID(); |
||
4353 | local id = this:GetParent():GetID(); |
||
4354 | local iCateg = SKM_List_Options[id].Category; |
||
4355 | if (iCateg) then |
||
4356 | if (SKM_OptionsList[iCateg].Expanded == true) then |
||
4357 | SKM_OptionsList[iCateg].Expanded = false |
||
4358 | else |
||
4359 | SKM_OptionsList[iCateg].Expanded = true; |
||
4360 | end |
||
4361 | SKMap_OptionsFrame_Load(); |
||
4362 | end |
||
4363 | end |
||
4364 | |||
4365 | |||
4366 | function SKMap_OptionExpandAll() |
||
4367 | local i; |
||
4368 | for i=1,table.getn(SKM_OptionsList),1 do |
||
4369 | SKM_OptionsList[i].Expanded = true; |
||
4370 | end |
||
4371 | SKMap_OptionsFrame_Load(); |
||
4372 | end |
||
4373 | |||
4374 | function SKMap_OptionCollapseAll() |
||
4375 | local i; |
||
4376 | for i=1,table.getn(SKM_OptionsList),1 do |
||
4377 | SKM_OptionsList[i].Expanded = false; |
||
4378 | end |
||
4379 | SKMap_OptionsFrame_Load(); |
||
4380 | end |
||
4381 | |||
4382 | |||
4383 | |||
4384 | function SKMap_EnemyList_ResetSort() |
||
4385 | |||
4386 | if (SKM_List_ActiveList == _SKM._players) then |
||
4387 | SKM_Settings.EnemyList_SortType = SKM_Config.EnemyList_SortType; |
||
4388 | SKM_Settings.EnemyList_SortTypes = SKM_Config.EnemyList_SortTypes; |
||
4389 | SKM_Settings.EnemyList_ReverseSort = SKM_Config.EnemyList_ReverseSort; |
||
4390 | |||
4391 | SKMap_ListFrame_SortList(); |
||
4392 | elseif (SKM_List_ActiveList == _SKM._guilds) then |
||
4393 | SKM_Settings.GuildList_SortType = SKM_Config.GuildList_SortType; |
||
4394 | SKM_Settings.GuildList_SortTypes = SKM_Config.GuildList_SortTypes; |
||
4395 | SKM_Settings.GuildList_ReverseSort = SKM_Config.GuildList_ReverseSort; |
||
4396 | |||
4397 | SKMap_ListFrame_SortGuildList(); |
||
4398 | end |
||
4399 | end |
||
4400 | |||
4401 | function SKMap_DuelList_ResetSort() |
||
4402 | SKM_Settings.DuelList_SortType = SKM_Config.DuelList_SortType; |
||
4403 | SKM_Settings.DuelList_SortTypes = SKM_Config.DuelList_SortTypes; |
||
4404 | SKM_Settings.DuelList_ReverseSort = SKM_Config.DuelList_ReverseSort; |
||
4405 | |||
4406 | SKMap_DuelFrame_SortList(); |
||
4407 | end |
||
4408 | |||
4409 | |||
4410 | |||
4411 | |||
4412 | -- check if the enemy players list displayed in the GUI has to be generated |
||
4413 | -- or if it is not required. |
||
4414 | function SKMap_PlayerListUpdateNeeded() |
||
4415 | local bUpdate = false; |
||
4416 | local curTime = GetTime(); |
||
4417 | |||
4418 | if (SKM_Context.LastPlayerListUpdate == nil) then |
||
4419 | bUpdate = true; |
||
4420 | else |
||
4421 | if (SKM_Context.PlayerDataChanged) then |
||
4422 | if (SkM_GetOption("EnemyListAutoUpdate")) |
||
4423 | and ((curTime - SKM_Context.LastPlayerListUpdate) > SkM_GetOption("EnemyListAutoUpdateDelay")) then |
||
4424 | bUpdate = true; |
||
4425 | end |
||
4426 | end |
||
4427 | end |
||
4428 | |||
4429 | if (bUpdate) then |
||
4430 | SKM_Context.LastPlayerListUpdate = curTime; |
||
4431 | SKM_Context.PlayerDataChanged = false; |
||
4432 | end |
||
4433 | return bUpdate; |
||
4434 | end |
||
4435 | |||
4436 | |||
4437 | function SKMap_ListFrame_UpdateListButtonClick() |
||
4438 | local curTime = GetTime(); |
||
4439 | |||
4440 | if (SKM_List_ActiveList == _SKM._players) then |
||
4441 | |||
4442 | SKM_Context.LastPlayerListUpdate = curTime; |
||
4443 | SKM_Context.PlayerDataChanged = false; |
||
4444 | |||
4445 | SKMap_SetListContent(); |
||
4446 | SKMap_ListFrame_UpdateList(); |
||
4447 | SKMap_ListFrame_SortList(); |
||
4448 | end |
||
4449 | end |
||
4450 |