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


C# GamePlayer.ReceiveItem方法代码示例

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


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

示例1: PromotePlayer

		/// <summary>
		/// Called to promote a player
		/// </summary>
		/// <param name="player">the player to promote</param>
		/// <param name="classid">the new classid</param>
		/// <param name="messageToPlayer">the message for the player</param>
		/// <param name="gifts">Array of inventory items as promotion gifts</param>
		/// <returns>true if successfull</returns>
		public bool PromotePlayer(GamePlayer player, int classid, string messageToPlayer, InventoryItem[] gifts)
		{

			if (player == null) return false;

			ICharacterClass oldClass = player.CharacterClass;

			// Player was promoted
			if (player.SetCharacterClass(classid))
			{
				player.RemoveAllStyles();
				player.RemoveAllAbilities();
				player.RemoveAllSpellLines();

				if (messageToPlayer != "")
					player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "GameTrainer.PromotePlayer.Says", this.Name, messageToPlayer), eChatType.CT_System, eChatLoc.CL_PopupWindow);
				player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "GameTrainer.PromotePlayer.Upgraded", player.CharacterClass.Name), eChatType.CT_Important, eChatLoc.CL_SystemWindow);

				player.CharacterClass.OnLevelUp(player, player.Level);
				player.RefreshSpecDependantSkills(true);
				player.StartPowerRegeneration();
				player.Out.SendUpdatePlayerSkills();
				player.Out.SendUpdatePlayer();
				// drop any non usable item
				CheckAbilityToUseItem(player);

				// Initiate equipment
				if (gifts != null && gifts.Length > 0)
				{
					for (int i = 0; i < gifts.Length; i++)
					{
						player.ReceiveItem(this, gifts[i]);
					}
				}

				// after gifts
				player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "GameTrainer.PromotePlayer.Accepted", player.CharacterClass.Profession), eChatType.CT_Important, eChatLoc.CL_SystemWindow);

				Notify(GameTrainerEvent.PlayerPromoted, this, new PlayerPromotedEventArgs(player, oldClass));

				player.SaveIntoDatabase();
				return true;
			}
			return false;
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:53,代码来源:GameTrainer.cs

示例2: GiveItem

		protected static bool GiveItem(GameLiving source, GamePlayer player, ItemTemplate itemTemplate, bool canDrop)
		{
			InventoryItem item = null;

			if (itemTemplate is ItemUnique)
			{
				GameServer.Database.AddObject(itemTemplate as ItemUnique);
				item = GameInventoryItem.Create(itemTemplate as ItemUnique);
			}
			else
			{
				item = GameInventoryItem.Create(itemTemplate);
			}

			if (!player.ReceiveItem(source, item))
			{
				if (canDrop)
				{
					player.CreateItemOnTheGround(item);
					player.Out.SendMessage(String.Format("Your backpack is full, {0} is dropped on the ground.", itemTemplate.Name), eChatType.CT_Important, eChatLoc.CL_PopupWindow);
				}
				else
				{
					player.Out.SendMessage("Your backpack is full!", eChatType.CT_Important, eChatLoc.CL_PopupWindow);
					return false;
				}
			}

			return true;
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:30,代码来源:AbstractQuest.cs

示例3: BuildTask

		/// <summary>
        /// Create an Item, Search for a NPC to consign the Item and give Item to the Player
		/// </summary>
		/// <param name="player"></param>
		/// <param name="source"></param>
		/// <returns></returns>
		public static bool BuildTask(GamePlayer player, GameLiving source)
		{
			if (source == null)
				return false;

			GameNPC NPC = GetRandomNPC(player);
			if(NPC == null)
			{
				player.Out.SendMessage("I have no task for you, come back some time later.",eChatType.CT_System,eChatLoc.CL_PopupWindow);
				return false;
			}
			else
			{
				InventoryItem TaskItems = GenerateNPCItem(NPC.Name, player.Level);
				
				player.Task = new MoneyTask(player);
				player.Task.TimeOut = DateTime.Now.AddHours(2);
				player.Task.ItemName = TaskItems.Name;
				player.Task.RecieverName = NPC.Name;
				((MoneyTask)player.Task).RecieverZone = NPC.CurrentZone.Description;
				
				player.Out.SendMessage("Bring "+TaskItems.GetName(0,false)+" to "+NPC.Name +" in "+ NPC.CurrentZone.Description, eChatType.CT_Say, eChatLoc.CL_PopupWindow);
				//Player.Out.SendCustomDialog("", new CustomDialogResponse(TaskDialogResponse));

				player.ReceiveItem(source,TaskItems);
				return true;
			}
			
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:35,代码来源:MoneyTask.cs

示例4: GiveItem

		/// <summary>
		/// Hand out an artifact.
		/// </summary>
		/// <param name="source"></param>
		/// <param name="player"></param>
		/// <param name="artifactID"></param>
		/// <param name="itemTemplate"></param>
		protected new static bool GiveItem(GamePlayer player, ItemTemplate itemTemplate)
		{
			InventoryArtifact item = new InventoryArtifact(itemTemplate);
			if (!player.ReceiveItem(null, item))
			{
				player.Out.SendMessage(String.Format("Your backpack is full, please make some room and try again."), eChatType.CT_Important, eChatLoc.CL_PopupWindow);
				return false;
			}

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

示例5: ReturnArtifact

		protected void ReturnArtifact(GamePlayer player)
		{
			ItemTemplate itemTemplate = GameServer.Database.FindObjectByKey<ItemTemplate>(GetCustomProperty("Id_nb"));
			InventoryArtifact artifact = new InventoryArtifact(itemTemplate);
			artifact.ArtifactLevel = Convert.ToInt32(GetCustomProperty("ALevel"));
			artifact.Experience = Convert.ToInt64(GetCustomProperty("AXP"));
			artifact.UpdateAbilities(itemTemplate);

			if (!player.ReceiveItem(null, artifact))
			{
				player.Out.SendMessage(String.Format("Your backpack is full, please make some room and try again.  You may have to relog to get to complete this quest."), eChatType.CT_Important, eChatLoc.CL_PopupWindow);
				return;
			}

			FinishQuest();
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:16,代码来源:ArtifactTurnInQuest.cs

示例6: GiveItem

        /// <summary>
        /// Hand out an artifact.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="player"></param>
        /// <param name="artifactID"></param>
        /// <param name="itemTemplate"></param>
        protected static bool GiveItem(GameLiving source, GamePlayer player, String artifactID, ItemTemplate itemTemplate)
        {
            InventoryItem item = new InventoryArtifact(itemTemplate);
            if (!player.ReceiveItem(source, item))
            {
                player.Out.SendMessage(LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "ArtifactQuest.GiveItem.BackpackFull"), eChatType.CT_Important, eChatLoc.CL_PopupWindow);
                return false;
            }

            return true;
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:18,代码来源:ArtifactQuest.cs


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