示例#1
0
		public EthicsItem( GenericReader reader, Ethic ethic )
		{
			int version = reader.ReadEncodedInt();

			switch ( version )
			{
				case 2:
				{
					m_IsRunic = reader.ReadBool();
					m_OrigHue = reader.ReadInt();
					goto case 0;
				}
				case 1:
				{
					/*m_OrigLootType = (LootType)*/reader.ReadByte();
					m_OrigHue = reader.ReadInt();
					goto case 0;
				}
				case 0:
				{
					m_Item = reader.ReadItem();
					m_Expiration = reader.ReadDateTime();
					break;
				}
			}

			m_Ethic = ethic;
		}
示例#2
0
        public EthicsItem(GenericReader reader, Ethic ethic)
        {
            int version = reader.ReadEncodedInt();

            switch (version)
            {
            case 2:
            {
                m_IsRunic = reader.ReadBool();
                m_OrigHue = reader.ReadInt();
                goto case 0;
            }

            case 1:
            {
                /*m_OrigLootType = (LootType)*/ reader.ReadByte();
                m_OrigHue = reader.ReadInt();
                goto case 0;
            }

            case 0:
            {
                m_Item       = reader.ReadItem();
                m_Expiration = reader.ReadDateTime();
                break;
            }
            }

            m_Ethic = ethic;
        }
示例#3
0
/*
 *              [CommandProperty( AccessLevel.GameMaster )]
 *              public bool IsShielded
 *              {
 *                      get
 *                      {
 *                              if ( m_Shield == DateTime.MinValue )
 *                                      return false;
 *
 *                              if ( DateTime.Now < ( m_Shield + TimeSpan.FromHours( 1.0 ) ) )
 *                                      return true;
 *
 *                              FinishShield();
 *                              return false;
 *                      }
 *              }
 *
 *              public void BeginShield()
 *              {
 *                      m_Shield = DateTime.Now;
 *              }
 *
 *              public void FinishShield()
 *              {
 *                      m_Shield = DateTime.MinValue;
 *              }
 */
        public Player(Ethic ethic, Mobile mobile)
        {
            m_Ethic  = ethic;
            m_Mobile = mobile;

            m_Power = 10;
        }
示例#4
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 heroes may wear this item.");
            }
            else if (itemEthic == Evil)
            {
                from.SendMessage("Only evil may wear this item.");
            }

            if (Find(from) == null)
            {
                DestoryItem(from, item);
            }

            return(false);
        }
示例#5
0
 public void CheckAttach()
 {
     if (Ethic.IsEligible(Mobile))
     {
         Attach();
     }
 }
        public static Item Imbue(Item item, Ethic ethic, bool expire, int hue)
        {
            if ((item is IEthicsItem))
            {
                EthicsItem state = Find(item);

                if (state == null)
                {
                    state = new EthicsItem(item, ethic);
                    state.Attach();
                }

                if (expire)
                {
                    state.StartExpiration();
                }

                state.m_OrigHue      = item.Hue;
                state.m_OrigLootType = item.LootType;
                item.Hue             = hue;
                item.LootType        = LootType.Blessed;
            }

            return(item);
        }
示例#7
0
        public static bool CheckEquip(Mobile from, Item item)
        {
            Ethic itemEthic = Find(item);

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

            if (from.AccessLevel >= AccessLevel.GameMaster && (itemEthic == Hero || itemEthic == Evil))
            {
                from.SendMessage("That item may only be equipped by someone ethically aligned, but your godly powers allow it.");
                return(true);
            }

            if (itemEthic == Hero && item is BaseWeapon)
            {
                from.SendMessage("Only a heroes may equip a holy item.");                 // 1045115: Only Paladins may equip a holy item (I believe Paladin is a later faction term)
            }
            else if (itemEthic == Evil && item is BaseWeapon)
            {
                from.SendLocalizedMessage(1045116);                 // Only evils may equip an unholy item
            }
            else 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);
        }
