Download
(2Kb)
Download
Updated: 10-13-09 01:08 PM
Pictures
File Info
Updated:10-13-09 01:08 PM
Created:08-05-09 03:33 PM
Downloads:2,234
Favorites:14
MD5:

Achievement Link Fix

Version: 1.2
by: modus [More]

Colors completed achievements in chat to be green instead of yellow.

Ridiculously lightweight. If green isn't your thing, it's easily changeable in the add-on's file.

Version 1.2
Re-colored links that you send to someone else will no longer cause problems.

Version 1.1
Forgot to change the version in the TOC. Done now. No functional changes.

Version 1.1
By mistake, some garbage files got into the uploaded zip. It should be clean now. No functional changes.

Version 1.1
Changed to a different shade of green. It was the same green as is used for green items, so that wouldn't work. The new green looks more like a green-tinted yellow, which is appropriate for a completed achievement.

Version 1.0
Posted.
Post A Reply Comment Options
Unread 11-05-21, 03:05 PM  
zkpjy
A Kobold Labourer
 
zkpjy's Avatar

Forum posts: 0
File comments: 18
Uploads: 0
9.1.5 Fix:

Code:
--[[
AchievementLinkFix
// Colors linked achievements green.
By Moduspwnens of Shattered Hand
A very simple add-on to re-color achievement links that are completed. 
]]
--Below is the hex code for the color to be used for completed achievements.
--You can change it, but it must be a hex code.

ALF_ReplacementColor = "|cff99ff00"
local chatChannels = { 
	"CHAT_MSG_ACHIEVEMENT",
	"CHAT_MSG_BG_SYSTEM_ALLIANCE",
	"CHAT_MSG_BG_SYSTEM_HORDE",
	"CHAT_MSG_BN",
	"CHAT_MSG_BN_INLINE_TOAST_ALERT",
	"CHAT_MSG_BN_INLINE_TOAST_BROADCAST",
	"CHAT_MSG_BN_INLINE_TOAST_BROADCAST_INFORM",
	"CHAT_MSG_BN_INLINE_TOAST_CONVERSATION",
	"CHAT_MSG_BN_WHISPER",
	"CHAT_MSG_BN_WHISPER_INFORM",
	"CHAT_MSG_BN_WHISPER_PLAYER_OFFLINE",
	"CHAT_MSG_CHANNEL_LEAVE_PREVENTED",
	"CHAT_MSG_INSTANCE_CHAT",
	"CHAT_MSG_INSTANCE_CHAT_LEADER",
	"CHAT_MSG_OPENING",
	"CHAT_MSG_PARTY_LEADER",
	"CHAT_MSG_SYSTEM",
	"CHAT_MSG_TARGETICONS",
	"CHAT_MSG_TRADESKILLS",
	"CHAT_MSG_VOICE_TEXT",
	"CHAT_MSG_CHANNEL",
	"CHAT_MSG_CHANNEL_JOIN",
	"CHAT_MSG_CHANNEL_LEAVE",
	"CHAT_MSG_EMOTE",
	"CHAT_MSG_GUILD",
	"CHAT_MSG_GUILD_ACHIEVEMENT",
	"CHAT_MSG_OFFICER",
	"CHAT_MSG_PARTY",
	"CHAT_MSG_RAID",
	"CHAT_MSG_RAID_LEADER",
	"CHAT_MSG_RAID_WARNING",
	"CHAT_MSG_SAY",
	"CHAT_MSG_TEXT_EMOTE",
	"CHAT_MSG_WHISPER",
	"CHAT_MSG_WHISPER_INFORM",
	"CHAT_MSG_YELL",
}

--------------------------
-- OnLoad function
-- This should just initialize the message event filters. No filtering is actually done here.
--------------------------
function ALF_OnLoad(self, event, addon)
	-- Loads message event filters for each achievement type.
	for i=1, #(chatChannels) do
		ChatFrame_AddMessageEventFilter(chatChannels[i], ALF_OnChatReceived)
	end
	-- This is necessary because evidently macros hit this, but I won't be editing macros... just achievement links.
	hooksecurefunc('ChatEdit_ParseText', ALF_ParseText)
	AchievementLinkFix:UnregisterAllEvents()
	AchievementLinkFix:SetScript("OnEvent", nil)
end

--------------------------
-- OnChatReceived
-- This is the function that is passed each chat message's details. Filtering is done here.
--------------------------
function ALF_OnChatReceived(self, event, message, author, ...)
	local message = message
	if(strfind(message, "|cffffff00|Hachievement:") ~= nil) then
		-- There is an achievement in chat.
		local fullMessage = message
		while(fullMessage ~= nil) do
			-- Split the message by colons.
			part1, fullMessage = strsplit(":", fullMessage, 2)
			if(strfind(part1,"|Hachievement")) then
				-- If a resulting string contains the text used to make an achievement hyperlink
				local id,guid,completed,_ = strsplit(":", fullMessage)
				if(completed == "1") then
					-- If it's completed, figure out the beginning of the link based on the ID and GUID.
					-- This way we only recolor the achievement we want, rather than all of them in the message.
					local targetString = "|cffffff00|Hachievement:"..id..":"
					local replacementString = ALF_ReplacementColor.."|Hachievement:"..id..":"
					message = string.gsub(message, targetString, replacementString)
				end
			end
		end
		return false, message, author, ...
	end
	return false
