# HG changeset patch # User Aaron@Aaron-PC # Date 1282018070 18000 # Node ID 22686cb65c51a534ae69e4b91f18ddc3bd663b75 # Parent 8a18dd9f2ceca4336412e3ae4f651e5753ab507b Cached NPCs functioning. No data submission yet. Own data has been added to Location cache. Major Refactor of Core.lua :) diff -r 8a18dd9f2cec -r 22686cb65c51 RecipeProfit.toc --- a/RecipeProfit.toc Sun Aug 15 17:59:03 2010 -0500 +++ b/RecipeProfit.toc Mon Aug 16 23:07:50 2010 -0500 @@ -1,12 +1,13 @@ ## Interface: 30300 -## Title: |cffCCCC88_RecipeProfit|r +## Title: GatherMate|cffCCCC88_RecipeProfit|r ## Notes: Use GatherMate to track Limited Supply Recipes -## Author: Vertebrate/Yuffles +## Author: Vertebrate/Yuffles - Sargeras US ## Version: 3.3.5 ## Dependencies: GatherMate -## SavedVariables: profile +## SavedVariables: RECIPEPROFIT_profile core.lua alliance.lua horde.lua +location_cache.lua \ No newline at end of file diff -r 8a18dd9f2cec -r 22686cb65c51 core.lua --- a/core.lua Sun Aug 15 17:59:03 2010 -0500 +++ b/core.lua Mon Aug 16 23:07:50 2010 -0500 @@ -18,16 +18,22 @@ local safeRecipes = {} local ids = {} +local profile + RecipeProfit.db = db; --- Forward Definitions (for local functions) +--[[ Forward Definitions (for local functions) ]] local get_faction_db, add_note, button_update, find_good_id, safe_cache_vendor, - get_note_title; + get_note_title, + get_next_texture_id, + set_node_constants, + inject_options; +--[[ Deep table inspection for debugging ]] function debugprint(val, indent) indent = indent or ""; if not(type(val) == "table") then @@ -148,7 +154,7 @@ } function RecipeProfit:OnInitialize() - profile = profile or defaults + profile = RECIPEPROFIT_profile or defaults for k, v in pairs(defaults) do profile[k] = profile[k] or v; @@ -164,50 +170,27 @@ GatherMate:GetModule("Config"):RegisterModule("RecipeProfit", options) GatherMate:RegisterDBType("RecipeProfit", db.storage) GatherMate.db.profile.show["RecipeProfit"] = GatherMate.db.profile.show["RecipeProfit"] or "always" - GatherMate.nodeIDs["RecipeProfit"] = {} - GatherMate.nodeTextures["RecipeProfit"] = {} - GatherMate.nodeMinHarvest["RecipeProfit"] = {} - local nodes = GatherMate.nodeIDs["RecipeProfit"] - for id, note in pairs(RECIPEPROFIT_alliance) do - safeRecipes[note.item] = true; - nodes[get_note_title(note, "A")] = id * 2 - GatherMate.nodeTextures["RecipeProfit"][id * 2] = "Interface\\Icons\\INV_Scroll_05" - end - - for id, note in pairs(RECIPEPROFIT_horde) do - safeRecipes[note.item] = true; - nodes[get_note_title(note, "H")] = (id - 1) * 2 + 1 - GatherMate.nodeTextures["RecipeProfit"][(id - 1) * 2 + 1] = "Interface\\Icons\\INV_Scroll_05" - end - - GatherMate.reverseNodeIDs["RecipeProfit"] = GatherMate:CreateReversedTable(nodes) - - GatherMate:GetModule("Config").options.args.display.args.general.args.showGroup.args["showRecipeProfit"] = { - order = 6, - name = "Show RecipeProfit nodes.", - desc = "Toggle showing nodes added by RecipeProfit.", - type = "select", - values = { - ["always"] = "Always show", - ["never"] = "Never show", - }, - arg = "RecipeProfit", - } - - GatherMate:GetModule("Config").options.args.display.args.general.args.iconGroup.args.tracking.args["showRecipeProfit"] = { - order = 6.5, - name = "RecipeProfit", - desc = "Color of the tracking circle.", - type = "color", - hasAlpha = true, - arg = "RecipeProfit", - } + set_node_constants() + inject_options() GatherMate:GetModule("Config"):UpdateConfig() GatherMate:GetModule("Config"):SendMessage("GatherMateConfigChanged") end + +function RecipeProfit:OnEnable() + + _G["MerchantPrevPageButton"]:HookScript("OnClick", self.UpdateButtons) + _G["MerchantNextPageButton"]:HookScript("OnClick", self.UpdateButtons) + + self:RegisterEvent("MERCHANT_SHOW", "UpdateButtons") + self:RegisterEvent("MERCHANT_UPDATE", "UpdateButtons") + self:RegisterEvent("BAG_UPDATE", "UpdateButtons") + + RecipeProfit:DoMerge() +end + function RecipeProfit:ShowOptions() LibStub("AceConfigDialog-3.0"):Open("GatherMate") LibStub("AceConfigDialog-3.0"):SelectGroup("GatherMate", "RecipeProfit") @@ -228,20 +211,7 @@ button_update(buttonframe) end end -end - - -function RecipeProfit:OnEnable() - - _G["MerchantPrevPageButton"]:HookScript("OnClick", self.UpdateButtons) - _G["MerchantNextPageButton"]:HookScript("OnClick", self.UpdateButtons) - - self:RegisterEvent("MERCHANT_SHOW", "UpdateButtons") - self:RegisterEvent("MERCHANT_UPDATE", "UpdateButtons") - self:RegisterEvent("BAG_UPDATE", "UpdateButtons") - - RecipeProfit:DoMerge() -end +end function RecipeProfit:DoMerge() ids = {} @@ -325,4 +295,57 @@ ids[x.." "..y] = true return x, y -end \ No newline at end of file +end + +local lastNodeTextureId = 0; + +function get_next_texture_id() + lastNodeTextureId = lastNodeTextureId + 1; + return lastNodeTextureId; +end + +function set_node_constants() + GatherMate.nodeIDs["RecipeProfit"] = {} + GatherMate.nodeTextures["RecipeProfit"] = {} + GatherMate.nodeMinHarvest["RecipeProfit"] = {} + + local nodes = GatherMate.nodeIDs["RecipeProfit"] + for id, note in pairs(RECIPEPROFIT_alliance) do + safeRecipes[note.item] = true; + nodes[get_note_title(note, "A")] = get_next_texture_id() + end + + for id, note in pairs(RECIPEPROFIT_horde) do + safeRecipes[note.item] = true; + nodes[get_note_title(note, "H")] = get_next_texture_id() + end + + for i = 1, lastNodeTextureId, 1 do + GatherMate.nodeTextures["RecipeProfit"][i] = "Interface\\Icons\\INV_Scroll_05" + end + + GatherMate.reverseNodeIDs["RecipeProfit"] = GatherMate:CreateReversedTable(nodes) +end + +function inject_options() + GatherMate:GetModule("Config").options.args.display.args.general.args.showGroup.args["showRecipeProfit"] = { + order = 6, + name = "Show RecipeProfit nodes.", + desc = "Toggle showing nodes added by RecipeProfit.", + type = "select", + values = { + ["always"] = "Always show", + ["never"] = "Never show", + }, + arg = "RecipeProfit", + } + + GatherMate:GetModule("Config").options.args.display.args.general.args.iconGroup.args.tracking.args["showRecipeProfit"] = { + order = 6.5, + name = "RecipeProfit", + desc = "Color of the tracking circle.", + type = "color", + hasAlpha = true, + arg = "RecipeProfit", + } +end diff -r 8a18dd9f2cec -r 22686cb65c51 location_cache.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/location_cache.lua Mon Aug 16 23:07:50 2010 -0500 @@ -0,0 +1,74 @@ +--[[--))--))--))--))--))--))--))--))--))--))--))--))--))--))--))--))--))--))--)) + + RecipeProfit by -[@project-author@]- + + Rev: @project-revision@ + Updated: @file-date-iso@ + +--))--))--))--))--))--))--))--))--))--))--))--))--))--))--))--))--))--))--))--)) + + http://www.wrathguides.com/ + +--]]--))--))--))--))--))--))--))--))--))--))--))--))--))--))--))--))--))--))--)) + +--[[ + This file contains location fix overrides for data. +]] +RECIPEPROFIT_location_cache = { + ["Aaron Hollman"] = { + ["y"] = 0.7215260863304138, + ["x"] = 0.6404642462730408, + }, + ["Madame Ruby"] = { + ["y"] = 0.7101468443870544, + ["x"] = 0.6331429481506348, + }, + ["Endora Moorehead"] = { + ["y"] = 0.5554489493370056, + ["x"] = 0.386496365070343, + }, + ["Larana Drome"] = { + ["y"] = 0.3669505119323731, + ["x"] = 0.41370689868927, + }, + ["Wind Trader Lathrai"] = { + ["y"] = 0.3077846765518189, + ["x"] = 0.7226132750511169, + }, + ["Eiin"] = { + ["y"] = 0.6892650127410889, + ["x"] = 0.6627683639526367, + }, + ["Bryan Landers"] = { + ["y"] = 0.245055764913559, + ["x"] = 0.3892331123352051, + }, + ["Fyldan"] = { + ["y"] = 0.215785413980484, + ["x"] = 0.4854764640331268, + }, + ["Ulthir"] = { + ["y"] = 0.2445829063653946, + ["x"] = 0.5585364103317261, + }, +} + +local function fix_coords(note) + for name, coord in pairs(RECIPEPROFIT_location_cache) do + if(note.vendor == name) then + note.x = coord.x * 100 + note.y = coord.y * 100 + end + end +end + +--[[ + Overwrites RECIPEPROFIT_alliance and RECIPEPROFIT_horde dbs. +]] +for _, note in pairs(RECIPEPROFIT_alliance) do + fix_coords(note) +end + +for _, note in pairs(RECIPEPROFIT_horde) do + fix_coords(note) +end