[RunUO 1.0]Hue Detector

Discussion about the technical aspects of scripting. Ask about all issues involving your freelance projects here.
Locked
User avatar
Kaiana
Elder Scribe
Posts: 148
Joined: Mon Jul 13, 2009 3:07 pm

[RunUO 1.0]Hue Detector

Post 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;
            }
        }
    }


}
♥Kaiana♥ - Administrator of the Heart

Yay for scripting and programming! :)
public bool EasyUOMastery = true;
private double CSharpSkillz = 30.0; //and rising!
Nelapsi
Legendary Scribe
Posts: 268
Joined: Thu Apr 15, 2010 11:16 am

Re: [RunUO 1.0]Hue Detector

Post by Nelapsi »

I see this as something that would go right next to the yard wand, nice job
User avatar
Efanchenko_MM
Legendary Scribe
Posts: 213
Joined: Mon Aug 11, 2008 4:13 pm
Location: Essex, England

Re: [RunUO 1.0]Hue Detector

Post by Efanchenko_MM »

woot! Fingers crossed for this, thanks Kaiana!
EFANCHENKO MM
User avatar
+Colibri
Administrator
Posts: 4068
Joined: Sat Feb 25, 2006 4:08 pm
Location: static void Main

Re: [RunUO 1.0]Hue Detector

Post 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.
+Colibri, Administrator of UO Excelsior Shard

Don't know what the purpose of your life is? Well then make something up! ;)
(Old Colibrian proverb)
Nelapsi
Legendary Scribe
Posts: 268
Joined: Thu Apr 15, 2010 11:16 am

Re: [RunUO 1.0]Hue Detector

Post by Nelapsi »

Sounds great to me, done yet?

:lol:
Ramious
Grandmaster Scribe
Posts: 72
Joined: Sat Dec 01, 2007 4:56 pm

Re: [RunUO 1.0]Hue Detector

Post 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.
“What will you do without freedom? Fight and you may die; run, and you’ll live, at least a while. What would you give for one chance, just one chance, to tell our enemies that they may take our lives but they’ll never take our freedom?
Locked