Mercurial > wow > worldplan
comparison WorldPlan.lua @ 108:b67ba1078824
- Added some WorldMapFrame alterations to make the filter bar less obtrusive
author | Nenue |
---|---|
date | Sat, 03 Jun 2017 17:20:14 -0400 |
parents | 4d1520186ea4 |
children | caa482329919 |
comparison
equal
deleted
inserted
replaced
107:b2be2de2b133 | 108:b67ba1078824 |
---|---|
34 db.ReportChunks = {} | 34 db.ReportChunks = {} |
35 db.Bounties = {} | 35 db.Bounties = {} |
36 db.BountiesByQuestID = {} | 36 db.BountiesByQuestID = {} |
37 db.BountiesByFactionID = {} | 37 db.BountiesByFactionID = {} |
38 db.IgnoreTimers = {} | 38 db.IgnoreTimers = {} |
39 db.CLTriggers = { | |
40 wq = function(arg2, extraArgs) | |
41 if arg2 and WorldPlanQuests[arg2] then | |
42 self:print('WorldPlanQuests:'..arg2..'()') | |
43 WorldPlanQuests[arg2](WorldPlanQuests) | |
44 else | |
45 self:print('WorldPlanQuests:Refresh(true)') | |
46 WorldPlanQuests:Refresh(true) | |
47 end | |
48 end, | |
49 flightmap = function(arg2, extraArgs) | |
50 if not extraArgs then | |
51 return | |
52 end | |
53 | |
54 local val1, val2, val3 = extraArgs:match("(%S+)%s*(%S*)%s*(%S*)") | |
55 if arg2 == 'scale' then | |
56 if tonumber(val1) and tonumber(val2) and tonumber(val3) then | |
57 db.Config.FlightMapScalingLimits = {tonumber(val1), tonumber(val2), tonumber(val3)} | |
58 self:print('FlightMapFrame scaling limits updated:', unpack(db.Config.FlightMapScalingLimits)) | |
59 else | |
60 self:print('FlightMapFrame scaling limits:', unpack(db.Config.FlightMapScalingLimits)) | |
61 end | |
62 elseif arg2 == 'alpha' then | |
63 | |
64 if tonumber(val1) and tonumber(val2) and tonumber(val3) then | |
65 db.Config.FlightMapAlphaLimits = {tonumber(val1), tonumber(val2), tonumber(val3)} | |
66 self:print('FlightMapFrame alpha limits updated:', unpack(db.Config.FlightMapAlphaLimits)) | |
67 else | |
68 self:print('FlightMapFrame alpha limits:', unpack(db.Config.FlightMapAlphaLimits)) | |
69 end | |
70 end | |
71 | |
72 end, | |
73 filter = function(arg2) | |
74 if arg2 and WorldPlanSummary[arg2] then | |
75 self:print('WorldPlanSummary:'..arg2..'()') | |
76 WorldPlanSummary[arg2](WorldPlanSummary) | |
77 else | |
78 self:print('WorldPlanSummary:Refresh(true)') | |
79 WorldPlanSummary:Refresh(true) | |
80 end | |
81 end, | |
82 log = function() | |
83 if WorldPlanDebug:IsShown() then | |
84 WorldPlanDebug:SetShown(false) | |
85 else | |
86 WorldPlanDebug:SetShown(true) | |
87 end | |
88 | |
89 end, | |
90 debug = function() | |
91 | |
92 if WorldPlanData then | |
93 WorldPlanData.DebugEnabled = (not WorldPlanData.DebugEnabled) | |
94 self:print(WorldPlanData.DebugEnabled and "Debugger on." or "Debugger off.") | |
95 end | |
96 end | |
97 } | |
98 | |
39 | 99 |
40 -- default color templates | 100 -- default color templates |
41 db.DefaultType = { | 101 db.DefaultType = { |
42 a = 1, | 102 a = 1, |
43 r = 1, g = 1, b = 1, | 103 r = 1, g = 1, b = 1, |
188 info.func = DropDown_OnClick | 248 info.func = DropDown_OnClick |
189 UIDropDownMenu_AddButton(info) | 249 UIDropDownMenu_AddButton(info) |
190 --]] | 250 --]] |
191 end | 251 end |
192 | 252 |
253 local function Handler_UpdateFader(self, sinceLast, isActive) | |
254 | |
255 if isActive then | |
256 self.toAlpha = 1 | |
257 self.Backdrop:Show() | |
258 else | |
259 self.toAlpha = self.fadeOpacity | |
260 self.Backdrop:Hide() | |
261 end | |
262 local cAlpha = self:GetAlpha() | |
263 if cAlpha ~= self.toAlpha then | |
264 if cAlpha > self.toAlpha then | |
265 cAlpha = cAlpha - sinceLast*4 | |
266 if cAlpha <= self.toAlpha then | |
267 cAlpha = self.toAlpha | |
268 end | |
269 else | |
270 cAlpha = cAlpha + sinceLast*4 | |
271 if cAlpha >= self.toAlpha then | |
272 cAlpha = self.toAlpha | |
273 end | |
274 end | |
275 end | |
276 self:SetAlpha(cAlpha) | |
277 end | |
193 | 278 |
194 function db.print(...) | 279 function db.print(...) |
195 for i = 1, select('#', ...) do | 280 for i = 1, select('#', ...) do |
196 tinsert(db.ReportChunks, tostring(select(i, ...))) | 281 tinsert(db.ReportChunks, tostring(select(i, ...))) |
197 end | 282 end |
239 else self:ScrollDown() end | 324 else self:ScrollDown() end |
240 end | 325 end |
241 end | 326 end |
242 } | 327 } |
243 | 328 |
329 | |
244 function WorldPlanCore:OnConfigUpdate() | 330 function WorldPlanCore:OnConfigUpdate() |
245 for _, module in ipairs(db.OrderedModules) do | 331 for _, module in ipairs(db.OrderedModules) do |
246 if module.OnConfigUpdate then | 332 if module.OnConfigUpdate then |
247 module:OnConfigUpdate() | 333 module:OnConfigUpdate() |
248 end | 334 end |
262 tinsert(db.OrderedModules, frame) | 348 tinsert(db.OrderedModules, frame) |
263 | 349 |
264 if frame.defaults then | 350 if frame.defaults then |
265 db.DefaultConfig[frame:GetName()] = frame.defaults | 351 db.DefaultConfig[frame:GetName()] = frame.defaults |
266 end | 352 end |
267 | 353 frame.UpdateAlpha = Handler_UpdateFader |
268 frame.owningFrame = self | 354 frame.owningFrame = self |
269 else | 355 else |
270 | 356 |
271 print('|cFFFF4400'..self:GetName()..':AddHandler()', frame:GetName()) | 357 print('|cFFFF4400'..self:GetName()..':AddHandler()', frame:GetName()) |
272 end | 358 end |
509 SLASH_WORLDPLAN1 = "/worldplan" | 595 SLASH_WORLDPLAN1 = "/worldplan" |
510 SLASH_WORLDPLAN2 = "/wp" | 596 SLASH_WORLDPLAN2 = "/wp" |
511 | 597 |
512 | 598 |
513 | 599 |
600 | |
514 SlashCmdList.WORLDPLAN = function(args) | 601 SlashCmdList.WORLDPLAN = function(args) |
515 local arg1, arg2, extraArgs = args:match("(%S+)%s*(%S*)%s*(.*)") | 602 local arg1, arg2, extraArgs = args:match("(%S+)%s*(%S*)%s*(.*)") |
516 | 603 |
517 if arg1 == 'wq' then | 604 if db.CLTriggers[arg1] then |
518 if arg2 and WorldPlanQuests[arg2] then | 605 db.CLTriggers[arg1](arg2, extraArgs) |
519 self:print('WorldPlanQuests:'..arg2..'()') | |
520 WorldPlanQuests[arg2](WorldPlanQuests) | |
521 elseif arg2 == 'flightscale' and extraArgs then | |
522 local val1, val2, val3 = extraArgs:match("(%S+)%s*(%S*)%s*(%S*)") | |
523 if tonumber(val1) and tonumber(val2) and tonumber(val3) then | |
524 db.Config.FlightMapScalingLimits = {tonumber(val1), tonumber(val2), tonumber(val3)} | |
525 self:print('FlightMapFrame scaling limits updated:', unpack(db.Config.FlightMapScalingLimits)) | |
526 else | |
527 self:print('FlightMapFrame scaling limits:', unpack(db.Config.FlightMapScalingLimits)) | |
528 end | |
529 elseif arg2 == 'flightalpha' and extraArgs then | |
530 local val1, val2, val3 = extraArgs:match("(%S+)%s*(%S*)%s*(%S*)") | |
531 if tonumber(val1) and tonumber(val2) and tonumber(val3) then | |
532 db.Config.FlightMapAlphaLimits = {tonumber(val1), tonumber(val2), tonumber(val3)} | |
533 self:print('FlightMapFrame alpha limits updated:', unpack(db.Config.FlightMapAlphaLimits)) | |
534 else | |
535 self:print('FlightMapFrame alpha limits:', unpack(db.Config.FlightMapAlphaLimits)) | |
536 end | |
537 else | |
538 | |
539 self:print('WorldPlanQuests:Refresh(true)') | |
540 WorldPlanQuests:Refresh(true) | |
541 end | |
542 elseif arg1 == 'filter' then | |
543 if arg2 and WorldPlanSummary[arg2] then | |
544 self:print('WorldPlanSummary:'..arg2..'()') | |
545 WorldPlanSummary[arg2](WorldPlanSummary) | |
546 else | |
547 self:print('WorldPlanSummary:Refresh(true)') | |
548 WorldPlanSummary:Refresh(true) | |
549 end | |
550 elseif arg1 == 'log' then | |
551 if WorldPlanDebug:IsShown() then | |
552 WorldPlanDebug:SetShown(false) | |
553 else | |
554 WorldPlanDebug:SetShown(true) | |
555 end | |
556 elseif arg1 == 'debug' then | |
557 if WorldPlanData then | |
558 WorldPlanData.DebugEnabled = (not WorldPlanData.DebugEnabled) | |
559 self:print(WorldPlanData.DebugEnabled and "Debugger on." or "Debugger off.") | |
560 end | |
561 | |
562 else | 606 else |
563 self:print('Refreshing data.') | 607 self:print('Refreshing data.') |
564 self:Refresh(true) | 608 self:Refresh(true) |
565 end | 609 end |
566 | 610 |