Dan

Moderator
Code:
if (AccessLevel > AccessLevel.Player)
            {           
                list.Add(1018085); // Game Master       
            }

color = "#FF0000";

What would be the best way to add this color to this cliloc?
 
Disregard

For anyone else wondering the same thing, this is what I came up with

Code:
if (AccessLevel > AccessLevel.Counselor)
            {          
                list.Add(1018085, String.Format("<BASEFONT COLOR=#FF0000" )); // Game Master      
            }
 
Last edited:
Since you use VNc, you can do this:

Code:
var opl = new ExtendedOPL( list ); // supports up to 65 custom lines by default

if (AccessLevel > AccessLevel.Player)
{
	opl.Add("Game Master".WrapUOHtmlColor( Color.Red ));
}

opl.Apply(); // Apply changes, can be called multiple times when needed
 
I would like it to show in all languages, just in this one case


Actually the color will not show? Any ideas why?

Code:
if (AccessLevel > AccessLevel.Counselor)
            {           
                list.Add(1018085, String.Format("<BASEFONT COLOR=#FF0000" )); // Game Master       
            }
 
A limitation of the Cliloc ID, it doesn't support arguments.

There is one other way to do this, but it's pretty convoluted for just one custom line.

If you're interested, take a look at this example:
https://github.com/Vita-Nex/Core/blob/master/Modules/EquipmentSets/EquipmentSets_Init.cs#L65
https://github.com/Vita-Nex/Core/blob/master/Modules/EquipmentSets/EquipmentSets.cs#L56

This allows you to know who's actually viewing the OPL, so you can get their language-specific cliloc string by using VNc's Clilocs service:

Note that the above files linked are for hooking Items, this code hooks Mobiles...
Code:
// using VitaNex;
// using VitaNex.Network;
// using System.Drawing;

public static void Initialize()
{
	ExtendedOPL.OnMobileOPLRequest += GetProperties;
}

private static void GetProperties( Mobile mobile, Mobile viewer, ExtendedOPL list )
{
	if ( mobile == null || mobile.Deleted || viewer == null || list == null || World.Loading )
	{
		return;
	}

	if( mobile.AccessLevel >= AccessLevel.GameMaster )
	{
		string value = Clilocs.GetString( viewer.GetLanguage( ), 1018085 );

		value = value.WrapUOHtmlColor( Color.Blue );

		list.Add( value );
	}
}
 
I actually got it showing Red for a minute, but when I transferred the code over from my test shard I seemed to mess it up somewhere
[doublepost=1487383782][/doublepost]I used this, in ServUO, as an example. It is a cliloc but with color


Code:
if (AccessLevel > AccessLevel.Player)
            {
                string color = "";
                switch (AccessLevel)
                {
                    case AccessLevel.VIP:
                        color = "#1EFF00";
                        break;
                    case AccessLevel.Counselor:
                        color = "#00BFFF";
                        break; //Deep Sky Blue
                    case AccessLevel.Decorator:
                        color = "#FF8000";
                        break;
                    case AccessLevel.Spawner:
                        color = "#E6CC80";
                        break;
                    case AccessLevel.GameMaster:
                        color = "#FF0000";
                        break; //Red
                    case AccessLevel.Seer:
                        color = "#00FF00";
                        break; //Green
                    case AccessLevel.Administrator:
                        color = "#0070FF";
                        break;
                    case AccessLevel.Developer:
                        color = "#A335EE";
                        break;
                    case AccessLevel.CoOwner:
                        color = "#FFD700";
                        break;
                    case AccessLevel.Owner:
                        color = "#FFD700";
                        break;
                }



I got what I was looking for to show red but I seemed to mess up somewhere when I moved it over to my main shard.
 
Yeah, with it, it still does not work, I am working to re-create how I added it on top of the ServUO way. 1 sec and I will post.
 
I just remembered that the client has a sub-parser for clilocs, so you can try:

Code:
list.Add( "<BASEFONT COLOR=#FF0000>#1018085<BASEFONT COLOR=#FFFFFF>" ); // Game Master

Prefixing the cliloc ID with # is essential.
 
So check this

SHOW1.png


Now this is my edit to PlayerMobile.cs It is only a few lines AFTER the ServUO stock staff edits that show Staff: (which I want to remove). I only want to show the Game Master part. However when I remove the Staff:Owner part, it goes back to normal color

Code:
if (AccessLevel > AccessLevel.Player)
            {
                string color = "";
                switch (AccessLevel)
                {
                    case AccessLevel.VIP:
                        color = "#1EFF00";
                        break;
                    case AccessLevel.Counselor:
                        color = "#00BFFF";
                        break; //Deep Sky Blue
                    case AccessLevel.Decorator:
                        color = "#FF8000";
                        break;
                    case AccessLevel.Spawner:
                        color = "#E6CC80";
                        break;
                    case AccessLevel.GameMaster:
                        color = "#FF0000";
                        break; //Red
                    case AccessLevel.Seer:
                        color = "#00FF00";
                        break; //Green
                    case AccessLevel.Administrator:
                        color = "#0070FF";
                        break;
                    case AccessLevel.Developer:
                        color = "#A335EE";
                        break;
                    case AccessLevel.CoOwner:
                        color = "#FF0000";
                        break;
                    case AccessLevel.Owner:
                        color = "#FF0000";
                        break;
                }
                if (IsStaff())
                {
                    list.Add(
                        1060658, "{0}\t{1}", "Staff", String.Format("<BASEFONT COLOR={0}>{1}", color, GetAccessLevelName(AccessLevel)));
                }
                else
                {
                    list.Add(1060658, "VIP");
                }
            }
           
            if (AccessLevel > AccessLevel.Counselor)
            {          
                list.Add(1018085, String.Format("<BASEFONT COLOR=#FF0000" )); // Game Master      
            }

            if (PlayerProperties != null)
            {
                PlayerProperties(new PlayerPropertiesEventArgs(this, list));
            }
        }
 
It happens because the entire OPL is interpreted by the client as a continuous string, so once you set it to red, everything after it is going to be red, that's why I reset it back to white in my example.
 
Ah gotcha, I am just lost on how to set JUST the game master portion to red, while removing the rest!!
[doublepost=1487386201][/doublepost]list.Add( "<BASEFONT COLOR=#FF0000>#1018085<BASEFONT COLOR=#FFFFFF>" ); // Game Master

Just going to use this but add in Game Master, no language support. Seems better than nothing. I can not figure it out otherwise. Thanks for the idea @Voxpire
 

Active Shards

Donations

Total amount
$50.00
Goal
$1,000.00
Back