/
-- Availability.lua: logic for the availability of recipes to characters |
-- $Id: Availability.lua 1039 2008-04-08 05:13:09Z jnmiller $ |
local L = LibStub("AceLocale-3.0"):GetLocale("RecipeRadar") |
----------------------------------------------------------------------------- |
-- Generic, abstracted availability entry points |
function RecipeRadar_Availability_Init() |
if (RecipeRadar_Options.RealmAvailability) then |
if (RecipeRadar.db.profile.RealmAvailability) then |
RecipeRadar_RealmAvailDropDown:Show() |
RecipeRadar_PersonAvailDropDown:Hide() |
else |
if (RecipeRadar_RealmAvailDropDown:IsVisible()) then |
RecipeRadar_PersonAvailDropDown:Show() |
RecipeRadar_RealmAvailDropDown:Hide() |
RecipeRadar_Options.RealmAvailability = false |
RecipeRadar.db.profile.RealmAvailability = false |
else |
RecipeRadar_RealmAvailDropDown:Show() |
RecipeRadar_PersonAvailDropDown:Hide() |
RecipeRadar_Options.RealmAvailability = true |
RecipeRadar.db.profile.RealmAvailability = true |
end |
RecipeRadar_FrameUpdate() |
-- Returns a colored indication of a recipe's availability. |
function RecipeRadar_Availability_GetIndicator(recipe) |
if (RecipeRadar_Options.RealmAvailability) then |
if (RecipeRadar.db.profile.RealmAvailability) then |
return RecipeRadar_RealmAvail_GetIndicator(recipe) |
else |
return RecipeRadar_PersonAvail_GetIndicator(recipe) |
local recipe_name = RecipeRadar_GetSafeItemInfo(recipe.ID) |
if (recipe_name == RRS("Uncached Recipe")) then |
if (recipe_name == L["Uncached Recipe"]) then |
-- uncached recipes have a special tooltip and warning |
-- I'm just coloring 'Warning:' red here for max contrast |
local warn = RRS("Warning: if your server has") |
local warn = L["Warning: if your server has"] |
local colon = string.find(warn, ":") |
local warning = |
RecipeRadar_ColorToCode(RecipeRadar_Colors.TooltipWarning) .. |
-- the layout of the tooltip, with colors for each line |
local tooltip = { |
{ text = RRS("Uncached Recipe"), color = RecipeRadar_Colors.UncachedRecipe }, |
{ text = L["Uncached Recipe"], color = RecipeRadar_Colors.UncachedRecipe }, |
{ text = "", color = nil }, |
{ text = RRS("You may mouse over the [?]"), color = RecipeRadar_Colors.TooltipHeading }, |
{ text = RRS("icon to lookup this recipe."), color = RecipeRadar_Colors.TooltipHeading }, |
{ text = L["You may mouse over the"], color = RecipeRadar_Colors.TooltipHeading }, |
{ text = L["icon to lookup this recipe."], color = RecipeRadar_Colors.TooltipHeading }, |
{ text = "", color = nil }, |
{ text = warning, color = RecipeRadar_Colors.TooltipHeading }, |
{ text = RRS("not yet seen this item, you"), color = RecipeRadar_Colors.TooltipHeading }, |
{ text = RRS("will be disconnected!"), color = RecipeRadar_Colors.TooltipHeading }, } |
{ text = L["not yet seen this item, you"], color = RecipeRadar_Colors.TooltipHeading }, |
{ text = L["will be disconnected!"], color = RecipeRadar_Colors.TooltipHeading }, } |
for _, line in pairs(tooltip) do |
RecipeRadar_AvailabilityTooltip_AddLine(line.text, line.color) |
end |
local factors = RecipeRadar_Availability_GetLimitingFactors( |
line.Name, recipe) |
local rank = string.format(RRS("%d of %d"), line.Rank, recipe.Skill) |
local rank = string.format(L["%d of %d"], line.Rank, recipe.Skill) |
if (factors["rank"]) then |
rank = RecipeRadar_HighlightString(rank, color) |
end |
local recipe_name = RecipeRadar_GetSafeItemInfo(recipe.ID) |
recipe_name = RecipeRadar_TrimRecipeLabel(recipe_name) |
if (recipe_name == RRS("Uncached Recipe")) then |
if (recipe_name == L["Uncached Recipe"]) then |
return nil |
end |
-- otherwise, get the other relevant booleans |
local has_rec = info.Professions[recipe.Type].Recipes[recipe_name] |
local has_rec = info.Professions[recipe.Type].Spell[recipe.Spell] |
local has_rank = info.Professions[recipe.Type].Rank >= recipe.Skill |
local has_rep = RecipeRadar_SkillDB_HasRep(player, recipe) |
local has_spec = RecipeRadar_SkillDB_HasSpec(player, recipe) |
RecipeRadar_IsAvailabilityFiltered(avail) |
end |
if (RecipeRadar_Options.RealmAvailability) then |
-- if (RecipeRadar_Options.RealmAvailability) then |
if (RecipeRadar.db.profile.RealmAvailability) then |
return avail == "LearnableByPlayer" or avail == "LearnableByAlt" |
else |
return avail == "LearnableByPlayer" |
if (RecipeRadar_Availability_IsAvailable(player, recipe)) then |
return "LearnableByPlayer" |
elseif (RecipeRadar_Options.RealmAvailability and |
elseif (RecipeRadar.db.profile.RealmAvailability and |
RecipeRadar_Availability_IsSatisfiedByAlt(recipe, |
RecipeRadar_Availability_IsAvailable)) then |
return "LearnableByAlt" |
elseif (RecipeRadar_Availability_IsProspect(player, recipe)) then |
return "ProspectForPlayer" |
elseif (RecipeRadar_Options.RealmAvailability and |
elseif (RecipeRadar.db.profile.RealmAvailability and |
RecipeRadar_Availability_IsSatisfiedByAlt(recipe, |
RecipeRadar_Availability_IsProspect)) then |
return "ProspectForAlt" |
elseif (RecipeRadar_Availability_IsKnown(player, recipe)) then |
return "KnownByPlayer" |
elseif (RecipeRadar_Options.RealmAvailability and |
elseif (RecipeRadar.db.profile.RealmAvailability and |
RecipeRadar_Availability_IsSatisfiedByAlt(recipe, |
RecipeRadar_Availability_IsKnown)) then |
return "KnownByAlt" |
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ |
..\FrameXML\UI.xsd"> |
<Script file="libs\LibStub\LibStub.lua"/> |
<Include file="libs\CallbackHandler-1.0\CallbackHandler-1.0.xml"/> |
<Include file="libs\AceAddon-3.0\AceAddon-3.0.xml"/> |
<Include file="libs\AceDB-3.0\AceDB-3.0.xml"/> |
<Include file="libs\AceGUI-3.0\AceGUI-3.0.xml"/> |
<Include file="libs\AceConfig-3.0\AceConfig-3.0.xml"/> |
<Include file="libs\AceEvent-3.0\AceEvent-3.0.xml"/> |
<Include file="libs\AceHook-3.0\AceHook-3.0.xml"/> |
<Include file="libs\AceLocale-3.0\AceLocale-3.0.xml"/> |
<Include file="libs\LibBabble-Zone-3.0\lib.xml"/> |
<Include file="libs\LibBabble-Faction-3.0\lib.xml"/> |
</Ui> |
-- DropDowns.lua: code concerned the dropdowns and corresponding filters |
-- $Id: DropDowns.lua 1046 2008-10-24 03:13:47Z jnmiller $ |
local L = LibStub("AceLocale-3.0"):GetLocale("RecipeRadar") |
function RecipeRadar_DropDowns_Init() |
RecipeRadar_PersonAvailDropDown_OnLoad() |
-- initialize the recipe filters and recipe tab icon |
RecipeRadar_SetProf2Filter(RecipeRadar_Options.CurrentProfession) |
RecipeRadar_SetProf2Filter(RecipeRadar.db.profile.CurrentProfession) |
if (RecipeRadar_Options.RealmAvailability) then |
if (RecipeRadar.db.profile.RealmAvailability) then |
return RecipeRadar_RealmAvailDropDown:Show() |
else |
return RecipeRadar_PersonAvailDropDown:Show() |
local dropdown = _G["RecipeRadar_RealmAvailDropDown"] |
UIDropDownMenu_Initialize(dropdown, RecipeRadar_RealmAvailDropDown_Init) |
UIDropDownMenu_SetText(dropdown, RRS("Availability")) |
UIDropDownMenu_SetText(dropdown, L["Availability"]) |
UIDropDownMenu_SetWidth(dropdown, 135) |
end |
local dropdown = _G["RecipeRadar_PersonAvailDropDown"] |
UIDropDownMenu_Initialize(dropdown, RecipeRadar_PersonAvailDropDown_Init) |
UIDropDownMenu_SetText(dropdown, RRS("Availability")) |
UIDropDownMenu_SetText(dropdown, L["Availability"]) |
UIDropDownMenu_SetWidth(dropdown, 135) |
end |
-- Generic tester for those who don't care about the current mode. |
function RecipeRadar_IsAvailabilityFiltered(avail) |
if (RecipeRadar_Options.RealmAvailability) then |
if (RecipeRadar.db.profile.RealmAvailability) then |
return RecipeRadar_IsRealmAvailFiltered(avail) |
else |
return RecipeRadar_IsPersonAvailFiltered(avail) |
local dropdown = _G["RecipeRadar_TeamDropDown"] |
UIDropDownMenu_Initialize(dropdown, RecipeRadar_TeamDropDown_Init) |
UIDropDownMenu_SetText(dropdown, RRS("Factions")) |
UIDropDownMenu_SetText(dropdown, L["Factions"]) |
UIDropDownMenu_SetWidth(dropdown, 112) |
end |
local dropdown = _G["RecipeRadar_Prof1DropDown"] |
UIDropDownMenu_Initialize(dropdown, RecipeRadar_Prof1DropDown_Init) |
UIDropDownMenu_SetText(dropdown, RRS("Professions")) |
UIDropDownMenu_SetText(dropdown, L["Professions"]) |
UIDropDownMenu_SetWidth(dropdown, 135) |
end |
local dropdown = _G["RecipeRadar_Prof2DropDown"] |
UIDropDownMenu_Initialize(dropdown, RecipeRadar_Prof2DropDown_Init) |
UIDropDownMenu_SetText(dropdown, RRS("Professions")) |
UIDropDownMenu_SetText(dropdown, L["Professions"]) |
UIDropDownMenu_SetWidth(dropdown, 135) |
end |
function RecipeRadar_IsCurrentProfession(prof) |
return RecipeRadar_Options.CurrentProfession == prof |
return RecipeRadar.db.profile.CurrentProfession == prof |
end |
RecipeRadarRecipesTabFrame:SetNormalTexture( |
RecipeRadar_Professions[prof].Icon) |
RecipeRadar_Options.CurrentProfession = prof |
RecipeRadar.db.profile.CurrentProfession = prof |
RecipeRadar_InitRecipeFilters() |
RecipeRadar_FrameUpdate() |
-- key on which to filter (eg. "Horde"), and is_filtered is the new state. |
function RecipeRadar_FilterVendors(filter_type, filter_on, is_filtered) |
local region = RecipeRadar_RegionData[RecipeRadar_Options.CurrentRegion] |
local region = RecipeRadar_RegionData[RecipeRadar.db.profile.CurrentRegion] |
if (not region) then return end |
for _, vendor in pairs(region.Vendors) do |
-- Initializes vendor/recipe filters according to saved filter settings. |
function RecipeRadar_InitVendorFilters() |
local region = RecipeRadar_RegionData[RecipeRadar_Options.CurrentRegion] |
local region = RecipeRadar_RegionData[RecipeRadar.db.profile.CurrentRegion] |
if (not region) then return end |
for _, vendor in pairs(region.Vendors) do |
-- set availability filter (the 'true') and auto-map if necessary |
if (RecipeRadar_Availability_IsLearnable(recipe, true) and |
RecipeRadar_Options.AutoMapVendors) then |
RecipeRadar.db.profile.AutoMapVendors) then |
RecipeRadar_Maps_AddVendor(vendor, |
RecipeRadar_Options.CurrentRegion) |
RecipeRadar.db.profile.CurrentRegion) |
end |
end |
-- key on which to filter (eg. "Horde"), and is_filtered is the new state. |
function RecipeRadar_FilterRecipes(filter_type, filter_on, is_filtered) |
local prof = RecipeRadar_RecipeData[RecipeRadar_Options.CurrentProfession] |
local prof = RecipeRadar_RecipeData[RecipeRadar.db.profile.CurrentProfession] |
for _, recipe in pairs(prof.Recipes) do |
-- Initializes vendor/recipe filters according to saved filter settings. |
function RecipeRadar_InitRecipeFilters() |
local prof = RecipeRadar_RecipeData[RecipeRadar_Options.CurrentProfession] |
local prof = RecipeRadar_RecipeData[RecipeRadar.db.profile.CurrentProfession] |
if (not prof) then return end |
for _, recipe in pairs(prof.Recipes) do |
-- Globals.lua: global/saved variables and some related initialization code |
-- $Id: Globals.lua 1099 2009-08-10 04:51:22Z jnmiller $ |
local L = LibStub("AceLocale-3.0"):GetLocale("RecipeRadar") |
local BFAC = LibStub("LibBabble-Faction-3.0"):GetLookupTable() |
RECIPERADAR_VERSION = "1.33" |
RECIPERADAR_VERSION = "1.402" |
RECIPERADAR_VENDORS_DISPLAYED = 8 |
RECIPERADAR_VENDOR_HEIGHT = 16 |
-- this should be <= the number of RecipeRadar*Icons |
RECIPERADAR_MAPPED_VENDORS_MAX = 20 |
BINDING_HEADER_RECIPERADAR_HEADER = RRS("Recipe Radar Bindings") |
BINDING_NAME_RECIPERADAR_TOGGLE = RRS("Toggle Recipe Radar") |
BINDING_HEADER_RECIPERADAR_HEADER = L["Recipe Radar Bindings"] |
BINDING_NAME_RECIPERADAR_TOGGLE = L["Toggle Recipe Radar"] |
RecipeRadar_Options = { } |
RecipeRadar_Continents = { |
[0] = RRS("Instances"), |
[1] = RRS("Kalimdor"), |
[2] = RRS("Eastern Kingdoms"), |
[3] = RRS("Outland"), |
[4] = RRS("Northrend"), |
[0] = L["Instances"], |
[1] = L["Kalimdor"], |
[2] = L["Eastern Kingdoms"], |
[3] = L["Outland"], |
[4] = L["Northrend"], |
} |
Color = RecipeRadar_Colors.Horde, |
}, |
["Neutral"] = { |
Name = RRS("Neutral"), |
Name = L["Neutral"], |
Color = RecipeRadar_Colors.Neutral, |
}, |
RecipeRadar_Professions = { |
[RRS("Alchemy")] = { |
Name = RRS("Alchemy"), |
[L["Alchemy"]] = { |
Name = L["Alchemy"], |
Icon = RECIPERADAR_IMAGE_ROOT .. "Icons\\" .. "Alchemy", |
}, |
[RRS("Blacksmithing")] = { |
Name = RRS("Blacksmithing"), |
[L["Blacksmithing"]] = { |
Name = L["Blacksmithing"], |
Icon = RECIPERADAR_IMAGE_ROOT .. "Icons\\" .. "Blacksmithing", |
}, |
[RRS("Cooking")] = { |
Name = RRS("Cooking"), |
[L["Cooking"]] = { |
Name = L["Cooking"], |
Icon = RECIPERADAR_IMAGE_ROOT .. "Icons\\" .. "Cooking", |
}, |
[RRS("Enchanting")] = { |
Name = RRS("Enchanting"), |
[L["Enchanting"]] = { |
Name = L["Enchanting"], |
Icon = RECIPERADAR_IMAGE_ROOT .. "Icons\\" .. "Enchanting", |
}, |
[RRS("Engineering")] = { |
Name = RRS("Engineering"), |
[L["Engineering"]] = { |
Name = L["Engineering"], |
Icon = RECIPERADAR_IMAGE_ROOT .. "Icons\\" .. "Engineering", |
}, |
[RRS("First Aid")] = { |
Name = RRS("First Aid"), |
[L["First Aid"]] = { |
Name = L["First Aid"], |
Icon = RECIPERADAR_IMAGE_ROOT .. "Icons\\" .. "First-Aid", |
}, |
[RRS("Fishing")] = { |
Name = RRS("Fishing"), |
[L["Fishing"]] = { |
Name = L["Fishing"], |
Icon = RECIPERADAR_IMAGE_ROOT .. "Icons\\" .. "Fishing", |
}, |
[RRS("Leatherworking")] = { |
Name = RRS("Leatherworking"), |
[L["Leatherworking"]] = { |
Name = L["Leatherworking"], |
Icon = RECIPERADAR_IMAGE_ROOT .. "Icons\\" .. "Leatherworking", |
}, |
[RRS("Tailoring")] = { |
Name = RRS("Tailoring"), |
[L["Tailoring"]] = { |
Name = L["Tailoring"], |
Icon = RECIPERADAR_IMAGE_ROOT .. "Icons\\" .. "Tailoring", |
}, |
[RRS("Jewelcrafting")] = { |
Name = RRS("Jewelcrafting"), |
[L["Jewelcrafting"]] = { |
Name = L["Jewelcrafting"], |
Icon = RECIPERADAR_IMAGE_ROOT .. "Icons\\" .. "Jewelcrafting", |
}, |
[RRS("Inscription")] = { |
Name = RRS("Inscription"), |
[L["Inscription"]] = { |
Name = L["Inscription"], |
Icon = RECIPERADAR_IMAGE_ROOT .. "Icons\\" .. "Inscription", |
}, |
RecipeRadar_Specialties = { |
[RRS("Gnomish Engineer")] = RRS("Engineering"), |
[RRS("Goblin Engineer")] = RRS("Engineering"), |
[RRS("Tribal Leatherworking")] = RRS("Leatherworking"), |
[RRS("Elemental Leatherworking")] = RRS("Leatherworking"), |
[RRS("Dragonscale Leatherworking")] = RRS("Leatherworking"), |
[RRS("Armorsmith")] = RRS("Blacksmithing"), |
[RRS("Weaponsmith")] = RRS("Blacksmithing"), |
[RRS("Master Axesmith")] = RRS("Blacksmithing"), |
[RRS("Master Swordsmith")] = RRS("Blacksmithing"), |
[RRS("Master Hammersmith")] = RRS("Blacksmithing"), |
[RRS("Master Axesmith")] = RRS("Blacksmithing"), |
[RRS("Master Swordsmith")] = RRS("Blacksmithing"), |
[RRS("Master Hammersmith")] = RRS("Blacksmithing"), |
[RRS("Spellfire Tailoring")] = RRS("Tailoring"), |
[RRS("Shadoweave Tailoring")] = RRS("Tailoring"), |
[RRS("Mooncloth Tailoring")] = RRS("Tailoring"), |
[L["Gnomish Engineer"]] = L["Engineering"], |
[L["Goblin Engineer"]] = L["Engineering"], |
[L["Tribal Leatherworking"]] = L["Leatherworking"], |
[L["Elemental Leatherworking"]] = L["Leatherworking"], |
[L["Dragonscale Leatherworking"]] = L["Leatherworking"], |
[L["Armorsmith"]] = L["Blacksmithing"], |
[L["Weaponsmith"]] = L["Blacksmithing"], |
[L["Master Axesmith"]] = L["Blacksmithing"], |
[L["Master Swordsmith"]] = L["Blacksmithing"], |
[L["Master Hammersmith"]] = L["Blacksmithing"], |
[L["Master Axesmith"]] = L["Blacksmithing"], |
[L["Master Swordsmith"]] = L["Blacksmithing"], |
[L["Master Hammersmith"]] = L["Blacksmithing"], |
[L["Spellfire Tailoring"]] = L["Tailoring"], |
[L["Shadoweave Tailoring"]] = L["Tailoring"], |
[L["Mooncloth Tailoring"]] = L["Tailoring"], |
} |
RecipeRadar_Factions = { |
RRS("Argent Dawn"), |
RRS("Cenarion Circle"), |
RRS("Thorium Brotherhood"), |
RRS("Timbermaw Hold"), |
RRS("Zandalar Tribe"), |
RRS("Cenarion Expedition"), |
RRS("The Consortium"), |
RRS("Honor Hold"), |
RRS("Kurenai"), |
RRS("The Mag'har"), |
RRS("Netherwing"), |
RRS("Sporeggar"), |
RRS("Thrallmar"), |
RRS("The Aldor"), |
RRS("The Scryers"), |
RRS("Lower City"), |
RRS("The Sha'tar"), |
RRS("The Violet Eye"), |
RRS("The Scale of the Sands"), |
RRS("Keepers of Time"), |
RRS("Ashtongue Deathsworn"), |
RRS("Shattered Sun Offensive"), |
RRS("Argent Crusade"), |
RRS("Explorers' League"), |
RRS("Frenzyheart Tribe"), |
RRS("Kirin Tor"), |
RRS("Knights of the Ebon Blade"), |
RRS("The Frostborn"), |
RRS("The Hand of Vengeance"), |
RRS("The Kalu'ak"), |
RRS("The Oracles"), |
RRS("The Silver Covenant"), |
RRS("The Sons of Hodir"), |
RRS("The Taunka"), |
RRS("The Wyrmrest Accord"), |
RRS("Valiance Expedition"), |
RRS("Warsong Offensive"), |
BFAC["Argent Dawn"], |
BFAC["Cenarion Circle"], |
BFAC["Thorium Brotherhood"], |
BFAC["Timbermaw Hold"], |
BFAC["Zandalar Tribe"], |
BFAC["Cenarion Expedition"], |
BFAC["The Consortium"], |
BFAC["Honor Hold"], |
BFAC["Kurenai"], |
BFAC["The Mag'har"], |
BFAC["Netherwing"], |
BFAC["Sporeggar"], |
BFAC["Thrallmar"], |
BFAC["The Aldor"], |
BFAC["The Scryers"], |
BFAC["Lower City"], |
BFAC["The Sha'tar"], |
BFAC["The Violet Eye"], |
BFAC["The Scale of the Sands"], |
BFAC["Keepers of Time"], |
BFAC["Ashtongue Deathsworn"], |
BFAC["Shattered Sun Offensive"], |
BFAC["Argent Crusade"], |
BFAC["Explorers' League"], |
BFAC["Frenzyheart Tribe"], |
BFAC["Kirin Tor"], |
BFAC["Knights of the Ebon Blade"], |
BFAC["The Frostborn"], |
BFAC["The Hand of Vengeance"], |
BFAC["The Kalu'ak"], |
BFAC["The Oracles"], |
BFAC["The Silver Covenant"], |
BFAC["The Sons of Hodir"], |
BFAC["The Taunka"], |
BFAC["The Wyrmrest Accord"], |
BFAC["Valiance Expedition"], |
BFAC["Warsong Offensive"], |
BFAC["Guild"], |
} |
RecipeRadar_Availabilities = { |
["LearnableByPlayer"] = { |
Text = RRS("Available Now (Player)"), |
Tooltip = { Group = 1, Heading = RRS("Available For:") }, |
Text = L["Available Now (Player)"], |
Tooltip = { Group = 1, Heading = L["Available For:"] }, |
DropDown = { POrder = 1, ROrder = 1 }, |
Color = RecipeRadar_Colors.LearnableByPlayer, |
TestFunction = RecipeRadar_Availability_IsLearnableByPlayer, |
}, |
["LearnableByAlt"] = { |
Text = RRS("Available Now (Alts)"), |
Tooltip = { Group = 1, Heading = RRS("Available For:") }, |
Text = L["Available Now (Alts)"], |
Tooltip = { Group = 1, Heading = L["Available For:"] }, |
DropDown = { POrder = nil, ROrder = 2 }, |
Color = RecipeRadar_Colors.LearnableByAlt, |
TestFunction = RecipeRadar_Availability_IsLearnableByAlt, |
}, |
["ProspectForPlayer"] = { |
Text = RRS("Future Prospect (Player)"), |
Tooltip = { Group = 2, Heading = RRS("Future Prospect For:") }, |
Text = L["Future Prospect (Player)"], |
Tooltip = { Group = 2, Heading = L["Future Prospect For:"] }, |
DropDown = { POrder = 2, ROrder = 3 }, |
Color = RecipeRadar_Colors.ProspectForPlayer, |
TestFunction = RecipeRadar_Availability_IsProspectForPlayer, |
}, |
["ProspectForAlt"] = { |
Text = RRS("Future Prospect (Alts)"), |
Tooltip = { Group = 2, Heading = RRS("Future Prospect For:") }, |
Text = L["Future Prospect (Alts)"], |
Tooltip = { Group = 2, Heading = L["Future Prospect For:"] }, |
DropDown = { POrder = nil, ROrder = 4 }, |
Color = RecipeRadar_Colors.ProspectForAlt, |
TestFunction = RecipeRadar_Availability_IsProspectForAlt, |
}, |
["KnownByPlayer"] = { |
Text = RRS("Already Known (Player)"), |
Tooltip = { Group = 3, Heading = RRS("Already Known By:") }, |
Text = L["Already Known (Player)"], |
Tooltip = { Group = 3, Heading = L["Already Known By:"] }, |
DropDown = { POrder = 3, ROrder = 5 }, |
Color = RecipeRadar_Colors.KnownByPlayer, |
TestFunction = RecipeRadar_Availability_IsKnownByPlayer, |
}, |
["KnownByAlt"] = { |
Text = RRS("Already Known (Alts)"), |
Tooltip = { Group = 3, Heading = RRS("Already Known By:") }, |
Text = L["Already Known (Alts)"], |
Tooltip = { Group = 3, Heading = L["Already Known By:"] }, |
DropDown = { POrder = nil, ROrder = 6 }, |
Color = RecipeRadar_Colors.KnownByAlt, |
TestFunction = RecipeRadar_Availability_IsKnownByAlt, |
}, |
["NotApplicable"] = { |
Text = RRS("Inapplicable"), |
Text = L["Inapplicable"], |
Tooltip = { Group = 0 }, -- do not show in tooltip |
DropDown = { POrder = 4, ROrder = 7 }, |
Color = RecipeRadar_Colors.NotApplicable, |
end |
-- upgrade is complete |
RecipeRadar_Options.Version = RECIPERADAR_VERSION |
RecipeRadar.db.profile.Version = RECIPERADAR_VERSION |
end |
-- Initializes the Options table with some defaults. |
function RecipeRadar_Options_Init() |
if (RecipeRadar_Options.Version == nil) then |
RecipeRadar_Options.Version = RECIPERADAR_VERSION |
if (RecipeRadar.db.profile.Version == nil) then |
-- setting this to the lowest version forces an |
-- upgrade for all characters on this account |
RecipeRadar_Options.Version = "1.0" |
RecipeRadar.db.profile.Version = "1.0" |
end |
if (RecipeRadar_Options.MinimapButtonPosition == nil) then |
RecipeRadar_Options.MinimapButtonPosition = 256 |
if (RecipeRadar.db.profile.MinimapButtonPosition == nil) then |
RecipeRadar.db.profile.MinimapButtonPosition = 256 |
end |
if (RecipeRadar_Options.ShowMinimapButton == nil) then |
RecipeRadar_Options.ShowMinimapButton = true |
if (RecipeRadar.db.profile.ShowMinimapButton == nil) then |
RecipeRadar.db.profile.ShowMinimapButton = true |
RecipeRadarMinimapButtonFrame:Show() |
end |
if (not RecipeRadar_IsProfession( |
RecipeRadar_Options.CurrentProfession)) then |
RecipeRadar_Options.CurrentProfession = RRS("Cooking") |
RecipeRadar.db.profile.CurrentProfession)) then |
RecipeRadar.db.profile.CurrentProfession = L["Cooking"] |
end |
if (RecipeRadar_Options.RealmAvailability == nil) then |
RecipeRadar_Options.RealmAvailability = true |
if (RecipeRadar.db.profile.RealmAvailability == nil) then |
RecipeRadar.db.profile.RealmAvailability = true |
RecipeRadar_RealmAvailDropDown:Show() |
end |
if (RecipeRadar_Options.Locked == nil) then |
RecipeRadar_Options.Locked = false |
if (RecipeRadar.db.profile.Locked == nil) then |
RecipeRadar.db.profile.Locked = false |
end |
if (RecipeRadar_Options.AutoSelectRegion == nil) then |
RecipeRadar_Options.AutoSelectRegion = true |
if (RecipeRadar.db.profile.AutoSelectRegion == nil) then |
RecipeRadar.db.profile.AutoSelectRegion = true |
end |
if (RecipeRadar_Options.AutoMapVendors == nil) then |
RecipeRadar_Options.AutoMapVendors = false |
if (RecipeRadar.db.profile.AutoMapVendors == nil) then |
RecipeRadar.db.profile.AutoMapVendors = false |
end |
end |
-- MinimapButton.lua: code to handle the little Recipe Radar minimap button |
-- $Id: MinimapButton.lua 1022 2008-03-07 20:57:50Z jnmiller $ |
local L = LibStub("AceLocale-3.0"):GetLocale("RecipeRadar") |
function RecipeRadar_MinimapButton_OnClick(self, button) |
--------------------------------------------------------------------------------------- |
--------------------------------------------------------------------------------------- |
-- Minimap Button |
RecipeRadar_Toggle() |
CreateFrame("Frame", "RecipeRadarMinimapButtonFrame", Minimap) |
RecipeRadarMinimapButtonFrame:EnableMouse(true) |
RecipeRadarMinimapButtonFrame:SetMovable(false) |
RecipeRadarMinimapButtonFrame:SetFrameStrata("LOW") |
RecipeRadarMinimapButtonFrame:SetWidth(32) |
RecipeRadarMinimapButtonFrame:SetHeight(32) |
RecipeRadarMinimapButtonFrame:SetPoint("TOPLEFT", Minimap, "RIGHT", 2, 0) |
CreateFrame("Frame", "RecipeRadarMinimapButtonHighlightFrame", RecipeRadarMinimapButtonFrame) |
RecipeRadarMinimapButtonHighlightFrame:SetWidth(32) |
RecipeRadarMinimapButtonHighlightFrame:SetHeight(32) |
RecipeRadarMinimapButtonHighlightFrame:SetPoint("TOPLEFT", RecipeRadarMinimapButtonFrame, 0, 0) |
local t = RecipeRadarMinimapButtonHighlightFrame:CreateTexture(nil,"OVERLAY") |
t:SetTexture("Interface\\Minimap\\UI-Minimap-Background") |
t:SetAllPoints() |
RecipeRadarMinimapButtonHighlightFrame:Hide() |
CreateFrame("Button", "RecipeRadar_MinimapButton", RecipeRadarMinimapButtonFrame) |
RecipeRadar_MinimapButton:SetWidth(32) |
RecipeRadar_MinimapButton:SetHeight(32) |
RecipeRadar_MinimapButton:SetNormalTexture("Interface\\AddOns\\RecipeRadar\\Images\\Misc\\MinimapButtonUp") |
RecipeRadar_MinimapButton:SetPushedTexture("Interface\\AddOns\\RecipeRadar\\Images\\Misc\\MinimapButtonDown") |
RecipeRadar_MinimapButton:SetPoint("TOPLEFT", RecipeRadarMinimapButtonFrame) |
-- Thanks to Yatlas for this code |
function RecipeRadar_MinimapButton_BeingDragged() |
-- Thanks to Gello for this code |
local xpos,ypos = GetCursorPosition() |
local xmin,ymin = Minimap:GetLeft(), Minimap:GetBottom() |
xpos = xmin-xpos/UIParent:GetScale()+70 |
ypos = ypos/UIParent:GetScale()-ymin-70 |
local v = math.deg(math.atan2(ypos, xpos)) |
if v < 0 then |
v = v + 360 |
end |
RecipeRadar.db.profile.MinimapButtonPosition = math.ceil(v) |
RecipeRadar_MinimapButton_UpdatePosition() |
end |
function RecipeRadar_MinimapButton_Init() |
RecipeRadar_MinimapButton:RegisterEvent("VARIABLES_LOADED") |
RecipeRadar_MinimapButton:RegisterForDrag("RightButton") |
RecipeRadar_MinimapButton:SetScript("OnDragStart", function(self) |
self:SetScript("OnUpdate", RecipeRadar_MinimapButton_BeingDragged) |
RecipeRadar_MinimapButton_BeingDragged() |
end) |
RecipeRadar_MinimapButton:SetScript("OnDragStop", function(self) |
self:SetScript("OnUpdate", RecipeRadar_MinimapButton_OnUpdate) |
if RecipeRadar_OptionsFrame:IsVisible() then |
LibStub("AceConfigRegistry-3.0"):NotifyChange("RecipeRadar") |
end |
end) |
RecipeRadar_MinimapButton:SetScript("OnClick", function(self) |
RecipeRadar_Toggle() |
end) |
RecipeRadar_MinimapButton:SetScript("OnEnter", function(self) |
GameTooltip:SetOwner(self, "ANCHOR_LEFT") |
GameTooltip:SetText(L["Recipe Radar"] .. " " .. RECIPERADAR_VERSION) |
GameTooltip:AddLine(L["Left-click to open RecipeRadar."]) |
GameTooltip:AddLine(L["Right-click and drag to move this button."]) |
GameTooltip:Show() |
end) |
RecipeRadar_MinimapButton:SetScript("OnLeave", RecipeRadar_Button_OnLeave) |
RecipeRadar_MinimapButton:SetScript("OnEvent", RecipeRadar_MinimapButton_Init) |
RecipeRadar_MinimapButton:SetScript("OnUpdate", function(self, elapsed) |
RecipeRadar_MinimapButton_OnUpdate(self, elapsed) |
end) |
RecipeRadar_MinimapButton:SetScript("OnShow", function(self) |
self.total = 0 |
self.cntr = 0 |
self.sign = 1 |
RECIPERADAR_FLASH_MINIMAP_BUTTON = false |
end) |
if (RecipeRadar_Options.ShowMinimapButton) then |
RecipeRadarMinimapButtonFrame:Show() |
else |
RecipeRadarMinimapButtonFrame:Hide() |
end |
RecipeRadar_MinimapButton_UpdatePosition() |
--------------------------------------------------------------------------------------- |
function RecipeRadar_Button_OnLeave(self) |
ResetCursor() |
GameTooltip:Hide() |
end |
function RecipeRadar_MinimapButton_Toggle() |
function RecipeRadar_MinimapButton_Init(self) |
if (RecipeRadarMinimapButtonFrame:IsVisible()) then |
if (RecipeRadar.db.profile.ShowMinimapButton) then |
RecipeRadarMinimapButtonFrame:Show() |
else |
RecipeRadarMinimapButtonFrame:Hide() |
RecipeRadar_Options.ShowMinimapButton = false |
else |
RecipeRadarMinimapButtonFrame:Show() |
RecipeRadar_Options.ShowMinimapButton = true |
end |
RecipeRadar_MinimapButton_UpdatePosition() |
end |
-- Turns on the slow highlight/outline flash. |
function RecipeRadar_MinimapButton_Flash() |
function RecipeRadar_MinimapButton_Flash(self) |
RECIPERADAR_FLASH_MINIMAP_BUTTON = true |
RecipeRadarMinimapButtonHighlightFrame:Show() |
return |
end |
if (self.total == nil) then |
self.total = 0 |
end |
if (self.cntr == nil) then |
self.cntr = 0 |
end |
if (self.sign == nil) then |
self.sign = 1 |
end |
self.total = self.total + elapsed |
local cntr = self.cntr + elapsed |
local sign = self.sign |
-- Sets the location of the button according to the current options. |
function RecipeRadar_MinimapButton_UpdatePosition() |
RecipeRadarMinimapButtonFrame:SetPoint("TOPLEFT", "Minimap", "TOPLEFT", |
54 - (78 * cos(RecipeRadar_Options.MinimapButtonPosition)), |
(78 * sin(RecipeRadar_Options.MinimapButtonPosition)) - 55) |
RecipeRadarMinimapButtonFrame:SetPoint("TOPLEFT", "Minimap", "TOPLEFT", |
54 - (78 * cos(RecipeRadar.db.profile.MinimapButtonPosition)), |
(78 * sin(RecipeRadar.db.profile.MinimapButtonPosition)) - 55) |
end |
-- Maps.lua: generic mapping code and map "base class" |
-- $Id: Maps.lua 1022 2008-03-07 20:57:50Z jnmiller $ |
local L = LibStub("AceLocale-3.0"):GetLocale("RecipeRadar") |
-- Initializes the state of the map overlays and settings. |
function RecipeRadar_Maps_Init() |
local anchor = "ANCHOR_BOTTOMLEFT" |
if (#frame.Vendor.Recipes == 1) then |
line2 = RRS("1 recipe") |
line2 = L["1 recipe"] |
else |
line2 = string.format(RRS("%d recipes"), #frame.Vendor.Recipes) |
line2 = string.format(L["%d recipes"], #frame.Vendor.Recipes) |
end |
local count = RecipeRadar_CountLearnableRecipes(frame.Vendor.Recipes) |
line2 = line2 .. " " .. format(TEXT(PARENS_TEMPLATE), |
format(RRS("%d learnable"), count)) |
format(L["%d learnable"], count)) |
-- make sure our tooltip doesn't hit the screen edge |
if (frame:GetLeft() < 200) then |
end |
item = { } |
item.text = RRS("Unmap Vendor") |
item.text = L["Unmap Vendor"] |
item.value = "unmap" |
item.notCheckable = 1 |
item.func = RecipeRadar_Maps_ContextMenuOnClick |
<Button name="RecipeRadarMinimapIcon19" inherits="RecipeRadarMinimapIconTemplate"/> |
<Button name="RecipeRadarMinimapIcon20" inherits="RecipeRadarMinimapIconTemplate"/> |
<Button name="RecipeRadarWorldmapIconTemplate" hidden="true" parent="WorldMapFrame" virtual="true"> |
<Button name="RecipeRadarWorldmapIconTemplate" hidden="true" parent="WorldMapDetailFrame" virtual="true"> |
<Size> |
<AbsDimension x="16" y="16"/> |
</Size> |
if (self.r) then |
_G[self:GetName() .. "SubText"]:SetTextColor(self.r + RecipeRadar_Colors.Highlight, self.g + RecipeRadar_Colors.Highlight, self.b + RecipeRadar_Colors.Highlight) |
end |
if (RecipeRadar_Options.RealmAvailability and self.Recipe) then |
if (RecipeRadar.db.profile.RealmAvailability and self.Recipe) then |
RecipeRadar_Availability_CreateTooltip(self.Recipe) |
RecipeRadar_AvailabilityTooltip_Show(self) |
end |
button.Elapsed = RECIPERADAR_MINIMAP_UPDATE |
button.IsMapped = true |
local Astrolabe = DongleStub("Astrolabe-0.4") |
local Astrolabe = DongleStub("Astrolabe-1.0") |
local continent = RecipeRadar_RegionData[region].Continent |
Astrolabe:PlaceIconOnMinimap(button, continent, |
RecipeRadar_RegionNameToID(region, continent), |
local mapId = Astrolabe:GetMapID(continent, RecipeRadar_RegionNameToID(region, continent)) |
local result = Astrolabe:PlaceIconOnMinimap(button, mapId, nil, |
vendor.Coordinates[1].x, vendor.Coordinates[1].y) |
end |
-- Resets and unmaps the given icon. |
button.Region = nil |
button.IsMapped = false |
local Astrolabe = DongleStub("Astrolabe-0.4") |
local Astrolabe = DongleStub("Astrolabe-1.0") |
Astrolabe:RemoveIconFromMinimap(button) |
end |
-- MainFrame.lua: main Recipe Radar window code |
-- $Id: MainFrame.lua 1060 2008-11-16 04:27:27Z jnmiller $ |
local L = LibStub("AceLocale-3.0"):GetLocale("RecipeRadar") |
function RecipeRadar_MainFrame_Init() |
RecipeRadarListScrollFrameScrollBar:SetValue(0) |
RecipeRadarListScrollFrameScrollBar.scrollBarHideable = 1 |
RecipeRadarOptionsButton:SetText(RRS("Options")) |
RecipeRadarMapVendorIndicatorText:SetText(RRS("Locate Vendor on Map")) |
RecipeRadarOptionsButton:SetText(L["Options"]) |
RecipeRadarMapVendorIndicatorText:SetText(L["Locate Vendor on Map"]) |
RecipeRadar_UpdateLock() |
RecipeRadar_RadarTab_Init() |
ShowUIPanel(RecipeRadarFrame) |
RecipeRadar_SkillDB_ParseSpellbookFrame() |
-- RecipeRadar_SkillDB_ParseSkillFrame() -- deprecated |
RecipeRadar_SkillDB_ParseSkillFrame() |
RecipeRadar_SkillDB_ParseReputationFrame() |
RecipeRadar_FrameUpdate() |
function RecipeRadar_FrameUpdate() |
if (RecipeRadar_Options.ActiveTab == 1) then |
if (RecipeRadar.db.profile.ActiveTab == 1) then |
RecipeRadar_RadarTab_Update() |
else |
RecipeRadar_RecipesTab_Update() |
RecipeRadarRecipesTabFrameLeft:SetHeight(background_tab_height) |
RecipeRadarRecipesTabFrameMiddle:SetHeight(background_tab_height) |
RecipeRadarRecipesTabFrameRight:SetHeight(background_tab_height) |
RecipeRadar_Options.ActiveTab = 1 |
RecipeRadar.db.profile.ActiveTab = 1 |
else |
RecipeRadarRadarTabFrameMiddle:SetHeight(background_tab_height) |
RecipeRadarRadarTabFrameRight:SetHeight(background_tab_height) |
RecipeRadarRecipesTabFrameLeft:SetHeight(active_tab_height) |
RecipeRadarRecipesTabFrameMiddle:SetHeight(active_tab_height) |
RecipeRadarRecipesTabFrameRight:SetHeight(active_tab_height) |
RecipeRadar_Options.ActiveTab = 2 |
RecipeRadar.db.profile.ActiveTab = 2 |
end |
end |
local name = RecipeRadar_GetSafeItemInfo(recipe.ID) |
local indicator = RecipeRadar_Availability_GetIndicator(recipe) |
if (name == RRS("Uncached Recipe")) then |
if (name == L["Uncached Recipe"]) then |
button:SetNormalFontObject(RecipeRadarDarkGray) |
button:SetHighlightFontObject(RecipeRadarDarkGrayHighlight) |
else |
end |
-- basic drawing code |
if (RecipeRadar_Options.RealmAvailability) then |
if (RecipeRadar.db.profile.RealmAvailability) then |
button:SetText(name .. indicator) |
else |
button:SetText(name) |
-- drawing code for the little subtext field |
local subtext = _G["RecipeRadarVendor" .. index .. "SubText"] |
if (not RecipeRadar_Options.RealmAvailability) then |
if (not RecipeRadar.db.profile.RealmAvailability) then |
local avail = RecipeRadar_Availability_GetKey(recipe) |
if (avail) then |
button.r = RecipeRadar_Availabilities[avail].Color.r |
-- Abstracts front for click handlers. |
function RecipeRadar_ServiceClickIndex(self, index, button) |
if (RecipeRadar_Options.ActiveTab == 1) then |
if (RecipeRadar.db.profile.ActiveTab == 1) then |
RecipeRadar_RadarTab_ServiceClickIndex(self, index, button) |
else |
RecipeRadar_RecipesTab_ServiceClickIndex(self, index, button) |
if (recipe.Cost > 0) then -- 0 denotes a "special" cost |
RecipeDetailSpecialText:Hide() |
else |
RecipeDetailSpecialText:SetText(RRS("Special")) |
RecipeDetailSpecialText:SetText(L["Special"]) |
RecipeDetailSpecialText:Show() |
end |
local cost, cost_item = RecipeRadar_GetSpecialRecipeCost(recipe) |
local cost, cost_item, need_link = RecipeRadar_GetSpecialRecipeCost(recipe) |
if (cost_item ~= nil and cost_item > 0) then |
-- some recipes cost a certain number of items |
local cost_name, cost_link, cost_colorcode, _, _, _, cost_texture = |
RecipeRadar_GetSafeItemInfo(cost_item) |
if (need_link) then |
local cost_name, cost_link, cost_colorcode, _, _, _, cost_texture = |
RecipeRadar_GetSafeItemInfo(cost_item) |
RecipeCostIcon.Link = cost_link |
RecipeCostIcon.Hyperlink = RecipeRadar_GetHyperlinkByParts( |
cost_name, cost_link, cost_colorcode) |
RecipeCostIcon:SetNormalTexture(cost_texture) |
else |
local cost_name = select(1, GetCurrencyInfo(cost_item)) |
local cost_texture = [[Interface\Icons\]]..select(3, GetCurrencyInfo(cost_item)) |
RecipeCostIcon:SetNormalTexture(cost_texture) |
RecipeCostIcon.Link = nil |
RecipeCostIcon.Hyperlink = cost_name |
end |
RecipeDetailSpecialText:SetText(cost) |
RecipeDetailSpecialText:Show() |
RecipeCostIcon:SetNormalTexture(cost_texture) |
RecipeCostIcon.Link = cost_link |
RecipeCostIcon.Hyperlink = RecipeRadar_GetHyperlinkByParts( |
cost_name, cost_link, cost_colorcode) |
RecipeDetailMoneyFrame:Hide() |
RecipeDetailSpecialText:Show() |
RecipeCostIcon:Show() |
if (vendor.Coordinates) then |
if (not region_name) then |
region_name = RecipeRadar_Options.CurrentRegion |
region_name = RecipeRadar.db.profile.CurrentRegion |
end |
local region = RecipeRadar_RegionData[region_name] |
function RecipeRadar_ToggleLock() |
if (RecipeRadar_Options.Locked) then |
RecipeRadar_Options.Locked = false |
if (RecipeRadar.db.profile.Locked) then |
RecipeRadar.db.profile.Locked = false |
RecipeRadar_UpdateLock() |
else |
RecipeRadar_Options.Locked = true |
RecipeRadar.db.profile.Locked = true |
RecipeRadar_UpdateLock() |
end |
function RecipeRadar_UpdateLock() |
if (RecipeRadar_Options.Locked) then |
if (RecipeRadar.db.profile.Locked) then |
RecipeRadarLockNormal:SetTexture( |
RECIPERADAR_IMAGE_ROOT .. "Frame\\LockButton-Locked-Up") |
RecipeRadarLockPushed:SetTexture( |
function RecipeRadar_StartMoving() |
if (not RecipeRadar_Options.Locked) then |
if (not RecipeRadar.db.profile.Locked) then |
RecipeRadarFrame:StartMoving() |
end |