repsys.src suggested changes

Archive of posts related to former distro versions. Be aware that posts here do not refer to the current distro and may not work.
Locked
User avatar
OldnGrey
POL Expert
Posts: 657
Joined: Sat Feb 04, 2006 6:26 pm

repsys.src suggested changes

Post by OldnGrey »

I have been working on the HighLightColor and NameColor functions in the distro repsys.src file and have a couple of suggested changes and a bug fix or two to make it work more as expected.

Existing exported function. Guild tests added and bugs fixed.

Code: Select all

exported function NameColor(mobile, seen_by)
	var color := 0;

	if ( mobile.master )
		return NameColor(mobile.master, seen_by);
	elseif ( mobile.murderer || mobile.alignment == ALIGNMENT_EVIL )
		color := GetConfigInt(g_name_colors, "Murderer");
	elseif ( mobile.criminal || mobile.alignment == ALIGNMENT_NEUTRAL )
		// Murderers are always criminals
		// Criminals are not always murderers
		color := GetConfigInt(g_name_colors, "Criminal");
	elseif ( Guild_Ally(mobile, seen_by) )
		color :=  GetConfigInt(g_name_colors, "GuildAlly");
	elseif ( Guild_Enemy(mobile, seen_by) )
		color := GetConfigInt(g_name_colors, "GuildEnemy");
	elseif ( mobile.Enabled("invul") )
		color := GetConfigInt(g_name_colors, "Invulnerable");
	else
		color := GetConfigInt(g_name_colors, "Innocent");
	endif

	if ( color.errortext )
		SysLog("NameColor() - "+color.errortext);
	endif

	return CInt(color);
endfunction
Existing exported function. Guild tests added and bugs fixed.

Code: Select all

exported function HighLightColor(mobile, seen_by)
	var color := 0;

	if ( mobile.master )
		return HighLightColor(mobile.master, seen_by);
	elseif ( mobile.murderer || mobile.alignment == ALIGNMENT_EVIL )
		color := GetConfigInt(g_name_colors, "MurdererHighLight");
	elseif ( mobile.criminal || mobile.alignment == ALIGNMENT_NEUTRAL )
		// Murderers are always criminals
		// Criminals are not always murderers
		color := GetConfigInt(g_name_colors, "CriminalHighLight");
	elseif ( Guild_Ally(mobile, seen_by) )
		color :=  GetConfigInt(g_name_colors, "GuildAllyHighLight");
	elseif ( Guild_Enemy(mobile, seen_by) )
		color := GetConfigInt(g_name_colors, "GuildEnemyHighLight");
	elseif ( mobile.Enabled("invul") )
		color := GetConfigInt(g_name_colors, "InvulnerableHighLight");
	else
		color := GetConfigInt(g_name_colors, "InnocentHighLight");
	endif

	if ( color.errortext )
		SysLog("HighLightColor() - "+color.errortext);
	endif

	return CInt(color);
endfunction
New function. This will highlight player and other guild members in green plus other allied guild members.

Code: Select all

function Guild_Ally(byref mobile, byref seen_by)
	if ( !mobile.guild )
		return 0;
	endif
	if ( !seen_by.guild )
		return 0;
	endif

	if ( mobile.guildid == seen_by.guildid )
		return 1;
	endif

	var mobile_guild := mobile.guild;
	var seen_by_guild := seen_by.guild;

	if ( mobile_guild.isallyguild(seen_by_guild) )
		return 1;
	endif
	if ( seen_by_guild.isallyguild(mobile_guild) )
		return 1;
	endif

	return 0;
endfunction

New function. Enemy guilds highlighted in pink.

Code: Select all

function Guild_Enemy(byref mobile, byref seen_by)
	if ( !mobile.guild )
		return 0;
	endif
	if ( !seen_by.guild )
		return 0;
	endif

	var mobile_guild := mobile.guild;
	var seen_by_guild := seen_by.guild;
	if ( mobile_guild.isenemyguild(seen_by_guild) )
		return 1;
	endif
	if ( seen_by_guild.isenemyguild(mobile_guild) )
		return 1;
	endif

	return 0;
endfunction
Locked