Exemple #1
0
        public static void EventSink_Speech(SpeechEventArgs e)
        {
            if (e.Blocked || e.Handled)
            {
                return;
            }

            if (Enabled)
            {
                Mobile m = e.Mobile;

                Player pl = Player.Find(m);

                if (pl != null)
                {
                    if (e.Mobile is PlayerMobile && (e.Mobile as PlayerMobile).DuelContext != null)
                    {
                        return;
                    }

                    Ethic ethic = pl.Ethic;

                    for (int i = 0; i < ethic.Definition.Powers.Length; ++i)
                    {
                        Power power = ethic.Definition.Powers[i];

                        if (!Insensitive.Equals(power.Definition.Phrase.String, e.Speech))
                        {
                            continue;
                        }

                        if (!power.CheckInvoke(pl))
                        {
                            continue;
                        }

                        power.BeginInvoke(pl);
                        e.Handled = true;

                        break;
                    }
                }
            }
        }
Exemple #2
0
        public static void EventSink_Speech(SpeechEventArgs e)
        {
            if (e.Blocked || e.Handled)
            {
                return;
            }

            Player pl = Player.Find(e.Mobile);

            if (pl == null)
            {
                for (int i = 0; i < Ethics.Length; ++i)
                {
                    Ethic ethic = Ethics[i];

                    if (!ethic.IsEligible(e.Mobile))
                    {
                        continue;
                    }

                    if (!Insensitive.Equals(ethic.Definition.JoinPhrase.String, e.Speech))
                    {
                        continue;
                    }

                    bool isNearAnkh = false;

                    foreach (Item item in e.Mobile.GetItemsInRange(2))
                    {
                        if (item is Items.AnkhNorth || item is Items.AnkhWest)
                        {
                            isNearAnkh = true;
                            break;
                        }
                    }

                    if (!isNearAnkh)
                    {
                        continue;
                    }

                    pl = new Player(ethic, e.Mobile);

                    pl.Attach();

                    e.Mobile.FixedEffect(0x373A, 10, 30);
                    e.Mobile.PlaySound(0x209);

                    e.Handled = true;
                    break;
                }
            }
            else
            {
                Ethic ethic = pl.Ethic;

                for (int i = 0; i < ethic.Definition.Powers.Length; ++i)
                {
                    Power power = ethic.Definition.Powers[i];

                    if (!Insensitive.Equals(power.Definition.Phrase.String, e.Speech))
                    {
                        continue;
                    }

                    if (!power.CheckInvoke(pl))
                    {
                        continue;
                    }

                    power.BeginInvoke(pl);
                    e.Handled = true;

                    break;
                }
            }
        }
Exemple #3
0
        public static void EventSink_Speech(SpeechEventArgs e)
        {
            if (e.Blocked || e.Handled)
            {
                return;
            }

            Player pl = Player.Find(e.Mobile);

            if (pl == null)
            {
                for (int i = 0; i < Ethics.Length; ++i)
                {
                    Ethic ethic = Ethics[i];

                    if (!Insensitive.Equals(ethic.Definition.JoinPhrase.String, e.Speech))
                    {
                        continue;
                    }

                    if (!ethic.IsEligible(e.Mobile))
                    {
                        if (Core.OldEthics)
                        {
                            if ((e.Mobile.CreationTime + TimeSpan.FromHours(24)) > DateTime.Now)
                            {
                                e.Mobile.SendLocalizedMessage(502593);                                 // Thou art too young to choose this fate.
                            }
                        }
                        break;
                    }

                    // don't allow tarnished players to join as Heros
                    if (Core.OldEthics)
                    {
                        // no murder counts if Hero. Evil ok
                        if (!(ethic == Ethic.Evil || (e.Mobile.ShortTermMurders == 0 && !e.Mobile.Murderer)))
                        {                               // not an official H/E string. I wish I knew what it was!
                            e.Mobile.SendMessage("Your murderous ways prevent you from taking this path.");
                            break;
                        }

                        // Heros can't belong to the Thieves guild and gain life force. Evil ok
                        if (!(ethic == Ethic.Evil || ((e.Mobile is PlayerMobile) && (e.Mobile as PlayerMobile).NpcGuild != NpcGuild.ThievesGuild)))
                        {                               // not an official H/E string. I wish I knew what it was!
                            e.Mobile.SendMessage("You must first quit the thieves' guild.");
                            break;
                        }
                    }

                    bool isNearAnkh = false;

                    foreach (Item item in e.Mobile.GetItemsInRange(2))
                    {
                        if (item is Items.AnkhNorth || item is Items.AnkhWest)
                        {
                            isNearAnkh = true;
                            break;
                        }
                    }

                    if (!isNearAnkh)
                    {
                        continue;
                    }

                    pl = new Player(ethic, e.Mobile);

                    pl.Attach();
                    e.Mobile.Delta(MobileDelta.Noto);

                    e.Mobile.FixedEffect(0x373A, 10, 30);
                    e.Mobile.PlaySound(0x209);

                    if (Core.OldEthics)
                    {
                        if (ethic == Ethic.Evil)
                        {
                            e.Mobile.SendLocalizedMessage(502595);                             // You are now evil.
                        }
                    }
                    //else
                    //don't know if or what the message is here

                    e.Handled = true;
                    break;
                }
            }
            else
            {
                Ethic ethic = pl.Ethic;

                for (int i = 0; i < ethic.Definition.Powers.Length; ++i)
                {
                    Power power = ethic.Definition.Powers[i];

                    if (!Insensitive.Equals(power.Definition.Phrase.String, e.Speech))
                    {
                        continue;
                    }

                    if (!power.CheckInvoke(pl))
                    {
                        continue;
                    }

                    power.BeginInvoke(pl);
                    e.Handled = true;

                    break;
                }
            }
        }