Thread Tools Display Modes
10-27-10, 06:30 PM   #1
Precision
A Deviate Faerie Dragon
Join Date: Sep 2010
Posts: 14
ICU/Personal sentry

for many years those two addons have allowed hunters to target using their minimap. both authors stopped around LK time, so the only one that has worked up until 4.0.1 is ICU, which only worked if you had sexymap installed.

Now, regardless of having sexymap installed, ICU and Personal sentry no longer work.

The addons are not against the rules, for you cannot minimap target while in combat with the addons. only outside of combat. It just takes someone with knowledge of programing addons to fix them to work with 4.0.1

I'd do it myself but i know 0 things about making an addon. i wish there was an easy learning process, but there isn't.
  Reply With Quote
10-28-10, 05:00 PM   #2
Precision
A Deviate Faerie Dragon
Join Date: Sep 2010
Posts: 14
anyone? no one at all?
  Reply With Quote
10-29-10, 04:39 PM   #3
Precision
A Deviate Faerie Dragon
Join Date: Sep 2010
Posts: 14
lalala.........
  Reply With Quote
10-29-10, 05:23 PM   #4
Maul
Ion Engines, Engage!
 
Maul's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 401
You left out the detail that this was on beta.

As I told you on the UI & Macros forum, this is a current bug on Blizzard's end that affects many addons while using the beta client. The fix will show up in a future beta patch. There is no work-a-round. You just have to wait.
__________________

Twitter: @IonMaul | Windows Live: [email protected] | Google Talk: [email protected]
  Reply With Quote
10-29-10, 05:28 PM   #5
Precision
A Deviate Faerie Dragon
Join Date: Sep 2010
Posts: 14
Originally Posted by Maul View Post
You left out the detail that this was on beta.

As I told you on the UI & Macros forum, this is a current bug on Blizzard's end that affects many addons while using the beta client. The fix will show up in a future beta patch. There is no work-a-round. You just have to wait.
ICU and personal sentry has been broken for a while now. the authors no longer develop on it.

plus i am not on the beta.

ICU has been broken since WOTLK came out. it's just had 10% of it's features working as long as you have sexymap installed. which is only the option of clicking the minimap blips and having a dropdown menu of the players clicked. changing the settings wont work, and hasn't worked for a long time.
  Reply With Quote
10-29-10, 05:29 PM   #6
Precision
A Deviate Faerie Dragon
Join Date: Sep 2010
Posts: 14
Originally Posted by Maul View Post
You left out the detail that this was on beta.

As I told you on the UI & Macros forum, this is a current bug on Blizzard's end that affects many addons while using the beta client. The fix will show up in a future beta patch. There is no work-a-round. You just have to wait.
also hey, where did you learn to make addons?
  Reply With Quote
10-29-10, 05:37 PM   #7
Precision
A Deviate Faerie Dragon
Join Date: Sep 2010
Posts: 14
Originally Posted by Maul View Post
You left out the detail that this was on beta.

As I told you on the UI & Macros forum, this is a current bug on Blizzard's end that affects many addons while using the beta client. The fix will show up in a future beta patch. There is no work-a-round. You just have to wait.
also do you want ICU's source code? i can give it to you.

Code:
------------------------------------------------------------------------------
-- Globals
------------------------------------------------------------------------------

-- Version
ICU_VERSION = "ICU v2.0.5b r003 by Minihunt. Based on Pdor @ Ravencrest modified ICU.";

-- Maximum number of lines for the popup menu, as defined in the XML file.
ICU_MAX_LINES = 10;

tooltip_class_color = { }

ICU_CLASSES = { };

debug_mode = false;

-- Last known ping position
ICU_PING_X = 0;
ICU_PING_Y = 0;

last_pinged = "";
local ICU_prevtooltip = nil;
local _bgMode = false;

------------------------------------------------------------------------------
-- OnFoo() functions
------------------------------------------------------------------------------

function ICU_OnLoad()

    this:RegisterEvent("ZONE_CHANGED_NEW_AREA");
    this:RegisterEvent("ZONE_CHANGED");
    this:RegisterEvent("ZONE_CHANGED_INDOORS");
    this:RegisterEvent("PLAYER_ENTERING_WORLD");

	this:RegisterEvent("VARIABLES_LOADED");
	this:RegisterEvent("PLAYER_TARGET_CHANGED");
	this:RegisterEvent("UPDATE_BATTLEFIELD_SCORE");

	this:RegisterEvent("CHAT_MSG_BG_SYSTEM_NEUTRAL");
	this:RegisterEvent("UPDATE_BATTLEFIELD_SCORE");


	-- Function hook. ICU depends on Blizzard's
	-- Minimap_OnClick() event function to activate.
	lOriginal_Minimap_OnClick_Event = Minimap_OnClick;
	Minimap_OnClick = ICU_Minimap_OnClick_Event;

	SlashCmdList["ICU"] = function(msg)
		ICU_Slash(msg);
	end

	SLASH_ICU1 = "/ICU";
	SLASH_ICU2 = "/ICU";

end

function ICU_InitializeLocals()
	
	tooltip_class_color = {
		[CLASS_WARRIOR] = "ffc69b6d",
		[CLASS_MAGE] = "ff68cce5",
		[CLASS_ROGUE] = "fffff469",
		[CLASS_DRUID] = "ffff7d0a",
		[CLASS_HUNTER] = "ffabd473",
		[CLASS_SHAMAN] = "fff48cba",
		[CLASS_PRIEST] = "ffffffff",
		[CLASS_WARLOCK] = "ff9382C9",
		[CLASS_PALADIN] = "fff48cba"
	}

	ICU_CLASSES = {
		[CLASS_WARRIOR] = { .25, 0, 0, .25; },
		[CLASS_MAGE] = { .5, .25, 0, .25; },
		[CLASS_ROGUE] = { .75, .5, 0, .25; },
		[CLASS_DRUID] = { 1, .75, 0, .25; },
		[CLASS_HUNTER] = { .25, 0, .25, .5; },
		[CLASS_SHAMAN] = { .5, .25, .25, .5; },
		[CLASS_PRIEST] = { .75, .5, .25, .5; },
		[CLASS_WARLOCK] = { 1, .75, .25, .5; },
		[CLASS_PALADIN] = { .25, 0, .5, .75; }
	};

end

function ICU_GetFoundString( name, data )
	local found = name .. " (" ..  data.Level
	if data.Race ~= nil then
		found = found .. data.Race;
	end

	found = found .. " " .. data.Class .. ")";

	if data.Zone ~= nil and data.Zone ~= "" then
		found = found .. ". Last seen at " .. data.Zone;
	end
	if data.SubZone ~= nil and data.SubZone ~= "" then
		found = found .. "/" .. data.SubZone;
	end

	return found;

end

function ICU_SearchTarget( target )
	local counter = 0;
	local nilcount = 0;
	local found = "";
	DEFAULT_CHAT_FRAME:AddMessage( SEARCH_TARGET_SEARCH .. ":" .. target , 1, 1, 1 );

	--enemy players
	for name, data in pairs(ICUvars.EnemyPlayers) do
		if( string.find( string.upper( name ), target ) ) then
			found = ICU_GetFoundString( name, data );
			counter = counter + 1;
			DEFAULT_CHAT_FRAME:AddMessage( counter .. ":" .. found , 1, 0, 0 );
		end
	end

	--enemy mobs
	for name, data in pairs(ICUvars.EnemyMobs) do
		if( string.find( string.upper( name ), target ) ) then
			found = ICU_GetFoundString( name, data );
			counter = counter + 1;
			DEFAULT_CHAT_FRAME:AddMessage( counter .. ":" .. found , 1, .50, 0 );
		end
	end

	--friendly players
	for name, data in pairs(ICUvars.FriendlyPlayers) do
		if( string.find( string.upper( name ), target ) ) then
			found = ICU_GetFoundString( name, data );
			counter = counter + 1;
			DEFAULT_CHAT_FRAME:AddMessage( counter .. ":" .. found , 0, 1, 0 );
		end
	end

	--friendly mobs
	for name, data in pairs(ICUvars.FriendlyMobs) do
		if( string.find( string.upper( name ), target ) ) then
			found = ICU_GetFoundString( name, data );
			counter = counter + 1;
			DEFAULT_CHAT_FRAME:AddMessage( counter .. ":" .. found , .70, 1, .70 );
		end
	end
	
	DEFAULT_CHAT_FRAME:AddMessage( SEARCH_TARGET_FOUND .. ":" .. counter .. " entries." , 1, 1, 1 );
