local NP = NanamiPlates local function GetThemeColor(key, fallbackR, fallbackG, fallbackB, fallbackA) if SFrames and SFrames.ActiveTheme and SFrames.ActiveTheme[key] then local c = SFrames.ActiveTheme[key] return c[1] or fallbackR, c[2] or fallbackG, c[3] or fallbackB, c[4] or fallbackA or 1 end return fallbackR, fallbackG, fallbackB, fallbackA or 1 end NP.GetThemeColor = GetThemeColor local function GetFont() if SFrames and SFrames.GetFont then return SFrames:GetFont() end return "Fonts\\ARIALN.TTF" end NP.GetFont = GetFont local function GetFontOutline() if SFrames and SFrames.Media and SFrames.Media.fontOutline then return SFrames.Media.fontOutline end return "OUTLINE" end NP.GetFontOutline = GetFontOutline local function GetTexture() if SFrames and SFrames.GetTexture then return SFrames:GetTexture() end return "Interface\\TargetingFrame\\UI-StatusBar" end NP.GetTexture = GetTexture NP.Settings = { healthbarHeight = 12, healthbarWidth = 120, healthFontSize = 9, healthTextFormat = 4, friendHealthbarHeight = 4, friendHealthbarWidth = 85, friendHealthFontSize = 8, friendHealthTextFormat = 1, castbarHeight = 10, castbarWidth = 120, showCastbarIcon = true, friendCastbarHeight = 6, friendCastbarWidth = 85, friendShowCastbarIcon = true, castbarColor = {1, 0.8, 0, 1}, levelFontSize = 9, nameFontSize = 9, friendLevelFontSize = 7, friendNameFontSize = 8, raidIconPosition = "LEFT", namePosition = "BOTTOM", showOnlyMyDebuffs = false, showDebuffTimers = true, debuffIconSize = 20, showComboPoints = true, comboPointsSize = 12, showTargetGlow = true, targetArrowStyle = 1, targetArrowSize = 24, targetArrowOffset = 0, targetArrowTint = 0, nonTargetAlpha = 0.35, showCritterNameplates = false, showManaBar = true, manabarHeight = 3, nameplateYOffset = 15, pvpEnemyAsFriendly = false, pvpEnemyNoClassColors = false, showQuestIcon = true, } NP.Colors = { hostile = {0.85, 0.2, 0.2, 1}, neutral = {0.9, 0.7, 0.0, 1}, friendly = {0.2, 0.8, 0.2, 1}, tapped = {0.5, 0.5, 0.5, 1}, class = { WARRIOR = {0.78, 0.61, 0.43}, MAGE = {0.41, 0.80, 0.94}, ROGUE = {1.0, 0.96, 0.41}, DRUID = {1.0, 0.49, 0.04}, HUNTER = {0.67, 0.83, 0.45}, SHAMAN = {0.14, 0.35, 1.0}, PRIEST = {1.0, 1.0, 1.0}, WARLOCK = {0.58, 0.51, 0.79}, PALADIN = {0.96, 0.55, 0.73}, }, power = { [0] = {0.0, 0.0, 1.0}, [1] = {1.0, 0.0, 0.0}, [2] = {1.0, 0.5, 0.0}, [3] = {1.0, 1.0, 0.0}, [4] = {0.0, 1.0, 1.0}, }, } NP.THREAT_COLORS = { DPS = { AGGRO = {1.0, 0.2, 0.2, 1}, HIGH_THREAT = {1.0, 0.6, 0.0, 1}, NO_AGGRO = {0.85, 0.2, 0.2, 1}, }, TANK = { AGGRO = {0.2, 0.8, 0.2, 1}, LOSING_AGGRO = {1.0, 0.6, 0.0, 1}, NO_AGGRO = {1.0, 0.1, 0.1, 1}, OTHER_TANK = {0.6, 0.8, 1.0, 1}, }, TAPPED = {0.5, 0.5, 0.5, 1}, STUN = {0.376, 0.027, 0.431, 1}, } NP.Critters = { ["adder"] = true, ["beetle"] = true, ["belfry bat"] = true, ["biletoad"] = true, ["black rat"] = true, ["brown prairie dog"] = true, ["caged rabbit"] = true, ["caged sheep"] = true, ["caged squirrel"] = true, ["caged toad"] = true, ["cat"] = true, ["chicken"] = true, ["cleo"] = true, ["core rat"] = true, ["cow"] = true, ["cured deer"] = true, ["cured gazelle"] = true, ["deeprun rat"] = true, ["deer"] = true, ["dog"] = true, ["effsee"] = true, ["enthralled deeprun rat"] = true, ["fang"] = true, ["fawn"] = true, ["fire beetle"] = true, ["fluffy"] = true, ["frog"] = true, ["gazelle"] = true, ["hare"] = true, ["horse"] = true, ["huge toad"] = true, ["infected deer"] = true, ["infected squirrel"] = true, ["jungle toad"] = true, ["krakle's thermometer"] = true, ["lady"] = true, ["larva"] = true, ["lava crab"] = true, ["maggot"] = true, ["moccasin"] = true, ["mouse"] = true, ["mr. bigglesworth"] = true, ["nibbles"] = true, ["noarm"] = true, ["old blanchy"] = true, ["parrot"] = true, ["pig"] = true, ["pirate treasure trigger mob"] = true, ["plagued insect"] = true, ["plagued maggot"] = true, ["plagued rat"] = true, ["plagueland termite"] = true, ["polymorphed chicken"] = true, ["polymorphed rat"] = true, ["prairie dog"] = true, ["rabbit"] = true, ["ram"] = true, ["rat"] = true, ["riding ram"] = true, ["roach"] = true, ["salome"] = true, ["school of fish"] = true, ["scorpion"] = true, ["sheep"] = true, ["shen'dralar wisp"] = true, ["sickly deer"] = true, ["sickly gazelle"] = true, ["snake"] = true, ["spider"] = true, ["spike"] = true, ["squirrel"] = true, ["swine"] = true, ["tainted cockroach"] = true, ["tainted rat"] = true, ["toad"] = true, ["transporter malfunction"] = true, ["turtle"] = true, ["underfoot"] = true, ["voice of elune"] = true, ["waypoint (only gm can see it)"] = true, ["wisp"] = true, } function NP:DetectTankSpec() local _, playerClass = UnitClass("player") if not playerClass then return end if playerClass ~= "WARRIOR" and playerClass ~= "PALADIN" and playerClass ~= "DRUID" then return end if not GetTalentTabInfo then return end local _, _, p1 = GetTalentTabInfo(1) local _, _, p2 = GetTalentTabInfo(2) local _, _, p3 = GetTalentTabInfo(3) p1 = p1 or 0 p2 = p2 or 0 p3 = p3 or 0 local isTank = false if playerClass == "WARRIOR" then isTank = (p3 >= p1 and p3 >= p2 and p3 >= 11) elseif playerClass == "PALADIN" then isTank = (p2 >= p1 and p2 >= p3 and p2 >= 11) elseif playerClass == "DRUID" then isTank = (p2 >= p1 and p2 >= p3 and p2 >= 11) end local newRole = isTank and "TANK" or "DPS" if newRole ~= self.playerRole then self.playerRole = newRole self:SaveSettings() self.Print("Auto role: " .. newRole) if NanamiPlates_Threat then NanamiPlates_Threat.BroadcastTankMode(true) end end end function NP:LoadSettings() if NanamiPlatesDB then for k, v in pairs(NanamiPlatesDB) do if self.Settings[k] ~= nil then self.Settings[k] = v end end if NanamiPlatesDB.playerRole then self.playerRole = NanamiPlatesDB.playerRole end end end function NP:SaveSettings() NanamiPlatesDB = {} for k, v in pairs(self.Settings) do NanamiPlatesDB[k] = v end NanamiPlatesDB.playerRole = self.playerRole end if SFrames and SFrames.Config and SFrames.Config.colors and SFrames.Config.colors.class then for k, v in pairs(SFrames.Config.colors.class) do NP.Colors.class[k] = {v.r, v.g, v.b} end end