mirror of
https://github.com/parnic/breakables.git
synced 2025-06-17 01:41:51 -05:00
Compare commits
19 Commits
Author | SHA1 | Date | |
---|---|---|---|
4b31136512 | |||
f6641909ed | |||
466f952018 | |||
798fc314a3 | |||
5ff9be70da | |||
f9b0d201ea | |||
9aba362e1b | |||
6624d74b2a | |||
619e0f7479 | |||
80bf120abf | |||
d902f864db | |||
9a4c7ddf82 | |||
8bd14cd525 | |||
b086d499b8 | |||
66b0de8074 | |||
62a949cd10 | |||
8f50b7f75f | |||
3f0637641a | |||
6d5d518a8b |
3
.mailmap
Normal file
3
.mailmap
Normal file
@ -0,0 +1,3 @@
|
||||
parnic <parnic@parnic.com> Parnic <chris@parnic.com>
|
||||
parnic <parnic@parnic.com> Chris Pickett <cpickett@perniciousgames.com>
|
||||
parnic <parnic@parnic.com> root <root@parnic.com>
|
178
Breakables.lua
178
Breakables.lua
@ -18,6 +18,55 @@ local AdditionalMillableItems = {
|
||||
109127,
|
||||
109128,
|
||||
109129,
|
||||
-- Legion herbs
|
||||
124101,
|
||||
124102,
|
||||
124103,
|
||||
124104,
|
||||
124105,
|
||||
124106,
|
||||
128304,
|
||||
}
|
||||
|
||||
local AdditionalProspectableItems = {
|
||||
-- Legion ore
|
||||
123918,
|
||||
123919,
|
||||
}
|
||||
|
||||
local MassMilling = {
|
||||
-- wod
|
||||
[109124] = 190381,
|
||||
[109125] = 190382,
|
||||
[109126] = 190383,
|
||||
[109127] = 190384,
|
||||
[109128] = 190385,
|
||||
[109129] = 190386,
|
||||
-- legion
|
||||
[124101] = 209658,
|
||||
[124102] = 209659,
|
||||
[124103] = 209660,
|
||||
[124104] = 209661,
|
||||
[124105] = 209662,
|
||||
[124106] = 209664,
|
||||
[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 = {
|
||||
@ -28,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
|
||||
@ -86,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
|
||||
@ -271,6 +330,7 @@ function Breakables:OnItemReceived(event, bag)
|
||||
if self.justClicked then
|
||||
self:FindBreakables()
|
||||
self.justClicked = false
|
||||
self:OnLeaveProfessionButton()
|
||||
elseif not bag or bag >= 0 then
|
||||
nextCheck[bag] = GetTime() + BagUpdateCheckDelay
|
||||
end
|
||||
@ -577,7 +637,7 @@ function Breakables:CreateButtonFrame()
|
||||
frame:SetScript("OnMouseUp", frame.OnMouseUpFunc)
|
||||
frame:SetClampedToScreen(true)
|
||||
|
||||
local spellName, _, texture = GetSpellInfo(self:GetSpellIdFromProfessionButton(frame))
|
||||
local spellName, _, texture = GetSpellInfo(self:GetSpellIdFromProfessionButton(frame.type))
|
||||
|
||||
frame:SetAttribute("type1", "spell")
|
||||
frame:SetAttribute("spell1", spellName)
|
||||
@ -604,10 +664,20 @@ function Breakables:CreateButtonFrame()
|
||||
end
|
||||
end
|
||||
|
||||
function Breakables:GetSpellIdFromProfessionButton(btn)
|
||||
return (btn.type == BREAKABLE_HERB and MillingId)
|
||||
or (btn.type == BREAKABLE_ORE and ProspectingId)
|
||||
or (btn.type == BREAKABLE_DE and DisenchantId)
|
||||
function Breakables:GetSpellIdFromProfessionButton(itemType, itemId)
|
||||
if itemType == BREAKABLE_HERB and itemId ~= nil 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)
|
||||
or PickLockId
|
||||
end
|
||||
|
||||
@ -693,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
|
||||
|
||||
@ -751,26 +821,30 @@ 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)
|
||||
end
|
||||
|
||||
local BreakableAbilityName = GetSpellInfo((foundBreakables[i][IDX_BREAKABLETYPE] == BREAKABLE_HERB and MillingId)
|
||||
or (foundBreakables[i][IDX_BREAKABLETYPE] == BREAKABLE_ORE and ProspectingId)
|
||||
or (foundBreakables[i][IDX_BREAKABLETYPE] == BREAKABLE_DE and DisenchantId)
|
||||
or PickLockId)
|
||||
btn:SetAttribute("spell", BreakableAbilityName)
|
||||
local BreakableAbilityName = GetSpellInfo(self:GetSpellIdFromProfessionButton(foundBreakables[i][IDX_BREAKABLETYPE], self:GetItemIdFromLink(foundBreakables[i][IDX_LINK])))
|
||||
--GetSpellInfo((foundBreakables[i][IDX_BREAKABLETYPE] == BREAKABLE_HERB and MillingId)
|
||||
--or (foundBreakables[i][IDX_BREAKABLETYPE] == BREAKABLE_ORE and ProspectingId)
|
||||
--or (foundBreakables[i][IDX_BREAKABLETYPE] == BREAKABLE_DE and DisenchantId)
|
||||
--or PickLockId)
|
||||
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
|
||||
@ -823,12 +897,15 @@ function Breakables:FindBreakables(bag)
|
||||
end
|
||||
|
||||
function Breakables:OnEnterProfessionButton(btn)
|
||||
GameTooltip:SetOwner(btn, "ANCHOR_BOTTOMLEFT")
|
||||
GameTooltip:SetSpellByID(self:GetSpellIdFromProfessionButton(btn))
|
||||
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()
|
||||
@ -849,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
|
||||
@ -946,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
|
||||
@ -1038,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
|
||||
@ -1063,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
|
||||
|
@ -1,4 +1,4 @@
|
||||
## Interface: 60100
|
||||
## Interface: 70000
|
||||
## Author: Parnic
|
||||
## Name: Breakables
|
||||
## Title: Breakables |cff7fff7f-Ace3-|r
|
||||
@ -6,7 +6,7 @@
|
||||
## Version: @project-version@ (Revision: @project-revision@)
|
||||
## SavedVariables: BreakablesDB
|
||||
## OptionalDeps: Ace3, LibBabble-Inventory-3.0, Masque
|
||||
## X-Compatible-With: 40300
|
||||
## X-Compatible-With: 60200
|
||||
|
||||
#@no-lib-strip@
|
||||
embeds.xml
|
||||
|
20
readme.md
Normal file
20
readme.md
Normal 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.
|
Reference in New Issue
Block a user