Skip to content

Commit

Permalink
Add support for initial specs
Browse files Browse the repository at this point in the history
  • Loading branch information
Snakybo committed Nov 4, 2020
1 parent cc1c1e1 commit 04ea997
Show file tree
Hide file tree
Showing 7 changed files with 257 additions and 74 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [0.10.1] - 2020-11-04

### Fixed

- Fix Lua errors on new and low level characters

## [0.10.0] - 2020-11-03

### Added
Expand Down Expand Up @@ -291,7 +297,8 @@

- Initial public release

[Unreleased]: https://github.com/Snakybo/Clicked/compare/0.10.0...master
[Unreleased]: https://github.com/Snakybo/Clicked/compare/0.10.1...master
[0.10.1]: https://github.com/Snakybo/Clicked/releases/tag/0.10.1
[0.10.0]: https://github.com/Snakybo/Clicked/releases/tag/0.10.0
[0.9.3]: https://github.com/Snakybo/Clicked/releases/tag/0.9.3
[0.9.2]: https://github.com/Snakybo/Clicked/releases/tag/0.9.2
Expand Down
14 changes: 7 additions & 7 deletions Config/Bindings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -884,10 +884,10 @@ local function DrawLoadInStance(container, form, specIds)
end

if #specIds == 1 then
local spec = specIds[1]
local specId = specIds[1]

-- Balance Druid, Feral Druid, Guardian Druid, Restoration Druid
if spec == 102 or spec == 103 or spec == 104 or spec == 105 then
if specId == 102 or specId == 103 or specId == 104 or specId == 105 then
label = L["BINDING_UI_PAGE_LOAD_OPTIONS_LABEL_FORM"]
end
end
Expand Down Expand Up @@ -932,10 +932,10 @@ local function DrawBindingLoadOptionsPage(container, binding)
specIndices[1] = GetSpecialization()
else
for _, class in ipairs(classNames) do
local numSpecs = #LibTalentInfo:GetClassSpecIDs(class)
local specs = LibTalentInfo:GetClassSpecIDs(class)

for i = 1, numSpecs do
table.insert(specIndices, i)
for specIndex in pairs(specs) do
table.insert(specIndices, specIndex)
end
end
end
Expand All @@ -948,11 +948,11 @@ local function DrawBindingLoadOptionsPage(container, binding)

for i = 1, #classNames do
local class = classNames[i]
local specIds = LibTalentInfo:GetClassSpecIDs(class)
local specs = LibTalentInfo:GetClassSpecIDs(class)

for j = 1, #specIndices do
local specIndex = specIndices[j]
local specId = specIds[specIndex]
local specId = specs[specIndex]

table.insert(specializationIds, specId)
end
Expand Down
9 changes: 8 additions & 1 deletion Core/Database.lua
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,14 @@ function Clicked:GetNewBindingTemplate()
}

if not self:IsClassic() then
template.load.specialization = GetTriStateLoadOptionTemplate(GetSpecialization())
local specIndex = GetSpecialization()

-- Initial spec
if specIndex == 5 then
specIndex = 1
end

template.load.specialization = GetTriStateLoadOptionTemplate(specIndex)
template.load.talent = GetTriStateLoadOptionTemplate(1)
template.load.pvpTalent = GetTriStateLoadOptionTemplate(1)
template.load.warMode = GetLoadOptionTemplate(Clicked.WarModeState.IN_WAR_MODE)
Expand Down
81 changes: 55 additions & 26 deletions Core/Utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,101 +3,113 @@ local LibTalentInfo = LibStub("LibTalentInfo-1.0")

