-- ==============================================================
-- MODUL: Milestones - Charakter-Meilensteine für Hardcore
-- v5.3.3 - Classic-kompatible Berufe-Tracking + DE/EN
-- 100% Character-basiert, synchronisiert mit Gilde
-- ==============================================================

local addonName, addon = ...
local GDL = _G["GuildDeathLog"]
local Milestones = {}

local MILESTONE_PREFIX = "GDLMile"
local COMM_DELIM = "|"

-- ==============================================================
-- LOKALISIERUNG - ALLE STRINGS!
-- ==============================================================

local L = {}
local locale = GetLocale()

local L_DE = {
        -- System
        LEVEL_UP = "Level Up!",
        IS_NOW_LEVEL = "ist jetzt Level",
        NEW_MILESTONE = "*** NEUER MEILENSTEIN! ***",
        REACHED_GUILD = "Meilenstein erreicht: ",
        SECRET_DESC = "???",
        SECRET_CATEGORY = "Geheim",
        
        -- Level
        LEVEL_10 = "Level 10",
        LEVEL_10_DESC = "Hat Level 10 erreicht",
        LEVEL_20 = "Level 20",
        LEVEL_20_DESC = "Hat Level 20 erreicht",
        LEVEL_30 = "Level 30",
        LEVEL_30_DESC = "Hat Level 30 erreicht",
        LEVEL_40 = "Level 40",
        LEVEL_40_DESC = "Hat Level 40 erreicht (erstes Mount!)",
        LEVEL_50 = "Level 50",
        LEVEL_50_DESC = "Hat Level 50 erreicht",
        LEVEL_60 = GDL.isTBC and "Level 60" or "Level 60 - UNSTERBLICH!",
        LEVEL_60_DESC = GDL.isTBC and "Level 60 erreicht (Auf nach Outland!)" or "Hat Level 60 erreicht!",
        
        -- Spielzeit
        PLAYED_24H = "Ein Tag Hardcore",
        PLAYED_24H_DESC = "24 Stunden /played ueberlebt",
        PLAYED_72H = "Drei Tage Hardcore",
        PLAYED_72H_DESC = "72 Stunden /played ueberlebt",
        PLAYED_168H = "Eine Woche Hardcore",
        PLAYED_168H_DESC = "168 Stunden (7 Tage) /played ueberlebt",
        PLAYED_336H = "Zwei Wochen Hardcore",
        PLAYED_336H_DESC = "336 Stunden (14 Tage) /played ueberlebt",
        PLAYED_720H = "Ein Monat Hardcore",
        PLAYED_720H_DESC = "720 Stunden (30 Tage) /played ueberlebt!",
        
        -- Dungeons Low
        BOSS_RFC = "Flammenschlund",
        BOSS_RFC_DESC = "Taragaman der Hungrige besiegt",
        BOSS_WC = "Hoehlen des Wehklagens",
        BOSS_WC_DESC = "Mutanus der Verschlinger besiegt",
        BOSS_DM = "Die Todesminen",
        BOSS_DM_DESC = "Edwin VanCleef besiegt",
        BOSS_SFK = "Burg Schattenfang",
        BOSS_SFK_DESC = "Erzmagier Arugal besiegt",
        BOSS_BFD = "Tiefschwarze Grotte",
        BOSS_BFD_DESC = "Aku'mai besiegt",
        BOSS_STOCKS = "Das Verlies",
        BOSS_STOCKS_DESC = "Bazil Thredd besiegt",
        
        -- Dungeons Mid
        BOSS_GNOMER = "Gnomeregan",
        BOSS_GNOMER_DESC = "Mekgineer Thermaplugg besiegt",
        BOSS_SM_LIB = "SM: Bibliothek",
        BOSS_SM_LIB_DESC = "Arkanist Doan besiegt",
        BOSS_SM_ARM = "SM: Waffenkammer",
        BOSS_SM_ARM_DESC = "Herod besiegt",
        BOSS_SM_CATH = "SM: Kathedrale",
        BOSS_SM_CATH_DESC = "Hochinquisitor Mograine besiegt",
        BOSS_SM_GY = "SM: Friedhof",
        BOSS_SM_GY_DESC = "Blutmagier Thalnos besiegt",
        BOSS_RFK = "Kral der Klingenhauer",
        BOSS_RFK_DESC = "Charlga Razorflank besiegt",
        BOSS_RFD = "Huegel der Klingenhauer",
        BOSS_RFD_DESC = "Amnennar der Kaeltebringer besiegt",
        BOSS_ULDA = "Uldaman",
        BOSS_ULDA_DESC = "Archaedas besiegt",
        BOSS_ZF = "Zul'Farrak",
        BOSS_ZF_DESC = "Haeuptling Ukorz Sandscalp besiegt",
        BOSS_MARA = "Maraudon",
        BOSS_MARA_DESC = "Prinzessin Theradras besiegt",
        
        -- Dungeons High
        BOSS_ST = "Versunkener Tempel",
        BOSS_ST_DESC = "Eranikus' Schatten besiegt",
        BOSS_BRD_EMP = "BRT: Imperator",
        BOSS_BRD_EMP_DESC = "Imperator Dagran Thaurissan besiegt",
        BOSS_DM_NORTH = "Duesterbruch: Nord",
        BOSS_DM_NORTH_DESC = "Koenig Gordok besiegt",
        BOSS_DM_EAST = "Duesterbruch: Ost",
        BOSS_DM_EAST_DESC = "Alzzin der Wildformer besiegt",
        BOSS_DM_WEST = "Duesterbruch: West",
        BOSS_DM_WEST_DESC = "Prinz Tortheldrin besiegt",
        BOSS_LBRS = "Untere Schwarzfelsspitze",
        BOSS_LBRS_DESC = "Kriegsherr Voone besiegt",
        BOSS_UBRS = "Obere Schwarzfelsspitze",
        BOSS_UBRS_DESC = "General Drakkisath besiegt",
        BOSS_SCHOLO = "Scholomance",
        BOSS_SCHOLO_DESC = "Dunkelmeister Gandling besiegt",
        BOSS_STRAT_UD = "Stratholme: Untot",
        BOSS_STRAT_UD_DESC = "Baron Rivendare besiegt",
        BOSS_STRAT_LIVE = "Stratholme: Lebend",
        BOSS_STRAT_LIVE_DESC = "Balnazzar besiegt",
        
        -- Raids
        BOSS_ONY = "Onyxia",
        BOSS_ONY_DESC = "Onyxia besiegt!",
        BOSS_MC_RAG = "Geschmolzener Kern: Ragnaros",
        BOSS_MC_RAG_DESC = "Ragnaros besiegt!",
        BOSS_BWL_NEF = "Pechschwingenhort: Nefarian",
        BOSS_BWL_NEF_DESC = "Nefarian besiegt!",
        BOSS_ZG_HAKKAR = "Zul'Gurub: Hakkar",
        BOSS_ZG_HAKKAR_DESC = "Hakkar besiegt!",
        BOSS_AQ20 = "AQ20: Ossirian",
        BOSS_AQ20_DESC = "Ossirian besiegt!",
        BOSS_AQ40 = "AQ40: C'Thun",
        BOSS_AQ40_DESC = "C'Thun besiegt!",
        BOSS_NAXX = "Naxxramas: Kel'Thuzad",
        BOSS_NAXX_DESC = "Kel'Thuzad besiegt!",
        
        -- Meta
        META_LOW_DUNGEONS = "Anfaenger-Kerkermeister",
        META_LOW_DUNGEONS_DESC = "Alle Lowlevel-Dungeons (10-25) abgeschlossen",
        META_MID_DUNGEONS = "Kerkermeister",
        META_MID_DUNGEONS_DESC = "Alle Midlevel-Dungeons (25-45) abgeschlossen",
        META_HIGH_DUNGEONS = "Meister der Kerker",
        META_HIGH_DUNGEONS_DESC = "Alle Highlevel-Dungeons (45-60) abgeschlossen",
        META_ALL_DUNGEONS = "Herr der Dungeons",
        META_ALL_DUNGEONS_DESC = "ALLE Dungeon-Endbosse besiegt!",
        META_ALL_RAIDS = "Raidmeister",
        META_ALL_RAIDS_DESC = "Alle Raid-Endbosse besiegt!",
        META_DUNGEON_LEGEND = "Dungeon-Legende",
        META_DUNGEON_LEGEND_DESC = "Alle Dungeons UND Raids gemeistert!",
        META_ALL_SECONDARY = "Alleskoenner",
        META_ALL_SECONDARY_DESC = "Alle Nebenberufe auf 300",
        META_COMPLETE_CRAFTER = "Der Perfekte Handwerker",
        META_COMPLETE_CRAFTER_DESC = "ALLE Berufe auf 300!",
        META_IMMORTAL_VET = "Unsterblicher Veteran",
        META_IMMORTAL_VET_DESC = "Level 60 + 7 Tage /played",
        META_LEGEND = "Legende von Azeroth",
        META_LEGEND_DESC = "Level 60 + Alle Dungeons + 5.000 Kills",
        META_TRUE_IMMORTAL = "Wahrer Unsterblicher",
        META_TRUE_IMMORTAL_DESC = "Level 60 + Alle Raids + 30 Tage /played",
        META_GODSLAYER = "Goetterschlaechter",
        META_GODSLAYER_DESC = "C'Thun UND Kel'Thuzad besiegt!",
        META_PERFECT = "Der Perfektionist",
        META_PERFECT_DESC = "Level 60 + Alle Berufe 300 + Alle Dungeons",
        
        -- Berufe
        PROF_150 = "Geselle",
        PROF_150_DESC = "Einen Beruf auf 150 gebracht",
        PROF_225 = "Experte",
        PROF_225_DESC = "Einen Beruf auf 225 gebracht",
        PROF_300 = "Meister",
        PROF_300_DESC = "Einen Beruf auf 300 gebracht!",
        FISH_150 = "Angler",
        FISH_150_DESC = "Angeln auf 150",
        FISH_300 = "Meisterangler",
        FISH_300_DESC = "Angeln auf 300",
        COOK_150 = "Koch",
        COOK_150_DESC = "Kochen auf 150",
        COOK_300 = "Meisterkoch",
        COOK_300_DESC = "Kochen auf 300",
        FIRST_150 = "Sanitaeter",
        FIRST_150_DESC = "Erste Hilfe auf 150",
        FIRST_300 = "Meister-Ersthelfer",
        FIRST_300_DESC = "Erste Hilfe auf 300",
        
        -- Total Kills
        KILLS_1000 = "Tausendtoeter",
        KILLS_1000_DESC = "1.000 Kreaturen insgesamt getoetet",
        KILLS_5000 = "Schlachtmeister",
        KILLS_5000_DESC = "5.000 Kreaturen insgesamt getoetet",
        KILLS_10000 = "Todesengel",
        KILLS_10000_DESC = "10.000 Kreaturen insgesamt getoetet!",
        KILLS_25000 = "Schrecken von Azeroth",
        KILLS_25000_DESC = "25.000 Kreaturen insgesamt getoetet!!",
        KILLS_50000 = "Apokalypse",
        KILLS_50000_DESC = "50.000 Kreaturen insgesamt getoetet!!!",
        
        -- Gold
        GOLD_100 = "Wohlhabend",
        GOLD_100_DESC = "100 Gold angesammelt",
        GOLD_500 = "Reich",
        GOLD_500_DESC = "500 Gold angesammelt",
        GOLD_1000 = "Steinreich",
        GOLD_1000_DESC = "1.000 Gold angesammelt!",
        GOLD_5000 = "Goldener Drache",
        GOLD_5000_DESC = "5.000 Gold angesammelt!",
        
        -- Kreaturtypen
        HUMANOID_25 = "Wegelagerer",
        HUMANOID_25_DESC = "25 Humanoide getoetet",
        HUMANOID_100 = "Banditenjaeger",
        HUMANOID_100_DESC = "100 Humanoide getoetet",
        HUMANOID_500 = "Kopfgeldjaeger",
        HUMANOID_500_DESC = "500 Humanoide getoetet",
        HUMANOID_2000 = "Schlaechter",
        HUMANOID_2000_DESC = "2.000 Humanoide getoetet!",
        
        BEAST_25 = "Jaeger",
        BEAST_25_DESC = "25 Wildtiere getoetet",
        BEAST_100 = "Wildnisjaeger",
        BEAST_100_DESC = "100 Wildtiere getoetet",
        BEAST_500 = "Grosswildjaeger",
        BEAST_500_DESC = "500 Wildtiere getoetet",
        BEAST_2000 = "Bestienmeister",
        BEAST_2000_DESC = "2.000 Wildtiere getoetet!",
        
        UNDEAD_25 = "Grabschaender",
        UNDEAD_25_DESC = "25 Untote getoetet",
        UNDEAD_100 = "Untotenjaeger",
        UNDEAD_100_DESC = "100 Untote getoetet",
        UNDEAD_500 = "Untotenschlaechter",
        UNDEAD_500_DESC = "500 Untote getoetet",
        UNDEAD_1000 = "Lichbane",
        UNDEAD_1000_DESC = "1.000 Untote getoetet",
        UNDEAD_5000 = "Seuchenreiniger",
        UNDEAD_5000_DESC = "5.000 Untote getoetet!",
        
        DEMON_25 = "Daemonentoeter",
        DEMON_25_DESC = "25 Daemonen getoetet",
        DEMON_100 = "Daemonenbekaempfer",
        DEMON_100_DESC = "100 Daemonen getoetet",
        DEMON_500 = "Daemonenjaeger",
        DEMON_500_DESC = "500 Daemonen getoetet",
        DEMON_1000 = "Eredarbane",
        DEMON_1000_DESC = "1.000 Daemonen getoetet!",
        
        ELEMENTAL_25 = "Elementarjaeger",
        ELEMENTAL_25_DESC = "25 Elementare getoetet",
        ELEMENTAL_100 = "Funkensammler",
        ELEMENTAL_100_DESC = "100 Elementare getoetet",
        ELEMENTAL_500 = "Elementarbrecher",
        ELEMENTAL_500_DESC = "500 Elementare getoetet!",
        
        DRAGON_10 = "Welpentoeter",
        DRAGON_10_DESC = "10 Drachkin getoetet",
        DRAGON_50 = "Schuppensammler",
        DRAGON_50_DESC = "50 Drachkin getoetet",
        DRAGON_250 = "Drachenjaeger",
        DRAGON_250_DESC = "250 Drachkin getoetet",
        DRAGON_1000 = "Drachenbane",
        DRAGON_1000_DESC = "1.000 Drachkin getoetet!",
        
        GIANT_10 = "Riesentoeter",
        GIANT_10_DESC = "10 Riesen getoetet",
        GIANT_50 = "Riesen-Bezwinger",
        GIANT_50_DESC = "50 Riesen getoetet",
        GIANT_250 = "Titanentoeter",
        GIANT_250_DESC = "250 Riesen getoetet!",
        
        -- PvP Ehrenhafte Siege
        PVP_10 = "Erste Ehre",
        PVP_10_DESC = "10 Ehrenhafte Siege",
        PVP_50 = "Schlachtfeld-Kaempfer",
        PVP_50_DESC = "50 Ehrenhafte Siege",
        PVP_100 = "Gladiator",
        PVP_100_DESC = "100 Ehrenhafte Siege",
        PVP_500 = "Eroberer",
        PVP_500_DESC = "500 Ehrenhafte Siege",
        PVP_1000 = "Kriegsherr der Ehre",
        PVP_1000_DESC = "1.000 Ehrenhafte Siege!",
        
        -- Gildentode miterlebt
        WITNESS_1 = "Erster Zeuge",
        WITNESS_1_DESC = "1 Gildentod miterlebt",
        WITNESS_10 = "Chronist des Todes",
        WITNESS_10_DESC = "10 Gildentode miterlebt",
        WITNESS_25 = "Totengraeber",
        WITNESS_25_DESC = "25 Gildentode miterlebt",
        WITNESS_50 = "Sensenmann-Begleiter",
        WITNESS_50_DESC = "50 Gildentode miterlebt",
        WITNESS_100 = "Hueter der Seelen",
        WITNESS_100_DESC = "100 Gildentode miterlebt!",
        
        -- Echtzeit-Ueberlebenstage
        ALIVE_7 = "Eine Woche am Leben",
        ALIVE_7_DESC = "7 Tage Echtzeit ueberlebt",
        ALIVE_30 = "Ein Monat am Leben",
        ALIVE_30_DESC = "30 Tage Echtzeit ueberlebt",
        ALIVE_90 = "Ein Quartal am Leben",
        ALIVE_90_DESC = "90 Tage Echtzeit ueberlebt!",
        ALIVE_365 = "Ein Jahr am Leben",
        ALIVE_365_DESC = "365 Tage Echtzeit ueberlebt!!",
        
        -- Quests
        QUEST_100 = "Auftragssucher",
        QUEST_100_DESC = "100 Quests abgeschlossen",
        QUEST_250 = "Abenteuer-Sammler",
        QUEST_250_DESC = "250 Quests abgeschlossen",
        QUEST_500 = "Questmeister",
        QUEST_500_DESC = "500 Quests abgeschlossen",
        QUEST_1000 = "Wissenshueter",
        QUEST_1000_DESC = "1.000 Quests abgeschlossen!",
        
        -- Gilden-Treue
        GUILD_MEMBER_10 = "Gildengefaehrte",
        GUILD_MEMBER_10_DESC = "Gilde hat 10+ Mitglieder",
        GUILD_MEMBER_25 = "Gildenfamilie",
        GUILD_MEMBER_25_DESC = "Gilde hat 25+ Mitglieder",
        GUILD_MEMBER_50 = "Gildenmacht",
        GUILD_MEMBER_50_DESC = "Gilde hat 50+ Mitglieder!",
        
        -- Neue Meta
        META_PVP_MASTER = "PvP-Legende",
        META_PVP_MASTER_DESC = "500 HKs + Level 60",
        META_WITNESS_MASTER = "Ewiger Chronist",
        META_WITNESS_MASTER_DESC = "50 Gildentode miterlebt + Alle Dungeons",
        META_ULTIMATE = "Avatar von Azeroth",
        META_ULTIMATE_DESC = "Level 60 + Alle Raids + 50.000 Kills + 30 Tage /played",

        -- TBC: Level
        LEVEL_70 = "Level 70 - UNSTERBLICH!",
        LEVEL_70_DESC = "Hat Level 70 in TBC erreicht!",

        -- TBC: Dungeons (Outland)
        BOSS_RAMPARTS = "Fellfeuer-Bastionen",
        BOSS_RAMPARTS_DESC = "Nazan besiegt",
        BOSS_BLOOD_FURNACE = "Blutschmelze",
        BOSS_BLOOD_FURNACE_DESC = "Keli'dan der Zerbrecher besiegt",
        BOSS_SLAVE_PENS = "Sklavenpferche",
        BOSS_SLAVE_PENS_DESC = "Quagmirran besiegt",
        BOSS_UNDERBOG = "Die Unterboegen",
        BOSS_UNDERBOG_DESC = "Der Schwarze Stalker besiegt",
        BOSS_MANA_TOMBS = "Mana-Graeber",
        BOSS_MANA_TOMBS_DESC = "Nexusfuerst Shaffar besiegt",
        BOSS_AUCHENAI = "Auchenai-Krypten",
        BOSS_AUCHENAI_DESC = "Exarch Maladaar besiegt",
        BOSS_SETHEKK = "Sethekkhallen",
        BOSS_SETHEKK_DESC = "Talonkoenig Ikiss besiegt",
        BOSS_SHADOW_LAB = "Schattenlabyrinth",
        BOSS_SHADOW_LAB_DESC = "Murmur besiegt",
        BOSS_SHATTERED_HALLS = "Zerschmetterte Hallen",
        BOSS_SHATTERED_HALLS_DESC = "Kriegshaeuptling Kargath besiegt",
        BOSS_BOTANICA = "Die Botanika",
        BOSS_BOTANICA_DESC = "Rankenspreizer besiegt",
        BOSS_MECHANAR = "Der Mechanar",
        BOSS_MECHANAR_DESC = "Pathaleon der Rechner besiegt",
        BOSS_ARCATRAZ = "Die Arkentraz",
        BOSS_ARCATRAZ_DESC = "Herold Skyriss besiegt",
        BOSS_OLD_HILLSBRAD = "Altes Huegelland",
        BOSS_OLD_HILLSBRAD_DESC = "Epochenjaeger besiegt",
        BOSS_BLACK_MORASS = "Das Schwarze Moor",
        BOSS_BLACK_MORASS_DESC = "Aeonus besiegt",
        BOSS_MAGS_TERRACE = "Sonnenbrunnenterrasse",
        BOSS_MAGS_TERRACE_DESC = "Kael'thas Sonnenwanderer (5-Mann) besiegt",

        -- TBC: Raids
        BOSS_KARA = "Karazhan: Fuerst Malchezaar",
        BOSS_KARA_DESC = "Fuerst Malchezaar besiegt!",
        BOSS_GRUUL = "Gruuls Unterschlupf: Gruul",
        BOSS_GRUUL_DESC = "Gruul der Dragonkiller besiegt!",
        BOSS_MAG = "Magtheridons Kammer",
        BOSS_MAG_DESC = "Magtheridon besiegt!",
        BOSS_VASHJ = "Hoehle des Schlangenreisers: Vashj",
        BOSS_VASHJ_DESC = "Lady Vashj besiegt!",
        BOSS_KAELTHAS_RAID = "Tempeststärke: Kael'thas",
        BOSS_KAELTHAS_RAID_DESC = "Kael'thas Sonnenwanderer besiegt!",
        BOSS_ARCHIMONDE = "Schlacht um Berg Hjal",
        BOSS_ARCHIMONDE_DESC = "Archimonde besiegt!",
        BOSS_ILLIDAN = "Schwarzer Tempel: Illidan",
        BOSS_ILLIDAN_DESC = "Illidan Stormrage besiegt!",
        BOSS_KILJAEDEN = "Sonnenbrunnenplateau: Kil'jaeden",
        BOSS_KILJAEDEN_DESC = "Kil'jaeden besiegt!",

        -- TBC: Meta
        META_ALL_TBC_DUNGEONS = "Meister der Kerker von Outland",
        META_ALL_TBC_DUNGEONS_DESC = "Alle Outland-Dungeon-Endbosse besiegt",
        META_ALL_TBC_RAIDS = "Herrscher von Outland",
        META_ALL_TBC_RAIDS_DESC = "Alle TBC-Raid-Endbosse besiegt!",
        META_OUTLAND_LEGEND = "Legende von Outland",
        META_OUTLAND_LEGEND_DESC = "Level 70 + Alle Outland-Raids abgeschlossen",
        META_IMMORTAL_VET_TBC = "Unsterblicher Veteran (TBC)",
        META_IMMORTAL_VET_TBC_DESC = "Level 70 + 7 Tage /played",
        META_TRUE_IMMORTAL_TBC = "Wahrer Unsterblicher (TBC)",
        META_TRUE_IMMORTAL_TBC_DESC = "Level 70 + Alle TBC-Raids + 30 Tage /played",
        META_GODSLAYER_TBC = "Goetterschlaechter (TBC)",
        META_GODSLAYER_TBC_DESC = "Illidan UND Kil'jaeden besiegt!",
        META_PVP_MASTER_TBC = "PvP-Legende (TBC)",
        META_PVP_MASTER_TBC_DESC = "500 HKs + Level 70",
        META_ULTIMATE_TBC = "Avatar von Azeroth (TBC)",
        META_ULTIMATE_TBC_DESC = "Level 70 + Alle TBC-Raids + 50.000 Kills + 30 Tage /played",
    }

