Mercurial > wow > ouroloot
comparison text_tabs.lua @ 97:ba5ff82dcf19
(First breaking change for MoP/3.0, incomplete transition.) Move generic user options to acedb. Remove older savedvar-upgrade code for a clean break. Add a profiles tab since it will be expected; changing profiles not yet implemented.
| author | Farmbuyer of US-Kilrogg <farmbuyer@gmail.com> |
|---|---|
| date | Fri, 27 Jul 2012 10:23:12 +0000 |
| parents | 8442272a8418 |
| children | fe04f5c4114a |
comparison
equal
deleted
inserted
replaced
| 96:780b7e0eeeeb | 97:ba5ff82dcf19 |
|---|---|
| 51 local green = ITEM_QUALITY_COLORS[ITEM_QUALITY_UNCOMMON].hex | 51 local green = ITEM_QUALITY_COLORS[ITEM_QUALITY_UNCOMMON].hex |
| 52 warning_text = ([[%sWARNING:|r Heroic (and Raid Finder) items sharing the same name as normal items often display incorrectly on forums that use the item name as the identifier. Recommend you change the %sItem markup|r dropdown in the right-hand side to %s"[item] by ID"|r (or some other format that uses $I) and regenerate this loot.]]):format(red, green, green) | 52 warning_text = ([[%sWARNING:|r Heroic (and Raid Finder) items sharing the same name as normal items often display incorrectly on forums that use the item name as the identifier. Recommend you change the %sItem markup|r dropdown in the right-hand side to %s"[item] by ID"|r (or some other format that uses $I) and regenerate this loot.]]):format(red, green, green) |
| 53 end | 53 end |
| 54 | 54 |
| 55 local function forum (_, loot, last_printed, generated, cache) | 55 local function forum (_, loot, last_printed, generated, cache) |
| 56 local fmt = OuroLootSV_opts.forum[OuroLootSV_opts.forum_current] or "" | 56 local fmt = addon.db.profile.forum[addon.db.profile.forum_current] or "" |
| 57 -- if it's capable of handling heroic items, consider them warned already | 57 -- if it's capable of handling heroic items, consider them warned already |
| 58 forum_warned_heroic = forum_warned_heroic or fmt:find'%$I' | 58 forum_warned_heroic = forum_warned_heroic or fmt:find'%$I' |
| 59 | 59 |
| 60 for i = last_printed+1, #loot do | 60 for i = last_printed+1, #loot do |
| 61 local e = loot[i] | 61 local e = loot[i] |
| 101 end | 101 end |
| 102 return #cache > 0 | 102 return #cache > 0 |
| 103 end | 103 end |
| 104 | 104 |
| 105 local function forum_specials (_,_, container, mkbutton) | 105 local function forum_specials (_,_, container, mkbutton) |
| 106 local opts = addon.db.profile | |
| 106 local map,current = {} | 107 local map,current = {} |
| 107 for label,format in pairs(OuroLootSV_opts.forum) do | 108 for label,format in pairs(opts.forum) do |
| 108 table.insert(map,label) | 109 table.insert(map,label) |
| 109 if label == OuroLootSV_opts.forum_current then | 110 if label == opts.forum_current then |
| 110 current = #map | 111 current = #map |
| 111 end | 112 end |
| 112 end | 113 end |
| 113 | 114 |
| 114 local dd, editbox | 115 local dd, editbox |
| 117 dd:SetFullWidth(true) | 118 dd:SetFullWidth(true) |
| 118 dd:SetLabel("Item markup") | 119 dd:SetLabel("Item markup") |
| 119 dd:SetList(map) | 120 dd:SetList(map) |
| 120 dd:SetValue(current) | 121 dd:SetValue(current) |
| 121 dd:SetCallback("OnValueChanged", function(_dd,event,choice) | 122 dd:SetCallback("OnValueChanged", function(_dd,event,choice) |
| 122 OuroLootSV_opts.forum_current = map[choice] | 123 opts.forum_current = map[choice] |
| 123 forum_warned_heroic = nil | 124 forum_warned_heroic = nil |
| 124 editbox:SetDisabled(map[choice] ~= "Custom...") | 125 editbox:SetDisabled(map[choice] ~= "Custom...") |
| 125 end) | 126 end) |
| 126 container:AddChild(dd) | 127 container:AddChild(dd) |
| 127 | 128 |
| 128 editbox = mkbutton("EditBox", nil, OuroLootSV_opts.forum["Custom..."], | 129 editbox = mkbutton("EditBox", nil, opts.forum["Custom..."], |
| 129 [[Format described in Help tab (Generated Text -> Forum Markup).]]) | 130 [[Format described in Help tab (Generated Text -> Forum Markup).]]) |
| 130 editbox:SetFullWidth(true) | 131 editbox:SetFullWidth(true) |
| 131 editbox:SetLabel("Custom:") | 132 editbox:SetLabel("Custom:") |
| 132 editbox:SetCallback("OnEnterPressed", function(_e,event,value) | 133 editbox:SetCallback("OnEnterPressed", function(_e,event,value) |
| 133 OuroLootSV_opts.forum["Custom..."] = value | 134 opts.forum["Custom..."] = value |
| 134 _e.editbox:ClearFocus() | 135 _e.editbox:ClearFocus() |
| 135 end) | 136 end) |
| 136 editbox:SetDisabled(OuroLootSV_opts.forum_current ~= "Custom...") | 137 editbox:SetDisabled(opts.forum_current ~= "Custom...") |
| 137 container:AddChild(editbox) | 138 container:AddChild(editbox) |
| 138 end | 139 end |
| 139 | 140 |
| 140 addon:register_text_generator ("forum", [[Forum Markup]], [[BBcode ready for Ouroboros forums]], forum, forum_specials) | 141 addon:register_text_generator ("forum", [[Forum Markup]], [[BBcode ready for Ouroboros forums]], forum, forum_specials) |
| 141 | 142 |
