当前位置: 首页>>代码示例>>C#>>正文


C# BaseCreature.GetType方法代码示例

本文整理汇总了C#中BaseCreature.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# BaseCreature.GetType方法的具体用法?C# BaseCreature.GetType怎么用?C# BaseCreature.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BaseCreature的用法示例。


在下文中一共展示了BaseCreature.GetType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandleKill

        public static void HandleKill(BaseCreature victim, Mobile damager, bool highestDamager)
        {
            if (victim == null || damager == null || damager.Map != Map.TerMur)
                return;

            if(PointsEntry.Entries.ContainsKey(victim.GetType()))
                ProcessKill(victim, damager, highestDamager);
        }
开发者ID:bittiez,项目名称:ServUO,代码行数:8,代码来源:LoyaltySystem.cs

示例2: MobileStatuette

		/// <summary>
		/// Creates a new MobileStatuette object - for internal use only
		/// </summary>
		private MobileStatuette( BaseCreature creature )
		{
			m_Creature = creature;
			ItemID = ShrinkTable.Lookup( m_Creature );
			Hue = m_Creature.Hue;

			m_Creature.ControlTarget = null;
			m_Creature.ControlOrder = OrderType.Stay;
			m_Creature.Internalize();
			m_Creature.SetControlMaster( null );
			m_Creature.SummonMaster = null;
			m_Creature.IsStabled = true;

			// Set the type of the creature as the name for this item
			Name = InsertSpaces( creature.GetType().Name );
		}
开发者ID:greeduomacro,项目名称:annox,代码行数:19,代码来源:MobileStatuette.cs

示例3: MobileStatuette

		/// <summary>
		/// Creates a new MobileStatuette object - for internal use only
		/// </summary>
		private MobileStatuette( BaseCreature creature )
		{
			m_Creature = creature;
			ItemID = ShrinkTable.Lookup( m_Creature );
			Hue = m_Creature.Hue;

			m_Creature.ControlTarget = null;
			m_Creature.ControlOrder = OrderType.Stay;
			m_Creature.Internalize();
			m_Creature.SetControlMaster( null );
			m_Creature.SummonMaster = null;
			m_Creature.IsStabled = true;

			// Set the type of the creature as the name for this item
			Name = Xanthos.Utilities.Misc.GetFriendlyClassName( creature.GetType().Name );
		}
开发者ID:ITLongwell,项目名称:aedilis2server,代码行数:19,代码来源:MobileStatuette.cs

示例4: ProcessKill

        public static void ProcessKill(BaseCreature victim, Mobile damager, bool highestDamager)
        {
            Type type = victim.GetType();

            if (damager is BaseCreature && (((BaseCreature)damager).Controlled || ((BaseCreature)damager).Summoned))
                damager = ((BaseCreature)damager).GetMaster();

            if (damager == null)
                return;

            if(highestDamager)
            {
                if(PointsEntry.Entries.ContainsKey(type))
                    AwardPoints(damager, PointsEntry.Entries[type].TopAttackerPoints, false);
            }
            else
            {
                if(PointsEntry.Entries.ContainsKey(type))
                    AwardPoints(damager, PointsEntry.Entries[type].RightsPoints, false);
            }
        }
开发者ID:bittiez,项目名称:ServUO,代码行数:21,代码来源:LoyaltySystem.cs

示例5: ProcessKill

		public override void ProcessKill(BaseCreature victim, Mobile damager, int index)
		{
			if(victim.Map != Map.TerMur || damager.Map != Map.TerMur)
				return;
				
			Type type = victim.GetType();

            if (damager is BaseCreature && (((BaseCreature)damager).Controlled || ((BaseCreature)damager).Summoned))
                damager = ((BaseCreature)damager).GetMaster();

            if (damager == null)
                return;

			if(index == 0)
			{
				if(Entries.ContainsKey(type))
					AwardPoints(damager, Entries[type].Item1, false);
			}
			else
			{
				if(Entries.ContainsKey(type))
					AwardPoints(damager, Entries[type].Item2, false);
			}
		}
开发者ID:Crome696,项目名称:ServUO,代码行数:24,代码来源:QueensLoyalty.cs