end

function ICU_Slash(msg)

	msg = string.upper(msg);
	if( string.find( msg, OPT_OPTIONS ) ) then
		ICU_OptionsForm_InitializeOptions();
		ICU_OptionsForm:Show();
	elseif( string.find( msg, OPT_SEARCH ) ) then
		for target in string.gmatch( msg, OPT_SEARCH.." (%a+)" ) do
			ICU_SearchTarget( target );
		end
	elseif( string.find( msg, OPT_DEBUG ) ) then
		debug_mode = not debug_mode;
		if( debug_mode ) then
			DEFAULT_CHAT_FRAME:AddMessage(OPT_DEBUG_ON, 1, 1, 0 );
		else
			DEFAULT_CHAT_FRAME:AddMessage(OPT_DEBUG_OFF, 1, 1, 0 );
		end
	else
		DEFAULT_CHAT_FRAME:AddMessage( ICU_VERSION, 1, 1, 1 );
		DEFAULT_CHAT_FRAME:AddMessage(HELP_COMMAND1, 1, 1, 0 );
		DEFAULT_CHAT_FRAME:AddMessage(HELP_COMMAND2, 1, 1, 1 );
		DEFAULT_CHAT_FRAME:AddMessage(HELP_COMMAND3, 1, 1, 0 );
		DEFAULT_CHAT_FRAME:AddMessage(HELP_COMMAND4, 1, 1, 1 );
		DEFAULT_CHAT_FRAME:AddMessage(HELP_COMMAND5, 0, .75, 0 );
		DEFAULT_CHAT_FRAME:AddMessage(HELP_ANNOUNCE..": "..ICUvars.announce.." "..HELP_ANCHOR..": "..ICUvars.anchor .. " "..HELP_ICON_INDEX.." : " .. ICUvars.iconindex .. " " .. HELP_STORAGE_MODE .. " : " .. ICUvars.storage, 0, .75, 0 );
	end

end

function ICU_CountPairs( pairtable )
	local counter = 0;

	for name, data in pairs( pairtable ) do
		counter = counter + 1
	end

	return counter;

end

function ICU_OnEvent(event, eventdata)

	if( event == "VARIABLES_LOADED" ) then
		ICU_InitializeLocals();
		ICU_LoadSavedVariables();
		ICU_SetPoints();
		ICU_OptionsForm:Hide();
		ICU_OptionsForm_InitializeOptions();

		-- Inform user ICU is loaded.
		if( DEFAULT_CHAT_FRAME ) then
			DEFAULT_CHAT_FRAME:AddMessage( ICU_VERSION );
			DEFAULT_CHAT_FRAME:AddMessage( MSG_DBLOADED1 .. ". " .. (ICU_CountPairs(ICUvars.EnemyMobs) + ICU_CountPairs(ICUvars.FriendlyMobs) ) .. " " .. MSG_DBLOADED2 .. " " .. (ICU_CountPairs( ICUvars.EnemyPlayers ) + ICU_CountPairs( ICUvars.FriendlyPlayers )) .. " " .. MSG_DBLOADED3 .. ". (" .. GetLocale() .. ")" );
		end

		return;
	end

	if( event == "PLAYER_TARGET_CHANGED" ) then

		if( UnitName( "target" ) ~= nil ) then

			local unitname = ICU_GetNoNilValue( UnitName( "target" ) );
			local level = ICU_GetNoNilValue( UnitLevel( "target" ) );
			local class = ICU_GetNoNilValue( UnitClass( "target" ) );
			local friend = ICU_GetNoNilValue( UnitIsFriend( "target", "player" ));
			local player = ICU_GetNoNilValue( UnitIsPlayer( "target" ));
			local race = UnitRace( "target" );

			targetData = ICU_GetUnitData( unitname );

			--this data may vary.
			targetData.Zone = GetRealZoneText();
			targetData.SubZone = GetSubZoneText();

			if tonumber(targetData.Level) == 0 then
				ICU_DebugEcho( DEBUG_UNK_UNIT );
				targetData.Class = class;
				targetData.Race = race;
			end

			--if( UnitCreatureType( "target" ) == "Demon" or UnitCreatureType( "target" ) == "Beast" ) then
			--	--set the class to PET
			--	targetData.Class = "Pet";
			--end

			targetData.Level = level;
			targetData.IsTemp = _bgMode;
			ICU_AddDBEntry( unitname, targetData, (friend ~= "1"), player == "1" );

		end
		return;
	end

	if( event == "UPDATE_BATTLEFIELD_SCORE" ) then

		ICU_DebugEcho( DEBUG_TOTAL_SCORES .. " : " .. GetNumBattlefieldScores() );

		for i=1, GetNumBattlefieldScores()  do
			name, killingBlows, honorableKills, deaths, honorGained, faction, rank, race, class = GetBattlefieldScore(i);

			--ive to remove the BG -SERVERNAME

			if (string.find(name, "-") ~= nil) then
				_, _, name = string.find(name, "(.*)-(.*)")
			end

			targetData = ICU_GetUnitData( name );

			if( targetData.Zone == "" ) then
				targetData.Zone = GetRealZoneText();
				targetData.SubZone = GetSubZoneText();
			end
			targetData.Class = class;
			targetData.Race = race;
			targetData.Level = 70;
			targetData.IsTemp = true;

			if( (UnitFactionGroup("player") == "Horde" and faction == 0) or (UnitFactionGroup("player") == "Alliance" and faction == 1) ) then
				--friend
				ICU_AddDBEntry( name, targetData, false, true );
			else
				--enemy
				ICU_AddDBEntry( name, targetData, true, true );
			end

		end

	end

	if( event == "UPDATE_BATTLEFIELD_SCORE" or event == "CHAT_MSG_BG_SYSTEM_NEUTRAL" ) then
		--score request, will update next time
		ICU_DebugEcho( DEBUG_RENEWING_BG_SCORES );
		RequestBattlefieldScoreData();
		return;
	end

	local zonetext = GetRealZoneText();

	if( ICU_ZoneIsABG( zonetext ) ) then
		ICU_DebugEcho( DEBUG_BG_MODE_ON );
		_bgMode = true;
	else
		ICU_DebugEcho( DEBUG_BG_MODE_OFF );
		_bgMode = false;
	end

end

function ICU_LoadSavedVariables()

	if( not ICUvars ) then
		ICUvars = {};
		ICUvars.anchor = "BOTTOMRIGHT";
		ICUvars.storage = "ALL";
		ICUvars.announce = "OFF";
		ICUvars.iconindex = 1;
		ICUvars.DBVersion = 2;			--2nd DB Revision
		ICUvars.PingMode = "DEFAULT";
		ICUvars.ColorMode = "CLASS";
	end

	if not ICUvars.EnemyMobs then
		ICUvars.EnemyMobs = {};
	end

	if not ICUvars.FriendlyMobs then
		ICUvars.FriendlyMobs = {};
	end

	if not ICUvars.EnemyPlayers then
		ICUvars.EnemyPlayers = {};
	end

	if not ICUvars.FriendlyPlayers then
		ICUvars.FriendlyPlayers = {};
	end

	if( ICUvars.ColorMode == nil ) then
		ICUvars.ColorMode = "CLASS";
	end

	if( ICUvars.iconindex == nil ) then
		ICUvars.iconindex = 1;
	end

	if( ICUvars.storage == nil ) then
		ICUvars.storage = "ALL";
	end

	if( ICUvars.announce == "PR" ) then
		ICUvars.announce = "AUTO";
	end

	if( ICUvars.PingMode == nil ) then
		ICUvars.PingMode = "DEFAULT";
	end

	--Colors
	if( ICUvars.EnemyPlayer == nil ) then

		ICUvars.EnemyPlayer = {};
		ICUvars.EnemyPlayer.r = 1;
		ICUvars.EnemyPlayer.g = 0;
		ICUvars.EnemyPlayer.b = 0;

		ICUvars.EnemyNPC = {};
		ICUvars.EnemyNPC.r = 1;
		ICUvars.EnemyNPC.g = .3;
		ICUvars.EnemyNPC.b = .3;

		ICUvars.FriendlyPlayer = {};
		ICUvars.FriendlyPlayer.r = 0;
		ICUvars.FriendlyPlayer.g = 1;
		ICUvars.FriendlyPlayer.b = 0;

		ICUvars.FriendlyNPC = {};
		ICUvars.FriendlyNPC.r = .3;
		ICUvars.FriendlyNPC.g = 1;
		ICUvars.FriendlyNPC.b = .3;

		ICUvars.UNKPlayer = {};
		ICUvars.UNKPlayer.r = 1;
		ICUvars.UNKPlayer.g = .5;
		ICUvars.UNKPlayer.b = .5;

		ICUvars.UNKNPC = {};
		ICUvars.UNKNPC.r = 1;
		ICUvars.UNKNPC.g = .8;
		ICUvars.UNKNPC.b = .8;


	end

	--Colors end

	ICU_ConvertOldDB();
	ICU_PurgeTempEntries();

