Compare commits

...

10 Commits
1.4.1 ... 1.4.3

Author SHA1 Message Date
4b31136512 Added WoD combinables 2016-10-06 00:20:10 -05:00
f6641909ed Added support for combining smaller items into larger ones
Certain types of herbs and ore can be looted that aren't millable/prospectable themselves, but can be used to combine (or unbreak, if you will...) them into an item that can be milled/prospected. It's convenient if the addon offers support for those situations so you can combine the combinables, then break the breakables.
2016-10-04 14:13:10 -05:00
466f952018 Fixed the breakable button not working all the time
We need to explicitly set the type of the button to spell in addition to specifying the spell name, target bag, and target slot.
2016-10-04 14:13:10 -05:00
798fc314a3 Update more frequently
I had set a bag check delay to ensure when the player looted masses of items at once that we didn't bog down the game. 1 second is way more than that case needs, so let's reduce it to 0.1 simply to prevent the "check 8 times when looting 8 items" performance problem but retain a responsive Breakables UI.
2016-10-04 14:13:10 -05:00
5ff9be70da Added handling for disenchanting WoD/Legion items with a low Enchanting level 2016-10-03 16:14:20 -05:00
f9b0d201ea Added readme 2016-10-03 15:52:17 -05:00
9aba362e1b Fixed sometimes choosing small stacks over large ones
This is an ancient problem in Breakables where the merging mechanism was always combining the same breakable into a single entry in its internal array and disregarding what bag and slot each stack was in. If we retain the position of the largest stack, then Breakables can always pick the proper larger stack to break no matter what order they appear in bags. This won't help the case where a single stack is spread into stacks where no single stack is large enough to break, but the WoW client has built-in bag compression now, so that should be less of a concern.
2016-09-22 13:34:31 -05:00
6624d74b2a Fixed sometimes choosing invalid items to break
When the player had items where one was a substring of the other ("Whiptail" vs "Whiptail Stem", for example), the game client would sometimes pick the wrong one to break. In the Whiptail case, this meant the game could attempt to cast Mill on a Whiptail Stem if it appeared first in the player's bags, which doesn't work. All we can do with the target-item attribute is supply a name, so it's not really our fault that the game makes this decision, but we can work around it by using target-bag and target-slot instead of target-item where we can be explicit about what we're trying to break.
2016-09-22 13:34:31 -05:00
619e0f7479 Different method of determining if a Mass Mill spell is known 2016-09-21 08:30:51 -05:00
80bf120abf Added explicit support for Legion ore 2016-09-19 13:56:27 -05:00
2 changed files with 124 additions and 24 deletions

View File

