From 7438a285e1f455db080622976b107e2f262973a1 Mon Sep 17 00:00:00 2001 From: Ackis Date: Mon, 27 Oct 2008 17:58:15 +0000 Subject: [PATCH] Ackis Recipe List: - Attempt to fix the shift click on a recipe - Added to locals L["NoItemLink"] - Dry-coded (Compiles with luac -p) --- ARLFrame.lua | 43 ++++++++++++++++++++++++++++++++++++++- AckisRecipeList.lua | 6 +++++- Locals/ARLLocals-enUS.lua | 49 +++++++++++++++++++++++---------------------- 3 files changed, 72 insertions(+), 26 deletions(-) diff --git a/ARLFrame.lua b/ARLFrame.lua index 70981bb..d1daf51 100644 --- a/ARLFrame.lua +++ b/ARLFrame.lua @@ -2073,56 +2073,97 @@ function addon.RecipeItem_OnClick(button) -- First, check if this is a "modified" click, and react appropriately if (IsShiftKeyDown()) then + local itemID = recipeDB[clickedSpellIndex]["ItemID"] local _, itemLink = GetItemInfo(itemID) - ChatFrameEditBox:Insert(itemLink) + + if (itemLink) then + + ChatFrameEditBox:Insert(itemLink) + + else + + addon:Print(L["NoItemLink"]) + + end + elseif (IsControlKeyDown()) then + ChatFrameEditBox:Insert(recipeDB[clickedSpellIndex]["RecipeLink"]) + elseif (IsAltKeyDown()) then + -- Code needed here to insert this item into the "Ignore List" addon:ToggleExcludeRecipe(clickedSpellIndex) ReDisplay() + else + -- three possibilities here -- 1) We clicked on the recipe button on a closed recipe -- 2) We clicked on the recipe button of an open recipe -- 3) we clicked on the expanded text of an open recipe if (isRecipe) then + if (isExpanded) then + -- get rid of our expanded lines traverseIndex = clickedIndex + 1 + while (DisplayStrings[traverseIndex].IsRecipe == false) do + tremove(DisplayStrings, traverseIndex) + -- if this is the last entry in the whole list, we should break out if not DisplayStrings[traverseIndex] then + break + end + end + DisplayStrings[clickedIndex].IsExpanded = false + else + -- add in our expanded lines expandEntry(clickedIndex) -- set our current recipe to expanded DisplayStrings[clickedIndex].IsExpanded = true + end + else + -- this inherently implies that we're on an expanded recipe -- first, back up in the list of buttons until we find our recipe line traverseIndex = clickedIndex - 1 + while (DisplayStrings[traverseIndex].IsRecipe == false) do + traverseIndex = traverseIndex - 1 + end + -- unexpand it DisplayStrings[traverseIndex].IsExpanded = false -- now remove the expanded lines until we get to a recipe again traverseIndex = traverseIndex + 1 + while (DisplayStrings[traverseIndex].IsRecipe == false) do + tremove(DisplayStrings, traverseIndex) + end + end + -- finally, call our scrollframe updater RecipeList_Update() + end + end -- Rep Filtering panel switcher diff --git a/AckisRecipeList.lua b/AckisRecipeList.lua index d7fc090..a96379b 100644 --- a/AckisRecipeList.lua +++ b/AckisRecipeList.lua @@ -500,7 +500,7 @@ function addon:addTradeSkill(RecipeDB, SpellID, SkillLevel, ItemID, Rarity, Prof RecipeDB[SpellID] = {} -- Set the information passed RecipeDB[SpellID]["Level"] = SkillLevel - RecipeDB[SpellID]["ItemID"] = ItemID + RecipeDB[SpellID]["ItemID"] = ItemID or nil RecipeDB[SpellID]["Rarity"] = Rarity RecipeDB[SpellID]["Profession"] = GetSpellInfo(Profession) @@ -508,9 +508,13 @@ function addon:addTradeSkill(RecipeDB, SpellID, SkillLevel, ItemID, Rarity, Prof local spellLink = GetSpellLink(SpellID) if (spellLink ~= nil) then + RecipeDB[SpellID]["RecipeLink"] = string.gsub(spellLink, "spell", "enchant") + else + RecipeDB[SpellID]["RecipeLink"] = nil + end -- Get the recipe name now diff --git a/Locals/ARLLocals-enUS.lua b/Locals/ARLLocals-enUS.lua index 3cca849..f2741f8 100644 --- a/Locals/ARLLocals-enUS.lua +++ b/Locals/ARLLocals-enUS.lua @@ -50,7 +50,7 @@ L["Profile Options"] = true -- Config UI Elements and their associated descriptions L["MAIN_OPTIONS_DESC"] = "Main configuration options" -L["Scan"] = true +L["Scan"] = true L["SCAN_RECIPES_DESC"] = "Scans an open tradeskill for missing recipes." L["Text Dump"] = true L["TEXT_DUMP_DESC"] = "Displays all recipes in a comma seperated value format which can be copied and pasted into another client." @@ -84,7 +84,7 @@ L["Obtain"] = true L["Binding"] = true L["Item"] = true L["Armor"] = true -L["Weapon"] = true +L["Weapon"] = true L["Player Type"] = true L["Reputation"] = true L["Old World"] = true @@ -92,29 +92,29 @@ L["Burning Crusade"] = true L["Wrath of the Lich King"] = true -- Filter Configuration Descriptions -L["FILTERING_OPTIONS_DESC"] = "Allows you to customize which recipes are filtered." -L["General Filtering Options"] = true -L["FILTERING_GENERAL_DESC"] = "Configuration for several more general filter types." -L["Obtain Filtering Options"] = true -L["FILTERING_OBTAIN_DESC"] = "Configuration for which methods of obtaining recipes are included in the scan." -L["Binding Filtering Options"] = true -L["FILTERING_BINDING_DESC"] = "Configuration for which types of binding are included in the scan." -L["Item Filtering Options"] = true -L["FILTERING_ITEM_DESC"] = "Configuration for which item types are included in the scan." -L["Armor Filtering Options"] = true -L["FILTERING_Armor_DESC"] = "Configuration for which types of armor are included in the scan." -L["Weapon Filtering Options"] = true -L["FILTERING_WEAPONS_DESC"] = "Configuration for which types of weapons are included in the scan." -L["Player Type Filtering Options"] = true -L["FILTERING_PLAYERTYPE_DESC"] = "Configuration for items matching which player types are included in the scan." -L["Reputation Filtering Options"] = true -L["FILTERING_REP_DESC"] = "Configuration for which reputation reward recipes are included in the scan." -L["Old World Rep. Filtering Options"] = true -L["FILTERING_OLDWORLD_DESC"] = "Configuration for which Old World Reputation reward recipes are included in the scan." +L["FILTERING_OPTIONS_DESC"] = "Allows you to customize which recipes are filtered." +L["General Filtering Options"] = true +L["FILTERING_GENERAL_DESC"] = "Configuration for several more general filter types." +L["Obtain Filtering Options"] = true +L["FILTERING_OBTAIN_DESC"] = "Configuration for which methods of obtaining recipes are included in the scan." +L["Binding Filtering Options"] = true +L["FILTERING_BINDING_DESC"] = "Configuration for which types of binding are included in the scan." +L["Item Filtering Options"] = true +L["FILTERING_ITEM_DESC"] = "Configuration for which item types are included in the scan." +L["Armor Filtering Options"] = true +L["FILTERING_Armor_DESC"] = "Configuration for which types of armor are included in the scan." +L["Weapon Filtering Options"] = true +L["FILTERING_WEAPONS_DESC"] = "Configuration for which types of weapons are included in the scan." +L["Player Type Filtering Options"] = true +L["FILTERING_PLAYERTYPE_DESC"] = "Configuration for items matching which player types are included in the scan." +L["Reputation Filtering Options"] = true +L["FILTERING_REP_DESC"] = "Configuration for which reputation reward recipes are included in the scan." +L["Old World Rep. Filtering Options"] = true +L["FILTERING_OLDWORLD_DESC"] = "Configuration for which Old World Reputation reward recipes are included in the scan." L["Burning Crusade Rep. Filtering Options"] = true -L["FILTERING_BC_DESC"] = "Configuration for which Burning Crusade Reputation reward recipes are included in the scan." -L["Lich King Rep. Filtering Options"] = true -L["FILTERING_WOTLK_DESC"] = "Configuration for which Wrath of the Lich King Reputation reward recipes are included in the scan." +L["FILTERING_BC_DESC"] = "Configuration for which Burning Crusade Reputation reward recipes are included in the scan." +L["Lich King Rep. Filtering Options"] = true +L["FILTERING_WOTLK_DESC"] = "Configuration for which Wrath of the Lich King Reputation reward recipes are included in the scan." -- General Filter UI Elements and their associated descriptions L["Faction"] = true @@ -265,6 +265,7 @@ L["MissingFromDB"] = ": is is missing from the database. \nPlease inform the aut L["UnknownTradeSkill"] = "You have opened up a trade skill window which is not supported by this add-on. The trade skill is %s. Please provide the author of the add-on with this information." L["OpenTradeSkillWindow"] = "Please open trade skill window to scan." L["SpellIDCache"] = "Spell ID: %s is not in your local cache. Please submit a ticket at http://wow.curseforge.com/projects/ackis-recipe-list/tickets/ and include the spell ID and the profession in which you were scanning." +L["NoItemLink"] = "This item does not have an item link or it was not in your cache." -- Drop Obtain Info L["Unknown"] = "Unknown Drop: The drop location of this recipe is unknown. Please contribute by posting on the Ackis Recipe List thread at www.wowace.com/forums" -- 1.7.9.5