public override void OnDoubleClick(Mobile from)
        {
            PlayerMobile pm = from as PlayerMobile;

            if (null == pm)
            {
                return;
            }

            if (!pm.MechanicalLife)
            {
                from.SendLocalizedMessage(1113034);   // You haven't read the Mechanical Life Manual. Talking to Sutek might help!
            }

            if (!this.IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1071944);   // The clockwork assembly must be in your backpack to construct a golem.
                return;
            }

            double tinkerSkill = from.Skills[SkillName.Tinkering].Value;

            if (tinkerSkill < 60.0)
            {
                from.SendLocalizedMessage(1113054); // You must be a Journeyman or higher Tinker to construct a mechanical pet.
                return;
            }

            if ((int)this.m_Type > m_Info.Length)
            {
                return;
            }

            GolemInfo ginfo = m_Info[(int)this.m_Type];

            if ((from.Followers + ginfo.Slots) > from.FollowersMax)
            {
                from.SendLocalizedMessage(1049607); // You have too many followers to control that creature.
                return;
            }

            Container pack = from.Backpack;

            if (pack == null)
            {
                return;
            }

            // check array length to prevent errors
            if (ginfo.Types.Length != ginfo.Amounts.Length)
            {
                return;
            }

            int res = pack.ConsumeTotal(ginfo.Types, ginfo.Amounts);

            if (res >= 0)
            {
                // send message, if valid index
                if (res < ginfo.MsgIds.Length)
                {
                    from.SendLocalizedMessage(ginfo.MsgIds[res]);   // You need _____ to construct a mechanical pet.
                }
                return;
            }

            BaseCreature bc = null;

            switch (this.m_Type)
            {
            case ClockworkType.Scorpion:
                bc = new ClockworkScorpion();
                break;

            case ClockworkType.Wolf:
                bc = new LeatherWolf();
                break;

            case ClockworkType.Vollem:
                bc = new Vollem();
                break;
            }

            if (null != bc && bc.SetControlMaster(from))
            {
                this.Delete();

                bc.MoveToWorld(from.Location, from.Map);
                from.PlaySound(0x241);
            }
        }
Example #2
0
 //Vector3 Target;
 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     golem = animator.GetComponent <GolemInfo>();
     golem.SpellSkill1();
 }