local L_EN = {
        -- System
        LEVEL_UP = "Level Up!",
        IS_NOW_LEVEL = "is now Level",
        NEW_MILESTONE = "*** NEW MILESTONE! ***",
        REACHED_GUILD = "Milestone reached: ",
        SECRET_DESC = "???",
        SECRET_CATEGORY = "Secret",
        
        -- Level
        LEVEL_10 = "Level 10",
        LEVEL_10_DESC = "Reached Level 10",
        LEVEL_20 = "Level 20",
        LEVEL_20_DESC = "Reached Level 20",
        LEVEL_30 = "Level 30",
        LEVEL_30_DESC = "Reached Level 30",
        LEVEL_40 = "Level 40",
        LEVEL_40_DESC = "Reached Level 40 (first mount!)",
        LEVEL_50 = "Level 50",
        LEVEL_50_DESC = "Reached Level 50",
        LEVEL_60 = GDL.isTBC and "Level 60" or "Level 60 - IMMORTAL!",
        LEVEL_60_DESC = GDL.isTBC and "Reached Level 60 (Onward to Outland!)" or "Reached Level 60!",
        
        -- Playtime
        PLAYED_24H = "One Day Hardcore",
        PLAYED_24H_DESC = "Survived 24 hours /played",
        PLAYED_72H = "Three Days Hardcore",
        PLAYED_72H_DESC = "Survived 72 hours /played",
        PLAYED_168H = "One Week Hardcore",
        PLAYED_168H_DESC = "Survived 168 hours (7 days) /played",
        PLAYED_336H = "Two Weeks Hardcore",
        PLAYED_336H_DESC = "Survived 336 hours (14 days) /played",
        PLAYED_720H = "One Month Hardcore",
        PLAYED_720H_DESC = "Survived 720 hours (30 days) /played!",
        
        -- Dungeons Low
        BOSS_RFC = "Ragefire Chasm",
        BOSS_RFC_DESC = "Defeated Taragaman the Hungerer",
        BOSS_WC = "Wailing Caverns",
        BOSS_WC_DESC = "Defeated Mutanus the Devourer",
        BOSS_DM = "The Deadmines",
        BOSS_DM_DESC = "Defeated Edwin VanCleef",
        BOSS_SFK = "Shadowfang Keep",
        BOSS_SFK_DESC = "Defeated Archmage Arugal",
        BOSS_BFD = "Blackfathom Deeps",
        BOSS_BFD_DESC = "Defeated Aku'mai",
        BOSS_STOCKS = "The Stockade",
        BOSS_STOCKS_DESC = "Defeated Bazil Thredd",
        
        -- Dungeons Mid
        BOSS_GNOMER = "Gnomeregan",
        BOSS_GNOMER_DESC = "Defeated Mekgineer Thermaplugg",
        BOSS_SM_LIB = "SM: Library",
        BOSS_SM_LIB_DESC = "Defeated Arcanist Doan",
        BOSS_SM_ARM = "SM: Armory",
        BOSS_SM_ARM_DESC = "Defeated Herod",
        BOSS_SM_CATH = "SM: Cathedral",
        BOSS_SM_CATH_DESC = "Defeated High Inquisitor Mograine",
        BOSS_SM_GY = "SM: Graveyard",
        BOSS_SM_GY_DESC = "Defeated Bloodmage Thalnos",
        BOSS_RFK = "Razorfen Kraul",
        BOSS_RFK_DESC = "Defeated Charlga Razorflank",
        BOSS_RFD = "Razorfen Downs",
        BOSS_RFD_DESC = "Defeated Amnennar the Coldbringer",
        BOSS_ULDA = "Uldaman",
        BOSS_ULDA_DESC = "Defeated Archaedas",
        BOSS_ZF = "Zul'Farrak",
        BOSS_ZF_DESC = "Defeated Chief Ukorz Sandscalp",
        BOSS_MARA = "Maraudon",
        BOSS_MARA_DESC = "Defeated Princess Theradras",
        
        -- Dungeons High
        BOSS_ST = "Sunken Temple",
        BOSS_ST_DESC = "Defeated Shade of Eranikus",
        BOSS_BRD_EMP = "BRD: Emperor",
        BOSS_BRD_EMP_DESC = "Defeated Emperor Dagran Thaurissan",
        BOSS_DM_NORTH = "Dire Maul: North",
        BOSS_DM_NORTH_DESC = "Defeated King Gordok",
        BOSS_DM_EAST = "Dire Maul: East",
        BOSS_DM_EAST_DESC = "Defeated Alzzin the Wildshaper",
        BOSS_DM_WEST = "Dire Maul: West",
        BOSS_DM_WEST_DESC = "Defeated Prince Tortheldrin",
        BOSS_LBRS = "Lower Blackrock Spire",
        BOSS_LBRS_DESC = "Defeated War Master Voone",
        BOSS_UBRS = "Upper Blackrock Spire",
        BOSS_UBRS_DESC = "Defeated General Drakkisath",
        BOSS_SCHOLO = "Scholomance",
        BOSS_SCHOLO_DESC = "Defeated Darkmaster Gandling",
        BOSS_STRAT_UD = "Stratholme: Undead",
        BOSS_STRAT_UD_DESC = "Defeated Baron Rivendare",
        BOSS_STRAT_LIVE = "Stratholme: Living",
        BOSS_STRAT_LIVE_DESC = "Defeated Balnazzar",
        
        -- Raids
        BOSS_ONY = "Onyxia",
        BOSS_ONY_DESC = "Defeated Onyxia!",
        BOSS_MC_RAG = "Molten Core: Ragnaros",
        BOSS_MC_RAG_DESC = "Defeated Ragnaros!",
        BOSS_BWL_NEF = "Blackwing Lair: Nefarian",
        BOSS_BWL_NEF_DESC = "Defeated Nefarian!",
        BOSS_ZG_HAKKAR = "Zul'Gurub: Hakkar",
        BOSS_ZG_HAKKAR_DESC = "Defeated Hakkar!",
        BOSS_AQ20 = "AQ20: Ossirian",
        BOSS_AQ20_DESC = "Defeated Ossirian!",
        BOSS_AQ40 = "AQ40: C'Thun",
        BOSS_AQ40_DESC = "Defeated C'Thun!",
        BOSS_NAXX = "Naxxramas: Kel'Thuzad",
        BOSS_NAXX_DESC = "Defeated Kel'Thuzad!",
        
        -- Meta
        META_LOW_DUNGEONS = "Apprentice Dungeon Master",
        META_LOW_DUNGEONS_DESC = "Completed all lowlevel dungeons (10-25)",
        META_MID_DUNGEONS = "Dungeon Master",
        META_MID_DUNGEONS_DESC = "Completed all midlevel dungeons (25-45)",
        META_HIGH_DUNGEONS = "Master of Dungeons",
        META_HIGH_DUNGEONS_DESC = "Completed all highlevel dungeons (45-60)",
        META_ALL_DUNGEONS = "Lord of Dungeons",
        META_ALL_DUNGEONS_DESC = "Defeated ALL dungeon end bosses!",
        META_ALL_RAIDS = "Raid Master",
        META_ALL_RAIDS_DESC = "Defeated all raid end bosses!",
        META_DUNGEON_LEGEND = "Dungeon Legend",
        META_DUNGEON_LEGEND_DESC = "Mastered all dungeons AND raids!",
        META_ALL_SECONDARY = "Jack of All Trades",
        META_ALL_SECONDARY_DESC = "All secondary professions at 300",
        META_COMPLETE_CRAFTER = "The Perfect Crafter",
        META_COMPLETE_CRAFTER_DESC = "ALL professions at 300!",
        META_IMMORTAL_VET = "Immortal Veteran",
        META_IMMORTAL_VET_DESC = "Level 60 + 7 days /played",
        META_LEGEND = "Legend of Azeroth",
        META_LEGEND_DESC = "Level 60 + All Dungeons + 5,000 Kills",
        META_TRUE_IMMORTAL = "True Immortal",
        META_TRUE_IMMORTAL_DESC = "Level 60 + All Raids + 30 days /played",
        META_GODSLAYER = "Godslayer",
        META_GODSLAYER_DESC = "Defeated C'Thun AND Kel'Thuzad!",
        META_PERFECT = "The Perfectionist",
        META_PERFECT_DESC = "Level 60 + All Profs 300 + All Dungeons",
        
        -- PvP Honorable Kills
        PVP_10 = "First Honor",
        PVP_10_DESC = "10 Honorable Kills",
        PVP_50 = "Battlefield Combatant",
        PVP_50_DESC = "50 Honorable Kills",
        PVP_100 = "Gladiator",
        PVP_100_DESC = "100 Honorable Kills",
        PVP_500 = "Conqueror",
        PVP_500_DESC = "500 Honorable Kills",
        PVP_1000 = "Warlord of Honor",
        PVP_1000_DESC = "1,000 Honorable Kills!",
        
        -- Guild Deaths Witnessed
        WITNESS_1 = "First Witness",
        WITNESS_1_DESC = "Witnessed 1 guild death",
        WITNESS_10 = "Chronicler of Death",
        WITNESS_10_DESC = "Witnessed 10 guild deaths",
        WITNESS_25 = "Gravedigger",
        WITNESS_25_DESC = "Witnessed 25 guild deaths",
        WITNESS_50 = "Reaper's Companion",
        WITNESS_50_DESC = "Witnessed 50 guild deaths",
        WITNESS_100 = "Keeper of Souls",
        WITNESS_100_DESC = "Witnessed 100 guild deaths!",
        
        -- Real-Time Survival Days
        ALIVE_7 = "One Week Alive",
        ALIVE_7_DESC = "Survived 7 real-time days",
        ALIVE_30 = "One Month Alive",
        ALIVE_30_DESC = "Survived 30 real-time days",
        ALIVE_90 = "One Quarter Alive",
        ALIVE_90_DESC = "Survived 90 real-time days!",
        ALIVE_365 = "One Year Alive",
        ALIVE_365_DESC = "Survived 365 real-time days!!",
        
        -- Quests
        QUEST_100 = "Quest Seeker",
        QUEST_100_DESC = "Completed 100 quests",
        QUEST_250 = "Adventure Collector",
        QUEST_250_DESC = "Completed 250 quests",
        QUEST_500 = "Questmaster",
        QUEST_500_DESC = "Completed 500 quests",
        QUEST_1000 = "Lorekeeper",
        QUEST_1000_DESC = "Completed 1,000 quests!",
        
        -- Guild Size
        GUILD_MEMBER_10 = "Guild Companion",
        GUILD_MEMBER_10_DESC = "Guild has 10+ members",
        GUILD_MEMBER_25 = "Guild Family",
        GUILD_MEMBER_25_DESC = "Guild has 25+ members",
        GUILD_MEMBER_50 = "Guild Power",
        GUILD_MEMBER_50_DESC = "Guild has 50+ members!",
        
        -- New Metas
        META_PVP_MASTER = "PvP Legend",
        META_PVP_MASTER_DESC = "500 HKs + Level 60",
        META_WITNESS_MASTER = "Eternal Chronicler",
        META_WITNESS_MASTER_DESC = "Witnessed 50 guild deaths + All Dungeons",
        META_ULTIMATE = "Avatar of Azeroth",
        META_ULTIMATE_DESC = "Level 60 + All Raids + 50,000 Kills + 30 days /played",
        
        -- Professions
        PROF_150 = "Journeyman",
        PROF_150_DESC = "Profession at 150",
        PROF_225 = "Expert",
        PROF_225_DESC = "Profession at 225",
        PROF_300 = "Artisan",
        PROF_300_DESC = "Profession at 300!",
        FISH_150 = "Angler",
        FISH_150_DESC = "Fishing at 150",
        FISH_300 = "Master Angler",
        FISH_300_DESC = "Fishing at 300",
        COOK_150 = "Cook",
        COOK_150_DESC = "Cooking at 150",
        COOK_300 = "Master Chef",
        COOK_300_DESC = "Cooking at 300",
        FIRST_150 = "Medic",
        FIRST_150_DESC = "First Aid at 150",
        FIRST_300 = "Master Medic",
        FIRST_300_DESC = "First Aid at 300",
        
        -- Total Kills
        KILLS_1000 = "Thousand Slayer",
        KILLS_1000_DESC = "Killed 1,000 creatures total",
        KILLS_5000 = "Battle Master",
        KILLS_5000_DESC = "Killed 5,000 creatures total",
        KILLS_10000 = "Angel of Death",
        KILLS_10000_DESC = "Killed 10,000 creatures total!",
        KILLS_25000 = "Terror of Azeroth",
        KILLS_25000_DESC = "Killed 25,000 creatures total!!",
        KILLS_50000 = "Apocalypse",
        KILLS_50000_DESC = "Killed 50,000 creatures total!!!",
        
        -- Gold
        GOLD_100 = "Wealthy",
        GOLD_100_DESC = "Accumulated 100 gold",
        GOLD_500 = "Rich",
        GOLD_500_DESC = "Accumulated 500 gold",
        GOLD_1000 = "Filthy Rich",
        GOLD_1000_DESC = "Accumulated 1,000 gold!",
        GOLD_5000 = "Golden Dragon",
        GOLD_5000_DESC = "Accumulated 5,000 gold!",
        
        -- Creature Types
        HUMANOID_25 = "Highwayman",
        HUMANOID_25_DESC = "Killed 25 humanoids",
        HUMANOID_100 = "Bandit Hunter",
        HUMANOID_100_DESC = "Killed 100 humanoids",
        HUMANOID_500 = "Bounty Hunter",
        HUMANOID_500_DESC = "Killed 500 humanoids",
        HUMANOID_2000 = "Slaughterer",
        HUMANOID_2000_DESC = "Killed 2,000 humanoids!",
        
        BEAST_25 = "Hunter",
        BEAST_25_DESC = "Killed 25 beasts",
        BEAST_100 = "Wilderness Hunter",
        BEAST_100_DESC = "Killed 100 beasts",
        BEAST_500 = "Big Game Hunter",
        BEAST_500_DESC = "Killed 500 beasts",
        BEAST_2000 = "Beast Master",
        BEAST_2000_DESC = "Killed 2,000 beasts!",
        
        UNDEAD_25 = "Grave Defiler",
        UNDEAD_25_DESC = "Killed 25 undead",
        UNDEAD_100 = "Undead Hunter",
        UNDEAD_100_DESC = "Killed 100 undead",
        UNDEAD_500 = "Undead Slayer",
        UNDEAD_500_DESC = "Killed 500 undead",
        UNDEAD_1000 = "Lichbane",
        UNDEAD_1000_DESC = "Killed 1,000 undead",
        UNDEAD_5000 = "Plague Cleanser",
        UNDEAD_5000_DESC = "Killed 5,000 undead!",
        
        DEMON_25 = "Demon Slayer",
        DEMON_25_DESC = "Killed 25 demons",
        DEMON_100 = "Demon Fighter",
        DEMON_100_DESC = "Killed 100 demons",
        DEMON_500 = "Demon Hunter",
        DEMON_500_DESC = "Killed 500 demons",
        DEMON_1000 = "Eredar Bane",
        DEMON_1000_DESC = "Killed 1,000 demons!",
        
        ELEMENTAL_25 = "Elemental Hunter",
        ELEMENTAL_25_DESC = "Killed 25 elementals",
        ELEMENTAL_100 = "Spark Collector",
        ELEMENTAL_100_DESC = "Killed 100 elementals",
        ELEMENTAL_500 = "Elemental Breaker",
        ELEMENTAL_500_DESC = "Killed 500 elementals!",
        
        DRAGON_10 = "Whelp Slayer",
        DRAGON_10_DESC = "Killed 10 dragonkin",
        DRAGON_50 = "Scale Collector",
        DRAGON_50_DESC = "Killed 50 dragonkin",
        DRAGON_250 = "Dragon Hunter",
        DRAGON_250_DESC = "Killed 250 dragonkin",
        DRAGON_1000 = "Dragonbane",
        DRAGON_1000_DESC = "Killed 1,000 dragonkin!",
        
        GIANT_10 = "Giant Slayer",
        GIANT_10_DESC = "Killed 10 giants",
        GIANT_50 = "Giant Conqueror",
        GIANT_50_DESC = "Killed 50 giants",
        GIANT_250 = "Titan Slayer",
        GIANT_250_DESC = "Killed 250 giants!",

        -- TBC: Level
        LEVEL_70 = "Level 70 - IMMORTAL!",
        LEVEL_70_DESC = "Reached Level 70 in The Burning Crusade!",

        -- TBC: Dungeons (Outland)
        BOSS_RAMPARTS = "Hellfire Ramparts",
        BOSS_RAMPARTS_DESC = "Defeated Nazan",
        BOSS_BLOOD_FURNACE = "Blood Furnace",
        BOSS_BLOOD_FURNACE_DESC = "Defeated Keli'dan the Breaker",
        BOSS_SLAVE_PENS = "Slave Pens",
        BOSS_SLAVE_PENS_DESC = "Defeated Quagmirran",
        BOSS_UNDERBOG = "The Underbog",
        BOSS_UNDERBOG_DESC = "Defeated The Black Stalker",
        BOSS_MANA_TOMBS = "Mana-Tombs",
        BOSS_MANA_TOMBS_DESC = "Defeated Nexus-Prince Shaffar",
        BOSS_AUCHENAI = "Auchenai Crypts",
        BOSS_AUCHENAI_DESC = "Defeated Exarch Maladaar",
        BOSS_SETHEKK = "Sethekk Halls",
        BOSS_SETHEKK_DESC = "Defeated Talon King Ikiss",
        BOSS_SHADOW_LAB = "Shadow Labyrinth",
        BOSS_SHADOW_LAB_DESC = "Defeated Murmur",
        BOSS_SHATTERED_HALLS = "Shattered Halls",
        BOSS_SHATTERED_HALLS_DESC = "Defeated Warchief Kargath Bladefist",
        BOSS_BOTANICA = "The Botanica",
        BOSS_BOTANICA_DESC = "Defeated Warp Splinter",
        BOSS_MECHANAR = "The Mechanar",
        BOSS_MECHANAR_DESC = "Defeated Pathaleon the Calculator",
        BOSS_ARCATRAZ = "The Arcatraz",
        BOSS_ARCATRAZ_DESC = "Defeated Harbinger Skyriss",
        BOSS_OLD_HILLSBRAD = "Old Hillsbrad Foothills",
        BOSS_OLD_HILLSBRAD_DESC = "Defeated Epoch Hunter",
        BOSS_BLACK_MORASS = "The Black Morass",
        BOSS_BLACK_MORASS_DESC = "Defeated Aeonus",
        BOSS_MAGS_TERRACE = "Magister's Terrace",
        BOSS_MAGS_TERRACE_DESC = "Defeated Kael'thas Sunstrider (5-man)",

        -- TBC: Raids
        BOSS_KARA = "Karazhan: Prince Malchezaar",
        BOSS_KARA_DESC = "Defeated Prince Malchezaar!",
        BOSS_GRUUL = "Gruul's Lair: Gruul",
        BOSS_GRUUL_DESC = "Defeated Gruul the Dragonkiller!",
        BOSS_MAG = "Magtheridon's Lair",
        BOSS_MAG_DESC = "Defeated Magtheridon!",
        BOSS_VASHJ = "Serpentshrine Cavern: Lady Vashj",
        BOSS_VASHJ_DESC = "Defeated Lady Vashj!",
        BOSS_KAELTHAS_RAID = "Tempest Keep: Kael'thas",
        BOSS_KAELTHAS_RAID_DESC = "Defeated Kael'thas Sunstrider!",
        BOSS_ARCHIMONDE = "Battle for Mount Hyjal",
        BOSS_ARCHIMONDE_DESC = "Defeated Archimonde!",
        BOSS_ILLIDAN = "Black Temple: Illidan",
        BOSS_ILLIDAN_DESC = "Defeated Illidan Stormrage!",
        BOSS_KILJAEDEN = "Sunwell Plateau: Kil'jaeden",
        BOSS_KILJAEDEN_DESC = "Defeated Kil'jaeden!",

        -- TBC: Meta
        META_ALL_TBC_DUNGEONS = "Master of Outland Dungeons",
        META_ALL_TBC_DUNGEONS_DESC = "Defeated all Outland dungeon end-bosses",
        META_ALL_TBC_RAIDS = "Lord of Outland",
        META_ALL_TBC_RAIDS_DESC = "Defeated all TBC raid end-bosses!",
        META_OUTLAND_LEGEND = "Legend of Outland",
        META_OUTLAND_LEGEND_DESC = "Level 70 + all Outland Raids cleared",
        META_IMMORTAL_VET_TBC = "Immortal Veteran (TBC)",
        META_IMMORTAL_VET_TBC_DESC = "Level 70 + 7 days /played",
        META_TRUE_IMMORTAL_TBC = "True Immortal (TBC)",
        META_TRUE_IMMORTAL_TBC_DESC = "Level 70 + all TBC raids + 30 days /played",
        META_GODSLAYER_TBC = "Godslayer (TBC)",
        META_GODSLAYER_TBC_DESC = "Defeated both Illidan AND Kil'jaeden!",
        META_PVP_MASTER_TBC = "PvP Legend (TBC)",
        META_PVP_MASTER_TBC_DESC = "500 HKs + Level 70",
        META_ULTIMATE_TBC = "Avatar of Azeroth (TBC)",
        META_ULTIMATE_TBC_DESC = "Level 70 + all TBC raids + 50,000 kills + 30 days /played",
    }

