Example #1
0
        public static void On_Speech(SpeechEventArgs args)
        {
            Mobile m = (Mobile)args.Mobile;

            if (!Enabled)
            {
                return;
            }

            if (args.Speech.ToLower().Contains("i wish to rvs"))
            {
                if (m is PlayerMobile)
                {
                    if (Duel_Config.InADuel((PlayerMobile)m) || Field_Config.InAField((PlayerMobile)m) || InARVS((PlayerMobile)m))
                    {
                        m.SendMessage("You are already in a RVS duel.");
                        return;
                    }

                    if (!RVS_Config.AllowFactionersToRVS)
                    {
                        if ((Faction.Find(m) != null))
                        {
                            m.SendMessage("Factioners cannot RVS duel.");
                            return;
                        }
                    }

                    if (m.Combatant != null || m.Aggressed.Count >= 1)
                    {
                        m.SendMessage("You are in combat an cannot RVS duel.");
                        return;
                    }

                    RVS d = new RVS((PlayerMobile)m);
                    Registry.Add(d);
                    m.CloseGump(typeof(RVSSetup_Main));
                    m.SendGump(new RVSSetup_Main(d));
                }
            }

            if (args.Speech.ToLower().Contains("i yield"))
            {
                if (m is PlayerMobile)
                {
                    if (InARVS((PlayerMobile)m))
                    {
                        m.Kill();
                        return;
                    }
                }
            }
        }
Example #2
0
        public bool CanTarget(Mobile from, object o)
        {
            PlayerMobile pm = (PlayerMobile)from;
            PlayerMobile target;

            if (o is PlayerMobile)
            {
                target = (PlayerMobile)o;
            }
            else
            {
                pm.SendMessage("You must target another player.");
                return(false);
            }

            if (target.Criminal)
            {
                //pm.SendMessage("They are criminal and cannot participate in a duel.");
                //return false;
            }

            if (target.Combatant != null)
            {
                pm.SendMessage("They are in combat and cannot participate.");
                return(false);
            }

            if (target.Aggressed.Count > 0 || target.Aggressors.Count > 0)
            {
                //pm.SendMessage("They have been in combat recently and cannot participate.");
                //return false;
            }

            if (!target.Alive)
            {
                pm.SendMessage("Only living players can participate in a duel.");
                return(false);
            }

            if (Duel_Config.InADuel(target) || Field_Config.InAField(target))
            {
                pm.SendMessage("They are already in a duel.");
                return(false);
            }

            if (!Duel_Config.AllowSameIPDuels && SameIP(pm, (PlayerMobile)target))
            {
                pm.SendMessage("You cannot duel them as there account is sharing the same ip as yours.");
                return(false);
            }

            if (!Duel_Config.AllowFactionersToDuel)
            {
                if (Faction.Find(target) != null)
                {
                    pm.SendMessage("Factioners cannot duel.");
                    return(false);
                }
            }

            return(true);
        }