@ -28,6 +28,12 @@ local AdditionalMillableItems = {
128304,
}
local AdditionalProspectableItems = {
-- Legion ore
123918,
123919,
}
local MassMilling = {
-- wod
[109124] = 190381,
@ -46,6 +52,23 @@ local MassMilling = {
[128304] = 210116,
}
local HerbCombineItems = {
-- MoP
97619, -- torn green tea leaf
97620, -- rain poppy petal
97621, -- silkweed stem
97622, -- snow lily petal
97623, -- fool's cap spores
97624, -- desecrated herb pod
-- WoD
109624, -- broken frostweed stem
109625, -- broken fireweed stem
109626, -- gorgrond flytrap ichor
109627, -- starflower petal
109628, -- nagrand arrowbloom petal
109629, -- talador orchid petal
}
local UnProspectableItems = {
109119, -- WoD True Iron Ore
}
@ -54,6 +77,15 @@ local ProspectingId = 31252
local ProspectingItemSubType = babbleInv["Metal & Stone"]
local CanProspect = false
local OreCombineItems = {
-- MoP
97512, -- ghost iron nugget
97546, -- kyparite fragment
-- WoD
109991, -- true iron nugget
109992, -- blackrock fragment
}
local DisenchantId = 13262
local DisenchantTypes = {babbleInv["Armor"], babbleInv["Weapon"]}
local CanDisenchant = false
@ -112,8 +144,9 @@ local BREAKABLE_HERB = 1
local BREAKABLE_ORE = 2
local BREAKABLE_DE = 3
local BREAKABLE_PICK = 4
local BREAKABLE_COMBINE = 5
local BagUpdateCheckDelay = 1.0
local BagUpdateCheckDelay = 0.1
local nextCheck = {}
for i=0,NUM_BAG_SLOTS do
nextCheck[i] = -1
@ -633,11 +666,15 @@ end
function Breakables:GetSpellIdFromProfessionButton(itemType, itemId)
if itemType == BREAKABLE_HERB and itemId ~= nil then
if MassMilling[itemId] ~= nil and IsSpellKnown(MassMilling[itemId]) then
if MassMilling[itemId] ~= nil and IsPlayerSpell(MassMilling[itemId]) then
return MassMilling[itemId]
end
end
if itemType == BREAKABLE_COMBINE then
return nil
end
return (itemType == BREAKABLE_HERB and MillingId)
or (itemType == BREAKABLE_ORE and ProspectingId)
or (itemType == BREAKABLE_DE and DisenchantId)
@ -726,7 +763,7 @@ function Breakables:FindBreakables(bag)
numBreakableStacks[j] = 0
end
if foundBreakables[i][IDX_BREAKABLETYPE] == self.buttonFrame[j].type and numBreakableStacks[j] < self.settings.maxBreakablesToShow then
if (foundBreakables[i][IDX_BREAKABLETYPE] == self.buttonFrame[j].type or (foundBreakables[i][IDX_BREAKABLETYPE] == BREAKABLE_COMBINE and foundBreakables[i][IDX_COUNT] >= 10)) and numBreakableStacks[j] < self.settings.maxBreakablesToShow then
local isDisenchantable = self:BreakableIsDisenchantable(foundBreakables[i][IDX_TYPE], foundBreakables[i][IDX_LEVEL], foundBreakables[i][IDX_RARITY])
local isLockedItem = foundBreakables[i][IDX_BREAKABLETYPE] == BREAKABLE_PICK
@ -784,7 +821,11 @@ function Breakables:FindBreakables(bag)
if not isDisenchantable then
local appendText = ""
if not isLockedItem then
appendText = " ("..(floor(foundBreakables[i][IDX_COUNT]/5))..")"
local breakStackSize = 5
if foundBreakables[i][IDX_BREAKABLETYPE] == BREAKABLE_COMBINE then
breakStackSize = 10
end
appendText = " ("..(floor(foundBreakables[i][IDX_COUNT]/breakStackSize))..")"
end
btn.text:SetText(foundBreakables[i][IDX_COUNT] .. appendText)
@ -795,16 +836,15 @@ function Breakables:FindBreakables(bag)
--or (foundBreakables[i][IDX_BREAKABLETYPE] == BREAKABLE_ORE and ProspectingId)
--or (foundBreakables[i][IDX_BREAKABLETYPE] == BREAKABLE_DE and DisenchantId)
--or PickLockId)
btn:SetAttribute("spell", BreakableAbilityName)
if BreakableAbilityName then
btn:SetAttribute("type", "spell")
btn:SetAttribute("spell", BreakableAbilityName)
if isLockedItem then
btn:SetAttribute("target-item")
btn:SetAttribute("target-bag", foundBreakables[i][IDX_BAG])
btn:SetAttribute("target-slot", foundBreakables[i][IDX_SLOT])
else
btn:SetAttribute("target-item", foundBreakables[i][IDX_NAME])
btn:SetAttribute("target-bag")
btn:SetAttribute("target-slot")
btn:SetAttribute("type", "item")
btn:SetAttribute("item", "item:" .. self:GetItemIdFromLink(foundBreakables[i][IDX_LINK]))
end
if lbfGroup then
@ -857,12 +897,15 @@ function Breakables:FindBreakables(bag)
end
function Breakables:OnEnterProfessionButton(btn)
GameTooltip:SetOwner(btn, "ANCHOR_BOTTOMLEFT")
GameTooltip:SetSpellByID(self:GetSpellIdFromProfessionButton(btn.type))
local spellId = self:GetSpellIdFromProfessionButton(btn.type)
if spellId then
GameTooltip:SetOwner(btn, "ANCHOR_BOTTOMLEFT")
GameTooltip:SetSpellByID(spellId)
GameTooltip:AddLine(" ")
GameTooltip:AddLine(L["Hold shift and left-click to drag the Breakables bar around."], 1, 1, 1, 1)
GameTooltip:Show()
GameTooltip:AddLine(" ")
GameTooltip:AddLine(L["Hold shift and left-click to drag the Breakables bar around."], 1, 1, 1, 1)
GameTooltip:Show()
end
end
function Breakables:OnLeaveProfessionButton()
@ -883,7 +926,7 @@ function Breakables:OnLeaveBreakableButton()
end
function Breakables:PostClickedBreakableButton(this)
if this.type == BREAKABLE_HERB or this.type == BREAKABLE_ORE or this.type == BREAKABLE_DE then
if this.type == BREAKABLE_HERB or this.type == BREAKABLE_ORE or this.type == BREAKABLE_DE or this.type == BREAKABLE_COMBINE then
self.justClicked = true
end
end
@ -980,20 +1023,45 @@ function Breakables:FindBreakablesInSlot(bagId, slotId)
end
end
if CanProspect and prospectable then
for i=1,#UnProspectableItems do
if UnProspectableItems[i] == itemId then
prospectable = false
if CanProspect then
if not prospectable then
for i=1,#AdditionalProspectableItems do
if AdditionalProspectableItems[i] == itemId then
prospectable = true
end
end
end
if prospectable then
for i=1,#UnProspectableItems do
if UnProspectableItems[i] == itemId then
prospectable = false
end
end
end
end
if CanMill --[[and (itemSubType == MillingItemSubType or itemSubType == MillingItemSecondarySubType)]] and millable then
return {itemLink, itemCount, itemType, itemTexture, bagId, slotId, itemSubType, itemLevel, BREAKABLE_HERB, false, itemName, itemRarity}
if CanMill --[[and (itemSubType == MillingItemSubType or itemSubType == MillingItemSecondarySubType)]] then
if millable then
return {itemLink, itemCount, itemType, itemTexture, bagId, slotId, itemSubType, itemLevel, BREAKABLE_HERB, false, itemName, itemRarity}
else
for i=1,#HerbCombineItems do
if HerbCombineItems[i] == itemId then
return {itemLink, itemCount, itemType, itemTexture, bagId, slotId, itemSubType, itemLevel, BREAKABLE_COMBINE, false, itemName, itemRarity}
end
end
end
end
if CanProspect --[[and itemSubType == ProspectingItemSubType]] and prospectable then
return {itemLink, itemCount, itemType, itemTexture, bagId, slotId, itemSubType, itemLevel, BREAKABLE_ORE, false, itemName, itemRarity}
if CanProspect --[[and itemSubType == ProspectingItemSubType]] then
if prospectable then
return {itemLink, itemCount, itemType, itemTexture, bagId, slotId, itemSubType, itemLevel, BREAKABLE_ORE, false, itemName, itemRarity}
else
for i=1,#OreCombineItems do
if OreCombineItems[i] == itemId then
return {itemLink, itemCount, itemType, itemTexture, bagId, slotId, itemSubType, itemLevel, BREAKABLE_COMBINE, false, itemName, itemRarity}
end
end
end
end
if CanPickLock and self:ItemIsPickable(itemId) and self:ItemIsLocked(bagId, slotId) then
@ -1072,6 +1140,11 @@ function Breakables:MergeBreakables(foundBreakable, breakableList)
for n=1,#breakableList do
local listItemId = self:GetItemIdFromLink(breakableList[n][IDX_LINK])
if foundItemId == listItemId then
-- always prefer the larger stack
if foundBreakable[IDX_COUNT] > breakableList[n][IDX_COUNT] then
breakableList[n][IDX_BAG] = foundBreakable[IDX_BAG]
breakableList[n][IDX_SLOT] = foundBreakable[IDX_SLOT]
end
breakableList[n][IDX_COUNT] = breakableList[n][IDX_COUNT] + foundBreakable[IDX_COUNT]
return true
end
@ -1097,6 +1170,13 @@ end
function Breakables:BreakableIsDisenchantable(itemType, itemLevel, itemRarity)
for i=1,#DisenchantTypes do
if DisenchantTypes[i] == itemType then
-- account for WoD and higher no longer needing specific ilvl. numbers from http://wow.gamepedia.com/Item_level
if (itemRarity == RARITY_UNCOMMON and itemLevel >= 483)
or (itemRarity == RARITY_RARE and itemLevel >= 515)
or (itemRarity >= RARITY_EPIC and itemLevel >= 640) then
return true
end
-- this is awful. is there an easier way? taken from www.wowpedia.org/Disenchanting
if itemRarity == RARITY_UNCOMMON then
if itemLevel <= 20 then

