Imagine Nation Forums
IN-X Scripts out in the open ? - Printable Version

+- Imagine Nation Forums (https://in-uo.net/forums)
+-- Forum: Imagine Nation: Xtreme archive (https://in-uo.net/forums/forumdisplay.php?fid=5)
+--- Forum: General (https://in-uo.net/forums/forumdisplay.php?fid=15)
+--- Thread: IN-X Scripts out in the open ? (/showthread.php?tid=1283)



IN-X Scripts out in the open ? - imported_Rackull - 08-22-2007

Well this is just something i caught just browsing some things runuo related, a simple barber script, nonetheless is dated very recently, I believe you should take care on securing the scripts exchange and do the work secured without letting them escape ...

I can give the location I extracted this and others from to an admin of IN-X, dam they are just sitting there in the open without any kind of security ...

*shakes head*

Code:
//Yes, i will upload this to the forums when im done with it

/***************************************************************************
*                                Barber.cs
*                            -------------------
*   last edited          : July 6, 2007
*   web site             : www.in-x.org
*   author               : Makaveli
*
*
***************************************************************************/

/***************************************************************************
*
*   Created by the Imagine Nation - Xtreme dev team for "IN-X" and the RunUo
*   community. If you miss the old school Sphere 0.51 gameplay, and want to
*   try it on the best and most stable emulator, visit us at www.in-x.org.
*      
*   www.in-x.org
*   A full sphere 0.51 replica.
*
***************************************************************************/

using System;
using Server;
using Server.Items;
using System.Collections;
using System.Collections.Generic;

namespace Server.Mobiles
{
    public class Barber : BaseVendor
    {
        #region Initiate vars

        private ArrayList m_SBInfos = new ArrayList();
        protected override ArrayList SBInfos { get { return m_SBInfos; } }

        //Seriously, someone change these MSGS
        private string m_ToManyStylesBought = "You will have to settle for one hair and beard style!";
        private string m_FemaleBuyingBeard = "I'm sorry, but I only know how to style men faces.";
        private string m_HairCutDone = "Ahh! Just look in the mirror!";
        private string m_PleaseDismount = "I cannott reach your head if you are sitting on your horse.";

        //Chance for hair to be dropped on the ground
        private double m_HairDropChance = 0.30;

        //The amount of time it will take to cut someones hair
        private int m_CutTimeInSeconds = 0;

        //If the barber has a specific chair
        private Item m_BarbersChair;

        //Should we use vendors with the shop menu
        private bool m_OldStyleHairStylist = true;
        private bool m_AllowFemalesBuyingBeard = false;
        private bool m_PlayScissorSound = true;
        private bool m_DropResidueHair = true;
        private bool m_NeedsToBeDismounted = true;

        #endregion

        [Constructable]
        public Barber() : base("the barber")
        {
            SetSkill(SkillName.Tailoring, 80.0, 100.0);
            SetSkill(SkillName.Magery, 90.0, 110.0);
            SetSkill(SkillName.TasteID, 85.0, 100.0);

            ////To add: a new style vendor that reacts on speech
            //if (!m_OldStyleHairStylist)
            //    this.AI = barberAi;
        }

        public Barber(Serial serial) : base(serial)
        {
        }

        public override void InitSBInfo()
        {
            m_SBInfos.Add(new SBHairStylist());
        }

        public override bool OnBuyItems(Mobile buyer, ArrayList list)
        {
            if (buyer.Mounted && m_NeedsToBeDismounted)
            {
                Say(m_ToManyStylesBought);
                return false;
            }

            if (list.Count > 2)
            {
                Say(m_ToManyStylesBought);
                return false;
            }

            int beard = 0, hair = 0;
            List<Item> styles = new List<Item>();;

            foreach (BuyItemResponse o in list)
            {
                Item item = World.FindItem(o.Serial);

                if (IsHair(item))
                {
                    styles.Add(item);
                    hair++;
                }
                else
                {
                    if (buyer.Female && !m_AllowFemalesBuyingBeard)
                    {
                        Say(m_FemaleBuyingBeard);
                        return false;
                    }

                    styles.Add(item);
                    beard++;
                }

                if (hair > 1 || beard > 1)
                    break;
            }

            if (hair > 1 || beard > 1)
            {
                Say(m_ToManyStylesBought);
                return false;
            }

            StartCutting(styles, buyer);
            return true;
        }

        private bool IsHair(Item item)
        {
            Type t = item.GetType();

            if (t == typeof(ShortHair) || t == typeof(LongHair) || t == typeof(PonyTail) || t == typeof(Mohawk)
                || t == typeof(PageboyHair) || t == typeof(BunsHair) || t == typeof(Afro)
                || t == typeof(ReceedingHair) || t == typeof(TwoPigTails) || t == typeof(KrisnaHair))
                return true;

            return false;
        }

        public void StartCutting(List<Item> styles, Mobile customer)
        {
            if (m_CutTimeInSeconds == 0)
                CutHair(styles, customer);
            //else
                //new CutTimer().Start();
        }

        public void CutHair(List<Item> styles, Mobile customer)
        {
            CutHair(styles, customer, true);
        }

        public void CutHair(List<Item> styles, Mobile customer, bool dropMoreThanOnce)
        {
            if (m_PlayScissorSound)
                PlayScissorSound(customer);

            if (m_DropResidueHair)
            {
                DropHairResidue(customer, dropMoreThanOnce);

                //Lets drop a little hair around the vendor too
                DropHairResidue(customer, this.Location, dropMoreThanOnce);
            }

            foreach (Item style in styles)
            {
                if (IsHair(style))
                    customer.HairItemID = style.ItemID;
                else
                    customer.FacialHairItemID = style.ItemID;

                style.Delete();
            }

            Say(m_HairCutDone);
        }

        public override void OnDoubleClick(Mobile from)
        {
            if (from.AccessLevel >= AccessLevel.GameMaster)
            {
                //Display coices: "Customize vendor" "Paperdoll"
                base.OnDoubleClick(from);
            }
            else
                base.OnDoubleClick(from);
        }

        public void PlayScissorSound(Mobile customer)
        {
            customer.PlaySound(0x248);
        }

        public void DropHairResidue(Mobile customer)
        {
            DropHairResidue(customer, customer.Location, false);
        }

        public void DropHairResidue(Mobile customer, bool moreThanOnce)
        {
            DropHairResidue(customer, customer.Location, moreThanOnce);
        }

        public void DropHairResidue(Mobile customer, Point3D loc, bool moreThanOnce)
        {
            int hue = customer.HairHue;
            int xLoc = loc.X;
            int yLoc = loc.Y;

            for (int x = (xLoc - 1); x <= (xLoc + 1); x++)
            {
                for (int y = (yLoc - 1); y <= (yLoc + 1); y++)
                {
                    if (Utility.RandomDouble() <= m_HairDropChance)
                    {
                        HairResidue hr = new HairResidue(customer);

                        hr.MoveToWorld(new Point3D(x, y, customer.Location.Z), customer.Map);

                        if (!moreThanOnce)
                            break;
                    }
                }
            }
        }

        public bool CheckChair(Mobile customer)
        {
            //Check if the chair is empty, if its not empty tell the customer that someone is ocupying it.
            //If its empty tell the customer to sit down and be still

            return false;
        }

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);

            writer.Write((int)0); // version
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();
        }
    }
}



IN-X Scripts out in the open ? - imported_Taran - 08-22-2007

Maka created that script and he put it on public forums with purpose to promote IN:X. It's the only script that's public though.


IN-X Scripts out in the open ? - imported_Rackull - 08-22-2007

Taran Wrote:Maka created that script and he put it on public forums with purpose to promote IN:X. It's the only script that's public though.

Taran, page me by ICQ or MSN, it's not the only one from where I extracted them ...


IN-X Scripts out in the open ? - imported_AptaR - 08-22-2007

read the script man it clearly says its for inx AND the runuo community. k nubcake


IN-X Scripts out in the open ? - imported_Odium - 08-22-2007

the barber we will use on IN:X is everything but simple btw, and its more than 1 script Big Grin


IN-X Scripts out in the open ? - maka - 08-22-2007

You most likely got it from paste bin, cause they really shouldn't be anywhere else i think. Non the less, that script is actually meant for INX and the RunUO community to give us some props. If you got any other scripts with that, then I guess it's reason to worry. Never got done with it, and that is actually a very old versionTongue The new version has a LOT more and a lot better property system.

Also, since I'm the author of that script, I'd also appreciate a PM.


IN-X Scripts out in the open ? - imported_Nasir - 08-22-2007

Yea, that's from pastebin.


IN-X Scripts out in the open ? - imported_Rackull - 08-22-2007

maka Wrote:If you got any other scripts with that, then I guess it's reason to worry.

Also, since I'm the author of that script, I'd also appreciate a PM.

PM sent and you have something to consider not sure if it is for you to worry about ... I know I would be worried with it Wink


IN-X Scripts out in the open ? - maka - 08-22-2007

Yeah, like I said in the PM_ These are the paste bin scripts and it's not privileged or sensitive information, only reason "everyone" doesn't have them yet is cause I'm not finished with them. Want to make things 100% before I commit it to the RunUO community. This is a really old version of my barber too, will be so sweet when I've fully tweaked itBig Grin Some of the features can be seen in the script for the ones who are interested.

Just want to thank you here in the open too, so that people know you did a good thing. If our scripts somehow where compromised, then your help would have been essential in making sure to minimize the damage.


IN-X Scripts out in the open ? - imported_Rackull - 08-22-2007

maka Wrote:Just want to thank you here in the open too, so that people know you did a good thing. If our scripts somehow where compromised, then your help would have been essential in making sure to minimize the damage.

np mate, and thanks


IN-X Scripts out in the open ? - imported_Pande - 08-23-2007

maka, you made a typo on line 2

props to rackull Smile


IN-X Scripts out in the open ? - imported_Odium - 08-23-2007

locked, and yeah thnx rackull.