-- /run local a,b,c=table.concat,{},{};for d=1,GetNumShapeshiftForms() do local _,_,_,f=GetShapeshiftFormInfo(d);local e=GetSpellInfo(f);b[#b+1]=e;c[#c+1]=f;end print("{ "..a(c, ",").." }, --"..a(b,", "))
local shapeshiftForms = {
-- Arms Warrior
-- Arms Warrior
-- Fury Warrior
-- Protection Warrior
[1446] = {},
-- Initial Warrior
[71] = {},
[72] = {},
[73] = {},
[1446] = {},

-- Holy Paladin
-- Protection Paladin
-- Retribution Paladin
[1451] = { 32223, 465, 183435 }, -- Crusader Aura, Devotion Aura, Retribution Aura
-- Initial Paladin
[65] = { 32223, 465, 183435 }, -- Crusader Aura, Devotion Aura, Retribution Aura
[66] = { 32223, 465, 183435 }, -- Crusader Aura, Devotion Aura, Retribution Aura
[70] = { 32223, 465, 183435 }, -- Crusader Aura, Devotion Aura, Retribution Aura
[1451] = { 32223, 465, 183435 }, -- Crusader Aura, Devotion Aura, Retribution Aura

-- Beast Mastery Hunter
-- Marksmanship Hunter
-- Survival Hunter
[1448] = {},
-- Initial Hunter
[253] = {},
[254] = {},
[255] = {},
[1448] = {},

-- Assassination Rogue
-- Outlaw Rogue
-- Subtlety Rogue
[1453] = { 1784 }, -- Stealth
-- Initial Rogue
[259] = { 1784 }, -- Stealth
[260] = { 1784 }, -- Stealth
[261] = { 1784 }, -- Stealth
[1453] = { 1784 }, -- Stealth

-- Discipline Priest
-- Holy Priest
-- Shadow Priest
[1452] = {},
-- Initial Priest
[256] = {},
[257] = {},
[258] = { 232698 }, -- Shadowform
[1452] = {},

-- Blood Death Knight
-- Frost Death Knight
-- Unholy Death Knight
[1455] = {},
-- Initial Death Knight
[250] = {},
[251] = {},
[252] = {},
[1455] = {},

-- Elemental Shaman
-- Enhancement Shaman
-- Restoration Shaman
[1444] = {},
-- Initial Shaman
[262] = {},
[263] = {},
[264] = {},
[1444] = {},

-- Arcane Mage
-- Fire Mage
-- Frost Mage
[1449] = {},
-- Initial Mage
[62] = {},
[63] = {},
[64] = {},
[1449] = {},

-- Afflication Warlock
-- Demonology Warlock
-- Destruction Warlock
[1454] = {},
-- Initial Warlock
[265] = {},
[266] = {},
[267] = {},
[1454] = {},

-- Brewmaster Monk
-- Mistweaver Monk
-- Windwalker Monk
[1450] = {},
-- Initial Monk
[268] = {},
[270] = {},
[269] = {},
[1450] = {},

-- Balance Druid
-- Feral Druid
-- Guardian Druid
-- Restoration Druid
[1447] = { 5487, 768, 783, 197625, 114282, 210053 }, -- Bear Form, Cat Form, Travel Form, Moonkin Form, Treant Form, Mount Form
-- Initial Druid
[102] = { 5487, 768, 783, 197625, 114282, 210053 }, -- Bear Form, Cat Form, Travel Form, Moonkin Form, Treant Form, Mount Form
[103] = { 5487, 768, 783, 197625, 114282, 210053 }, -- Bear Form, Cat Form, Travel Form, Moonkin Form, Treant Form, Mount Form
[104] = { 5487, 768, 783, 197625, 114282, 210053 }, -- Bear Form, Cat Form, Travel Form, Moonkin Form, Treant Form, Mount Form
[105] = { 5487, 768, 783, 197625, 114282, 210053 }, -- Bear Form, Cat Form, Travel Form, Moonkin Form, Treant Form, Mount Form
[1447] = { 5487, 768, 783, 197625, 114282, 210053 }, -- Bear Form, Cat Form, Travel Form, Moonkin Form, Treant Form, Mount Form

-- Havoc Demon Hunter
-- Vengeance Demon Hunter
[1456] = {},
-- Initial Demon Hunter
[577] = {},
[581] = {}
[581] = {},
[1456] = {}
}

local races
Expand Down Expand Up @@ -538,31 +550,46 @@ function Clicked:GetLocalizedSpecializations(classNames)
local class = classNames[1]
local specs = LibTalentInfo:GetClassSpecIDs(class) or {}

for i = 1, #specs do
local _, name, _, icon = GetSpecializationInfoByID(specs[i])
local key = i
for specIndex, specId in pairs(specs) do
local _, name, _, icon = GetSpecializationInfoByID(specId)
local key = specIndex

items[key] = string.format("<icon=%d><text=%s>", icon, name)
table.insert(order, key)
if not self:IsStringNilOrEmpty(name) then
items[key] = string.format("<icon=%d><text=%s>", icon, name)
table.insert(order, key)
end
end
else
local function CountSpecs(specs)
local count = 0

for specIndex in pairs(specs) do
count = count + 1
end

return count
end

local max = 0

-- Find class with the most specializations out of all available classes
if #classNames == 0 then
for _, specs in LibTalentInfo:AllClasses() do
if #specs > max then
max = #specs
local count = CountSpecs(specs)

if count > max then
max = count
end
end
-- Find class with the most specializations out of the selected classes
else
for i = 1, #classNames do
local class = classNames[i]
local specs = LibTalentInfo:GetClassSpecIDs(class) or {}
local count = CountSpecs(specs)

if #specs > max then
max = #specs
if count > max then
max = count
end
end
end
Expand Down Expand Up @@ -595,8 +622,10 @@ function Clicked:GetLocalizedTalents(specializations)
local _, name, texture = LibTalentInfo:GetTalentInfo(spec, tier, column)
local key = #order + 1

items[key] = string.format("<icon=%d><text=%s>", texture, name)
table.insert(order, key)
if not self:IsStringNilOrEmpty(name) then
items[key] = string.format("<icon=%d><text=%s>", texture, name)
table.insert(order, key)
end
end
end
else
Expand Down Expand Up @@ -639,7 +668,7 @@ function Clicked:GetLocalizedPvPTalents(specializations)
-- Find specialization with the highest number of PvP talents
if #specializations == 0 then
for _, specs in LibTalentInfo:AllClasses() do
for _, spec in ipairs(specs) do
for _, spec in pairs(specs) do
local numTalents = LibTalentInfo:GetNumPvPTalentsForSpec(spec, 1)

if numTalents > max then
Expand Down
14 changes: 6 additions & 8 deletions Libs/LibTalentInfo-1.0/CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
commit fbac6bcff353188948fa77b7a74642c43a584252
Author: Snakybo <[email protected]>
Date: Sun Nov 1 23:42:31 2020 +0100

Add assertion error messages
tag 405fbbb3f3a5abecffdafc752eef12f78736b6af r4
Author: Snakybo <[email protected]>
Date: Wed Nov 4 11:22:35 2020 +0100

commit 43145e1a72416509d6f219e82172fd4981af1260
commit 0224a35c124d31fc717fe1aed69d49b7ee2d8ba8
Author: Snakybo <[email protected]>
Date: Sun Nov 1 23:19:05 2020 +0100
Date: Wed Nov 4 11:22:26 2020 +0100

Initial commit
Add support for initial specs

Loading

0 comments on commit 04ea997

Please sign in to comment.