mirror of
https://github.com/parnic/breakables.git
synced 2025-06-17 01:41:51 -05:00
- Fixed GetEnchantingLevel() to work without requiring the user to open his/her professions window first. This isn't used yet; committing the fixed function to work on later.
This commit is contained in:
@ -17,6 +17,7 @@ local CanProspect = false
|
|||||||
local DisenchantId = 13262
|
local DisenchantId = 13262
|
||||||
local DisenchantTypes = {babbleInv["Armor"], babbleInv["Weapon"]}
|
local DisenchantTypes = {babbleInv["Armor"], babbleInv["Weapon"]}
|
||||||
local CanDisenchant = false
|
local CanDisenchant = false
|
||||||
|
local EnchantingProfessionId = 333
|
||||||
|
|
||||||
local PickLockId = 1804
|
local PickLockId = 1804
|
||||||
local PickableItems = {
|
local PickableItems = {
|
||||||
@ -159,6 +160,8 @@ function Breakables:OnEnable()
|
|||||||
CanDisenchant = IsUsableSpell(GetSpellInfo(DisenchantId))
|
CanDisenchant = IsUsableSpell(GetSpellInfo(DisenchantId))
|
||||||
CanPickLock = IsUsableSpell(GetSpellInfo(PickLockId))
|
CanPickLock = IsUsableSpell(GetSpellInfo(PickLockId))
|
||||||
|
|
||||||
|
self.EnchantingLevel = 0
|
||||||
|
|
||||||
LibStub("AceConfig-3.0"):RegisterOptionsTable("Breakables", self:GetOptions(), "breakables")
|
LibStub("AceConfig-3.0"):RegisterOptionsTable("Breakables", self:GetOptions(), "breakables")
|
||||||
self.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("Breakables")
|
self.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("Breakables")
|
||||||
|
|
||||||
@ -185,6 +188,7 @@ function Breakables:OnEnable()
|
|||||||
end
|
end
|
||||||
if CanDisenchant then
|
if CanDisenchant then
|
||||||
numEligibleProfessions = numEligibleProfessions + 1
|
numEligibleProfessions = numEligibleProfessions + 1
|
||||||
|
self:GetEnchantingLevel()
|
||||||
end
|
end
|
||||||
if CanPickLock then
|
if CanPickLock then
|
||||||
numEligibleProfessions = numEligibleProfessions + 1
|
numEligibleProfessions = numEligibleProfessions + 1
|
||||||
@ -296,12 +300,24 @@ function Breakables:OnBagItemLockPicked()
|
|||||||
nextCheck[1] = GetTime() + BagUpdateCheckDelay
|
nextCheck[1] = GetTime() + BagUpdateCheckDelay
|
||||||
end
|
end
|
||||||
|
|
||||||
function Breakables:GetEnchantingLevel()
|
function Breakables:FindLevelOfProfessionIndex(idx)
|
||||||
local skillName, skillType, numAvailable, isExpanded = GetTradeSkillInfo(1)
|
if idx ~= nil then
|
||||||
|
local name, texture, rank, maxRank, numSpells, spelloffset, skillLine = GetProfessionInfo(idx)
|
||||||
|
return skillLine, rank
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if skillName == "Enchant" then
|
function Breakables:GetEnchantingLevel()
|
||||||
local _, rank, maxRank = GetTradeSkillLine()
|
local prof1, prof2 = GetProfessions()
|
||||||
self.settings.EnchantingLevel = rank
|
|
||||||
|
local skillId, rank = self:FindLevelOfProfessionIndex(prof1)
|
||||||
|
if skillId ~= nil and skillId == EnchantingProfessionId then
|
||||||
|
self.EnchantingLevel = rank
|
||||||
|
else
|
||||||
|
skillId, rank = self:FindLevelOfProfessionIndex(prof2)
|
||||||
|
if skillId ~= nil and skillId == EnchantingProfessionId then
|
||||||
|
self.EnchantingLevel = rank
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -989,6 +1005,8 @@ function Breakables:BreakableIsDisenchantable(itemType, itemLevel)
|
|||||||
if DisenchantTypes[i] == itemType then
|
if DisenchantTypes[i] == itemType then
|
||||||
-- todo: figure out if the iLevel works with our enchanting skill level.
|
-- todo: figure out if the iLevel works with our enchanting skill level.
|
||||||
-- formula (from http://www.wowwiki.com/Disenchanting): 5*ceiling(iLevel,5)-100
|
-- formula (from http://www.wowwiki.com/Disenchanting): 5*ceiling(iLevel,5)-100
|
||||||
|
-- For most of the range, this is equivalent to 5*ceiling(iLevel,5)-100 = 5*ceiling(req. level,5)-75; that is, round up the required level to the next multiple of 5, multiply by 5, and subtract 75 to find the minimum enchanting skill necessary to disenchant an item.
|
||||||
|
-- return self.EnchantingLevel >= 5*ceil(itemLevel, 5) - 100
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user