-- Aktive Tabelle nach Client-Locale (Fallback; echte Wahl folgt nach Login via ApplyLocale)
local L = (locale == "deDE") and L_DE or L_EN

-- DE<->EN Wert-Maps aus den vorhandenen Uebersetzungen (kein Dict-Duplikat noetig)
local _VAL_DE2EN, _VAL_EN2DE = {}, {}
for k, v in pairs(L_DE) do if type(v) == "string" then _VAL_DE2EN[v] = L_EN[k] end end
for k, v in pairs(L_EN) do if type(v) == "string" then _VAL_EN2DE[v] = L_DE[k] end end

-- Expansion-Erkennung (einmalig beim Laden, GDL.isClassicEra/isTBC aus Compat.lua)
local _isClassicEra = GDL.isClassicEra or false
local _isTBC        = GDL.isTBC or false
local _expTag       = _isTBC and "tbc" or "classic"

-- ==============================================================
-- MEILENSTEIN-DEFINITIONEN (Vollstaendige Liste, expansion-tagged)
-- "classic"  -> nur fuer Classic 1.15.x
-- "tbc"      -> nur fuer TBC 2.5.x
-- nil        -> universell (beide)
-- ==============================================================

local MILESTONE_DEFS_ALL = {
    -- Level
    {id = "level_10", name = L.LEVEL_10, desc = L.LEVEL_10_DESC, icon = "Interface\\Icons\\Spell_Holy_WordFortitude", type = "level", threshold = 10, category = "level"},
    {id = "level_20", name = L.LEVEL_20, desc = L.LEVEL_20_DESC, icon = "Interface\\Icons\\Spell_Holy_GreaterHeal", type = "level", threshold = 20, category = "level"},
    {id = "level_30", name = L.LEVEL_30, desc = L.LEVEL_30_DESC, icon = "Interface\\Icons\\INV_Shield_06", type = "level", threshold = 30, category = "level"},
    {id = "level_40", name = L.LEVEL_40, desc = L.LEVEL_40_DESC, icon = "Interface\\Icons\\Ability_Mount_RidingHorse", type = "level", threshold = 40, category = "level"},
    {id = "level_50", name = L.LEVEL_50, desc = L.LEVEL_50_DESC, icon = "Interface\\Icons\\INV_Shield_07", type = "level", threshold = 50, category = "level"},
    {id = "level_60", name = L.LEVEL_60, desc = L.LEVEL_60_DESC, icon = "Interface\\Icons\\INV_Crown_01", type = "level", threshold = 60, category = "level"},
    
    -- Spielzeit
    {id = "played_24h", name = L.PLAYED_24H, desc = L.PLAYED_24H_DESC, icon = "Interface\\Icons\\Spell_Nature_TimeStop", type = "playtime", threshold = 86400, category = "survival"},
    {id = "played_72h", name = L.PLAYED_72H, desc = L.PLAYED_72H_DESC, icon = "Interface\\Icons\\INV_Misc_PocketWatch_01", type = "playtime", threshold = 259200, category = "survival"},
    {id = "played_168h", name = L.PLAYED_168H, desc = L.PLAYED_168H_DESC, icon = "Interface\\Icons\\INV_Misc_PocketWatch_02", type = "playtime", threshold = 604800, category = "survival"},
    {id = "played_336h", name = L.PLAYED_336H, desc = L.PLAYED_336H_DESC, icon = "Interface\\Icons\\Spell_Holy_PowerInfusion", type = "playtime", threshold = 1209600, category = "survival"},
    {id = "played_720h", name = L.PLAYED_720H, desc = L.PLAYED_720H_DESC, icon = "Interface\\Icons\\INV_Misc_PocketWatch_01", type = "playtime", threshold = 2592000, category = "survival"},
    
    -- Dungeons Low (10-25)
    {id = "boss_rfc", name = L.BOSS_RFC, desc = L.BOSS_RFC_DESC, icon = "Interface\\Icons\\Spell_Shadow_SummonFelGuard", type = "boss", bossId = 11520, category = "dungeon", tier = "low"},
    {id = "boss_wc", name = L.BOSS_WC, desc = L.BOSS_WC_DESC, icon = "Interface\\Icons\\INV_Misc_MonsterHead_01", type = "boss", bossId = 3654, category = "dungeon", tier = "low"},
    {id = "boss_dm", name = L.BOSS_DM, desc = L.BOSS_DM_DESC, icon = "Interface\\Icons\\INV_Helmet_25", type = "boss", bossId = 639, category = "dungeon", tier = "low"},
    {id = "boss_sfk", name = L.BOSS_SFK, desc = L.BOSS_SFK_DESC, icon = "Interface\\Icons\\Spell_Shadow_Charm", type = "boss", bossId = 4275, category = "dungeon", tier = "low"},
    {id = "boss_bfd", name = L.BOSS_BFD, desc = L.BOSS_BFD_DESC, icon = "Interface\\Icons\\Spell_Shadow_DeathScream", type = "boss", bossId = 4829, category = "dungeon", tier = "low"},
    {id = "boss_stocks", name = L.BOSS_STOCKS, desc = L.BOSS_STOCKS_DESC, icon = "Interface\\Icons\\INV_Misc_Key_13", type = "boss", bossId = 1716, category = "dungeon", tier = "low"},
    
    -- Dungeons Mid (25-45)
    {id = "boss_gnomer", name = L.BOSS_GNOMER, desc = L.BOSS_GNOMER_DESC, icon = "Interface\\Icons\\INV_Gizmo_02", type = "boss", bossId = 7800, category = "dungeon", tier = "mid"},
    {id = "boss_sm_lib", name = L.BOSS_SM_LIB, desc = L.BOSS_SM_LIB_DESC, icon = "Interface\\Icons\\INV_Misc_Book_07", type = "boss", bossId = 6487, category = "dungeon", tier = "mid"},
    {id = "boss_sm_arm", name = L.BOSS_SM_ARM, desc = L.BOSS_SM_ARM_DESC, icon = "Interface\\Icons\\INV_Axe_12", type = "boss", bossId = 3975, category = "dungeon", tier = "mid"},
    {id = "boss_sm_cath", name = L.BOSS_SM_CATH, desc = L.BOSS_SM_CATH_DESC, icon = "Interface\\Icons\\INV_Sword_27", type = "boss", bossId = 3976, category = "dungeon", tier = "mid"},
    {id = "boss_sm_gy", name = L.BOSS_SM_GY, desc = L.BOSS_SM_GY_DESC, icon = "Interface\\Icons\\Spell_Shadow_RaiseDead", type = "boss", bossId = 4543, category = "dungeon", tier = "mid"},
    {id = "boss_rfk", name = L.BOSS_RFK, desc = L.BOSS_RFK_DESC, icon = "Interface\\Icons\\INV_Misc_Head_Gnoll_01", type = "boss", bossId = 4421, category = "dungeon", tier = "mid"},
    {id = "boss_rfd", name = L.BOSS_RFD, desc = L.BOSS_RFD_DESC, icon = "Interface\\Icons\\Spell_Shadow_DeathCoil", type = "boss", bossId = 7358, category = "dungeon", tier = "mid"},
    {id = "boss_ulda", name = L.BOSS_ULDA, desc = L.BOSS_ULDA_DESC, icon = "Interface\\Icons\\INV_Misc_Gem_Stone_01", type = "boss", bossId = 2748, category = "dungeon", tier = "mid"},
    {id = "boss_zf", name = L.BOSS_ZF, desc = L.BOSS_ZF_DESC, icon = "Interface\\Icons\\INV_Helmet_53", type = "boss", bossId = 7267, category = "dungeon", tier = "mid"},
    {id = "boss_mara", name = L.BOSS_MARA, desc = L.BOSS_MARA_DESC, icon = "Interface\\Icons\\Spell_Nature_EarthElemental_Totem", type = "boss", bossId = 12201, category = "dungeon", tier = "mid"},
    
    -- Dungeons High (45-60)
    {id = "boss_st", name = L.BOSS_ST, desc = L.BOSS_ST_DESC, icon = "Interface\\Icons\\Spell_Shadow_GatherShadows", type = "boss", bossId = 5709, category = "dungeon", tier = "high"},
    {id = "boss_brd_emp", name = L.BOSS_BRD_EMP, desc = L.BOSS_BRD_EMP_DESC, icon = "Interface\\Icons\\INV_Hammer_25", type = "boss", bossId = 9019, category = "dungeon", tier = "high"},
    {id = "boss_dm_north", name = L.BOSS_DM_NORTH, desc = L.BOSS_DM_NORTH_DESC, icon = "Interface\\Icons\\INV_Misc_MonsterHead_02", type = "boss", bossId = 11501, category = "dungeon", tier = "high"},
    {id = "boss_dm_east", name = L.BOSS_DM_EAST, desc = L.BOSS_DM_EAST_DESC, icon = "Interface\\Icons\\Spell_Nature_Regeneration", type = "boss", bossId = 11492, category = "dungeon", tier = "high"},
    {id = "boss_dm_west", name = L.BOSS_DM_WEST, desc = L.BOSS_DM_WEST_DESC, icon = "Interface\\Icons\\INV_Sword_26", type = "boss", bossId = 11486, category = "dungeon", tier = "high"},
    {id = "boss_lbrs", name = L.BOSS_LBRS, desc = L.BOSS_LBRS_DESC, icon = "Interface\\Icons\\INV_Misc_MonsterHead_03", type = "boss", bossId = 9237, category = "dungeon", tier = "high"},
    {id = "boss_ubrs", name = L.BOSS_UBRS, desc = L.BOSS_UBRS_DESC, icon = "Interface\\Icons\\Spell_Fire_Lavaspawn", type = "boss", bossId = 10363, category = "dungeon", tier = "high"},
    {id = "boss_scholo", name = L.BOSS_SCHOLO, desc = L.BOSS_SCHOLO_DESC, icon = "Interface\\Icons\\Spell_Shadow_Haunting", type = "boss", bossId = 1853, category = "dungeon", tier = "high"},
    {id = "boss_strat_ud", name = L.BOSS_STRAT_UD, desc = L.BOSS_STRAT_UD_DESC, icon = "Interface\\Icons\\INV_Sword_25", type = "boss", bossId = 10440, category = "dungeon", tier = "high"},
    {id = "boss_strat_live", name = L.BOSS_STRAT_LIVE, desc = L.BOSS_STRAT_LIVE_DESC, icon = "Interface\\Icons\\Spell_Shadow_PainSpike", type = "boss", bossId = 10813, category = "dungeon", tier = "high"},
    
    -- Raids
    {id = "boss_ony", name = L.BOSS_ONY, desc = L.BOSS_ONY_DESC, icon = "Interface\\Icons\\INV_Misc_Head_Dragon_Black", type = "boss", bossId = 10184, category = "raid"},
    {id = "boss_mc_rag", name = L.BOSS_MC_RAG, desc = L.BOSS_MC_RAG_DESC, icon = "Interface\\Icons\\Spell_Fire_Lavaspawn", type = "boss", bossId = 11502, category = "raid"},
    {id = "boss_bwl_nef", name = L.BOSS_BWL_NEF, desc = L.BOSS_BWL_NEF_DESC, icon = "Interface\\Icons\\INV_Misc_Head_Dragon_01", type = "boss", bossId = 11583, category = "raid"},
    {id = "boss_zg_hakkar", name = L.BOSS_ZG_HAKKAR, desc = L.BOSS_ZG_HAKKAR_DESC, icon = "Interface\\Icons\\Spell_Shadow_Haunting", type = "boss", bossId = 14834, category = "raid"},
    {id = "boss_aq20_ossirian", name = L.BOSS_AQ20, desc = L.BOSS_AQ20_DESC, icon = "Interface\\Icons\\INV_Jewelry_Ring_40", type = "boss", bossId = 15339, category = "raid"},
    {id = "boss_aq40_cthun", name = L.BOSS_AQ40, desc = L.BOSS_AQ40_DESC, icon = "Interface\\Icons\\Spell_Nature_WispHeal", type = "boss", bossId = 15727, category = "raid"},
    {id = "boss_naxx_kt", name = L.BOSS_NAXX, desc = L.BOSS_NAXX_DESC, icon = "Interface\\Icons\\INV_Trinket_Naxxramas06", type = "boss", bossId = 15990, category = "raid"},
    
    -- Meta-Achievements
    {id = "meta_low_dungeons", name = L.META_LOW_DUNGEONS, desc = L.META_LOW_DUNGEONS_DESC, icon = "Interface\\Icons\\INV_Misc_Key_03", type = "meta", requirements = {"boss_rfc", "boss_wc", "boss_dm", "boss_sfk", "boss_bfd", "boss_stocks"}, category = "meta"},
    {id = "meta_mid_dungeons", name = L.META_MID_DUNGEONS, desc = L.META_MID_DUNGEONS_DESC, icon = "Interface\\Icons\\INV_Misc_Key_07", type = "meta", requirements = {"boss_gnomer", "boss_sm_lib", "boss_sm_arm", "boss_sm_cath", "boss_sm_gy", "boss_rfk", "boss_rfd", "boss_ulda", "boss_zf", "boss_mara"}, category = "meta"},
    {id = "meta_high_dungeons", name = L.META_HIGH_DUNGEONS, desc = L.META_HIGH_DUNGEONS_DESC, icon = "Interface\\Icons\\INV_Misc_Key_14", type = "meta", requirements = {"boss_st", "boss_brd_emp", "boss_dm_north", "boss_dm_east", "boss_dm_west", "boss_lbrs", "boss_ubrs", "boss_scholo", "boss_strat_ud", "boss_strat_live"}, category = "meta"},
    {id = "meta_all_dungeons", name = L.META_ALL_DUNGEONS, desc = L.META_ALL_DUNGEONS_DESC, icon = "Interface\\Icons\\INV_Jewelry_Talisman_08", type = "meta", requirements = {"meta_low_dungeons", "meta_mid_dungeons", "meta_high_dungeons"}, category = "meta"},
    {id = "meta_all_raids", name = L.META_ALL_RAIDS, desc = L.META_ALL_RAIDS_DESC, icon = "Interface\\Icons\\INV_Helmet_06", type = "meta", requirements = {"boss_ony", "boss_mc_rag", "boss_bwl_nef", "boss_zg_hakkar", "boss_aq20_ossirian", "boss_aq40_cthun", "boss_naxx_kt"}, category = "meta"},
    {id = "meta_dungeon_legend", name = L.META_DUNGEON_LEGEND, desc = L.META_DUNGEON_LEGEND_DESC, icon = "Interface\\Icons\\Spell_Holy_ChampionsBond", type = "meta", requirements = {"meta_all_dungeons", "meta_all_raids"}, category = "meta"},
    
    -- Berufe
    {id = "prof_150", name = L.PROF_150, desc = L.PROF_150_DESC, icon = "Interface\\Icons\\Trade_BlackSmithing", type = "profession", threshold = 150, category = "profession"},
    {id = "prof_225", name = L.PROF_225, desc = L.PROF_225_DESC, icon = "Interface\\Icons\\Trade_LeatherWorking", type = "profession", threshold = 225, category = "profession"},
    {id = "prof_300", name = L.PROF_300, desc = L.PROF_300_DESC, icon = "Interface\\Icons\\Trade_Engineering", type = "profession", threshold = 300, category = "profession"},
    {id = "fish_150", name = L.FISH_150, desc = L.FISH_150_DESC, icon = "Interface\\Icons\\Trade_Fishing", type = "fishing", threshold = 150, category = "profession"},
    {id = "fish_300", name = L.FISH_300, desc = L.FISH_300_DESC, icon = "Interface\\Icons\\INV_Fishingpole_02", type = "fishing", threshold = 300, category = "profession"},
    {id = "cook_150", name = L.COOK_150, desc = L.COOK_150_DESC, icon = "Interface\\Icons\\INV_Misc_Food_15", type = "cooking", threshold = 150, category = "profession"},
    {id = "cook_300", name = L.COOK_300, desc = L.COOK_300_DESC, icon = "Interface\\Icons\\INV_Misc_Food_67", type = "cooking", threshold = 300, category = "profession"},
    {id = "firstaid_150", name = L.FIRST_150, desc = L.FIRST_150_DESC, icon = "Interface\\Icons\\Spell_Holy_SealOfSacrifice", type = "firstaid", threshold = 150, category = "profession"},
    {id = "firstaid_300", name = L.FIRST_300, desc = L.FIRST_300_DESC, icon = "Interface\\Icons\\INV_Misc_Bandage_12", type = "firstaid", threshold = 300, category = "profession"},
    {id = "meta_all_secondary", name = L.META_ALL_SECONDARY, desc = L.META_ALL_SECONDARY_DESC, icon = "Interface\\Icons\\Spell_Nature_EnchantArmor", type = "meta", requirements = {"fish_300", "cook_300", "firstaid_300"}, category = "meta"},
    {id = "meta_complete_crafter", name = L.META_COMPLETE_CRAFTER, desc = L.META_COMPLETE_CRAFTER_DESC, icon = "Interface\\Icons\\Trade_BlackSmithing", type = "meta", requirements = {"prof_300", "meta_all_secondary"}, category = "meta"},
    
    -- Total Kills
    {id = "kills_total_1000", name = L.KILLS_1000, desc = L.KILLS_1000_DESC, icon = "Interface\\Icons\\Ability_DualWield", type = "total_kills", threshold = 1000, category = "kills"},
    {id = "kills_total_5000", name = L.KILLS_5000, desc = L.KILLS_5000_DESC, icon = "Interface\\Icons\\Ability_Warrior_Rampage", type = "total_kills", threshold = 5000, category = "kills"},
    {id = "kills_total_10000", name = L.KILLS_10000, desc = L.KILLS_10000_DESC, icon = "Interface\\Icons\\Ability_Warrior_BattleShout", type = "total_kills", threshold = 10000, category = "kills"},
    {id = "kills_total_25000", name = L.KILLS_25000, desc = L.KILLS_25000_DESC, icon = "Interface\\Icons\\Ability_Warrior_WarCry", type = "total_kills", threshold = 25000, category = "kills"},
    {id = "kills_total_50000", name = L.KILLS_50000, desc = L.KILLS_50000_DESC, icon = "Interface\\Icons\\Spell_Shadow_DeathScream", type = "total_kills", threshold = 50000, category = "kills"},
    
    -- Gold (GetMoney() = Copper! 1 Gold = 10000 Copper)
    {id = "gold_100", name = L.GOLD_100, desc = L.GOLD_100_DESC, icon = "Interface\\Icons\\INV_Misc_Coin_02", type = "gold", threshold = 1000000, category = "wealth"},
    {id = "gold_500", name = L.GOLD_500, desc = L.GOLD_500_DESC, icon = "Interface\\Icons\\INV_Misc_Coin_05", type = "gold", threshold = 5000000, category = "wealth"},
    {id = "gold_1000", name = L.GOLD_1000, desc = L.GOLD_1000_DESC, icon = "Interface\\Icons\\INV_Misc_Coin_06", type = "gold", threshold = 10000000, category = "wealth"},
    {id = "gold_5000", name = L.GOLD_5000, desc = L.GOLD_5000_DESC, icon = "Interface\\Icons\\INV_Misc_Coin_17", type = "gold", threshold = 50000000, category = "wealth"},
    
    -- Kreaturtypen
    {id = "kill_humanoid_25", name = L.HUMANOID_25, desc = L.HUMANOID_25_DESC, icon = "Interface\\Icons\\Ability_Rogue_Ambush", type = "kills", creatureType = "humanoid", threshold = 25, category = "kills"},
    {id = "kill_humanoid_100", name = L.HUMANOID_100, desc = L.HUMANOID_100_DESC, icon = "Interface\\Icons\\Ability_Rogue_Disguise", type = "kills", creatureType = "humanoid", threshold = 100, category = "kills"},
    {id = "kill_humanoid_500", name = L.HUMANOID_500, desc = L.HUMANOID_500_DESC, icon = "Interface\\Icons\\INV_Misc_Coin_02", type = "kills", creatureType = "humanoid", threshold = 500, category = "kills"},
    {id = "kill_humanoid_2000", name = L.HUMANOID_2000, desc = L.HUMANOID_2000_DESC, icon = "Interface\\Icons\\Ability_Warrior_BattleShout", type = "kills", creatureType = "humanoid", threshold = 2000, category = "kills"},
    
    {id = "kill_beast_25", name = L.BEAST_25, desc = L.BEAST_25_DESC, icon = "Interface\\Icons\\Ability_Hunter_SniperShot", type = "kills", creatureType = "beast", threshold = 25, category = "kills"},
    {id = "kill_beast_100", name = L.BEAST_100, desc = L.BEAST_100_DESC, icon = "Interface\\Icons\\Ability_Hunter_BeastCall", type = "kills", creatureType = "beast", threshold = 100, category = "kills"},
    {id = "kill_beast_500", name = L.BEAST_500, desc = L.BEAST_500_DESC, icon = "Interface\\Icons\\Ability_Hunter_BeastTaming", type = "kills", creatureType = "beast", threshold = 500, category = "kills"},
    {id = "kill_beast_2000", name = L.BEAST_2000, desc = L.BEAST_2000_DESC, icon = "Interface\\Icons\\Ability_Hunter_BeastMastery", type = "kills", creatureType = "beast", threshold = 2000, category = "kills"},
    
    {id = "kill_undead_25", name = L.UNDEAD_25, desc = L.UNDEAD_25_DESC, icon = "Interface\\Icons\\Spell_Shadow_DeathCoil", type = "kills", creatureType = "undead", threshold = 25, category = "kills"},
    {id = "kill_undead_100", name = L.UNDEAD_100, desc = L.UNDEAD_100_DESC, icon = "Interface\\Icons\\Spell_Shadow_AnimateDead", type = "kills", creatureType = "undead", threshold = 100, category = "kills"},
    {id = "kill_undead_500", name = L.UNDEAD_500, desc = L.UNDEAD_500_DESC, icon = "Interface\\Icons\\Spell_Shadow_RaiseDead", type = "kills", creatureType = "undead", threshold = 500, category = "kills"},
    {id = "kill_undead_1000", name = L.UNDEAD_1000, desc = L.UNDEAD_1000_DESC, icon = "Interface\\Icons\\Spell_Holy_SenseUndead", type = "kills", creatureType = "undead", threshold = 1000, category = "kills"},
    {id = "kill_undead_5000", name = L.UNDEAD_5000, desc = L.UNDEAD_5000_DESC, icon = "Interface\\Icons\\Spell_Holy_PrayerOfHealing", type = "kills", creatureType = "undead", threshold = 5000, category = "kills"},
    
    {id = "kill_demon_25", name = L.DEMON_25, desc = L.DEMON_25_DESC, icon = "Interface\\Icons\\Spell_Shadow_SummonImp", type = "kills", creatureType = "demon", threshold = 25, category = "kills"},
    {id = "kill_demon_100", name = L.DEMON_100, desc = L.DEMON_100_DESC, icon = "Interface\\Icons\\Spell_Shadow_SummonFelGuard", type = "kills", creatureType = "demon", threshold = 100, category = "kills"},
    {id = "kill_demon_500", name = L.DEMON_500, desc = L.DEMON_500_DESC, icon = "Interface\\Icons\\Spell_Shadow_Metamorphosis", type = "kills", creatureType = "demon", threshold = 500, category = "kills"},
    {id = "kill_demon_1000", name = L.DEMON_1000, desc = L.DEMON_1000_DESC, icon = "Interface\\Icons\\Spell_Shadow_SummonFelGuard", type = "kills", creatureType = "demon", threshold = 1000, category = "kills"},
    
    {id = "kill_elemental_25", name = L.ELEMENTAL_25, desc = L.ELEMENTAL_25_DESC, icon = "Interface\\Icons\\Spell_Fire_Fire", type = "kills", creatureType = "elemental", threshold = 25, category = "kills"},
    {id = "kill_elemental_100", name = L.ELEMENTAL_100, desc = L.ELEMENTAL_100_DESC, icon = "Interface\\Icons\\Spell_Fire_FireBolt", type = "kills", creatureType = "elemental", threshold = 100, category = "kills"},
    {id = "kill_elemental_500", name = L.ELEMENTAL_500, desc = L.ELEMENTAL_500_DESC, icon = "Interface\\Icons\\Spell_Fire_Elemental_Totem", type = "kills", creatureType = "elemental", threshold = 500, category = "kills"},
    
    {id = "kill_dragonkin_10", name = L.DRAGON_10, desc = L.DRAGON_10_DESC, icon = "Interface\\Icons\\INV_Misc_MonsterScales_02", type = "kills", creatureType = "dragonkin", threshold = 10, category = "kills"},
    {id = "kill_dragonkin_50", name = L.DRAGON_50, desc = L.DRAGON_50_DESC, icon = "Interface\\Icons\\INV_Misc_MonsterScales_05", type = "kills", creatureType = "dragonkin", threshold = 50, category = "kills"},
    {id = "kill_dragonkin_250", name = L.DRAGON_250, desc = L.DRAGON_250_DESC, icon = "Interface\\Icons\\INV_Misc_Head_Dragon_01", type = "kills", creatureType = "dragonkin", threshold = 250, category = "kills"},
    {id = "kill_dragonkin_1000", name = L.DRAGON_1000, desc = L.DRAGON_1000_DESC, icon = "Interface\\Icons\\INV_Misc_Head_Dragon_Black", type = "kills", creatureType = "dragonkin", threshold = 1000, category = "kills"},
    
    {id = "kill_giant_10", name = L.GIANT_10, desc = L.GIANT_10_DESC, icon = "Interface\\Icons\\INV_Misc_Bone_HumanSkull_01", type = "kills", creatureType = "giant", threshold = 10, category = "kills"},
    {id = "kill_giant_50", name = L.GIANT_50, desc = L.GIANT_50_DESC, icon = "Interface\\Icons\\INV_Misc_Foot_Centaur", type = "kills", creatureType = "giant", threshold = 50, category = "kills"},
    {id = "kill_giant_250", name = L.GIANT_250, desc = L.GIANT_250_DESC, icon = "Interface\\Icons\\INV_Stone_15", type = "kills", creatureType = "giant", threshold = 250, category = "kills"},
    
    -- Legendäre Meta-Achievements (GEHEIM!)
    {id = "meta_immortal_veteran", name = L.META_IMMORTAL_VET, desc = L.META_IMMORTAL_VET_DESC, icon = "Interface\\Icons\\Spell_Holy_AshesToAshes", type = "meta", requirements = {"level_60", "played_168h"}, category = "secret", secret = true, expansion = "classic"},
    {id = "meta_legend_azeroth", name = L.META_LEGEND, desc = L.META_LEGEND_DESC, icon = "Interface\\Icons\\INV_Misc_Map02", type = "meta", requirements = {"level_60", "meta_all_dungeons", "kills_total_5000"}, category = "secret", secret = true, expansion = "classic"},
    {id = "meta_true_immortal", name = L.META_TRUE_IMMORTAL, desc = L.META_TRUE_IMMORTAL_DESC, icon = "Interface\\Icons\\Spell_Holy_Resurrection", type = "meta", requirements = {"level_60", "meta_all_raids", "played_720h"}, category = "secret", secret = true, expansion = "classic"},
    {id = "meta_godslayer", name = L.META_GODSLAYER, desc = L.META_GODSLAYER_DESC, icon = "Interface\\Icons\\INV_Misc_Eye_01", type = "meta", requirements = {"boss_aq40_cthun", "boss_naxx_kt"}, category = "secret", secret = true, expansion = "classic"},
    {id = "meta_perfectionist", name = L.META_PERFECT, desc = L.META_PERFECT_DESC, icon = "Interface\\Icons\\INV_Misc_Gift_01", type = "meta", requirements = {"level_60", "meta_complete_crafter", "meta_all_dungeons"}, category = "secret", secret = true, expansion = "classic"},
    
    -- â•â•â• PVP MEILENSTEINE â•â•â•
    {id = "pvp_10", name = L.PVP_10, desc = L.PVP_10_DESC, icon = "Interface\\Icons\\Achievement_PVP_A_01", type = "pvp", threshold = 10, category = "pvp"},
    {id = "pvp_50", name = L.PVP_50, desc = L.PVP_50_DESC, icon = "Interface\\Icons\\Achievement_PVP_A_05", type = "pvp", threshold = 50, category = "pvp"},
    {id = "pvp_100", name = L.PVP_100, desc = L.PVP_100_DESC, icon = "Interface\\Icons\\Achievement_PVP_A_10", type = "pvp", threshold = 100, category = "pvp"},
    {id = "pvp_500", name = L.PVP_500, desc = L.PVP_500_DESC, icon = "Interface\\Icons\\Achievement_PVP_A_14", type = "pvp", threshold = 500, category = "pvp"},
    {id = "pvp_1000", name = L.PVP_1000, desc = L.PVP_1000_DESC, icon = "Interface\\Icons\\Ability_Warrior_BattleShout", type = "pvp", threshold = 1000, category = "pvp"},
    
    -- â•â•â• GILDENTODE MITERLEBT â•â•â•
    {id = "witness_1", name = L.WITNESS_1, desc = L.WITNESS_1_DESC, icon = "Interface\\Icons\\Spell_Shadow_DarkSummoning", type = "witness", threshold = 1, category = "social"},
    {id = "witness_10", name = L.WITNESS_10, desc = L.WITNESS_10_DESC, icon = "Interface\\Icons\\INV_Misc_Book_09", type = "witness", threshold = 10, category = "social"},
    {id = "witness_25", name = L.WITNESS_25, desc = L.WITNESS_25_DESC, icon = "Interface\\Icons\\Spell_Shadow_AnimateDead", type = "witness", threshold = 25, category = "social"},
    {id = "witness_50", name = L.WITNESS_50, desc = L.WITNESS_50_DESC, icon = "Interface\\Icons\\Spell_Shadow_RaiseDead", type = "witness", threshold = 50, category = "social"},
    {id = "witness_100", name = L.WITNESS_100, desc = L.WITNESS_100_DESC, icon = "Interface\\Icons\\Spell_Shadow_Possession", type = "witness", threshold = 100, category = "social"},
    
    -- â•â•â• ECHTZEIT UEBERLEBENSTAGE â•â•â•
    {id = "alive_7", name = L.ALIVE_7, desc = L.ALIVE_7_DESC, icon = "Interface\\Icons\\Spell_Holy_GuardianSpirit", type = "alive_days", threshold = 7, category = "survival"},
    {id = "alive_30", name = L.ALIVE_30, desc = L.ALIVE_30_DESC, icon = "Interface\\Icons\\Spell_Holy_InnerFire", type = "alive_days", threshold = 30, category = "survival"},
    {id = "alive_90", name = L.ALIVE_90, desc = L.ALIVE_90_DESC, icon = "Interface\\Icons\\Spell_Nature_Reincarnation", type = "alive_days", threshold = 90, category = "survival"},
    {id = "alive_365", name = L.ALIVE_365, desc = L.ALIVE_365_DESC, icon = "Interface\\Icons\\Spell_Holy_Resurrection", type = "alive_days", threshold = 365, category = "survival"},
    
    -- â•â•â• QUESTS â•â•â•
    {id = "quest_100", name = L.QUEST_100, desc = L.QUEST_100_DESC, icon = "Interface\\Icons\\INV_Misc_Note_01", type = "quests", threshold = 100, category = "quests"},
    {id = "quest_250", name = L.QUEST_250, desc = L.QUEST_250_DESC, icon = "Interface\\Icons\\INV_Misc_Note_02", type = "quests", threshold = 250, category = "quests"},
    {id = "quest_500", name = L.QUEST_500, desc = L.QUEST_500_DESC, icon = "Interface\\Icons\\INV_Misc_Note_05", type = "quests", threshold = 500, category = "quests"},
    {id = "quest_1000", name = L.QUEST_1000, desc = L.QUEST_1000_DESC, icon = "Interface\\Icons\\INV_Misc_Book_12", type = "quests", threshold = 1000, category = "quests"},
    
    -- â•â•â• GILDEN-GROESSE â•â•â•
    {id = "guild_10", name = L.GUILD_MEMBER_10, desc = L.GUILD_MEMBER_10_DESC, icon = "Interface\\Icons\\Ability_Warrior_RallyingCry", type = "guild_size", threshold = 10, category = "social"},
    {id = "guild_25", name = L.GUILD_MEMBER_25, desc = L.GUILD_MEMBER_25_DESC, icon = "Interface\\Icons\\Ability_Warrior_ShieldWall", type = "guild_size", threshold = 25, category = "social"},
    {id = "guild_50", name = L.GUILD_MEMBER_50, desc = L.GUILD_MEMBER_50_DESC, icon = "Interface\\Icons\\Spell_Holy_ChampionsBond", type = "guild_size", threshold = 50, category = "social"},
    
    -- â•â•â• NEUE META â•â•â•
    {id = "meta_pvp_master", name = L.META_PVP_MASTER, desc = L.META_PVP_MASTER_DESC, icon = "Interface\\Icons\\Achievement_PVP_A_15", type = "meta", requirements = {"pvp_500", "level_60"}, category = "secret", secret = true, expansion = "classic"},
    {id = "meta_witness_master", name = L.META_WITNESS_MASTER, desc = L.META_WITNESS_MASTER_DESC, icon = "Interface\\Icons\\INV_Misc_Book_11", type = "meta", requirements = {"witness_50", "meta_all_dungeons"}, category = "secret", secret = true},
    {id = "meta_ultimate", name = L.META_ULTIMATE, desc = L.META_ULTIMATE_DESC, icon = "Interface\\Icons\\INV_Misc_Gem_Pearl_03", type = "meta", requirements = {"level_60", "meta_all_raids", "kills_total_50000", "played_720h"}, category = "secret", secret = true, expansion = "classic"},
}