end

--------------------------
-- ParseText
-- This function checks outgoing messages for achievement links colored green (invalid to the server) and 
-- sets them back to standard color.
--------------------------
function ALF_ParseText(chatEntry, send)
	if (send == 1) then
		-- This message is being sent.
		local message = chatEntry:GetText()
		if(strfind(message,  ALF_ReplacementColor.."|Hachievement")) then
			local targetString =  ALF_ReplacementColor.."|Hachievement"
			local replacementString = "|cffffff00|Hachievement"
			message = string.gsub(message, targetString, replacementString)
			chatEntry:SetText(message)
		end
	end
end

-- This done to create the frame so it need not be done in XML.
local AchievementLinkFix = CreateFrame("Frame", "AchievementLinkFix")
AchievementLinkFix:RegisterEvent("ADDON_LOADED")
AchievementLinkFix:SetScript("OnEvent", ALF_OnLoad)
Last edited by zkpjy : 11-05-21 at 03:10 PM.
Report comment to moderator  
Reply With Quote
Unread 02-08-10, 09:45 AM  
modus
A Deviate Faerie Dragon
 
modus's Avatar
AddOn Author - Click to view AddOns

Forum posts: 14
File comments: 7
Uploads: 4
Originally posted by ezarra
Would it be possible to add your current progress on an achievement to the tooltip window, or show "You completed this on dd/mm/yyyy"

There used to be an addon (Enhanced Achievement) that did this, but it hasn't worked in a long time.

Oh, and while we're at it, it SHOULD be coloring the link based on if *I* have completed the achievement, not if the person linking it has.
Well, you're just looking for a different add-on then. I designed this add-on to specifically color it based on whether or not the linked achievement is completed. Basically, I was tired of seeing achievements linked to me (whether in trade, raid, guild, whisper, etc.) and then having to click them just to see whether or not they are completed.
__________________
Report comment to moderator  
Reply With Quote
Unread 02-04-10, 01:34 PM  
ezarra
A Flamescale Wyrmkin
AddOn Author - Click to view AddOns

Forum posts: 123
File comments: 47
Uploads: 2
Would it be possible to add your current progress on an achievement to the tooltip window, or show "You completed this on dd/mm/yyyy"

There used to be an addon (Enhanced Achievement) that did this, but it hasn't worked in a long time.

Oh, and while we're at it, it SHOULD be coloring the link based on if *I* have completed the achievement, not if the person linking it has.
Last edited by ezarra : 02-04-10 at 02:27 PM.
Report comment to moderator  
Reply With Quote
Unread 10-13-09, 01:47 PM  
modus
A Deviate Faerie Dragon
 
modus's Avatar
AddOn Author - Click to view AddOns

Forum posts: 14
File comments: 7
Uploads: 4
Originally posted by Banur
It seems to disconnect me from the server everytime I link a colored achivement.
The newest update fixes this issue. I didn't realize there was such an easy way to fix it until today.
__________________
Last edited by modus : 10-13-09 at 01:47 PM.
Report comment to moderator  
Reply With Quote
Unread 08-28-09, 04:01 PM  
Banur
A Murloc Raider
AddOn Author - Click to view AddOns

Forum posts: 7
File comments: 137
Uploads: 5
It seems to disconnect me from the server everytime I link a colored achivement.
Report comment to moderator  
Reply With Quote
Unread 08-23-09, 06:19 PM  
DaemonSambe
A Kobold Labourer
 
DaemonSambe's Avatar
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 169
Uploads: 2
i thought the point was to identify what 'you' - the player, has completed when a link is posted.
I see link: [The Battle for Mount Hyjal] - have i completed it or not... color it accordingly.

I guesss anything else, i don't really care about, so my misunderstanding.
Report comment to moderator  
Reply With Quote
Unread 08-23-09, 03:37 PM  
modus
A Deviate Faerie Dragon
 
modus's Avatar
AddOn Author - Click to view AddOns

Forum posts: 14
File comments: 7
Uploads: 4
Re: Doesn't work?

Originally posted by DaemonSambe
Doesn't really seem to work. All of the achievements linked in guild, or part of guild spam, show as completed.
And everything else, shows as not completed. Although sometimes i shows as completed when i have not, but the other person has...
No rhyme or reason.
Well, anything linked as part of guild spam should certainly be completed. I haven't had an issue yet, but if you'd like to help, post or PM me with some screenshots of an achievement which you've clicked that is incorrectly colored.

Basically, any achievement link that, when clicked, says "completed by" rather than "in progress" should be tinted green.
__________________
Last edited by modus : 08-23-09 at 04:57 PM.
Report comment to moderator  
Reply With Quote
Unread 08-23-09, 03:32 PM  
DaemonSambe
A Kobold Labourer
 
DaemonSambe's Avatar
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 169
Uploads: 2
Doesn't work?

Doesn't really seem to work. All of the achievements linked in guild, or part of guild spam, show as completed.
And everything else, shows as not completed. Although sometimes i shows as completed when i have not, but the other person has...
No rhyme or reason.
Report comment to moderator  
Reply With Quote
Unread 08-10-09, 11:14 AM  
High Five
A Kobold Labourer
 
High Five's Avatar
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 30
Uploads: 2
Nifty. I'll be using this one.
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: