+ Added MBB compatibility (better minimap button managment),
+ Added
RUru localization by Maus
+ backported some fixes from original 1.14
release
This commit is contained in:
LaYt
2017-02-02 15:40:03 +07:00
parent 7c3c0f6b15
commit 0d28143942
103 changed files with 14372 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
# Recipe Radar
##Description
Recipe Radar is a World of Warcraft UI addon that assists players in finding recipes. It knows about vendors who sell recipes in the current region or by profession. It has a number of filtering options and can even locate vendors on the world map.
![Main Window](http://imgur.com/5Dw3mCH)
When you get in game, you may want to map a key to toggle Recipe Radar.
You should be able to find the option to do this in your Key Bindings menu,
all the way at the bottom. Otherwise, you can hit the new icon on your
minimap to open Recipe Radar or use the slash command, '/rrdr'.
#Last changes:
- Added MBB compatibility (better minimap button managment),
- Added RUru localization by Maus
#Download
https://github.com/laytya/RecipeRadar-vanilla
#Installation
Just copy "RecipeRadar" folder to your addon's directory.
#Credits
originaly made by Jay Miller [jnmiller@cryptofreak.org]
+440
View File
@@ -0,0 +1,440 @@
-- Availability.lua: logic for the availability of recipes to characters
-- $Id: Availability.lua 451 2006-09-11 03:23:04Z jnmiller $
-----------------------------------------------------------------------------
-- Generic, abstracted availability entry points
-----------------------------------------------------------------------------
function RecipeRadar_Availability_Init()
if (RecipeRadar_Options.RealmAvailability) then
RecipeRadar_RealmAvailDropDown:Show()
RecipeRadar_PersonAvailDropDown:Hide()
else
RecipeRadar_PersonAvailDropDown:Show()
RecipeRadar_RealmAvailDropDown:Hide()
end
end
function RecipeRadar_Availability_Toggle()
if (RecipeRadar_RealmAvailDropDown:IsVisible()) then
RecipeRadar_PersonAvailDropDown:Show()
RecipeRadar_RealmAvailDropDown:Hide()
RecipeRadar_Options.RealmAvailability = false
else
RecipeRadar_RealmAvailDropDown:Show()
RecipeRadar_PersonAvailDropDown:Hide()
RecipeRadar_Options.RealmAvailability = true
end
RecipeRadar_FrameUpdate()
end
-----------------------------------------------------------------------------
-- Indicator for vendor/recipe item lists
-----------------------------------------------------------------------------
-- Returns a colored indication of a recipe's availability.
function RecipeRadar_Availability_GetIndicator(recipe)
if (RecipeRadar_Options.RealmAvailability) then
return RecipeRadar_RealmAvail_GetIndicator(recipe)
else
return RecipeRadar_PersonAvail_GetIndicator(recipe)
end
end
-- Returns a string with the recipe's skill in parens.
function RecipeRadar_PersonAvail_GetIndicator(recipe)
return format(TEXT(PARENS_TEMPLATE), recipe.Skill)
end
-- Returns a string with a little colored realm-wide availability
-- indicator for the main vendor/recipe list.
function RecipeRadar_RealmAvail_GetIndicator(recipe)
local key = RecipeRadar_Availability_GetKey(recipe)
if (not key) then return "" end
return RecipeRadar_ColorToCode(RecipeRadar_Availabilities[key].Color) ..
"*" .. FONT_COLOR_CODE_CLOSE
end
-----------------------------------------------------------------------------
-- Availability tooltip code
-----------------------------------------------------------------------------
-- Populates the tooltip that displays on recipe button mouseover.
function RecipeRadar_Availability_CreateTooltip(recipe)
local recipe_name = RecipeRadar_GetSafeItemInfo(recipe.ID)
if (recipe_name == RRS("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 colon = string.find(warn, ":")
local warning =
RecipeRadar_ColorToCode(RecipeRadar_Colors.TooltipWarning) ..
string.sub(warn, 1, colon) .. FONT_COLOR_CODE_CLOSE ..
string.sub(warn, colon + 1)
-- the layout of the tooltip, with colors for each line
local tooltip = {
{ text = RRS("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 = "", 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 }, }
for _, line in tooltip do
RecipeRadar_AvailabilityTooltip_AddLine(line.text, line.color)
end
return
end
local avail, prosp, known, line_info = { }, { }, { }, { }
local num_avail, num_prosp, num_known = 0, 0, 0
-- recipe labels are not saved in the skill database
recipe_name = RecipeRadar_TrimRecipeLabel(recipe_name)
-- iterate through each character on this realm
for player, player_info in RecipeRadar_SkillDB[GetRealmName()] do
-- do the rest only if the character has the profession
if (player_info.Professions[recipe.Type] and
player_info.Professions[recipe.Type].Rank > 0) then
-- get player's rank
local rank = player_info.Professions[recipe.Type].Rank
-- get player's relevant faction standing, if any
local rep = nil
if (recipe.Faction and player_info.Factions[recipe.Faction]) then
rep = getglobal("FACTION_STANDING_LABEL" ..
player_info.Factions[recipe.Faction])
end
-- get player's specialty, if any
local spec = nil
if (recipe.Specialty) then
spec = player_info.Professions[recipe.Type].Specialty
end
-- now test all of the possible recipe statuses
if (RecipeRadar_Availability_IsAvailable(player, recipe)) then
num_avail = num_avail + 1
avail[num_avail] = {
Name = player, Rank = rank, Rep = rep, Spec = spec }
elseif (RecipeRadar_Availability_IsProspect(player, recipe)) then
num_prosp = num_prosp + 1
prosp[num_prosp] = {
Name = player, Rank = rank, Rep = rep, Spec = spec }
elseif (RecipeRadar_Availability_IsKnown(player, recipe)) then
num_known = num_known + 1
known[num_known] = {
Name = player, Rank = rank, Rep = rep, Spec = spec }
else
local bleh = 0
if (knows) then bleh = 1 end
RecipeRadar_Print("ASSERT FAILED: " .. player .. " - " ..
recipe.Type .. ", " .. recipe_name .. ", " .. recipe.Skill ..
" (have " .. rank .. ") knows = " .. bleh)
end
end
end
-- populate the "available now" entries
if (num_avail > 0) then
RecipeRadar_AvailabilityTooltip_AddLine(
RecipeRadar_Availabilities["LearnableByPlayer"].Tooltip.Heading,
RecipeRadar_Colors.TooltipHeading)
table.sort(avail, RecipeRadar_Availability_NameSort)
for _, line in avail do
local color = RecipeRadar_Colors.LearnableByAlt
if (line.Name == UnitName("player")) then
color = RecipeRadar_Colors.LearnableByPlayer
end
local rank_suffix = line.Rank
if (line.Rep) then -- reputation is relevant to this line
rank_suffix = rank_suffix .. " - " .. line.Rep
end
rank_suffix = format(TEXT(PARENS_TEMPLATE), rank_suffix)
RecipeRadar_AvailabilityTooltip_AddLine(
" " .. line.Name .. " " .. rank_suffix, color)
end
end
-- populate the "available soon" entries
if (num_prosp > 0) then
if (num_avail > 0) then
RecipeRadar_AvailabilityTooltip_AddLine()
end
RecipeRadar_AvailabilityTooltip_AddLine(
RecipeRadar_Availabilities["ProspectForPlayer"].Tooltip.Heading,
RecipeRadar_Colors.TooltipHeading)
table.sort(prosp, RecipeRadar_Availability_NameSort)
for _, line in prosp do
local color = RecipeRadar_Colors.ProspectForAlt
if (line.Name == UnitName("player")) then
color = RecipeRadar_Colors.ProspectForPlayer
end
local factors = RecipeRadar_Availability_GetLimitingFactors(
line.Name, recipe)
local rank = string.format(RRS("%d of %d"), line.Rank, recipe.Skill)
if (factors["rank"]) then
rank = RecipeRadar_HighlightString(rank, color)
end
local suffix = rank -- always include rank in the tooltip
if (line.Rep) then
local rep = line.Rep
if (factors["rep"]) then
rep = RecipeRadar_HighlightString(rep, color)
end
suffix = suffix .. " - " .. rep
end
if (line.Spec) then
local spec = line.Spec
if (factors["spec"]) then
spec = RecipeRadar_HighlightString(spec, color)
end
suffix = suffix .. " - " .. spec
end
suffix = format(TEXT(PARENS_TEMPLATE), suffix)
RecipeRadar_AvailabilityTooltip_AddLine(
" " .. line.Name .. " " .. suffix, color)
end
end
-- populate the "already known" entries
if (num_known > 0) then
if (num_prosp > 0 or num_avail > 0) then
RecipeRadar_AvailabilityTooltip_AddLine()
end
RecipeRadar_AvailabilityTooltip_AddLine(
RecipeRadar_Availabilities["KnownByPlayer"].Tooltip.Heading,
RecipeRadar_Colors.TooltipHeading)
table.sort(known, RecipeRadar_Availability_NameSort)
for _, line in known do
local color = RecipeRadar_Colors.KnownByAlt
if (line.Name == UnitName("player")) then
color = RecipeRadar_Colors.KnownByPlayer
end
local rank_suffix = line.Rank
if (line.Rep) then -- reputation is relevant to this line
rank_suffix = rank_suffix .. " - " .. line.Rep
end
rank_suffix = format(TEXT(PARENS_TEMPLATE), rank_suffix)
RecipeRadar_AvailabilityTooltip_AddLine(
" " .. line.Name .. " " .. rank_suffix, color)
end
end
end
-- Boolean test for availability used by CreateTooltip(), above
function RecipeRadar_Availability_NameSort(line1, line2)
return line1.Name < line2.Name
end
-- Returns a set of booleans from which one can derive the availability
-- of any recipe relative to any player.
function RecipeRadar_Availability_GetBooleans(player, recipe)
local info = RecipeRadar_SkillDB_GetSafePlayerDB(player)
-- if the player doesn't even have the profession, just return
if (not info.Professions[recipe.Type]) then return false end
local recipe_name = RecipeRadar_GetSafeItemInfo(recipe.ID)
recipe_name = RecipeRadar_TrimRecipeLabel(recipe_name)
if (recipe_name == RRS("Uncached Recipe")) then
return nil
end
-- otherwise, get the other relevant booleans
local has_rec = info.Professions[recipe.Type].Recipes[recipe_name]
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)
return true, has_rec, has_rank, has_rep, has_spec
end
-- Boolean test for availability used by CreateTooltip() and GetKey()
function RecipeRadar_Availability_IsAvailable(player, recipe)
local has_prof, has_rec, has_rank, has_rep, has_spec =
RecipeRadar_Availability_GetBooleans(player, recipe)
return (has_prof and not has_rec and has_rank and has_rep and has_spec)
end
-- Boolean test for availability used by CreateTooltip() and GetKey()
function RecipeRadar_Availability_IsProspect(player, recipe)
local has_prof, has_rec, has_rank, has_rep, has_spec =
RecipeRadar_Availability_GetBooleans(player, recipe)
return (has_prof and not has_rec and
(not has_rank or not has_rep or not has_spec))
end
-- Boolean test for availability used by CreateTooltip() and GetKey()
function RecipeRadar_Availability_IsKnown(player, recipe)
local has_prof, has_rec, has_rank, has_rep, has_spec =
RecipeRadar_Availability_GetBooleans(player, recipe)
return (has_prof and has_rec and has_rank and has_rep and has_spec)
end
-- Returns a table of strings that specify why the given recipe is not
-- available to the given player.
function RecipeRadar_Availability_GetLimitingFactors(player, recipe)
local has_prof, has_rec, has_rank, has_rep, has_spec =
RecipeRadar_Availability_GetBooleans(player, recipe)
local factors = { }
if (not has_prof) then factors["prof"] = 1 end
if (not has_rec) then factors["rec"] = 1 end
if (not has_rank) then factors["rank"] = 1 end
if (not has_rep) then factors["rep"] = 1 end
if (not has_spec) then factors["spec"] = 1 end
return factors
end
-----------------------------------------------------------------------------
-- Availability testing for filtering and dropdowns
-----------------------------------------------------------------------------
-- This function tests whether the recipe is learnable either by
-- the player or an alt if realm-wide availability is on.
function RecipeRadar_Availability_IsLearnable(recipe, set_filter)
local name = RecipeRadar_GetSafeItemInfo(recipe.ID)
local avail = RecipeRadar_Availability_GetKey(recipe)
if (not avail) then return false end
if (set_filter) then
recipe.IsFilteredByAvailability =
RecipeRadar_IsAvailabilityFiltered(avail)
end
if (RecipeRadar_Options.RealmAvailability) then
return avail == "LearnableByPlayer" or avail == "LearnableByAlt"
else
return avail == "LearnableByPlayer"
end
end
-- Wrapper for the above that makes its functionality clearer.
function RecipeRadar_Availability_SetAvailabilityFilter(recipe)
RecipeRadar_Availability_IsLearnable(recipe, true)
end
-- Generic function returns the key to the RecipeRadar_Availabilities
-- table so the caller can get whatever related info she needs.
function RecipeRadar_Availability_GetKey(recipe)
if (RecipeRadar_Availability_IsAvailable(player, recipe)) then
return "LearnableByPlayer"
elseif (RecipeRadar_Options.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
RecipeRadar_Availability_IsSatisfiedByAlt(recipe,
RecipeRadar_Availability_IsProspect)) then
return "ProspectForAlt"
elseif (RecipeRadar_Availability_IsKnown(player, recipe)) then
return "KnownByPlayer"
elseif (RecipeRadar_Options.RealmAvailability and
RecipeRadar_Availability_IsSatisfiedByAlt(recipe,
RecipeRadar_Availability_IsKnown)) then
return "KnownByAlt"
else
return "NotApplicable"
end
end
-- Boolean test for availability used by GetKey(), above.
function RecipeRadar_Availability_IsSatisfiedByAlt(recipe, sat_func)
for player, player_info in RecipeRadar_SkillDB[GetRealmName()] do
if (player_info.Team ~= RecipeRadar_GetOpposingFaction("player") and
player ~= UnitName("player") and
sat_func(player, recipe)) then
return true
end
end
return false
end
+98
View File
@@ -0,0 +1,98 @@
-- AvailabilityTooltip.lua: handles the recipe availability tooltip
-- $Id: AvailabilityTooltip.lua 282 2006-04-12 08:41:25Z jnmiller $
function RecipeRadar_AvailabilityTooltip_AddLine(msg, color)
if (RecipeRadarAvailabilityTooltip.Lines ==
RecipeRadar_AvailabilityTooltip_MaxLines) then
RecipeRadar_Print("ASSERT FAILED: tooltip has too many lines.")
return
end
local line_num = RecipeRadarAvailabilityTooltip.Lines + 1
local line = getglobal("RecipeRadarAvailabilityTooltipText" .. line_num)
-- handle null colors
if (color) then
line:SetTextColor(color.r, color.g, color.b)
else
line:SetTextColor(1, 1, 1)
end
-- handle null messages
if (not msg or msg == "") then
line:SetText(" ")
else
line:SetText(msg)
end
line:Show()
RecipeRadarAvailabilityTooltip.Lines = line_num
end
function RecipeRadar_AvailabilityTooltip_Show(frame)
if (not frame or RecipeRadarAvailabilityTooltip.Lines == 0) then
RecipeRadar_AvailabilityTooltip_Hide()
return
end
-- calculate the width of the tooltip
local height = 20
local width = 0
for i = 1, RecipeRadarAvailabilityTooltip.Lines do
local line = getglobal("RecipeRadarAvailabilityTooltipText" .. i)
height = height + line:GetHeight() + 2
if (line:GetWidth() + 20 > width) then
width = line:GetWidth() + 20
end
end
RecipeRadarAvailabilityTooltip:SetWidth(width)
RecipeRadarAvailabilityTooltip:SetHeight(height)
RecipeRadarAvailabilityTooltip:ClearAllPoints()
-- place on the left or right according to the position of the main frame
local frame_left = (frame:GetLeft() or 0) - width
local frame_right = GetScreenWidth() - (frame:GetRight() or 0) - width
local offset = 0
if (RecipeRadar_Options.ActiveTab == 2) then
offset = RECIPERADAR_VENDOR_OFFSET
end
if (frame_left < frame_right) then
if (RecipeRadarListScrollFrame:IsVisible()) then
RecipeRadarAvailabilityTooltip:SetPoint(
"TOPLEFT", frame:GetName(), "TOPRIGHT", 35, 0)
else
RecipeRadarAvailabilityTooltip:SetPoint(
"TOPLEFT", frame:GetName(), "TOPRIGHT", 13, 0)
end
else
RecipeRadarAvailabilityTooltip:SetPoint(
"TOPRIGHT", frame:GetName(), "TOPLEFT", -33 + offset, 0)
end
-- basic drawing code
RecipeRadarAvailabilityTooltip:SetBackdropColor(
TOOLTIP_DEFAULT_BACKGROUND_COLOR.r,
TOOLTIP_DEFAULT_BACKGROUND_COLOR.g,
TOOLTIP_DEFAULT_BACKGROUND_COLOR.b)
RecipeRadarAvailabilityTooltip:Show()
end
function RecipeRadar_AvailabilityTooltip_Hide()
for i = 1, RecipeRadarAvailabilityTooltip.Lines do
getglobal("RecipeRadarAvailabilityTooltipText" .. i):Hide()
end
RecipeRadarAvailabilityTooltip.Lines = 0
--RecipeRadarAvailabilityTooltip:Hide()
end
+176
View File
@@ -0,0 +1,176 @@
<?xml version="1.0" encoding="utf-8" ?>
<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="NameMap.lua"/>
<Script file="SkillDB.lua"/>
<Script file="AvailabilityTooltip.lua"/>
<Script file="Availability.lua"/>
<Frame name="RecipeRadarAvailabilityTooltip" inherits="GameTooltipTemplate" frameStrata="TOOLTIP" parent="UIParent" hidden="true">
<Scripts>
<OnLoad>
-- this allows for 18 alts per server, though I think 8 is the max
RecipeRadar_AvailabilityTooltip_MaxLines = 24
RecipeRadarAvailabilityTooltip.Lines = 0
</OnLoad>
<OnHide>
RecipeRadar_AvailabilityTooltip_Hide()
</OnHide>
</Scripts>
<Layers>
<Layer level="ARTWORK">
<FontString name="$parentText1" inherits="GameFontNormalSmall" hidden="true">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="10" y="-10"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentText2" inherits="GameFontNormalSmall" hidden="true">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentText1" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-2"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentText3" inherits="GameFontNormalSmall" hidden="true">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentText2" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-2"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentText4" inherits="GameFontNormalSmall" hidden="true">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentText3" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-2"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentText5" inherits="GameFontNormalSmall" hidden="true">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentText4" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-2"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentText6" inherits="GameFontNormalSmall" hidden="true">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentText5" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-2"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentText7" inherits="GameFontNormalSmall" hidden="true">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentText6" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-2"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentText8" inherits="GameFontNormalSmall" hidden="true">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentText7" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-2"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentText9" inherits="GameFontNormalSmall" hidden="true">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentText8" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-2"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentText10" inherits="GameFontNormalSmall" hidden="true">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentText9" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-2"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentText11" inherits="GameFontNormalSmall" hidden="true">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentText10" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-2"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentText12" inherits="GameFontNormalSmall" hidden="true">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentText11" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-2"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentText13" inherits="GameFontNormalSmall" hidden="true">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentText12" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-2"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentText14" inherits="GameFontNormalSmall" hidden="true">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentText13" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-2"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentText15" inherits="GameFontNormalSmall" hidden="true">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentText14" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-2"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentText16" inherits="GameFontNormalSmall" hidden="true">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentText15" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-2"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
</Frame>
</UI>
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<Bindings>
<Binding name="RECIPERADAR_TOGGLE" header="RECIPERADAR_HEADER">
RecipeRadar_Toggle()
</Binding>
</Bindings>
+107
View File
@@ -0,0 +1,107 @@
Recipe Radar (vanilla) ChangeLog
v1.14; 2.02.2017
- Added MBB compatibility (better minimap button managment),
- Added RUru localization by Maus
- backported some fixes from original 1.14 release
v1.11; September 18, 2006
- Fixed item linking bug (thank you, TDurden!).
- Fixed a bug that could occur for unlucky Dragonscale/Elemental LWers
and Armorsmiths (thank you, Arilaw!).
v1.10; September 16, 2006
- I'd forgotten to enable specialization checking! It should now work.
- Auctioneer and Recipe Book are now supported in the recipe icon
mouseover. Thanks very much to borohir for this functionality!
v1.9; September 5, 2006
- Recipes names are now cached when learned. This should make new
Blizzard patches less of a hassle.
- Availability checking now takes faction reputation and trade skill
specialties into account.
- Adjusted some vendor information.
- Reduced memory usage significantly.
v1.8; July 11, 2006
- Several new German region names were missing in v1.7. Hopefully they
are all correct now.
- Adjusted some vendor information.
v1.7; June 24, 2006
- Fixed the nasty profession selection bug for non-English versions.
- Profession icons should now show up for non-English versions.
- Unlearning a profession should now be handled correctly.
- Fixed several new 1.11 German region names.
- Added the new 1.11 Cenarion Circle recipes.
- Several vendors were incorrectly marked as Alliance-only (thank you,
Howlin!).
v1.6; June 21, 2006
- Added a right-click context menu to the scroll frame. From this
menu users can map vendors and expand/collapse all items.
- Fixed bug causing non-English profession stuff to suck (thank you
ElKano and Jeremy Gurr!).
- Alts of a different team should no longer appear in the availability
list.
- Adjusted the German translation.
- Adjusted some vendor locations.
v1.5; May 11, 2006
- All recipes that are named differently after learning (eg. transmutes)
should now show up correctly as known or not. This applies, in theory,
to all locales.
- Revamped the filtering code and fixed filtering, I hope, for non-
English versions.
- Nonapplicable professions and known recipes are now different filtering
categories in both availability modes.
- Fixed the incompatibility with Metamap, more or less.
- Tweaked the German translation and some vendor locations.
v1.4; May 7, 2006
- Revised German translation (thanks to DJMars and Elkano!).
- Dropdown filters are now effected every time Recipe Radar is opened.
Filters should now work much more intuitively.
- Fixed a bug that sometimes caused an error message on startup and/or
zone changes.
- Changed Alliance color to blue.
- Added a couple of missing vendors/recipes and improved the positions of
several others.
- Enchant Bracer - Healing should now show up correctly as known or not.
v1.3; April 29, 2006
- Fixed a bug that was preventing about half of the maps from displaying
on non-English clients.
- Adjusted some vendor locations.
v1.2; April 28, 2006
- Fixed chat message parsing bugs in non-English versions.
- Added an option to auto-map (but not auto-unmap!) contributive vendors.
- Added the number of learnable recipes to mapped vendor tooltips.
- Changed the '/rr' slash command to '/rrdr'.
- Map tooltips will hopefully no longer run off the screen.
v1.1; April 27, 2006
- Added support for the frFR locale. (I hope it works..)
- Added the ability to view regions other than the current region. The
relevant settings now appear in the Options frame.
- Instance vendors can no longer be mapped.
- Non-English versions should now be able to use the dropdowns (I hope).
- Now accounting for WoW's "Mithril Head Trout" bug - it should now show
up correctly as known or not.
v1.0; April 24, 2006
- Initial public release!
+546
View File
@@ -0,0 +1,546 @@
-- DropDowns.lua: code concerned the dropdowns and corresponding filters
-- $Id: DropDowns.lua 433 2006-08-31 20:22:07Z jnmiller $
function RecipeRadar_DropDowns_Init()
-- can't use the OnLoad events because we use saved variables
RecipeRadar_TeamDropDown_OnLoad()
RecipeRadar_Prof1DropDown_OnLoad()
RecipeRadar_RealmAvailDropDown_OnLoad()
RecipeRadar_Prof2DropDown_OnLoad()
RecipeRadar_PersonAvailDropDown_OnLoad()
-- initialize the recipe filters and recipe tab icon
RecipeRadar_SetProf2Filter(RecipeRadar_Options.CurrentProfession)
if (RecipeRadar_Options.RealmAvailability) then
return RecipeRadar_RealmAvailDropDown:Show()
else
return RecipeRadar_PersonAvailDropDown:Show()
end
end
-----------------------------------------------------------------------------
-- Realm-wide availability drop down and filtering
-----------------------------------------------------------------------------
function RecipeRadar_RealmAvailDropDown_OnLoad()
local dropdown = getglobal("RecipeRadar_RealmAvailDropDown")
UIDropDownMenu_Initialize(dropdown, RecipeRadar_RealmAvailDropDown_Init)
UIDropDownMenu_SetText(RRS("Availability"), dropdown)
UIDropDownMenu_SetWidth(135, RecipeRadar_RealmAvailDropDown)
end
function RecipeRadar_RealmAvailDropDown_Init()
-- sort our drop down list by table-specified order
local t = { }
for key, val in RecipeRadar_Availabilities do
t[val.DropDown.ROrder] = key
end
for _, key in t do
local info = RecipeRadar_Availabilities[key]
local checked, item = nil, { }
item.text = RecipeRadar_ColorToCode(info.Color) ..
info.Text .. FONT_COLOR_CODE_CLOSE
item.value = key
item.func = RecipeRadar_RealmAvailDropDown_OnClick
item.checked = not RecipeRadar_IsRealmAvailFiltered(key)
item.keepShownOnClick = 1
UIDropDownMenu_AddButton(item)
end
end
function RecipeRadar_RealmAvailDropDown_OnClick()
-- the logic here seems backwards, doesn't it?
if (UIDropDownMenuButton_GetChecked()) then
RecipeRadar_SetRealmAvailFilter(this.value, true)
else
RecipeRadar_SetRealmAvailFilter(this.value, false)
end
RecipeRadarListScrollFrameScrollBar:SetValue(0)
end
function RecipeRadar_IsRealmAvailFiltered(avail)
return RecipeRadar_Filters.RealmAvails[avail]
end
function RecipeRadar_SetRealmAvailFilter(avail, is_filtered)
RecipeRadar_Filters.RealmAvails[avail] = is_filtered
-- we filter out vendors here to keep the Update() quick
RecipeRadar_FilterVendors("avail", avail, is_filtered)
RecipeRadar_FilterRecipes("avail", avail, is_filtered)
RecipeRadar_FrameUpdate()
end
-----------------------------------------------------------------------------
-- Personal availability drop down and filtering
-----------------------------------------------------------------------------
function RecipeRadar_PersonAvailDropDown_OnLoad()
local dropdown = getglobal("RecipeRadar_PersonAvailDropDown")
UIDropDownMenu_Initialize(dropdown, RecipeRadar_PersonAvailDropDown_Init)
UIDropDownMenu_SetText(RRS("Availability"), dropdown)
UIDropDownMenu_SetWidth(135, RecipeRadar_PersonAvailDropDown)
end
function RecipeRadar_PersonAvailDropDown_Init()
-- sort our drop down list by table-specified order
local t = { }
for key, val in RecipeRadar_Availabilities do
if (val.DropDown.POrder) then
t[val.DropDown.POrder] = key
end
end
for _, key in t do
local info = RecipeRadar_Availabilities[key]
local checked, item = nil, { }
item.text = RecipeRadar_ColorToCode(info.Color) ..
info.Text .. FONT_COLOR_CODE_CLOSE
item.value = key
item.func = RecipeRadar_PersonAvailDropDown_OnClick
item.checked = not RecipeRadar_IsPersonAvailFiltered(key)
item.keepShownOnClick = 1
UIDropDownMenu_AddButton(item)
end
end
function RecipeRadar_PersonAvailDropDown_OnClick()
-- the logic here seems backwards, doesn't it?
if (UIDropDownMenuButton_GetChecked()) then
RecipeRadar_SetPersonAvailFilter(this.value, true)
else
RecipeRadar_SetPersonAvailFilter(this.value, false)
end
RecipeRadarListScrollFrameScrollBar:SetValue(0)
end
function RecipeRadar_IsPersonAvailFiltered(avail)
return RecipeRadar_Filters.PersonAvails[avail]
end
function RecipeRadar_SetPersonAvailFilter(avail, is_filtered)
RecipeRadar_Filters.PersonAvails[avail] = is_filtered
-- we filter out vendors here to keep the Update() quick
RecipeRadar_FilterVendors("avail", avail, is_filtered)
RecipeRadar_FilterRecipes("avail", avail, is_filtered)
RecipeRadar_FrameUpdate()
end
-- Generic tester for those who don't care about the current mode.
function RecipeRadar_IsAvailabilityFiltered(avail)
if (RecipeRadar_Options.RealmAvailability) then
return RecipeRadar_IsRealmAvailFiltered(avail)
else
return RecipeRadar_IsPersonAvailFiltered(avail)
end
end
-----------------------------------------------------------------------------
-- Teams/factions drop down and filtering
-----------------------------------------------------------------------------
function RecipeRadar_TeamDropDown_OnLoad()
local dropdown = getglobal("RecipeRadar_TeamDropDown")
UIDropDownMenu_Initialize(dropdown, RecipeRadar_TeamDropDown_Init)
UIDropDownMenu_SetText(RRS("Factions"), dropdown)
UIDropDownMenu_SetWidth(112, RecipeRadar_TeamDropDown)
end
function RecipeRadar_TeamDropDown_Init()
-- sort our drop down list by table key
local t = { }
table.foreach(RecipeRadar_Teams,
function (k) table.insert(t, k) end)
table.sort(t)
for _, key in t do
local info = RecipeRadar_Teams[key]
local checked, item = nil, { }
item.text = RecipeRadar_ColorToCode(info.Color) ..
info.Name .. FONT_COLOR_CODE_CLOSE
item.value = key
item.func = RecipeRadar_TeamDropDown_OnClick
item.checked = not RecipeRadar_IsTeamFiltered(key)
item.keepShownOnClick = 1
UIDropDownMenu_AddButton(item)
end
end
function RecipeRadar_TeamDropDown_OnClick()
-- the logic here seems backwards, doesn't it?
if (UIDropDownMenuButton_GetChecked()) then
RecipeRadar_SetTeamFilter(this.value, true)
else
RecipeRadar_SetTeamFilter(this.value, false)
end
RecipeRadarListScrollFrameScrollBar:SetValue(0)
end
function RecipeRadar_IsTeamFiltered(team)
return RecipeRadar_Filters.Teams[team]
end
function RecipeRadar_SetTeamFilter(team, is_filtered)
RecipeRadar_Filters.Teams[team] = is_filtered
-- we filter out vendors here to keep the Update() quick
RecipeRadar_FilterVendors("team", team, is_filtered)
RecipeRadar_FilterRecipes("team", team, is_filtered)
RecipeRadar_FrameUpdate()
end
-----------------------------------------------------------------------------
-- Multi-select professions drop down and filtering (for radar tab)
-----------------------------------------------------------------------------
function RecipeRadar_Prof1DropDown_OnLoad()
local dropdown = getglobal("RecipeRadar_Prof1DropDown")
UIDropDownMenu_Initialize(dropdown, RecipeRadar_Prof1DropDown_Init)
UIDropDownMenu_SetText(RRS("Professions"), dropdown)
UIDropDownMenu_SetWidth(135, RecipeRadar_Prof1DropDown)
end
function RecipeRadar_Prof1DropDown_Init()
-- sort our drop down list by table key
local t = { }
table.foreach(RecipeRadar_Professions,
function (k) table.insert(t, k) end)
table.sort(t)
for _, key in t do
local info = RecipeRadar_Professions[key]
local checked, item = nil, { }
item.text = info.Name
item.value = key
item.func = RecipeRadar_Prof1DropDown_OnClick
item.checked = not RecipeRadar_IsProfFiltered(key)
item.keepShownOnClick = 1
UIDropDownMenu_AddButton(item)
end
end
function RecipeRadar_Prof1DropDown_OnClick()
-- the logic here seems backwards, doesn't it?
if (UIDropDownMenuButton_GetChecked()) then
RecipeRadar_SetProfFilter(this.value, true)
else
RecipeRadar_SetProfFilter(this.value, false)
end
RecipeRadarListScrollFrameScrollBar:SetValue(0)
end
function RecipeRadar_IsProfFiltered(prof)
return RecipeRadar_Filters.Professions[prof]
end
function RecipeRadar_SetProfFilter(prof, is_filtered)
RecipeRadar_Filters.Professions[prof] = is_filtered
-- we filter out vendors here to keep the Update() quick
RecipeRadar_FilterVendors("prof", prof, is_filtered)
RecipeRadar_FrameUpdate()
end
-----------------------------------------------------------------------------
-- Single-select professions drop down and filtering (for recipes tab)
-----------------------------------------------------------------------------
function RecipeRadar_Prof2DropDown_OnLoad()
local dropdown = getglobal("RecipeRadar_Prof2DropDown")
UIDropDownMenu_Initialize(dropdown, RecipeRadar_Prof2DropDown_Init)
UIDropDownMenu_SetText(RRS("Professions"), dropdown)
UIDropDownMenu_SetWidth(135, RecipeRadar_Prof2DropDown)
end
function RecipeRadar_Prof2DropDown_Init()
-- sort our drop down list by table key
local t = { }
table.foreach(RecipeRadar_Professions,
function (k) table.insert(t, k) end)
table.sort(t)
for _, key in t do
local info = RecipeRadar_Professions[key]
local checked, item = nil, { }
if (RecipeRadar_IsCurrentProfession(key)) then
checked = 1
end
item.text = info.Name
item.value = key
item.func = RecipeRadar_Prof2DropDown_OnClick
item.checked = checked
UIDropDownMenu_AddButton(item)
end
end
function RecipeRadar_Prof2DropDown_OnClick()
UIDropDownMenu_SetSelectedID(RecipeRadar_Prof2DropDown, this:GetID())
RecipeRadar_SetProf2Filter(this.value)
RecipeRadarListScrollFrameScrollBar:SetValue(0)
end
function RecipeRadar_IsCurrentProfession(prof)
return RecipeRadar_Options.CurrentProfession == prof
end
function RecipeRadar_SetProf2Filter(prof)
RecipeRadarRecipesTabFrame:SetNormalTexture(
RecipeRadar_Professions[prof].Icon)
RecipeRadar_Options.CurrentProfession = prof
RecipeRadar_InitRecipeFilters()
RecipeRadar_FrameUpdate()
end
-----------------------------------------------------------------------------
-- Radar tab filtering code
-----------------------------------------------------------------------------
-- Checks for recipe filtering by either profession or availability.
function RecipeRadar_IsRecipeFiltered(recipe)
return recipe.IsFilteredByTeam or recipe.IsFilteredByProfession or
recipe.IsFilteredByAvailability
end
-- Iterate through all vendors or recipes and set their filter state.
-- This function is only useful for the radar tab, not the recipes tab.
-- filter_type is one of 'team', 'prof' or 'avail', filter_on is the
-- 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]
if (not region) then return end
for _, vendor in region.Vendors do
-- this bit filters vendors by their team
if (filter_type == "team" and filter_on == vendor.Team) then
vendor.IsFiltered = is_filtered
-- if the to-be-filtered vendor is "active", unselect her
if (RecipeRadarRadarTabFrame.SelectedVendor == vendor) then
RecipeRadar_RadarTab_ClearSelection()
end
-- this bit filters recipes by their profession
elseif (filter_type == "prof") then
for _, recipe in vendor.Recipes do
if (filter_on == recipe.Type) then
recipe.IsFilteredByProfession = is_filtered
-- if the to-be-filtered recipe is selected, unselect it
if (RecipeRadarRadarTabFrame.SelectedRecipe == recipe) then
RecipeRadar_RadarTab_ClearSelection()
end
end
end
-- this bit filters recipes by their availability state
elseif (filter_type == "avail") then
for _, recipe in vendor.Recipes do
if (filter_on == RecipeRadar_Availability_GetKey(recipe)) then
recipe.IsFilteredByAvailability = is_filtered
-- if the to-be-filtered recipe is selected, unselect it
if (RecipeRadarRadarTabFrame.SelectedRecipe == recipe) then
RecipeRadar_RadarTab_ClearSelection()
end
end
end
end
end
end
-- Initializes vendor/recipe filters according to saved filter settings.
function RecipeRadar_InitVendorFilters()
local region = RecipeRadar_RegionData[RecipeRadar_Options.CurrentRegion]
if (not region) then return end
for _, vendor in region.Vendors do
-- set team filter
vendor.IsFiltered = RecipeRadar_IsTeamFiltered(vendor.Team)
for _, recipe in vendor.Recipes do
-- set profession filter
recipe.IsFilteredByProfession =
RecipeRadar_IsProfFiltered(recipe.Type)
-- set availability filter (the 'true') and auto-map if necessary
if (RecipeRadar_Availability_IsLearnable(recipe, true) and
RecipeRadar_Options.AutoMapVendors) then
RecipeRadar_Maps_AddVendor(vendor,
RecipeRadar_Options.CurrentRegion)
end
end
end
end
-----------------------------------------------------------------------------
-- Recipes tab filtering code
-----------------------------------------------------------------------------
-- Iterate through all recipes and set their filter state.
-- This function is only useful for the recipes tab, not the radar tab.
-- filter_type is one of 'team' or 'avail', filter_on is the
-- 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]
for _, recipe in prof.Recipes do
-- this bit filters recipes by their availability state
if (filter_type == "avail" and
filter_on == RecipeRadar_Availability_GetKey(recipe)) then
recipe.IsFilteredByAvailability = is_filtered
-- if the to-be-filtered recipe is "active", unselect it
if (RecipeRadarRecipesTabFrame.SelectedRecipe == recipe) then
RecipeRadar_RecipesTab_ClearSelection()
end
-- this bit filters vendors by their team
elseif (filter_type == "team") then
for _, location in recipe.Locations do
if (filter_on == location.Team) then
location.IsFiltered = is_filtered
-- if the to-be-filtered recipe is selected, unselect it
if (RecipeRadarRecipesTabFrame.SelectedLocation ==
location.Region) then
RecipeRadar_RecipesTab_ClearSelection()
end
end
end
end
end
end
-- Initializes vendor/recipe filters according to saved filter settings.
function RecipeRadar_InitRecipeFilters()
local prof = RecipeRadar_RecipeData[RecipeRadar_Options.CurrentProfession]
if (not prof) then return end
for _, recipe in prof.Recipes do
-- set availability filter (the 'true')
RecipeRadar_Availability_SetAvailabilityFilter(recipe)
for _, location in recipe.Locations do
-- set team filter
location.IsFiltered = RecipeRadar_IsTeamFiltered(location.Team)
end
end
end
+288
View File
@@ -0,0 +1,288 @@
<?xml version="1.0" encoding="utf-8" ?>
<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">
<Button name="RecipeRadarVendorButtonTemplate" hidden="true" virtual="true">
<Size>
<AbsDimension x="393" y="16"/>
</Size>
<Layers>
<Layer level="BACKGROUND">
<FontString name="$parentSubText" inherits="GameFontNormalSmall" justifyH="LEFT"/>
<Texture name="$parentCheck" file="Interface\Buttons\UI-CheckBox-Check" hidden="true">
<Size>
<AbsDimension x="16" y="16"/>
</Size>
<Anchors>
<Anchor point="LEFT">
<Offset>
<AbsDimension x="50" y="0"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
</Layer>
</Layers>
<Scripts>
<OnLoad>
this:SetFrameLevel(this:GetFrameLevel() + 1)
this:RegisterForClicks("LeftButtonUp", "RightButtonUp")
</OnLoad>
<OnClick>
RecipeRadar_VendorButton_OnClick(arg1)
</OnClick>
<OnEnter>
if (this.r) then
getglobal(this:GetName() .. "SubText"):SetTextColor(this.r + RecipeRadar_Colors.Highlight, this.g + RecipeRadar_Colors.Highlight, this.b + RecipeRadar_Colors.Highlight)
end
if (RecipeRadar_Options.RealmAvailability and this.Recipe) then
RecipeRadar_Availability_CreateTooltip(this.Recipe)
RecipeRadar_AvailabilityTooltip_Show(this)
end
</OnEnter>
<OnLeave>
getglobal(this:GetName() .. "SubText"):SetTextColor(this.r, this.g, this.b)
RecipeRadarAvailabilityTooltip:Hide()
</OnLeave>
<OnMouseDown>
getglobal(this:GetName() .. "SubText"):SetPoint("LEFT", this:GetName() .. "Text", "RIGHT", 11, -1)
</OnMouseDown>
<OnMouseUp>
getglobal(this:GetName() .. "SubText"):SetPoint("LEFT", this:GetName() .. "Text", "RIGHT", 10, 0)
</OnMouseUp>
</Scripts>
<NormalTexture>
<Size>
<AbsDimension x="16" y="16"/>
</Size>
<Anchors>
<Anchor point="LEFT">
<Offset>
<AbsDimension x="3" y="0"/>
</Offset>
</Anchor>
</Anchors>
</NormalTexture>
<HighlightTexture name="$parentHighlight" alphaMode="ADD">
<Size>
<AbsDimension x="16" y="16"/>
</Size>
<Anchors>
<Anchor point="LEFT">
<Offset>
<AbsDimension x="3" y="0"/>
</Offset>
</Anchor>
</Anchors>
</HighlightTexture>
<DisabledTexture file="Interface\Buttons\UI-PlusButton-Disabled">
<Size>
<AbsDimension x="16" y="16"/>
</Size>
<Anchors>
<Anchor point="LEFT">
<Offset>
<AbsDimension x="3" y="0"/>
</Offset>
</Anchor>
</Anchors>
</DisabledTexture>
<NormalText name="$parentText" inherits="GameFontNormal" justifyH="LEFT">
<Size>
<AbsDimension x="0" y="0"/>
</Size>
<Anchors>
<Anchor point="LEFT" relativeTo="$parentHighlight" relativePoint="RIGHT">
<Offset>
<AbsDimension x="2" y="1"/>
</Offset>
</Anchor>
</Anchors>
</NormalText>
<HighlightText name="$parentHighlightText" inherits="GameFontHighlight" justifyH="LEFT">
<Size>
<AbsDimension x="0" y="0"/>
</Size>
<Anchors>
<Anchor point="LEFT" relativeTo="$parentHighlight" relativePoint="RIGHT">
<Offset>
<AbsDimension x="2" y="1"/>
</Offset>
</Anchor>
</Anchors>
</HighlightText>
<DisabledText name="$parentDisabledText" inherits="GameFontDisable" justifyH="LEFT">
<Size>
<AbsDimension x="0" y="0"/>
</Size>
<Anchors>
<Anchor point="LEFT" relativeTo="$parentHighlight" relativePoint="RIGHT">
<Offset>
<AbsDimension x="2" y="1"/>
</Offset>
</Anchor>
</Anchors>
</DisabledText>
</Button>
<Button name="RecipeRadarScrollTemplate" hidden="true" virtual="true">
<Size>
<AbsDimension x="16" y="16"/>
</Size>
<Anchors>
<Anchor point="CENTER" relativeTo="RecipeRadarMapFrame" relativePoint="TOPLEFT"/>
</Anchors>
<Scripts>
<OnEnter>
RecipeRadar_Maps_SetTooltip(GameTooltip, this)
</OnEnter>
<OnLeave>
GameTooltip:Hide()
</OnLeave>
</Scripts>
<NormalTexture file="Interface\Addons\RecipeRadar\Images\Misc\Scroll"/>
</Button>
<ScrollFrame name="RecipeRadarDetailScrollFrameTemplate" inherits="UIPanelScrollFrameTemplate" virtual="true">
<Layers>
<Layer level="BACKGROUND">
<Texture name="$parentTop" file="Interface\RecipeRadarFrame\UI-RecipeRadar-ScrollBar">
<Size>
<AbsDimension x="30" y="123"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="-2" y="5"/>
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0" right="0.46875" top="0" bottom="0.9609375"/>
</Texture>
<Texture name="$parentBottom" file="Interface\RecipeRadarFrame\UI-RecipeRadar-ScrollBar">
<Size>
<AbsDimension x="30" y="123"/>
</Size>
<Anchors>
<Anchor point="BOTTOMLEFT" relativePoint="BOTTOMRIGHT">
<Offset>
<AbsDimension x="-2" y="-1"/>
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0.53125" right="1.0" top="0.03125" bottom="1.0"/>
</Texture>
</Layer>
</Layers>
<Scripts>
<OnLoad>
ScrollFrame_OnLoad()
this.scrollBarHideable = 1
</OnLoad>
</Scripts>
</ScrollFrame>
<ScrollFrame name="RecipeRadarListScrollFrameTemplate" inherits="FauxScrollFrameTemplate" virtual="true">
<Layers>
<Layer level="BACKGROUND">
<Texture file="Interface\ClassTrainerFrame\UI-ClassTrainer-ScrollBar">
<Size>
<AbsDimension x="30" y="120"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="-3" y="2"/>
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0" right="0.46875" top="0.0234375" bottom="0.9609375"/>
</Texture>
<Texture file="Interface\ClassTrainerFrame\UI-ClassTrainer-ScrollBar">
<Size>
<AbsDimension x="30" y="123"/>
</Size>
<Anchors>
<Anchor point="BOTTOMLEFT" relativePoint="BOTTOMRIGHT">
<Offset>
<AbsDimension x="-3" y="-2"/>
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0.53125" right="1.0" top="0.03125" bottom="1.0"/>
</Texture>
</Layer>
</Layers>
</ScrollFrame>
<Button name="RecipeRadarTabButtonTemplate" virtual="true">
<Size>
<AbsDimension x="53" y="29"/>
</Size>
<Scripts>
<OnMouseDown>
getglobal(this:GetName() .. "Normal"):SetPoint("LEFT", 21, 1)
getglobal(this:GetName() .. "Highlight"):SetPoint("LEFT", 21, 1)
</OnMouseDown>
<OnMouseUp>
getglobal(this:GetName() .. "Normal"):SetPoint("LEFT", 20, 2)
getglobal(this:GetName() .. "Highlight"):SetPoint("LEFT", 20, 2)
</OnMouseUp>
</Scripts>
<Layers>
<Layer level="BACKGROUND">
<Texture name="$parentLeft" file="Interface\ClassTrainerFrame\UI-ClassTrainer-ExpandTab-Left">
<Size>
<AbsDimension x="8" y="33"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT"/>
</Anchors>
</Texture>
<Texture name="$parentMiddle" file="Interface\QuestFrame\UI-QuestLogSortTab-Middle">
<Size>
<AbsDimension x="38" y="33"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentLeft" relativePoint="TOPRIGHT"/>
</Anchors>
</Texture>
<Texture name="$parentRight" file="Interface\QuestFrame\UI-QuestLogSortTab-Right">
<Size>
<AbsDimension x="8" y="33"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentMiddle" relativePoint="TOPRIGHT"/>
</Anchors>
</Texture>
</Layer>
</Layers>
<NormalTexture name="$parentNormal">
<Size>
<AbsDimension x="16" y="16"/>
</Size>
<Anchors>
<Anchor point="LEFT">
<Offset>
<AbsDimension x="19" y="2"/>
</Offset>
</Anchor>
</Anchors>
</NormalTexture>
<HighlightTexture name="$parentHighlight" alphaMode="ADD">
<Size>
<AbsDimension x="16" y="16"/>
</Size>
<Anchors>
<Anchor point="LEFT">
<Offset>
<AbsDimension x="19" y="2"/>
</Offset>
</Anchor>
</Anchors>
</HighlightTexture>
</Button>
</UI>
+267
View File
@@ -0,0 +1,267 @@
-- Globals.lua: global/saved variables and some related initialization code
-- $Id: Globals.lua 466 2006-09-18 18:10:31Z jnmiller $
RECIPERADAR_VERSION = GetAddOnMetadata("RecipeRadar", "Version");
RECIPERADAR_VENDORS_DISPLAYED = 8
RECIPERADAR_VENDOR_HEIGHT = 16
RECIPERADAR_VENDOR_OFFSET = 20
RECIPERADAR_IMAGE_ROOT = "Interface\\Addons\\RecipeRadar\\Images\\"
-- 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")
RecipeRadar_Options = { }
RecipeRadar_Filters = {
Teams = { },
Professions = { },
RealmAvails = { },
PersonAvails = { },
}
RecipeRadar_Colors = {
MainFont = { r = 1.0, g = 0.75, b = 0.0 },
Alliance = { r = 0.5, g = 0.625, b = 1.0 },
Horde = { r = 1.0, g = 0.125, b = 0.25 },
Neutral = { r = 1.0, g = 0.82, b = 0.0 },
LightGray = { r = 0.9, g = 0.9, b = 0.9 },
UncachedRecipe = { r = 0.75, g = 0.75, b = 0.75 },
DisabledGray = { r = 0.5, g = 0.5, b = 0.5 },
TooltipHeading = { r = 0.9, g = 0.9, b = 0.9 },
TooltipWarning = { r = 1.0, g = 0.3, b = 0.3 },
-- realm-wide availability tooltip/indicator colors
LearnableByPlayer = { r = 0.0, g = 1.0, b = 0.0 },
LearnableByAlt = { r = 0.0, g = 0.8, b = 0.0 },
ProspectForPlayer = { r = 1.0, g = 0.2, b = 0.2 },
ProspectForAlt = { r = 0.8, g = 0.2, b = 0.2 },
KnownByPlayer = { r = 0.7, g = 0.7, b = 0.7 },
KnownByAlt = { r = 0.5, g = 0.5, b = 0.5 },
NotApplicable = { r = 0.5, g = 0.5, b = 0.5 },
-- person-wide availability tooltip/indicator colors
Available = GREEN_FONT_COLOR,
Unavailable = RED_FONT_COLOR,
AlreadyKnown = GRAY_FONT_COLOR,
-- amount that colors will be phased to highlight the text
Highlight = 0.2,
}
RecipeRadar_Continents = {
[0] = RRS("Instances"),
[1] = RRS("Kalimdor"),
[2] = RRS("Eastern Kingdoms"),
}
RecipeRadar_Teams = {
["Alliance"] = {
Name = FACTION_ALLIANCE,
Color = RecipeRadar_Colors.Alliance,
},
["Horde"] = {
Name = FACTION_HORDE,
Color = RecipeRadar_Colors.Horde,
},
["Neutral"] = {
Name = RRS("Neutral"),
Color = RecipeRadar_Colors.Neutral,
},
}
RecipeRadar_Professions = {
[RRS("Alchemy")] = {
Name = RRS("Alchemy"),
Icon = RECIPERADAR_IMAGE_ROOT .. "Icons\\" .. "Alchemy",
},
[RRS("Blacksmithing")] = {
Name = RRS("Blacksmithing"),
Icon = RECIPERADAR_IMAGE_ROOT .. "Icons\\" .. "Blacksmithing",
},
[RRS("Cooking")] = {
Name = RRS("Cooking"),
Icon = RECIPERADAR_IMAGE_ROOT .. "Icons\\" .. "Cooking",
},
[RRS("Enchanting")] = {
Name = RRS("Enchanting"),
Icon = RECIPERADAR_IMAGE_ROOT .. "Icons\\" .. "Enchanting",
},
[RRS("Engineering")] = {
Name = RRS("Engineering"),
Icon = RECIPERADAR_IMAGE_ROOT .. "Icons\\" .. "Engineering",
},
[RRS("First Aid")] = {
Name = RRS("First Aid"),
Icon = RECIPERADAR_IMAGE_ROOT .. "Icons\\" .. "First-Aid",
},
[RRS("Fishing")] = {
Name = RRS("Fishing"),
Icon = RECIPERADAR_IMAGE_ROOT .. "Icons\\" .. "Fishing",
},
[RRS("Leatherworking")] = {
Name = RRS("Leatherworking"),
Icon = RECIPERADAR_IMAGE_ROOT .. "Icons\\" .. "Leatherworking",
},
[RRS("Tailoring")] = {
Name = RRS("Tailoring"),
Icon = RECIPERADAR_IMAGE_ROOT .. "Icons\\" .. "Tailoring",
},
}
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"),
}
RecipeRadar_Factions = {
RRS("Argent Dawn"),
RRS("Cenarion Circle"),
RRS("Thorium Brotherhood"),
RRS("Timbermaw Hold"),
RRS("Zandalar Tribe"),
}
RecipeRadar_Availabilities = {
["LearnableByPlayer"] = {
Text = RRS("Available Now (Player)"),
Tooltip = { Group = 1, Heading = RRS("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:") },
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:") },
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:") },
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:") },
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:") },
DropDown = { POrder = nil, ROrder = 6 },
Color = RecipeRadar_Colors.KnownByAlt,
TestFunction = RecipeRadar_Availability_IsKnownByAlt,
},
["NotApplicable"] = {
Text = RRS("Inapplicable Professions"),
Tooltip = { Group = 0 }, -- do not show in tooltip
DropDown = { POrder = 4, ROrder = 7 },
Color = RecipeRadar_Colors.NotApplicable,
TestFunction = nil, -- don't need to test the default case
},
}
-----------------------------------------------------------------------------
-- Global initialization functions
-----------------------------------------------------------------------------
-- This function "upgrades" the user's saved variables, if necessary.
function RecipeRadar_Globals_Init(force)
RecipeRadar_Options_Init()
if (not force and RecipeRadar_Options.Version >= RECIPERADAR_VERSION) then
return -- running version is current
end
RecipeRadar_Options.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
end
if (RecipeRadar_Options.MinimapButtonPosition == nil) then
RecipeRadar_Options.MinimapButtonPosition = 256
end
if (RecipeRadar_Options.ShowMinimapButton == nil) then
RecipeRadar_Options.ShowMinimapButton = true
RecipeRadarMinimapButtonFrame:Show()
end
if (not RecipeRadar_IsProfession(
RecipeRadar_Options.CurrentProfession)) then
RecipeRadar_Options.CurrentProfession = RRS("Cooking")
end
if (RecipeRadar_Options.RealmAvailability == nil) then
RecipeRadar_Options.RealmAvailability = true
RecipeRadar_RealmAvailDropDown:Show()
end
if (RecipeRadar_Options.Locked == nil) then
RecipeRadar_Options.Locked = false
end
if (RecipeRadar_Options.AutoSelectRegion == nil) then
RecipeRadar_Options.AutoSelectRegion = true
end
if (RecipeRadar_Options.AutoMapVendors == nil) then
RecipeRadar_Options.AutoMapVendors = false
end
end
-- Copies 'IsFiltered' members from t2 to t1.
function RecipeRadar_CopyFilterSettings(t1, t2)
for key, val in t2 do
t1[key].IsFiltered = val.IsFiltered
end
end
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large Load Diff
+356
View File
@@ -0,0 +1,356 @@
-- MainFrame.lua: main Recipe Radar window code
-- $Id: MainFrame.lua 459 2006-09-16 18:33:44Z jnmiller $
function RecipeRadar_MainFrame_Init()
RecipeRadarFrame:RegisterForDrag("LeftButton")
RecipeRadarListScrollFrameScrollBar:SetMinMaxValues(0, 0)
RecipeRadarListScrollFrameScrollBar:SetValue(0)
RecipeRadarListScrollFrameScrollBar.scrollBarHideable = 1
RecipeRadarOptionsButton:SetText(RRS("Options"))
RecipeRadarMapVendorIndicatorText:SetText(RRS("Locate Vendor on Map"))
RecipeRadar_UpdateLock()
RecipeRadar_RadarTab_Init()
RECIPERADAR_TOOLTIP_LINK = ""
end
function RecipeRadar_Toggle()
if (RecipeRadarFrame:IsVisible()) then
HideUIPanel(RecipeRadarFrame)
else
RecipeRadar_InitVendorFilters()
RecipeRadar_InitRecipeFilters()
RecipeRadar_Frame_Show()
end
end
function RecipeRadar_Frame_Show()
ShowUIPanel(RecipeRadarFrame)
RecipeRadar_SkillDB_ParseSpellbookFrame()
RecipeRadar_SkillDB_ParseSkillFrame()
RecipeRadar_SkillDB_ParseReputationFrame()
RecipeRadar_FrameUpdate()
end
function RecipeRadar_FrameUpdate()
if (RecipeRadar_Options.ActiveTab == 1) then
RecipeRadar_RadarTab_Update()
else
RecipeRadar_RecipesTab_Update()
end
end
------------------------------------------------------------------------
-- Tab code
------------------------------------------------------------------------
-- Draws the borders around each tab according to which is active.
function RecipeRadar_SetActiveTab(id)
local active_tab_height, background_tab_height = 33, 29
if (id == 1) then
RecipeRadarRadarTabFrameMiddle:SetHeight(active_tab_height)
RecipeRadarRadarTabFrameRight:SetHeight(active_tab_height)
RecipeRadarRecipesTabFrameLeft:SetHeight(background_tab_height)
RecipeRadarRecipesTabFrameMiddle:SetHeight(background_tab_height)
RecipeRadarRecipesTabFrameRight:SetHeight(background_tab_height)
RecipeRadar_Options.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
end
end
-- Sets the button color and the corresponding highlight color.
function RecipeRadar_SetButtonColors(button, text_color)
button:SetTextColor(text_color.r, text_color.g, text_color.b)
button:SetHighlightTextColor(
text_color.r + RecipeRadar_Colors.Highlight,
text_color.g + RecipeRadar_Colors.Highlight,
text_color.b + RecipeRadar_Colors.Highlight)
end
-- Common drawing code for list items in the scroll frame.
function RecipeRadar_DrawListItem(index, recipe)
local button = getglobal("RecipeRadarVendor" .. index)
-- get and set the text color according to recipe availability
local name = RecipeRadar_GetSafeItemInfo(recipe.ID)
local indicator = RecipeRadar_Availability_GetIndicator(recipe)
if (name == RRS("Uncached Recipe")) then
RecipeRadar_SetButtonColors(button, RecipeRadar_Colors.UncachedRecipe)
else
RecipeRadar_SetButtonColors(button, RecipeRadar_Colors.LightGray)
end
-- basic drawing code
if (RecipeRadar_Options.RealmAvailability) then
button:SetText(name .. indicator)
else
button:SetText(name)
end
button:SetID(index)
button:Show()
-- drawing code for the little subtext field
local subtext = getglobal("RecipeRadarVendor" .. index .. "SubText")
if (not RecipeRadar_Options.RealmAvailability) then
local avail = RecipeRadar_Availability_GetKey(recipe)
if (avail) then
button.r = RecipeRadar_Availabilities[avail].Color.r
button.g = RecipeRadar_Availabilities[avail].Color.g
button.b = RecipeRadar_Availabilities[avail].Color.b
else
button.r = RecipeRadar_Colors.UncachedRecipe.r
button.g = RecipeRadar_Colors.UncachedRecipe.g
button.b = RecipeRadar_Colors.UncachedRecipe.b
end
subtext:SetText(indicator)
subtext:SetTextColor(button.r, button.g, button.b)
subtext:SetPoint("LEFT", "RecipeRadarVendor" .. index .. "Text",
"RIGHT", 10, 0)
subtext:Show()
else
subtext:Hide()
end
-- provide information for the availability tooltip
button.Recipe = recipe
end
------------------------------------------------------------------------
-- Base vendor/recipe selection code
------------------------------------------------------------------------
-- OnClick handler for the vendor/recipe buttons in the scroll frame.
function RecipeRadar_VendorButton_OnClick(button)
local offset = FauxScrollFrame_GetOffset(RecipeRadarListScrollFrame)
local index = this:GetID() + offset
RecipeRadar_ServiceClickIndex(index, button)
if (button == "LeftButton") then
RecipeRadar_FrameUpdate()
end
end
-- Selects the first visible recipe (not vendor).
function RecipeRadar_SelectFirstRecipe()
RecipeRadar_ServiceClickIndex(-1)
end
-- Abstracts front for click handlers.
function RecipeRadar_ServiceClickIndex(index, button)
if (RecipeRadar_Options.ActiveTab == 1) then
RecipeRadar_RadarTab_ServiceClickIndex(index, button)
else
RecipeRadar_RecipesTab_ServiceClickIndex(index, button)
end
end
------------------------------------------------------------------------
-- Recipe details and map frames
------------------------------------------------------------------------
function RecipeRadar_ShowRecipeDetails()
RecipeDetailName:Show()
RecipeDetailIcon:Show()
RecipeDetailCostText:Show()
RecipeDetailMoneyFrame:Show()
end
function RecipeRadar_HideRecipeDetails()
RecipeDetailName:Hide()
RecipeDetailIcon:Hide()
RecipeDetailCostText:Hide()
RecipeDetailMoneyFrame:Hide()
RecipeDetailNoteText:Hide()
RecipeDetailRequirements:Hide()
RecipeRadarRegionMap:Hide()
-- reset the mapped indicator to red/off
RecipeRadarMapVendorIndicator:SetVertexColor(1.0, 0, 0)
-- hide all of our little mapping scrolls
for i = 1, RecipeRadar_MaxVendorCoordinates do
getglobal("RecipeRadarScroll" .. i):Hide()
end
end
-- When a recipe is actually selected, this function handles the
-- subsequent drawing in the lower details and map frames.
function RecipeRadar_SetSelection(vendor, recipe, region_name)
local name, link, colorcode, _, _, _, texture, cached =
RecipeRadar_GetSafeItemInfo(recipe.ID)
RecipeDetailName:SetText(name)
-- handle the little icon in the details frame
RecipeDetailIcon:SetNormalTexture(texture)
RecipeDetailIcon.NeedsUpdate = not cached
RecipeDetailIcon.Name = name
RecipeDetailIcon.Link = link
RecipeDetailIcon.Hyperlink =
RecipeRadar_GetHyperlinkByParts(name, link, colorcode)
-- set the color/content of the money text
if (GetMoney() >= recipe.Cost) then
SetMoneyFrameColor("RecipeDetailMoneyFrame", 1.0, 1.0, 1.0);
else
SetMoneyFrameColor("RecipeDetailMoneyFrame", 1.0, 0.1, 0.1);
end
MoneyFrame_Update("RecipeDetailMoneyFrame", recipe.Cost);
-- some vendors have special requirements
if (RecipeRadar_GetRecipeReqsString(recipe)) then
RecipeDetailRequirements:SetText(RecipeRadar_GetRecipeReqsString(recipe))
RecipeDetailNoteText:Show()
RecipeDetailRequirements:Show()
else
RecipeDetailNoteText:Hide()
RecipeDetailRequirements:Hide()
end
-- sets the color on the little radio button at the top
if (vendor.IsMapped) then
RecipeRadarMapVendorIndicator:SetVertexColor(0, 1.0, 0)
else
RecipeRadarMapVendorIndicator:SetVertexColor(1.0, 0, 0)
end
if (vendor.Coordinates) then
if (not region_name) then
region_name = RecipeRadar_Options.CurrentRegion
end
local region = RecipeRadar_RegionData[region_name]
if (not region) then return end
-- draw the map first
RecipeRadarRegionMap:SetTexture(
RECIPERADAR_IMAGE_ROOT .. "Regions\\" .. region.MapFile)
RecipeRadarRegionMap:Show()
-- then draw the little icon (or multiple icons for moble vendors)
for i = 1, RecipeRadar_MaxVendorCoordinates do
local scroll_icon = getglobal("RecipeRadarScroll" .. i)
local coords = vendor.Coordinates[i]
if (not coords) then
scroll_icon:Hide()
else
local x = RecipeRadarMapFrame:GetWidth() * coords.x
local y = RecipeRadarMapFrame:GetHeight() * -coords.y
scroll_icon.Vendor = vendor
scroll_icon:SetPoint("CENTER", "RecipeRadarMapFrame",
"TOPLEFT", x, y)
scroll_icon:Show()
end
end
else -- no vendor coordinates means no map
RecipeRadarRegionMap:Hide()
for i = 1, RecipeRadar_MaxVendorCoordinates do
getglobal("RecipeRadarScroll" .. i):Hide()
end
end
end
function RecipeRadar_RecipeDetailIcon_ShowToolTip()
GameTooltip:SetOwner(this, "ANCHOR_RIGHT")
GameTooltip:SetHyperlink(RecipeDetailIcon.Link)
GameTooltip:Show()
if RecipeDetailIcon.NeedsUpdate then return end
if (RecipeBook_DoHookedFunction) then
RecipeBook_DoHookedFunction(GameTooltip, RecipeDetailIcon.Link)
end
if (EnhTooltip and EnhTooltip.TooltipCall) then
EnhTooltip.TooltipCall(GameTooltip, RecipeDetailIcon.Name,
RecipeDetailIcon.Hyperlink, nil, 1)
end
end
-------------------------------------------------------------------------
-- Frame Movement
-------------------------------------------------------------------------
function RecipeRadar_ToggleLock()
if (RecipeRadar_Options.Locked) then
RecipeRadar_Options.Locked = false
RecipeRadar_UpdateLock()
else
RecipeRadar_Options.Locked = true
RecipeRadar_UpdateLock()
end
end
function RecipeRadar_UpdateLock()
if (RecipeRadar_Options.Locked) then
RecipeRadarLockNormal:SetTexture(
RECIPERADAR_IMAGE_ROOT .. "Frame\\LockButton-Locked-Up")
RecipeRadarLockPushed:SetTexture(
RECIPERADAR_IMAGE_ROOT .. "Frame\\LockButton-Locked-Down")
else
RecipeRadarLockNormal:SetTexture(
RECIPERADAR_IMAGE_ROOT .. "Frame\\LockButton-Unlocked-Up")
RecipeRadarLockPushed:SetTexture(
RECIPERADAR_IMAGE_ROOT .. "Frame\\LockButton-Unlocked-Down")
end
end
function RecipeRadar_StartMoving()
if (not RecipeRadar_Options.Locked) then
RecipeRadarFrame:StartMoving()
end
end
+222
View File
@@ -0,0 +1,222 @@
-- Maps.lua: generic mapping code and map "base class"
-- $Id: Maps.lua 443 2006-09-01 04:41:40Z jnmiller $
-- Initializes the state of the map overlays and settings.
function RecipeRadar_Maps_Init()
RecipeRadar_Minimap_Init()
RecipeRadar_Worldmap_Init()
RecipeRadar_MappedVendors = { }
end
-- find the next unused icon; we just check minimap icons since
-- world/mini icons should always correspond
function RecipeRadar_Maps_FindNextID()
for i = 1, RECIPERADAR_MAPPED_VENDORS_MAX do
if (not getglobal("RecipeRadarMinimapIcon" .. i).IsMapped) then
return i
end
end
return nil
end
-- Add the given vendor to the list of mapped vendors.
function RecipeRadar_Maps_AddVendor(vendor, region)
if (vendor.IsMapped) then return end -- vendor is already mapped
local continent = RecipeRadar_RegionData[region].Continent
if (continent == 0) then return end -- instance vendor
if (not vendor.Coordinates) then
RecipeRadar_Print("ASSERT FAILED: " .. vendor.Name ..
" has no coordinates.")
return
end
local id = RecipeRadar_Maps_FindNextID()
if (not id) then return end
RecipeRadar_Worldmap_AddVendor(id, vendor, region, continent)
RecipeRadar_Minimap_AddVendor(id, vendor, region)
RecipeRadar_MappedVendors[vendor.Name] = id
vendor.IsMapped = true
end
-- Unmap the vendor.
function RecipeRadar_Maps_RemoveVendor(vendor)
local id = RecipeRadar_MappedVendors[vendor.Name]
RecipeRadar_Minimap_RemoveVendor(id)
RecipeRadar_Worldmap_RemoveVendor(id)
RecipeRadar_MappedVendors[vendor.Name] = nil
vendor.IsMapped = false
end
-- Creates and displays the tooltip that displays on mouseover for all
-- of our maps - minimap, worldmap and our custom Recipe Radar map.
-- tooltip is the tooltip to draw (eg. GameTooltip), and frame is the
-- owner button.
function RecipeRadar_Maps_SetTooltip(tooltip, frame)
local line1, line2 = RecipeRadar_GetColoredTeamString(
frame.Vendor.Team, frame.Vendor.Name)
local anchor = "ANCHOR_BOTTOMLEFT"
local count = table.getn(frame.Vendor.Recipes)
if (count == 1) then
line2 = RRS("1 recipe")
else
line2 = string.format(RRS("%d recipes"), count)
end
count = RecipeRadar_CountLearnableRecipes(frame.Vendor.Recipes)
line2 = line2 .. " " .. format(TEXT(PARENS_TEMPLATE),
format(RRS("%d learnable"), count))
-- make sure our tooltip doesn't hit the screen edge
if (frame:GetLeft() < 200) then
anchor = "ANCHOR_RIGHT"
end
tooltip:SetOwner(frame, anchor)
tooltip:SetText(line1)
tooltip:AddLine(line2)
if (frame.Vendor.Notes and frame.Vendor.Notes ~= "") then
tooltip:AddLine(RecipeRadar_FormatVendorNote(frame.Vendor.Notes, true))
end
tooltip:Show()
end
-- OnLoad event handler for the right-click context menu for map buttons.
function RecipeRadar_Maps_ContextMenuOnLoad()
RecipeRadar_ContextMenuGlobal = { }
UIDropDownMenu_Initialize(this, RecipeRadar_Maps_ContextMenuInit, "MENU")
end
-- Initialization routine for the right-click context menu for map buttons.
function RecipeRadar_Maps_ContextMenuInit()
local item
-- putting in the vendor's name as the title of the popup
if (RecipeRadar_ContextMenuGlobal.Vendor) then
item = { }
item.text = RecipeRadar_ContextMenuGlobal.Vendor.Name
item.isTitle = 1
item.notCheckable = 1
UIDropDownMenu_AddButton(item)
end
item = { }
item.text = RRS("Unmap Vendor")
item.value = "unmap"
item.notCheckable = 1
item.func = RecipeRadar_Maps_ContextMenuOnClick
UIDropDownMenu_AddButton(item)
item = { }
item.text = CANCEL
item.notCheckable = 1
item.func = RecipeRadar_Maps_ContextMenuOnClick
UIDropDownMenu_AddButton(item)
end
-- OnClick event handler for the right-click context menu for map buttons.
function RecipeRadar_Maps_ContextMenuOnClick()
if (this.value == "unmap") then
RecipeRadar_Maps_RemoveVendor(RecipeRadar_ContextMenuGlobal.Vendor)
RecipeRadar_FrameUpdate()
end
end
-- Changes local (region map) coordinates to absolute coordinates.
function RecipeRadar_Maps_LocalToAbsolute(local_x, local_y, region)
local region = RecipeRadar_RegionData[region]
if (not region) then return end
local absolute_x = local_x * region.MapScale + region.MapOffset.x
local absolute_y = local_y * region.MapScale + region.MapOffset.y
return absolute_x, absolute_y
end
-- Changes local (region map) coordinates to absolute coordinates.
function RecipeRadar_Maps_LocalToAbsoluteTable(local_coords, region)
local region = RecipeRadar_RegionData[region]
if (not region) then return end
local absolute = { }
absolute.x = local_coords.x * region.MapScale + region.MapOffset.x
absolute.y = local_coords.y * region.MapScale + region.MapOffset.y
return absolute
end
-- Map constants (from MapNotes).
RecipeRadar_MapData = {
IndoorZoomRatio = {
[0] = 1.565,
[1] = 1.687,
[2] = 1.882,
[3] = 2.210,
[4] = 2.575,
[5] = 2.651,
},
Worldmap = {
[1] = {
Scale = 0.815775262,
Offset = { x = -0.185568684, y = 0.064012977 },
},
[2] = {
Scale = 0.790967532,
Offset = { x = 0.371931204, y = 0.081458069 },
},
},
[1] = {
Scale = { -- continent scale rates
[0] = { x = 11016.6, y = 7399.9 },
[1] = { x = 12897.3, y = 8638.1 },
[2] = { x = 15478.8, y = 10368.0 },
[3] = { x = 19321.8, y = 12992.7 },
[4] = { x = 25650.4, y = 17253.2 },
[5] = { x = 38787.7, y = 26032.1 },
}
},
[2] = {
Scale = { -- continent scale rates
[0] = { x = 10448.3, y = 7072.7 },
[1] = { x = 12160.5, y = 8197.8 },
[2] = { x = 14703.1, y = 9825.0 },
[3] = { x = 18568.7, y = 12472.2 },
[4] = { x = 24390.3, y = 15628.5 },
[5] = { x = 37012.2, y = 25130.6 },
},
},
}
+125
View File
@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="utf-8" ?>
<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="Maps.lua"/>
<Script file="Minimap.lua"/>
<Script file="Worldmap.lua"/>
<Button name="RecipeRadarMinimapIconTemplate" hidden="true" parent="Minimap" virtual="true">
<Size>
<AbsDimension x="12" y="12"/>
</Size>
<Scripts>
<OnLoad>
this:RegisterForClicks("RightButtonUp")
</OnLoad>
<OnUpdate>
RecipeRadar_Minimap_OnUpdate(arg1)
</OnUpdate>
<OnEnter>
RecipeRadar_Maps_SetTooltip(GameTooltip, this)
</OnEnter>
<OnLeave>
GameTooltip:Hide()
</OnLeave>
<OnClick>
if (arg1 and arg1 == "RightButton") then
HideDropDownMenu(1)
RecipeRadar_ContextMenuGlobal.Vendor = this.Vendor
ToggleDropDownMenu(1, nil, UnmapVendorDropDown, this:GetName(), 6, 6)
end
</OnClick>
</Scripts>
<NormalTexture file="Interface\Addons\RecipeRadar\Images\Misc\Scroll"/>
</Button>
<Button name="RecipeRadarMinimapIcon1" inherits="RecipeRadarMinimapIconTemplate"/>
<Button name="RecipeRadarMinimapIcon2" inherits="RecipeRadarMinimapIconTemplate"/>
<Button name="RecipeRadarMinimapIcon3" inherits="RecipeRadarMinimapIconTemplate"/>
<Button name="RecipeRadarMinimapIcon4" inherits="RecipeRadarMinimapIconTemplate"/>
<Button name="RecipeRadarMinimapIcon5" inherits="RecipeRadarMinimapIconTemplate"/>
<Button name="RecipeRadarMinimapIcon6" inherits="RecipeRadarMinimapIconTemplate"/>
<Button name="RecipeRadarMinimapIcon7" inherits="RecipeRadarMinimapIconTemplate"/>
<Button name="RecipeRadarMinimapIcon8" inherits="RecipeRadarMinimapIconTemplate"/>
<Button name="RecipeRadarMinimapIcon9" inherits="RecipeRadarMinimapIconTemplate"/>
<Button name="RecipeRadarMinimapIcon10" inherits="RecipeRadarMinimapIconTemplate"/>
<Button name="RecipeRadarMinimapIcon11" inherits="RecipeRadarMinimapIconTemplate"/>
<Button name="RecipeRadarMinimapIcon12" inherits="RecipeRadarMinimapIconTemplate"/>
<Button name="RecipeRadarMinimapIcon13" inherits="RecipeRadarMinimapIconTemplate"/>
<Button name="RecipeRadarMinimapIcon14" inherits="RecipeRadarMinimapIconTemplate"/>
<Button name="RecipeRadarMinimapIcon15" inherits="RecipeRadarMinimapIconTemplate"/>
<Button name="RecipeRadarMinimapIcon16" inherits="RecipeRadarMinimapIconTemplate"/>
<Button name="RecipeRadarMinimapIcon17" inherits="RecipeRadarMinimapIconTemplate"/>
<Button name="RecipeRadarMinimapIcon18" inherits="RecipeRadarMinimapIconTemplate"/>
<Button name="RecipeRadarMinimapIcon19" inherits="RecipeRadarMinimapIconTemplate"/>
<Button name="RecipeRadarMinimapIcon20" inherits="RecipeRadarMinimapIconTemplate"/>
<Button name="RecipeRadarWorldmapIconTemplate" hidden="true" parent="WorldMapFrame" virtual="true">
<Size>
<AbsDimension x="16" y="16"/>
</Size>
<Scripts>
<OnLoad>
this:SetFrameLevel(this:GetFrameLevel() + 2)
this:RegisterForClicks("RightButtonUp")
</OnLoad>
<OnEnter>
RecipeRadar_Maps_SetTooltip(WorldMapTooltip, this)
</OnEnter>
<OnLeave>
WorldMapTooltip:Hide()
</OnLeave>
<OnClick>
if (arg1 and arg1 == "RightButton") then
HideDropDownMenu(1)
RecipeRadar_ContextMenuGlobal.Vendor = this.Vendor
ToggleDropDownMenu(1, nil, UnmapVendorDropDown, this:GetName(), 6, 6)
end
</OnClick>
</Scripts>
<NormalTexture setAllPoints="true" file="Interface\Addons\RecipeRadar\Images\Misc\Scroll"/>
</Button>
<Button name="RecipeRadarWorldmapIcon1" inherits="RecipeRadarWorldmapIconTemplate"/>
<Button name="RecipeRadarWorldmapIcon2" inherits="RecipeRadarWorldmapIconTemplate"/>
<Button name="RecipeRadarWorldmapIcon3" inherits="RecipeRadarWorldmapIconTemplate"/>
<Button name="RecipeRadarWorldmapIcon4" inherits="RecipeRadarWorldmapIconTemplate"/>
<Button name="RecipeRadarWorldmapIcon5" inherits="RecipeRadarWorldmapIconTemplate"/>
<Button name="RecipeRadarWorldmapIcon6" inherits="RecipeRadarWorldmapIconTemplate"/>
<Button name="RecipeRadarWorldmapIcon7" inherits="RecipeRadarWorldmapIconTemplate"/>
<Button name="RecipeRadarWorldmapIcon8" inherits="RecipeRadarWorldmapIconTemplate"/>
<Button name="RecipeRadarWorldmapIcon9" inherits="RecipeRadarWorldmapIconTemplate"/>
<Button name="RecipeRadarWorldmapIcon10" inherits="RecipeRadarWorldmapIconTemplate"/>
<Button name="RecipeRadarWorldmapIcon11" inherits="RecipeRadarWorldmapIconTemplate"/>
<Button name="RecipeRadarWorldmapIcon12" inherits="RecipeRadarWorldmapIconTemplate"/>
<Button name="RecipeRadarWorldmapIcon13" inherits="RecipeRadarWorldmapIconTemplate"/>
<Button name="RecipeRadarWorldmapIcon14" inherits="RecipeRadarWorldmapIconTemplate"/>
<Button name="RecipeRadarWorldmapIcon15" inherits="RecipeRadarWorldmapIconTemplate"/>
<Button name="RecipeRadarWorldmapIcon16" inherits="RecipeRadarWorldmapIconTemplate"/>
<Button name="RecipeRadarWorldmapIcon17" inherits="RecipeRadarWorldmapIconTemplate"/>
<Button name="RecipeRadarWorldmapIcon18" inherits="RecipeRadarWorldmapIconTemplate"/>
<Button name="RecipeRadarWorldmapIcon19" inherits="RecipeRadarWorldmapIconTemplate"/>
<Button name="RecipeRadarWorldmapIcon20" inherits="RecipeRadarWorldmapIconTemplate"/>
<Frame name="UnmapVendorDropDown" inherits="UIDropDownMenuTemplate" hidden="true">
<Size>
<AbsDimension x="10" y="10"/>
</Size>
<Anchors>
<Anchor point="TOP">
<Offset>
<AbsDimension x="-10" y="-50"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
RecipeRadar_Maps_ContextMenuOnLoad()
</OnLoad>
</Scripts>
</Frame>
</UI>
+209
View File
@@ -0,0 +1,209 @@
-- Minimap.lua: minimap vendor plotting code
-- $Id: Minimap.lua 429 2006-08-22 19:16:17Z jnmiller $
-- Note: the mapping code in here is from MapNotes, by Sir.Bender, et al.
-- Initializes the state of the minimap overlays and settings.
function RecipeRadar_Minimap_Init()
-- time between minimap updates, in seconds
RECIPERADAR_MINIMAP_UPDATE = 0.1
-- determine minimap scale
RecipeRadar_Minimap_SetIndoorness()
for i = 1, RECIPERADAR_MAPPED_VENDORS_MAX do
local button = getglobal("RecipeRadarMinimapIcon" .. i)
button.Elapsed = 0
button:Hide()
end
end
function RecipeRadar_Minimap_OnNewRegion()
SetMapToCurrentZone()
for i = 1, RECIPERADAR_MAPPED_VENDORS_MAX do
local button = getglobal("RecipeRadarMinimapIcon" .. i)
if (button.IsMapped and button.Region == GetRealZoneText()) then
button:Show()
else
button:Hide()
end
end
end
-- Map the given icon to the given vendor.
function RecipeRadar_Minimap_AddVendor(id, vendor, region)
local button = getglobal("RecipeRadarMinimapIcon" .. id)
button.Vendor = vendor
button.Region = region
button.Elapsed = RECIPERADAR_MINIMAP_UPDATE
button.IsMapped = true
button:Show()
end
-- Resets and unmaps the given icon.
function RecipeRadar_Minimap_RemoveVendor(id)
local button = getglobal("RecipeRadarMinimapIcon" .. id)
button.Vendor = nil
button.Region = nil
button.IsMapped = false
button:Hide()
end
function RecipeRadar_Minimap_OnUpdate(elapsed)
if (this.Region ~= GetRealZoneText()) then
this:Hide()
return
end
this.Elapsed = this.Elapsed + elapsed
if (this.Elapsed < RECIPERADAR_MINIMAP_UPDATE) then
return
end
this.Elapsed = 0
RecipeRadar_Minimap_UpdateButton(this)
end
-- Determines whether the minimap is displaying an indoor location
-- by comparing the minimapZoom and minimapInsideZoom CVars (from MapNotes).
function RecipeRadar_Minimap_SetIndoorness()
local test_zoom = 0
if (GetCVar("minimapZoom") == GetCVar("minimapInsideZoom")) then
if (GetCVar("minimapInsideZoom") + 0 >= 3) then
Minimap:SetZoom(Minimap:GetZoom() - 1)
test_zoom = 1
else
Minimap:SetZoom(Minimap:GetZoom() + 1)
test_zoom = -1
end
end
RecipeRadar_Minimap_IsIndoor =
(GetCVar("minimapInsideZoom") + 0 == Minimap:GetZoom())
Minimap:SetZoom(Minimap:GetZoom() + test_zoom)
end
-- Computes the distance between two points on the minimap.
function RecipeRadar_Minimap_Distance(p1_x, p1_y, p2_x, p2_y)
local dist_x, dist_y = p2_x - p1_x, p2_y - p1_y
return dist_x, dist_y
end
-- Computes the length of the hypotenuse between two lines.
function RecipeRadar_Minimap_Pythagorean(length1, length2)
local distance = math.sqrt(length1 * length1 + length2 * length2)
if (distance == 0) then
return 0.0000000001
end
return distance
end
-- Retrieves the appropriate scaling constants from our MapData table.
function RecipeRadar_Minimap_GetScale(continent, is_indoor, zoom)
if (continent == 0) then
RecipeRadar_Print("ASSERT FAILED: continent = 0")
return nil
end
local scale_x = RecipeRadar_MapData[continent].Scale[zoom].x
local scale_y = RecipeRadar_MapData[continent].Scale[zoom].y
if (is_indoor == true) then
scale_x = scale_x * RecipeRadar_MapData.IndoorZoomRatio[zoom]
scale_y = scale_y * RecipeRadar_MapData.IndoorZoomRatio[zoom]
end
return scale_x, scale_y
end
-- Finds the appropriate location on the minimap, accounting for the fact
-- that the minimap has a radius of only 57 (or so) units (from MapNotes).
function RecipeRadar_Minimap_GetPosition(offs_x, offs_y, scale_x, scale_y)
local map_x, map_y = offs_x * scale_x, offs_y * scale_y
local dist = RecipeRadar_Minimap_Pythagorean(map_x, map_y)
if (dist >= 57) then
local flip_axis = 1
if (map_x == 0) then
map_x = 0.0000000001
elseif (map_x < 0) then
flip_axis = -1
end
local angle = math.atan(map_y / map_x)
map_x = math.cos(angle) * 58 * flip_axis
map_y = math.sin(angle) * 58 * flip_axis
end
return map_x, map_y
end
-- Plots the given button on the minimap.
function RecipeRadar_Minimap_UpdateButton(button)
local pl_x, pl_y = GetPlayerMapPosition("player")
if (pl_x == 0 and pl_y == 0) then
button:Hide() -- the player is in an unmappable location
return
end
-- only mapping the first location in our database
local vendor = button.Vendor.Coordinates[1]
if (not vendor) then return end
-- some code to display the current coordinates for debugging
if (RecipeRadar_Options.PositionDebug) then
RecipeRadar_Print("Debugging " .. button.Vendor.Name)
RecipeRadar_Print("Database Coords: " .. vendor.x .. ", " .. vendor.y)
RecipeRadar_Print("Player Coords: " .. pl_x .. ", " .. pl_y)
RecipeRadar_Options.PositionDebug = false
end
-- we don't need all these computations if the player isn't moving
if (pl_x == button.pl_x and pl_y == button.pl_y) then return end
button.pl_x, button.pl_y = pl_x, pl_y
pl_x, pl_y = RecipeRadar_Maps_LocalToAbsolute(pl_x, pl_y, button.Region)
vendor = RecipeRadar_Maps_LocalToAbsoluteTable(vendor, button.Region)
local offs_x, offs_y = RecipeRadar_Minimap_Distance(pl_x, pl_y,
vendor.x, vendor.y)
local region = RecipeRadar_RegionData[button.Region]
local scale_x, scale_y = RecipeRadar_Minimap_GetScale(
region.Continent, RecipeRadar_Minimap_IsIndoor, Minimap:GetZoom())
local pos_x, pos_y = RecipeRadar_Minimap_GetPosition(
offs_x, offs_y, scale_x, scale_y)
button:SetPoint("CENTER", "Minimap", "CENTER", pos_x, -pos_y)
end
+91
View File
@@ -0,0 +1,91 @@
-- MinimapButton.lua: code to handle the little Recipe Radar minimap button
-- $Id: MinimapButton.lua 279 2006-04-12 07:55:40Z jnmiller $
function RecipeRadar_MinimapButton_OnClick()
RecipeRadar_Toggle()
end
function RecipeRadar_MinimapButton_Init()
if (RecipeRadar_Options.ShowMinimapButton) then
RecipeRadarMinimapButton:Show()
else
RecipeRadarMinimapButton:Hide()
end
RecipeRadar_MinimapButton_UpdatePosition()
end
function RecipeRadar_MinimapButton_Toggle()
if (RecipeRadarMinimapButton:IsVisible()) then
RecipeRadarMinimapButton:Hide()
RecipeRadar_Options.ShowMinimapButton = false
else
RecipeRadarMinimapButton:Show()
RecipeRadar_Options.ShowMinimapButton = true
end
end
-- Turns on the slow highlight/outline flash.
function RecipeRadar_MinimapButton_Flash()
RECIPERADAR_FLASH_MINIMAP_BUTTON = true
RecipeRadarMinimapButton:LockHighlight()
end
-- OnUpdate event handler manages the flashing highlight when appropriate.
function RecipeRadar_MinimapButton_OnUpdate(elapsed)
if (not RECIPERADAR_FLASH_MINIMAP_BUTTON) then
return
end
this.total = this.total + elapsed
local cntr = this.cntr + elapsed
local sign = this.sign
local alpha
-- alternate coming/going every half-second
if (cntr > 0.5) then
sign = -sign
this.sign = sign
end
cntr = mod(cntr, 0.5)
this.cntr = cntr
-- only make the new value visible if the button is also visible
if (RecipeRadarMinimapButton:IsVisible()) then
if (sign == 1) then
RecipeRadarMinimapButton:LockHighlight();
else
RecipeRadarMinimapButton:UnlockHighlight();
end
end
-- only flash for a few seconds, then shut off
if (this.total > 4) then
RecipeRadarMinimapButton:UnlockHighlight()
RECIPERADAR_FLASH_MINIMAP_BUTTON = false
this.total = 0
end
end
-- Sets the location of the button according to the current options.
function RecipeRadar_MinimapButton_UpdatePosition()
local xmin,ymin,xm,ym = Minimap:GetLeft(), Minimap:GetBottom(), Minimap:GetRight(), Minimap:GetTop();
local scale = Minimap:GetEffectiveScale();
local xdelta, ydelta = (xm - xmin)/2*scale, (ym - ymin) /2 * scale;
local scale2 = RecipeRadarMinimapButton:GetEffectiveScale();
local x = (xdelta * cos(RecipeRadar_Options.MinimapButtonPosition))/scale2;
local y = (ydelta * sin(RecipeRadar_Options.MinimapButtonPosition))/scale2;
RecipeRadarMinimapButton:SetPoint("TOPLEFT", "Minimap", "CENTER", x - 17 , y + 17)
end
+47
View File
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8" ?>
<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="MinimapButton.lua"/>
<Button name="RecipeRadarMinimapButton" parent="Minimap" enableMouse="true" hidden="false" frameStrata="LOW">
<Size>
<AbsDimension x="32" y="32"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="2" y="0"/>
</Offset>
</Anchor>
</Anchors>
<NormalTexture file="Interface\AddOns\RecipeRadar\Images\Misc\MinimapButtonUp"/>
<PushedTexture file="Interface\AddOns\RecipeRadar\Images\Misc\MinimapButtonDown"/>
<HighlightTexture alphaMode="ADD" file="Interface\Minimap\UI-Minimap-ZoomButton-Highlight"/>
<Scripts>
<OnLoad>
this.total = 0
this.cntr = 0
this.sign = 1
RECIPERADAR_FLASH_MINIMAP_BUTTON = false
</OnLoad>
<OnClick>
RecipeRadar_MinimapButton_OnClick()
</OnClick>
<OnUpdate>
RecipeRadar_MinimapButton_OnUpdate(arg1)
</OnUpdate>
<OnEnter>
GameTooltip_SetDefaultAnchor(GameTooltip, UIParent)
GameTooltip:SetText(RRS("Recipe Radar"))
</OnEnter>
<OnLeave>
GameTooltip:Hide()
</OnLeave>
</Scripts>
</Button>
</UI>
+107
View File
@@ -0,0 +1,107 @@
-- NameMap.lua: recipes named differently after learning
-- Auto generated on 9/17/2006 3:42:09 PM
RecipeRadar_NameMap = {
["enUS"] = {
-- Alchemy
["Philosophers' Stone"] = "Philosopher's Stone",
["Transmute: Iron to Gold"] = "Transmute Iron to Gold",
["Transmute: Mithril to Truesilver"] = "Transmute Mithril to Truesilver",
["Transmute: Arcanite"] = "Transmute Arcanite",
["Transmute: Air to Fire"] = "Transmute Air to Fire",
["Transmute: Earth to Water"] = "Transmute Earth to Water",
["Transmute: Fire to Earth"] = "Transmute Fire to Earth",
["Transmute: Water to Air"] = "Transmute Water to Air",
["Greater Dreamless Sleep Potion"] = "Greater Dreamless Sleep",
["Transmute: Elemental Fire"] = "Transmute Elemental Fire",
-- Enchanting
["Enchant Bracer - Healing Power"] = "Enchant Bracer - Healing",
-- Cooking
["Mithril Headed Trout"] = "Mithril Head Trout",
},
["enGB"] = {
-- Alchemy
["Philosophers' Stone"] = "Philosopher's Stone",
["Transmute: Iron to Gold"] = "Transmute Iron to Gold",
["Transmute: Mithril to Truesilver"] = "Transmute Mithril to Truesilver",
["Transmute: Arcanite"] = "Transmute Arcanite",
["Transmute: Air to Fire"] = "Transmute Air to Fire",
["Transmute: Earth to Water"] = "Transmute Earth to Water",
["Transmute: Fire to Earth"] = "Transmute Fire to Earth",
["Transmute: Water to Air"] = "Transmute Water to Air",
["Greater Dreamless Sleep Potion"] = "Greater Dreamless Sleep",
["Transmute: Elemental Fire"] = "Transmute Elemental Fire",
-- Enchanting
["Enchant Bracer - Healing Power"] = "Enchant Bracer - Healing",
-- Cooking
["Mithril Headed Trout"] = "Mithril Head Trout",
},
["deDE"] = {
-- Alchemy
["Transmutieren: Eisen in Gold"] = "Eisen in Gold transmutieren",
["Transmutieren: Mithril in Echtsilber"] = "Mithril in Echtsilber transmutieren",
["Transmutieren: Arkanit"] = "Arkanit transmutieren",
["Transmutieren: Luft zu Feuer"] = "Luft zu Feuer transmutieren",
["Transmutieren: Erde zu Wasser"] = "Erde zu Wasser transmutieren",
["Transmutieren: Feuer zu Erde"] = "Feuer zu Erde transmutieren",
["Transmutieren: Wasser zu Luft"] = "Wasser zu Luft transmutieren",
-- Enchanting
["Zweihandwaffen - Beweglichkeit"] = "Zweihandwaffe - Beweglichkeit",
["Armschiene - Heilkraft"] = "Armschiene - Heilung",
-- Engineering
["Gnomen-Universalfernbedienung"] = "Gnomenuniversalfernbedienung",
["Goblin-Überbrückungskabel"] = "Goblinüberbrückungskabel",
["Echtsilber-Umwandler"] = "Echtsilberumwandler",
-- Cooking
["Westfall-Eintopf"] = "Westfalleintopf",
},
["frFR"] = {
-- Alchemy
["Potion de Rage"] = "Potion de rage",
["Transmutation : Fer en Or"] = "Transmutation du fer en or",
["Transmutation de mithril en vrai-argent"] = "Transmutation du mithril en vrai-argent",
["Elixir de Puissance de l'ombre"] = "Elixir de puissance de l'Ombre",
["Elixir de Tueur de démons"] = "Elixir de tueur de démons",
["Potion de soins majeure"] = "Potion de Soins majeure",
["Potion de sommeil sans rêve supérieure"] = "Sommeil sans rêve supérieur",
["Transmutation : Feu élémentaire"] = "Transmutation du feu élémentaire",
-- Enchanting
["Ench. de plastron (Mana mineur)"] = "Enchantement de plastron (Mana mineur)",
["Ench. de plastron (Mana inférieur)"] = "Enchantement de plastron (Mana inférieur)",
["Ench. d'arme 2M (Intelligence inférieure)"] = "Enchantement d'arme 2M (Intelligence inférieure)",
["Ench. de cape (Agilité mineure)"] = "Enchantement de cape (Agilité mineure)",
["Ench. de bottes (Agilité mineure)"] = "Bottes enchantées (Agilité mineure)",
["Ench. de bracelets (Force inférieure)"] = "Enchantement de bracelets (Force inférieure)",
["Ench. de bracelets (Déviation inférieure)"] = "Enchantement de bracelets (Déviation inférieure)",
["Ench. de bracelets (Déviation)"] = "Enchantement de bracelets (Déviation)",
["Ench. de bouclier (Endurance supérieure)"] = "Enchantement de bouclier (Endurance supérieure)",
["Ench. de plastron (Vie majeure)"] = "Enchantement de plastron (Santé majeure)",
["Ench. de cape (Défense excellente)"] = "Enchantement de cape (Défense excellent)",
["Ench. d'arme (Force)"] = "Enchantement d'arme (Force)",
["Ench. d'arme (Agilité)"] = "Enchantement d'arme (Agilité)",
["Ench. de bracelets (Régénération de mana)"] = "Enchantement de bracelets (Régénération de mana)",
["Ench. d'arme 2M (Agilité)"] = "Enchantement d'arme 2M (Agilité)",
["Ench. de bracelets (Pouvoir de guérison)"] = "Enchantement de bracelets (Soin)",
["Ench. d'arme (Esprit renforcé)"] = "Enchantement d'arme (Esprit renforcé)",
["Ench. d'arme (Intelligence renforcée)"] = "Enchantement d'arme (Intelligence renforcée)",
["Ench. de cape (Résistance au Feu supérieure)"] = "Enchantement de cape (Résistance au feu supérieure)",
["Ench. de cape (Résistance à la Nature supérieure)"] = "Enchantement de cape (Résistance à la nature supérieure)",
-- Engineering
["Rouage en thorium"] = "Rouages en thorium",
-- Leatherworking
["Ceinture en cuir clouté de gemmes"] = "Ceinture en cuir cloutée de gemmes",
["Demi-bottes de l'aube"] = "Bottines de l'aube",
["Jambières de l'ours de guerre"] = "Haut-de-chausses de l'ours de guerre",
-- Tailoring
["Jambières en vignesang"] = "Jambières en vignesang",
-- Cooking
["Biscuit au pain d'épices"] = "Biscuit de pain d'épice",
},
}
+207
View File
@@ -0,0 +1,207 @@
function RecipeRadar_OptionsFrame_OnLoad()
UIPanelWindows["RecipeRadarOptionsFrame"] = { area = "center" }
RecipeRadarOptionsFrameHeaderText:SetText(RRS("Recipe Radar"))
end
function RecipeRadar_OptionsFrame_Toggle()
if (RecipeRadarOptionsFrame:IsVisible()) then
RecipeRadarOptionsFrame:Hide()
else
RecipeRadarOptionsFrame:Show()
end
end
function RecipeRadar_OptionsFrame_Init()
RecipeRadarRealmAvailability:SetChecked(
RecipeRadar_Options.RealmAvailability)
RecipeRadarShowMinimapButton:SetChecked(
RecipeRadar_Options.ShowMinimapButton)
RecipeRadarMinimapButtonPositionSlider:SetValue(
RecipeRadar_Options.MinimapButtonPosition)
RecipeRadarAutoSelectRegionButton:SetChecked(
RecipeRadar_Options.AutoSelectRegion)
RecipeRadar_OptionsFrame_AutoSelectRegion_OnClick()
RecipeRadarAutoMapVendorsButton:SetChecked(
RecipeRadar_Options.AutoMapVendors)
end
function RecipeRadar_OptionsFrame_OnShow()
RecipeRadar_OptionsFrame_Init()
UIDropDownMenu_Initialize(RecipeRadar_ContinentDropDown,
RecipeRadar_ContinentDropDown_Init)
UIDropDownMenu_Initialize(RecipeRadar_RegionDropDown,
RecipeRadar_RegionDropDown_Init)
end
function RecipeRadar_OptionsFrame_AutoSelectRegion_OnClick()
if (RecipeRadarAutoSelectRegionButton:GetChecked()) then
PlaySound("igMainMenuOptionCheckBoxOn")
RecipeRadar_Options.AutoSelectRegion = true
RecipeRadar_OptionsFrame_DisableDropDown(RecipeRadar_ContinentDropDown)
RecipeRadar_OptionsFrame_DisableDropDown(RecipeRadar_RegionDropDown)
-- auto-select the current region
RecipeRadar_NewRegion(GetRealZoneText())
UIDropDownMenu_ClearAll(RecipeRadar_ContinentDropDown)
UIDropDownMenu_Initialize(RecipeRadar_ContinentDropDown,
RecipeRadar_ContinentDropDown_Init)
UIDropDownMenu_Initialize(RecipeRadar_RegionDropDown,
RecipeRadar_RegionDropDown_Init)
else
PlaySound("igMainMenuOptionCheckBoxOff")
RecipeRadar_Options.AutoSelectRegion = false
RecipeRadar_OptionsFrame_EnableDropDown(RecipeRadar_ContinentDropDown)
RecipeRadar_OptionsFrame_EnableDropDown(RecipeRadar_RegionDropDown)
end
end
-----------------------------------------------------------------------------
-- Continent/region drop down code
-----------------------------------------------------------------------------
function RecipeRadar_ContinentDropDown_OnLoad()
UIDropDownMenu_ClearAll(this)
UIDropDownMenu_SetWidth(140)
end
function RecipeRadar_ContinentDropDown_Init()
for index, name in RecipeRadar_Continents do
local item = { }
if ((not RecipeRadar_ContinentDropDown.selectedValue and
index == RecipeRadar_Options.CurrentContinent) or
index == RecipeRadar_ContinentDropDown.selectedValue) then
item.checked = 1
end
item.text = name
item.value = index
item.func = RecipeRadar_ContinentDropDown_OnClick
UIDropDownMenu_AddButton(item)
end
if (not RecipeRadar_ContinentDropDown.selectedValue) then
UIDropDownMenu_SetSelectedValue(RecipeRadar_ContinentDropDown,
RecipeRadar_Options.CurrentContinent)
end
end
function RecipeRadar_ContinentDropDown_OnClick()
UIDropDownMenu_SetSelectedValue(RecipeRadar_ContinentDropDown, this.value)
UIDropDownMenu_Initialize(RecipeRadar_RegionDropDown,
RecipeRadar_RegionDropDown_Init)
end
function RecipeRadar_GetContinentIndex(continent)
for index, name in RecipeRadar_Continents do
if (name == continent) then
return index
end
end
return nil
end
function RecipeRadar_RegionDropDown_OnLoad()
UIDropDownMenu_SetWidth(140)
end
function RecipeRadar_RegionDropDown_Init()
local cont = UIDropDownMenu_GetSelectedValue(RecipeRadar_ContinentDropDown)
local regions = { }
if (cont == 0) then
-- create sorted list of relevant instances
table.foreach(RecipeRadar_RegionData,
function (k, v)
if (v.Continent == 0) then
table.insert(regions, k)
end
end)
table.sort(regions)
else
-- otherwise just populate with all the continent's regions
regions = { GetMapZones(cont) }
end
for id, region in regions do
local item = { }
item.text = region
item.value = id
item.func = RecipeRadar_RegionDropDown_OnClick
UIDropDownMenu_AddButton(item)
end
if (cont == RecipeRadar_Options.CurrentContinent) then
UIDropDownMenu_SetSelectedName(RecipeRadar_RegionDropDown,
RecipeRadar_Options.CurrentRegion)
else
UIDropDownMenu_ClearAll(RecipeRadar_RegionDropDown)
end
end
function RecipeRadar_RegionDropDown_OnClick()
UIDropDownMenu_SetSelectedID(RecipeRadar_RegionDropDown, this:GetID())
RecipeRadar_NewRegion(this:GetText())
RecipeRadarListScrollFrameScrollBar:SetValue(0)
RecipeRadar_FrameUpdate()
end
function RecipeRadar_OptionsFrame_DisableDropDown(dropdown)
getglobal(dropdown:GetName().."Text"):SetVertexColor(
GRAY_FONT_COLOR.r, GRAY_FONT_COLOR.g, GRAY_FONT_COLOR.b)
getglobal(dropdown:GetName().."Button"):Disable()
end
function RecipeRadar_OptionsFrame_EnableDropDown(dropdown)
getglobal(dropdown:GetName().."Text"):SetVertexColor(
HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b)
getglobal(dropdown:GetName().."Button"):Enable()
end
+241
View File
@@ -0,0 +1,241 @@
<?xml version="1.0" encoding="utf-8" ?>
<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="OptionsFrame.lua"/>
<Frame name="RecipeRadarOptionsFrame" toplevel="true" frameStrata="DIALOG" movable="true" enableMouse="true" hidden="true" parent="UIParent" enableKeyboard="true">
<Size>
<AbsDimension x="300" y="360"/>
</Size>
<Anchors>
<Anchor point="CENTER"/>
</Anchors>
<Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
<BackgroundInsets>
<AbsInset left="11" right="12" top="12" bottom="11"/>
</BackgroundInsets>
<TileSize>
<AbsValue val="32"/>
</TileSize>
<EdgeSize>
<AbsValue val="32"/>
</EdgeSize>
</Backdrop>
<Layers>
<Layer level="ARTWORK">
<Texture name="RecipeRadarOptionsFrameHeader" file="Interface\DialogFrame\UI-DialogBox-Header">
<Size>
<AbsDimension x="256" y="64"/>
</Size>
<Anchors>
<Anchor point="TOP">
<Offset>
<AbsDimension x="0" y="12"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
<FontString name="RecipeRadarOptionsFrameHeaderText" inherits="GameFontNormal">
<Anchors>
<Anchor point="TOP" relativeTo="RecipeRadarOptionsFrameHeader">
<Offset>
<AbsDimension x="0" y="-14"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Frames>
<!-- Check availability for alts checkbox -->
<CheckButton name="RecipeRadarRealmAvailability" inherits="OptionsCheckButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="40" y="-40"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
getglobal(this:GetName() .. "Text"):SetText(RRS("Check Availability for Alts"))
</OnLoad>
<OnClick>
if (this:GetChecked()) then
PlaySound("igMainMenuOptionCheckBoxOn")
else
PlaySound("igMainMenuOptionCheckBoxOff")
end
RecipeRadar_Availability_Toggle()
</OnClick>
</Scripts>
</CheckButton>
<!-- Show minimap button checkbox -->
<CheckButton name="RecipeRadarShowMinimapButton" inherits="OptionsCheckButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="40" y="-80"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
getglobal(this:GetName() .. "Text"):SetText(RRS("Show Minimap Button"))
</OnLoad>
<OnClick>
if (this:GetChecked()) then
PlaySound("igMainMenuOptionCheckBoxOn")
else
PlaySound("igMainMenuOptionCheckBoxOff")
end
RecipeRadar_MinimapButton_Toggle()
</OnClick>
</Scripts>
</CheckButton>
<!-- Minimap button position slider -->
<Slider name="RecipeRadarMinimapButtonPositionSlider" inherits="OptionsSliderTemplate">
<Size>
<AbsDimension x="220" y="16"/>
</Size>
<Anchors>
<Anchor point="TOP">
<Offset>
<AbsDimension x="0" y="-130"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
getglobal(this:GetName() .. "Text"):SetText(RRS("Minimap Button Position"))
getglobal(this:GetName() .. "High"):SetText()
getglobal(this:GetName() .. "Low"):SetText()
RecipeRadarMinimapButtonPositionSlider:SetMinMaxValues(0, 360)
RecipeRadarMinimapButtonPositionSlider:SetValueStep(1)
</OnLoad>
<OnValueChanged>
RecipeRadar_Options.MinimapButtonPosition = this:GetValue()
RecipeRadar_MinimapButton_UpdatePosition()
</OnValueChanged>
</Scripts>
</Slider>
<!-- Auto-select region checkbox -->
<CheckButton name="RecipeRadarAutoSelectRegionButton" inherits="OptionsCheckButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="40" y="-160"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
getglobal(this:GetName() .. "Text"):SetText(RRS("Auto-select Current Region"))
</OnLoad>
<OnClick>
RecipeRadar_OptionsFrame_AutoSelectRegion_OnClick()
</OnClick>
</Scripts>
</CheckButton>
<!-- Region selection dropdowns -->
<Frame name="RecipeRadar_ContinentDropDown" inherits="UIDropDownMenuTemplate">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="50" y="-197"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
RecipeRadar_ContinentDropDown_OnLoad()
</OnLoad>
</Scripts>
</Frame>
<Frame name="RecipeRadar_RegionDropDown" inherits="UIDropDownMenuTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="RecipeRadar_ContinentDropDown" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-2"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
RecipeRadar_RegionDropDown_OnLoad()
</OnLoad>
</Scripts>
</Frame>
<!-- Auto-select region checkbox -->
<CheckButton name="RecipeRadarAutoMapVendorsButton" inherits="OptionsCheckButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="40" y="-270"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
getglobal(this:GetName() .. "Text"):SetText(RRS("Auto-map Contributive Vendors"))
</OnLoad>
<OnClick>
if (this:GetChecked()) then
PlaySound("igMainMenuOptionCheckBoxOn")
RecipeRadar_Options.AutoMapVendors = true
RecipeRadar_InitVendorFilters()
RecipeRadar_FrameUpdate()
else
PlaySound("igMainMenuOptionCheckBoxOff")
RecipeRadar_Options.AutoMapVendors = false
end
</OnClick>
</Scripts>
</CheckButton>
<!-- Okay/done button -->
<Button inherits="OptionsButtonTemplate" text="OKAY">
<Anchors>
<Anchor point="BOTTOM">
<Offset>
<AbsDimension x="0" y="20"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
PlaySound("gsTitleOptionOK")
RecipeRadar_OptionsFrame_Toggle()
</OnClick>
</Scripts>
</Button>
</Frames>
<Scripts>
<OnLoad>
RecipeRadar_OptionsFrame_OnLoad()
</OnLoad>
<OnShow>
RecipeRadar_OptionsFrame_OnShow()
</OnShow>
<OnKeyDown>
if (arg1 == "ESCAPE") then
RecipeRadar_OptionsFrame_Toggle()
end
</OnKeyDown>
</Scripts>
</Frame>
</UI>
+69
View File
@@ -0,0 +1,69 @@
Recipe Radar
(by Jay Miller [jnmiller@cryptofreak.org])
http://www.cryptofreak.org/projects/reciperadar
$Id: README.txt 299 2006-04-24 17:34:12Z jnmiller $
Installation
~~~~~~~~~~~~
You've probably already installed the addon. In case you're not sure how
to do it, unzip the archive to your
... \World of Warcraft\Interface\AddOns
directory. A new directory called 'RecipeRadar' should appear, along with
several files and subdirectories. That should be all you need to do to
use Recipe Radar.
When you get in game, you may want to map a key to toggle Recipe Radar.
You should be able to find the option to do this in your Key Bindings menu,
all the way at the bottom. Otherwise, you can hit the new icon on your
minimap to open Recipe Radar or use the slash command, '/rrdr'.
Bugs
~~~~
If you spot a bug in this software, *please let me know!* The best way
to do so is to hit the bug tracker at
http://sourceforge.net/tracker/?group_id=165127
and leave a short report on what was happening at the time. If possible,
please include the version of Recipe Radar that caused the bug and the
language of your WoW client.
Also in the bugs category are misplaced vendors. The location information
for all of the vendors in the Recipe Radar database was retrieved in a
mostly automated way, so some coordinates are incorrect. If you come upon
a vendor whose mapped location does not match their actual location, please
let me know! The most helpful thing you can do is this quick process:
1) Unmap all but the problematic vendor.
2) Move your toon exactly on top of the vendor.
3) Type '/rrdr debug vendor'.
4) Record the text you see. It should resemble this:
Debugging Drac Roughcut
Database Coords: 0.356, 0.491
Player Coords: 0.35588067770004, 0.48890501260757
5) File a bug report and include this text.
Thank you very much for your help!
Acknowledgements
~~~~~~~~~~~~~~~~
- I'd like to thank Nimrah for passing on Technetium's TGAtoBLP2 code.
It dropped the almost 50 maps from 343k each to 130k each!
- I stole the clean, simple minimap button code from Atlas, as well
as the nice version display idea.
- The minimap mapping methods and constants are all from the original
MapNotes - awesome work, it was.
Thanks for trying Recipe Radar! Enjoy!
+498
View File
@@ -0,0 +1,498 @@
-- RadarTab.lua: handles clicking and drawing for the Radar tab
-- $Id: RadarTab.lua 443 2006-09-01 04:41:40Z jnmiller $
function RecipeRadar_RadarTab_Init()
RecipeRadar_Prof1DropDown:Show()
RecipeRadar_Prof2DropDown:Hide()
RecipeRadar_SetActiveTab(1)
RecipeRadar_RadarTab_Update()
RecipeRadarListScrollFrameScrollBar:SetValue(
RecipeRadarRadarTabFrame.ScrollValue)
end
function RecipeRadar_RadarTab_OnClick()
if (RecipeRadar_Options.ActiveTab == 1) then
return
end
PlaySound("igSpellBookClose")
RecipeRadar_RadarTab_Init()
end
function RecipeRadar_RadarTab_ExpandAll(expand)
local region = RecipeRadar_RegionData[RecipeRadar_Options.CurrentRegion]
if (not region) then return end
for _, vendor in region.Vendors do
vendor.IsExpanded = expand
end
RecipeRadar_SelectFirstRecipe()
RecipeRadar_FrameUpdate()
end
function RecipeRadar_RadarTab_Update()
if (RecipeRadar_Options.ActiveTab ~= 1) then
return
end
local title = RRS("Recipe Radar")
if (RecipeRadar_Options.CurrentRegion) then
title = title .. " - " .. RecipeRadar_Options.CurrentRegion
local parens = string.find(title, " %(")
if (parens) then -- remove parenthesized zone title
title = string.sub(title, 1, parens - 1)
end
end
TitleBarText:SetText(title)
-- some globals for the Update() procedure
RecipeRadar_row = 0
RecipeRadar_last_button = ""
RecipeRadar_ContextMenuGlobal.RadarTabHasExpanded = false
RecipeRadar_ContextMenuGlobal.RadarTabHasCollapsed = false
RecipeRadarHighlightFrame:Hide()
local region = RecipeRadar_RegionData[RecipeRadar_Options.CurrentRegion]
-- only populate the scroll frame if we have valid region data
if (region) then
RecipeRadar_SortVendors(region)
table.foreach(region.Vendors, RecipeRadar_RadarTab_AddVendor)
end
-- update the scroll position and the width of the highlight frame
FauxScrollFrame_Update(RecipeRadarListScrollFrame, RecipeRadar_row,
RECIPERADAR_VENDORS_DISPLAYED, RECIPERADAR_VENDOR_HEIGHT,
nil, nil, nil, RecipeRadarHighlightFrame, 361, 384)
-- update the widths of the vendor/recipe buttons after scroll update
for i = 1, RECIPERADAR_VENDORS_DISPLAYED do
local button = getglobal("RecipeRadarVendor" .. i)
if (i > RecipeRadar_row) then
button:Hide()
elseif (button.Recipe) then
if (RecipeRadarListScrollFrame:IsVisible()) then
button:SetWidth(361 - RECIPERADAR_VENDOR_OFFSET)
else
button:SetWidth(384 - RECIPERADAR_VENDOR_OFFSET)
end
else
if (RecipeRadarListScrollFrame:IsVisible()) then
button:SetWidth(361)
else
button:SetWidth(384)
end
end
end
-- update the current selection (or lack thereof)
if (not region or not RecipeRadarRadarTabFrame.SelectedRecipe) then
RecipeRadar_HideRecipeDetails()
elseif (RecipeRadarRadarTabFrame.SelectedVendor) then
RecipeRadar_SetSelection(RecipeRadarRadarTabFrame.SelectedVendor,
RecipeRadarRadarTabFrame.SelectedRecipe)
RecipeRadar_ShowRecipeDetails()
end
end
-- This function is called for each vendor during the main update. It
-- adds the vendor and her recipes, if appropriate, to the main scroll frame.
function RecipeRadar_RadarTab_AddVendor(key, vendor)
-- don't add the vendor if she or her recipes are filtered
if (vendor.IsFiltered or not RecipeRadar_VendorHasRecipes(vendor)) then
if (vendor.IsMapped) then
RecipeRadar_Maps_RemoveVendor(vendor)
end
return
end
RecipeRadar_row = RecipeRadar_row + 1
local offset = FauxScrollFrame_GetOffset(RecipeRadarListScrollFrame)
local index = RecipeRadar_row - offset
-- reset our radio button to red/off in case there are no listed vendors
RecipeRadarMapVendorIndicator:SetVertexColor(1.0, 0, 0)
-- only do the following if we're in the scroll frame's visible portion
if (index > 0 and index <= RECIPERADAR_VENDORS_DISPLAYED) then
local button = getglobal("RecipeRadarVendor" .. index)
-- decide the horizontal offset of this button
if (index == 1) then
button:SetPoint("TOPLEFT", "RecipeRadarFrame",
"TOPLEFT", 22, -96)
elseif (RecipeRadar_last_button == "recipe") then
button:SetPoint("TOPLEFT", "RecipeRadarVendor" .. index - 1,
"BOTTOMLEFT", -RECIPERADAR_VENDOR_OFFSET, 0)
elseif (RecipeRadar_last_button == "vendor") then
button:SetPoint("TOPLEFT", "RecipeRadarVendor" .. index - 1,
"BOTTOMLEFT", 0, 0)
end
-- this variable decides the next button's horizontal offset
RecipeRadar_last_button = "vendor"
-- basic drawing code
button:UnlockHighlight()
button:SetText(vendor.Name)
RecipeRadar_SetButtonColors(button, RecipeRadar_Teams[vendor.Team].Color)
button:SetID(index)
button:Show()
-- drawing code for the little subtext field
local subtext = getglobal("RecipeRadarVendor" .. index .. "SubText")
if (vendor.Notes and vendor.Notes ~= "") then
local note = RecipeRadar_FormatVendorNote(vendor.Notes, true)
VendorNameDummySubText:SetText(note .. " ")
subtext:SetText(note)
button.r = RecipeRadar_Teams[vendor.Team].Color.r
button.g = RecipeRadar_Teams[vendor.Team].Color.g
button.b = RecipeRadar_Teams[vendor.Team].Color.b
subtext:SetTextColor(
RecipeRadar_Teams[vendor.Team].Color.r,
RecipeRadar_Teams[vendor.Team].Color.g,
RecipeRadar_Teams[vendor.Team].Color.b)
subtext:SetPoint("LEFT", "RecipeRadarVendor" .. index .. "Text",
"RIGHT", 10, 0)
subtext:Show()
else
subtext:Hide()
end
-- show or hide the little mapped indicator check mark
local check = getglobal("RecipeRadarVendor" .. index .. "Check")
if (vendor.IsMapped) then
VendorNameDummyText:SetText(vendor.Name .. " ")
local check_offset = VendorNameDummyText:GetWidth() + 24
if (vendor.Notes and vendor.Notes ~= "") then
check_offset = check_offset + VendorNameDummySubText:GetWidth()
end
check:SetPoint("TOPLEFT", "RecipeRadarVendor" .. index, "TOPLEFT",
check_offset, 0)
check:Show()
else
check:Hide()
end
-- unset to indicate this is a vendor header for the tooltip stuff
button.Recipe = nil
-- icon highlight is different for vendors than recipes
getglobal("RecipeRadarVendor" .. index .. "Highlight"):SetTexture(
"Interface\\Buttons\\UI-PlusButton-Hilight")
if (vendor.IsExpanded ~= false) then
RecipeRadar_ContextMenuGlobal.RadarTabHasExpanded = true
button:SetNormalTexture("Interface\\Buttons\\UI-MinusButton-Up")
else
RecipeRadar_ContextMenuGlobal.RadarTabHasCollapsed = true
button:SetNormalTexture("Interface\\Buttons\\UI-PlusButton-Up")
return
end
else
-- if the vendor is collapsed, we don't need to count her recipes
if (vendor.IsExpanded == false) then
RecipeRadar_ContextMenuGlobal.RadarTabHasCollapsed = true
return
else
RecipeRadar_ContextMenuGlobal.RadarTabHasExpanded = true
end
end
RecipeRadar_SortRecipes(vendor)
for _, recipe in vendor.Recipes do
-- skip filtered recipes, of course
if (not RecipeRadar_IsRecipeFiltered(recipe)) then
RecipeRadar_row = RecipeRadar_row + 1
index = RecipeRadar_row - offset;
-- only do this if we're in the scroll frame's visible portion
if (index > 0 and index <= RECIPERADAR_VENDORS_DISPLAYED) then
local button = getglobal("RecipeRadarVendor" .. index)
-- decide the horizontal offset of this button
if (index == 1) then
button:SetPoint("TOPLEFT", "RecipeRadarFrame",
"TOPLEFT", 22 + RECIPERADAR_VENDOR_OFFSET, -96)
elseif (RecipeRadar_last_button == "recipe") then
button:SetPoint("TOPLEFT", "RecipeRadarVendor" .. index - 1,
"BOTTOMLEFT", 0, 0)
elseif (RecipeRadar_last_button == "vendor") then
button:SetPoint("TOPLEFT", "RecipeRadarVendor" .. index - 1,
"BOTTOMLEFT", RECIPERADAR_VENDOR_OFFSET, 0)
end
-- this variable decides the next button's horizontal offset
RecipeRadar_last_button = "recipe"
-- generic list item drawing
RecipeRadar_DrawListItem(index, recipe)
-- radar tab-specific list item drawing
button:SetNormalTexture(RecipeRadar_Professions[recipe.Type].Icon)
getglobal("RecipeRadarVendor" .. index .. "Check"):Hide()
getglobal("RecipeRadarVendor" .. index .. "Highlight"):
SetTexture(RECIPERADAR_IMAGE_ROOT .. "Icons\\Highlight")
-- selected recipes look a little bit different
if (RecipeRadarRadarTabFrame.SelectedRecipe == recipe) then
RecipeRadarHighlightFrame:SetPoint("TOPLEFT",
"RecipeRadarVendor" .. index, "TOPLEFT", -22, 0)
RecipeRadarHighlightFrame:Show()
button:LockHighlight()
else
button:UnlockHighlight()
end
end
end
end
end
-- Handles a vendor/recipe button click in the main scroll frame. The
-- supplied index is row + offset in the scroll frame. index may also
-- be set to -1 to select the first visible recipe.
function RecipeRadar_RadarTab_ServiceClickIndex(index, button)
local region = RecipeRadar_RegionData[RecipeRadar_Options.CurrentRegion]
if (not region) then return end
if (not button) then button = "LeftButton" end
-- save this index so we can return to it on tab switch
RecipeRadarRadarTabFrame.SelectedIndex = index
-- sort the vendors so we're counting in the right order
RecipeRadar_SortVendors(region)
local row = 0
-- iterate through each vendor, counting up to index
for _, vendor in region.Vendors do
-- if this vendor is filtered, she does not count towards our index
if (not vendor.IsFiltered and RecipeRadar_VendorHasRecipes(vendor)) then
row = row + 1
if (row == index) then
if (button == "LeftButton") then
-- if the shift key is down, the user wants to (un)map this vendor
if (IsShiftKeyDown()) then
if (vendor.IsMapped) then
RecipeRadar_Maps_RemoveVendor(vendor)
else
RecipeRadar_Maps_AddVendor(vendor,
RecipeRadar_Options.CurrentRegion)
end
-- otherwise, we collapse or expand the vendor button
else
RecipeRadar_RadarTab_ToggleExpanded(vendor)
end
return
elseif (button == "RightButton") then
HideDropDownMenu(1)
RecipeRadar_ContextMenuGlobal.Vendor = vendor
RecipeRadar_RadarTab_ContextMenuOnLoad()
ToggleDropDownMenu(1, nil, RadarTabDropDown,
this:GetName(), GetCursorPosition(), 0)
return
end
end
if (vendor.IsExpanded ~= false) then
-- sort the recipes so we're counting in the right order
RecipeRadar_SortRecipes(vendor)
local vendor_index = row
-- iterate through each recipe, counting up to index
for _, recipe in vendor.Recipes do
-- don't count filtered recipes
if (not RecipeRadar_IsRecipeFiltered(recipe)) then
row = row + 1
-- if index is -1, this catches on the first iteration
if (row == index or index == -1) then
if (button == "LeftButton") then
-- if the shift key is down, we map this recipe's vendor
if (IsShiftKeyDown()) then
if (vendor.IsMapped) then
RecipeRadar_Maps_RemoveVendor(vendor)
else
RecipeRadar_Maps_AddVendor(vendor,
RecipeRadar_Options.CurrentRegion)
end
end
-- otherwise, select this recipe and show its details
RecipeRadarRadarTabFrame.SelectedVendor = vendor
RecipeRadarRadarTabFrame.SelectedRecipe = recipe
RecipeRadar_SetSelection(vendor, recipe)
RecipeRadar_ShowRecipeDetails()
return
elseif (button == "RightButton") then
HideDropDownMenu(1)
RecipeRadar_ContextMenuGlobal.Vendor = vendor
RecipeRadar_RadarTab_ContextMenuOnLoad()
ToggleDropDownMenu(1, nil, RadarTabDropDown,
this:GetName(), GetCursorPosition(), 0)
return
end
end
end
end
end
end
end
-- if the index was not found, select nothing
RecipeRadar_RadarTab_ClearSelection()
RecipeRadar_HideRecipeDetails()
end
function RecipeRadar_RadarTab_ToggleExpanded(vendor)
if (vendor.IsExpanded == false) then
vendor.IsExpanded = true
else
vendor.IsExpanded = false
end
RecipeRadar_RadarTab_ClearSelection()
RecipeRadar_FrameUpdate()
end
function RecipeRadar_RadarTab_ClearSelection()
RecipeRadarRadarTabFrame.SelectedVendor = nil
RecipeRadarRadarTabFrame.SelectedRecipe = nil
end
-- OnLoad event handler for the right-click context menu for map buttons.
function RecipeRadar_RadarTab_ContextMenuOnLoad()
UIDropDownMenu_Initialize(RadarTabDropDown,
RecipeRadar_RadarTab_ContextMenuInit, "MENU")
end
-- Initialization routine for the right-click context menu for map buttons.
function RecipeRadar_RadarTab_ContextMenuInit()
if (not RecipeRadar_ContextMenuGlobal.Vendor) then return end
-- putting in the vendor's name as the title of the popup
local item = { }
item.text = RecipeRadar_ContextMenuGlobal.Vendor.Name
item.isTitle = 1
item.notCheckable = 1
UIDropDownMenu_AddButton(item)
item = { }
if (RecipeRadar_ContextMenuGlobal.Vendor.IsMapped) then
item.text = RRS("Unmap Vendor")
item.value = "unmap"
else
item.text = RRS("Map Vendor")
item.value = "map"
end
item.notCheckable = 1
item.func = RecipeRadar_RadarTab_ContextMenuOnClick
UIDropDownMenu_AddButton(item)
item = { }
item.text = RRS("Expand All")
item.value = "expandall"
item.notCheckable = 1
item.func = RecipeRadar_RadarTab_ContextMenuOnClick
if (not RecipeRadar_ContextMenuGlobal.RadarTabHasCollapsed) then
item.disabled = 1
end
UIDropDownMenu_AddButton(item)
item = { }
item.text = RRS("Collapse All")
item.value = "collapseall"
item.notCheckable = 1
item.func = RecipeRadar_RadarTab_ContextMenuOnClick
if (not RecipeRadar_ContextMenuGlobal.RadarTabHasExpanded) then
item.disabled = 1
end
UIDropDownMenu_AddButton(item)
item = { }
item.text = CANCEL
item.notCheckable = 1
item.func = RecipeRadar_RadarTab_ContextMenuOnClick
UIDropDownMenu_AddButton(item)
end
-- OnClick event handler for the right-click context menu for map buttons.
function RecipeRadar_RadarTab_ContextMenuOnClick()
if (this.value == "unmap") then
RecipeRadar_Maps_RemoveVendor(RecipeRadar_ContextMenuGlobal.Vendor)
RecipeRadar_FrameUpdate()
elseif (this.value == "map") then
RecipeRadar_Maps_AddVendor(RecipeRadar_ContextMenuGlobal.Vendor,
RecipeRadar_Options.CurrentRegion)
RecipeRadar_FrameUpdate()
elseif (this.value == "expandall") then
RecipeRadar_RadarTab_ExpandAll(true)
elseif (this.value == "collapseall") then
RecipeRadar_RadarTab_ExpandAll(false)
end
end
File diff suppressed because it is too large Load Diff
+628
View File
@@ -0,0 +1,628 @@
-- RecipeRadar.lua: main event code and general utility functions
-- $Id: RecipeRadar.lua 464 2006-09-18 18:05:57Z jnmiller $
function RecipeRadar_OnLoad()
tinsert(UISpecialFrames, "RecipeRadarFrame")
UIPanelWindows["RecipeRadarFrame"] = nil
SLASH_RecipeRadar1 = "/rrdr"
SLASH_RecipeRadar2 = "/reciperadar"
SlashCmdList["RecipeRadar"] = RecipeRadar_SlashHandler
this:RegisterEvent("VARIABLES_LOADED")
this:RegisterEvent("ZONE_CHANGED_NEW_AREA")
this:RegisterEvent("MINIMAP_UPDATE_ZOOM")
this:RegisterEvent("WORLD_MAP_UPDATE")
this:RegisterEvent("CRAFT_SHOW")
this:RegisterEvent("TRADE_SKILL_SHOW")
this:RegisterEvent("CHAT_MSG_SKILL")
this:RegisterEvent("CHAT_MSG_SYSTEM")
this:RegisterEvent("PLAYER_ENTERING_WORLD")
-- RecipeRadar_Print("Recipe Radar loaded!")
end
function RecipeRadar_OnEvent()
if (event == "VARIABLES_LOADED") then
RecipeRadar_Globals_Init()
RecipeRadar_MinimapButton_Init()
RecipeRadar_Availability_Init()
RecipeRadar_Maps_Init()
RecipeRadar_SkillDB_Init()
RecipeRadar_MainFrame_Init()
RecipeRadar_DropDowns_Init()
RecipeRadar_SelectFirstRecipe()
elseif (event == "ZONE_CHANGED_NEW_AREA") then
if (RecipeRadar_RegionHasLearnableRecipe(GetRealZoneText())) then
RecipeRadar_MinimapButton_Flash()
end
RecipeRadar_Minimap_OnNewRegion()
if (RecipeRadar_Options.AutoSelectRegion) then
RecipeRadar_NewRegion(GetRealZoneText())
end
elseif (event == "ADDON_LOADED" and arg1 == "RecipeRadar") then
--
elseif (event == "PLAYER_ENTERING_WORLD") then
if (RecipeRadar_Filters.Teams["Horde"] == nil) then
-- this should be the first run of the addon, so set team filters
RecipeRadar_Filters.Teams[UnitFactionGroup("player")] = false
RecipeRadar_Filters.Teams
[RecipeRadar_GetOpposingFaction("player")] = true
end
elseif (event == "MINIMAP_UPDATE_ZOOM") then
RecipeRadar_Minimap_SetIndoorness()
elseif (event == "WORLD_MAP_UPDATE") then
RecipeRadar_Worldmap_UpdateButtons()
elseif (event == "CRAFT_SHOW") then
RecipeRadar_SkillDB_Refresh("craft")
elseif (event == "TRADE_SKILL_SHOW") then
RecipeRadar_SkillDB_Refresh("trade")
elseif (event == "CHAT_MSG_SKILL") then
-- arg1 = eg. "Your skill in Cooking has increased to 221."
RecipeRadar_ParseChatMessage(arg1)
elseif (event == "CHAT_MSG_SYSTEM") then
-- arg1 = eg. "You have learned how to create a new item: Bristle Whisker Catfish."
RecipeRadar_ParseChatMessage(arg1)
end
end
function RecipeRadar_OnShow()
--PlaySound("igCharacterInfoOpen")
end
function RecipeRadar_OnHide()
PlaySound("igCharacterInfoClose")
RecipeRadarFrame:StopMovingOrSizing()
end
function RecipeRadar_SlashHandler(msg)
local _, _, cmd, arg1, arg2 = string.find(msg, "(%w+)%s*(%w*)%s*(%w*)")
if (cmd == "debug") then
if (arg1 == "vendor") then
RecipeRadar_Options.PositionDebug = true
end
if (arg1 == "skills") then
RecipeRadar_SkillDB_Print(arg2)
end
if (arg1 == "clear") then
RecipeRadar_SkillDB_Clear(arg2)
end
return
end
if (cmd == "radar") then
local region = RecipeRadar_RegionData[GetRealZoneText()]
if (not region) then return end
for _, vendor in region.Vendors do
RecipeRadar_Print(RecipeRadar_GetColoredTeamString(
vendor.Team, vendor.Name) .. " (" ..
string.format("%d", vendor.Coordinates[1].x * 100) .. ", " ..
string.format("%d", vendor.Coordinates[1].y * 100) .. "):")
table.sort(vendor.Recipes, RecipeRadar_CompareSkills)
table.foreach(vendor.Recipes, RecipeRadar_PrintRecipe)
end
return
end
RecipeRadar_Toggle()
end
-- Function to be called on selecting a new region to initialize the
-- main frame and any active filters.
function RecipeRadar_NewRegion(region)
if (not region or region == "") then return end
RecipeRadar_Options.CurrentRegion = region
RecipeRadar_Options.CurrentContinent = RecipeRadar_GetCurrentContinent()
RecipeRadar_InitVendorFilters()
RecipeRadar_SelectFirstRecipe()
RecipeRadar_FrameUpdate()
end
-- Returns whether the given region contains at least one recipe that
-- is learnable by the player or (optionally) alts
function RecipeRadar_RegionHasLearnableRecipe(region_name)
local region_data = RecipeRadar_RegionData[region_name]
if (not region_data) then return false end
for _, vendor in region_data.Vendors do
for _, recipe in vendor.Recipes do
if (RecipeRadar_Availability_IsLearnable(recipe)) then
return true
end
end
end
return false
end
-- Given a table of recipes, returns the number of recipes that are
-- learnable by the player or (optionally) alts.
function RecipeRadar_CountLearnableRecipes(recipes)
if (not recipes) then return 0 end
local total = 0
for _, recipe in recipes do
if (RecipeRadar_Availability_IsLearnable(recipe)) then
total = total + 1
end
end
return total
end
-- Returns the index of the current region's continent, or 0 if the
-- player is not in a known map zone (eg. she's in an instance).
function RecipeRadar_GetCurrentContinent()
local region = RecipeRadar_RegionData[RecipeRadar_Options.CurrentRegion]
-- this mess derives the current continent from the current region
if (region) then
return region.Continent
else
-- region is not one with recipes, so we search for it
for cont_id, _ in { GetMapContinents() } do
for _, zone in { GetMapZones(cont_id) } do
if (RecipeRadar_Options.CurrentRegion == zone) then
return cont_id
end
end
end
return 0
end
end
-- Converts a format string to one that LUA can understand. I've
-- shamelessly stolen this from Innerfire in order to (I hope) prevent
-- the combat chatlog parsing errors.
function RecipeRadar_ConvertFormat(fmt)
-- remove non-English format params like "%1$s"
local find = string.gsub(fmt, "%%%d%$", "%%")
-- remove any special characters with escaped versions
find = string.gsub(find, "([%^%$%(%)%.%[%]%*%+%-%?])", "%%%1")
-- finally replace standard "%s" and "%d"
find = string.gsub(find, "%%s", "(.+)")
find = string.gsub(find, "%%d", "(%%d+)")
return find
end
-- Parses the input for a couple of known message formats to gain information
-- about changes in the character's skills.
function RecipeRadar_ParseChatMessage(msg)
-- messages of the form 'Your skill in %s has increased to %d.'
local start, _, prof, rank =
string.find(msg, RecipeRadar_ConvertFormat(ERR_SKILL_UP_SI))
if (start) then
RecipeRadar_SkillDB_SetRank(prof, rank)
end
-- messages of the form 'You have unlearned %s.'
start, _, prof =
string.find(msg, RecipeRadar_ConvertFormat(ERR_SPELL_UNLEARNED_S))
if (prof) then
RecipeRadar_SkillDB_GetPlayerProfessions()[prof] = nil
end
end
-- Foreach function that prints a recipe link and its cost.
function RecipeRadar_PrintRecipe(index, recipe)
RecipeRadar_Print(" " .. RecipeRadar_GetHyperlinkByID(recipe.ID) ..
", " .. RecipeRadar_GetGSCString(recipe.Cost))
end
-- Returns a string describing an item link from an item ID.
function RecipeRadar_GetHyperlinkByID(id)
local name, link, color = RecipeRadar_GetSafeItemInfo(id)
return RecipeRadar_GetHyperlinkByParts(name, link, color)
end
-- Returns a string describing an item link from link components.
function RecipeRadar_GetHyperlinkByParts(name, link, color)
return string.format("%s|H%s|h[%s]|h|r", color, link, name)
end
-- If an item is not in your local cache, GetItemInfo() fails. To work
-- around this, we just return 'uncached' along with the details we do know.
-- If an item is recognized by the client, we cache the name so that future
-- requests don't end up fully 'uncached'. The final return value is a
-- boolean indicating whether it was a cached ID.
function RecipeRadar_GetSafeItemInfo(id)
local name, link, rarity, _, _, _, _, _, texture = GetItemInfo(id)
-- initialize our name cache if necessary
if (not RecipeRadar_NameCache) then RecipeRadar_NameCache = { } end
if (name == nil) then
-- set returned name according to whether we've already seen the id
if (RecipeRadar_NameCache[id]) then
name = RecipeRadar_NameCache[id]
else
name = RRS("Uncached Recipe")
end
-- create our own tooltip for uncached items
return name, "item:" .. id .. ":0:0:0",
RecipeRadar_ColorToCode(RecipeRadar_Colors.UncachedRecipe),
RecipeRadar_Colors.UncachedRecipe.r,
RecipeRadar_Colors.UncachedRecipe.g,
RecipeRadar_Colors.UncachedRecipe.b,
RECIPERADAR_IMAGE_ROOT .. "Misc\\QuestionMark",
false -- boolean to indicate whether we got a real recipe
else
RecipeRadar_NameCache[id] = name -- cache names
local r, g, b, colorcode = GetItemQualityColor(rarity)
return name, link, colorcode, r, g, b, texture, true
end
end
function RecipeRadar_RegionNameToID(region_name, continent)
local index = 0
for _, zone in { GetMapZones(continent) } do
index = index + 1
if (region_name == zone) then
return index
end
end
RecipeRadar_Print("ASSERT FAILED: region '" .. region_name ..
"' not found by GetMapZones()!")
return nil
end
-- Formats the subtext that applies to a few vendors. include_parens is
-- a boolean that specifies whether the string should be in parens.
function RecipeRadar_FormatVendorNote(note, include_parens)
if (include_parens) then
return format(TEXT(PARENS_TEMPLATE), format(RRS("%s Vendor"), note))
end
return format(RRS("%s Vendor"), note)
end
-- Get gold, silver, copper from total copper.
function RecipeRadar_GetGSC(copper)
if (copper == nil) then
copper = 0
end
local g = math.floor(copper / 10000)
local s = math.floor((copper - (g * 10000)) / 100)
local c = math.floor(copper - (g * 10000) - (s * 100))
return g, s, c
end
-- Format text by color for gold, silver and copper (from EnhTooltip).
function RecipeRadar_GetGSCString(copper)
local TEXT_NONE = "0"
local GSC_GOLD = "ffd100"
local GSC_SILVER = "e6e6e6"
local GSC_COPPER = "c8602c"
local GSC_FMT = "|cff%s%d|r"
local GSC_PART = ".|cff%s%02d|r"
local GSC_NONE = "|cffa0a0a0" .. TEXT_NONE .. "|r"
local g, s, c = RecipeRadar_GetGSC(copper)
local gsc = ""
if (g > 0) then
gsc = string.format(GSC_FMT, GSC_GOLD, g)
if (s > 0) then
gsc = gsc .. string.format(GSC_PART, GSC_SILVER, s)
end
if exact then
gsc = gsc .. string.format(GSC_PART,GSC_COPPER, c)
end
elseif (s > 0) then
gsc = string.format(GSC_FMT, GSC_SILVER, s)
if (c > 0) then
gsc = gsc .. string.format(GSC_PART, GSC_COPPER, c)
end
elseif (c > 0) then
gsc = gsc .. string.format(GSC_FMT, GSC_COPPER, c)
else
gsc = GSC_NONE
end
return gsc
end
-- Returns the name of the player's opposing faction.
-- These strings shouldn't need to be localized.
function RecipeRadar_GetOpposingFaction()
if (UnitFactionGroup("player") == "Alliance") then
return "Horde"
elseif (UnitFactionGroup("player") == "Horde") then
return "Alliance"
end
return "Unknown"
end
-- Formats a string in the color specified by the key 'team'.
function RecipeRadar_GetColoredTeamString(team, s)
if (not RecipeRadar_Teams[team]) then return end
return RecipeRadar_ColorToCode(RecipeRadar_Teams[team].Color) ..
s .. FONT_COLOR_CODE_CLOSE
end
-- Returns whether the skill is an applicable profession.
function RecipeRadar_IsProfession(skill_name)
for name, _ in RecipeRadar_Professions do
if (name == skill_name) then
return true
end
end
return false
end
-- Returns the profession under which a trade skill specialty belongs,
-- or false if skill_name is not a known specialty.
function RecipeRadar_IsProfessionSpecialty(skill_name)
for spec, prof in RecipeRadar_Specialties do
if (spec == skill_name) then
return prof
end
end
return false
end
-- Returns whether the supplied faction is one that Recipe Radar cares about.
function RecipeRadar_IsKnownFaction(faction)
for _, name in RecipeRadar_Factions do
if (name == faction) then
return true
end
end
return false
end
-- Returns whether the given vendor has at least one unfiltered recipe.
function RecipeRadar_VendorHasRecipes(vendor)
for _, recipe in vendor.Recipes do
if (not RecipeRadar_IsRecipeFiltered(recipe)) then
return true
end
end
return false
end
-- Returns whether the given recipe has at least one unfiltered location.
function RecipeRadar_RecipeHasLocations(recipe)
for _, location in recipe.Locations do
if (not location.IsFiltered) then
return true
end
end
return false
end
-- Returns a string describing the requirements to buy the given recipe
-- according to the recipe's Notes/Faction member, or nil.
function RecipeRadar_GetRecipeReqsString(recipe)
if (recipe.Notes and recipe.Notes ~= "") then
return recipe.Notes
end
if (recipe.Faction and recipe.Faction ~= "") then
return recipe.Faction .. ", " ..
getglobal("FACTION_STANDING_LABEL" .. recipe.Level)
end
return nil
end
-- Given a recipe name of the form 'Label: Name', returns 'Name'. It
-- does this by checking for a ':' and looking ahead two characters.
-- TODO: verify this with Asian/other languages.
function RecipeRadar_TrimRecipeLabel(recipe_name)
local label_end = string.find(recipe_name, ":")
if (label_end) then
return string.sub(recipe_name, label_end + 2)
end
return recipe_name
end
-- Sorts the vendors in a given region.
function RecipeRadar_SortVendors(region_data)
if (region_data.IsVendorTableSorted) then
return
end
table.sort(region_data.Vendors, RecipeRadar_CompareNames)
region_data.IsVendorTableSorted = true
end
-- Sorts the recipes on a given vendor.
function RecipeRadar_SortRecipes(container)
if (container.IsRecipeTableSorted) then
return
end
table.sort(container.Recipes, RecipeRadar_CompareSkills)
container.IsRecipeTableSorted = true
end
-- Sorts the locations on a given recipe.
function RecipeRadar_SortLocations(recipe_data)
if (recipe_data.IsLocationsTableSorted) then
return
end
table.sort(recipe_data.Locations, RecipeRadar_CompareRegions)
recipe_data.IsRecipeTableSorted = true
end
-- Sort comparison function on required skill first, then the recipe's
-- ID (to insure a deterministic order).
function RecipeRadar_CompareSkills(recipe1, recipe2)
if (recipe1.Skill == recipe2.Skill) then
return recipe1.ID < recipe2.ID
end
return recipe1.Skill < recipe2.Skill
end
-- Sort comparison function on vendor names.
function RecipeRadar_CompareNames(vendor1, vendor2)
return vendor1.Name < vendor2.Name
end
-- Sort comparison function on location names.
function RecipeRadar_CompareRegions(location1, location2)
if (location1.Region == location2.Region) then
return location1.Vendor < location2.Vendor
end
return location1.Region < location2.Region
end
-- Returns the result of the "<" operator on both major and minor portions.
function RecipeRadar_IsVersionLessThan(version1, version2)
local major1, minor1 = string.match(version1, "(%d+)\.(%d+)")
local major2, minor2 = string.match(version2, "(%d+)\.(%d+)")
if (major1 ~= major2) then
return major1+0 < major2+0
end
return minor1+0 < minor2+0
end
-- Returns a color code string converted from RGB decimals.
function RecipeRadar_ColorToCode(color)
return string.format("|cff%02x%02x%02x",
255 * color.r, 255 * color.g, 255 * color.b)
end
-- Returns the given string surrounded by the highlighted version of
-- base_color.
function RecipeRadar_HighlightString(s, base_color)
local highlight = {
r = math.min(1.0, base_color.r + RecipeRadar_Colors.Highlight),
g = math.min(1.0, base_color.g + RecipeRadar_Colors.Highlight),
b = math.min(1.0, base_color.b + RecipeRadar_Colors.Highlight), }
return RecipeRadar_ColorToCode(highlight) .. s .. FONT_COLOR_CODE_CLOSE
end
-- Basic chat frame printing function.
function RecipeRadar_Print(msg, r, g, b)
DEFAULT_CHAT_FRAME:AddMessage(msg,
(r or RecipeRadar_Colors.MainFont.r),
(g or RecipeRadar_Colors.MainFont.g),
(b or RecipeRadar_Colors.MainFont.b))
end
+19
View File
@@ -0,0 +1,19 @@
## Interface: 11200
## Version: 1.14
## Title: Recipe Radar
## Author: Jay Miller
## Notes: Locates vendors who sell recipes in the current region or by profession.
## Notes-ruRU: Показывает вендоров, которые продают рецепты в данной территории или в�е �витки профе��ии.
## Notes-deDE: Lokalisiert Händler, die Rezepte im Strombereich oder durch Beruf verkaufen.
## Notes-frFR: Localise les marchands qui vendent des recettes dans la région courante ou par profession.
## Notes-esES: Localiza a vendedores que venden recetas en la región actual o por la profesión.
## SavedVariables: RecipeRadar_SkillDB RecipeRadar_NameCache
## SavedVariablesPerCharacter: RecipeRadar_Options RecipeRadar_Filters
Localization.lua
Globals.lua
FrameTemplates.xml
Maps.xml
MinimapButton.xml
AvailabilityTooltip.xml
RecipeRadar.xml
OptionsFrame.xml
+826
View File
@@ -0,0 +1,826 @@
<?xml version="1.0" encoding="utf-8" ?>
<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="RegionData.lua"/>
<Script file="RecipeData.lua"/>
<Script file="RecipeRadar.lua"/>
<Script file="RadarTab.lua"/>
<Script file="RecipesTab.lua"/>
<Script file="MainFrame.lua"/>
<Script file="DropDowns.lua"/>
<Frame name="RecipeRadarFrame" toplevel="true" movable="true" parent="UIParent" enableMouse="true" hidden="true">
<Size>
<AbsDimension x="452" y="648"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="0" y="-104"/>
</Offset>
</Anchor>
</Anchors>
<HitRectInsets>
<AbsInset left="0" right="34" top="0" bottom="75"/>
</HitRectInsets>
<Layers>
<Layer level="BACKGROUND">
<Texture file = "Interface\FriendsFrame\FriendsFrameScrollIcon">
<Size>
<AbsDimension x="60" y="60"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="7" y="-6"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
</Layer>
<Layer level="BORDER">
<Texture file="Interface\Addons\RecipeRadar\Images\Frame\FrameTopLeft">
<Size>
<AbsDimension x="256" y="256"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT"/>
</Anchors>
</Texture>
<Texture file="Interface\Addons\RecipeRadar\Images\Frame\FrameTopRight">
<Size>
<AbsDimension x="256" y="256"/>
</Size>
<Anchors>
<Anchor point="TOPRIGHT"/>
</Anchors>
</Texture>
<Texture name="RecipeRadarFrameBottomLeft" file="Interface\Addons\RecipeRadar\Images\Frame\FrameBottomLeft">
<Size>
<AbsDimension x="256" y="512"/>
</Size>
<Anchors>
<Anchor point="BOTTOMLEFT"/>
</Anchors>
</Texture>
<Texture name="RecipeRadarFrameBottomRight" file="Interface\Addons\RecipeRadar\Images\Frame\FrameBottomRight">
<Size>
<AbsDimension x="256" y="512"/>
</Size>
<Anchors>
<Anchor point="BOTTOMRIGHT"/>
</Anchors>
</Texture>
<FontString name="TitleBarText" inherits="GameFontNormal">
<Anchors>
<Anchor point="TOP" relativeTo="RecipeRadarFrame" relativePoint="TOP">
<Offset>
<AbsDimension x="-7" y="-17"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString inherits="GameFontNormalSmall" text="RECIPERADAR_VERSION">
<Color r="0.4" g="0.4" b="0.4"/>
<Anchors>
<Anchor point="TOPRIGHT">
<Offset>
<AbsDimension x="-83" y="-19"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
<Layer level="ARTWORK">
<!-- Upper horizontal bar -->
<Texture file="Interface\Addons\RecipeRadar\Images\Frame\HorizontalBarLeft">
<Size>
<AbsDimension x="256" y="16"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="15" y="-221"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
<Texture file="Interface\Addons\RecipeRadar\Images\Frame\HorizontalBarRight">
<Size>
<AbsDimension x="256" y="16"/>
</Size>
<Anchors>
<Anchor point="TOPRIGHT">
<Offset>
<AbsDimension x="-39" y="-221"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
<!-- The lower horizontal bar is down with the RecipeRadarMapFrame -->
</Layer>
</Layers>
<Frames>
<!-- This is the little X button in the top-right corner. -->
<Button name="RecipeRadarExitButton" inherits="UIPanelCloseButton">
<Anchors>
<Anchor point="TOPRIGHT" relativeTo="RecipeRadarFrame" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="-30" y="-8"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<!-- This is the little lock button in the top-right corner. -->
<Button name="RecipeRadarLockButton">
<Size>
<AbsDimension x="32" y="32"/>
</Size>
<Anchors>
<Anchor point="RIGHT" relativeTo="RecipeRadarExitButton" relativePoint="LEFT">
<Offset>
<AbsDimension x="11" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
RecipeRadar_ToggleLock();
</OnClick>
</Scripts>
<NormalTexture name="RecipeRadarLockNormal"/>
<PushedTexture name="RecipeRadarLockPushed"/>
<HighlightTexture file="Interface\Buttons\UI-Panel-MinimizeButton-Highlight" AlphaMode="ADD"/>
</Button>
<!-- These are the two tabs at the top of the scroll frame. -->
<Button name="RecipeRadarRadarTabFrame" inherits="RecipeRadarTabButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="15" y="-69"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
this.ScrollValue = 0
this:SetNormalTexture(RECIPERADAR_IMAGE_ROOT .. "Misc\\Radar")
getglobal(this:GetName() .. "Highlight"):SetTexture(RECIPERADAR_IMAGE_ROOT .. "Icons\\Highlight")
getglobal(this:GetName() .. "Middle"):SetPoint("TOPLEFT", this:GetName() .. "Left", "TOPRIGHT", 0, 6)
</OnLoad>
<OnClick>
RecipeRadar_RadarTab_OnClick()
</OnClick>
</Scripts>
</Button>
<Button name="RecipeRadarRecipesTabFrame" inherits="RecipeRadarTabButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="RecipeRadarRadarTabFrame" relativePoint="TOPRIGHT"/>
</Anchors>
<Scripts>
<OnLoad>
this.ScrollValue = 0
getglobal(this:GetName() .. "Highlight"):SetTexture(RECIPERADAR_IMAGE_ROOT .. "Icons\\Highlight")
getglobal(this:GetName() .. "Left"):SetTexture(RECIPERADAR_IMAGE_ROOT .. "Frame\\Tab-Right")
getglobal(this:GetName() .. "Left"):SetPoint("TOPLEFT", "RecipeRadarRadarTabFrameRight", "TOPRIGHT")
</OnLoad>
<OnClick>
RecipeRadar_RecipesTab_OnClick()
</OnClick>
</Scripts>
</Button>
<!-- Dropdown combo boxes with multicheck (order is important here). -->
<Frame name="RecipeRadar_PersonAvailDropDown" inherits="UIDropDownMenuTemplate" hidden="true">
<Anchors>
<Anchor point="TOPRIGHT" relativeTo="RecipeRadarFrame" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="-27" y="-37"/>
</Offset>
</Anchor>
</Anchors>
</Frame>
<Frame name="RecipeRadar_Prof1DropDown" inherits="UIDropDownMenuTemplate">
<Anchors>
<Anchor point="TOPRIGHT" relativeTo="RecipeRadar_PersonAvailDropDown" relativePoint="BOTTOMRIGHT">
<Offset>
<AbsDimension x="0" y="4"/>
</Offset>
</Anchor>
</Anchors>
</Frame>
<Frame name="RecipeRadar_TeamDropDown" inherits="UIDropDownMenuTemplate">
<Anchors>
<Anchor point="TOPRIGHT" relativeTo="RecipeRadar_Prof1DropDown" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="30" y="0"/>
</Offset>
</Anchor>
</Anchors>
</Frame>
<Frame name="RecipeRadar_RealmAvailDropDown" inherits="UIDropDownMenuTemplate" hidden="true">
<Anchors>
<Anchor point="TOPRIGHT" relativeTo="RecipeRadar_PersonAvailDropDown" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
</Frame>
<Frame name="RecipeRadar_Prof2DropDown" inherits="UIDropDownMenuTemplate">
<Anchors>
<Anchor point="TOPRIGHT" relativeTo="RecipeRadar_PersonAvailDropDown" relativePoint="BOTTOMRIGHT">
<Offset>
<AbsDimension x="0" y="4"/>
</Offset>
</Anchor>
</Anchors>
</Frame>
<!-- Contains the collapsable list of vendors and recipes -->
<ScrollFrame name="RecipeRadarListScrollFrame" inherits="RecipeRadarListScrollFrameTemplate">
<Size>
<AbsDimension x="365" y="130"/>
</Size>
<Anchors>
<Anchor point="TOPRIGHT" relativeTo="RecipeRadarFrame" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="-67" y="-96"/>
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<FontString name="VendorNameDummyText" inherits="GameFontNormal" hidden="true">
<Size>
<AbsDimension x="0" y="16"/>
</Size>
</FontString>
<FontString name="VendorNameDummySubText" inherits="GameFontNormalSmall" hidden="true">
<Size>
<AbsDimension x="0" y="16"/>
</Size>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnVerticalScroll>
RecipeRadarAvailabilityTooltip:Hide()
FauxScrollFrame_OnVerticalScroll(RECIPERADAR_VENDOR_HEIGHT, RecipeRadar_FrameUpdate)
if (RecipeRadar_Options.ActiveTab == 1) then
RecipeRadarRadarTabFrame.ScrollValue = getglobal(this:GetName() .. "ScrollBar"):GetValue()
else
RecipeRadarRecipesTabFrame.ScrollValue = getglobal(this:GetName() .. "ScrollBar"):GetValue()
end
</OnVerticalScroll>
</Scripts>
</ScrollFrame>
<!-- Radio button indicating a mapped vendor -->
<Frame name="RecipeRadarMapVendorIndicatorFrame" enableMouse="true">
<Size>
<AbsDimension x="20" y="20"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="75" y="-40"/>
</Offset>
</Anchor>
</Anchors>
<HitRectInsets>
<AbsInset left="0" right="-80" top="0" bottom="0"/>
</HitRectInsets>
<Layers>
<Layer level="BACKGROUND">
<FontString name="RecipeRadarMapVendorIndicatorText" inherits="GameFontHighlightSmall">
<Anchors>
<Anchor point="LEFT" relativePoint="RIGHT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<Texture file="Interface\Buttons\UI-RadioButton">
<TexCoords left="0" right="0.25" top="0" bottom="1"/>
</Texture>
<Texture name="RecipeRadarMapVendorIndicator" file="Interface\Buttons\UI-RadioButton">
<TexCoords left="0.25" right="0.5" top="0" bottom="1"/>
</Texture>
</Layer>
</Layers>
<Scripts>
<OnLoad>
RecipeRadarMapVendorIndicator:SetVertexColor(1.0, 0, 0)
</OnLoad>
<OnEnter>
GameTooltip:SetOwner(this, "ANCHOR_RIGHT")
GameTooltip:SetText(RRS("Shift-click a vendor to add or remove her location on the world map."), nil, nil, nil, nil, 1)
</OnEnter>
<OnLeave>
GameTooltip:Hide()
</OnLeave>
</Scripts>
</Frame>
<Button name="RecipeRadarVendor1" inherits="RecipeRadarVendorButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="RecipeRadarFrame">
<Offset>
<AbsDimension x="22" y="-96"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="RecipeRadarVendor2" inherits="RecipeRadarVendorButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="RecipeRadarVendor1" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="RecipeRadarVendor3" inherits="RecipeRadarVendorButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="RecipeRadarVendor2" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="RecipeRadarVendor4" inherits="RecipeRadarVendorButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="RecipeRadarVendor3" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="RecipeRadarVendor5" inherits="RecipeRadarVendorButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="RecipeRadarVendor4" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="RecipeRadarVendor6" inherits="RecipeRadarVendorButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="RecipeRadarVendor5" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="RecipeRadarVendor7" inherits="RecipeRadarVendorButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="RecipeRadarVendor6" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="RecipeRadarVendor8" inherits="RecipeRadarVendorButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="RecipeRadarVendor7" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="RecipeRadarVendor9" inherits="RecipeRadarVendorButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="RecipeRadarVendor8" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Frame name="RecipeRadarHighlightFrame" hidden="true">
<Size>
<AbsDimension x="452" y="16"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT"/>
</Anchors>
<Layers>
<Layer level="ARTWORK">
<Texture name="RecipeRadarHighlight" file="Interface\AddOns\RecipeRadar\Images\Misc\RecipeHighlight"/>
</Layer>
</Layers>
</Frame>
<Frame name="RecipeRadarDetailFrame">
<Size>
<AbsDimension x="393" y="176"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="RecipeRadarListScrollFrame" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-8"/>
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<FontString name="RecipeDetailName" inherits="GameFontNormal" justifyH="LEFT">
<Size>
<AbsDimension x="393" y="0"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="46" y="-2"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="RecipeDetailSubText" inherits="GameFontNormal" justifyH="LEFT">
<Size>
<AbsDimension x="0" y="0"/>
</Size>
<Anchors>
<Anchor point="LEFT" relativeTo="RecipeDetailName" relativePoint="RIGHT">
<Offset>
<AbsDimension x="5" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="RecipeDetailCostText" inherits="GameFontNormalSmall" justifyH="LEFT" text="COSTS_LABEL">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="RecipeDetailName" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-4"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="RecipeDetailNoteText" inherits="GameFontNormalSmall" justifyH="LEFT" text="NOTE_COLON">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="RecipeDetailCostText" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-4"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="RecipeDetailRequirements" inherits="GameFontHighlightSmall" justifyH="LEFT">
<Size>
<AbsDimension x="393" y="0"/>
</Size>
<Anchors>
<Anchor point="LEFT" relativeTo="RecipeDetailNoteText" relativePoint="RIGHT">
<Offset>
<AbsDimension x="5" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Frames>
<Button name="RecipeDetailIcon">
<Size>
<AbsDimension x="37" y="37"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="5" y="-4"/>
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<Texture file="Interface\Buttons\UI-EmptySlot">
<Size>
<AbsDimension x="64" y="64"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="-13" y="13"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
</Layer>
</Layers>
<Scripts>
<OnClick>
if (IsShiftKeyDown() and arg1 == "LeftButton" and ChatFrameEditBox:IsVisible()) then
ChatFrameEditBox:Insert(RecipeDetailIcon.Hyperlink)
end
</OnClick>
<OnEnter>
RecipeRadar_RecipeDetailIcon_ShowToolTip()
</OnEnter>
<OnLeave>
if (RecipeDetailIcon.NeedsUpdate) then
RecipeRadar_FrameUpdate()
RecipeDetailIcon.NeedsUpdate = false
end
GameTooltip:Hide()
</OnLeave>
</Scripts>
</Button>
<Frame name="RecipeDetailMoneyFrame" inherits="SmallMoneyFrameTemplate">
<Anchors>
<Anchor point="LEFT" relativeTo="RecipeDetailCostText" relativePoint="RIGHT">
<Offset>
<AbsDimension x="5" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
SmallMoneyFrame_OnLoad()
MoneyFrame_SetType("STATIC")
</OnLoad>
</Scripts>
</Frame>
</Frames>
</Frame>
<Frame name="RecipeRadarMapFrame">
<Size>
<AbsDimension x="386" y="257"/>
</Size>
<Anchors>
<Anchor point="BOTTOMLEFT" relativeTo="RecipeRadarFrame" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="21" y="104"/>
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<!-- Placeholder for showing our maps via the code -->
<Texture name="RecipeRadarRegionMap">
<Size>
<AbsDimension x="386" y="386"/>
</Size>
<Anchors>
<Anchor point="BOTTOMLEFT" relativeTo="RecipeRadarMapFrame" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
</Layer>
<Layer level="OVERLAY">
<!-- Lower horizontal bar, all the way down here because
it wasn't overlaying the map otherwise! -->
<Texture file="Interface\Addons\RecipeRadar\Images\Frame\HorizontalBarLeft">
<Size>
<AbsDimension x="256" y="16"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="RecipeRadarFrame" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="15" y="-276"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
<Texture file="Interface\Addons\RecipeRadar\Images\Frame\HorizontalBarRight">
<Size>
<AbsDimension x="256" y="16"/>
</Size>
<Anchors>
<Anchor point="TOPRIGHT" relativeTo="RecipeRadarFrame" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="-39" y="-276"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
</Layer>
</Layers>
</Frame>
<Button name="RecipeRadarScroll1" Inherits="RecipeRadarScrollTemplate"/>
<Button name="RecipeRadarScroll2" Inherits="RecipeRadarScrollTemplate"/>
<Button name="RecipeRadarScroll3" Inherits="RecipeRadarScrollTemplate"/>
<Button name="RecipeRadarScroll4" Inherits="RecipeRadarScrollTemplate"/>
<Button name="RecipeRadarScroll5" Inherits="RecipeRadarScrollTemplate"/>
<Button name="RecipeRadarScroll6" Inherits="RecipeRadarScrollTemplate"/>
<!-- Bottom row, with money and buttons. -->
<Frame name="RecipeRadarMoneyFrame" inherits="SmallMoneyFrameTemplate">
<Anchors>
<Anchor point="BOTTOMRIGHT" relativeTo="RecipeRadarFrame" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="180" y="86"/>
</Offset>
</Anchor>
</Anchors>
</Frame>
<Button name="RecipeRadarOptionsButton" inherits="OptionsButtonTemplate">
<Size>
<AbsDimension x="80" y="22"/>
</Size>
<Anchors>
<Anchor point="CENTER" relativeTo="RecipeRadarFrame" relativePoint="BOTTOMRIGHT">
<Offset>
<AbsDimension x="-162" y="91"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
PlaySound("igMainMenuOption")
RecipeRadar_OptionsFrame_Toggle()
</OnClick>
</Scripts>
</Button>
<Button name="RecipeRadarCloseButton" inherits="UIPanelButtonTemplate" text="CLOSE">
<Size>
<AbsDimension x="80" y="22"/>
</Size>
<Anchors>
<Anchor point="CENTER" relativeTo="RecipeRadarOptionsButton" relativePoint="CENTER">
<Offset>
<AbsDimension x="80" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
HideUIPanel(this:GetParent())
</OnClick>
</Scripts>
</Button>
<Frame name="RadarTabDropDown" inherits="UIDropDownMenuTemplate" hidden="true">
<Size>
<AbsDimension x="10" y="10"/>
</Size>
<Anchors>
<Anchor point="TOP">
<Offset>
<AbsDimension x="-10" y="-50"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
--RecipeRadar_RadarTab_ContextMenuOnLoad()
</OnLoad>
</Scripts>
</Frame>
<Frame name="RecipesTabDropDown" inherits="UIDropDownMenuTemplate" hidden="true">
<Size>
<AbsDimension x="10" y="10"/>
</Size>
<Anchors>
<Anchor point="TOP">
<Offset>
<AbsDimension x="-10" y="-50"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
--RecipeRadar_RecipesTab_ContextMenuOnLoad()
</OnLoad>
</Scripts>
</Frame>
</Frames>
<Scripts>
<OnLoad>
RecipeRadar_OnLoad()
</OnLoad>
<OnEvent>
RecipeRadar_OnEvent()
</OnEvent>
<OnShow>
RecipeRadar_OnShow()
</OnShow>
<OnHide>
RecipeRadar_OnHide()
</OnHide>
<OnDragStart>
if(arg1 == "LeftButton") then RecipeRadar_StartMoving() end
</OnDragStart>
<OnDragStop>
RecipeRadarFrame:StopMovingOrSizing()
</OnDragStop>
<OnMouseUp>
RecipeRadarFrame:StopMovingOrSizing()
</OnMouseUp>
</Scripts>
</Frame>
</UI>
+510
View File
@@ -0,0 +1,510 @@
-- RecipesTab.lua: handles clicking and drawing for the Recipes tab
-- $Id: RecipesTab.lua 443 2006-09-01 04:41:40Z jnmiller $
------------------------------------------------------------------------
-- Main window refresh code
------------------------------------------------------------------------
function RecipeRadar_RecipesTab_Init()
-- reset some of the RegionData GUI settings just once here
for i = 1, RECIPERADAR_VENDORS_DISPLAYED do
local button = getglobal("RecipeRadarVendor" .. i)
-- reset items' horizontal offsets
if (i == 1) then
button:SetPoint("TOPLEFT", "RecipeRadarFrame",
"TOPLEFT", 22, -96)
else
button:SetPoint("TOPLEFT", "RecipeRadarVendor" .. i - 1,
"BOTTOMLEFT", 0, 0)
end
-- turn off highlights and textures for these items
getglobal("RecipeRadarVendor" .. i .. "Check"):Hide()
-- unset to preclude tooltips for these items
button.Recipe = nil
end
RecipeRadar_Prof1DropDown:Hide()
RecipeRadar_Prof2DropDown:Show()
RecipeRadar_SetActiveTab(2)
RecipeRadar_RecipesTab_Update()
RecipeRadarListScrollFrameScrollBar:SetValue(
RecipeRadarRecipesTabFrame.ScrollValue)
end
function RecipeRadar_RecipesTab_OnClick()
if (RecipeRadar_Options.ActiveTab == 2) then
return
end
PlaySound("igSpellBookClose")
RecipeRadar_RecipesTab_Init()
end
function RecipeRadar_RecipesTab_ExpandAll(expand)
local prof = RecipeRadar_RecipeData[RecipeRadar_Options.CurrentProfession]
if (not prof) then return end
for _, recipe in prof.Recipes do
recipe.IsExpanded = expand
end
RecipeRadar_SelectFirstRecipe()
RecipeRadar_FrameUpdate()
end
function RecipeRadar_RecipesTab_Update()
if (RecipeRadar_Options.ActiveTab ~= 2) then
return
end
local prof = RecipeRadar_Options.CurrentProfession
TitleBarText:SetText(RRS("Recipe Radar") .. " - " .. prof .. " " ..
format(TEXT(PARENS_TEMPLATE), RecipeRadar_SkillDB_GetRank(prof)))
-- some globals for the Update() procedure
RecipeRadar_row = 0
RecipeRadar_ContextMenuGlobal.RecipesTabHasExpanded = false
RecipeRadar_ContextMenuGlobal.RecipesTabHasCollapsed = false
RecipeRadarHighlightFrame:Hide()
RecipeRadar_SortRecipes(RecipeRadar_RecipeData[prof])
table.foreach(RecipeRadar_RecipeData[prof].Recipes,
RecipeRadar_RecipesTab_AddRecipe)
-- update the scroll position and the width of the highlight frame
FauxScrollFrame_Update(RecipeRadarListScrollFrame, RecipeRadar_row,
RECIPERADAR_VENDORS_DISPLAYED, RECIPERADAR_VENDOR_HEIGHT,
nil, nil, nil, RecipeRadarHighlightFrame, 361, 384)
-- hide unused item buttons
for i = 1, RECIPERADAR_VENDORS_DISPLAYED do
local button = getglobal("RecipeRadarVendor" .. i)
if (i > RecipeRadar_row) then
button:Hide()
else
if (RecipeRadarListScrollFrame:IsVisible()) then
button:SetWidth(361)
else
button:SetWidth(384)
end
end
end
-- update the current selection (or lack thereof)
if (not prof or not RecipeRadarRecipesTabFrame.SelectedRecipe) then
RecipeRadar_HideRecipeDetails()
elseif (RecipeRadarRecipesTabFrame.SelectedVendor) then
RecipeRadar_SetSelection(RecipeRadarRecipesTabFrame.SelectedVendor,
RecipeRadarRecipesTabFrame.SelectedRecipe,
RecipeRadarRecipesTabFrame.SelectedLocation)
RecipeRadar_ShowRecipeDetails()
end
end
function RecipeRadar_RecipesTab_AddRecipe(key, recipe)
if (RecipeRadar_IsRecipeFiltered(recipe) or
not RecipeRadar_RecipeHasLocations(recipe)) then
return
end
RecipeRadar_row = RecipeRadar_row + 1
local offset = FauxScrollFrame_GetOffset(RecipeRadarListScrollFrame)
local index = RecipeRadar_row - offset
-- only do the following if we're in the scroll frame's visible portion
if (index > 0 and index <= RECIPERADAR_VENDORS_DISPLAYED) then
local button = getglobal("RecipeRadarVendor" .. index)
-- generic list item drawing
RecipeRadar_DrawListItem(index, recipe)
button:UnlockHighlight()
getglobal("RecipeRadarVendor" .. index .. "Check"):Hide()
getglobal("RecipeRadarVendor" .. index .. "Highlight"):SetTexture(
"Interface\\Buttons\\UI-PlusButton-Hilight")
if (recipe.IsExpanded) then
RecipeRadar_ContextMenuGlobal.RecipesTabHasExpanded = true
button:SetNormalTexture("Interface\\Buttons\\UI-MinusButton-Up")
else
RecipeRadar_ContextMenuGlobal.RecipesTabHasCollapsed = true
button:SetNormalTexture("Interface\\Buttons\\UI-PlusButton-Up")
return
end
else
-- if the recipe is collapsed, we don't need to traverse its locations
if (recipe.IsExpanded) then
RecipeRadar_ContextMenuGlobal.RecipesTabHasExpanded = true
else
RecipeRadar_ContextMenuGlobal.RecipesTabHasCollapsed = true
return
end
end
RecipeRadar_SortLocations(recipe)
for _, location in recipe.Locations do
-- skip and unmap filtered recipes
if (location.IsFiltered) then
local vendor = RecipeRadar_RecipesTab_FindVendor(
location.Region, location.Vendor)
if (vendor.IsMapped) then
RecipeRadar_Maps_RemoveVendor(vendor)
end
else
RecipeRadar_row = RecipeRadar_row + 1
index = RecipeRadar_row - offset;
-- only do this if we're in the scroll frame's visible portion
if (index > 0 and index <= RECIPERADAR_VENDORS_DISPLAYED) then
local button = getglobal("RecipeRadarVendor" .. index)
-- turn off highlighting textures for these items
button:SetNormalTexture("")
getglobal("RecipeRadarVendor" .. index .. "Highlight"):SetTexture("")
-- basic drawing code
button:SetText(location.Region)
VendorNameDummyText:SetText(location.Region)
button:SetTextColor(
RecipeRadar_Colors.LightGray.r,
RecipeRadar_Colors.LightGray.g,
RecipeRadar_Colors.LightGray.b)
button:SetID(index)
button:Show()
-- drawing code for the little subtext field
local subtext = getglobal("RecipeRadarVendor" .. index .. "SubText")
local vendor = RecipeRadar_RecipesTab_FindVendor(
location.Region, location.Vendor)
local content = location.Vendor
if (vendor.Notes and vendor.Notes ~= "") then
content = content .. " - " ..
RecipeRadar_FormatVendorNote(vendor.Notes)
end
content = format(TEXT(PARENS_TEMPLATE), content)
subtext:SetText(content)
VendorNameDummySubText:SetText(content)
button.r = RecipeRadar_Teams[vendor.Team].Color.r
button.g = RecipeRadar_Teams[vendor.Team].Color.g
button.b = RecipeRadar_Teams[vendor.Team].Color.b
subtext:SetTextColor(
RecipeRadar_Teams[vendor.Team].Color.r,
RecipeRadar_Teams[vendor.Team].Color.g,
RecipeRadar_Teams[vendor.Team].Color.b)
subtext:SetPoint("LEFT", "RecipeRadarVendor" .. index .. "Text",
"RIGHT", 10, 0)
subtext:Show()
-- unset to indicate this is a vendor item for the tooltip stuff
button.Recipe = nil
-- show or hide the little mapped indicator check mark
local check = getglobal("RecipeRadarVendor" .. index .. "Check")
if (vendor.IsMapped) then
local check_offset = VendorNameDummyText:GetWidth() + 42
check_offset = check_offset + VendorNameDummySubText:GetWidth()
check:SetPoint("TOPLEFT", "RecipeRadarVendor" .. index, "TOPLEFT",
check_offset, 0)
check:Show()
else
check:Hide()
end
-- selected recipes look a little bit different
if (RecipeRadarRecipesTabFrame.SelectedLocation == location.Region and
RecipeRadarRecipesTabFrame.SelectedRecipe == recipe and
RecipeRadarRecipesTabFrame.SelectedVendor.Name == location.Vendor) then
RecipeRadarHighlightFrame:SetPoint("TOPLEFT",
"RecipeRadarVendor" .. index, "TOPLEFT", -2, 0)
RecipeRadarHighlightFrame:Show()
button:LockHighlight()
else
button:UnlockHighlight()
end
end
end
end
end
-- Handles a vendor/recipe button click in the main scroll frame. The
-- supplied index is row + offset in the scroll frame. index may also
-- be set to -1 to select the first visible recipe.
function RecipeRadar_RecipesTab_ServiceClickIndex(index, button)
local prof = RecipeRadar_Options.CurrentProfession
if (not button) then button = "LeftButton" end
-- save this index so we can return to it on tab switch
RecipeRadarRecipesTabFrame.SelectedIndex = index
-- sort the recipes so we're counting in the right order
RecipeRadar_SortRecipes(RecipeRadar_RecipeData[prof])
local row = 0
-- iterate through each recipe, counting up to index
for _, recipe in RecipeRadar_RecipeData[prof].Recipes do
-- if this recipe is filtered, it does not count towards our index
if (not RecipeRadar_IsRecipeFiltered(recipe) and
RecipeRadar_RecipeHasLocations(recipe)) then
row = row + 1
if (row == index) then
if (button == "LeftButton") then
RecipeRadar_RecipesTab_ToggleExpanded(recipe)
return
elseif (button == "RightButton") then
HideDropDownMenu(1)
RecipeRadar_ContextMenuGlobal.Recipe = recipe
RecipeRadar_ContextMenuGlobal.Location = nil
RecipeRadar_RecipesTab_ContextMenuOnLoad()
ToggleDropDownMenu(1, nil, RecipesTabDropDown,
this:GetName(), GetCursorPosition(), 0)
return
end
end
if (recipe.IsExpanded) then
-- sort the locations so we're counting in the right order
RecipeRadar_SortLocations(recipe)
local vendor_index = row
-- iterate through each recipe, counting up to index
for _, location in recipe.Locations do
if (not location.IsFiltered) then
row = row + 1
-- if index is -1, this catches on the first iteration
if (row == index or index == -1) then
if (button == "LeftButton") then
local vendor = RecipeRadar_RecipesTab_FindVendor(
location.Region, location.Vendor)
-- if the shift key is down, (un)map this vendor
if (IsShiftKeyDown()) then
if (vendor.IsMapped) then
RecipeRadar_Maps_RemoveVendor(vendor)
else
RecipeRadar_Maps_AddVendor(vendor, location.Region)
end
end
-- select this location and show its details
RecipeRadarRecipesTabFrame.SelectedVendor = vendor
RecipeRadarRecipesTabFrame.SelectedRecipe = recipe
RecipeRadarRecipesTabFrame.SelectedLocation =
location.Region
RecipeRadar_SetSelection(vendor, recipe, location.Region)
RecipeRadar_ShowRecipeDetails()
return
elseif (button == "RightButton") then
HideDropDownMenu(1)
RecipeRadar_ContextMenuGlobal.Recipe = recipe
RecipeRadar_ContextMenuGlobal.Location = location
RecipeRadar_RecipesTab_ContextMenuOnLoad()
ToggleDropDownMenu(1, nil, RecipesTabDropDown,
this:GetName(), GetCursorPosition(), 0)
return
end
end
end
end
end
end
end
-- if the index was not found, select nothing
RecipeRadar_RecipesTab_ClearSelection()
RecipeRadar_HideRecipeDetails()
end
function RecipeRadar_RecipesTab_ToggleExpanded(recipe)
if (recipe.IsExpanded) then
recipe.IsExpanded = false
else
recipe.IsExpanded = true
end
RecipeRadar_RecipesTab_ClearSelection()
RecipeRadar_FrameUpdate()
end
-- Retrieves a vendor's info table from her name and region.
function RecipeRadar_RecipesTab_FindVendor(region_name, vendor_name)
local region_data = RecipeRadar_RegionData[region_name]
if (not region_data) then return end
for _, vendor in region_data.Vendors do
if (vendor.Name == vendor_name) then
return vendor
end
end
return nil
end
function RecipeRadar_RecipesTab_ClearSelection()
RecipeRadarRecipesTabFrame.SelectedVendor = nil
RecipeRadarRecipesTabFrame.SelectedRecipe = nil
RecipeRadarRecipesTabFrame.SelectedLocation = nil
end
-- OnLoad event handler for the right-click context menu for map buttons.
function RecipeRadar_RecipesTab_ContextMenuOnLoad()
UIDropDownMenu_Initialize(RecipesTabDropDown,
RecipeRadar_RecipesTab_ContextMenuInit, "MENU")
end
-- Initialization routine for the right-click context menu for map buttons.
function RecipeRadar_RecipesTab_ContextMenuInit()
if (not RecipeRadar_ContextMenuGlobal.Recipe) then return end
if (RecipeRadar_ContextMenuGlobal.Location) then
local vendor = RecipeRadar_RecipesTab_FindVendor(
RecipeRadar_ContextMenuGlobal.Location.Region,
RecipeRadar_ContextMenuGlobal.Location.Vendor)
-- putting in the vendor's name as the title of the popup
local item = { }
item.text = RecipeRadar_ContextMenuGlobal.Location.Vendor
item.isTitle = 1
item.notCheckable = 1
UIDropDownMenu_AddButton(item)
item = { }
if (vendor.IsMapped) then
item.text = RRS("Unmap Vendor")
item.value = "unmap"
else
item.text = RRS("Map Vendor")
item.value = "map"
end
item.notCheckable = 1
item.func = RecipeRadar_RecipesTab_ContextMenuOnClick
UIDropDownMenu_AddButton(item)
end
item = { }
item.text = RRS("Expand All")
item.value = "expandall"
item.notCheckable = 1
item.func = RecipeRadar_RecipesTab_ContextMenuOnClick
if (not RecipeRadar_ContextMenuGlobal.RecipesTabHasCollapsed) then
item.disabled = 1
end
UIDropDownMenu_AddButton(item)
item = { }
item.text = RRS("Collapse All")
item.value = "collapseall"
item.notCheckable = 1
item.func = RecipeRadar_RecipesTab_ContextMenuOnClick
if (not RecipeRadar_ContextMenuGlobal.RecipesTabHasExpanded) then
item.disabled = 1
end
UIDropDownMenu_AddButton(item)
item = { }
item.text = CANCEL
item.notCheckable = 1
item.func = RecipeRadar_RecipesTab_ContextMenuOnClick
UIDropDownMenu_AddButton(item)
end
-- OnClick event handler for the right-click context menu for map buttons.
function RecipeRadar_RecipesTab_ContextMenuOnClick()
if (RecipeRadar_ContextMenuGlobal.Location) then
local vendor = RecipeRadar_RecipesTab_FindVendor(
RecipeRadar_ContextMenuGlobal.Location.Region,
RecipeRadar_ContextMenuGlobal.Location.Vendor)
if (this.value == "unmap") then
RecipeRadar_Maps_RemoveVendor(vendor)
RecipeRadar_FrameUpdate()
elseif (this.value == "map") then
RecipeRadar_Maps_AddVendor(vendor,
RecipeRadar_ContextMenuGlobal.Location.Region)
RecipeRadar_FrameUpdate()
end
end
if (this.value == "expandall") then
RecipeRadar_RecipesTab_ExpandAll(true)
elseif (this.value == "collapseall") then
RecipeRadar_RecipesTab_ExpandAll(false)
end
end

Some files were not shown because too many files have changed in this diff Show More