end

function ICU_ZoneIsABG( zone )
	if( zone == ZONE_ARATHI_BASIN or zone == ZONE_ALTERAC_VALLEY or zone == ZONE_WARSONG_GULCH or zone == ZONE_EYE_OF_THE_STORM ) then
		return true;
	else
		return false;
	end

end

function ICU_PurgeTempEntries()

	local purged = 0;

	--enemy players
	for name, data in pairs(ICUvars.EnemyPlayers) do
		if( data.IsTemp and ICU_ZoneIsABG( data.Zone ) ) then
			ICUvars.EnemyPlayers[name] = nil;
			purged = purged + 1
		end
	end

	--enemy mobs
	for name, data in pairs(ICUvars.EnemyMobs) do
		if( data.IsTemp and ICU_ZoneIsABG( data.Zone ) ) then
			ICUvars.EnemyMobs[name] = nil;
			purged = purged + 1
		end
	end

	--friendly players
	for name, data in pairs(ICUvars.FriendlyPlayers) do
		if( data.IsTemp and ICU_ZoneIsABG( data.Zone ) ) then
			ICUvars.FriendlyPlayers[name] = nil;
			purged = purged + 1
		end
	end

	--friendly mobs
	for name, data in pairs(ICUvars.FriendlyMobs) do
		if( data.IsTemp and ICU_ZoneIsABG( data.Zone ) ) then
			ICUvars.FriendlyMobs[name] = nil;
			purged = purged + 1
		end
	end

	DEFAULT_CHAT_FRAME:AddMessage( MSG_PURGE1 .. " " .. purged .. " " .. MSG_PURGE2 .. "." , 1, 1 ,1 );

end

function ICU_GetNoNilValue( value )
	if value == nil then
		return "<Unknown>";
	else
		return "" .. value;
	end
end

function ICU_SetPoints() --Fedos

	ICU_Popup:ClearAllPoints();
	ICU_PopupSecure:ClearAllPoints();
	if( ICUvars.anchor == "BOTTOMRIGHT" ) then
		ICU_Popup:SetPoint("TOPRIGHT", "Minimap", "BOTTOMRIGHT", 0, 0 );
		ICU_PopupSecure:SetPoint("TOPRIGHT", "Minimap", "BOTTOMRIGHT", 0, 0 );
	elseif( ICUvars.anchor == "TOPRIGHT" ) then
		ICU_Popup:SetPoint("BOTTOMRIGHT", "Minimap", "TOPRIGHT", 0, 0 );
		ICU_PopupSecure:SetPoint("BOTTOMRIGHT", "Minimap", "TOPRIGHT", 0, 0 );
	elseif( ICUvars.anchor == "BOTTOM" ) then
		ICU_Popup:SetPoint("TOP", "Minimap", "BOTTOM", 0, 0 );
		ICU_PopupSecure:SetPoint("TOP", "Minimap", "BOTTOM", 0, 0 );
	elseif( ICUvars.anchor == "TOP" ) then
		ICU_Popup:SetPoint("BOTTOM", "Minimap", "TOP", 0, 0 );
		ICU_PopupSecure:SetPoint("BOTTOM", "Minimap", "TOP", 0, 0 );
	elseif( ICUvars.anchor == "BOTTOMLEFT" ) then
		ICU_Popup:SetPoint("TOPLEFT", "Minimap", "BOTTOMLEFT", 0, 0 );
		ICU_PopupSecure:SetPoint("TOPLEFT", "Minimap", "BOTTOMLEFT", 0, 0 );
	elseif( ICUvars.anchor == "TOPLEFT" ) then
		ICU_Popup:SetPoint("BOTTOMLEFT", "Minimap", "TOPLEFT", 0, 0 );
		ICU_PopupSecure:SetPoint("BOTTOMLEFT", "Minimap", "TOPLEFT", 0, 0 );
	elseif( ICUvars.anchor == "RIGHT" ) then
		ICU_Popup:SetPoint("RIGHT", "Minimap", "LEFT", 0, 0 );
		ICU_PopupSecure:SetPoint("RIGHT", "Minimap", "LEFT", 0, 0 );
	elseif( ICUvars.anchor == "LEFT" ) then
		ICU_Popup:SetPoint("LEFT", "Minimap", "RIGHT", 0, 0 );
		ICU_PopupSecure:SetPoint("LEFT", "Minimap", "RIGHT", 0, 0 );
	else
		--No data? BOTTOMRIGHT...
		ICUvars.anchor = "BOTTOMRIGHT";
		ICU_Popup:SetPoint("TOPRIGHT", "Minimap", "BOTTOMRIGHT", 0, 0 );
		ICU_PopupSecure:SetPoint("TOPRIGHT", "Minimap", "BOTTOMRIGHT", 0, 0 );
	end
end


function ICU_Popup_OnUpdate()
	-- Called every tick when popup is activated. Clears the popup menu if mouse is not over it or the Minimap.
	if( not MouseIsOver( Minimap ) and not MouseIsOver( ICU_Popup ) and not MouseIsOver( ICU_PopupSecure ) ) then
		ICU_Clear_Popup();
		ICU_DebugEcho( "ICU_Popup_OnUpdate(): ICU_Clear_Popup()" ); --Fedos
	end
end

function ICU_UserWantsToPing()

	--Default mode : ping
	if( ICUvars.PingMode == "OFF" ) then
		return true;
	end

	--Outside bg only
	if( ICUvars.PingMode == "OUTSIDE BG" and not ICU_ZoneIsABG( GetRealZoneText() ) ) then
		return true;
	end

	--Inside bg only
	if( ICUvars.PingMode == "INSIDE BG" and ICU_ZoneIsABG( GetRealZoneText() ) ) then
		return true;
	end

	--No ping
	return false;

end

function ICU_ButtonClick()


	local data = this.ICU_DATA;
	local text = this:GetText();

	-- Ping the last known location of selected target.
	if( not IsControlKeyDown() ) then

		if( ICU_UserWantsToPing() ) then
			Minimap:PingLocation( ICU_PING_X, ICU_PING_Y );
		end

		-- Display the target in party chatbox if player is in a party
		if( ICUvars.announce ~= "SELF" ) and (ICUvars.announce ~= "OFF") then
			if( ICUvars.announce ~= "ONION" and ICUvars.announce ~= "AUTO" ) then
				if( ICUvars.announce == "GROUP" ) then
					SendChatMessage( text  .. ".", "PARTY" );
				else
					SendChatMessage( text  .. ".", ICUvars.announce );
				end
			else
				if( GetNumRaidMembers() > 0 ) then
					SendChatMessage( text  .. ".", "RAID" );
				elseif ( GetNumPartyMembers() > 0 ) then
					SendChatMessage( text  .. ".", "PARTY" );
				else
					DEFAULT_CHAT_FRAME:AddMessage(text  .. ".", 1, 1, 0.0 );
				end
			end
		elseif( ICUvars.announce == "SELF" ) then
			DEFAULT_CHAT_FRAME:AddMessage( text .. ".", 1, 1, 1 );
		end

	else
		DEFAULT_CHAT_FRAME:AddMessage( text .. ".", 1, 1, 1 );
	end

	last_pinged = data;

	--Aggiorno la macro
	--local index = GetMacroIndexByName( "ICU_LastTarget" );

	this:SetAttribute("type", "macro") --Fedos
	this:SetAttribute("macrotext", "/target " .. last_pinged) --Fedos

	--EditMacro(index, "ICU_LastTarget", ICUvars.iconindex, "/target " .. last_pinged, false);
end

------------------------------------------------------------------------------
-- OnFoo() hooked function
------------------------------------------------------------------------------

function ICU_PreParseNames( names )

	local ret = "";

	if( names == nil ) then
		return;
	end

	local wasreturn = false;

	for target in string.gmatch( names, "[^\n]*" ) do
		if( string.len( target ) > 0 ) then
			--colorize names
			ret = ret .. ICU_ColorizeTooltipText( target );
			wasreturn = false;
		else
			if( not wasreturn ) then
				ret = ret .. "\n";
				wasreturn = true;
			end
		end
	end

	return ret;