-- ==============================================================
-- TBC-MEILENSTEIN-DEFINITIONEN (nur fuer 2.5.x Clients)
-- ==============================================================

local TBC_MILESTONE_DEFS = {
    -- Level 70 (TBC-Cap)
    {id = "level_70", name = L.LEVEL_70, desc = L.LEVEL_70_DESC, icon = "Interface\\Icons\\Spell_Holy_BoreanLight", type = "level", threshold = 70, category = "level", expansion = "tbc"},

    -- TBC Dungeons (Outland)
    {id = "boss_ramparts",       name = L.BOSS_RAMPARTS,       desc = L.BOSS_RAMPARTS_DESC,       icon = "Interface\\Icons\\INV_Sword_39",               type = "boss", bossId = 17537, category = "dungeon", expansion = "tbc"},
    {id = "boss_blood_furnace",  name = L.BOSS_BLOOD_FURNACE,  desc = L.BOSS_BLOOD_FURNACE_DESC,  icon = "Interface\\Icons\\Spell_Fire_SelfDestruct",    type = "boss", bossId = 17377, category = "dungeon", expansion = "tbc"},
    {id = "boss_slave_pens",     name = L.BOSS_SLAVE_PENS,     desc = L.BOSS_SLAVE_PENS_DESC,     icon = "Interface\\Icons\\Spell_Nature_WaterBreathing",type = "boss", bossId = 17942, category = "dungeon", expansion = "tbc"},
    {id = "boss_underbog",       name = L.BOSS_UNDERBOG,       desc = L.BOSS_UNDERBOG_DESC,       icon = "Interface\\Icons\\Spell_Nature_FaerieFire",    type = "boss", bossId = 17882, category = "dungeon", expansion = "tbc"},
    {id = "boss_mana_tombs",     name = L.BOSS_MANA_TOMBS,     desc = L.BOSS_MANA_TOMBS_DESC,     icon = "Interface\\Icons\\Spell_Arcane_ArcaneSurge",   type = "boss", bossId = 18373, category = "dungeon", expansion = "tbc"},
    {id = "boss_auchenai",       name = L.BOSS_AUCHENAI,       desc = L.BOSS_AUCHENAI_DESC,       icon = "Interface\\Icons\\INV_Misc_Bone_HumanSkull_01",type = "boss", bossId = 18839, category = "dungeon", expansion = "tbc"},
    {id = "boss_sethekk",        name = L.BOSS_SETHEKK,        desc = L.BOSS_SETHEKK_DESC,        icon = "Interface\\Icons\\Ability_Hunter_BeastTaming", type = "boss", bossId = 18473, category = "dungeon", expansion = "tbc"},
    {id = "boss_shadow_lab",     name = L.BOSS_SHADOW_LAB,     desc = L.BOSS_SHADOW_LAB_DESC,     icon = "Interface\\Icons\\Spell_Shadow_ShadowWordPain", type = "boss", bossId = 18708, category = "dungeon", expansion = "tbc"},
    {id = "boss_shattered_halls",name = L.BOSS_SHATTERED_HALLS,desc = L.BOSS_SHATTERED_HALLS_DESC,icon = "Interface\\Icons\\Ability_Warrior_Bladestorm",  type = "boss", bossId = 16808, category = "dungeon", expansion = "tbc"},
    {id = "boss_botanica",       name = L.BOSS_BOTANICA,       desc = L.BOSS_BOTANICA_DESC,       icon = "Interface\\Icons\\Spell_Nature_Rejuvenation",  type = "boss", bossId = 17977, category = "dungeon", expansion = "tbc"},
    {id = "boss_mechanar",       name = L.BOSS_MECHANAR,       desc = L.BOSS_MECHANAR_DESC,       icon = "Interface\\Icons\\INV_Gizmo_RocketHelmet",     type = "boss", bossId = 19220, category = "dungeon", expansion = "tbc"},
    {id = "boss_arcatraz",       name = L.BOSS_ARCATRAZ,       desc = L.BOSS_ARCATRAZ_DESC,       icon = "Interface\\Icons\\Spell_Shadow_DemonicCircle",  type = "boss", bossId = 20912, category = "dungeon", expansion = "tbc"},
    {id = "boss_old_hillsbrad",  name = L.BOSS_OLD_HILLSBRAD,  desc = L.BOSS_OLD_HILLSBRAD_DESC,  icon = "Interface\\Icons\\Ability_Rogue_SurpriseAttack",type = "boss", bossId = 18096, category = "dungeon", expansion = "tbc"},
    {id = "boss_black_morass",   name = L.BOSS_BLACK_MORASS,   desc = L.BOSS_BLACK_MORASS_DESC,   icon = "Interface\\Icons\\Spell_Shadow_AntiMagicShell", type = "boss", bossId = 17881, category = "dungeon", expansion = "tbc"},
    {id = "boss_mags_terrace",   name = L.BOSS_MAGS_TERRACE,   desc = L.BOSS_MAGS_TERRACE_DESC,   icon = "Interface\\Icons\\Spell_Arcane_MassDispel",    type = "boss", bossId = 24664, category = "dungeon", expansion = "tbc"},

    -- TBC Raids
    {id = "boss_kara_malchezaar",name = L.BOSS_KARA,           desc = L.BOSS_KARA_DESC,           icon = "Interface\\Icons\\Spell_Shadow_Summon",         type = "boss", bossId = 15690, category = "raid", expansion = "tbc"},
    {id = "boss_gruul",          name = L.BOSS_GRUUL,          desc = L.BOSS_GRUUL_DESC,          icon = "Interface\\Icons\\Ability_Warrior_ShieldWall",  type = "boss", bossId = 19044, category = "raid", expansion = "tbc"},
    {id = "boss_magtheridon",    name = L.BOSS_MAG,            desc = L.BOSS_MAG_DESC,            icon = "Interface\\Icons\\Spell_Shadow_ChaosForm",      type = "boss", bossId = 17257, category = "raid", expansion = "tbc"},
    {id = "boss_lady_vashj",     name = L.BOSS_VASHJ,          desc = L.BOSS_VASHJ_DESC,          icon = "Interface\\Icons\\Spell_Nature_WaterElemental01",type = "boss", bossId = 21212, category = "raid", expansion = "tbc"},
    {id = "boss_kaelthas_raid",  name = L.BOSS_KAELTHAS_RAID,  desc = L.BOSS_KAELTHAS_RAID_DESC,  icon = "Interface\\Icons\\Spell_Arcane_Arcane01",       type = "boss", bossId = 19622, category = "raid", expansion = "tbc"},
    {id = "boss_archimonde",     name = L.BOSS_ARCHIMONDE,     desc = L.BOSS_ARCHIMONDE_DESC,     icon = "Interface\\Icons\\Spell_Fire_GreaterFireElemental",type = "boss", bossId = 17968, category = "raid", expansion = "tbc"},
    {id = "boss_illidan",        name = L.BOSS_ILLIDAN,        desc = L.BOSS_ILLIDAN_DESC,        icon = "Interface\\Icons\\Spell_Shadow_Metamorphosis",  type = "boss", bossId = 22917, category = "raid", expansion = "tbc"},
    {id = "boss_kiljaeden",      name = L.BOSS_KILJAEDEN,      desc = L.BOSS_KILJAEDEN_DESC,      icon = "Interface\\Icons\\Spell_Shadow_Demonicempathy", type = "boss", bossId = 25315, category = "raid", expansion = "tbc"},

    -- TBC Meta (GEHEIM)
    {id = "meta_all_tbc_dungeons",  name = L.META_ALL_TBC_DUNGEONS, desc = L.META_ALL_TBC_DUNGEONS_DESC, icon = "Interface\\Icons\\INV_Misc_Map_01", type = "meta", requirements = {"boss_ramparts","boss_blood_furnace","boss_slave_pens","boss_underbog","boss_mana_tombs","boss_auchenai","boss_sethekk","boss_shadow_lab","boss_shattered_halls","boss_botanica","boss_mechanar","boss_arcatraz","boss_old_hillsbrad","boss_black_morass"}, category = "meta", expansion = "tbc"},
    {id = "meta_all_tbc_raids",     name = L.META_ALL_TBC_RAIDS,    desc = L.META_ALL_TBC_RAIDS_DESC,    icon = "Interface\\Icons\\Spell_Holy_ChampionsBond", type = "meta", requirements = {"boss_kara_malchezaar","boss_gruul","boss_magtheridon","boss_lady_vashj","boss_kaelthas_raid","boss_archimonde","boss_illidan","boss_kiljaeden"}, category = "meta", expansion = "tbc"},
    {id = "meta_outland_legend",    name = L.META_OUTLAND_LEGEND,   desc = L.META_OUTLAND_LEGEND_DESC,   icon = "Interface\\Icons\\INV_Misc_Map02", type = "meta", requirements = {"level_70", "meta_all_tbc_raids"}, category = "secret", secret = true, expansion = "tbc"},
    {id = "meta_immortal_vet_tbc",  name = L.META_IMMORTAL_VET_TBC, desc = L.META_IMMORTAL_VET_TBC_DESC, icon = "Interface\\Icons\\Spell_Holy_AshesToAshes", type = "meta", requirements = {"level_70", "played_168h"}, category = "secret", secret = true, expansion = "tbc"},
    {id = "meta_true_immortal_tbc", name = L.META_TRUE_IMMORTAL_TBC,desc = L.META_TRUE_IMMORTAL_TBC_DESC,icon = "Interface\\Icons\\Spell_Holy_Resurrection", type = "meta", requirements = {"level_70", "meta_all_tbc_raids", "played_720h"}, category = "secret", secret = true, expansion = "tbc"},
    {id = "meta_godslayer_tbc",     name = L.META_GODSLAYER_TBC,    desc = L.META_GODSLAYER_TBC_DESC,    icon = "Interface\\Icons\\INV_Misc_Eye_01", type = "meta", requirements = {"boss_illidan", "boss_kiljaeden"}, category = "secret", secret = true, expansion = "tbc"},
    {id = "meta_pvp_master_tbc",    name = L.META_PVP_MASTER_TBC,   desc = L.META_PVP_MASTER_TBC_DESC,   icon = "Interface\\Icons\\Achievement_PVP_A_15", type = "meta", requirements = {"pvp_500", "level_70"}, category = "secret", secret = true, expansion = "tbc"},
    {id = "meta_ultimate_tbc",      name = L.META_ULTIMATE_TBC,     desc = L.META_ULTIMATE_TBC_DESC,     icon = "Interface\\Icons\\INV_Misc_Gem_Pearl_03", type = "meta", requirements = {"level_70", "meta_all_tbc_raids", "kills_total_50000", "played_720h"}, category = "secret", secret = true, expansion = "tbc"},
}

