Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 39 additions & 40 deletions Dungeons.lua
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,10 @@ local function DungeonTrackerGetDungeonMaxLevel(name)
local max_level = 1000 -- Default: if we can't find it, or game version not set: it doesn't have a max level

if dt_db_max_levels ~= nil and dt_db_max_levels[name] ~= nil then
if Hardcore_Character.game_version ~= nil then
if Hardcore_Character.game_version == "Era" or Hardcore_Character.game_version == "SoM" then
max_level = dt_db_max_levels[name][1]
elseif Hardcore_Character.game_version == "WotLK" or Hardcore_Character.game_version == "Cata" then
max_level = dt_db_max_levels[name][2]
if Hardcore_Character.game_version ~= nil and _G.HC_CONSTANTS and _G.HC_CONSTANTS.DB_LEVEL_INDEX then
local index = _G.HC_CONSTANTS.DB_LEVEL_INDEX
if dt_db_max_levels[name] and dt_db_max_levels[name][index] then
max_level = dt_db_max_levels[name][index]
end
end
end
Expand All @@ -108,16 +107,9 @@ end
-- game where the max levels were different

local function DungeonTrackerGetDungeonMaxLevelAtRunTime(run)

-- If we are in cata now, but the run started before pre-patch day, we use the WotLK max level (if it was differen than Cata)
if _G["HardcoreBuildLabel"] == "Cata" and run.start ~= nil and _dt_db_wotlk_max_levels[ run.name ] ~= nil then
if run.start < 1714482000 then -- Wed 30 April 2024, 15:00 PDT
return _dt_db_wotlk_max_levels[ run.name ]
end
end

-- Default to the current version's max level if not Cata
return DungeonTrackerGetDungeonMaxLevel(run.name)
-- This logic is for a past event. For MoP and future versions,
-- simply return the current max level.
return DungeonTrackerGetDungeonMaxLevel(run.name)
end

-- DungeonTrackerGetAllDungeonMaxLevels()
Expand All @@ -128,15 +120,28 @@ end

function DungeonTrackerGetAllDungeonMaxLevels()
local the_table = {}
local game_version = Hardcore_Character.game_version
-- Use the constant for the database level index, which is correctly set to 3 for MoP
local level_index = _G.HC_CONSTANTS and _G.HC_CONSTANTS.DB_LEVEL_INDEX or 2

for i, v in pairs(dt_db) do
-- Only show entries that are dungeons
if v[4] == "D" then
local max_era_level = v[7][1]
if max_era_level == 1000 then
table.insert(the_table, { v[3], "--", v[7][2] })
else
table.insert(the_table, { v[3], max_era_level, v[7][2] })
local name = v[3]
local era_level = v[7][1]
-- This now correctly gets the level from the MoP slot (index 3)
-- It no longer falls back to index 2 if the MoP level is nil
local current_level = v[7][level_index]

-- If a level is not defined or is set to 1000 (meaning no cap), display it as "--"
if era_level == 1000 or era_level == nil then
era_level = "--"
end
if current_level == 1000 or current_level == nil then
current_level = "--"
end

table.insert(the_table, { name, era_level, current_level })
end
end

Expand Down Expand Up @@ -343,16 +348,8 @@ local function DungeonTrackerWarnInfraction()
end

-- Get max level to know if we should even warn
if Hardcore_Character.game_version ~= nil then
local max_level
if Hardcore_Character.game_version == "Era" or Hardcore_Character.game_version == "SoM" then
max_level = 60
elseif Hardcore_Character.game_version == "WotLK" then
max_level = 80
else -- Cataclysm or anything else
max_level = 85
end
if UnitLevel("player") >= max_level then
if _G.HC_CONSTANTS and _G.HC_CONSTANTS.MAX_LEVEL then
if UnitLevel("player") >= _G.HC_CONSTANTS.MAX_LEVEL then
Hardcore_Character.dt.warn_infractions = false
return
end
Expand Down Expand Up @@ -1488,23 +1485,25 @@ local function DungeonTracker()

-- Move current to pending
if next(Hardcore_Character.dt.current) then
-- If we didn't find an instance ID yet, we drop this "ghost" run immediately (there is no point in keeping it)
if Hardcore_Character.dt.current.iid == nil then
Hardcore:Debug("Dropping active run without instanceID in " .. Hardcore_Character.dt.current.name)
elseif Hardcore_Character.dt.current.name == "Scarlet Monastery" then
-- If we didn't find the SM wing, we drop this run as well.
-- Use a local variable to hold the run and clear the global state immediately.
local runToProcess = Hardcore_Character.dt.current
Hardcore_Character.dt.current = {}

