comparison core.lua @ 138:8345df517488 2.20.2

- Redo instance tagging for new GetInstanceInfo return values. Normal raids should no longer "randomly" detect as heroic mode. - If loaded during combat, do not prescan history. - Fix nil error caused by reassigning loot inside an instance after having been loaded during combat. - "Peppers!" sound test.
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Fri, 19 Oct 2012 14:34:34 -0400
parents feca7e0e1f89
children c176359e7265
comparison
equal deleted inserted replaced
137:aec6325c80b5 138:8345df517488
511 return text, M, D, Y 511 return text, M, D, Y
512 end 512 end
513 end 513 end
514 514
515 -- Returns an instance name or abbreviation, followed by the raid size 515 -- Returns an instance name or abbreviation, followed by the raid size
516 local function instance_tag() 516 local instance_tag
517 -- possibly redo this with the new GetRaidDifficulty function 517 do
518 local name, typeof, diffcode, diffstr, _, perbossheroic, isdynamic = GetInstanceInfo() 518 local codemap = {
519 local t, r 519 --[0] = "?", -- should already be caught, avoid needless hash part
520 name = addon.instance_abbrev[name] or name 520 [1] = "5", -- normal or scenario
521 if typeof == "none" then return name, MAX_RAID_MEMBERS end 521 [2] = "5h",
522 -- diffstr is "5 Player", "10 Player (Heroic)", etc. ugh. 522 [3] = "10",
523 if GetLFGMode(LE_LFG_CATEGORY_RF) then 523 [4] = "25",
524 t,r = 'LFR', 25 524 [5] = "10h",
525 elseif diffcode == 1 then 525 [6] = "25h",
526 if IsInRaid() then 526 [7] = "LFR",
527 t,r = "10",10 527 [8] = "C", -- challenge mode
528 else 528 [9] = "40",
529 t,r = "5",5 529 }
530 end 530 function instance_tag()
531 elseif diffcode == 2 then 531 -- Return values of GetInstanceInfo changed considerably, now much
532 if IsInRaid() then 532 -- more useful and consistent.
533 t,r = "25",25 533 local name, typeof, diffcode, _, raidsize = GetInstanceInfo()
534 else 534 local t
535 t,r = "5h",5 535 name = addon.instance_abbrev[name] or name
536 end 536 if typeof == nil or typeof == "none" or diffcode == 0 or diffcode == nil then
537 elseif diffcode == 3 then 537 -- either outdoors or in a scenario (revisit those maybe)
538 t,r = "10h", 10 538 return name, MAX_RAID_MEMBERS
539 elseif diffcode == 4 then 539 end
540 t,r = "25h", 25 540 t = codemap[diffcode] or ("?"..diffcode.."?")
541 end 541 return name .. "(" .. t .. ")", raidsize
542 -- dynamic difficulties always return normal "codes" 542 end
543 if isdynamic and perbossheroic == 1 then
544 t = t .. "h"
545 end
546 return name .. "(" .. t .. ")", r
547 end 543 end
548 addon.instance_tag = instance_tag -- grumble 544 addon.instance_tag = instance_tag -- grumble
549 addon.latest_instance = nil -- spelling reminder, assigned elsewhere 545 addon.latest_instance = nil -- spelling reminder, assigned elsewhere
550 546
551 -- Whether we're recording anything at all in the loot histories 547 -- Whether we're recording anything at all in the loot histories
1039 _b:SetScript("OnShow",nil) 1035 _b:SetScript("OnShow",nil)
1040 end) 1036 end)
1041 InterfaceOptions_AddCategory(bliz) 1037 InterfaceOptions_AddCategory(bliz)
1042 1038
1043 -- Maybe load up g_uniques now? 1039 -- Maybe load up g_uniques now?
1044 if opts.precache_history_uniques then 1040 if opts.precache_history_uniques and not InCombatLockdown() then
1041 -- Calling the memory-querying APIs while in combat instantly
1042 -- triggers the "script ran too long" error, see
1043 -- http://www.wowinterface.com/forums/showthread.php?t=44812
1045 self:_cache_history_uniques() 1044 self:_cache_history_uniques()
1046 end 1045 end
1046 self._cache_history_uniques = nil
1047 1047
1048 self:_scan_LOD_modules() 1048 self:_scan_LOD_modules()
1049 1049
1050 self:_set_chatty_change_chatframe (opts.chatty_on_changes_frame, --[[silent_p=]]true) 1050 self:_set_chatty_change_chatframe (opts.chatty_on_changes_frame, --[[silent_p=]]true)
1051 1051
3276 "SavedVariables file), and regenerating or preening this", 3276 "SavedVariables file), and regenerating or preening this",
3277 "realm's loot history. If you keep seeing this message, type", 3277 "realm's loot history. If you keep seeing this message, type",
3278 "'/ouroloot fix ?' and try some of those actions.") 3278 "'/ouroloot fix ?' and try some of those actions.")
3279 end 3279 end
3280 g_uniques:SETMODE('probe') 3280 g_uniques:SETMODE('probe')
3281 self._cache_history_uniques = nil
3282 end 3281 end
3283 3282
3284 -- Builds the map of names to array indices, using passed table or 3283 -- Builds the map of names to array indices, using passed table or
3285 -- self.history, and stores the result into its 'byname' field. Also 3284 -- self.history, and stores the result into its 'byname' field. Also
3286 -- called from the GUI code at least once. 3285 -- called from the GUI code at least once.
3556 from_h.when[U] = nil 3555 from_h.when[U] = nil
3557 from_h.id[U] = nil 3556 from_h.id[U] = nil
3558 from_h.count[U] = nil 3557 from_h.count[U] = nil
3559 end 3558 end
3560 -- "Blessed be the lookup cache of the loot master." 3559 -- "Blessed be the lookup cache of the loot master."
3561 g_uniques[U] = { loot = index, history = to_name } 3560 g_uniques[unique] = { loot = index, history = to_name }
3562 end 3561 end
3563 local from_person_class = e.person_class or from_h.person_class 3562 local from_person_class = e.person_class or from_h.person_class
3564 or (g_loot.raiders[from_name] and g_loot.raiders[from_name].class) 3563 or (g_loot.raiders[from_name] and g_loot.raiders[from_name].class)
3565 or select(2,UnitClass(from_name)) 3564 or select(2,UnitClass(from_name))
3566 e.person = to_name 3565 e.person = to_name