RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

SolidHueOverride Immunity for Items

SolidHueOverride Immunity for Items

This Core Mod has been created so that Items can have a SolidHueImmunity bool attached to their properties that can be set in game or via the individual Item scripts.
If the SolidHueImmunity bool is set to True then if the Item is equipped and the Mobile it is equipped on has a SolidHueOverride then this Item will retain its hue and won't take the hue of the SolidHueOverride. If the SolidHueImmunity is set to false (default) then the Item will take the hue of the SolidHueOverride as normal.

This mod requires edits to Item.cs and Packets.cs.

Open Item.cs

Find the code below, around Line 542:
Code:
 public class Item : IPoint3D, IEntity, IHued
 {
 
        public static readonly EmptyArrayList EmptyItems = new EmptyArrayList();

Insert the code below so that the code now looks like this:
Code:
 public class Item : IPoint3D, IEntity, IHued
 {
        // SOLIDHUEIMMUNE EDIT
        private bool m_SolidHueImmune;
        [CommandProperty(AccessLevel.GameMaster)]
        public bool SolidHueImmune
        {
            get { return m_SolidHueImmune; }
            set 
            {
                if (m_SolidHueImmune != value)
                {
                    m_SolidHueImmune = value;
                    m_WorldPacket = null;
                    Delta(ItemDelta.Update);
                }
            }
        }
        //END SOLIDHUEIMMUNE EDIT
 
        public static readonly EmptyArrayList EmptyItems = new EmptyArrayList();

Find the code below, around line 1667:
Code:
  public virtual void Serialize( GenericWriter writer )
  {
            SaveFlag flags = SaveFlag.None;

Insert the code below so that the code now looks like this:
Code:
  public virtual void Serialize( GenericWriter writer )
  {
            // SOLIDHUEIMMUNE EDIT
            //writer.Write( 7 ); // version
            writer.Write( 8 ); // version
            writer.Write((bool)m_SolidHueImmune);
            // END SOLIDHUEIMMUNE EDIT
 
            SaveFlag flags = SaveFlag.None;

Find the code below, around line 1946:
Code:
  public virtual void Deserialize( GenericReader reader )
  {
        int version = reader.ReadInt();
        SetLastMoved();
        switch ( version )
        {                 
              case 7:

Insert the code below so that the code now looks like this:
Code:
  public virtual void Deserialize( GenericReader reader )
  {
        int version = reader.ReadInt();
        SetLastMoved();
        switch ( version )
        {   
                // SOLIDHUEIMMUNE EDIT
                case 8:
                    {
                        m_SolidHueImmune = reader.ReadBool();
                        goto case 7;
                    }
                // END SOLIDHUEIMMUNE EDIT
                case 7:

Save and Close Item.cs

Open Packets.cs

Find the code below, around line 946:
Code:
   if ( item.Parent is Mobile )
   {
         Mobile mob = (Mobile)item.Parent;
 
         if ( mob.SoludHueOverride > = 0 )
               hue = mob.SolidHueOverride;
   }

Change the code to the code below so that it now looks like this:
Code:
   if ( item.Parent is Mobile )
   {
         Mobile mob = (Mobile)item.Parent;
         // SOLIDHUEIMMUNE EDIT
         // if ( mob.SoludHueOverride > = 0 )
         if ( mob.SolidHueOverride >= 0 && !item.SolidHueImmune)
               hue = mob.SolidHueOverride;
         // END SOLIDHUEIMMUNE EDIT
   }

Find the code below, around line 2618
Code:
     if ( beheld.SolidHueOverride >= 0 )
           hue = beheld.SolidHueOverride;

Change the code to the code below so that it now looks like this:
Code:
     // SOLIDHUEIMMUNE EDIT
     // if ( beheld.SolidHueOverride >=0 )
     if ( beheld.SolidHueOverride >= 0 && !item.SolidHueImmune)
           hue = beheld.SolidHueOverride;
     // END SOLIDHUEIMMUNE EDIT

Save and Close Packets.cs

Recompile your new core.

You are now finished.
 
Do [props on a Mobile and set the SolidHueOverride to any int value for a Hue. You will notice that this overrides their skin hue, and all their equipment hue so that they turn completely one colour.
What my mod does is to allow Items to be immune from having their colour turned by the SolidHueOverride.
For example a project I'm working on is a CTF Game and so you can use the SolidHueOverride to set the players on the blue team to a blue colour, so that they look competely blue. Well the Red Flag will have its SolidHueImmune bool set to True so that when a Blue player captures the Red Flag and equips it the Red Flag won't turn blue, it will retain its Red Hue.

Hope that helps you get an idea. If you've never used the SolidHueOverride before, then I suggest you take a look at it, its very cool :D
 
Top