-- Now process the local variable. This prevents duplication even if an error occurs.
if runToProcess.iid == nil then
Hardcore:Debug("Dropping active run without instanceID in " .. runToProcess.name)
elseif runToProcess.name == "Scarlet Monastery" then
Hardcore:Debug("Dropping active Scarlet Monastery run without identified wing")
else
Hardcore:Debug("Queuing active run in " .. Hardcore_Character.dt.current.name)
table.insert(Hardcore_Character.dt.pending, Hardcore_Character.dt.current)
Hardcore:Debug("Queuing active run in " .. runToProcess.name)
table.insert(Hardcore_Character.dt.pending, runToProcess)
end
Hardcore_Character.dt.current = {}


-- We don't need the combat log anymore
if combat_log_frame ~= nil then
combat_log_frame:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
combat_log_frame:UnregisterEvent("PLAYER_TARGET_CHANGED")
combat_log_frame.dtcl_script_registered = nil -- trigger re-registering later
combat_log_frame.dtcl_script_registered = nil
end
end
end
Expand Down
90 changes: 49 additions & 41 deletions Hardcore.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ local CLASSES = {
[7] = "Shaman",
[8] = "Mage",
[9] = "Warlock",
[10] = "Monk",
[11] = "Druid",
}

Expand All @@ -51,6 +52,7 @@ local CLASS_DICT = {
["Shaman"] = 1,
["Mage"] = 1,
["Warlock"] = 1,
["Monk"] = 1,
["Druid"] = 1,
}

Expand Down Expand Up @@ -402,7 +404,6 @@ local ALERT_STYLES = {
alertSound = 8959,
},
}
Hardcore_Alert_Frame:SetScale(0.7)

-- the big frame object for our addon
local Hardcore = CreateFrame("Frame", "Hardcore", nil, "BackdropTemplate")
Expand Down Expand Up @@ -460,21 +461,9 @@ end
-- end

function FailureFunction(achievement_name)
local max_level = 60
if
(Hardcore_Character.game_version ~= "")
and (Hardcore_Character.game_version ~= "Era")
and (Hardcore_Character.game_version ~= "SoM")
then
if Hardcore_Character.game_version == "WotLK" then
max_level = 80
else
max_level = 85
end
end
if UnitLevel("player") == max_level then
return
end
if UnitLevel("player") == _G.HC_CONSTANTS.MAX_LEVEL then
return
end