示例#8
0
        public Player(Ethic ethic, Mobile mobile)
        {
            Ethic  = ethic;
            Mobile = mobile;

            Power   = 5;
            History = 5;
        }
示例#9
0
        public Player(Ethic ethic, Mobile mobile)
        {
            m_Ethic  = ethic;
            m_Mobile = mobile;

            m_Power   = 5;
            m_History = 5;
        }
示例#10
0
文件: Player.cs 项目: pallop/Servuo
        public Player(Ethic ethic, Mobile mobile)
        {
            this.m_Ethic  = ethic;
            this.m_Mobile = mobile;

            this.m_Power   = 5;
            this.m_History = 5;
        }
示例#11
0
        public Player(Ethic ethic, Mobile mobile)
        {
            m_Ethic  = ethic;
            m_Mobile = mobile;

            m_Sphere = 5;
            m_Power  = 10;
            Grant();
        }
示例#12
0
		public Player( Ethic ethic, Mobile mobile )
		{
			m_Ethic = ethic;
			m_Mobile = mobile;

            m_Sphere = 5;
			m_Power = 10;
            Grant();
		}
示例#13
0
 public EthicsItem(Item item, Ethic ethic)
 {
     m_Item  = item;
     m_Ethic = ethic;
     if (item is IDurability)
     {
         ((IDurability)item).MaxHitPoints = 150;
         ((IDurability)item).HitPoints    = 150;
     }
 }
示例#14
0
		public EthicsItem( Item item, Ethic ethic )
		{
			m_Item = item;
			m_Ethic = ethic;
		    if (item is IDurability)
		    {
		        ((IDurability)item).MaxHitPoints = 150;
                ((IDurability)item).HitPoints = 150;
		    }
		}
示例#15
0
        public Player(Ethic ethic, GenericReader reader)
        {
            m_Ethic = ethic;

            int version = reader.ReadEncodedInt();

            switch (version)
            {
            case 2:
            {
                m_Sphere = reader.ReadInt();                         //We want the rank adjusted from here.

                goto case 1;
            }

            case 1:
            {
                m_Mobile = reader.ReadMobile();

                m_Power = reader.ReadEncodedInt();

                if (version < 2)
                {
                    /*m_History =*/ reader.ReadEncodedInt();
                    m_History = 0;
                }

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

                break;
            }

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

                m_Power = reader.ReadEncodedInt();

                if (version < 2)
                {
                    /*m_History =*/ reader.ReadEncodedInt();
                    m_History = 0;
                }

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

                break;
            }
            }
        }
示例#16
0
        public Player(Ethic ethic, Mobile mobile)
        {
            m_Ethic  = ethic;
            m_Mobile = mobile;

            // Old Ethics say: A Hero will start with on sphere 1 and have 10 lifeforce, but also say:
            //	"The more advanced the player, the higher initial values of sphere and lifeforce the evil will start with."
            //	so if you are Evil we will give you 10 + your skill total / 20. For a 7xGM this would be 10 + 35 or 45 life force with a sphere of 4
            //	if you are Hero you will get the standard 10 .. wtf
            // This is Question(3) on the message boards
            m_Power = (Core.OldEthics) ?
                      ethic == Ethics.Ethic.Hero ? 10 :  10 + (PlayerMobile.ComputeSkillTotal(mobile) / 20) :
                      5;
            m_History = m_Power;
        }
示例#17
0
        public static bool IsEthicsDeath(Mobile from)
        {
            Player fromState = Player.Find(from);

            if (fromState.HasFallen)               //Fallen heroes/evils get no rights.
            {
                return(false);
            }

            Ethic fromEthic = fromState.Ethic;

            int ethicdamage    = 0;
            int nonethicdamage = 0;

            for (int i = from.DamageEntries.Count - 1; i >= 0; --i)
            {
                if (i >= from.DamageEntries.Count)
                {
                    continue;
                }

                DamageEntry de = from.DamageEntries[i];

                if (de.HasExpired)
                {
                    from.DamageEntries.RemoveAt(i);
                }
                else if (de.Damager != from)
                {
                    Ethic ethic = Ethic.Find(de.Damager);
                    if (ethic != null && ethic != fromEthic)
                    {
                        if (i == from.DamageEntries.Count - 1)
                        {
                            return(true);                            //Most recent damager
                        }
                        ethicdamage += de.DamageGiven;
                    }
                    else
                    {
                        nonethicdamage += de.DamageGiven;
                    }
                }
            }

            return(ethicdamage > nonethicdamage);            //At least 50% ethic damage
        }
