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


C# GamePlayer.GetName方法代码示例

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


在下文中一共展示了GamePlayer.GetName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
								
			// check if class matches.				
			if (player.CharacterClass.ID == (int) TrainedClass)
			{
                player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "MentalistTrainer.Interact.Text2", this.Name, player.GetName(0, false)), eChatType.CT_Say, eChatLoc.CL_ChatWindow);
			} 
			else 
			{
				// perhaps player can be promoted
				if (CanPromotePlayer(player)) 
				{
                    player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "MentalistTrainer.Interact.Text1", this.Name, player.GetName(0, false)), eChatType.CT_System, eChatLoc.CL_PopupWindow);
					if (!player.IsLevelRespecUsed)
					{
						OfferRespecialize(player);
					}
				}
				else
				{
					CheckChampionTraining(player);
				}
			}
			return true;
 		}
开发者ID:Refizul,项目名称:DOL-Kheldron,代码行数:32,代码来源:MentalistTrainer.cs

示例2: SayTo

		/// <summary>
		/// Format "say" message and send it to target
		/// </summary>
		/// <param name="target"></param>
		/// <param name="loc">chat location of the message</param>
		/// <param name="message"></param>
		public virtual void SayTo(GamePlayer target, eChatLoc loc, string message, bool announce = true)
		{
			if (target == null)
				return;

			TurnTo(target);
            string resultText = LanguageMgr.GetTranslation(target.Client.Account.Language, "GameNPC.SayTo.Says", GetName(0, true, target.Client.Account.Language, this), message);
			switch (loc)
			{
				case eChatLoc.CL_PopupWindow:
					target.Out.SendMessage(resultText, eChatType.CT_System, eChatLoc.CL_PopupWindow);
					if (announce)
					{
                        Message.ChatToArea(this, LanguageMgr.GetTranslation(target.Client.Account.Language, "GameNPC.SayTo.SpeaksTo", GetName(0, true, target.Client.Account.Language, this), target.GetName(0, false)), eChatType.CT_System, WorldMgr.SAY_DISTANCE, target);
					}
					break;
				case eChatLoc.CL_ChatWindow:
					target.Out.SendMessage(resultText, eChatType.CT_Say, eChatLoc.CL_ChatWindow);
					break;
				case eChatLoc.CL_SystemWindow:
					target.Out.SendMessage(resultText, eChatType.CT_System, eChatLoc.CL_SystemWindow);
					break;
			}
		}
开发者ID:dudemanvox,项目名称:Dawn-of-Light-Server,代码行数:30,代码来源:GameNPC.cs

示例3: CheckPlayerAcceptQuest

        private static void CheckPlayerAcceptQuest(GamePlayer player, byte response)
        {
            if(Roben.CanGiveQuest(typeof (Church_50), player)  <= 0)
                return;

            if (player.IsDoingQuest(typeof (Church_50)) != null)
                return;

            if (response == 0x00)
            {
                player.Out.SendMessage("Our God forgives your laziness, just look out for stray lightning bolts.", eChatType.CT_Say, eChatLoc.CL_PopupWindow);
            }
            else
            {
                // Check to see if we can add quest
                if (!Roben.GiveQuest(typeof (Church_50), player, 1))
                    return;;

                Roben.SayTo(player, "You must not let this occur " + player.GetName(0, false) + "! I am familar with [Lyonesse]. I suggest that you gather a strong group of adventurers in order to succeed in this endeavor!");
            }
        }
开发者ID:mynew4,项目名称:DOLSharp,代码行数:21,代码来源:Church50.cs