end

function ICU_ColorizeTooltipText( target )

	local color = "";
	local class_color = "";

	targetData = ICU_GetEnemyPlayer( target );

	if targetData == nil then

		targetData = ICU_GetFriendlyPlayer( target );

		if targetData == nil then

			targetData = ICU_GetEnemyMob( target );

			if targetData == nil then

				targetData = ICU_GetFriendlyMob( target );

				if targetData == nil then
					targetData = ICU_GetEmptyTargetEntry();
					--not known
					color = ICUvars.UNKPlayer;
				else
					color = ICUvars.FriendlyNPC;

				end

			else
				--enemy mob?
				color = ICUvars.EnemyNPC;

			end

		else
			color = ICUvars.FriendlyPlayer;
		end
	else
		color = ICUvars.EnemyPlayer;
	end

	return '|c' .. ICU_GetHexColor( color ) .. target .. '|r' .. ICU_GetClassColor( targetData );
end

function ICU_GetHexColor( color )

	local rh = string.format( "%x", color.r * 255 );
	local gh = string.format( "%x", color.g * 255 );
	local bh = string.format( "%x", color.b * 255 );

	if( string.len( rh ) == 1 ) then
		rh = "0" .. rh;
	end

	if( string.len( gh ) == 1 ) then
		gh = "0" .. gh;
	end

	if( string.len( bh ) == 1 ) then
		bh = "0" .. bh;
	end

	return "ff" .. rh .. gh .. bh;

end

function ICU_GetClassColor( data )

	local ret = "";

	if( ICUvars.ColorMode == "NORMAL" ) then
		return "";
	end

	if( data == nil or data.Class == nil or tooltip_class_color[data.Class] == nil ) then
		return "";
	end

	if( ICUvars.ColorMode ~= "CLASS LEVEL" or data.Level  == nil or tonumber( data.Level ) == 0 ) then
		return '|c' .. tooltip_class_color[data.Class] .. " [" .. data.Class .. ']|r'
	else
		return '|c' .. tooltip_class_color[data.Class] .. " [" .. data.Level .. " " .. data.Class .. ']|r'
	end


end


function ICU_Minimap_OnClick_Event(self)
	if( IsShiftKeyDown() ) then
		-- SHIFT key is pressed, returns control to original function.
		lOriginal_Minimap_OnClick_Event(self);
	else
		-- Shift key is up
		if ( GameTooltip:IsVisible() ) then

			-- Grab the cursor x/y position within Minimap and saves it
			local x, y = GetCursorPosition();
			x = x / this:GetEffectiveScale();
			y = y / this:GetEffectiveScale();

			local cx, cy = this:GetCenter();
			ICU_PING_X = x - cx;
			ICU_PING_Y = y - cy;

			-- Clear all display
			ICU_Clear_Popup();
			ICU_DebugEcho( "ICU_Minimap_OnClick_Event(): ICU_Clear_Popup()" ); --Fedos

			-- Grab the tooltip and send it to be processed
			ICU_Process_Tooltip( GameTooltipTextLeft1:GetText() );

			-- Play a clicky sound
			PlaySound( "UChatScrollButton" );

		end
	end

end

------------------------------------------------------------------------------
-- Internal functions
------------------------------------------------------------------------------

-- Receives the tooltip and process it. Tooltip is in this format:
-- "Target1" or "Target1\nTarget2\nTarget3\nTarget4"
function ICU_Process_Tooltip( tooltip, silent )

	local pos = 0;
	local width = 0;
	local result_line, r, g, b, target, class, health, rank;
	local prev_trg = nil;
	local targetData = nil;
	local isenemy = false;
	local isplayer = false;

	-- Hook the functions TargetFrame_OnShow() and TargetFrame_OnHide() in TargetFrame.lua
	-- The purpose is to stop it from playing sound when we cycle targets. Playing targetting
	-- sound while cycling targets makes the CPU crawl.
    local lOriginal_TargetFrame_OnShow_Event = TargetFrame_OnShow;
    local lOriginal_TargetFrame_OnHide_Event = TargetFrame_OnHide;
    TargetFrame_OnShow = ICU_TargetFrame_OnShow_Event;
    TargetFrame_OnHide = ICU_TargetFrame_OnHide_Event;
	local lOriginal_ERR_UNIT_NOT_FOUND = ERR_UNIT_NOT_FOUND;
	local lOriginal_ERR_GENERIC_NO_TARGET = ERR_GENERIC_NO_TARGET;
	ERR_UNIT_NOT_FOUND = "";
	ERR_GENERIC_NO_TARGET = "";

	local ICU_UsinSecureFrame = (not UnitAffectingCombat("player")); --Fedos
	local isSecure;
	if ICU_UsinSecureFrame then
		isSecure = "Secure";
	else
		isSecure = "";
	end --Fedos

	-- Grabs anything that's not control character \newline
	-- one at a time within the following loop
	for target in string.gmatch( tooltip, "[^\n]*" ) do

		-- string.gmatch will return an empty string when it
		-- encounters "not \newline", skip it
		if( string.len( target ) > 0 ) then

			--strip colors
			target = ICU_Process_Trg( target );

			--Get Target Info
			targetData = ICU_GetEnemyPlayer( target );
			if targetData == nil then
				targetData = ICU_GetFriendlyPlayer( target );
				if targetData == nil then
					targetData = ICU_GetEnemyMob( target );
					if targetData == nil then
						targetData = ICU_GetFriendlyMob( target );
						if targetData == nil then
							ICU_DebugEcho( "No data for " .. target );
							targetData = ICU_GetEmptyTargetEntry();
						end
					else
						isenemy = true;
						isplayer = false;
						ICU_DebugEcho( "Enemy:TRUE -- Player:FALSE" );
					end
				else
					isenemy = false;
					isplayer = true;
					ICU_DebugEcho( "Enemy:FALSE -- Player:TRUE" );
				end
			else
				isenemy = true;
				isplayer = true;
				ICU_DebugEcho( "Enemy:TRUE -- Player:TRUE" );
			end

			--okk...
			if( targetData ~= nil ) then
				-- The target's position on popup menu
				pos = pos + 1;
				health = 100;
				-- Get the button position and display the result_line
				local button = getglobal("ICU_PopupButton"..pos..isSecure.."Button"); --Fedos
				local bar = getglobal("ICU_PopupButton"..pos..isSecure.."ButtonBar");
				local bg = getglobal("ICU_PopupButton"..pos..isSecure.."ButtonBGBar");
				local bgtext = getglobal("ICU_PopupButton"..pos..isSecure.."ButtonBarLeftText");
				local classicon = getglobal("ICU_PopupButton"..pos..isSecure.."ButtonClassIcon"); --Fedos

				local message = target;
				local hsdata = target;

				r = 255;
				g = 0;
				b = 0;

				button:SetAttribute("target", target );

				--known target : ive it in my db
				if tonumber(targetData.Level) > 0 then

					if( ICU_CLASSES[ targetData.Class ] ) then
						classicon:SetTexCoord(unpack(ICU_CLASSES[ targetData.Class ]));
					else
						classicon:SetTexCoord(0, .25, 0, .25);
					end
					classicon:SetTexture("Interface\\Glues\\CharacterCreate\\UI-CharacterCreate-Classes");
					
					if isplayer then
						race = targetData.Race;
						if( race == nil ) then
							message = message .. " (" .. targetData.Level .. " " .. targetData.Class .. ")";
						else
							message = message .. " (" .. targetData.Level .. " " .. targetData.Race .. " " .. targetData.Class .. ")";
						end
						if isenemy then
							r = ICUvars.EnemyPlayer.r;
							g = ICUvars.EnemyPlayer.g;
							b = ICUvars.EnemyPlayer.b;
						else
							r = ICUvars.FriendlyPlayer.r;
							g = ICUvars.FriendlyPlayer.g;
							b = ICUvars.FriendlyPlayer.b;
						end
						--Pet?
						--if(targetData.Class == "Pet") then
						--	classicon:SetTexCoord(0, 1, 0, 1);
						--	classicon:SetTexture("Interface\\AddOns\\ICU\\images\\pet_unit");
						--end
					else
						--Pet?
						--if(targetData.Class == "Pet") then
						--	classicon:SetTexCoord(0, 1, 0, 1);
						--	classicon:SetTexture("Interface\\AddOns\\ICU\\images\\pet_unit");
						--end

						message  = "NPC : " .. message .. " (" .. targetData.Level .. ")";
						if isenemy then
							r = ICUvars.EnemyNPC.r;
							g = ICUvars.EnemyNPC.g;
							b = ICUvars.EnemyNPC.b;
						else
							r = ICUvars.FriendlyNPC.r;
							g = ICUvars.FriendlyNPC.g;
							b = ICUvars.FriendlyNPC.b;
						end
					end

				else
					--target sconosciuto...
					classicon:SetTexCoord(0, 1, 0, 1);
					found = string.find( message, "%s" );
					if found == nil then
						message = message .. " (Player Probably)";
						r = ICUvars.UNKPlayer.r;
						g = ICUvars.UNKPlayer.g;
						b = ICUvars.UNKPlayer.b;
						classicon:SetTexture("Interface\\AddOns\\ICU\\images\\unk_pg");
					else
						message = message .. " (NPC Probably)";
						r = ICUvars.UNKNPC.r;
						g = ICUvars.UNKNPC.g;
						b = ICUvars.UNKNPC.b;
						classicon:SetTexture("Interface\\AddOns\\ICU\\images\\unk_npc");
					end
				end

				getglobal("ICU_PopupButton"..pos..isSecure):SetBackdropBorderColor(r, g, b); --Fedos

				bar:SetStatusBarColor( r, g, b, 0.75 );
				bar:SetValue( health );

				bg:SetStatusBarColor( r, g, b, 0.1 );

				button:SetNormalFontObject(GameFontNormal);
				button:SetText( message );

				-- Store name of Target in self defined slot
				button.ICU_DATA = hsdata;
				button:GetParent():Show();
				button:Show();

				-- Get the width of the longest result_line
				local w = button:GetTextWidth();

				if( w > width ) then
					width = w;
				end
			end	
		end

		-- Process at most 10 lines as defined in the xml.
		if( pos >= ICU_MAX_LINES ) then
			break
		end;
	end


	-- We are done, unhook the functions
    TargetFrame_OnShow = lOriginal_TargetFrame_OnShow_Event;
    TargetFrame_OnHide = lOriginal_TargetFrame_OnHide_Event;
	ERR_UNIT_NOT_FOUND = lOriginal_ERR_UNIT_NOT_FOUND;
	ERR_GENERIC_NO_TARGET = lOriginal_ERR_GENERIC_NO_TARGET;

	-- Show popup iff there is something to show.
	if( pos > 0 ) then
		ICU_Display_Popup( pos, width + 10, isSecure ); --Fedos
	else
		ICU_DebugEcho( "ICU_ProcessTooltip(): ICU_Clear_Popup() <list is empty>" ); --Fedos
		ICU_Clear_Popup();
	end

