Mercurial > wow > ouroloot
comparison core.lua @ 92:01cfbfa96dd6
Last bits of cleanup and testing.
author | Farmbuyer of US-Kilrogg <farmbuyer@gmail.com> |
---|---|
date | Tue, 17 Jul 2012 03:24:36 +0000 |
parents | 92e0db376858 |
children | ea20a28327b5 |
comparison
equal
deleted
inserted
replaced
91:2ef80188a547 | 92:01cfbfa96dd6 |
---|---|
325 -- Class color support. Do the expensive string.format calls up front, and | 325 -- Class color support. Do the expensive string.format calls up front, and |
326 -- the cheap all-string-all-at-once single-op concatenation as needed. | 326 -- the cheap all-string-all-at-once single-op concatenation as needed. |
327 do | 327 do |
328 local cc = {} | 328 local cc = {} |
329 local function extract (color_info) | 329 local function extract (color_info) |
330 local r = _G.math.floor(255*color_info.r+0.5) | 330 local hex = ("|cff%.2x%.2x%.2x"):format(255*color_info.r, |
331 local g = _G.math.floor(255*color_info.g+0.5) | 331 255*color_info.g, 255*color_info.b) |
332 local b = _G.math.floor(255*color_info.b+0.5) | 332 return { r=color_info.r, g=color_info.g, b=color_info.b, a=1, hex=hex } |
333 local hex = ("|cff%.2x%.2x%.2x"):format(r,g,b) | |
334 return { r=r, g=g, b=b, a=1, hex=hex } | |
335 end | 333 end |
336 local function fill_out_class_colors() | 334 local function fill_out_class_colors() |
337 for class,color in pairs(CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS) do | 335 for class,color in pairs(CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS) do |
338 cc[class] = extract(color) | 336 cc[class] = extract(color) |
339 end | 337 end |
1939 else | 1937 else |
1940 self.dprint('comm', "ours is older, (possibly) yammering") | 1938 self.dprint('comm', "ours is older, (possibly) yammering") |
1941 if newer_warning then | 1939 if newer_warning then |
1942 local pop = addon.format_hypertext ([[click here]], ITEM_QUALITY_UNCOMMON, | 1940 local pop = addon.format_hypertext ([[click here]], ITEM_QUALITY_UNCOMMON, |
1943 function() | 1941 function() |
1944 -- Sadly, this is not generated by the packager, so hardcode it for now. | 1942 -- Sadly, this is not generated by the packager, so hardcode it |
1945 -- The 'data' field is handled differently for onshow than for other callbacks. | 1943 -- for now. The 'data' field is handled differently for onshow |
1946 StaticPopup_Show("OUROL_URL", --[[text_arg1=]]nil, --[[text_arg2=]]nil, | 1944 -- than for other callbacks. |
1945 StaticPopup_Show("OUROL_URL", | |
1946 --[[text_arg1=]]nil, --[[text_arg2=]]nil, | |
1947 --[[data=]][[http://www.curse.com/addons/wow/ouroloot]]) | 1947 --[[data=]][[http://www.curse.com/addons/wow/ouroloot]]) |
1948 end) | 1948 end) |
1949 local ping = addon.format_hypertext ([[click here]], ITEM_QUALITY_UNCOMMON, 'DoPing') | 1949 local ping = addon.format_hypertext ([[click here]], ITEM_QUALITY_UNCOMMON, 'DoPing') |
1950 self:Print(newer_warning, tostring(pop), tostring(ping)) | 1950 self:Print(newer_warning, tostring(pop), tostring(ping)) |
1951 newer_warning = nil | 1951 newer_warning = nil |
2489 >g_loot and history already has the replacement value | 2489 >g_loot and history already has the replacement value |
2490 B: winner was generated remotely | 2490 B: winner was generated remotely |
2491 >need to scan and replace | 2491 >need to scan and replace |
2492 Detecting A is strictly an optimization. We should be able to do | 2492 Detecting A is strictly an optimization. We should be able to do |
2493 this code safely in all cases. Important to note: a local winner | 2493 this code safely in all cases. Important to note: a local winner |
2494 will always be at index 1, but a winner at index 1 does not necessarily | 2494 will always be at index 1, but a winner at index 1 does not |
2495 mean it was locally generated (e.g., if the local itemfilter drops | 2495 necessarily mean it was locally generated (e.g., if the local |
2496 it but a remote player does an improv). Just do the general case | 2496 itemfilter drops it but a remote player does an improv). Just |
2497 until/unless this becomes a problem. | 2497 do the general case until/unless this becomes a problem. |
2498 ]] | 2498 ]] |
2499 --XXX this branch still needs to be tested with live data | |
2500 local cache = g_uniques:SEARCH(exist) | 2499 local cache = g_uniques:SEARCH(exist) |
2501 local looti,hi,ui = cache.loot, cache.history, cache.history_may | 2500 local looti,hi,ui = cache.loot, cache.history, cache.history_may |
2502 | 2501 |
2503 -- Active loot | 2502 -- Active loot |
2504 if looti and g_loot[looti].unique == exist then | 2503 if looti and g_loot[looti].unique == exist then |
2654 local s = self:check_saved_table(); if not s then return end | 2653 local s = self:check_saved_table(); if not s then return end |
2655 if (not num) or (num > #s) then | 2654 if (not num) or (num > #s) then |
2656 return self:Print("Saved text number must be 1 - "..#s) | 2655 return self:Print("Saved text number must be 1 - "..#s) |
2657 end | 2656 end |
2658 local save = s[num] | 2657 local save = s[num] |
2659 self:Print("Overwriting current loot data with saved text #%d '%s'", num, save.name) | 2658 self:Print("Overwriting current loot data with saved text #%d '%s'",num,save.name) |
2660 self:Clear(--[[verbose_p=]]false) | 2659 self:Clear(--[[verbose_p=]]false) |
2661 -- Clear will already have displayed the window, and re-selected the first | 2660 -- Clear will already have displayed the window, and re-selected the first |
2662 -- tab. Set these up for when the text tabs are clicked. | 2661 -- tab. Set these up for when the text tabs are clicked. |
2663 for text in self:registered_textgen_iter() do | 2662 for text in self:registered_textgen_iter() do |
2664 g_loot[text] = save[text] | 2663 g_loot[text] = save[text] |