20
readme.md Normal file
View File

@ -0,0 +1,20 @@
### **Description**
Displays a bar on screen that allows quick access to enchanting, jewelcrafting, and inscription professions by presenting a Disenchant/Prospect/Mill button and all of the breakable items you have for that profession next to it. Also displays a bar for any locked junkboxes in your inventory if you're a Rogue. This allows one-click access for breaking down items instead of finding the item in your bag, clicking the appropriate profession/skill button, and clicking the item for each and every item you want to break. For prospecting and milling, you will see the number of items you have alongside the number of times you can break it. In the prospecting screenshot on the right, the player has 169 total Saronite Ore in his bags which will allow for 33 total prospects.
### **Usage**
By default, if you have the appropriate profession and items in your inventory, a bar will appear with the profession ability followed by any items that are eligible for breaking. You can hold shift to drag the bar around if you want to move it. Clicking the profession button will activate that ability (disenchant/prospect/mill) and clicking an item will break it. You don't have to click the profession button first as simply clicking the item will automatically break it down.
### **Configuration**
Typing */brk* will open the configuration settings (or you can get to it from Blizzard's Interface options) which consist of:
* **Hide if no breakables**: this will control whether you see the profession button or not when nothing breakable is detected
* **Max number to display**: this controls the highest number of items that you will see next to your profession button. If this is 5 but you have 10 breakable items in your bags, you will only see 5 at a time.
* **Show soulbound items**: aimed at enchanters, this controls whether or not you will see items that are soulbound as breakable items or not.
### **Known issues**
* If you have more than 5 of a breakable item but split into stacks all smaller than 5, the game will say you do not have enough items to break. The default UI now has a built-in button to compress stacks that should solve this issue.
* If you know Mass Milling for a specific type of herb, the current alpha will try to use this ability and fail. I am in the process of leveling a scribe up high enough to debug this problem.