-- ==============================================================
-- AKTIVE MEILENSTEINE (expansion-gefiltert, ersetzt MILESTONE_DEFS)
-- Alle vorhandenen Stellen nutzen weiterhin MILESTONE_DEFS (unveraendert).
-- ==============================================================

local MILESTONE_DEFS = {}
for _, m in ipairs(MILESTONE_DEFS_ALL) do
    if not m.expansion or m.expansion == _expTag then
        MILESTONE_DEFS[#MILESTONE_DEFS + 1] = m
    end
end
if _isTBC then
    for _, m in ipairs(TBC_MILESTONE_DEFS) do
        MILESTONE_DEFS[#MILESTONE_DEFS + 1] = m
    end
end
local BOSS_TO_MILESTONE = {}
local MILESTONE_BY_ID = {}
for _, m in ipairs(MILESTONE_DEFS) do
    MILESTONE_BY_ID[m.id] = m
    if m.type == "boss" and m.bossId then
        BOSS_TO_MILESTONE[m.bossId] = m.id
    end
end

-- ==============================================================
-- LOCALE NACHZIEHEN: forcedLocale (/gdl lang) ist beim File-Load noch nicht
-- verfuegbar. Diese Methode wird nach dem Login und bei /gdl lang gerufen und
-- uebersetzt Namen/Beschreibungen idempotent in die Wunschsprache. Nutzt die
-- vorhandenen Autor-Uebersetzungen (L_DE/L_EN) statt das Locale-Dict zu duplizieren.
-- ==============================================================
function Milestones:ApplyLocale()
    local useEN = (GDL.WantEnglish and GDL:WantEnglish()) and true or false
    local map = useEN and _VAL_DE2EN or _VAL_EN2DE
    L = useEN and L_EN or L_DE
    local function tr(s) return (type(s) == "string" and map[s]) or s end
    for _, m in ipairs(MILESTONE_DEFS_ALL) do m.name = tr(m.name); m.desc = tr(m.desc) end
    for _, m in ipairs(TBC_MILESTONE_DEFS) do m.name = tr(m.name); m.desc = tr(m.desc) end
end

-- ==============================================================
-- INITIALISIERUNG
-- ==============================================================

function Milestones:Initialize()
    if self.initialized then return end
    self.initialized = true
    
    C_ChatInfo.RegisterAddonMessagePrefix(MILESTONE_PREFIX)
    
    GuildDeathLogDB.milestones = GuildDeathLogDB.milestones or {}
    GuildDeathLogDB.guildMilestones = GuildDeathLogDB.guildMilestones or {}
    
    local charKey = self:GetCharacterKey()
    
    -- â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
    -- DATENMIGRATION: Alte Name-Keys -> neue GUID-Keys
    -- Vor v6.x wurden Milestones unter "CharName-RealmName" gespeichert,
    -- jetzt unter GUID "Player-XXXX-XXXXXXXX". Migration einmalig.
    -- â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
    local playerName = UnitName("player")
    local realmName = GetRealmName()
    if playerName and realmName then
        local oldKey = playerName .. "-" .. realmName
        if oldKey ~= charKey then
            -- Milestones migrieren
            if GuildDeathLogDB.milestones[oldKey] and not GuildDeathLogDB.milestones[charKey] then
                GuildDeathLogDB.milestones[charKey] = GuildDeathLogDB.milestones[oldKey]
                GDL:Debug("Milestones: Migrated data from '" .. oldKey .. "' -> '" .. charKey .. "'")
                GDL:Print("|cff00FF00[Meilensteine]|r Daten erfolgreich migriert!")
            end
            -- KillStats migrieren
            if GuildDeathLogDB.killStats and GuildDeathLogDB.killStats[oldKey] and not GuildDeathLogDB.killStats[charKey] then
                GuildDeathLogDB.killStats[charKey] = GuildDeathLogDB.killStats[oldKey]
                GDL:Debug("KillStats: Migrated from '" .. oldKey .. "' -> '" .. charKey .. "'")
            end
            -- Titles migrieren
            if GuildDeathLogDB.titles and GuildDeathLogDB.titles[oldKey] and not GuildDeathLogDB.titles[charKey] then
                GuildDeathLogDB.titles[charKey] = GuildDeathLogDB.titles[oldKey]
                GDL:Debug("Titles: Migrated from '" .. oldKey .. "' -> '" .. charKey .. "'")
            end
        end
    end
    
    local existingData = GuildDeathLogDB.milestones[charKey]
    
    -- â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
    -- HC-RESET DETECTION: Gleicher Name, neuer Charakter?
    -- SICHERHEIT: UnitLevel kann beim Login kurzzeitig 0 sein!
    -- Deshalb verzögert prüfen wenn Level <= 0
    -- â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
    if existingData and existingData.unlocked and next(existingData.unlocked) then
        local currentLevel = UnitLevel("player") or 0
        
        if currentLevel <= 0 then
            GDL:Debug("Milestones: UnitLevel=0, HC-Reset Check auf 8s verschoben")
            C_Timer.After(8, function()
                local delayedLevel = UnitLevel("player") or 0
                if delayedLevel > 0 then
                    self:CheckHCReset(charKey, GuildDeathLogDB.milestones[charKey], delayedLevel)
                end
            end)
        else
            self:CheckHCReset(charKey, existingData, currentLevel)
        end
    end
    
    GuildDeathLogDB.milestones[charKey] = GuildDeathLogDB.milestones[charKey] or {
        unlocked = {},
        stats = { totalKills = 0 }
    }
    
    self:RegisterEvents()
    
    C_Timer.NewTicker(60, function() 
        self:TrackPlayerStats() 
        self:CheckMetaMilestones()
    end)
    
    C_Timer.After(2, function() 
        self:CheckCurrentLevel() 
        self:TrackPlayerStats()
        self:CheckMetaMilestones()
    end)
    
    GDL:Debug("Milestones: Initialized")
end

-- HC-Reset: Ausgelagert damit es sicher mit gueltigem UnitLevel aufgerufen wird
function Milestones:CheckHCReset(charKey, existingData, currentLevel)
    if not existingData or not existingData.unlocked then return end
    
    local highestSavedLevel = 0
    local levelMilestones = {
        level_10 = 10, level_20 = 20, level_30 = 30,
        level_40 = 40, level_50 = 50, level_60 = 60
    }
    for milestoneId, lvl in pairs(levelMilestones) do
        if existingData.unlocked[milestoneId] and lvl > highestSavedLevel then
            highestSavedLevel = lvl
        end
    end
    
    -- Sicherheitsmarge: 10 Level Unterschied (nicht 5!) um Login-Glitches zu vermeiden
    if highestSavedLevel > 0 and currentLevel > 0 and currentLevel < (highestSavedLevel - 10) then
        GDL:Debug("Milestones: HC-RESET erkannt! Gespeichert: Lvl " .. highestSavedLevel .. ", Aktuell: Lvl " .. currentLevel)
        
        -- Alte Daten archivieren
        local archiveKey = charKey .. "_dead_" .. time()
        GuildDeathLogDB.milestones[archiveKey] = existingData
        
        -- Frische Daten
        GuildDeathLogDB.milestones[charKey] = {
            unlocked = {},
            stats = { totalKills = 0 }
        }
        
        -- KillStats zuruecksetzen
        if GuildDeathLogDB.killStats and GuildDeathLogDB.killStats[charKey] then
            GuildDeathLogDB.killStats[charKey .. "_dead_" .. time()] = GuildDeathLogDB.killStats[charKey]
            GuildDeathLogDB.killStats[charKey] = {}
        end
        
        -- Titel zuruecksetzen
        if GuildDeathLogDB.titles and GuildDeathLogDB.titles[charKey] then
            GuildDeathLogDB.titles[charKey] = nil
        end

        -- Errungenschaften zuruecksetzen
        if GuildDeathLogDB.achievements and GuildDeathLogDB.achievements[charKey] then
            GuildDeathLogDB.achievements[charKey .. "_dead_" .. time()] = GuildDeathLogDB.achievements[charKey]
            GuildDeathLogDB.achievements[charKey] = {}
            local Achievements = GDL:GetModule("Achievements")
            if Achievements then
                Achievements.unlocked = GuildDeathLogDB.achievements[charKey]
            end
        end

        GDL:Print("|cffFFD100[" .. GDL:T("Meilensteine") .. "]|r " .. GDL:T("Neuer Charakter erkannt - Fortschritt zurueckgesetzt!"))
    elseif highestSavedLevel > 0 then
        GDL:Debug("Milestones: HC-Reset Check OK (Saved: " .. highestSavedLevel .. ", Current: " .. currentLevel .. ")")
    end
end

function Milestones:GetCharacterKey(name, realm)
    -- Für andere Chars (Sync etc.) weiterhin Name-Realm
    if name then
        name = strsplit("-", name)
        realm = realm or GetRealmName()
        return name .. "-" .. realm
    end
    -- Für den eigenen Char: GUID verwenden (eindeutig, überlebt Neustart)
    -- GUID Format: "Player-serverID-charID" z.B. "Player-4372-00B735D9"
    local guid = UnitGUID("player")
    if guid then
        -- GUID als Key speichern damit wir Name-Anzeige mappen können
        GuildDeathLogDB.guidToName = GuildDeathLogDB.guidToName or {}
        local charName = UnitName("player") or "?"
        local charRealm = GetRealmName() or "?"
        GuildDeathLogDB.guidToName[guid] = charName .. "-" .. charRealm
        return guid
    end
    -- Fallback: Name-Realm
    local n = UnitName("player") or "Unknown"
    local r = GetRealmName() or "Unknown"
    return n .. "-" .. r
end

function Milestones:GetCharacterData(charKey)
    charKey = charKey or self:GetCharacterKey()
    GuildDeathLogDB.milestones[charKey] = GuildDeathLogDB.milestones[charKey] or {
        unlocked = {},
        stats = {}
    }
    return GuildDeathLogDB.milestones[charKey]
end

-- ==============================================================
-- EVENTS
-- ==============================================================

function Milestones:RegisterEvents()
    if self.eventFrame then return end
    
    self.eventFrame = CreateFrame("Frame")
    self.eventFrame:SetScript("OnEvent", function(frame, event, ...)
        if self[event] then self[event](self, ...) end
    end)
    
    self.eventFrame:RegisterEvent("PLAYER_LEVEL_UP")
    self.eventFrame:RegisterEvent("PLAYER_LOGIN")
    self.eventFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
    self.eventFrame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
    self.eventFrame:RegisterEvent("CHAT_MSG_ADDON")
    self.eventFrame:RegisterEvent("PLAYER_MONEY")
    self.eventFrame:RegisterEvent("TIME_PLAYED_MSG")
    self.eventFrame:RegisterEvent("SKILL_LINES_CHANGED")  -- Für Berufe-Tracking!
    self.eventFrame:RegisterEvent("TRADE_SKILL_UPDATE")   -- Wenn Berufsfenster geöffnet
end

function Milestones:SKILL_LINES_CHANGED()
    -- Berufe haben sich geändert - prüfe Meilensteine
    C_Timer.After(0.5, function()
        self:TrackPlayerStats()
    end)
end

function Milestones:TRADE_SKILL_UPDATE()
    -- Berufsfenster wurde aktualisiert
    C_Timer.After(0.5, function()
        self:TrackPlayerStats()
    end)
end

function Milestones:PLAYER_LEVEL_UP(newLevel)
    local charKey = self:GetCharacterKey()
    local charName = UnitName("player")
    
    -- NUR anzeigen wenn Setting aktiv ist
    if GuildDeathLogDB.settings.milestoneAnnounce ~= false then
        GDL:Print("|cff00FF00" .. L.LEVEL_UP .. "|r " .. charName .. " " .. L.IS_NOW_LEVEL .. " " .. tostring(newLevel))
    end
    
    for _, m in ipairs(MILESTONE_DEFS) do
        if m.type == "level" and m.threshold == newLevel then
            self:UnlockMilestone(m.id, charKey, charName, newLevel)
        end
    end
    
    C_Timer.After(1, function() self:CheckMetaMilestones() end)
end

function Milestones:PLAYER_LOGIN()
    self:ApplyLocale()  -- forcedLocale ist jetzt verfuegbar -> Sprache final waehlen
    C_Timer.After(2, function()
        self:CheckCurrentLevel()
        self:TrackPlayerStats()
        RequestTimePlayed()
    end)
end

function Milestones:PLAYER_ENTERING_WORLD(isInitialLogin, isReloadingUi)
    if isInitialLogin or isReloadingUi then
        C_Timer.After(3, function()
            self:CheckCurrentLevel()
            self:RequestMilestoneSync()
            RequestTimePlayed()
        end)
    end
end

function Milestones:PLAYER_MONEY()
    self:CheckGoldMilestones()
end

function Milestones:TIME_PLAYED_MSG(totalTime)
    local charKey = self:GetCharacterKey()
    local charData = self:GetCharacterData(charKey)
    charData.stats.totalPlaytime = totalTime
    self:CheckPlaytimeMilestones(totalTime)
end

function Milestones:COMBAT_LOG_EVENT_UNFILTERED()
    local _, subEvent, _, sourceGUID, _, _, _, destGUID, destName = CombatLogGetCurrentEventInfo()
    
    if subEvent ~= "UNIT_DIED" then return end
    
    local npcId = self:GetNPCIdFromGUID(destGUID)
    if not npcId then return end
    
    local milestoneId = BOSS_TO_MILESTONE[npcId]
    if milestoneId then
        local charKey = self:GetCharacterKey()
        local charName = UnitName("player")
        local charLevel = UnitLevel("player")
        self:UnlockMilestone(milestoneId, charKey, charName, charLevel)
        C_Timer.After(1, function() self:CheckMetaMilestones() end)
    end
    
    if sourceGUID == UnitGUID("player") then
        self:TrackKill(destGUID)
    end
end

function Milestones:CHAT_MSG_ADDON(prefix, message, channel, sender)
    if prefix == MILESTONE_PREFIX and channel == "GUILD" then
        self:HandleMilestoneSync(message, sender)
    end
end

-- ==============================================================
-- CHECKS
-- ==============================================================

function Milestones:CheckCurrentLevel()
    local currentLevel = UnitLevel("player")
    local charKey = self:GetCharacterKey()
    local charName = UnitName("player")
    
    for _, m in ipairs(MILESTONE_DEFS) do
        if m.type == "level" and currentLevel >= m.threshold then
            local charData = self:GetCharacterData(charKey)
            if not charData.unlocked[m.id] then
                self:UnlockMilestone(m.id, charKey, charName, currentLevel, true)
            end
        end
    end
end

function Milestones:CheckPlaytimeMilestones(totalTime)
    local charKey = self:GetCharacterKey()
    local charName = UnitName("player")
    local charLevel = UnitLevel("player")
    
    for _, m in ipairs(MILESTONE_DEFS) do
        if m.type == "playtime" and totalTime >= m.threshold then
            local charData = self:GetCharacterData(charKey)
            if not charData.unlocked[m.id] then
                self:UnlockMilestone(m.id, charKey, charName, charLevel)
            end
        end
    end
end

function Milestones:CheckGoldMilestones()
    local gold = GetMoney()
    local charKey = self:GetCharacterKey()
    local charName = UnitName("player")
    local charLevel = UnitLevel("player")
    local charData = self:GetCharacterData(charKey)
    
    for _, m in ipairs(MILESTONE_DEFS) do
        if m.type == "gold" and gold >= m.threshold then
            if not charData.unlocked[m.id] then
                self:UnlockMilestone(m.id, charKey, charName, charLevel)
            end
        end
    end
end

function Milestones:CheckTotalKillMilestones()
    local charKey = self:GetCharacterKey()
    local charData = self:GetCharacterData(charKey)
    local charName = UnitName("player")
    local charLevel = UnitLevel("player")
    
    -- Verwende KillStats für Total Kills (character-spezifisch!)
    local KillStats = GDL:GetModule("KillStats")
    local totalKills = 0
    if KillStats and KillStats.GetTotalKills then
        totalKills = KillStats:GetTotalKills(charKey)
    end
    
    for _, m in ipairs(MILESTONE_DEFS) do
        if m.type == "total_kills" and totalKills >= m.threshold then
            if not charData.unlocked[m.id] then
                self:UnlockMilestone(m.id, charKey, charName, charLevel)
            end
        end
    end
end

-- Auch Kreaturtyp-Kills über KillStats prüfen
function Milestones:CheckCreatureKillMilestones()
    local charKey = self:GetCharacterKey()
    local charData = self:GetCharacterData(charKey)
    local charName = UnitName("player")
    local charLevel = UnitLevel("player")
    
    local KillStats = GDL:GetModule("KillStats")
    if not KillStats then return end
    
    for _, m in ipairs(MILESTONE_DEFS) do
        if m.type == "kills" and m.creatureType and m.threshold then
            local killCount = KillStats:GetKillCount(m.creatureType, charKey)
            if killCount >= m.threshold then
                if not charData.unlocked[m.id] then
                    self:UnlockMilestone(m.id, charKey, charName, charLevel)
                end
            end
        end
    end
end

function Milestones:CheckMetaMilestones()
    local charKey = self:GetCharacterKey()
    local charData = self:GetCharacterData(charKey)
    local charName = UnitName("player")
    local charLevel = UnitLevel("player")
    
    for _, m in ipairs(MILESTONE_DEFS) do
        if m.type == "meta" and m.requirements then
            if not charData.unlocked[m.id] then
                local allMet = true
                for _, reqId in ipairs(m.requirements) do
                    if not charData.unlocked[reqId] then
                        allMet = false
                        break
                    end
                end
                if allMet then
                    self:UnlockMilestone(m.id, charKey, charName, charLevel)
                end
            end
        end
    end
end

-- TrackKill wird nicht mehr benötigt - KillStats trackt alle Kills
-- Diese Funktion bleibt für Kompatibilität, ruft aber nur die Checks auf
function Milestones:TrackKill(destGUID)
    -- KillStats trackt die Kills bereits
    -- Wir prüfen nur alle 50 Kills ob neue Meilensteine freigeschaltet werden
    local KillStats = GDL:GetModule("KillStats")
    if KillStats then
        local totalKills = KillStats:GetTotalKills()
        if totalKills % 50 == 0 then
            self:CheckTotalKillMilestones()
            self:CheckCreatureKillMilestones()
        end
    end
end

function Milestones:TrackPlayerStats()
    local charKey = self:GetCharacterKey()
    local charData = self:GetCharacterData(charKey)
    local charName = UnitName("player")
    local charLevel = UnitLevel("player")
    
    -- Berufe über Classic API (GetSkillLineInfo)
    local profSkills = self:GetProfessionSkills()
    
    -- Hauptberufe prüfen
    local maxMainSkill = profSkills.maxMain or 0
    for _, m in ipairs(MILESTONE_DEFS) do
        if m.type == "profession" and maxMainSkill >= m.threshold then
            if not charData.unlocked[m.id] then
                self:UnlockMilestone(m.id, charKey, charName, charLevel)
            end
        end
    end
    
    -- Angeln
    if profSkills.fishing and profSkills.fishing > 0 then
        for _, m in ipairs(MILESTONE_DEFS) do
            if m.type == "fishing" and profSkills.fishing >= m.threshold then
                if not charData.unlocked[m.id] then
                    self:UnlockMilestone(m.id, charKey, charName, charLevel)
                end
            end
        end
    end
    
    -- Kochen
    if profSkills.cooking and profSkills.cooking > 0 then
        for _, m in ipairs(MILESTONE_DEFS) do
            if m.type == "cooking" and profSkills.cooking >= m.threshold then
                if not charData.unlocked[m.id] then
                    self:UnlockMilestone(m.id, charKey, charName, charLevel)
                end
            end
        end
    end
    
    -- Erste Hilfe
    if profSkills.firstaid and profSkills.firstaid > 0 then
        for _, m in ipairs(MILESTONE_DEFS) do
            if m.type == "firstaid" and profSkills.firstaid >= m.threshold then
                if not charData.unlocked[m.id] then
                    self:UnlockMilestone(m.id, charKey, charName, charLevel)
                end
            end
        end
    end
    
    self:CheckGoldMilestones()
    self:CheckTotalKillMilestones()
    self:CheckCreatureKillMilestones()
    self:CheckPvPMilestones()
    self:CheckWitnessMilestones()
    self:CheckAliveDaysMilestones()
    self:CheckQuestMilestones()
    self:CheckGuildSizeMilestones()
    self:CheckMetaMilestones()
end

-- ==============================================================
-- CLASSIC-KOMPATIBLE BERUFE-ABFRAGE
-- ==============================================================

function Milestones:GetProfessionSkills()
    local result = {
        maxMain = 0,
        fishing = 0,
        cooking = 0,
        firstaid = 0,
        mainSkills = {}
    }
    
    local numSkills = GetNumSkillLines and GetNumSkillLines() or 0
    if numSkills == 0 then return result end
    
    local inProfessionHeader = false
    local inSecondaryHeader = false
    
    -- Berufe-Header Namen (DE/EN) - ohne Umlaute für Kompatibilität
    local profHeaders = {
        ["Berufe"] = true, ["Professions"] = true, 
        ["Trade Skills"] = true, ["Handelsfertigkeiten"] = true
    }
    local secondaryHeaders = {
        ["Sekundäre Fertigkeiten"] = true, ["Secondary Skills"] = true,
        ["Sekundärberufe"] = true, ["Secondary"] = true,
        ["Sekundare Fertigkeiten"] = true, ["Sekundarberufe"] = true  -- Ohne Umlaute
    }
    -- Nebenberuf-Namen (mit und ohne Umlaute)
    local fishingNames = {["Angeln"] = true, ["Fishing"] = true}
    local cookingNames = {["Kochen"] = true, ["Cooking"] = true, ["Kochkunst"] = true}
    local firstaidNames = {["Erste Hilfe"] = true, ["First Aid"] = true}
    
    for i = 1, numSkills do
        local skillName, isHeader, _, skillRank = GetSkillLineInfo(i)
        
        if isHeader then
            if profHeaders[skillName] then
                inProfessionHeader = true
                inSecondaryHeader = false
            elseif secondaryHeaders[skillName] then
                inSecondaryHeader = true
                inProfessionHeader = false
            else
                inProfessionHeader = false
                inSecondaryHeader = false
            end
        elseif skillName and skillRank then
            if inProfessionHeader then
                -- Hauptberuf
                table.insert(result.mainSkills, {name = skillName, skill = skillRank})
                if skillRank > result.maxMain then
                    result.maxMain = skillRank
                end
            elseif inSecondaryHeader then
                -- Sekundärberuf
                if fishingNames[skillName] then
                    result.fishing = skillRank
                elseif cookingNames[skillName] then
                    result.cooking = skillRank
                elseif firstaidNames[skillName] then
                    result.firstaid = skillRank
                end
            end
        end
    end
    
    return result
end

-- ==============================================================
-- UNLOCK
-- ==============================================================

function Milestones:UnlockMilestone(milestoneId, charKey, charName, charLevel, silent)
    charKey = charKey or self:GetCharacterKey()
    charName = charName or UnitName("player")
    charLevel = charLevel or UnitLevel("player")
    
    local charData = self:GetCharacterData(charKey)
    if charData.unlocked[milestoneId] then return false end
    
    local milestone = MILESTONE_BY_ID[milestoneId]
    if not milestone then return false end
    
    charData.unlocked[milestoneId] = {
        timestamp = time(),
        level = charLevel,
        name = charName,
    }
    
    self:BroadcastMilestone(milestoneId, charName, charLevel)
    
    GuildDeathLogDB.guildMilestones[charKey] = GuildDeathLogDB.guildMilestones[charKey] or {}
    GuildDeathLogDB.guildMilestones[charKey][milestoneId] = charData.unlocked[milestoneId]
    
    if not silent then
        -- Einzeiler in den ECHTEN Gildenchat (sichtbar fuer alle, auch ohne Addon)
        if GuildDeathLogDB.settings.guildPushEnabled ~= false and IsInGuild() then
            pcall(SendChatMessage, (L.REACHED_GUILD or "Milestone reached: ") .. milestone.name, "GUILD")
        end
        -- NUR Popup zeigen wenn Setting aktiv ist
        if GuildDeathLogDB.settings.milestonePopup ~= false then
            self:ShowMilestonePopup(milestone, charName)
        end
        local Titles = GDL:GetModule("Titles")
        if Titles and Titles.OnMilestoneUnlocked then
            Titles:OnMilestoneUnlocked(milestoneId)
        end
    end
    
    C_Timer.After(0.5, function() self:CheckMetaMilestones() end)
    return true
end

function Milestones:GetNPCIdFromGUID(guid)
    if not guid then return nil end
    local guidType, _, _, _, _, npcId = strsplit("-", guid)
    if guidType == "Creature" or guidType == "Vehicle" then
        return tonumber(npcId)
    end
    return nil
end

-- ==============================================================
-- SYNC
-- ==============================================================

-- Meilenstein-Sync ist eine LIVE-ANNOUNCE-Funktion (wie eine Gildenchat-Notiz),
-- KEIN State-Sync: es gibt projektweit keinen Consumer fuer fremde Meilenstein-
-- Zustaende, also waere REQUEST/HAVE/Persistenz tote Last (Bandbreite + Storm-
-- Risiko ohne Feature-Nutzen). Nur das Unlock-Ereignis wird angekuendigt;
-- spaete Joiner verpassen alte Announces - das ist fuer eine Notiz korrekt.
local announcedRecently = {}   -- "sender|id" -> time, gegen Doppel-Print bei Doppel-Events

function Milestones:BroadcastMilestone(milestoneId, charName, charLevel)
    if not IsInGuild() then return end
    local message = "UNLOCK" .. COMM_DELIM .. milestoneId .. COMM_DELIM .. charName .. COMM_DELIM .. charLevel
    C_ChatInfo.SendAddonMessage(MILESTONE_PREFIX, message, "GUILD")
    if GDL.Debug then GDL:Debug("Milestones: -> SENT UNLOCK " .. tostring(milestoneId)) end
end

-- Announce-only: es gibt nichts abzufragen. Bewusst No-Op (frueher leerer Timer).
function Milestones:RequestMilestoneSync() end

function Milestones:HandleMilestoneSync(message, sender)
    local senderName = Ambiguate(sender, "short")
    if senderName == UnitName("player") then return end   -- eigenes Echo
    if message == "REQUEST" then return end               -- announce-only, nichts zu liefern

    local cmd, data = strsplit(COMM_DELIM, message, 2)
    if cmd ~= "UNLOCK" then return end

    local mId, cName = strsplit(COMM_DELIM, data)
    if not (mId and cName and MILESTONE_BY_ID[mId]) then return end

    -- Doppel-Print verhindern (WoW liefert CHAT_MSG_ADDON gelegentlich doppelt)
    local key, now = senderName .. "|" .. mId, time()
    if announcedRecently[key] and (now - announcedRecently[key]) < 8 then return end
    announcedRecently[key] = now

    if GDL.Debug then GDL:Debug("Milestones: <- RECV UNLOCK " .. mId .. " from " .. senderName) end
    if GuildDeathLogDB.settings.milestoneAnnounce ~= false then
        GDL:Print("|cffFFD100" .. cName .. "|r: |cff00FF00" .. MILESTONE_BY_ID[mId].name .. "|r")
    end
end

-- ==============================================================
-- POPUP
-- ==============================================================

function Milestones:ShowMilestonePopup(milestone, charName)
    local UI = GDL:GetModule("UI")
    if UI and UI.ShowMilestoneToast then
        UI:ShowMilestoneToast(milestone, charName)
    end
end

-- ==============================================================
-- API
-- ==============================================================

function Milestones:GetAllMilestones()
    return MILESTONE_DEFS
end

function Milestones:GetMilestonesByCategory(category)
    local result = {}
    for _, m in ipairs(MILESTONE_DEFS) do
        if m.category == category then
            table.insert(result, m)
        end
    end
    return result
end

function Milestones:GetCharacterMilestones(charKey)
    charKey = charKey or self:GetCharacterKey()
    local charData = self:GetCharacterData(charKey)
    return charData.unlocked or {}
end

function Milestones:GetGuildMilestones()
    return GuildDeathLogDB.guildMilestones or {}
end

function Milestones:IsMilestoneUnlocked(milestoneId, charKey)
    charKey = charKey or self:GetCharacterKey()
    local charData = self:GetCharacterData(charKey)
    return charData.unlocked[milestoneId] ~= nil
end

function Milestones:GetMilestoneProgress(charKey)
    charKey = charKey or self:GetCharacterKey()
    local charData = self:GetCharacterData(charKey)
    local unlocked = 0
    for _ in pairs(charData.unlocked) do unlocked = unlocked + 1 end
    return unlocked, #MILESTONE_DEFS
end

function Milestones:GetCategoryProgress(category, charKey)
    charKey = charKey or self:GetCharacterKey()
    local charData = self:GetCharacterData(charKey)
    local unlocked, total = 0, 0
    
    for _, m in ipairs(MILESTONE_DEFS) do
        if m.category == category then
            total = total + 1
            if charData.unlocked[m.id] then unlocked = unlocked + 1 end
        end
    end
    return unlocked, total
end

function Milestones:IsSecretMilestone(milestoneId)
    local m = MILESTONE_BY_ID[milestoneId]
    return m and m.secret == true
end

function Milestones:GetMilestoneDescription(milestoneId, charKey)
    charKey = charKey or self:GetCharacterKey()
    local m = MILESTONE_BY_ID[milestoneId]
    if not m then return "" end
    
    -- Wenn geheim und nicht freigeschaltet, zeige "???"
    if m.secret and not self:IsMilestoneUnlocked(milestoneId, charKey) then
        return L.SECRET_DESC
    end
    
    return m.desc
end

function Milestones:GetSecretLocale()
    return L.SECRET_DESC, L.SECRET_CATEGORY
end

function Milestones:CheckAllMilestones()
    self:CheckCurrentLevel()
    self:TrackPlayerStats()
    self:CheckMetaMilestones()
    RequestTimePlayed()
end

function Milestones:CheckPvPMilestones()
    local charKey = self:GetCharacterKey()
    local charData = self:GetCharacterData(charKey)
    local charName = UnitName("player")
    local charLevel = UnitLevel("player")
    local hks = 0
    if GetPVPLifetimeStats then
        hks = GetPVPLifetimeStats() or 0
    end
    if hks > 0 then
        for _, m in ipairs(MILESTONE_DEFS) do
            if m.type == "pvp" and hks >= m.threshold then
                if not charData.unlocked[m.id] then
                    self:UnlockMilestone(m.id, charKey, charName, charLevel)
                end
            end
        end
    end
end

function Milestones:CheckWitnessMilestones()
    local charKey = self:GetCharacterKey()
    local charData = self:GetCharacterData(charKey)
    local charName = UnitName("player")
    local charLevel = UnitLevel("player")
    local guildName = GDL.currentGuildName
    if not guildName then return end
    local guildData = GuildDeathLogDB and GuildDeathLogDB.guilds and GuildDeathLogDB.guilds[guildName]
    if not guildData or not guildData.deaths then return end
    local count = 0
    for _ in pairs(guildData.deaths) do count = count + 1 end
    for _, m in ipairs(MILESTONE_DEFS) do
        if m.type == "witness" and count >= m.threshold then
            if not charData.unlocked[m.id] then
                self:UnlockMilestone(m.id, charKey, charName, charLevel)
            end
        end
    end
end

function Milestones:CheckAliveDaysMilestones()
    local charKey = self:GetCharacterKey()
    local charData = self:GetCharacterData(charKey)
    local charName = UnitName("player")
    local charLevel = UnitLevel("player")
    if not charData.firstSeen then
        charData.firstSeen = time()
    end
    local daysAlive = math.floor((time() - charData.firstSeen) / 86400)
    for _, m in ipairs(MILESTONE_DEFS) do
        if m.type == "alive_days" and daysAlive >= m.threshold then
            if not charData.unlocked[m.id] then
                self:UnlockMilestone(m.id, charKey, charName, charLevel)
            end
        end
    end
end

function Milestones:CheckQuestMilestones()
    local charKey = self:GetCharacterKey()
    local charData = self:GetCharacterData(charKey)
    local charName = UnitName("player")
    local charLevel = UnitLevel("player")
    charData.questsCompleted = charData.questsCompleted or 0
    for _, m in ipairs(MILESTONE_DEFS) do
        if m.type == "quests" and charData.questsCompleted >= m.threshold then
            if not charData.unlocked[m.id] then
                self:UnlockMilestone(m.id, charKey, charName, charLevel)
            end
        end
    end
end

function Milestones:CheckGuildSizeMilestones()
    local charKey = self:GetCharacterKey()
    local charData = self:GetCharacterData(charKey)
    local charName = UnitName("player")
    local charLevel = UnitLevel("player")
    local numMembers = GetNumGuildMembers and GetNumGuildMembers() or 0
    for _, m in ipairs(MILESTONE_DEFS) do
        if m.type == "guild_size" and numMembers >= m.threshold then
            if not charData.unlocked[m.id] then
                self:UnlockMilestone(m.id, charKey, charName, charLevel)
            end
        end
    end
end

function Milestones:OnQuestTurnedIn()
    local charKey = self:GetCharacterKey()
    local charData = self:GetCharacterData(charKey)
    charData.questsCompleted = (charData.questsCompleted or 0) + 1
    self:CheckQuestMilestones()
end

-- Module registrieren
-- ── Debug/Test-Methoden (für /gdl Slash-Commands) ──────────────────────────
function Milestones:TestLevelMilestones()
    GDL:Print("[Milestones] Test: Level-Meilensteine prüfen...")
    self:PLAYER_LEVEL_UP()
end

function Milestones:ForceUnlockCurrentLevel()
    local level = UnitLevel and UnitLevel("player") or 1
    GDL:Print(string.format("[Milestones] Force-Unlock Level %d", level))
    self:CheckCurrentLevel()
end

GDL:RegisterModule("Milestones", Milestones)


local initFrame = CreateFrame("Frame")
initFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
initFrame:RegisterEvent("QUEST_TURNED_IN")
initFrame:SetScript("OnEvent", function(self, event, ...)
    if event == "PLAYER_ENTERING_WORLD" then
        C_Timer.After(2, function() Milestones:Initialize() end)
        self:UnregisterEvent("PLAYER_ENTERING_WORLD")
    elseif event == "QUEST_TURNED_IN" then
        if Milestones.initialized then
            Milestones:OnQuestTurnedIn()
        end
    end
end)
