Initial WoW Classic Support

First pass of changes to make Details! compatible with WoW Classic.
This commit is contained in:
Tercioo
2019-05-23 15:13:42 -03:00
parent 24dde5130c
commit 643d25bb91
30 changed files with 517 additions and 364 deletions
+93 -5
View File
@@ -1,5 +1,5 @@
local dversion = 149
local dversion = 151
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary (major, minor)
@@ -25,6 +25,94 @@ DF.AuthorInfo = {
Discord = "https://discord.gg/AGSzAZX",
}
if (not PixelUtil) then
--check if is in classic wow, if it is, build a replacement for PixelUtil
local gameVersion = GetBuildInfo()
if (gameVersion:match("%d") == "1") then
PixelUtil = {
SetWidth = function (self, width) self:SetWidth (width) end,
SetHeight = function (self, height) self:SetHeight (height) end,
SetSize = function (self, width, height) self:SetSize (width, height) end,
SetPoint = function (self, ...) self:SetPoint (...) end,
}
end
end
function DF.IsClassicWow()
local gameVersion = GetBuildInfo()
if (gameVersion:match ("%d") == "1") then
return true
end
return false
end
function DF.UnitGroupRolesAssigned (unitId)
if (UnitGroupRolesAssigned) then
return UnitGroupRolesAssigned (unitId)
else
--attempt to guess the role by the player spec
--at the moment just return none
return "NONE"
end
end
--return the specialization of the player it self
function DF.GetSpecialization()
if (GetSpecialization) then
return GetSpecialization()
end
return nil
end
function DF.GetSpecializationInfoByID (...)
if (GetSpecializationInfoByID) then
return GetSpecializationInfoByID (...)
end
return nil
end
function DF.GetSpecializationInfo (...)
if (GetSpecializationInfo) then
return GetSpecializationInfo (...)
end
return nil
end
function DF.GetSpecializationRole (...)
if (GetSpecializationRole) then
return GetSpecializationRole (...)
end
return nil
end
--build dummy encounter journal functions if they doesn't exists
--this is done for compatibility with classic and if in the future EJ_ functions are moved to C_
DF.EncounterJournal = {
EJ_GetCurrentInstance = EJ_GetCurrentInstance or function() return nil end,
EJ_GetInstanceForMap = EJ_GetInstanceForMap or function() return nil end,
EJ_GetInstanceInfo = EJ_GetInstanceInfo or function() return nil end,
EJ_SelectInstance = EJ_SelectInstance or function() return nil end,
EJ_GetEncounterInfoByIndex = EJ_GetEncounterInfoByIndex or function() return nil end,
EJ_GetEncounterInfo = EJ_GetEncounterInfo or function() return nil end,
EJ_SelectEncounter = EJ_SelectEncounter or function() return nil end,
EJ_GetSectionInfo = EJ_GetSectionInfo or function() return nil end,
EJ_GetCreatureInfo = EJ_GetCreatureInfo or function() return nil end,
EJ_SetDifficulty = EJ_SetDifficulty or function() return nil end,
EJ_GetNumLoot = EJ_GetNumLoot or function() return 0 end,
EJ_GetLootInfoByIndex = EJ_GetLootInfoByIndex or function() return nil end,
}
if (not EJ_GetCurrentInstance) then
end
--> will always give a very random name for our widgets
local init_counter = math.random (1, 1000000)
@@ -2496,9 +2584,9 @@ function DF:ReskinSlider (slider, heightOffset)
end
function DF:GetCurrentSpec()
local specIndex = GetSpecialization()
local specIndex = DF.GetSpecialization()
if (specIndex) then
local specID = GetSpecializationInfo (specIndex)
local specID = DF.GetSpecializationInfo (specIndex)
if (specID and specID ~= 0) then
return specID
end
@@ -2786,8 +2874,8 @@ DF.CLEncounterID = {
function DF:GetPlayerRole()
local assignedRole = UnitGroupRolesAssigned ("player")
if (assignedRole == "NONE") then
local spec = GetSpecialization()
return spec and GetSpecializationRole (spec) or "NONE"
local spec = DF.GetSpecialization()
return spec and DF.GetSpecializationRole (spec) or "NONE"
end
return assignedRole
end
+14 -12
View File
@@ -14,6 +14,8 @@ local _type = type --> lua local
local _math_floor = math.floor --> lua local
local loadstring = loadstring --> lua local
local UnitGroupRolesAssigned = DetailsFramework.UnitGroupRolesAssigned
local cleanfunction = function() end
local APIFrameFunctions
@@ -4459,7 +4461,7 @@ function DF:CreateKeybindBox (parent, name, data, callback, width, height, line_
for index, specId in ipairs (specIds) do
local button = new_keybind_frame ["SpecButton" .. index]
local spec_id, spec_name, spec_description, spec_icon, spec_background, spec_role, spec_class = GetSpecializationInfoByID (specId)
local spec_id, spec_name, spec_description, spec_icon, spec_background, spec_role, spec_class = DetailsFramework.GetSpecializationInfoByID (specId)
button.text = spec_name
button:SetClickFunction (switch_spec, specId)
button:SetIcon (spec_icon)
@@ -4584,9 +4586,9 @@ function DF:CreateKeybindBox (parent, name, data, callback, width, height, line_
if (type (dispel) == "table") then
local dispelString = "\n"
for specID, spellid in pairs (dispel) do
local specid, specName = GetSpecializationInfoByID (specID)
local specid, specName = DetailsFramework.GetSpecializationInfoByID (specID)
local spellName = GetSpellInfo (spellid)
dispelString = dispelString .. "|cFFE5E5E5" .. specName .. "|r: |cFFFFFFFF" .. spellName .. "\n"
dispelString = dispelString .. "|cFFE5E5E5" .. (specName or "") .. "|r: |cFFFFFFFF" .. spellName .. "\n"
end
dispel = dispelString
else
@@ -4608,9 +4610,9 @@ function DF:CreateKeybindBox (parent, name, data, callback, width, height, line_
for specID, t in pairs (new_keybind_frame.Data) do
if (specID ~= new_keybind_frame.EditingSpec) then
local key = CopyTable (keybind)
local specid, specName = GetSpecializationInfoByID (specID)
local specid, specName = DetailsFramework.GetSpecializationInfoByID (specID)
tinsert (new_keybind_frame.Data [specID], key)
DF:Msg ("Keybind copied to " .. specName)
DF:Msg ("Keybind copied to " .. (specName or ""))
end
end
DF:QuickDispatch (callback)
@@ -5653,9 +5655,9 @@ function DF:CreateLoadFilterParser (callback)
elseif (event == "PLAYER_ROLES_ASSIGNED") then
local assignedRole = UnitGroupRolesAssigned ("player")
if (assignedRole == "NONE") then
local spec = GetSpecialization()
local spec = DetailsFramework.GetSpecialization()
if (spec) then
assignedRole = GetSpecializationRole (spec)
assignedRole = DetailsFramework.GetSpecializationRole (spec)
end
end
@@ -5705,9 +5707,9 @@ function DF:PassLoadFilters (loadTable, encounterID)
end
if (canCheckTalents) then
local specIndex = GetSpecialization()
local specIndex = DetailsFramework.GetSpecialization()
if (specIndex) then
local specID = GetSpecializationInfo (specIndex)
local specID = DetailsFramework.GetSpecializationInfo (specIndex)
if (not loadTable.spec [specID]) then
return false
end
@@ -5767,9 +5769,9 @@ function DF:PassLoadFilters (loadTable, encounterID)
if (loadTable.role.Enabled) then
local assignedRole = UnitGroupRolesAssigned ("player")
if (assignedRole == "NONE") then
local spec = GetSpecialization()
local spec = DetailsFramework.GetSpecialization()
if (spec) then
assignedRole = GetSpecializationRole (spec)
assignedRole = DetailsFramework.GetSpecializationRole (spec)
end
end
if (not loadTable.role [assignedRole]) then
@@ -5927,7 +5929,7 @@ function DF:OpenLoadConditionsPanel (optionsTable, callback, frameOptions)
--create the radio group for character spec
local specs = {}
for _, specID in ipairs (DF:GetClassSpecIDs (select (2, UnitClass ("player")))) do
local specID, specName, specDescription, specIcon, specBackground, specRole, specClass = GetSpecializationInfoByID (specID)
local specID, specName, specDescription, specIcon, specBackground, specRole, specClass = DetailsFramework.GetSpecializationInfoByID (specID)
tinsert (specs, {
name = specName,
set = f.OnRadioCheckboxClick,
+2 -2
View File
@@ -834,8 +834,8 @@ DF.RuneIDs = {
function DF:GetSpellsForEncounterFromJournal (instanceEJID, encounterEJID)
EJ_SelectInstance (instanceEJID)
local name, description, encounterID, rootSectionID, link = EJ_GetEncounterInfo (encounterEJID) --taloc (primeiro boss de Uldir)
DetailsFramework.EncounterJournal.EJ_SelectInstance (instanceEJID)
local name, description, encounterID, rootSectionID, link = DetailsFramework.EncounterJournal.EJ_GetEncounterInfo (encounterEJID) --taloc (primeiro boss de Uldir)
if (not name) then
print ("DetailsFramework: Encounter Info Not Found!", instanceEJID, encounterEJID)
+1 -1
View File
@@ -16,6 +16,6 @@
<Include file="LibCompress\lib.xml"/>
<Include file="LibDeflate\lib.xml"/>
<Include file="LibItemUpgradeInfo-1.0\LibItemUpgradeInfo-1.0.xml"/>
<Include file="LibGroupInSpecT-1.1\lib.xml"/>
<!-- <Include file="LibGroupInSpecT-1.1\lib.xml"/> temp disabled due to classic-->
<Include file="DF\load.xml"/>
</Ui>