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


C# Item.TypeEquals方法代码示例

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


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

示例1: OnTarget

		protected void OnTarget(Mobile m, Item item)
		{
			if (!this.CheckDoubleClick(m, true, false, 2, true) || item == null || item.Deleted || _Target == null ||
				_Target.User != m)
			{
				return;
			}

			if (!_LayerableTypes.Any(t => item.TypeEquals(t)))
			{
				m.SendMessage(34, "You can not layer that item.");
				return;
			}

			if (item.Layer == TargetLayer)
			{
				m.SendMessage(34, "That sash is already layered.");
				return;
			}

			if (item.RootParent != m)
			{
				m.SendMessage(34, "That sash must be equipped or in your pack to layer it.");
				return;
			}

			if (item.IsEquipped())
			{
				var otherItem = m.FindItemOnLayer(TargetLayer);

				if (otherItem != null)
				{
					m.SendMessage(
						34,
						"You must unequip the {0} in your {1} slot before you can layer that sash.",
						otherItem.ResolveName(m),
						TargetLayer.ToString().ToLower());
					return;
				}
			}

			item.Layer = TargetLayer;

			if (String.IsNullOrWhiteSpace(item.Name))
			{
				item.Name = "a body sash [Layered]";
			}
			else if (!item.Name.EndsWith(" [Layered]"))
			{
				item.Name += " [Layered]";
			}

			m.SendMessage(85, "You successfully layer the sash!");

			Delete();
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:56,代码来源:SashLayerDeed.cs

示例2: OnDragDrop

        public override bool OnDragDrop(Mobile from, Item item)
        {
            // trigger returns true if returnoverride
            if (XmlScript.HasTrigger(this, TriggerName.onDragDrop) &&
                UberScriptTriggers.Trigger(this, from, TriggerName.onDragDrop, item))
            {
                return true;
            }

            if (!IsOwner(from))
            {
                SayTo(from, 503209); // I can only take item from the shop owner.
                return false;
            }

            if (item is CommodityDeed && ((CommodityDeed) item).Commodity == null)
            {
                SayTo(from, "I refuse to sell empty commodity deeds!");
                return false;
            }

            if (item.TypeEquals(TypeOfCurrency))
            {
                if (BaseHouse.NewVendorSystem)
                {
                    if (HoldCurrency < 1000000)
                    {
                        SayTo(from, 503210); // I'll take that to fund my services.

                        HoldCurrency += item.Amount;
                        item.Delete();

                        return true;
                    }

                    from.SendMessage("Your vendor has sufficient funds for operation and cannot accept this {0}.",
                        TypeOfCurrency.Name);
                    return false;
                }

                if (BankAccount < 1000000)
                {
                    SayTo(from, 503210); // I'll take that to fund my services.

                    BankAccount += item.Amount;
                    item.Delete();

                    return true;
                }

                from.SendMessage("Your vendor has sufficient funds for operation and cannot accept this {0}.",
                    TypeOfCurrency.Name);
                return false;
            }

            bool newItem = (GetVendorItem(item) == null);

            if (Backpack != null && Backpack.TryDropItem(from, item, false))
            {
                if (newItem)
                {
                    OnItemGiven(from, item);
                }

                return true;
            }

            SayTo(from, 503211); // I can't carry any more.
            return false;
        }
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:70,代码来源:PlayerVendor.cs

示例3: GetProgress

		protected virtual int GetProgress(ConquestState state, Item item, CraftResource res, HarvestSystem harvest)
		{
			if (item == null || harvest == null)
			{
				return 0;
			}

            if (state.User == null)
                return 0;

			if (ItemType.IsNotNull && !item.TypeEquals(ItemType, ItemChildren))
			{
				if (ItemChangeReset)
				{
					return -state.Progress;
				}

				return 0;
			}

			if (Resource != CraftResource.None && res != Resource)
			{
				return 0;
			}

			if (HarvestSystem.IsNotNull && !harvest.TypeEquals(HarvestSystem, false))
			{
				return 0;
			}

			return item.Amount;
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:32,代码来源:HarvestConquest.cs

示例4: GetProgress

        protected virtual int GetProgress(ConquestState state, Item item, string keyword)
		{
            if (item == null)
			{
				return 0;
			}

            if (state.User == null)
                return 0;

            if (Item.IsNotNull && !item.TypeEquals(Item, ItemChildren))
			{
				if (ItemChangeReset)
				{
					return -state.Progress;
				}

				return 0;
			}

	        if (!String.IsNullOrEmpty(KeywordReq) && !KeywordSearch.Execute(keyword, KeywordReq, KeywordIgnoreCaps))
	        {
		        if (KeywordChangeReset)
		        {
			        return -state.Progress;
		        }

		        return 0;
	        }

	        if (item.Amount > 1 && CheckAmount)
			{
                return item.Amount;
			}

			return 1;
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:37,代码来源:ItemConquest.cs

示例5: GetProgress

		protected virtual int GetProgress(
			ConquestState state, Item item, int quality, bool slayer, CraftResource res, CraftSystem craft)
		{
            if (state.User == null)
                return 0;

			if (item == null || craft == null)
			{
				return 0;
			}

			if (ItemType.IsNotNull && !item.TypeEquals(ItemType, ItemChildren))
			{
				if (ItemChangeReset)
				{
					return -state.Progress;
				}

				return 0;
			}

			if (IsExceptional && quality == 0)
			{
				return 0;
			}

			if (IsSlayer && !slayer)
			{
				return 0;
			}

			if (IsCloth && !(item is BaseClothing))
			{
				return 0;
			}

			if (Resource != CraftResource.None && res != Resource)
			{
				return 0;
			}

			if (CraftSystem.IsNotNull && !craft.TypeEquals(CraftSystem, false))
			{
				return 0;
			}

            // This function is only called after a successful completion so amount will
            // not be zero except for the case of a potion that was created and auto-consolidated
            // into a keg by the oncraft handler in BasePotion
            if(item.Amount <= 0)
            {
                return 1;
            }

            return item.Amount;
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:56,代码来源:CraftingConquest.cs


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