Esempio n. 1
0
        public static void EventSink_Speech(SpeechEventArgs args)
        {
            string said = args.Speech.ToLower();
            Mobile from = args.Mobile;

            switch (said)
            {
            case ("i wish to duel"):
            {
                if (from.Region is DuelRegion || DuelGump.Exists(from) || ((PlayerMobile)from).SentRequest || ((PlayerMobile)from).RecievedRequest)
                {
                    from.SendAsciiMessage("You are too busy to duel someone else.");
                }
                else if (!from.Alive)
                {
                    from.SendMessage("You cannot duel while dead.");
                }
                else if (from.Aggressed.Count != 0 || from.Aggressors.Count != 0)
                {
                    from.SendMessage("You cannot duel while in combat.");
                }
                else if (from.Hits != from.HitsMax)
                {
                    from.SendMessage("You need to heal before offering a duel.");
                }
                else
                {
                    from.Target = new DuelTarget(from);
                    ((PlayerMobile)from).SentRequest = true;
                }
                break;
            }
            }
        }
Esempio n. 2
0
 protected override void OnTarget(Mobile from, object targeted)
 {
     if (targeted is Mobile)
     {
         if (targeted is PlayerMobile)
         {
             if (targeted == m_Sender)
             {
                 from.SendAsciiMessage("You cannot duel yourself.");
             }
             else if (DuelGump.Exists((Mobile)targeted) || ((Mobile)targeted).Region is DuelRegion || ((PlayerMobile)targeted).SentRequest || ((PlayerMobile)targeted).RecievedRequest)
             {
                 from.SendAsciiMessage("They look busy, maybe you should try again later.");
                 ((PlayerMobile)from).SentRequest = false;
             }
             else if (!((Mobile)targeted).Alive)
             {
                 from.SendMessage("A live opponent would be a better choice.");
                 ((PlayerMobile)from).SentRequest = false;
             }
             else if (!from.Alive)
             {
                 from.SendMessage("You cannot duel while dead.");
                 ((PlayerMobile)from).SentRequest = false;
             }
             else if (from.Hits != from.HitsMax)
             {
                 from.SendMessage("You need to heal before offering a duel.");
                 ((PlayerMobile)from).SentRequest = false;
             }
             else if (((Mobile)targeted).Hits != ((Mobile)targeted).HitsMax)
             {
                 from.SendMessage("They are not at full health.");
                 ((PlayerMobile)from).SentRequest = false;
             }
             else
             {
                 m_Reciever = (PlayerMobile)targeted;
                 ((PlayerMobile)m_Reciever).RecievedRequest = true;
                 m_Reciever.SendGump(new DuelAcceptGump(m_Sender, m_Reciever));
             }
         }
         else if (((Mobile)targeted).Body.IsHuman)
         {
             from.SendAsciiMessage(((Mobile)targeted).Name + " does not wish to duel you.");
             ((PlayerMobile)from).SentRequest = false;
         }
         else
         {
             from.SendAsciiMessage("Maybe you should just attack it.");
             ((PlayerMobile)from).SentRequest = false;
         }
     }
     else
     {
         from.SendAsciiMessage("You seem to have died since making the offer.");
     }
 }