Reply
Thread Tools Display Modes
Unread 06-05-13, 02:43 PM   #1
Tonyleila
An Onyxian Warder
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 368
Dungeon Difficulty / Minimap

I can't find an addon or data broker to display the Dungeon Difficulty. I use chinchilla minimap for years now and this is one of the things I don't like about it is the ugly blizzard display for it. I used V Difficulty (LDB) for some time now but its not up to date any more and I don't realy like that its always on. I only want to see it if I'm in a dungeon or raid and then I only want to see the Difficulty for this Dungeon/raid. So just show one of this: 10N, 10H, 25N, 25H, 5N, 5H, 5C

Anyone knows an alternative addon?
__________________
Author of: LeilaUI and Aurora: Missing Textures
__________________
Tonyleila is online now   Reply With Quote
Unread 06-05-13, 03:52 PM   #2
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 4,400
Here's the code I use for a simplified text-only difficulty display in my private minimap addon:
Code:
MiniMapInstanceDifficulty:SetParent(Minimap)
MiniMapInstanceDifficulty:ClearAllPoints()
MiniMapInstanceDifficulty:SetPoint("TOPRIGHT", -2, 20)

MiniMapInstanceDifficultyText:ClearAllPoints()
MiniMapInstanceDifficultyText:SetPoint("RIGHT", 0, -9)
MiniMapInstanceDifficultyText:SetFontObject(TextStatusBarText)

MiniMapInstanceDifficultyTexture:Hide()

GuildInstanceDifficulty:Hide()

MiniMapInstanceDifficulty:HookScript("OnEvent", function(self, event, isGuildGroup)
	if event == "GUILD_PARTY_STATE_UPDATED" then
		self.__isGuildGroup = isGuildGroup
	end
end)

function MiniMapInstanceDifficulty_Update()
	local instanceName, instanceType, difficulty, _, maxPlayers, playerDifficulty, isDynamicInstance = GetInstanceInfo()
	local _, _, isHeroic, isChallengeMode = GetDifficultyInfo(difficulty)

	if MiniMapInstanceDifficulty.__isGuildGroup then
		instanceType = "GUILD"
	end

	local color = ChatTypeInfo[strupper(instanceType)]

	if color and maxPlayers > 0 then
		MiniMapInstanceDifficultyText:SetFormattedText("%d%s", maxPlayers, isChallengeMode and "++" or isHeroic and "+" or "")
		MiniMapInstanceDifficultyText:SetTextColor(color.r, color.g, color.b)
		MiniMapInstanceDifficulty:Show()
	else
		MiniMapInstanceDifficulty:Hide()
	end
end

local difficultyText = {
	DUNGEON_DIFFICULTY1,
	DUNGEON_DIFFICULTY2,
	RAID_DIFFICULTY1,
	RAID_DIFFICULTY2,
	RAID_DIFFICULTY3,
	RAID_DIFFICULTY4,
	UNKNOWN,
	CHALLENGE_MODE,
}

MiniMapInstanceDifficulty:EnableMouse(true)
MiniMapInstanceDifficulty:SetScript("OnEnter", function(self)
	local instanceName, instanceType, difficulty, difficultyText, maxPlayers, playerDifficulty, isDynamicInstance = GetInstanceInfo()

	GameTooltip:SetOwner(self, "ANCHOR_NONE")
	GameTooltip:SetPoint("TOPRIGHT", self, "LEFT")

	GameTooltip:AddLine(instanceName, 1, 0.82, 0)
	GameTooltip:AddLine(difficultyText, 1, 1, 1)
	GameTooltip:AddLine(difficultyText[difficulty] or UNKNOWN, 1, 1, 1)

	if self.__isGuildGroup then
		GameTooltip:AddLine(GUILD, 1, 1, 1)
	end

	GameTooltip:Show()
end)
MiniMapInstanceDifficulty:SetScript("OnLeave", GameTooltip_Hide)
Drycoded Broker conversion:
Code:
local DEFAULT_TEXT = ""

local isGuildGroup

local b = LibStub("LibDataBroker-1.1"):NewDataObject("InstanceDifficulty", {
	type = "data source",
	text = DEFAULT_TEXT,
	OnTooltipShow = function(GameTooltip)
		local instanceName, instanceType, difficultyID, difficultyName, maxPlayers, playerDifficulty, isDynamicInstance = GetInstanceInfo()
		local difficultyText = GetDifficultyInfo(difficultyID)

		GameTooltip:AddLine(instanceName, 1, 0.82, 0)
		GameTooltip:AddLine(difficultyText, 1, 1, 1)

		if isGuildGroup then
			GameTooltip:AddLine(GUILD, 1, 1, 1)
		end

		GameTooltip:Show()
	end,
})

