Exemple #1
0
        public Player(Ethic ethic, Mobile mobile)
        {
            m_Ethic  = ethic;
            m_Mobile = mobile;

            m_Power   = 5;
            m_History = 5;
        }
Exemple #2
0
        public static bool CheckTrade(Mobile from, Mobile to, Mobile newOwner, Item item)
        {
            Ethic itemEthic = Find(item);

            if (itemEthic == null || Find(newOwner) == itemEthic)
            {
                return(true);
            }

            if (itemEthic == Hero)
            {
                (from == newOwner ? to : from).SendMessage("Only heros may receive this item.");
            }
            else if (itemEthic == Evil)
            {
                (from == newOwner ? to : from).SendMessage("Only the evil may receive this item.");
            }

            return(false);
        }
Exemple #3
0
        public static bool CheckEquip(Mobile from, Item item)
        {
            Ethic itemEthic = Find(item);

            if (itemEthic == null || Find(from) == itemEthic)
            {
                return(true);
            }

            if (itemEthic == Hero)
            {
                from.SendMessage("Only heros may wear this item.");
            }
            else if (itemEthic == Evil)
            {
                from.SendMessage("Only the evil may wear this item.");
            }

            return(false);
        }
Exemple #4
0
        public Player(Ethic ethic, GenericReader reader)
        {
            m_Ethic = ethic;

            int version = reader.ReadEncodedInt();

            switch (version)
            {
            case 0:
            {
                m_Mobile = reader.ReadMobile();

                m_Power   = reader.ReadEncodedInt();
                m_History = reader.ReadEncodedInt();

                m_Steed    = reader.ReadMobile();
                m_Familiar = reader.ReadMobile();

                m_Shield = reader.ReadDeltaTime();

                break;
            }
            }
        }
Exemple #5
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
            {
                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;
                }
            }
        }