Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
iam3yal committed Feb 3, 2024
1 parent 8de7763 commit 8c8e5e7
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 34 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ TooltipInfo is a simple and opinionated addon designed to enrich your World of W
- **Guild:** Display the guild name and character rank.
- **Honor Level:** Display the honor level of players.
- **Character Level:** Display the effective/actual level of characters.
- Useful information for Timewalking Dungeons.
- Can be useful for Timewalking Dungeons.
- **Mythic+:** Display Mythic+ rating and best run of characters.
- **Raid Icon:** Display the icon on the tooltip.
- **Target of Target:** Display the target's target for improved awareness.
- **StatusBar:** Display the health of units on the tooltip StatusBar.
- **StatusBar:** Display the health of units on the tooltip's StatusBar.
- **Character Race and Class Colors:** Color-coded for improved visuals.

## Additional Features:
Expand Down
3 changes: 3 additions & 0 deletions Scripts/Class.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
if not TooltipDataProcessor.AddTooltipPostCall then return end

local _G = _G
local RAID_CLASS_COLORS = RAID_CLASS_COLORS

local UnitIsPlayer = UnitIsPlayer
local UnitClass = UnitClass

Expand Down
1 change: 1 addition & 0 deletions Scripts/Guild.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
if not TooltipDataProcessor.AddTooltipPostCall then return end

local _G = _G
local UnitIsPlayer = UnitIsPlayer
local GetGuildInfo = GetGuildInfo

Expand Down
2 changes: 1 addition & 1 deletion Scripts/HonorLevel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ TooltipDataProcessor.AddTooltipPostCall(Enum.TooltipDataType.Unit, function(tool
if line then
local lineText = line:GetText()
if lineText and lineText:find(localizedFaction) then
line:SetText('')
line:SetText("")
line:Hide()
tooltip:AddDoubleLine(HONOR_LEVEL_LABEL, honorLevel, nil, nil, nil, 1, 1, 1)
break
Expand Down
8 changes: 7 additions & 1 deletion Scripts/Level.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
if not TooltipDataProcessor.AddTooltipPostCall then return end

local _G = _G
local CreateColor = CreateColor
local GetContentDifficultyCreatureForPlayer = C_PlayerInfo.GetContentDifficultyCreatureForPlayer
local GetDifficultyColor = GetDifficultyColor
Expand All @@ -10,6 +11,8 @@ local UnitLevel = UnitLevel
local LEVEL1_FORMAT = "|cff%%s%%s|r"
local LEVEL2_FORMAT = "|cff%%s%%s|r (%%s)"

local PLAYER_PATTERN = "%(%w+%)"

TooltipDataProcessor.AddTooltipPostCall(Enum.TooltipDataType.Unit, function(tooltip)
if tooltip:IsForbidden() then return end
if tooltip ~= GameTooltip then return end
Expand All @@ -28,13 +31,16 @@ TooltipDataProcessor.AddTooltipPostCall(Enum.TooltipDataType.Unit, function(tool
local lineText = line:GetText()
if lineText and lineText:find(LEVEL) then
local levelText = level > 0 and level or "??"

if level < realLevel then
line:SetFormattedText(lineText:gsub(level, LEVEL2_FORMAT), diffHexColor, levelText, realLevel)
else
line:SetFormattedText(lineText:gsub(level, LEVEL1_FORMAT), diffHexColor, levelText)
end

-- Removes the (Player) bit from the level line.
line:SetText(lineText:gsub(PLAYER_PATTERN, ""))

break
end
end
Expand Down
29 changes: 1 addition & 28 deletions Scripts/Race.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
if not TooltipDataProcessor.AddTooltipPostCall then return end

local _G = _G
local UnitIsPlayer = UnitIsPlayer
local UnitRace = UnitRace
local UnitIsFriend = UnitIsFriend

local RACE_FORMAT = "%%s%%s|r"
--local ALLIANCE = "Alliance"
--local HORDE = "Horde"
--local PANDAREN = "Pandaren"

local function GetUnitReactionColor(unit)
if UnitIsFriend(unit, "player") then
Expand All @@ -17,27 +15,6 @@ local function GetUnitReactionColor(unit)
end
end

--[[local function GetUnitBattlefieldFaction(unit)
local englishFaction, localizedFaction = UnitFactionGroup(unit)
-- This might be a rated BG or wargame and if so the player's faction might be altered
-- should also apply if `player` is a mercenary.
if unit == "player" then
if C_PvP.IsRatedBattleground() or IsWargame() then
englishFaction = PLAYER_FACTION_GROUP[GetBattlefieldArenaFaction()]
localizedFaction = (englishFaction == ALLIANCE and FACTION_ALLIANCE) or FACTION_HORDE
elseif UnitIsMercenary(unit) then
if englishFaction == ALLIANCE then
englishFaction, localizedFaction = HORDE, FACTION_HORDE
else
englishFaction, localizedFaction = ALLIANCE, FACTION_ALLIANCE
end
end
end
return englishFaction, localizedFaction
end]]

TooltipDataProcessor.AddTooltipPostCall(Enum.TooltipDataType.Unit, function(tooltip)
if tooltip:IsForbidden() then return end
if tooltip ~= GameTooltip then return end
Expand All @@ -47,10 +24,6 @@ TooltipDataProcessor.AddTooltipPostCall(Enum.TooltipDataType.Unit, function(tool

if unit and UnitIsPlayer(unit) then
local race = UnitRace(unit)
--[[local _, localizedFaction = GetUnitBattlefieldFaction(unit)
if localizedFaction and englishRace == PANDAREN then
race = localizedFaction .. " " .. race
end]]
if race then
for i = 2, numLines do
local line = _G["GameTooltipTextLeft" .. i]
Expand Down
2 changes: 2 additions & 0 deletions Scripts/RaidIcon.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
if not TooltipDataProcessor.AddTooltipPostCall then return end

local ICON_LIST = ICON_LIST

local UnitExists = UnitExists
local GetRaidTargetIndex = GetRaidTargetIndex

Expand Down
5 changes: 5 additions & 0 deletions Scripts/StatusBar.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
if not TooltipDataProcessor.AddTooltipPostCall then return end

local UnitHealth = UnitHealth
local UnitHealthMax = UnitHealthMax
local TextStatusBar_UpdateTextStringWithValues = TextStatusBar_UpdateTextStringWithValues
local TextStatusBar_UpdateTextString = TextStatusBar_UpdateTextString

do
local text = GameTooltipStatusBar:CreateFontString(nil, "OVERLAY", "TextStatusBarText")
text:SetPoint("CENTER")
Expand Down
7 changes: 5 additions & 2 deletions Scripts/Target.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
if not TooltipDataProcessor.AddTooltipPostCall then return end

local _G = _G
local TARGET = TARGET
local FACTION_BAR_COLORS = FACTION_BAR_COLORS
local RAID_CLASS_COLORS = RAID_CLASS_COLORS

local UnitIsUnit = UnitIsUnit
local UnitIsPlayer = UnitIsPlayer
local UnitClass = UnitClass
local UnitReaction = UnitReaction
local UnitName = UnitName
local UnitExists = UnitExists

local TARGET = TARGET

local THE_TARGET_FORMAT = "|cfffed100" .. TARGET .. ":|r %s"
local PLAYER_FORMAT = "|cffffffff<You>|r"
local UNIT_NAME_FORMAT = "|cff%2x%2x%2x%s|r"
Expand Down

0 comments on commit 8c8e5e7

Please sign in to comment.