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


C# eInventorySlot类代码示例

本文整理汇总了C#中eInventorySlot的典型用法代码示例。如果您正苦于以下问题:C# eInventorySlot类的具体用法?C# eInventorySlot怎么用?C# eInventorySlot使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: GetValidInventorySlot

		/// <summary>
		/// Check if the slot is valid in the inventory
		/// </summary>
		/// <param name="slot">SlotPosition to check</param>
		/// <returns>the slot if it's valid or eInventorySlot.Invalid if not</returns>
		protected override eInventorySlot GetValidInventorySlot(eInventorySlot slot)
		{
			foreach (eInventorySlot visibleSlot in VISIBLE_SLOTS)
				if (visibleSlot == slot)
					return slot;
			return eInventorySlot.Invalid;
		}
开发者ID:boscorillium,项目名称:dol,代码行数:12,代码来源:GameNpcInventoryTemplate.cs

示例2: SwitchItem

        public void SwitchItem(GamePlayer player, eInventorySlot ToSlot, eInventorySlot FromSlot)
        {
            if (player.Inventory.GetItem(FromSlot) != null)
            {
                InventoryItem item = player.Inventory.GetItem(FromSlot);

                if (!GlobalConstants.IsWeapon(item.Object_Type))
                {
                    DisplayMessage(player.Client, "That is not a weapon!");
                    DisplaySyntax(player.Client);
                    return;
                }

                if (!player.Inventory.MoveItem(FromSlot, ToSlot, 1))
                {
                    DisplayMessage(player.Client, "There seems to have been a problem. Please try again.");
                    DisplaySyntax(player.Client);
                    return;
                }
            }
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:21,代码来源:SwitchCommandHandler.cs

示例3: MoveItem

		/// <summary>
		/// Overridden. Inventory template cannot be modified.
		/// </summary>
		/// <param name="fromSlot"></param>
		/// <param name="toSlot"></param>
		/// <param name="itemCount"></param>
		/// <returns></returns>
		public override bool MoveItem(eInventorySlot fromSlot, eInventorySlot toSlot, int itemCount)
		{
			return false;
		}
开发者ID:boscorillium,项目名称:dol,代码行数:11,代码来源:GameNpcInventoryTemplate.cs

示例4: MoveItem

		/// <summary>
		/// Exchange two Items in form specified slot
		/// </summary>
		/// <param name="fromSlot">Source slot</param>
		/// <param name="toSlot">Destination slot</param>
		/// <param name="itemCount"></param>
		/// <returns>true if successfull false if not</returns>
		public virtual bool MoveItem(eInventorySlot fromSlot, eInventorySlot toSlot, int itemCount)
		{
			lock (m_items) // Mannen 10:56 PM 10/30/2006 - Fixing every lock(this)
			{
				fromSlot = GetValidInventorySlot(fromSlot);
				toSlot = GetValidInventorySlot(toSlot);
				if (fromSlot == eInventorySlot.Invalid || toSlot == eInventorySlot.Invalid)
					return false;

				InventoryItem fromItem;
				InventoryItem toItem;

				m_items.TryGetValue(fromSlot, out fromItem);
				m_items.TryGetValue(toSlot, out toItem);

				if (!CombineItems(fromItem, toItem) && !StackItems(fromSlot, toSlot, itemCount))
				{
					ExchangeItems(fromSlot, toSlot);
				}

				if (!m_changedSlots.Contains(fromSlot))
					m_changedSlots.Add(fromSlot);

				if (!m_changedSlots.Contains(toSlot))
					m_changedSlots.Add(toSlot);

				if (m_changesCounter <= 0)
					UpdateChangedSlots();

				return true;
			}
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:39,代码来源:GameLivingInventory.cs

示例5: AddTradeItem

		public virtual bool AddTradeItem(eInventorySlot slot, InventoryItem item)
		{
			return false;
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:4,代码来源:GameLivingInventory.cs

示例6: GetFirstItemByName

		/// <summary>
		/// Searches for the first occurrence of an item with given
		/// name between specified slots
		/// </summary>
		/// <param name="name">name</param>
		/// <param name="minSlot">fist slot for search</param>
		/// <param name="maxSlot">last slot for search</param>
		/// <returns>found item or null</returns>
		public InventoryItem GetFirstItemByName(string name, eInventorySlot minSlot, eInventorySlot maxSlot)
		{
			minSlot = GetValidInventorySlot(minSlot);
			maxSlot = GetValidInventorySlot(maxSlot);
			if (minSlot == eInventorySlot.Invalid || maxSlot == eInventorySlot.Invalid)
				return null;

			// If lower slot is greater than upper slot, flip the values.
			if (minSlot > maxSlot)
			{
				eInventorySlot tmp = minSlot;
				minSlot = maxSlot;
				maxSlot = tmp;
			}

			lock (m_items)
			{
				InventoryItem item;

				for (eInventorySlot i = minSlot; i <= maxSlot; i++)
				{
					if (m_items.TryGetValue(i, out item))
					{
						if (item.Name == name)
							return item;
					}
				}
			}

			return null;
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:39,代码来源:GameLivingInventory.cs

示例7: FindSlot

		/// <summary>
		/// Searches between two slots for the first or last full or empty slot
		/// </summary>
		/// <param name="first"></param>
		/// <param name="last"></param>
		/// <param name="searchFirst"></param>
		/// <param name="searchNull"></param>
		/// <returns></returns>
		protected virtual eInventorySlot FindSlot(eInventorySlot first, eInventorySlot last, bool searchFirst, bool searchNull)
		{
			lock (m_items) // Mannen 10:56 PM 10/30/2006 - Fixing every lock(this)
			{
				first = GetValidInventorySlot(first);
				last = GetValidInventorySlot(last);

				if (first == eInventorySlot.Invalid || last == eInventorySlot.Invalid)
					return eInventorySlot.Invalid;

				// If first/last slots are identical, check to see if the slot is full/empty and return based on
				// whether we instructed to find an empty or a full slot.
				if (first == last)
				{
					// If slot is empty, and we wanted an empty slot, or if slot is full, and we wanted
					// a full slot, return the given slot, otherwise return invalid.
					return !m_items.ContainsKey(first) == searchNull ? first : eInventorySlot.Invalid;
				}

				// If lower slot is greater than upper slot, flip the values.
				if (first > last)
				{
					eInventorySlot tmp = first;
					first = last;
					last = tmp;
				}

				for (int i = 0; i <= last - first; i++)
				{
					var testSlot = (int) (searchFirst ? (first + i) : (last - i));

					if (!m_items.ContainsKey((eInventorySlot) testSlot) == searchNull)
						return (eInventorySlot) testSlot;
				}

				return eInventorySlot.Invalid;
			}
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:46,代码来源:GameLivingInventory.cs

示例8: FindLastFullSlot

		/// <summary>
		/// Find the last full slot in the inventory
		/// </summary>
		/// <param name="first">SlotPosition to start the search</param>
		/// <param name="last">SlotPosition to stop the search</param>
		/// <returns>the empty inventory slot or eInventorySlot.Invalid</returns>
		public virtual eInventorySlot FindLastFullSlot(eInventorySlot first, eInventorySlot last)
		{
			return FindSlot(first, last, false, false);
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:10,代码来源:GameLivingInventory.cs

示例9: IsSlotsFree

		/// <summary>
		/// Checks if specified count of slots is free
		/// </summary>
		/// <param name="count"></param>
		/// <param name="minSlot"></param>
		/// <param name="maxSlot"></param>
		/// <returns></returns>
		public bool IsSlotsFree(int count, eInventorySlot minSlot, eInventorySlot maxSlot)
		{
			if (count < 1)
				return true;

			// If lower slot is greater than upper slot, flip the values.
			if (minSlot > maxSlot)
			{
				eInventorySlot tmp = minSlot;
				minSlot = maxSlot;
				maxSlot = tmp;
			}

			lock (m_items) // Mannen 10:56 PM 10/30/2006 - Fixing every lock(this)
			{
				for (eInventorySlot i = minSlot; i <= maxSlot; i++)
				{
					if (m_items.ContainsKey(i))
						continue;

					count--;

					if (count <= 0)
						return true;
				}

				return false;
			}
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:36,代码来源:GameLivingInventory.cs

示例10: OnPlayerBuy

        /// <summary>
        /// The Player is buying an Item from the merchant
        /// </summary>
        /// <param name="player"></param>
        /// <param name="playerInventory"></param>
        /// <param name="fromClientSlot"></param>
        /// <param name="toClientSlot"></param>
		public virtual void OnPlayerBuy(GamePlayer player, eInventorySlot fromClientSlot, eInventorySlot toClientSlot, bool usingMarketExplorer = false)
        {
			IDictionary<int, InventoryItem> clientInventory = GetClientInventory(player);

			InventoryItem fromItem = null;

			if (clientInventory.ContainsKey((int)fromClientSlot))
			{
				fromItem = clientInventory[(int)fromClientSlot];
			}

			if (fromItem == null)
			{
				ChatUtil.SendErrorMessage(player, "I can't find the item you want to purchase!");
				log.ErrorFormat("CM: {0}:{1} can't find item to buy in slot {2} on consignment merchant on lot {3}.", player.Name, player.Client.Account, (int)fromClientSlot, HouseNumber);
				return;
			}

			string buyText = "Do you want to buy this Item?";

			// If the player has a marketExplorer activated they will be charged a commission
			if (player.TargetObject is MarketExplorer)
			{
				player.TempProperties.setProperty(CONSIGNMENT_BUY_ITEM, fromClientSlot);
				if (ServerProperties.Properties.MARKET_FEE_PERCENT > 0)
				{
					player.Out.SendCustomDialog("Buying directly from the Market Explorer costs an additional " +  ServerProperties.Properties.MARKET_FEE_PERCENT + "% fee. Do you want to buy this Item?", new CustomDialogResponse(BuyMarketResponse));
				}
				else
				{
					player.Out.SendCustomDialog(buyText, new CustomDialogResponse(BuyResponse));
				}
			}
			else if (player.TargetObject == this)
			{
				player.TempProperties.setProperty(CONSIGNMENT_BUY_ITEM, fromClientSlot);
				player.Out.SendCustomDialog(buyText, new CustomDialogResponse(BuyResponse));
			}
			else
			{
				ChatUtil.SendErrorMessage(player, "I'm sorry, you need to be talking to a market explorer or consignment merchant in order to make a purchase.");
				log.ErrorFormat("CM: {0}:{1} did not have a CM or ME targeted when attempting to purchase {2} on consignment merchant on lot {3}.", player.Name, player.Client.Account, fromItem.Name, HouseNumber);
			}
        }
开发者ID:mynew4,项目名称:DAoC,代码行数:51,代码来源:ConsignmentMerchant.cs

示例11: AddNPCEquipment

		/// <summary>
		/// Adds item to template reusing inventory item instances from other templates.
		/// </summary>
		/// <param name="slot">The equipment slot</param>
		/// <param name="model">The equipment model</param>
		/// <returns>true if added</returns>
		public bool AddNPCEquipment(eInventorySlot slot, int model)
		{
			return AddNPCEquipment(slot, model, 0, 0, 0);
		}
开发者ID:boscorillium,项目名称:dol,代码行数:10,代码来源:GameNpcInventoryTemplate.cs

示例12: RemoveTemplate

		/// <summary>
		/// Overridden. Inventory template cannot be modified.
		/// </summary>
		/// <param name="templateID">The ItemTemplate ID</param>
		/// <param name="count">The count of items to add</param>
		/// <param name="minSlot">The first slot</param>
		/// <param name="maxSlot">The last slot</param>
		/// <returns>false</returns>
		public override bool RemoveTemplate(string templateID, int count, eInventorySlot minSlot, eInventorySlot maxSlot)
		{
			return false;
		}
开发者ID:boscorillium,项目名称:dol,代码行数:12,代码来源:GameNpcInventoryTemplate.cs

示例13: AddTemplate

		/// <summary>
		/// Overridden. Inventory template cannot be modified.
		/// </summary>
		/// <param name="template">The ItemTemplate</param>
		/// <param name="count">The count of items to add</param>
		/// <param name="minSlot">The first slot</param>
		/// <param name="maxSlot">The last slot</param>
		/// <returns>false</returns>
		public override bool AddTemplate(InventoryItem template, int count, eInventorySlot minSlot, eInventorySlot maxSlot)
		{
			return false;
		}
开发者ID:boscorillium,项目名称:dol,代码行数:12,代码来源:GameNpcInventoryTemplate.cs

示例14: ExchangeItems

		/// <summary>
		/// Overridden. Inventory template cannot be modified.
		/// </summary>
		/// <param name="fromSlot">First SlotPosition</param>
		/// <param name="toSlot">Second SlotPosition</param>
		/// <returns>false</returns>
		protected override bool ExchangeItems(eInventorySlot fromSlot, eInventorySlot toSlot)
		{
			return false;
		}
开发者ID:boscorillium,项目名称:dol,代码行数:10,代码来源:GameNpcInventoryTemplate.cs

示例15: StackItems

		/// <summary>
		/// Overridden. Inventory template cannot be modified.
		/// </summary>
		/// <param name="fromSlot">First SlotPosition</param>
		/// <param name="toSlot">Second SlotPosition</param>
		/// <param name="itemCount">How many items to move</param>
		/// <returns>false</returns>
		protected override bool StackItems(eInventorySlot fromSlot, eInventorySlot toSlot, int itemCount)
		{
			return false;
		}
开发者ID:boscorillium,项目名称:dol,代码行数:11,代码来源:GameNpcInventoryTemplate.cs


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