示例4: GetPersonalizedMessage

        /// <summary>
        /// Personalizes the given message by replacing all instances of PLAYER with the actual name of the player
        /// </summary>
        /// <param name="message">message to personalize</param>
        /// <param name="player">Player's name to insert</param>
        /// <returns>message with actual name of player instead of PLAYER</returns>
        public static string GetPersonalizedMessage(string message, GamePlayer player)
        {
            if (message == null || player == null)
                return message;

            int playerIndex = message.IndexOf(PLAYER);
            if (playerIndex == 0)
            {
                message = message.Replace(PLAYER, player.GetName(0, true));
            }
            else if (playerIndex > 0)
            {
                message = message.Replace(PLAYER, player.GetName(0, false));
            }

            // {PLAYER} is deprecated use <PLAYER> instead
            playerIndex = message.IndexOf(PLAYER_OLD);
            if (playerIndex == 0)
            {
                message = message.Replace(PLAYER_OLD, player.GetName(0, true));
            }
            else if (playerIndex > 0)
            {
                message = message.Replace(PLAYER_OLD, player.GetName(0, false));
            }

            message = message.Replace(RACE, player.RaceName);
            message = message.Replace(CLASS, player.CharacterClass.Name);
            message = message.Replace("<RealmTitle>", player.RealmTitle);

            if (message.Contains("<Guild>"))
            {
                string guild = "";
                if (player.Guild != null)
                    guild = player.GuildName;

                message = message.Replace("<Guild>", guild);
            }

            if (message.Contains("<Title>"))
            {
                string title = "";
                if (player.CurrentTitle != null)
                    title = player.CurrentTitle.GetValue(player, player);

                message = message.Replace("<Title>", title);
            }

            return message;
        }
开发者ID:mynew4,项目名称:DOLSharp,代码行数:56,代码来源:BehaviourUtils.cs