local f = CreateFrame("Frame")
f:RegisterEvent("GROUP_ROSTER_UPDATE")
f:RegisterEvent("GUILD_PARTY_STATE_UPDATED")
f:RegisterEvent("PARTY_MEMBER_DISABLE")
f:RegisterEvent("PARTY_MEMBER_ENABLE")
f:RegisterEvent("PLAYER_DIFFICULTY_CHANGED")
f:RegisterEvent("PLAYER_GUILD_UPDATE")
f:RegisterEvent("UPDATE_INSTANCE_INFO")
f:SetScript("OnEvent", function(self, event, ...)
	if event == "GUILD_PARTY_STATE_UPDATED" then
		isGuildGroup = ...
	elseif event ~= "UPDATE_INSTANCE_INFO" then
		RequestGuildPartyState()
	end

	local instanceName, instanceType, difficulty, _, maxPlayers, playerDifficulty, isDynamicInstance = GetInstanceInfo()
	local _, _, isHeroic, isChallengeMode = GetDifficultyInfo(difficulty)

	if isGuildGroup then
		instanceType = "GUILD"
	end

	local color = ChatTypeInfo[strupper(instanceType)]

	if color and maxPlayers > 0 then 
		b.text = format("|cff%02x%02x%02x%s%d", color.r * 255, color.g * 255, color.b * 255, isChallengeMode and "++" or isHeroic and "+" or "", maxPlayers)
	else
		b.text = DEFAULT_TEXT
	end
end)
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!

Last edited by Phanx : 06-05-13 at 07:20 PM.
Phanx is offline   Reply With Quote
Unread 06-05-13, 04:43 PM   #3
Tonyleila
An Onyxian Warder
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 368
Thank you Phanx! I use the broker one right now but for some reason the text is showing up in black.
__________________
Author of: LeilaUI and Aurora: Missing Textures
__________________
Tonyleila is online now   Reply With Quote
Unread 06-05-13, 05:07 PM   #4
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 4,400
Fixed. Forgot to multiply the RGB values by 255 before formatting as hex values.
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
Phanx is offline   Reply With Quote
Unread 06-05-13, 06:13 PM   #5
Tonyleila
An Onyxian Warder
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 368
Originally Posted by Phanx View Post
Fixed. Forgot to multiply the RGB values by 255 before formatting as hex values.
Yep that fixed it. Only the name "InstanceDifficulty" is still black (but thats not a big deal since I only use that to move it in the broker display around.


Don't you want to upload that market gap fixing addon? Its simply perfect

Folder:
Broker_InstanceDifficulty

Code from above:
Broker_InstanceDifficulty.lua

Broker_InstanceDifficulty.toc
Code:
## Interface: 50300
## Title: Broker InstanceDifficulty
## Version: 1.0
## Author: Phanx
## Notes: Displays Instance Difficulty when in an Instance

Broker_InstanceDifficulty.lua
__________________
Author of: LeilaUI and Aurora: Missing Textures
__________________
Tonyleila is online now   Reply With Quote
Unread 06-05-13, 07:18 PM   #6
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 4,400
Originally Posted by Tonyleila View Post
Only the name "InstanceDifficulty" is still black ...
Where are you seeing that? There's nothing in the code I posted that should show that phrase as text anywhere. The only instance of that phrase in my code was the internal identifier of the plugin as registered with LibDataBroker. If your display addon is showing internal plugin identifiers, there's nothing I can do in the plugin code to control that.

The only text that should be displayed on the plugin is something like "52" for a normal 25-man, "10+" for a heroic 10-man, or "5++" for a challenge mode dungeon.

(The numbers and plusses were reversed for my right-aligned minimap; I've edited my previous code to show them in standard order on the Broker plugin.)
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!

Last edited by Phanx : 06-05-13 at 07:21 PM.
Phanx is offline   Reply With Quote
Unread 06-05-13, 09:44 PM   #7
Tonyleila
An Onyxian Warder
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 368
As far as I know broker addons always have a label and a text to display.
I think Bazooka is best addon for Broker plugins. It has an option to display the titel of the broker - for plugins like this one where you normaly woud need to go into an instace to move it around. Also its possible to stripe colors to make all text white (but not your black one only the other one).However as I said I only use this name to move it around so don't care if its black.
For myself I changed the + and ++ to C H and N


Edit: and I'm not able to test it now but will it hide in raidfinder?
__________________
Author of: LeilaUI and Aurora: Missing Textures
__________________

Last edited by Tonyleila : 06-05-13 at 09:56 PM.
Tonyleila is online now   Reply With Quote
Unread 06-05-13, 10:03 PM   #8
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,295
Turn off the title.
p3lim is offline   Reply With Quote
Unread 06-05-13, 10:21 PM   #9
Tonyleila
An Onyxian Warder
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 368
Originally Posted by p3lim View Post
Turn off the title.
Mahh I know I just turned the titel on to move it around outside the instance and then I turned it off again. And for the screenshot I just turned it on to show Phanx that its black
__________________
Author of: LeilaUI and Aurora: Missing Textures
__________________
Tonyleila is online now   Reply With Quote
Unread 06-06-13, 12:23 PM   #10
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 9,627
It might be up to Bazooka to configure the color of the title.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

Seerah is offline   Reply With Quote
Unread 06-06-13, 04:25 PM   #11
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 4,400
I also use Bazooka. Check the general options and change the Label Color to something other than black.

Also, you don't need to turn on the label to move the plugin. You can click and drag anywhere on the plugin, including on the text. If you want to see text when you're not in a group, change the DEFAULT_TEXT value at the top of the file to "Solo" or something.
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
Phanx is offline   Reply With Quote
Reply

Go BackWoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » Dungeon Difficulty / Minimap

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off