示例#18
0
        public static Item Imbue(Item item, Ethic ethic, int hue)
        {
            if ((item is IEthicsItem))
            {
                EthicsItem state = Find(item);

                if (state == null)
                {
                    state = new EthicsItem(item, ethic);
                    state.Attach();
                }

                state.m_OrigHue = item.Hue;
                item.Hue        = hue;
            }

            return(item);
        }
示例#19
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;
                    }
                }
            }
        }
示例#20
0
文件: Ethic.cs 项目: pallop/Servuo
        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);
        }
示例#21
0
        public static bool CheckTrade(Mobile from, Mobile to, Mobile newOwner, Item item)
        {
            Ethic itemEthic = Find(item);

            if (itemEthic == null || Find(newOwner) == itemEthic || from.AccessLevel >= AccessLevel.GameMaster ||
                to.AccessLevel >= AccessLevel.GameMaster)
            {
                return(true);
            }

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

            return(false);
        }
示例#22
0
文件: Player.cs 项目: pallop/Servuo
        public Player(Ethic ethic, GenericReader reader)
        {
            this.m_Ethic = ethic;

            int version = reader.ReadEncodedInt();

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

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

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

                this.m_Shield = reader.ReadDeltaTime();

                break;
            }
            }
        }
示例#23
0
        public Player(Ethic ethic, IGenericReader reader)
        {
            Ethic = ethic;

            var version = reader.ReadEncodedInt();

            switch (version)
            {
            case 0:
            {
                Mobile = reader.ReadEntity <Mobile>();

                Power   = reader.ReadEncodedInt();
                History = reader.ReadEncodedInt();

                Steed    = reader.ReadEntity <Mobile>();
                Familiar = reader.ReadEntity <Mobile>();

                m_Shield = reader.ReadDeltaTime();

                break;
            }
            }
        }
示例#24
0
		public static Item Imbue( Item item, Ethic ethic, int hue )
		{
			if ( (item is IEthicsItem) )
			{
				EthicsItem state = Find( item );

				if ( state == null )
				{
					state = new EthicsItem( item, ethic );
					state.Attach();
				}

				state.m_OrigHue = item.Hue;
				item.Hue = hue;
			}

			return item;
		}
示例#25
0
文件: Ethic.cs 项目: pallop/Servuo
        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;
                }
            }
        }
示例#26
0
		public Player( Ethic ethic, GenericReader reader )
		{
			m_Ethic = ethic;

			int version = reader.ReadEncodedInt();

			switch ( version )
			{
				case 2:
				{
					m_Sphere = reader.ReadInt(); //We want the rank adjusted from here.

					goto case 1;
				}
				case 1:
				{
					m_Mobile = reader.ReadMobile();

					m_Power = reader.ReadEncodedInt();

					if ( version < 2 )
					{
						/*m_History =*/ reader.ReadEncodedInt();
						m_History = 0;
					}

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

					break;
				}
				case 0:
				{
					m_Mobile = reader.ReadMobile();

					m_Power = reader.ReadEncodedInt();

					if ( version < 2 )
					{
						/*m_History =*/ reader.ReadEncodedInt();
						m_History = 0;
					}

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

					break;
				}
			}
		}
示例#27
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;
                }
            }
        }
示例#28
0
 public EthicsItem(Item item, Ethic ethic)
 {
     m_Item  = item;
     m_Ethic = ethic;
 }