end

-- Attempts to gather information on trg
function ICU_Process_Trg( trg )

	local counter = 0;
	--strips color information for targets that are inside
	for name in string.gmatch( trg, "|c%x%x%x%x%x%x%x%x([^|]+)|r" ) do
		--DEFAULT_CHAT_FRAME:AddMessage( counter .. " :: " .. name );
		trg = name;
		if( counter == 0 ) then
			return name;
		end
	end

	return trg;

end

-- The original PlaySound(), do nothing here. Hopefully speeds up when we
-- cycle targets. Show for clarity, not really needed.
function ICU_TargetFrame_OnShow_Event()
	-- Do nothing
end

-- The original PlaySound(), remove relevant portion, but include
-- CloseDropDownMenus().
function ICU_TargetFrame_OnHide_Event()
	-- Do nothing
	CloseDropDownMenus();
end

-- Prepares the popup menu and displays it
function ICU_Display_Popup( numTrgs, width, isSecure ) --Fedos
	-- Loop unrolled
	-- Set the width of every popup button, even if not shown

	--DEFAULT_CHAT_FRAME:AddMessage(width);
	for i=1, 10 do
		getglobal("ICU_PopupButton"..i..isSecure):SetWidth( width + 29 );
		getglobal("ICU_PopupButton"..i..isSecure.."Button"):SetWidth( width + 29 );
		getglobal("ICU_PopupButton"..i..isSecure.."ButtonBar"):SetWidth( width );
		getglobal("ICU_PopupButton"..i..isSecure.."ButtonBGBar"):SetWidth( width );
		getglobal("ICU_PopupButton"..i..isSecure):SetAlpha(1); --Fedos
	end
	--[[ICU_PopupButton1:SetWidth( width );
	ICU_PopupButton2:SetWidth( width );
	ICU_PopupButton3:SetWidth( width );
	ICU_PopupButton4:SetWidth( width );
	ICU_PopupButton5:SetWidth( width );
	ICU_PopupButton6:SetWidth( width );
	ICU_PopupButton7:SetWidth( width );
	ICU_PopupButton8:SetWidth( width );
	ICU_PopupButton9:SetWidth( width );
	ICU_PopupButton10:SetWidth( width );]]

	-- Set the width for the menu.
	getglobal("ICU_Popup"..isSecure):SetWidth( width + 40 + UNITPOPUP_BORDER_WIDTH );

	-- Set the height for the menu.
	getglobal("ICU_Popup"..isSecure):SetHeight( ( numTrgs * ICU_PopupButton1:GetHeight() ) + 12 );

	-- Shows the popupmenu
	getglobal("ICU_Popup"..isSecure):Show();
end

-- Clears all text in buttons, hides all buttons and hides popup menu.
function ICU_Clear_Popup() --Fedos

	-- Loop unrolled
	for i=1, 10 do --Fedos
		getglobal("ICU_PopupButton"..i.."Button"):SetText("");
		getglobal("ICU_PopupButton"..i).ICU_DATA = "";
		getglobal("ICU_PopupButton"..i):Hide();

		getglobal("ICU_PopupButton"..i.."Secure".."Button"):SetText("");
		getglobal("ICU_PopupButton"..i.."Secure").ICU_DATA = "";
		getglobal("ICU_PopupButton"..i.."Secure"):Hide();
		getglobal("ICU_PopupButton"..i.."Secure"):SetAlpha(0); --Fedos
	end
	--[[
	ICU_PopupButton1:SetText( "" );
	ICU_PopupButton2:SetText( "" );
	ICU_PopupButton3:SetText( "" );
	ICU_PopupButton4:SetText( "" );
	ICU_PopupButton5:SetText( "" );
	ICU_PopupButton6:SetText( "" );
	ICU_PopupButton7:SetText( "" );
	ICU_PopupButton8:SetText( "" );
	ICU_PopupButton9:SetText( "" );
	ICU_PopupButton10:SetText( "" );
	ICU_PopupButton1.ICU_DATA = "";
	ICU_PopupButton2.ICU_DATA = "";
	ICU_PopupButton3.ICU_DATA = "";
	ICU_PopupButton4.ICU_DATA = "";
	ICU_PopupButton5.ICU_DATA = "";
	ICU_PopupButton6.ICU_DATA = "";
	ICU_PopupButton7.ICU_DATA = "";
	ICU_PopupButton8.ICU_DATA = "";
	ICU_PopupButton9.ICU_DATA = "";
	ICU_PopupButton10.ICU_DATA = "";
	ICU_PopupButton1:Hide();
	ICU_PopupButton2:Hide();
	ICU_PopupButton3:Hide();
	ICU_PopupButton4:Hide();
	ICU_PopupButton5:Hide();
	ICU_PopupButton6:Hide();
	ICU_PopupButton7:Hide();
	ICU_PopupButton8:Hide();
	ICU_PopupButton9:Hide();
	ICU_PopupButton10:Hide();]]
	ICU_Popup:Hide();
	ICU_PopupSecure:Hide();
end

function ICU_MouseOverUpdate()

	if( GetMouseFocus() ~= nil ) then
		if( MouseIsOver(Minimap) and GetMouseFocus():GetName() == "Minimap" ) then
			if( GameTooltipTextLeft1:GetText() ~= nil ) then
				GameTooltipTextLeft1:SetText( ICU_PreParseNames( GameTooltipTextLeft1:GetText() ) );
				GameTooltip:Show();
			end
		end
	end

	if( ICUvars.mouseOver ) and ( IsControlKeyDown() ) and ( MouseIsOver(Minimap) ) and ( GetMouseFocus():GetName() == "Minimap" ) then --Fedos
		if( GameTooltip:IsVisible() ) then
			if( GameTooltipTextLeft1:GetText() ~= ICU_prevtooltip ) then
				ICU_DebugEcho( "ICU_MouseOverUpdate(): ICU_Clear_Popup()" ); --Fedos
				ICU_Clear_Popup();
				ICU_prevtooltip = GameTooltipTextLeft1:GetText()
				ICU_Minimap_OnClick_Event();
			end	
		end
	end
