diff --git a/Libs/LibPeriodicTable-3.1-Consumable/LibPeriodicTable-3.1-Consumable.lua b/Libs/LibPeriodicTable-3.1-Consumable/LibPeriodicTable-3.1-Consumable.lua index 7f67b5f..fff3d7c 100644 --- a/Libs/LibPeriodicTable-3.1-Consumable/LibPeriodicTable-3.1-Consumable.lua +++ b/Libs/LibPeriodicTable-3.1-Consumable/LibPeriodicTable-3.1-Consumable.lua @@ -1,7 +1,7 @@ -- (c) 2007 Nymbia. see LGPLv2.1.txt for full details. --DO NOT MAKE CHANGES TO THIS FILE BEFORE READING THE WIKI PAGE REGARDING CHANGING THESE FILES if not LibStub("LibPeriodicTable-3.1", true) then error("PT3 must be loaded before data") end -LibStub("LibPeriodicTable-3.1"):AddData("Consumable", gsub("$Rev: 287 $", "(%d+)", function(n) return n+90000 end), { +LibStub("LibPeriodicTable-3.1"):AddData("Consumable", gsub("$Rev: 292 $", "(%d+)", function(n) return n+90000 end), { ["Consumable.Anti-Venom"]="6452:25,6453:35,13462:60,2633:60,19440:60,12586:60,9030:60,3386:60,31437:70,25550:70", ["Consumable.Bandage.Basic"]="1251:66,2581:114,3530:161,3531:301,6450:400,6451:640,8544:800,8545:1104,14529:1360,14530:2000,21990:2800,21991:3400,38643:3400,38640:4100,34721:4800,34722:5800", ["Consumable.Bandage.Battleground.Alterac Valley"]="19307:2000", @@ -33,9 +33,9 @@ LibStub("LibPeriodicTable-3.1"):AddData("Consumable", gsub("$Rev: 287 $", "(%d+) ["Consumable.Buff.Absorb.Self.Holy"]="6051:400,22847:3400", ["Consumable.Buff.Absorb.Self.Nature"]="6052:1800,13458:2600,22844:3400", ["Consumable.Buff.Absorb.Self.Shadow"]="6048:900,13459:2600,22846:3400", - ["Consumable.Buff.Armor.Self"]="5997:50,3389:150,8951:250,13445:450,22834:550,4623:1000,13455:2000,22849:2500", + ["Consumable.Buff.Armor.Self"]="5997:50,3389:150,8951:250,13445:450,22834:550,4623:1000,13455:2000,22849:2500,40093:3500", ["Consumable.Buff.Armor.Target"]="3013:65,1478:105,4421:150,10305:195,27500:240,33459:285,43467:340", - ["Consumable.Buff.Attack Crit.Flask"]="32597:20", + ["Consumable.Buff.Attack Crit.Flask"]="32597:20,40212:200", ["Consumable.Buff.Attack Damage"]="23501:10,22788:40", ["Consumable.Buff.Attack Power.Self"]="23989:10,22779:30,12820:35,29528:60,28102:60,49856:75,49859:75,40068:90,31679:120,9224:265", ["Consumable.Buff.Attack Power.Flask"]="32599:20,47499:80,22854:120,32901:120,46377:120", @@ -71,9 +71,9 @@ LibStub("LibPeriodicTable-3.1"):AddData("Consumable", gsub("$Rev: 287 $", "(%d+) ["Consumable.Buff.Shadow Power"]="9264:40,22835:65", ["Consumable.Buff.Shield"]="23575:1000,23576:4000", ["Consumable.Buff.Speed.Self"]="29530:15,20081:20,2459:50,33226:14,43135:15", - ["Consumable.Buff.Spell Crit.Self"]="22839:2,28103:24", + ["Consumable.Buff.Spell Crit.Self"]="22839:2,28103:24,40212:200", ["Consumable.Buff.Spell Damage.Flask"]="32601:23,47499:47,13512:70,32900:70,22861:80,22866:80,46376:125", - ["Consumable.Buff.Spell Damage.Self"]="6373:10,22710:10,17708:15,22778:15,9155:20,22238:23,23326:23,28103:24,29528:30,13454:35,9264:40,49857:45,49860:45,22833:55,40070:58,22835:65,22788:80,22839:120", + ["Consumable.Buff.Spell Damage.Self"]="6373:10,22710:10,17708:15,22778:15,9155:20,22238:23,23326:23,28103:24,29528:30,13454:35,9264:40,49857:45,49860:45,22833:55,40070:58,22835:65,22788:80,22839:120,40212:200", ["Consumable.Buff.Spell Reflect.Self"]="20080:3", ["Consumable.Buff.Water Breathing"]="34076:3,37265:10,23871:30,24421:30,25539:60", diff --git a/Libs/LibPeriodicTable-3.1-Consumable/LibPeriodicTable-3.1-Consumable.toc b/Libs/LibPeriodicTable-3.1-Consumable/LibPeriodicTable-3.1-Consumable.toc index de49bfb..4e99b88 100644 --- a/Libs/LibPeriodicTable-3.1-Consumable/LibPeriodicTable-3.1-Consumable.toc +++ b/Libs/LibPeriodicTable-3.1-Consumable/LibPeriodicTable-3.1-Consumable.toc @@ -8,7 +8,7 @@ ## X-Category: Library ## X-License: LGPL v2.1 ## X-PeriodicTable-3.1-Module: Consumable -## X-Curse-Packaged-Version: r291 +## X-Curse-Packaged-Version: r292 ## X-Curse-Project-Name: LibPeriodicTable-3.1 ## X-Curse-Project-ID: libperiodictable-3-1 ## X-Curse-Repository-ID: wow/libperiodictable-3-1/mainline diff --git a/Libs/LibPeriodicTable-3.1-Misc/LibPeriodicTable-3.1-Misc.toc b/Libs/LibPeriodicTable-3.1-Misc/LibPeriodicTable-3.1-Misc.toc index 47d8c7b..d045997 100644 --- a/Libs/LibPeriodicTable-3.1-Misc/LibPeriodicTable-3.1-Misc.toc +++ b/Libs/LibPeriodicTable-3.1-Misc/LibPeriodicTable-3.1-Misc.toc @@ -8,7 +8,7 @@ ## X-Category: Library ## X-License: LGPL v2.1 ## X-PeriodicTable-3.1-Module: Misc -## X-Curse-Packaged-Version: r291 +## X-Curse-Packaged-Version: r292 ## X-Curse-Project-Name: LibPeriodicTable-3.1 ## X-Curse-Project-ID: libperiodictable-3-1 ## X-Curse-Repository-ID: wow/libperiodictable-3-1/mainline diff --git a/Libs/LibPeriodicTable-3.1-Tradeskill/LibPeriodicTable-3.1-Tradeskill.toc b/Libs/LibPeriodicTable-3.1-Tradeskill/LibPeriodicTable-3.1-Tradeskill.toc index ee2e751..17ee095 100644 --- a/Libs/LibPeriodicTable-3.1-Tradeskill/LibPeriodicTable-3.1-Tradeskill.toc +++ b/Libs/LibPeriodicTable-3.1-Tradeskill/LibPeriodicTable-3.1-Tradeskill.toc @@ -8,7 +8,7 @@ ## X-Category: Library ## X-License: LGPL v2.1 ## X-PeriodicTable-3.1-Module: Tradeskill -## X-Curse-Packaged-Version: r291 +## X-Curse-Packaged-Version: r292 ## X-Curse-Project-Name: LibPeriodicTable-3.1 ## X-Curse-Project-ID: libperiodictable-3-1 ## X-Curse-Repository-ID: wow/libperiodictable-3-1/mainline diff --git a/Libs/LibPeriodicTable-3.1-TradeskillResultMats/LibPeriodicTable-3.1-TradeskillResultMats.toc b/Libs/LibPeriodicTable-3.1-TradeskillResultMats/LibPeriodicTable-3.1-TradeskillResultMats.toc index 52954d0..4724484 100644 --- a/Libs/LibPeriodicTable-3.1-TradeskillResultMats/LibPeriodicTable-3.1-TradeskillResultMats.toc +++ b/Libs/LibPeriodicTable-3.1-TradeskillResultMats/LibPeriodicTable-3.1-TradeskillResultMats.toc @@ -8,7 +8,7 @@ ## X-Category: Library ## X-License: LGPL v2.1 ## X-PeriodicTable-3.1-Module: TradeskillResultMats -## X-Curse-Packaged-Version: r291 +## X-Curse-Packaged-Version: r292 ## X-Curse-Project-Name: LibPeriodicTable-3.1 ## X-Curse-Project-ID: libperiodictable-3-1 ## X-Curse-Repository-ID: wow/libperiodictable-3-1/mainline diff --git a/changelog.txt b/changelog.txt deleted file mode 100644 index f2e6f86..0000000 --- a/changelog.txt +++ /dev/null @@ -1,15 +0,0 @@ -=== Changelog === - -3.3v27: - * deathknights cannot wear shields. fixed - * fixed items on sell list not selling - * added option to use include list as sell list as well - * inventory scanning rewritten - will now only scan updated bags, and item info is cached <-- this is worth about 10 minor features and 100kB memory per scan saved - * Broker_Garbage-LootManager: Changed the way 'Warn Clams' and 'Warn Containers' work - they will now show a line in the tooltip - * finally made LibPeriodicTable an optional dependency. Therefore, I removed it from the package - if you didn't use it, you won't notice, if you did, get LibPeriodicTable here <http://wow.curse.com/downloads/wow-addons/details/libperiodictable-3-1.aspx> or if you have another addon that already loads this library, you're fine as well - * refined security checks when deleting items - * changed the license from GPLv2 to BSD, mainly because it does all I really need and is much less painful to read ;) - * many thanks to Zidomo and Cidrei for elaborate testing! - - TODO: - * config options for hideZeroValue \ No newline at end of file diff --git a/constants.lua b/constants.lua index e445316..5c89733 100644 --- a/constants.lua +++ b/constants.lua @@ -54,6 +54,8 @@ BrokerGarbage.defaultLocalSettings = { moneyEarned = 0, } +BrokerGarbage.toSellValue = {} -- value to show on sell icon + -- item classification BrokerGarbage.EXCLUDE = 0 -- item is excluded. Nothing happened... BrokerGarbage.INCLUDE = 1 -- item is on include list diff --git a/core.lua b/core.lua index 3d0d2dd..bee64ad 100644 --- a/core.lua +++ b/core.lua @@ -25,20 +25,17 @@ local LDB = LibStub("LibDataBroker-1.1"):NewDataObject("Broker_Garbage", { }) local function UpdateLDB() - local cheapestItems = BrokerGarbage:GetCheapest() BrokerGarbage.totalBagSpace, BrokerGarbage.totalFreeSlots = BrokerGarbage:GetBagSlots() - if cheapestItems[1] then - BrokerGarbage.cheapestItem = cheapestItems[1] + if BrokerGarbage.cheapestItems[1] then LDB.text = BrokerGarbage:FormatString(BG_GlobalDB.LDBformat) else - BrokerGarbage.cheapestItem = nil + BrokerGarbage.cheapestItems[1] = nil LDB.text = BrokerGarbage:FormatString(BG_GlobalDB.LDBNoJunk) end end -- internal variables --- local lastReminder = time() BrokerGarbage.optionsModules = {} -- used for ordering/showing entries in the options panel local locked = false -- set to true while selling stuff local sellValue = 0 -- represents the actual value that we sold stuff for @@ -47,12 +44,11 @@ local cost = 0 -- the amount of money that we repaired for -- Event Handler -- --------------------------------------------------------- local function eventHandler(self, event, ...) - if event == "ADDON_LOADED" and arg1 == "Broker_Garbage" then + if event == "PLAYER_ENTERING_WORLD" then BrokerGarbage:CheckSettings() -- some default values initialization BrokerGarbage.isAtVendor = false - BrokerGarbage.toSellValue = {} -- value to show on sell icon BrokerGarbage.totalBagSpace = 0 BrokerGarbage.totalFreeSlots = 0 @@ -61,17 +57,14 @@ local function eventHandler(self, event, ...) BrokerGarbage.clamInInventory = false BrokerGarbage.containerInInventory = false - elseif event == "PLAYER_ENTERING_WORLD" then -- full inventory scan to start with BrokerGarbage:ScanInventory() elseif event == "BAG_UPDATE" then + -- whatever these weird arguments mean if arg1 < 0 or arg1 > 4 then return end - BrokerGarbage:ScanInventoryContainer(arg1) -- partial inventory scan - if not locked then - UpdateLDB() - end + BrokerGarbage:ScanInventoryContainer(arg1) -- partial inventory scan on the relevant container elseif event == "MERCHANT_SHOW" then BrokerGarbage.isAtVendor = true @@ -82,18 +75,15 @@ local function eventHandler(self, event, ...) BrokerGarbage:AutoSell() end - elseif locked and event == "MERCHANT_CLOSED" then - -- fallback unlock - cost = 0 - sellValue = 0 - BrokerGarbage.isAtVendor = false - locked = false - BrokerGarbage:Debug("Fallback Unlock: Merchant window closed, scan lock released.") - UpdateLDB() - elseif event == "MERCHANT_CLOSED" then - -- we are unlocked, but still need to update this state BrokerGarbage.isAtVendor = false + + -- fallback unlock + if locked then + BrokerGarbage.isAtVendor = false + locked = false + BrokerGarbage:Debug("Fallback Unlock: Merchant window closed, scan lock released.") + end elseif event == "AUCTION_HOUSE_CLOSED" then -- Update cache auction values if needed @@ -114,22 +104,23 @@ local function eventHandler(self, event, ...) BrokerGarbage:FormatMoney(cost), BrokerGarbage:FormatMoney(sellValue - cost) )) + sellValue = 0 + cost = 0 elseif cost ~= 0 and BG_GlobalDB.autoRepairAtVendor then -- repair only BrokerGarbage:Print(format(BrokerGarbage.locale.repair, BrokerGarbage:FormatMoney(cost))) + cost = 0 elseif sellValue ~= 0 and BG_GlobalDB.autoSellToVendor then -- autosell only BrokerGarbage:Print(format(BrokerGarbage.locale.sell, BrokerGarbage:FormatMoney(sellValue))) + sellValue = 0 end - sellValue = 0 - cost = 0 locked = false BrokerGarbage:Debug("Regular Unlock: Money received, scan lock released.") - UpdateLDB() end end @@ -137,7 +128,7 @@ end local frame = CreateFrame("frame") frame:RegisterEvent("PLAYER_ENTERING_WORLD") -frame:RegisterEvent("ADDON_LOADED") +-- frame:RegisterEvent("ADDON_LOADED") frame:RegisterEvent("BAG_UPDATE") frame:RegisterEvent("MERCHANT_SHOW") frame:RegisterEvent("MERCHANT_CLOSED") @@ -168,6 +159,7 @@ function BrokerGarbage:UpdateRepairButton(...) -- show auto-sell icon on vendor frame if not _G["BrokerGarbage_SellIcon"] then iconbutton = CreateFrame("Button", "BrokerGarbage_SellIcon", MerchantBuyBackItemItemButton) + iconbutton:SetParent(MerchantBuyBackItemItemButton) iconbutton:SetWidth(36); iconbutton:SetHeight(36) iconbutton:SetNormalTexture("Interface\\Icons\\achievement_bg_returnxflags_def_wsg") iconbutton:SetHighlightTexture("Interface\\Buttons\\ButtonHilight-Square") @@ -266,7 +258,7 @@ function BrokerGarbage:Tooltip(self) end -- shows up to n lines of deletable items - local cheapList = BrokerGarbage:GetCheapest(BG_GlobalDB.tooltipNumItems) + local cheapList = BrokerGarbage.cheapestItems or {} for i = 1, #cheapList do -- adds lines: itemLink, count, itemPrice, source lineNum = BrokerGarbage.tt:AddLine( @@ -308,7 +300,7 @@ function BrokerGarbage:OnClick(itemTable, button) local LDBclick = false if not itemTable.itemID or type(itemTable.itemID) ~= "number" then BrokerGarbage:Debug("Click on LDB") - itemTable = BrokerGarbage.cheapestItem + itemTable = BrokerGarbage.cheapestItems[1] LDBclick = true end @@ -327,7 +319,6 @@ function BrokerGarbage:OnClick(itemTable, button) BrokerGarbage:Debug("Not at vendor", "Deleting") BrokerGarbage:Delete(itemTable) end - UpdateLDB() --[[elseif itemTable and IsAltKeyDown() and IsControlKeyDown() then -- disenchant @@ -343,22 +334,22 @@ function BrokerGarbage:OnClick(itemTable, button) end BrokerGarbage:Print(format(BrokerGarbage.locale.addedToSaveList, select(2,GetItemInfo(itemTable.itemID)))) BrokerGarbage.itemsCache = {} - UpdateLDB() if BrokerGarbage.optionsLoaded then BrokerGarbage:ListOptionsUpdate("exclude") end + BrokerGarbage:ScanInventory() elseif itemTable and IsAltKeyDown() then -- add to force vendor price list BG_GlobalDB.forceVendorPrice[itemTable.itemID] = true BrokerGarbage:Print(format(BrokerGarbage.locale.addedToPriceList, select(2,GetItemInfo(itemTable.itemID)))) BrokerGarbage.itemsCache = {} - UpdateLDB() if BrokerGarbage.optionsLoaded then BrokerGarbage:ListOptionsUpdate("forceprice") end + BrokerGarbage:ScanInventory() elseif button == "RightButton" then -- open config @@ -370,7 +361,7 @@ function BrokerGarbage:OnClick(itemTable, button) BrokerGarbage:ScanInventory() end - BrokerGarbage.debugItemTable = itemTable + UpdateLDB() end -- Item Value Calculation @@ -624,7 +615,6 @@ function BrokerGarbage:ScanInventory() for container = 0,4 do BrokerGarbage:ScanInventoryContainer(container) end - UpdateLDB() end -- scans your inventory bags for possible junk items and updates LDB display @@ -651,6 +641,9 @@ function BrokerGarbage:ScanInventoryContainer(container) end end end + + BrokerGarbage:GetCheapest() + UpdateLDB() end -- Find Cheap Items @@ -674,7 +667,7 @@ end -- returns the n cheapest items in your bags in a table function BrokerGarbage:GetCheapest(number) - if not number then number = 1 end + if not number then number = BG_GlobalDB.tooltipNumItems end local cheapestItems = {} local numSlots, count, quality, canOpen, itemLink, itemID, stackSize local item, maxValue, insert @@ -790,7 +783,7 @@ function BrokerGarbage:GetCheapest(number) end end - BrokerGarbage.cheapestItem = cheapestItems[1] + BrokerGarbage.cheapestItems = cheapestItems return cheapestItems end diff --git a/helper.lua b/helper.lua index f4d800c..53b5f39 100644 --- a/helper.lua +++ b/helper.lua @@ -107,7 +107,7 @@ end function BrokerGarbage:CreateDefaultLists(global) if global then BG_GlobalDB.include[46069] = true -- argentum lance - if not BG_GlobalDB.include[6265] then BG_GlobalDB.include[6265] = 20 end -- soulshards + if BG_GlobalDB.include[6265] == nil then BG_GlobalDB.include[6265] = 20 end -- soulshards BG_GlobalDB.include["Consumable.Water.Conjured"] = true BG_GlobalDB.forceVendorPrice["Consumable.Food.Edible.Basic"] = true BG_GlobalDB.forceVendorPrice["Consumable.Water.Basic"] = true @@ -145,6 +145,8 @@ function BrokerGarbage:CreateDefaultLists(global) BG_LocalDB.exclude["Misc.Reagent.Class."..string.gsub(string.lower(BrokerGarbage.playerClass), "^.", string.upper)] = true BrokerGarbage:Print(BrokerGarbage.locale.listsUpdatedPleaseCheck) + BrokerGarbage.itemsCache = {} + BrokerGarbage:ScanInventory() end -- returns options for plugin use @@ -201,14 +203,14 @@ end -- easier syntax for LDB display strings function BrokerGarbage:FormatString(text) local item - if not BrokerGarbage.cheapestItem or BrokerGarbage.cheapestItem == {} then + if not BrokerGarbage.cheapestItems or not BrokerGarbage.cheapestItems[1] then item = { itemID = 0, count = 0, value = 0, } else - item = BrokerGarbage.cheapestItem + item = BrokerGarbage.cheapestItems[1] end -- [junkvalue] diff --git a/readme.txt b/readme.txt index a8f1124..348dfc2 100644 --- a/readme.txt +++ b/readme.txt @@ -1,7 +1,7 @@ Broker_Garbage ============== Author: ckaotik -Version: 3.3v27 +Version: 3.3v28 WoW Version: 3.3.5 (TOC 30300) WoWInterface: http://www.wowinterface.com/downloads/info15531-Broker_Garbage.html