示例6: OnDeath

        public static void OnDeath(BaseCreature bc, Container corpse)
        {
            if (corpse == null || corpse.Map == Map.Internal || corpse.Map == null)
                return;

            Type type = bc.GetType();

            foreach(KeyValuePair<Type, List<DropEntry>> kvp in m_Table)
            {
                if (type == kvp.Key || type.IsSubclassOf(kvp.Key))
                {
                    Region r = Region.Find(corpse.Location, corpse.Map);
                    Map map = corpse.Map;

                    if (r != null)
                    {
                        foreach (DropEntry entry in kvp.Value)
                        {
                            if (entry.Region == null || entry.Region == r.Name || entry.Region == map.ToString())
                            {
                                for (int i = 0; i < entry.Amount; i++)
                                {
                                    if (Utility.Random(100) < entry.Probability)
                                    {
                                        Item item = RunicReforging.GenerateRandomItem(bc.LastKiller, bc);

                                        if (item != null)
                                            corpse.DropItem(item);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
开发者ID:Ziden,项目名称:ServUO-EC-Test-Fork,代码行数:36,代码来源:RandomItemGenerator.cs

示例7: OnKill

		public override void OnKill( BaseCreature creature, Container corpse )
		{
			IngredientInfo info = IngredientInfo.Get( this.Ingredient );

			for ( int i = 0; i < info.Creatures.Length; i++ )
			{
				Type type = info.Creatures[i];

				if ( creature.GetType() == type )
				{
					System.From.SendLocalizedMessage( 1055043, "#" + info.Name ); // You gather a ~1_INGREDIENT_NAME~ from the corpse.

					CurProgress++;

					break;
				}
			}
		}
开发者ID:kamronbatman,项目名称:DefianceUO-Pre1.10,代码行数:18,代码来源:Objectives.cs

示例8: TransferItem

            public TransferItem( BaseCreature creature )
                : base(ShrinkTable.Lookup( creature ))
            {
                m_Creature = creature;

                Movable = false;

                if( !Core.AOS )
                {
                    Name = creature.Name;
                }
                else if( this.ItemID == ShrinkTable.DefaultItemID ||  creature.GetType().IsDefined( typeof( FriendlyNameAttribute ), false ) )
                    Name = FriendlyNameAttribute.GetFriendlyNameFor( creature.GetType() ).ToString();

                //(As Per OSI)No name.  Normally, set by the ItemID of the Shrink Item unless we either explicitly set it with an Attribute, or, no lookup found
            }
开发者ID:greeduomacro,项目名称:aediliszeta,代码行数:16,代码来源:BaseAI.cs

示例9: AnimalLoreGump


//.........这里部分代码省略.........

					if ((c.PackInstinct & PackInstinct.Canine) != 0)
						packInstinct = 1049570; // Canine
					else if ((c.PackInstinct & PackInstinct.Ostard) != 0)
						packInstinct = 1049571; // Ostard
					else if ((c.PackInstinct & PackInstinct.Feline) != 0)
						packInstinct = 1049572; // Feline
					else if ((c.PackInstinct & PackInstinct.Arachnid) != 0)
						packInstinct = 1049573; // Arachnid
					else if ((c.PackInstinct & PackInstinct.Daemon) != 0)
						packInstinct = 1049574; // Daemon
					else if ((c.PackInstinct & PackInstinct.Bear) != 0)
						packInstinct = 1049575; // Bear
					else if ((c.PackInstinct & PackInstinct.Equine) != 0)
						packInstinct = 1049576; // Equine
					else if ((c.PackInstinct & PackInstinct.Bull) != 0)
						packInstinct = 1049577; // Bull

					AddHtmlLocalized(153, 204, 160, 18, packInstinct, LabelColor, false, false);

					AddImage(128, 224, 2086);
					AddHtmlLocalized(147, 222, 160, 18, 1049594, 200, false, false); // Loyalty Rating

					// loyalty redo
					int loyaltyval = (int)c.Loyalty / 10;
					if (loyaltyval < 0)
						loyaltyval = 0;
					if (loyaltyval > 11)
						loyaltyval = 11;
					AddHtmlLocalized(153, 240, 160, 18, (!c.Controlled || c.Loyalty == PetLoyalty.None) ? 1061643 : 1049594 + loyaltyval, LabelColor, false, false);

					break;
					#endregion
				}
				default: // rest of the pages are filled with genes - be sure to adjust "pg" calc in here when adding pages
				{
                    int nextpage = 3;

                    // idea for later - flesh out custom pages more, a string[] is hackish

                    //List<string[]> custompages = c.GetAnimalLorePages();
                    //if (custompages != null && page >= nextpage && page < (nextpage + custompages.Count))
                    //{
                    //    foreach (string[] s in custompages)
                    //    {
                    //        for (int i = 0; i < s.Length; i++)
                    //        {
                    //            AddHtml(153, 168 + 18 * i, 150, 18, s[i], false, false);
                    //        }
                    //    }

                    //    nextpage += custompages.Count;
                    //}

					#region Genetics
                    if (page >= nextpage)
                    {
                        List<PropertyInfo> genes = new List<PropertyInfo>();

                        foreach (PropertyInfo pi in c.GetType().GetProperties())
                        {
                            GeneAttribute attr = (GeneAttribute)Attribute.GetCustomAttribute(pi, typeof(GeneAttribute), true);
                            if (attr == null)
                                continue;
                            if (m_User.AccessLevel < AccessLevel.Counselor && !Server.Misc.TestCenter.Enabled)
                            {
                                if (attr.Visibility == GeneVisibility.Invisible)
                                    continue;
                                if (attr.Visibility == GeneVisibility.Tame && m_User != c.ControlMaster)
                                    continue;
                            }

                            genes.Add(pi);
                        }

                        int pg = m_Page - nextpage;

                        AddImage(128, 152, 2086);
                        AddHtml(147, 150, 160, 18, "Genetics", false, false);

                        for (int i = 0; i < 9; i++)
                        {
                            if (pg * 9 + i >= genes.Count)
                                break;

                            GeneAttribute attr = (GeneAttribute)Attribute.GetCustomAttribute(genes[pg * 9 + i], typeof(GeneAttribute), true);
                            AddHtml(153, 168 + 18 * i, 120, 18, attr.Name, false, false);
                            AddHtml(240, 168 + 18 * i, 115, 18, String.Format("<div align=right>{0:G3}</div>", c.DescribeGene(genes[pg * 9 + i], attr)), false, false);
                        }
                    }
					break;
					#endregion
				}
			}

			if (m_Page < NumTotalPages - 1)
				AddButton(340, 358, 5601, 5605, (int)ButtonID.NextPage, GumpButtonType.Reply, 0);
			if (m_Page > 0)
				AddButton(317, 358, 5603, 5607, (int)ButtonID.PrevPage, GumpButtonType.Reply, 0);
		}
开发者ID:zerodowned,项目名称:angelisland,代码行数:101,代码来源:AnimalLore.cs

示例10: Check

		public static bool Check( TalismanSlayerName name, BaseCreature creature )
		{
			Type[] types = GetSlayer( name );
			
			if ( types == null || creature == null )
				return false;
				
			for ( int i = 0; i < types.Length; i ++ )
			{
				Type type = types[ i ];
				
				if ( type == creature.GetType() )
					return true;
			}
			
			return false;
		}
开发者ID:greeduomacro,项目名称:uodarktimes-1,代码行数:17,代码来源:TalismanSlayer.cs

示例11: IsSnake

        private static bool IsSnake( BaseCreature bc )
        {
            Type type = bc.GetType();

            for ( int i = 0; i < m_SnakeTypes.Length; i++ )
            {
                if ( type == m_SnakeTypes[i] )
                    return true;
            }

            return false;
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:12,代码来源:SnakeCharmerFlute.cs

示例12: CheckLevel

		public static void CheckLevel( Mobile defender, BaseCreature attacker, int count )
		{
			bool nolevel = false;
			Type typ = attacker.GetType();
			string nam = attacker.Name;

			foreach ( string check in FSATS.NoLevelCreatures )
			{
  				if ( check == nam )
    					nolevel = true;
			}

			if ( nolevel != false )
				return;

			int expgainmin, expgainmax;

			if ( attacker is BaseBioCreature || attacker is BioCreature || attacker is BioMount )
			{
			}
			else if ( defender is BaseCreature )
			{
				if ( attacker.Controlled == true && attacker.ControlMaster != null && attacker.Summoned == false )
				{
					BaseCreature bc = (BaseCreature)defender;

					expgainmin = bc.HitsMax * 25;
					expgainmax = bc.HitsMax * 50;

					int xpgain = Utility.RandomMinMax( expgainmin, expgainmax );
					
					if ( count > 1 )
						xpgain = xpgain / count;

					if ( attacker.Level <= attacker.MaxLevel - 1 )
					{
						attacker.Exp += xpgain;
						attacker.ControlMaster.SendMessage( "Your pet has gained {0} experience points.", xpgain );
					}
			
					int nextLevel = attacker.NextLevel * attacker.Level;

					if ( attacker.Exp >= nextLevel && attacker.Level <= attacker.MaxLevel - 1 )
					{
						DoLevelBonus( attacker );

						Mobile cm = attacker.ControlMaster;
						attacker.Level += 1;
						attacker.Exp = 0;
						attacker.FixedParticles( 0x373A, 10, 15, 5012, EffectLayer.Waist );
						attacker.PlaySound( 503 );
						cm.SendMessage( 38, "Your pets level has increased to {0}.", attacker.Level );

						int gain = Utility.RandomMinMax( 10, 50 );

						attacker.AbilityPoints += gain;

						if ( attacker.ControlMaster != null )
						{
							attacker.ControlMaster.SendMessage( 38, "Your pet {0} has gained some ability points.", gain );
						}

						if ( attacker.Level == 9 )
						{
							attacker.AllowMating = true;
							cm.SendMessage( 1161, "Your pet is now at the level to mate." );
						}
						if ( attacker.Evolves == true )
						{
							if ( attacker.UsesForm1 == true && attacker.F0 == true )
							{
								DoEvoCheck( attacker );

								attacker.BodyValue = attacker.Form1;
								attacker.BaseSoundID = attacker.Sound1;
								attacker.F1 = true;
								attacker.F2 = false;
								attacker.F3 = false;
								attacker.F4 = false;
								attacker.F5 = false;
								attacker.F6 = false;
								attacker.F7 = false;
								attacker.F8 = false;
								attacker.F9 = false;
								attacker.UsesForm1 = false;
								cm.SendMessage( 64, "Your pet has evoloved." );
							}
							else if ( attacker.UsesForm2 == true && attacker.F1 == true )
							{
								DoEvoCheck( attacker );

								attacker.BodyValue = attacker.Form2;
								attacker.BaseSoundID = attacker.Sound2;
								attacker.F1 = false;
								attacker.F2 = true;
								attacker.F3 = false;
								attacker.F4 = false;
								attacker.F5 = false;
								attacker.F6 = false;
								attacker.F7 = false;
//.........这里部分代码省略.........
开发者ID:ITLongwell,项目名称:aedilis2server,代码行数:101,代码来源:PetLeveling.cs

示例13: BreedWith

		public BaseCreature BreedWith(BaseCreature male)
		{
			if (!BreedingEnabled)
				return null;
			if (!Female || male.Female)
				return null; // must call BreedWith on the female, and lezzies can't make babies!
			if (male.GetType() != this.GetType())
				return null; // cannot cross-breed
			if (!CheckBreedWith(male))
				return null; // some other check failed

			BaseCreature child = null;
			try
			{
				child = (BaseCreature)GetType().GetConstructor(Type.EmptyTypes).Invoke(Type.EmptyTypes);

				PropertyInfo[] props = GetType().GetProperties();
				System.ComponentModel.TypeConverter doubleconv = System.ComponentModel.TypeDescriptor.GetConverter(typeof(double));

				for (int i = 0; i < props.Length; i++)
				{
					// note: props[i].GetCustomAttributes() does not traverse inheritance tree!
					GeneAttribute attr = (GeneAttribute)Attribute.GetCustomAttribute(props[i], typeof(GeneAttribute), true);
					if (attr == null)
						continue;

					double high = Convert.ToDouble(props[i].GetValue(this, null));
					double low = Convert.ToDouble(props[i].GetValue(male, null));
					if (high < low)
					{
						double t = high;
						high = low;
						low = t;
					}

                    double lowrange = low - attr.LowFactor * (attr.BreedMax - attr.BreedMin);
                    double highrange = high + attr.HighFactor * (attr.BreedMax - attr.BreedMin);

                    if (props[i].PropertyType == typeof(int) &&
                        attr.MinVariance == GeneAttribute.DefaultMinVariance)
                    {
                        if (attr.LowFactor * (attr.BreedMax - attr.BreedMin) < 1)
                            lowrange = low - 1;
                        if (attr.HighFactor * (attr.BreedMax - attr.BreedMin) < 1)
                            highrange = high + 1;
                    }
                    else if (highrange - lowrange < attr.MinVariance)
                    {
                        lowrange -= attr.MinVariance / 2;
                        highrange += attr.MinVariance / 2;
                    } 
                    
                    if (lowrange > highrange) // shouldn't ever happen, sanity check
                    {
                        Exception ex = new Exception(String.Format("Sanity Check: Child range for {0} was inverted.\r\nLowFactor: {1}\r\nHighFactor: {2}\r\nMinVariance: {3}", attr.GetType().FullName, attr.LowFactor, attr.HighFactor, attr.MinVariance));
                        LogHelper.LogException(ex);
                        lowrange = low;
                        highrange = high;
                    }         

                    double childval = Utility.RandomDouble() * (highrange - lowrange) + lowrange;

					if (childval < attr.BreedMin)
						childval = attr.BreedMin;
					if (childval > attr.BreedMax)
						childval = attr.BreedMax;

					props[i].SetValue(child, doubleconv.ConvertTo(childval, props[i].PropertyType), null);
				}

				ValidateGenes();
			}
			catch (Exception e)
			{
				LogHelper.LogException(e);
				Console.WriteLine(e.ToString());
				if (child != null)
					child.Delete();
				return null;
			}

			return child;
		}
开发者ID:zerodowned,项目名称:angelisland,代码行数:83,代码来源:BaseCreature.cs

示例14: CheckSummonLimits

        public static void CheckSummonLimits( BaseCreature creature )
        {
            ArrayList creatures = new ArrayList();

            int limit = 6; // 6 creatures
            int range = 5; // per 5x5 area

            var eable = creature.GetMobilesInRange( range );

            foreach ( Mobile mobile in eable )
            {
                if ( mobile != null && mobile.GetType() == creature.GetType() )
                    creatures.Add( mobile );
            }

            int amount = 0;

            if ( creatures.Count > limit )
                amount = creatures.Count - limit;

            while ( amount > 0 )
            {
                for ( int i = 0; i < creatures.Count; i++ )
                {
                    Mobile m = creatures[i] as Mobile;

                    if ( m != null && ( (BaseCreature) m ).Summoned )
                    {
                        if ( Utility.RandomBool() && amount > 0 )
                        {
                            m.Delete();
                            amount--;
                        }
                    }
                }
            }
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:37,代码来源:SpellHelper.cs

示例15: CheckBloodAmount

            /// <summary>
            /// Checks the blood amount in the creature.
            /// </summary>
            /// <param name="bc"></param>
            /// <returns>Returns -1 if not enough blood.</returns>
            private int CheckBloodAmount(BaseCreature bc, out string errorMsg)
            {
                // Default msg
                errorMsg = "There's not enough blood in that corpse.";

                if (bc == null)
                    return -1;

                if (bc.HitsMax < CreatureMinHits)
                    return -1;

                foreach (Type type in CreaturesWithoutBlood)
                {
                    if (bc.GetType() == type)
                    {
                        errorMsg = "You cant seem to find any blood in that corpse.";
                        return -1;
                    }
                }

                int returnValue = 1;
                if (bc.HitsMax > BloodAmountScale)
                    returnValue = (int)(bc.HitsMax / BloodAmountScale);

                if (returnValue > MaxBloodPerCreature)
                    return MaxBloodPerCreature;
                else
                    return returnValue;
            }
开发者ID:kamronbatman,项目名称:Defiance-AOS-Pre-2012,代码行数:34,代码来源:BloodDrainToolkit.cs


注:本文中的BaseCreature.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。