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


C# GamePlayer.GainExperience方法代码示例

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


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

示例1: Interact

		/// <summary>
		/// Interact with trainer
		/// </summary>
		/// <param name="player"></param>
		/// <returns></returns>
		public override bool Interact(GamePlayer player)
		{
			if (!base.Interact(player)) return false;

			// Turn to face player
			TurnTo(player, 10000);

			// Unknown class must be used for multitrainer
			if (CanTrain(player))
			{
				player.Out.SendTrainerWindow();
				
				player.GainExperience(GameLiving.eXPSource.Other, 0);//levelup

				if (player.FreeLevelState == 2)
				{
					player.DBCharacter.LastFreeLevel = player.Level;
					//long xp = GameServer.ServerRules.GetExperienceForLevel(player.PlayerCharacter.LastFreeLevel + 3) - GameServer.ServerRules.GetExperienceForLevel(player.PlayerCharacter.LastFreeLevel + 2);
					long xp = player.GetExperienceNeededForLevel(player.DBCharacter.LastFreeLevel + 1) - player.GetExperienceNeededForLevel(player.DBCharacter.LastFreeLevel);
					//player.PlayerCharacter.LastFreeLevel = player.Level;
					player.GainExperience(GameLiving.eXPSource.Other, xp);
					player.DBCharacter.LastFreeLeveled = DateTime.Now;
					player.Out.SendPlayerFreeLevelUpdate();
				}
			}

			if (CanTrainChampionLevels(player))
			{
				player.Out.SendChampionTrainerWindow((int)m_championTrainerType);
			}

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

示例2: CheckOfferedQuestReceiveItem

		/// <summary>
		/// Check quests offered to see if receiving an item should be processed
		/// Used for Collection and Item Start quest types
		/// </summary>
		/// <param name="player"></param>
		/// <param name="obj"></param>
		/// <param name="item"></param>
		protected virtual void CheckOfferedQuestReceiveItem(GamePlayer player, GameObject obj, InventoryItem item)
		{
			// checking the quests we can offer to see if this is a collection quest or if the item starts a quest
			//log.DebugFormat("Checking collection quests: '{0}' of type '{1}', wants item '{2}'", Name, (eStartType)DBDataQuest.StartType, DBDataQuest.CollectItemTemplate == null ? "" : DBDataQuest.CollectItemTemplate);

			// check to see if this object has a collection quest and if so accept the item and generate the reward
			// collection quests do not go into the GamePlayer quest lists
			if (StartType == eStartType.Collection && item.Id_nb == DBDataQuest.CollectItemTemplate)
			{
				CharacterXDataQuest charQuest = GetCharacterQuest(player, ID, true);

				if (charQuest.Count < MaxQuestCount)
				{
					if (item.Count == 1)
					{
						RemoveItem(obj, player, item, false);
						charQuest.Count++;
						charQuest.Step = 0;
						GameServer.Database.SaveObject(charQuest);
						long rewardXP = 0;
						if (long.TryParse(DBDataQuest.RewardXP, out rewardXP))
						{
							player.GainExperience(GameLiving.eXPSource.Quest, rewardXP);
						}
						if (m_sourceTexts.Count > 0)
						{
							SendMessage(player, m_sourceTexts[0], 0, eChatType.CT_System, eChatLoc.CL_PopupWindow);
						}
						else
						{
							ChatUtil.SendDebugMessage(player, "Source Text missing on Collection Quest receive item.");
						}
					}
					else
					{
						SendMessage(player, "You need to unstack these first.", 0, eChatType.CT_System, eChatLoc.CL_PopupWindow);
					}
				}
			}
		}
开发者ID:boscorillium,项目名称:dol,代码行数:47,代码来源:DataQuest.cs

示例3: CheckPlayerAcceptQuest

        /* This is our callback hook that will be called when the player clicks
         * on any button in the quest offer dialog. We check if he accepts or
         * declines here...
         */

        private static void CheckPlayerAcceptQuest(GamePlayer player, byte response)
        {
            //We recheck the qualification, because we don't talk to players
            //who are not doing the quest
            if (harlfug.CanGiveQuest(typeof(CityOfJordheim), player) <= 0)
                return;

            CityOfJordheim quest = player.IsDoingQuest(typeof(CityOfJordheim)) as CityOfJordheim;

            if (quest != null)
                return;

            if (response == 0x00)
            {
                SendReply(player, "Oh well, if you change your mind, please come back!");
            }
            else
            {
                //Check if we can add the quest!
                if (!harlfug.GiveQuest(typeof(CityOfJordheim), player, 1))
                    return;

                harlfug.SayTo(player, "Oh thank you Eeinken. This means a lot to me. Here, take this chest of coins, this scroll and this [necklace].");

                GiveItem(harlfug, player, assistantNecklace);
                GiveItem(harlfug, player, chestOfCoins);
                GiveItem(harlfug, player, scrollYuliwyf);
                player.GainExperience(GameLiving.eXPSource.Quest, 7, true);

                GameEventMgr.AddHandler(player, GamePlayerEvent.Quit, new DOLEventHandler(PlayerLeftWorld));
                GameEventMgr.AddHandler(player, GamePlayerEvent.UseSlot, new DOLEventHandler(PlayerUseSlot));
            }
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:38,代码来源:CityOfJordheim.cs

示例4: CheckOfferQuest

		/// <summary>
		/// A player has interacted with an object that has a DataQuest.
		/// Check to see if we can offer this quest to the player and display the text
		/// </summary>
		/// <param name="player"></param>
		/// <param name="obj"></param>
		protected virtual void CheckOfferQuest(GamePlayer player, GameObject obj)
		{
			// Can we offer this quest to the player?
			if (CheckQuestQualification(player))
			{
				if (StartType == eStartType.InteractComplete)
				{
					// This quest finishes with the interaction

					CharacterXDataQuest charQuest = GetCharacterQuest(player, ID, true);

					if (charQuest.Count < MaxQuestCount)
					{
						if (ExecuteCustomQuestStep(player, 0, eStepCheckType.Finish))
						{
							if (Description.Trim() != "")
							{
								SendMessage(player, Description, 0, eChatType.CT_System, eChatLoc.CL_PopupWindow);
							}

							if (m_finalRewards.Count > 0)
							{
								lock (player.Inventory)
								{
									if (player.Inventory.IsSlotsFree(m_finalRewards.Count, eInventorySlot.FirstBackpack, eInventorySlot.LastBackpack))
									{
										foreach (ItemTemplate item in m_finalRewards)
										{
											if (item != null)
											{
												GiveItem((obj is GameLiving ? obj as GameLiving : null), player, item, false);
											}
										}
									}
									else
									{
										SendMessage(player, "Your inventory does not have enough space to finish this quest!", 0, eChatType.CT_System, eChatLoc.CL_PopupWindow);
										return;
									}
								}
							}

							if (m_rewardXPs.Count > 0 && m_rewardXPs[0] > 0)
							{
								player.GainExperience(GameLiving.eXPSource.Quest, m_rewardXPs[0]);
							}

							if (m_rewardMoneys.Count > 0 && m_rewardMoneys[0] > 0)
							{
								player.AddMoney(m_rewardMoneys[0], "You are awarded {0}!");
                                InventoryLogging.LogInventoryAction("(QUEST;" + Name + ")", player, eInventoryActionType.Quest, m_rewardMoneys[0]);
							}

							charQuest.Count++;
							GameServer.Database.SaveObject(charQuest);

							bool add = true;
							lock (player.QuestListFinished)
							{
								foreach (AbstractQuest q in player.QuestListFinished)
								{
									if (q is DataQuest && (q as DataQuest).ID == ID)
									{
										add = false;
										break;
									}
								}
							}

							if (add)
							{
								player.QuestListFinished.Add(this);
							}

							player.Out.SendQuestListUpdate();

							player.Out.SendMessage(String.Format(LanguageMgr.GetTranslation(player.Client, "AbstractQuest.FinishQuest.Completed", Name)), eChatType.CT_ScreenCenter, eChatLoc.CL_SystemWindow);
							player.Out.SendMessage(String.Format(LanguageMgr.GetTranslation(player.Client, "AbstractQuest.FinishQuest.Completed", Name)), eChatType.CT_Important, eChatLoc.CL_SystemWindow);
						}
					}
					return;
				}

				if (StartType == eStartType.AutoStart)
				{
					CharacterXDataQuest charQuest = GetCharacterQuest(player, ID, true);
					DataQuest dq = new DataQuest(player, obj, DBDataQuest, charQuest);
					dq.Step = 1;
					player.AddQuest(dq);
					if (m_sourceTexts.Count > 0)
					{
						if (string.IsNullOrEmpty(m_sourceTexts[0]) == false)
						{
							SendMessage(player, m_sourceTexts[0], 0, eChatType.CT_System, eChatLoc.CL_PopupWindow);
//.........这里部分代码省略.........
开发者ID:boscorillium,项目名称:dol,代码行数:101,代码来源:DataQuest.cs

示例5: CheckPlayerAcceptQuest

        /* This is our callback hook that will be called when the player clicks
         * on any button in the quest offer dialog. We check if he accepts or
         * declines here...
         */
        private static void CheckPlayerAcceptQuest(GamePlayer player, byte response)
        {
            //We recheck the qualification, because we don't talk to players
            //who are not doing the quest
            if(freagus.CanGiveQuest(typeof (CityOfTirnaNog), player)  <= 0)
                return;

            CityOfTirnaNog quest = player.IsDoingQuest(typeof (CityOfTirnaNog)) as CityOfTirnaNog;

            if (quest != null)
                return;

            if (response == 0x00)
            {
                SendReply(player, "Oh well, if you change your mind, please come back!");
            }
            else
            {
                //Check if we can add the quest!
                if (!freagus.GiveQuest(typeof (CityOfTirnaNog), player, 1))
                    return;

                freagus.SayTo(player, "Ah! Wonderful. I have several things for you for your trip into [Tir na Nog].");

                GiveItem(freagus, player, assistantNecklace);
                GiveItem(freagus, player, chestOfCoins);
                GiveItem(freagus, player, scrollHylvian);
                GiveItem(freagus, player, ticketToTirnaNog);
                player.GainExperience(GameLiving.eXPSource.Quest, 7, true);

                GameEventMgr.AddHandler(player, GamePlayerEvent.Quit, new DOLEventHandler(PlayerLeftWorld));
                GameEventMgr.AddHandler(player, GamePlayerEvent.UseSlot, new DOLEventHandler(PlayerUseSlot));
            }
        }
开发者ID:mynew4,项目名称:DOLSharp,代码行数:38,代码来源:CityOfTirnaNog.cs


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