Exemple #1
0
            public InternalTarget(Mobile from, ClockworkMechanism item, SutekResourceType type, int remaining, double delay, DateTime endtime)
                : base(2, true, TargetFlags.None)
            {
                this.m_Item      = item;
                this.m_Type      = type;
                this.m_Remaining = remaining;
                this.m_EndTime   = endtime;
                this.m_Delay     = delay;

                from.SendLocalizedMessage(1112821, String.Concat("#", SutekQuestResource.GetLabelId(this.m_Type).ToString())); // I need to add some ~1_INGREDIENT~.

                this.BeginTimeout(from, this.m_EndTime - DateTime.UtcNow);
            }
Exemple #2
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Item == null || m_Item.Deleted)
                {
                    return;
                }

                if (targeted is SutekQuestResource && ((SutekQuestResource)targeted).ActualType == m_Type)
                {
                    CancelTimeout();

                    if (--m_Remaining > 0)
                    {
                        from.SendLocalizedMessage(1112819); // You've successfully added this ingredient.
                        m_Type    = SutekQuestResource.GetRandomResource();
                        m_Delay  += 0.1 + (Utility.RandomDouble() / 4.0);
                        m_EndTime = DateTime.UtcNow + TimeSpan.FromSeconds(m_Delay);
                    }
                    else
                    {
                        m_Item.StopTimer();
                        Item item = new CompletedClockworkAssembly();
                        if (null == m_Item.Parent && m_Item.Parent is Container)
                        {
                            item.Location = new Point3D(m_Item.Location);
                            ((Container)m_Item.Parent).AddItem(item);
                        }
                        else
                        {
                            item.MoveToWorld(m_Item.GetWorldLocation(), m_Item.Map);
                        }

                        m_Item.Delete();

                        from.SendLocalizedMessage(1112987); // The training clockwork fails and the creature vanishes.
                        from.SendLocalizedMessage(1112872);
                        // Your assembly is completed. Return it to Sutek for your reward!
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1112820); // That is not the right ingredient.
                    OnTargetCancel(from, TargetCancelType.Timeout);
                }
            }
Exemple #3
0
 public InternalTarget(Mobile from, ClockworkMechanism item)
     : this(from, item, SutekQuestResource.GetRandomResource(), Utility.RandomMinMax(10, 20), 10.0, DateTime.UtcNow + TimeSpan.FromSeconds(10.0))
 {
 }