Page 1 of 1

[RunUO 1.0]Hue Detector

Posted: Fri Sep 17, 2010 5:58 am
by Kaiana
Yay, my first item :)

I hope Coli puts it in, I could really use it on this server. :)

Code: Select all

using System;
using Server;
using Server.Targeting;

namespace Server.Items    //Namespace
{
    public class HueWand : Item //Class name and parent class
    {
        
        [Constructable] //Constructor tag
        public HueWand()
            : base(0x14F6) // naming the constructor and defining the graphic base
        {
            Weight = 1.0; 
            Hue = 1480;
            Name = "a hue detector";
        }

        public HueWand(Serial serial)
            : base(serial) //constructor for serializing
        {
        }

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
            writer.Write((int)0);
        }
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();
        }

        public override void OnDoubleClick(Mobile from) //handles double click events and brings character with it
        {
            

            if (IsChildOf(from.Backpack) || from.InRange(this, 2) && from.CanSee(this)) //if in backpack or within range and can see
            {
                from.Target = new HueWandTarget(this);
                from.SendMessage("What item would you like to get the hue of?");
            }
            else
            {
                from.SendLocalizedMessage(500446); // That is too far away. 
            }
        }

    }
    public class HueWandTarget : Target
    {
        private HueWand m_Wand; //creating the modular variable for the Wand being used

        public HueWandTarget(HueWand wand) //sets wand to the wand being used (set when it is called)
            : base(15, false, TargetFlags.None)  //no idea on this yet
        {
            m_Wand = wand;
        }

        protected override void OnTarget(Mobile from, object target)
        {
            if (target is Item) //remember conditions are always in parens
            {
                Item item = (Item)target;
                string hue = System.String.Concat("The item's hue is ",item.Hue.ToString(),".");
                from.SendMessage(hue);
                return;

            }
            else if (target is Mobile)
            {
                Mobile mobile = (Mobile)target;
                string hue = System.String.Concat("The item's hue is ", mobile.Hue.ToString(), ".");
                from.SendMessage(hue);
                return;
            }
            else
            {
                from.SendMessage("You cannot get the hue of that.");
                return;
            }
        }
    }


}

Re: [RunUO 1.0]Hue Detector

Posted: Fri Sep 17, 2010 6:17 am
by Nelapsi
I see this as something that would go right next to the yard wand, nice job

Re: [RunUO 1.0]Hue Detector

Posted: Fri Sep 17, 2010 12:26 pm
by Efanchenko_MM
woot! Fingers crossed for this, thanks Kaiana!

Re: [RunUO 1.0]Hue Detector

Posted: Fri Sep 17, 2010 12:41 pm
by +Colibri
I will add this one in, but after the guild hue system is re-coded a bit. Things i have planned to help reduce the hue problems:
- doubleclicking the display armor will give you a target. targeting a unitub will color that unitub. and targeting anything else will have the temporary hue preview function. This will make it so it's no longer possible use a color that already belongs to a guild.
- the items will not just plainly be dyed, but will be internally marked that they are guild dyed. meaning that a guild-hue-undye-tub will be easy to make. also trading such items will be disabled.
- ability to still apply the guild hue on a unitub if you are a member of the guild. and could only use it if you are still a member.

Re: [RunUO 1.0]Hue Detector

Posted: Fri Sep 17, 2010 12:54 pm
by Nelapsi
Sounds great to me, done yet?

:lol:

Re: [RunUO 1.0]Hue Detector

Posted: Fri Sep 17, 2010 11:16 pm
by Ramious
good script. tested it. Coli on the guild issues can it be done to also add a date as to when it was hued. say some one does use a uni with a hue # but 2 days later someone buys that hue # the first person is safe to keep that hued item.