end

function ICU_ProcessWhoResults()

	local resultsCount = GetNumWhoResults();

	for i = 1, resultsCount, 1 do
			local name, guild, level, race, class, zone, group = GetWhoInfo(i);

			targetData = ICU_GetUnitData( name );

			targetData.Zone = zone;
			targetData.SubZone = "";

			targetData.Class = class;
			targetData.Race = race;

			targetData.Level = level;
			targetData.IsTemp = ICU_ZoneIsABG( zone );
			ICU_AddDBEntry( unitname, targetData, true, true );
	end

	DEFAULT_CHAT_FRAME:AddMessage( MSG_STORE1 .. " " .. resultsCount .. " " .. MSG_STORE2 .. "."  );

end

--------------------------------------------------------
-- ICU DB
--------------------------------------------------------
function ICU_GetEmptyTargetEntry()
	return { 	
				Level 			= 0,
				Class			= "",
				Race			= "",
				Zone			= "",
				SubZone			= "",
				Notes			= "",
				IsKOS			= false,
				IsTemp			= false	
			}
end

function ICU_AddDBEntry( name, data, isenemy, isplayer )

	--dont store if user didnt choose it
	if( ICUvars.storage == "PLAYERS" and not isplayer ) then
		ICU_DebugEcho( "Storage is PLAYERS. Target Skipped" );
		return;
	end

	if( ICUvars.storage == "NPC" and isplayer ) then
		ICU_DebugEcho( "Storage is NPC. Target Skipped" );
		return;
	end

	if( ICUvars.storage == "NONE" and not data.IsTemp ) then
		ICU_DebugEcho( "Storage is NONE. Target Skipped" );
		return;
	end

	if isenemy then
		if isplayer then
			--enemy player
			ICUvars.EnemyPlayers[ name ] = data;
		else
			--enemy mob
			ICUvars.EnemyMobs[ name ] = data;
		end
	else
		if isplayer then
			--friendly player
			ICUvars.FriendlyPlayers[ name ] = data;
		else
			--friendly mob
			ICUvars.FriendlyMobs[ name ] = data;
		end
	end

	ICU_DebugEcho( "Unit [" .. name .. "/" .. data.Class .. "/" .. data.Level .. "] Stored." );

end

function ICU_GetUnitData( name )
	data = ICU_GetEnemyPlayer( name );
	if data ~= nil then
		return data;
	end

	data = ICU_GetFriendlyPlayer( name );
	if data ~= nil then
		return data;
	end

	data = ICU_GetEnemyMob( name );
	if data ~= nil then
		return data;
	end

	data = ICU_GetFriendlyMob( name );
	if data ~= nil then
		return data;
	end
	
	return ICU_GetEmptyTargetEntry();
end

function ICU_GetEnemyPlayer( name )
	return ICUvars.EnemyPlayers[ name ];
end

function ICU_GetFriendlyPlayer( name )
	return ICUvars.FriendlyPlayers[ name ];
end

function ICU_GetEnemyMob( name )
	return ICUvars.EnemyMobs[ name ];
end

function ICU_GetFriendlyMob( name )
	return ICUvars.FriendlyMobs[ name ];
end

function ICU_ConvertOldDB()
	if not TargetsInfoDB then
		return;
	end

	if table.getn( TargetsInfoDB ) == 0 then
		return;
	end

	ICU_DebugEcho( "Cleaning old DB Version.");

	for i=1, table.getn( TargetsInfoDB )  do
		olddata = TargetsInfoDB[i];
		newdata = ICU_GetEmptyTargetEntry();

		newdata.Level 			= olddata.Level;
		newdata.Class			= olddata.Class;
		newdata.Race			= olddata.Race;
		newdata.Zone			= olddata.Zone;
		newdata.SubZone			= olddata.SubZone;
		newdata.Notes			= olddata.Notes;
		newdata.IsKOS			= false;
		newdata.IsTemp			= false;

		ICU_AddDBEntry( olddata.Name, newdata, olddata.IsEnemy, olddata.IsPlayer )
	end

	TargetsInfoDB = {};

end

function ICU_DebugEcho( text )
	if debug_mode then
		DEFAULT_CHAT_FRAME:AddMessage( "#" .. MSG_DEBUG .. " : " .. text , 1, 1, 1 );
	end
end

Last edited by Cladhaire : 11-18-10 at 06:54 AM. Reason: Fixing code block
  Reply With Quote
10-29-10, 05:39 PM   #8
Precision
A Deviate Faerie Dragon
Join Date: Sep 2010
Posts: 14
and here's the options menu source code. God i wish i knew how to program. looks fun.

Code:
	local TooltipModeList =
	{
		"NORMAL",
		"CLASS",
		"CLASS LEVEL",
		n = 3;
	};

	local AnchorList =
	{
		"BOTTOMRIGHT",
		"TOPRIGHT",
		"BOTTOM",
		"TOP",
		"BOTTOMLEFT",
		"TOPLEFT",
		"RIGHT",
		"LEFT",
		n = 8;
	};

	local PingList =
	{
		"DEFAULT",			--the map is pinged when you click. Click+CTRL does silent mode.
		"OFF",				--the map is not pinged when you click. Click+CTRL does silent mode (no announce).
		"OUTSIDE BG",		--the map is pinged only when you are in a battleground
		"INSIDE BG",		--the map is pinged only when you are not in a battleground
		n = 4;
	};

local StorageMode =
{
	"ALL",
	"PLAYERS",
	"NPC",
	"NONE",
	n = 4;
};

local AnnounceMode =
{
	"AUTO",
	"SELF",
	"SAY",
	"YELL",
	"GROUP",
	"RAID",
	"BG",
	"OFF",
	n = 8;
};

ICU_Anchor 	= "";
ICU_Announce 	= "";
ICU_Storage	= "";
ICU_PingMode	= "";
ICU_TooltipMode = "";


function ICU_OptionsForm_OnLoad()
end

function ICU_OptionsForm_LoadCombos()
	local id = getglobal( "ICU_OptionsFormAnchorType" );
	UIDropDownMenu_Initialize( id, ICU_OptionsForm_MakeAnchorButtons);

	id = getglobal( "ICU_OptionsFormStorageMode" );
	UIDropDownMenu_Initialize( id, ICU_OptionsForm_MakeStorageButtons);

	id = getglobal( "ICU_OptionsFormAnnounceMode" );
	UIDropDownMenu_Initialize( id, ICU_OptionsForm_MakeAnnounceButtons);

	id = getglobal( "ICU_OptionsFormMapPingMode" );
	UIDropDownMenu_Initialize( id, ICU_OptionsForm_MakeMapPingButtons);

	id = getglobal( "ICU_OptionsFormToolipMode" );
	UIDropDownMenu_Initialize( id, ICU_OptionsForm_MakeToolipModeButtons);
end

function ICU_OptionsForm_MakeToolipModeButtons()
	local i = ICU_OptionsForm_MakeDDButtons( getglobal( "ICU_OptionsFormToolipMode" ), TooltipModeList, ICU_TooltipMode, ICU_OptionsForm_MakeToolipModeButtonsClick );
	UIDropDownMenu_SetSelectedID( getglobal( "ICU_OptionsFormToolipMode" ), i, 0);
end

function ICU_OptionsForm_MakeToolipModeButtonsClick()
	UIDropDownMenu_SetSelectedID( getglobal( "ICU_OptionsFormToolipMode" ), this:GetID(), 0);
	ICU_TooltipMode = this:GetText();
end


function ICU_OptionsForm_MakeMapPingButtons()
	local i = ICU_OptionsForm_MakeDDButtons( getglobal( "ICU_OptionsFormMapPingMode" ), PingList, ICU_PingMode, ICU_OptionsForm_MakeMapPingButtonsClick );
	UIDropDownMenu_SetSelectedID( getglobal( "ICU_OptionsFormMapPingMode" ), i, 0);
end

function ICU_OptionsForm_MakeMapPingButtonsClick()
	UIDropDownMenu_SetSelectedID( getglobal( "ICU_OptionsFormMapPingMode" ), this:GetID(), 0);
	ICU_PingMode = this:GetText();
end