示例5: Start

        /// <summary>
        /// Start the guarding on player
        /// </summary>
        /// <param name="guardSource">The guarder</param>
        /// <param name="guardTarget">The player guarded by guarder</param>
        public void Start(GamePlayer guardSource, GamePlayer guardTarget)
        {
            if (guardSource == null || guardTarget == null)
                return;

            m_playerGroup = guardSource.Group;

            if (m_playerGroup != guardTarget.Group)
                return;

            m_guardSource = guardSource;
            m_guardTarget = guardTarget;
            m_owner = m_guardSource;

            GameEventMgr.AddHandler(m_playerGroup, GroupEvent.MemberDisbanded, new DOLEventHandler(GroupDisbandCallback1));

            m_guardSource.EffectList.Add(this);
            m_guardTarget.EffectList.Add(this);

            if (!guardSource.IsWithinRadius(guardTarget, BodyguardAbilityHandler.BODYGUARD_DISTANCE))
            {
                guardSource.Out.SendMessage(LanguageMgr.GetTranslation(guardSource.Client, "Effects.BodyguardEffect.NowBGXButSC", guardTarget.GetName(0, false)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                guardTarget.Out.SendMessage(LanguageMgr.GetTranslation(guardTarget.Client, "Effects.BodyguardEffect.XNowBGYouButSC", guardSource.GetName(0, true)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
            }
            else
            {
                guardSource.Out.SendMessage(LanguageMgr.GetTranslation(guardSource.Client, "Effects.BodyguardEffect.YouAreNowBGX", guardTarget.GetName(0, false)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                guardTarget.Out.SendMessage(LanguageMgr.GetTranslation(guardTarget.Client, "Effects.BodyguardEffect.XIsBGYou", guardSource.GetName(0, true)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
            }
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:35,代码来源:BodyguardEffect.cs

示例6: GetPersonalizedMessage

        /// <summary>
        /// Personalizes the given message by replacing all instances of PLAYER with the actual name of the player
        /// </summary>
        /// <param name="message">message to personalize</param>
        /// <param name="player">Player's name to insert</param>
        /// <returns>message with actual name of player instead of PLAYER</returns>
        public static string GetPersonalizedMessage(string message, GamePlayer player)
        {
            if (message == null || player == null)
                return message;

            int playerIndex = message.IndexOf(PLAYER);
            if (playerIndex == 0)
            {
                message = message.Replace(PLAYER, player.GetName(0, true));
            }
            else if (playerIndex > 0)
            {
                message = message.Replace(PLAYER, player.GetName(0, false));
            }

            // {PLAYER} is deprecated use <PLAYER> instead
            playerIndex = message.IndexOf(PLAYER_OLD);
            if (playerIndex == 0)
            {
                message = message.Replace(PLAYER_OLD, player.GetName(0, true));
            }
            else if (playerIndex > 0)
            {
                message = message.Replace(PLAYER_OLD, player.GetName(0, false));
            }

            message = message.Replace(RACE, player.RaceName);
            message = message.Replace(CLASS, player.CharacterClass.Name);

            return message;
        }
开发者ID:boscorillium,项目名称:dol,代码行数:37,代码来源:BehaviourUtils.cs

示例7: Start

        /// <summary>
        /// Start the guarding on player
        /// </summary>
        public void Start(GamePlayer protectSource, GamePlayer protectTarget)
        {
            if (protectSource == null || protectTarget == null)
                return;

            m_owner = protectSource;
            m_playerGroup = protectSource.Group;

            if (m_playerGroup != protectTarget.Group)
                return;

            m_protectSource = protectSource;
            m_protectTarget = protectTarget;

            GameEventMgr.AddHandler(m_playerGroup, GroupEvent.MemberDisbanded, new DOLEventHandler(GroupDisbandCallback));

            m_protectSource.EffectList.Add(this);
            m_protectTarget.EffectList.Add(this);

            if (!protectSource.IsWithinRadius(protectTarget, ProtectAbilityHandler.PROTECT_DISTANCE))
            {
                protectSource.Out.SendMessage(LanguageMgr.GetTranslation(protectSource.Client, "Effects.ProtectEffect.YouProtectingYBut", protectTarget.GetName(0, false)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                protectTarget.Out.SendMessage(LanguageMgr.GetTranslation(protectTarget.Client, "Effects.ProtectEffect.XProtectingYouBut", protectSource.GetName(0, true)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
            }
            else
            {
                protectSource.Out.SendMessage(LanguageMgr.GetTranslation(protectSource.Client, "Effects.ProtectEffect.YouProtectingY", protectTarget.GetName(0, false)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                protectTarget.Out.SendMessage(LanguageMgr.GetTranslation(protectTarget.Client, "Effects.ProtectEffect.XProtectingYou", protectSource.GetName(0, true)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
            }
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:33,代码来源:ProtectEffect.cs

示例8: Start

        // <summary>
        // Start the guarding on player
        // <//summary>
        // <param name="guardSource">The guarder<//param>
        // <param name="guardTarget">The player guarded by guarder<//param>
        public void Start(GamePlayer guardSource, GamePlayer guardTarget, int duration)
        {
            if (guardSource == null || guardTarget == null)
                return;

            m_playerGroup = guardSource.Group;

            if (m_playerGroup != guardTarget.Group)
                return;

            m_guardSource = guardSource;
            m_guardTarget = guardTarget;
            // Set the duration & start the timers
            m_effectDuration = duration;
            StartTimers();

            m_guardSource.EffectList.Add(this);
            m_guardTarget.EffectList.Add(this);

            if (!guardSource.IsWithinRadius(guardTarget, DashingDefenseEffect.GUARD_DISTANCE))
            {
                guardSource.Out.SendMessage(string.Format("You are now guarding {0}, but you must stand closer.", guardTarget.GetName(0, false)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                guardTarget.Out.SendMessage(string.Format("{0} is now guarding you, but you must stand closer.", guardSource.GetName(0, true)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
            }
            else
            {
                guardSource.Out.SendMessage(string.Format("You are now guarding {0}.", guardTarget.GetName(0, false)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                guardTarget.Out.SendMessage(string.Format("{0} is now guarding you.", guardSource.GetName(0, true)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
            }
            guardTarget.TempProperties.setProperty(RealmAbilities.DashingDefenseAbility.Dashing, true);
        }
开发者ID:mynew4,项目名称:DAoC,代码行数:36,代码来源:DashingDefenseEffect.cs


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