Skip to content

Commit c600300

Browse files
committed
improve detection of item uniqueness, and disable automatically accepting all quests by default
1 parent 1b14414 commit c600300

File tree

4 files changed

+27
-11
lines changed

4 files changed

+27
-11
lines changed

.vscode/settings.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,10 @@
9696
"EmbeddedItemTooltip",
9797
"SettingsPanel",
9898
"NORMAL_FONT_COLOR",
99-
"SOUNDKIT"
99+
"SOUNDKIT",
100+
"ITEM_UNIQUE",
101+
"ITEM_UNIQUE_EQUIPPABLE",
102+
"ITEM_MOD_VERSATILITY"
100103
],
101104
"Lua.runtime.version": "Lua 5.1",
102105
"Lua.runtime.builtin": {

AutoGear-Mainline.toc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Interface: 110107, 110200
1+
## Interface: 110107, 110200, 110205
22
## Title: AutoGear
33
## Notes: Automatically chooses loot and equips gear
44
## Author: Synthetikaryote, BujuArena

AutoGear.lua

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ end
9696
local InterfaceOptionsFrame_OpenToCategory = InterfaceOptionsFrame_OpenToCategory or Settings.OpenToCategory
9797
local IsPlayerSpell = C_SpellBook and C_SpellBook.IsSpellKnown or IsPlayerSpell
9898
local PickupContainerItem = PickupContainerItem or (C_Container and C_Container.PickupContainerItem)
99+
ITEM_UNIQUE_EQUIPPABLE_SANITIZED_PATTERN = select(1,string.gsub(ITEM_UNIQUE_EQUIPPABLE,"%-","%%-"))
99100
AutoGearWouldRoll = "nil"
100101
AutoGearSomeItemDataIsMissing = nil
101102
AutoGearFirstEquippableBagSlot = ContainerIDToInventoryID(1) or 20
@@ -1928,7 +1929,7 @@ optionsMenu:SetScript("OnEvent", function (self, event, arg1, arg2, ...)
19281929
AutoConfirmBinding = true,
19291930
AutoConfirmBindingBlues = false,
19301931
AutoConfirmBindingEpics = false,
1931-
AutoAcceptQuests = true,
1932+
AutoAcceptQuests = false,
19321933
AutoCompleteItemQuests = true,
19331934
AutoAcceptPartyInvitations = true,
19341935
ScoreInTooltips = true,
@@ -2631,8 +2632,10 @@ function AutoGearDecideRoll(link, lootRollID)
26312632
AutoGearPrint("AutoGear: "..rollItemInfo.link.." is not gear and \"Roll on non-gear loot\" is disabled, so not rolling.", 3)
26322633
--local rollDecision is nil, so no roll
26332634
elseif wouldNeed and canNeed then
2634-
if rollItemInfo.Within5levels or (rollItemInfo.isMount and (not rollItemInfo.alreadyKnown)) then
2635-
local maxNumberOfCopiesAllowedToNeed = (rollItemInfo.unique or (rollItemInfo.isMount and (not rollItemInfo.alreadyKnown))) and 1 or #rollItemInfo.validGearSlots
2635+
if rollItemInfo.Within5levels or (rollItemInfo.isMount and (not rollItemInfo.alreadyKnown)) or (not rollItemInfo.unusable) then
2636+
local maxNumberOfCopiesAllowedToNeed = (rollItemInfo.unique or (rollItemInfo.isMount and (not rollItemInfo.alreadyKnown))) and 1
2637+
or rollItemInfo.numEquippable
2638+
or #rollItemInfo.validGearSlots
26362639
local numberOfCopiesOwned = GetItemCount(rollItemInfo.id, true)
26372640
if numberOfCopiesOwned >= maxNumberOfCopiesAllowedToNeed then
26382641
AutoGearPrint("AutoGear: "..rollItemInfo.link.." is "..(rollItemInfo.isMount and "a mount" or "an upgrade usable within 5 levels")..", but you already have "..tostring(numberOfCopiesOwned).." cop"..(numberOfCopiesOwned == 1 and "y" or "ies")..", so rolling "..RED_FONT_COLOR_CODE.."GREED"..FONT_COLOR_CODE_CLOSE..".",3)
@@ -3586,6 +3589,16 @@ function AutoGearReadItemInfo(inventoryID, lootRollID, container, slot, questRew
35863589
(not info.bop) then
35873590
info.boe = 1
35883591
end
3592+
if textLeftText == ITEM_UNIQUE or textLeftText == ITEM_UNIQUE_EQUIPPABLE then
3593+
info.unique = 1
3594+
elseif string.find(textLeftText, ITEM_UNIQUE_EQUIPPABLE_SANITIZED_PATTERN) then
3595+
local uniqueType, numEquippable = string.match(textLeftText, ITEM_UNIQUE_EQUIPPABLE_SANITIZED_PATTERN..": ([^%(]+) %(([0-9]+)%)")
3596+
if uniqueType and numEquippable then
3597+
info.uniqueType = uniqueType
3598+
info.numEquippable = tonumber(numEquippable)
3599+
end
3600+
AutoGearPrint("AutoGear: uniqueType, numEquippable in \""..textLeftText.."\": \""..uniqueType.."\", "..tostring(numEquippable), 3)
3601+
end
35893602
local multiplier = 1.0
35903603
if string.find(text, "chance to") and not string.find(text, "improves") then multiplier = multiplier/3.0 end
35913604
if string.find(text, "use:") then multiplier = multiplier/6.0 end
@@ -3621,9 +3634,6 @@ function AutoGearReadItemInfo(inventoryID, lootRollID, container, slot, questRew
36213634
and string.find(text, "ranged attack speed") then
36223635
info.ammoBagRangedAttackSpeed = (info.ammoBagRangedAttackSpeed or 0) + value
36233636
end
3624-
if string.find(text, "unique") then
3625-
info.unique = 1
3626-
end
36273637
if string.find(text, "already known") then
36283638
info.alreadyKnown = 1
36293639
info.unusable = 1
@@ -4374,6 +4384,7 @@ function AutoGearIsGearPairEquippableTogether(a, b)
43744384
or ((a.id == b.id)
43754385
and ((GetItemCount(a.id, true) < 2)
43764386
or (a.unique)))
4387+
or (a.uniqueType and (a.uniqueType == b.uniqueType) and (a.numEquippable < 2) and (b.numEquippable < 2))
43774388
or (a.ammoBagRangedAttackSpeed and b.ammoBagRangedAttackSpeed)
43784389
or ((a.is1hWeaponOrOffHand and b.is1hWeaponOrOffHand)
43794390
and ((weapons == "dagger and any")
@@ -4382,6 +4393,7 @@ function AutoGearIsGearPairEquippableTogether(a, b)
43824393
or ((weapons == "weapon and shield")
43834394
and (a.subclassID ~= Enum.ItemArmorSubclass.Shield)
43844395
and (b.subclassID ~= Enum.ItemArmorSubclass.Shield))) then
4396+
-- AutoGearPrint("AG: "..a.link.." ("..(a.guid or "missing guid")..") and "..b.link.." ("..(b.guid or "missing guid")..") are not equippable together", 3)
43854397
return
43864398
end
43874399
for _, firstSlot in pairs(a.validGearSlots) do
@@ -4394,6 +4406,7 @@ function AutoGearIsGearPairEquippableTogether(a, b)
43944406
and ((secondSlot == INVSLOT_MAINHAND)
43954407
or (secondSlot == INVSLOT_OFFHAND))))
43964408
then
4409+
-- AutoGearPrint("AG: "..a.link.." ("..(a.guid or "missing guid")..") and "..b.link.." ("..(b.guid or "missing guid")..") are equippable together", 3)
43974410
return 1
43984411
end
43994412
end
@@ -4706,7 +4719,7 @@ function AutoGearTooltipHook(tooltip, tooltipData)
47064719
HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b,
47074720
HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b
47084721
)
4709-
-- local rollDecision = AutoGearDecideRoll(tooltipItemInfo.link)
4722+
-- local rollDecision = AutoGearDecideRoll(info.link)
47104723
-- tooltip:AddDoubleLine(
47114724
-- "AutoGear: would roll:",
47124725
-- (rollDecision == 1 and GREEN_FONT_COLOR_CODE.."NEED" or (rollDecision == 2 and RED_FONT_COLOR_CODE.."GREED" or HIGHLIGHT_FONT_COLOR_CODE.."no roll"))..FONT_COLOR_CODE_CLOSE,

AutoGear.toc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
## Interface: 110107, 110200
2-
## Interface-Mainline: 110200
1+
## Interface: 110107, 110200, 110205
2+
## Interface-Mainline: 110205
33
## Interface-Mists: 50500, 50501
44
## Interface-Cata: 40402
55
## Interface-Wrath: 30404, 30405

0 commit comments

Comments
 (0)