function ICU_OptionsForm_MakeAnchorButtons()
	local i = ICU_OptionsForm_MakeDDButtons( getglobal( "ICU_OptionsFormAnchorType" ), AnchorList, ICU_Anchor, ICU_OptionsForm_MakeAnchorButtonsClick );
	UIDropDownMenu_SetSelectedID( getglobal( "ICU_OptionsFormAnchorType" ), i, 0);
end

function ICU_OptionsForm_MakeAnchorButtonsClick()
	UIDropDownMenu_SetSelectedID( getglobal( "ICU_OptionsFormAnchorType" ), this:GetID(), 0);
	ICU_Anchor = this:GetText();
end

function ICU_OptionsForm_MakeStorageButtons()
	local i = ICU_OptionsForm_MakeDDButtons( getglobal( "ICU_OptionsFormStorageMode" ), StorageMode, ICU_Storage, ICU_OptionsForm_MakeStorageButtonsClick );
	UIDropDownMenu_SetSelectedID( getglobal( "ICU_OptionsFormStorageMode" ), i, 0);
end

function ICU_OptionsForm_MakeStorageButtonsClick()
	UIDropDownMenu_SetSelectedID( getglobal( "ICU_OptionsFormStorageMode" ), this:GetID(), 0);
	ICU_Storage = this:GetText();
end

function ICU_OptionsForm_MakeAnnounceButtons()
	local i = ICU_OptionsForm_MakeDDButtons( getglobal( "ICU_OptionsFormAnnounceMode" ), AnnounceMode, ICU_Announce, ICU_OptionsForm_MakeAnnounceButtonsClick);
	UIDropDownMenu_SetSelectedID( getglobal( "ICU_OptionsFormAnnounceMode" ), i, 0);
end

function ICU_OptionsForm_MakeAnnounceButtonsClick()
	UIDropDownMenu_SetSelectedID(getglobal( "ICU_OptionsFormAnnounceMode" ), this:GetID(), 0);
	ICU_Announce = this:GetText();
end

function ICU_OptionsForm_MakeDDButtons( dropdown, list, presel, func )
	local i = 0;
	local info = {};
	local checked = false;
	local preselindex = 1;
	for  i = 1, table.getn(list) do
		info = {};
		info.width = 100;
		info.text = list[i];
		info.value = list[i];
		info.func = func;
		if( presel == list[i] ) then
			preselindex = i;
		end

		UIDropDownMenu_AddButton(info);
	end

	return preselindex;

end



function ICU_OptionsForm_IconSliderValueChanged()
	local slider = getglobal("ICU_OptionsFormMacroIconNumberSlider");
	local texture =  GetMacroIconInfo( slider:GetValue() );
	if( texture  ~= nil ) then
		ICU_OptionsFormMacroIconTextureTexture:SetTexture( texture );
		ICU_OptionsFormMacroIconNumberSliderTitle:SetText( "Macro Icon " .. slider:GetValue() );
	end
end

function ICU_OptionsForm_InitializeOptions()

	ICU_Anchor = ICUvars.anchor;
	ICU_Announce = ICUvars.announce;
	ICU_Storage = ICUvars.storage;
	ICU_PingMode = ICUvars.PingMode;
	ICU_TooltipMode = ICUvars.ColorMode;

	ICU_OptionsForm_LoadCombos();

	ICU_OptionsForm_LoadColors();

end

function ICU_OptionsForm_LoadColors()

	--enemy player
	getglobal("ICU_OptionsForm_PlayerEnemyColorColor"):SetTexture( ICUvars.EnemyPlayer.r, ICUvars.EnemyPlayer.g, ICUvars.EnemyPlayer.b );

	--enemy npc
	getglobal("ICU_OptionsForm_NPCEnemyColorColor"):SetTexture( ICUvars.EnemyNPC.r, ICUvars.EnemyNPC.g, ICUvars.EnemyNPC.b );

	--friendly player
	getglobal("ICU_OptionsForm_PlayerFriendlyColorColor"):SetTexture( ICUvars.FriendlyPlayer.r, ICUvars.FriendlyPlayer.g, ICUvars.FriendlyPlayer.b );

	--friendly npc
	getglobal("ICU_OptionsForm_NPCFriendlyColorColor"):SetTexture( ICUvars.FriendlyNPC.r, ICUvars.FriendlyNPC.g, ICUvars.FriendlyNPC.b );

	--unknown player
	getglobal("ICU_OptionsForm_UNKPlayerColorColor"):SetTexture( ICUvars.UNKPlayer.r, ICUvars.UNKPlayer.g, ICUvars.UNKPlayer.b );

	--unknown npc
	getglobal("ICU_OptionsForm_UNKNPCColorColor"):SetTexture( ICUvars.UNKNPC.r, ICUvars.UNKNPC.g, ICUvars.UNKNPC.b );

end

function ICU_OptionsForm_SaveOptions()

	local anchor 	= getglobal("ICU_OptionsFormAnchorTypeText");
	local storage	= getglobal("ICU_OptionsFormStorageModeText");
	local announce	= getglobal("ICU_OptionsFormAnnounceModeText");
	local pingmode	= getglobal("ICU_OptionsFormMapPingModeText");
	local colormode	= getglobal("ICU_OptionsFormToolipModeText");

	ICUvars.anchor = anchor:GetText();
	ICUvars.storage = storage:GetText();
	ICUvars.announce = announce:GetText();
	ICUvars.PingMode = pingmode:GetText();
	ICUvars.ColorMode = colormode:GetText();

	ICU_SetPoints();
	--close
	ICU_OptionsForm:Hide();
end

function ICU_DisplayColorPicker( colorvar, colorfunc, cancelfunc )

	PlaySound("igMainMenuOptionCheckBoxOn");
	ColorPickerFrame.func = colorfunc;
	ColorPickerFrame.cancelFunc = cancelfunc;
	ColorPickerFrame:SetColorRGB( colorvar.r, colorvar.g, colorvar.b );
	ColorPickerFrame.previousValues = { colorvar.r, colorvar.g, colorvar.b };
	ShowUIPanel(ColorPickerFrame);

end

function ICUvars_EnemyPlayer_Change()
	local r,g,b = ColorPickerFrame:GetColorRGB();
	getglobal("ICU_OptionsForm_PlayerEnemyColorColor"):SetTexture( r, g, b );
	ICUvars.EnemyPlayer.r = r;
	ICUvars.EnemyPlayer.g = g;
	ICUvars.EnemyPlayer.b = b;
end


function ICUvars_EnemyPlayer_Cancel( prev )
	local r,g,b = unpack( prev );
	getglobal("ICU_OptionsForm_PlayerEnemyColorColor"):SetTexture( r, g, b );
	ICUvars.EnemyPlayer.r = r;
	ICUvars.EnemyPlayer.g = g;
	ICUvars.EnemyPlayer.b = b;
end

function ICUvars_EnemyNPC_Change()
	local r,g,b = ColorPickerFrame:GetColorRGB();
	getglobal("ICU_OptionsForm_NPCEnemyColorColor"):SetTexture( r, g, b );
	ICUvars.EnemyNPC.r = r;
	ICUvars.EnemyNPC.g = g;
	ICUvars.EnemyNPC.b = b;
end


function ICUvars_EnemyNPC_Cancel( prev )
	local r,g,b = unpack( prev );
	getglobal("ICU_OptionsForm_NPCEnemyColorColor"):SetTexture( r, g, b );
	ICUvars.EnemyNPC.r = r;
	ICUvars.EnemyNPC.g = g;
	ICUvars.EnemyNPC.b = b;
end

function ICUvars_FriendlyPlayer_Change()
	local r,g,b = ColorPickerFrame:GetColorRGB();
	getglobal("ICU_OptionsForm_PlayerFriendlyColorColor"):SetTexture( r, g, b );
	ICUvars.FriendlyPlayer.r = r;
	ICUvars.FriendlyPlayer.g = g;
	ICUvars.FriendlyPlayer.b = b;
end


function ICUvars_FriendlyPlayer_Cancel( prev )
	local r,g,b = unpack( prev );
	getglobal("ICU_OptionsForm_PlayerFriendlyColorColor"):SetTexture( r, g, b );
	ICUvars.FriendlyPlayer.r = r;
	ICUvars.FriendlyPlayer.g = g;
	ICUvars.FriendlyPlayer.b = b;
end

function ICUvars_FriendlyNPC_Change()
	local r,g,b = ColorPickerFrame:GetColorRGB();
	getglobal("ICU_OptionsForm_NPCFriendlyColorColor"):SetTexture( r, g, b );
	ICUvars.FriendlyNPC.r = r;
	ICUvars.FriendlyNPC.g = g;
	ICUvars.FriendlyNPC.b = b;