for i, v in ipairs(Hardcore_Character.achievements) do
if v == achievement_name then
Expand Down Expand Up @@ -772,18 +761,7 @@ TradeFrameTradeButton:SetScript("OnClick", function()
local legacy_duo_support = #Hardcore_Character.trade_partners > 0
local target_trader = TradeFrameRecipientNameText:GetText()
local level = UnitLevel("player")
local max_level = 60
if
(Hardcore_Character.game_version ~= "")
and (Hardcore_Character.game_version ~= "Era")
and (Hardcore_Character.game_version ~= "SoM")
then
if Hardcore_Character.game_version == "WotLK" then
max_level = 80
else
max_level = 85
end
end
local max_level = _G.HC_CONSTANTS.MAX_LEVEL
if Hardcore_Character.team ~= nil then
for _, name in ipairs(Hardcore_Character.team) do
if target_trader == name then
Expand Down Expand Up @@ -1035,9 +1013,6 @@ function Hardcore:PLAYER_LOGIN()
-- initiate pulse played time
Hardcore:InitiatePulsePlayed()

-- initiate dungeon tracking (pass Hardcore.lua locals needed for communication)
DungeonTrackerInitiate(COMM_NAME, COMM_COMMANDS[15], COMM_COMMAND_DELIM, COMM_FIELD_DELIM)

-- initiate survey module (pass Hardcore.lua locals needed for communication)
SurveyInitiate(COMM_NAME, COMM_COMMANDS[18], COMM_COMMANDS[19], COMM_COMMAND_DELIM, COMM_FIELD_DELIM)

Expand Down Expand Up @@ -1075,21 +1050,28 @@ function Hardcore:PLAYER_LOGIN()
-- Set the game_version (saved in the data file) from the addon version
-- If we don't do this, toons that went through automatic transfer during WotLK->Cata will remain
-- labeled as "WotLK", with the associated L80 / L85 problems.
--if Hardcore_Character.game_version == "" or Hardcore_Character.game_version == "Era" then
if _G["HardcoreBuildLabel"] == nil then
-- pass
elseif _G["HardcoreBuildLabel"] == "Classic" then
-- Auto-detect game version based on the client's interface number
local build, _, _, interfaceVersion = GetBuildInfo()

if interfaceVersion >= 50000 and interfaceVersion < 60000 then -- MoP Interface Range
_G["HardcoreBuildLabel"] = "MoP"
Hardcore_Character.game_version = "MoP"
elseif interfaceVersion >= 40000 and interfaceVersion < 50000 then -- Cata Interface Range
_G["HardcoreBuildLabel"] = "Cata"
Hardcore_Character.game_version = "Cata"
elseif interfaceVersion >= 30000 and interfaceVersion < 40000 then -- WotLK Interface Range
_G["HardcoreBuildLabel"] = "WotLK"
Hardcore_Character.game_version = "WotLK"
else -- Fallback for Classic / SoM
_G["HardcoreBuildLabel"] = "Classic"
C_Timer.After(5.0, function()
if inSOM() then
Hardcore_Character.game_version = "SoM"
else
Hardcore_Character.game_version = "Era"
end
end)
else
Hardcore_Character.game_version = _G["HardcoreBuildLabel"]
end
--end

if Hardcore_Settings.hardcore_player_name == nil or Hardcore_Settings.hardcore_player_name == "" then
Hardcore:Print(
Expand All @@ -1102,8 +1084,33 @@ function Hardcore:PLAYER_LOGIN()
)
end

-- Store some basic info that helps interpretation of the data file
Hardcore_StoreCharacterInfo()
-- Store some basic info that helps interpretation of the data file
Hardcore_StoreCharacterInfo()

_G.HC_CONSTANTS = {}
local game_version = Hardcore_Character.game_version

if game_version == "Era" or game_version == "SoM" then
_G.HC_CONSTANTS.MAX_LEVEL = 60
_G.HC_CONSTANTS.DB_LEVEL_INDEX = 1
elseif game_version == "WotLK" then
_G.HC_CONSTANTS.MAX_LEVEL = 80
_G.HC_CONSTANTS.DB_LEVEL_INDEX = 2
elseif game_version == "Cata" then
_G.HC_CONSTANTS.MAX_LEVEL = 85
_G.HC_CONSTANTS.DB_LEVEL_INDEX = 2 -- Cata uses the same DB index as WotLK
elseif game_version == "MoP" then
-- Add the new MoP constants
_G.HC_CONSTANTS.MAX_LEVEL = 90
_G.HC_CONSTANTS.DB_LEVEL_INDEX = 3 -- We will use a new index 3 for MoP
else
-- Default fallback for unknown versions
_G.HC_CONSTANTS.MAX_LEVEL = 60
_G.HC_CONSTANTS.DB_LEVEL_INDEX = 1
end
Hardcore_InitializeDungeonDB()
DungeonTrackerInitiate(COMM_NAME, COMM_COMMANDS[15], COMM_COMMAND_DELIM, COMM_FIELD_DELIM)
reorderPassiveAchievements()
end

function Hardcore:PLAYER_LOGOUT()
Expand Down Expand Up @@ -2761,6 +2768,8 @@ function Hardcore:GetClassColorText(classname)
return "|c00c79c6e"
elseif "Death Knight" == classname then
return "|c00C41E3A"
elseif "Monk" == classname then
return "|c0000ff96"
end

Hardcore:Debug("ERROR: classname not found")
Expand Down Expand Up @@ -4225,7 +4234,6 @@ local options = {
LibStub("AceConfig-3.0"):RegisterOptionsTable("Hardcore", options)
optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("Hardcore", "Hardcore")

reorderPassiveAchievements()
--[[ Start Addon ]]
--
Hardcore:Startup()
19 changes: 16 additions & 3 deletions Hardcore_Cata.toc → Hardcore.toc
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
## Interface: 50500
<<<<<<< HEAD:Hardcore.toc
## Title: Hardcore 0.11.58b
=======
## Title: Hardcore 0.11.57b
>>>>>>> master:Hardcore_Cata.toc
## Notes: Supports Classic Hardcore
## Author: The Classic Hardcore team, Molikar (Sean Kennedy)
## X-License: All Rights Reserved
## X-Category: Leveling,Guild
<<<<<<< HEAD:Hardcore.toc
## Version: 0.11.58b
=======
## Version: 0.11.57b
>>>>>>> master:Hardcore_Cata.toc


## DefaultState: enabled
## SavedVariables: Hardcore_Settings,Backup_Character_Data
## SavedVariablesPerCharacter: WARNING,Hardcore_Character

embeds.xml
Hardcore.xml
Hardcore.lua

CustomLayouts.lua
utils.lua
Security.lua
Hardcore.xml

#Tokens
DKToken.lua
Expand Down Expand Up @@ -156,7 +165,7 @@ InspectStatusScreen.lua
AchievementTab.lua
FirstMenuScreen.lua
ReloadReminder.lua
dungeon-db-cata.lua
dungeon-db.lua
Dungeons.lua
Survey.lua
MainMenu.lua
Expand All @@ -167,5 +176,9 @@ id_to_npc.lua
npc_to_id.lua
DeathLog.lua
SlashCommands.lua
<<<<<<< HEAD:Hardcore.toc
LevelToast.lua
=======
LevelToast.lua
Hardcore.lua
Hardcore.lua
>>>>>>> master:Hardcore_Cata.toc
Loading