Mercurial > wow > ouroloot
comparison core.lua @ 66:43913e02a1ef
Detect LFR loot as best we can, and bundle it into the same warning given for heroic loot formatted by name only. Less tedious method of bumping data revisions.
| author | Farmbuyer of US-Kilrogg <farmbuyer@gmail.com> |
|---|---|
| date | Fri, 27 Apr 2012 10:11:56 +0000 |
| parents | 69fd720f853e |
| children | c01875b275ca |
comparison
equal
deleted
inserted
replaced
| 65:69fd720f853e | 66:43913e02a1ef |
|---|---|
| 54 - disposition offspec/gvault/shard; missing otherwise; can be set from | 54 - disposition offspec/gvault/shard; missing otherwise; can be set from |
| 55 the extratext field | 55 the extratext field |
| 56 - count e.g., "x3"; missing otherwise; can be set/removed from | 56 - count e.g., "x3"; missing otherwise; can be set/removed from |
| 57 extratext; triggers only for a stack of items, not "the boss | 57 extratext; triggers only for a stack of items, not "the boss |
| 58 dropped double axes today" | 58 dropped double axes today" |
| 59 - is_heroic true if item is heroic; missing otherwise | 59 - variant 1 = heroic item, 2 = LFR item; missing otherwise |
| 60 - cache_miss if GetItemInfo failed; SHOULD be missing (changes other fields) | 60 - cache_miss if GetItemInfo failed; SHOULD be missing (changes other fields) |
| 61 - bcast_from player's name if received rebroadcast from that player; | 61 - bcast_from player's name if received rebroadcast from that player; |
| 62 missing otherwise; can be deleted as a result of in-game | 62 missing otherwise; can be deleted as a result of in-game |
| 63 fiddling of loot data | 63 fiddling of loot data |
| 64 - extratext text in Note column, including disposition and rebroadcasting | 64 - extratext text in Note column, including disposition and rebroadcasting |
| 105 OuroLootSV_log = {} | 105 OuroLootSV_log = {} |
| 106 | 106 |
| 107 | 107 |
| 108 ------ Constants | 108 ------ Constants |
| 109 local option_defaults = { | 109 local option_defaults = { |
| 110 ['datarev'] = 17, -- cheating, this isn't actually an option | 110 ['datarev'] = 18, -- cheating, this isn't actually an option |
| 111 ['popup_on_join'] = true, | 111 ['popup_on_join'] = true, |
| 112 ['register_slashloot'] = true, | 112 ['register_slashloot'] = true, |
| 113 ['scroll_to_bottom'] = true, | 113 ['scroll_to_bottom'] = true, |
| 114 ['chatty_on_kill'] = false, | 114 ['chatty_on_kill'] = false, |
| 115 ['no_tracking_wipes'] = false, | 115 ['no_tracking_wipes'] = false, |
| 468 end,10,self) | 468 end,10,self) |
| 469 else | 469 else |
| 470 virgin = nil | 470 virgin = nil |
| 471 end | 471 end |
| 472 opts = OuroLootSV_opts | 472 opts = OuroLootSV_opts |
| 473 local stored_datarev = opts.datarev | 473 local stored_datarev = opts.datarev or 14 |
| 474 for opt,default in pairs(option_defaults) do | 474 for opt,default in pairs(option_defaults) do |
| 475 if opts[opt] == nil then | 475 if opts[opt] == nil then |
| 476 opts[opt] = default | 476 opts[opt] = default |
| 477 end | 477 end |
| 478 end | 478 end |
| 540 --OuroLootSV_hist = nil | 540 --OuroLootSV_hist = nil |
| 541 | 541 |
| 542 -- Handle changes to the stored data format in stages from oldest to newest. | 542 -- Handle changes to the stored data format in stages from oldest to newest. |
| 543 if OuroLootSV then | 543 if OuroLootSV then |
| 544 local dirty = false | 544 local dirty = false |
| 545 if stored_datarev == nil then | 545 local bumpers = {} |
| 546 self:Print("Transitioning saved data format to 15..."); dirty = true | 546 bumpers[14] = function() |
| 547 for i,e in ipairs(OuroLootSV) do | 547 for i,e in ipairs(OuroLootSV) do |
| 548 if e.bosskill then | 548 if e.bosskill then |
| 549 e.bossname, e.bosskill = e.bosskill, nil | 549 e.bossname, e.bosskill = e.bosskill, nil |
| 550 end | 550 end |
| 551 end | 551 end |
| 552 stored_datarev = 15 | 552 end |
| 553 end | 553 |
| 554 if stored_datarev == 15 then | 554 bumpers[15] = function() |
| 555 self:Print("Transitioning saved data format to 16..."); dirty = true | |
| 556 for i,e in ipairs(OuroLootSV) do | 555 for i,e in ipairs(OuroLootSV) do |
| 557 if e.kind == 'boss' then | 556 if e.kind == 'boss' then |
| 558 e.maxsize, e.raiderlist, e.raidersnap = 0, nil, {} | 557 e.maxsize, e.raiderlist, e.raidersnap = 0, nil, {} |
| 559 end | 558 end |
| 560 end | 559 end |
| 561 OuroLootSV.raiders = OuroLootSV.raiders or {} | 560 OuroLootSV.raiders = OuroLootSV.raiders or {} |
| 562 for name,r in pairs(OuroLootSV.raiders) do | 561 for name,r in pairs(OuroLootSV.raiders) do |
| 563 r.subgroup = 0 | 562 r.subgroup = 0 |
| 564 end | 563 end |
| 565 stored_datarev = 16 | 564 end |
| 566 end | 565 |
| 567 if stored_datarev == 16 then | 566 bumpers[16] = function() |
| 568 self:Print("Transitioning saved data format to 17..."); dirty = true | |
| 569 for i,e in ipairs(OuroLootSV) do | 567 for i,e in ipairs(OuroLootSV) do |
| 570 if e.kind == 'boss' then -- brown paper bag bugs | 568 if e.kind == 'boss' then -- brown paper bag bugs |
| 571 e.raidersnap = e.raidersnap or {} | 569 e.raidersnap = e.raidersnap or {} |
| 572 e.maxsize = e.maxsize or 0 | 570 e.maxsize = e.maxsize or 0 |
| 573 end | 571 end |
| 574 end | 572 end |
| 575 stored_datarev = 17 | 573 end |
| 574 | |
| 575 bumpers[17] = function() | |
| 576 for i,e in ipairs(OuroLootSV) do | |
| 577 if e.kind == 'loot' and e.is_heroic then | |
| 578 e.variant, e.is_heroic = 1, nil | |
| 579 -- Could try detecting any previous LFR loot here, but... gah | |
| 580 end | |
| 581 end | |
| 582 end | |
| 583 | |
| 584 --[===[ | |
| 585 local real = bumpers | |
| 586 bumpers = newproxy(true) | |
| 587 local mt = getmetatable(bumpers) | |
| 588 mt.__index = real | |
| 589 mt.__gc = function() print"whadda ya know, garbage collection works" end ]===] | |
| 590 | |
| 591 while stored_datarev < opts.datarev do | |
| 592 self:Printf("Transitioning saved data format to %d...", stored_datarev+1) | |
| 593 dirty = true | |
| 594 bumpers[stored_datarev]() | |
| 595 stored_datarev = stored_datarev + 1 | |
| 576 end | 596 end |
| 577 if dirty then self:Print("Saved data has been massaged into shape.") end | 597 if dirty then self:Print("Saved data has been massaged into shape.") end |
| 578 assert(stored_datarev==opts.datarev) | |
| 579 end | 598 end |
| 580 | 599 |
| 581 _init(self) | 600 _init(self) |
| 582 self.dprint('flow', "version strings:", revision_large, self.status_text) | 601 self.dprint('flow', "version strings:", revision_large, self.status_text) |
| 583 self.OnInitialize = nil | 602 self.OnInitialize = nil -- free up ALL the things! |
| 584 end | 603 end |
| 585 | 604 |
| 586 function addon:OnEnable() | 605 function addon:OnEnable() |
| 587 self:RegisterEvent("PLAYER_LOGOUT") | 606 self:RegisterEvent("PLAYER_LOGOUT") |
| 588 self:RegisterEvent("RAID_ROSTER_UPDATE") | 607 self:RegisterEvent("RAID_ROSTER_UPDATE") |
| 1026 itexture = itexture, | 1045 itexture = itexture, |
| 1027 disposition = (recipient == self.sharder) and 'shard' or nil, | 1046 disposition = (recipient == self.sharder) and 'shard' or nil, |
| 1028 count = (count and count ~= "") and count or nil, | 1047 count = (count and count ~= "") and count or nil, |
| 1029 bcast_from = from, | 1048 bcast_from = from, |
| 1030 extratext = extratext, | 1049 extratext = extratext, |
| 1031 is_heroic = self:is_heroic_item(ilink), | 1050 variant = self:is_variant_item(ilink), |
| 1032 } | 1051 } |
| 1033 if local_override then | 1052 if local_override then |
| 1034 -- player is adding loot by hand, don't wait for network cache timeouts | 1053 -- player is adding loot by hand, don't wait for network cache timeouts |
| 1035 -- keep this sync'd with prefer_local_loots above | 1054 -- keep this sync'd with prefer_local_loots above |
| 1036 if i.extratext == 'shard' | 1055 if i.extratext == 'shard' |
| 1430 lefts[i] = L | 1449 lefts[i] = L |
| 1431 end | 1450 end |
| 1432 tip.lefts = lefts | 1451 tip.lefts = lefts |
| 1433 return tip | 1452 return tip |
| 1434 end | 1453 end |
| 1435 function addon:is_heroic_item(item) -- returns true or *nil* | 1454 function addon:is_variant_item(item) -- returns number or *nil* |
| 1436 itt = itt or create() | 1455 itt = itt or create() |
| 1437 itt:SetOwner(UIParent,"ANCHOR_NONE") | 1456 itt:SetOwner(UIParent,"ANCHOR_NONE") |
| 1438 itt:ClearLines() | 1457 itt:ClearLines() |
| 1439 itt:SetHyperlink(item) | 1458 itt:SetHyperlink(item) |
| 1440 local t = itt.lefts[2]:GetText() | 1459 local t = itt.lefts[2]:GetText() |
| 1441 itt:Hide() | 1460 itt:Hide() |
| 1442 return (t == ITEM_HEROIC) or nil | 1461 return (t == ITEM_HEROIC and 1) |
| 1462 or (t == RAID_FINDER and 2) -- no ITEM_ for this, apparently | |
| 1463 or nil | |
| 1443 end | 1464 end |
| 1444 end | 1465 end |
| 1445 | 1466 |
| 1446 -- Called when first loading up, and then also when a 'clear' is being | 1467 -- Called when first loading up, and then also when a 'clear' is being |
| 1447 -- performed. If SV's are present then g_restore_p will be true. | 1468 -- performed. If SV's are present then g_restore_p will be true. |