end


function ICUvars_FriendlyNPC_Cancel( prev )
	local r,g,b = unpack( prev );
	getglobal("ICU_OptionsForm_NPCFriendlyColorColor"):SetTexture( r, g, b );
	ICUvars.FriendlyNPC.r = r;
	ICUvars.FriendlyNPC.g = g;
	ICUvars.FriendlyNPC.b = b;
end

function ICUvars_UNKPlayer_Change()
	local r,g,b = ColorPickerFrame:GetColorRGB();
	getglobal("ICU_OptionsForm_UNKPlayerColorColor"):SetTexture( r, g, b );
	ICUvars.UNKPlayer.r = r;
	ICUvars.UNKPlayer.g = g;
	ICUvars.UNKPlayer.b = b;
end


function ICUvars_UNKPlayer_Cancel( prev )
	local r,g,b = unpack( prev );
	getglobal("ICU_OptionsForm_UNKPlayerColorColor"):SetTexture( r, g, b );
	ICUvars.UNKPlayer.r = r;
	ICUvars.UNKPlayer.g = g;
	ICUvars.UNKPlayer.b = b;
end

function ICUvars_UNKNPC_Change()
	local r,g,b = ColorPickerFrame:GetColorRGB();
	getglobal("ICU_OptionsForm_UNKNPCColorColor"):SetTexture( r, g, b );
	ICUvars.UNKNPC.r = r;
	ICUvars.UNKNPC.g = g;
	ICUvars.UNKNPC.b = b;
end


function ICUvars_UNKNPC_Cancel( prev )
	local r,g,b = unpack( prev );
	getglobal("ICU_OptionsForm_UNKNPCColorColor"):SetTexture( r, g, b );
	ICUvars.UNKNPC.r = r;
	ICUvars.UNKNPC.g = g;
	ICUvars.UNKNPC.b = b;
end

Last edited by Cladhaire : 11-18-10 at 06:54 AM. Reason: Fixing code block
  Reply With Quote
10-29-10, 05:44 PM   #9
Maul
Ion Engines, Engage!
 
Maul's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 401
Originally Posted by Precision View Post
ICU and personal sentry has been broken for a while now. the authors no longer develop on it.

plus i am not on the beta.

ICU has been broken since WOTLK came out. it's just had 10% of it's features working as long as you have sexymap installed. which is only the option of clicking the minimap blips and having a dropdown menu of the players clicked. changing the settings wont work, and hasn't worked for a long time.
In your thread on the UI & Macros forum, you indicated it worked on the current live build, but not on the PTR (which I thought said beta earlier).

So I am a bit confused as to what the issue is. If the addon is broken on live, then it may need updating. My hands are too full take on fixing another addon that is not my own right now, however.
__________________

Twitter: @IonMaul | Windows Live: [email protected] | Google Talk: [email protected]
  Reply With Quote
10-29-10, 05:47 PM   #10
Precision
A Deviate Faerie Dragon
Join Date: Sep 2010
Posts: 14
Originally Posted by Maul View Post
In your thread on the UI & Macros forum, you indicated it worked on the current live build, but not on the PTR (which I thought said beta earlier).

So I am a bit confused as to what the issue is. If the addon is broken on live, then it may need updating. My hands are too full take on fixing another addon that is not my own right now, however.
sorry sorry, everything should be cleared up now.

http://forums.worldofwarcraft.com/th...sid=1&pageNo=2

i cleaned up that thread, disregard my stupidity.
  Reply With Quote
11-09-10, 07:57 PM   #11
Precision
A Deviate Faerie Dragon
Join Date: Sep 2010
Posts: 14
bumpsssssssssss
  Reply With Quote
11-17-10, 09:00 PM   #12
Precision
A Deviate Faerie Dragon
Join Date: Sep 2010
Posts: 14
localization-enUS.lua

Code:
-- Original english text

-- Priority translate
	CLASS_WARRIOR			= "Warrior";
	CLASS_MAGE			= "Mage";
	CLASS_ROGUE			= "Rogue";
	CLASS_DRUID			= "Druid";
	CLASS_HUNTER			= "Hunter";
	CLASS_SHAMAN			= "Shaman";
	CLASS_PRIEST			= "Priest";
	CLASS_WARLOCK			= "Warlock";
	CLASS_PALADIN			= "Paladin";
	ZONE_ARATHI_BASIN		= "Arathi Basin";
	ZONE_ALTERAC_VALLEY		= "Alterac Valley";
	ZONE_WARSONG_GULCH		= "Warsong Gulch";
	ZONE_EYE_OF_THE_STORM		= "Eye of the Storm";

-- Optionnel translate
	OPT_OPTIONS			= "OPTIONS";
	OPT_SEARCH			= "SEARCH";
	OPT_DEBUG			= "DEBUG";
	OPT_DEBUG_ON			= "ICU Debug : ON.";
	OPT_DEBUG_OFF			= "ICU Debug : OFF.";
	HELP_COMMAND1			= "/ICU options";
	HELP_COMMAND2			= "Shows the options dialog.";
	HELP_COMMAND3			= "/ICU search (target name)";
	HELP_COMMAND4			= "Searches trough know targets";
	HELP_COMMAND5			= "Current settings";
	HELP_ANNOUNCE			= "Announce";
	HELP_ANCHOR			= "Anchor";
	HELP_ICON_INDEX			= "Icon Index";
	HELP_STORAGE_MODE		= "Storage Mode";
	MSG_DBLOADED1			= "ICU DB Loaded";
	MSG_DBLOADED2			= "Mobs and";
	MSG_DBLOADED3			= "players loaded";
	DEBUG_UNK_UNIT			= "Unknown Unit Detected";
	DEBUG_TOTAL_SCORES		= "Total Scores";
	DEBUG_RENEWING_BG_SCORES	= "Renewing BG scores.";
	DEBUG_BG_MODE_ON		= "BG Mode Enabled";
	DEBUG_BG_MODE_OFF		= "BG Mode DISABLED";
	SEARCH_TARGET_SEARCH		= "Searching";
	SEARCH_TARGET_FOUND		= "Found";
	MSG_PURGE1			= "ICU Purged";
	MSG_PURGE2			= "temporary entries";
	MSG_STORE1			= "ICU : stored";
	MSG_STORE2			= "players";
	MSG_DEBUG			= "ICU DEBUG";

Last edited by Cladhaire : 11-18-10 at 06:54 AM. Reason: Fixing code block
  Reply With Quote
11-17-10, 09:15 PM   #13
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,366
This is not the wow forums.

Humongous walls of text and constant bumps don't work very well.

You have the option of
  • attaching the zipped files to your post
  • using [code][/code] tags around your code to make it scroll instead of covering screens upon screens.

Whatever you choose to do, stop bumping your post, it will accomplish nothing.

Just a friendly advise.
  Reply With Quote
11-17-10, 11:05 PM   #14
Precision
A Deviate Faerie Dragon
Join Date: Sep 2010
Posts: 14
Originally Posted by Dridzt View Post
This is not the wow forums.

Humongous walls of text and constant bumps don't work very well.

You have the option of
  • attaching the zipped files to your post
  • using [code][/code] tags around your code to make it scroll instead of covering screens upon screens.

Whatever you choose to do, stop bumping your post, it will accomplish nothing.

Just a friendly advise.
i was posting it for a developer who asked for it. i'm not familiar with all the html options so thanks.
  Reply With Quote
11-22-10, 11:05 PM   #15
Precision
A Deviate Faerie Dragon
Join Date: Sep 2010
Posts: 14
still need this addon very badly >.<
  Reply With Quote
12-01-10, 04:41 PM   #16
Precision
A Deviate Faerie Dragon
Join Date: Sep 2010
Posts: 14
seems like there's no hope..
  Reply With Quote
12-01-10, 06:47 PM   #17
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,366
If this is not a suitable replacement I "might" take a look at ICU ...
Minimap Target by Adirelle.

No promises though, the moment Cataclysm hits development time ==> 0
  Reply With Quote
12-01-10, 11:34 PM   #18
Precision
A Deviate Faerie Dragon
Join Date: Sep 2010
Posts: 14
Originally Posted by Dridzt View Post
If this is not a suitable replacement I "might" take a look at ICU ...
Minimap Target by Adirelle.

No promises though, the moment Cataclysm hits development time ==> 0
, i love you and want to marry you.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » ICU/Personal sentry


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