예제 #1
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);
                }
            }
예제 #2
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (this.m_Item == null || this.m_Item.Deleted)
                    return;

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

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

                        this.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.
                    this.OnTargetCancel(from, TargetCancelType.Timeout);
                }
            }