From 3e10e834b3e76491b4ea6c5f10df593aa3e6b301 Mon Sep 17 00:00:00 2001 From: zorba Date: Wed, 5 May 2010 11:58:21 -0700 Subject: [PATCH] clean up some old dead code --- tracker.lua | 333 ------------------------------------------------------------ 1 file changed, 333 deletions(-) diff --git a/tracker.lua b/tracker.lua index c1c5651..c9b2d27 100644 --- a/tracker.lua +++ b/tracker.lua @@ -416,64 +416,6 @@ local function addMetaObjective(metaobj, items, y, depth) return math.max(y, spacer), depth + #items + 1 end ---[[ -- these will be plugged in later one way or another -local function ccode(r1, g1, b1, r2, g2, b2, p) - local ip - p, ip = p*255, 255-p*255 - return string.format("|cff%02x%02x%02x", r1*ip+r2*p, g1*ip+g2*p, b1*ip+b2*p) -end - -local function qname(title, level) - if QuestHelper_Pref.track_level and level ~= 7777 and level ~= 7778 then - title = string.format("[%d] %s", level, title) - end - - if level == 7778 then - level = -7778 - end - - if QuestHelper_Pref.track_qcolour then - local player_level = QuestHelper.player_level - local delta = level - player_level - - local colour - - if delta >= 5 then - colour = "|cffff0000" - elseif delta >= 0 then - colour = ccode(1, 1, 0, 1, 0, 0, delta/5) - else - local grey - - if player_level >= 60 then grey = player_level - 9 - elseif player_level >= 40 then grey = player_level - math.floor(player_level/5) - 1 - elseif player_level >= 6 then grey = player_level - math.floor(player_level/10) - 5 - else grey = 0 end - - if level == -7778 then - colour = "|cff808080" - elseif level > grey then - colour = ccode(0, 1, 0, 1, 1, 0, (grey-level)/(grey-player_level)) - else - colour = ccode(.4, .4, .4, .2, .8, .2, (1-level)/(1-grey)) - end - end - - title = string.format("%s%s", colour, title) - end - - return title -end - -local function oname(text, pct) - if QuestHelper_Pref.track_ocolour then - text = string.format("%s%s", pct < 0.5 and ccode(1, 0, 0, 1, 1, 0, pct*2) or ccode(1, 1, 0, 0, 1, 0, pct*2-1), text) - end - - return text -end -]] - local function removeUnusedItem(item) item.t = 0 item.sx, item.sy, item.dx, item.dy = item.x, item.y, item.x+30, item.y @@ -488,116 +430,7 @@ local function removeUnusedItem(item) end end ---[=[ -local was_inside = false - --- :ughh: -local function addobj(objective, seen, obj_index_lookup, filter, x, y, gap) - local count = 0 - local quest - - if objective.cat == "quest" then - quest = objective - else - quest = objective.quest - end - - if quest and quest.watched and not seen[quest] and (not filter or filter(quest)) then - seen[quest] = true - - local level, name = string.match(quest.obj, "^(%d+)/%d*/(.*)$") - - if not level then - level, name = string.match(quest.obj, "^(%d+)/(.*)$") - if not level then - level, name = 1, quest.obj - end - end - - level = tonumber(level) or 1 - - count = count + 1 - local w, h = addItem(qname(name, level), true, quest, -(y+gap), name, quest.index) - x = math.max(x, w) - y = y + h + gap - gap = 2 - - for obj in pairs(quest.swap_after or quest.after) do - if obj.progress then - table.insert(obj_list, obj) - end - end - - table.sort(obj_list, objlist_sort) - - for i, obj in ipairs(obj_list) do - local pct, text = 0, obj.obj - local seen_sum, seen_max = 0, 0 - - if obj.progress then - local seen_have, seen_need = QuestHelper:CreateTable(), QuestHelper:CreateTable() - - for user, progress in pairs(obj.progress) do - seen_sum = seen_sum + progress[3] - seen_max = seen_max + 1 - seen_have[progress[1]] = true - seen_need[progress[2]] = true - end - - if seen_max > 0 then - pct = seen_sum / seen_max - local list = QuestHelper:CreateTable() - - for val in pairs(seen_have) do - table.insert(list, val) - end - - table.sort(list) - - local have = table.concat(list, ", ") - - for i = #list,1,-1 do - list[i] = nil - end - - for val in pairs(seen_need) do - table.insert(list, val) - end - - if #list ~= 1 or list[1] ~= 1 then - -- If there is only one thing needed, ignore the progress, it's redundant. - -- It's either shown or it isn't. - - table.sort(list) - - local need = table.concat(list, ", ") - - text = string.format((tonumber(have) and tonumber(need) and QUEST_ITEMS_NEEDED) or QUEST_FACTION_NEEDED, - text, have, need) - end - - QuestHelper:ReleaseTable(list) - end - - QuestHelper:ReleaseTable(seen_have) - QuestHelper:ReleaseTable(seen_need) - end - - if seen_sum ~= seen_max then - count = count + 1 - w, h = addItem(oname(text, pct), quest, obj, -y) - x = math.max(x, w) - y = y + h - end - end - - for i = #obj_list, 1, -1 do obj_list[i] = nil end - end - - return x, y, gap, count -end -]=] local loading_vquest = {tracker_desc = QHFormat("QH_LOADING", "0")} local flightpath_vquest = {tracker_desc = QHFormat("QH_FLIGHTPATH", "0")} @@ -789,172 +622,6 @@ function QH_Tracker_Rescan() tracker.sw = tracker.dw resizing = true end - - - - - - - --[[ - if x ~= tracker.dw or y ~= tracker.dy then - tracker.t = 0 - tracker.sw, tracker.sh = tracker:GetWidth(), tracker:GetHeight() - tracker.dw, tracker.dh = x, y - resizing = true - end]] - - --[[ - - local quests = QuestHelper.quest_log - local added = 0 - local x, y = 4, 4 - local gap = 0 - local track_size = QuestHelper_Pref.track_size - local quests_added = {} - - for quest, objs in pairs(used_items) do - for obj, item in pairs(objs) do - item.used = false - end - end - - for i, objective in pairs(QuestHelper.route) do - if objective.watched then - obj_index_lookup[objective] = i - end - end - - for q, data in pairs(QuestHelper.quest_log) do - quest_lookup[data.index] = q - end - - -- Add our little "not yet loaded" notification - local loadedshow = false - if not QuestHelper.Routing.map_walker then - local count - x, y, gap, count = addobj(loading_vquest, seen, nil, nil, x, y, gap) - added = added + count - loadedshow = true - - if QuestHelper_Flight_Updates and QuestHelper_Flight_Updates_Current and QuestHelper_Flight_Updates > 0 and QuestHelper_Flight_Updates_Current < QuestHelper_Flight_Updates then - loading_vquest.obj = string.format("7777/" .. QHFormat("QH_LOADING", string.format("%d", QuestHelper_Flight_Updates_Current * 100 / QuestHelper_Flight_Updates))) - end - end - - -- Add an extra large gap to seperate the notification from everything else - gap = gap * 5 - - -- Add Quests that are watched but not in the route. - if UberQuest then - local uq_settings = UberQuest_Config[UnitName("player")] - if uq_settings then - local list = uq_settings.selected - if list then - local i = 1 - while true do - local name = GetQuestLogTitle(i) - if not name then break end - quest_lookup[name] = quest_lookup[i] - i = i + 1 - end - for name in pairs(list) do - local q = quest_lookup[name] - if q and not obj_index_lookup[q] then - local count - x, y, gap, count = addobj(q, seen, obj_index_lookup, nil, x, y, gap) - added = added + count - quests_added[q] = true - end - end - end - end - else - for i = 1,GetNumQuestWatches() do - local q = quest_lookup[GetQuestIndexForWatch(i)] - if q and not obj_index_lookup[q] then - local count - x, y, gap, count = addobj(q, seen, obj_index_lookup, nil, x, y, gap) - added = added + count - end - end - end - - -- Add Quests that are watched and are in the route. - for i, objective in ipairs(QuestHelper.route) do - local count - x, y, gap, count = addobj(objective, seen, obj_index_lookup, watched_filter, x, y, gap) - added = added + count - quests_added[objective] = true - end - - -- Add an extra large gap to seperate the watched objectives from the automatic objectives. - gap = gap * 5 - - -- Add Quests that aren't watched and are in the route. - if added <= track_size then - for i, objective in ipairs(QuestHelper.route) do - local count - x, y, gap, count = addobj(objective, seen, obj_index_lookup, nil, x, y, gap) - added = added + count - quests_added[objective] = true - - if added > track_size then - break - end - end - end - - if not loadedshow and added < track_size and not QuestHelper_Pref.filter_done and not QuestHelper_Pref.filter_zone and not QuestHelper_Pref.filter_watched then - local added = 0 - local notadded = 0 - for k, v in pairs(quest_lookup) do - if not quests_added[v] then - notadded = notadded + 1 - else - added = added + 1 - end - end - - if notadded > 0 then - gap = gap * 10 - x, y, gap, count = addobj(hidden_vquest1, seen, nil, nil, x, y, gap) - added = added + count - x, y, gap, count = addobj(hidden_vquest2, seen, nil, nil, x, y, gap) - added = added + count - end - end - - for obj in pairs(obj_index_lookup) do - obj_index_lookup[obj] = nil - end - - for key in pairs(quest_lookup) do - quest_lookup[key] = nil - end - - for quest, objs in pairs(used_items) do - for obj, item in pairs(objs) do - if not item.used then - removeUnusedItem(quest, obj, item) - end - end - end - - for key in pairs(seen) do - seen[key] = nil - end - - y = y+4 - - if x ~= tracker.dw or y ~= tracker.dy then - tracker.t = 0 - tracker.sw, tracker.sh = tracker:GetWidth(), tracker:GetHeight() - tracker.dw, tracker.dh = x, y - resizing = true - end - - added = 0 - ]] end function QH_Tracker_UpdateRoute(new_route) -- 2.11.4.GIT