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
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
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