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


C# GamePlayer.Stealth方法代码示例

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


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

示例1: Interact

		public override bool Interact(GamePlayer player)
		{
			if (!base.Interact(player)) return false;

            foreach (GameNPC npc in GetNPCsInRadius(100))
            {
                if (npc.Model == 1583)
                {
                    player.Out.SendMessage("You cannot pickup " + GetName(0, false) + ". It is locked!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return false;
                }
            }

			if (!player.IsAlive)
			{
				player.Out.SendMessage("You cannot pickup " + GetName(0, false) + ". You are dead!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
				return false;
			}
			if (this.Owner != null)
			{
				player.Out.SendMessage("This Relic is owned by someone else!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
				return false;
			}
			if (player.MinotaurRelic != null)
			{
				player.Out.SendMessage("You already have a Relic!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
				return false;
			}
			if (player.Group != null)
			{
				foreach (GamePlayer pl in player.Group.GetPlayersInTheGroup())
				{
					if (pl.MinotaurRelic != null)
					{
						player.Out.SendMessage("Someone in your group already have a Relic!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
						return false;
					}
				}
			}
			if (player.IsStealthed)
				player.Stealth(false);
			PlayerTakesRelic(player);
			return true;
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:44,代码来源:MinotaurRelic.cs

示例2: Execute

        /// <summary>
        /// Executes the stealth ability
        /// </summary>
        /// <param name="spec"></param>
        /// <param name="player"></param>
        public void Execute(Specialization spec, GamePlayer player)
        {
            // Can't stealth while in combat
            if(player.InCombat && !player.IsStealthed && player.Client.Account.PrivLevel == (int)ePrivLevel.Player)
            {
                player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.Stealth.CannotUseInCombat"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                return;
            }

            long stealthChangeTick = player.TempProperties.getProperty<long>(GamePlayer.STEALTH_CHANGE_TICK);
            long changeTime = player.CurrentRegion.Time - stealthChangeTick;
            if(changeTime < 2000)
            {
                player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.Stealth.CannotUseStealthChangeTick", ((2000 - changeTime) / 1000).ToString()), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                return;
            }
            player.TempProperties.setProperty(GamePlayer.STEALTH_CHANGE_TICK, player.CurrentRegion.Time);

            if (!player.IsStealthed)
            {
                // Dead can't stealth
                if(!player.IsAlive)
                {
                    player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.Stealth.CannotUseDead"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }

                // Can't stealth if in attack mode
                if(player.AttackState || (player.CurrentSpellHandler != null && player.CurrentSpellHandler.IsCasting))
                {
                    player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.Stealth.CannotUseCombatState"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }

                //TODO: more checks in this order

                //"You can't hide with a relic!"

                if (player.ConcentrationEffects.GetOfType(typeof (PulsingSpellEffect)) != null)
                {
                    player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.Stealth.CannotUseActivePulsingSpell"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }

                //HasVanishRealmAbilityActivated -> Allow stealthing, Stop further checks ...

                if (player.IsMezzed)
                {
                    player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.Stealth.CannotUseMezzed"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }

                if (player.IsStunned)
                {
                    player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.Stealth.CannotUseStunned"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }

                // Check if enemy player is close
                foreach (GamePlayer ply in player.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
                {
                    if (ply.ObjectState != GameObject.eObjectState.Active) continue;

                    //Dead players don't prevent stealth!
                    if (!ply.IsAlive) continue;

                    //TODO: "True Seeing" realm ability check
                    //True Seeing denies restealthing for VISIBILITY_DISTANCE!
                    //There was/is a huge discussion about this on live servers since
                    //all Assessins found this quite unfair!
                    //But the discussion has died down since True Seeing etc.

                    //Friendly players/mobs don't prevent stealth!
                    if (!GameServer.ServerRules.IsAllowedToAttack(ply, player, true)) continue;

                    //GM's don't prevent stealth
                    if (ply.Client.Account.PrivLevel > 1) continue;

                    //Range check
                    if (!IsObjectTooClose(ply, player)) continue;

                    player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.Stealth.CannotUseToCloseAnEnemy"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }

                // Check if enemy NPC is close
                foreach (GameNPC npc in player.GetNPCsInRadius(WorldMgr.VISIBILITY_DISTANCE))
                {
                    if (npc.ObjectState != GameObject.eObjectState.Active) continue;

                    //Dead npc don't prevent stealth!
                    if (!npc.IsAlive) continue;

                    //Friendly players/mobs don't prevent stealth!
                    if (!GameServer.ServerRules.IsAllowedToAttack(npc, player, true)) continue;
//.........这里部分代码省略.........
开发者ID:mynew4,项目名称:DOLSharp,代码行数:101,代码来源:StealthSpecHandler.cs

示例3: CraftItem

		/// <summary>
		/// Called when player tries to begin crafting an item
		/// </summary>
		public virtual void CraftItem(GamePlayer player, DBCraftedItem recipe, ItemTemplate itemToCraft, IList<DBCraftedXItem> rawMaterials)
		{
			if (!CanPlayerStartToCraftItem(player, recipe, itemToCraft, rawMaterials))
			{
				return;
			}

			if (player.IsCrafting)
			{
				StopCraftingCurrentItem(player, itemToCraft);
				return;
			}

			int craftingTime = GetCraftingTime(player, recipe, rawMaterials);

			player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "AbstractCraftingSkill.CraftItem.BeginWork", itemToCraft.Name, CalculateChanceToMakeItem(player, recipe).ToString()), eChatType.CT_Missed, eChatLoc.CL_SystemWindow);
			player.Out.SendTimerWindow(LanguageMgr.GetTranslation(player.Client.Account.Language, "AbstractCraftingSkill.CraftItem.CurrentlyMaking", itemToCraft.Name), craftingTime);

			player.Stealth(false);
			
			StartCraftingTimerAndSetCallBackMethod(player, recipe, rawMaterials, craftingTime);
		}
开发者ID:Refizul,项目名称:DOL-Kheldron,代码行数:25,代码来源:AbstractCraftingSkill.cs

示例4: BeginWork

		/// <summary>
		/// Begin salvaging an inventory item
		/// </summary>
		/// <param name="item"></param>
		/// <param name="player"></param>
		/// <returns></returns>
		public static int BeginWork(GamePlayer player, InventoryItem item)
		{
            SalvageYield salvageYield = null;

			if (!IsAllowedToBeginWork(player, item))
			{
				return 0;
			}

			int salvageLevel = CraftingMgr.GetItemCraftLevel(item) / 100;
			if(salvageLevel > 9) salvageLevel = 9; // max 9

			string sql = "";

			if (item.SalvageYieldID == 0)
			{
				sql = "ObjectType=" + item.Object_Type + " AND SalvageLevel=" + salvageLevel;
			}
			else
			{
				sql = "ID=" + item.SalvageYieldID;
			}

			if (ServerProperties.Properties.USE_SALVAGE_PER_REALM)
			{
				// Some items use realm, some do not, so allow a find of either a set realm, or 0
				sql += " AND (Realm=" + item.Realm + " OR Realm=0)";
			}

			salvageYield = GameServer.Database.SelectObject<SalvageYield>(sql);
			ItemTemplate material = null;

			if (salvageYield != null && string.IsNullOrEmpty(salvageYield.MaterialId_nb) == false)
			{
				material = GameServer.Database.FindObjectByKey<ItemTemplate>(salvageYield.MaterialId_nb);

				if (material == null)
				{
					player.Out.SendMessage("Can't find material (" + material.Id_nb + ") needed to salvage this item!", eChatType.CT_Important, eChatLoc.CL_SystemWindow);
					log.ErrorFormat("Salvage Error for ID: {0}:  Material not found: {1}", salvageYield.ID, material.Id_nb);
				}
			}

            if (material == null)
			{
				if (salvageYield == null && item.SalvageYieldID > 0)
				{
					player.Out.SendMessage("This items salvage recipe (" + item.SalvageYieldID + ") not implemented yet.", eChatType.CT_Important, eChatLoc.CL_SystemWindow);
					log.ErrorFormat("SalvageYield ID {0} not found for item: {1}", item.SalvageYieldID, item.Name);
				}
				else if (salvageYield == null)
				{
					player.Out.SendMessage("Salvage recipe not found for this item.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
					log.ErrorFormat("Salvage Lookup Error: ObjectType: {0}, Item: {1}", item.Object_Type, item.Name);
				}
				return 0;
			}

			if (player.IsMoving || player.IsStrafing)
			{
				player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Salvage.BeginWork.InterruptSalvage"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
				return 0;
			}

			if (player.IsStealthed)
			{
				player.Stealth(false);
			}
			
			player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Salvage.BeginWork.BeginSalvage", item.Name), eChatType.CT_System, eChatLoc.CL_SystemWindow);

			// clone the yield entry and update values to work with this salvage (not saved to the DB)
			SalvageYield yield = salvageYield.Clone() as SalvageYield;

			if (item.SalvageYieldID == 0 || yield.Count == 0)
			{
				// Calculated salvage values
				int count = GetMaterialYield(player, item, yield, material);
				if (count < 1)
				{
					player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Salvage.BeginWork.NoSalvage", item.Name + ". The material returned amount is zero"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
					return 0;
				}
			}

			player.Out.SendTimerWindow(LanguageMgr.GetTranslation(player.Client.Account.Language, "Salvage.BeginWork.Salvaging", item.Name), yield.Count);
			player.CraftTimer = new RegionTimer(player);
			player.CraftTimer.Callback = new RegionTimerCallback(Proceed);
			player.CraftTimer.Properties.setProperty(AbstractCraftingSkill.PLAYER_CRAFTER, player);
			player.CraftTimer.Properties.setProperty(SALVAGED_ITEM, item);
			player.CraftTimer.Properties.setProperty(SALVAGE_YIELD, yield);

			player.CraftTimer.Start(yield.Count * 1000);
			return 1;
//.........这里部分代码省略.........
开发者ID:mynew4,项目名称:DAoC,代码行数:101,代码来源:Salvage.cs

示例5: PreFireChecks

		public bool PreFireChecks(GamePlayer player, GameLiving obj)
		{
			if (obj == null)
				return false;
			if (player.Realm != obj.Realm)
				return false;

			if (player.Client.Account.PrivLevel > (int)ePrivLevel.Player)
				return true;

			if ((obj as GameLiving).InCombat)
			{
				DisplayMessage(player, "You can't repair object while it is under attack!");
				return false;
			}
            if (obj is GameKeepDoor)
            {
                GameKeepDoor doorcomponent = obj as GameKeepDoor;
                if (doorcomponent.Component.AbstractKeep.InCombat)
                {
                    DisplayMessage(player, "You can't repair the keep door while keep is under attack!");
                    return false;
                }
            }
			if (obj is IKeepItem)
			{
				if (obj.CurrentRegion.Time - obj.LastAttackedByEnemyTick <= 60 * 1000)
				{
					DisplayMessage(player, "You can't repair the keep component while it is under attack!");
					return false;
				}
			}

			if ((obj as GameLiving).HealthPercent == 100)
			{
				DisplayMessage(player, "The component is already at full health!");
				return false;
			}
			if (obj is GameKeepComponent)
			{
				GameKeepComponent component = obj as GameKeepComponent;
				if (component.IsRaized)
				{
					DisplayMessage(player, "You cannot repair a raized tower!");
					return false;
				}
			}

			if (player.IsCrafting)
			{
				DisplayMessage(player, "You must end your current action before you repair anything!");
				return false;
			}
			if (player.IsMoving)
			{
				DisplayMessage(player, "You can't repair while moving");
				return false;
			}

			if (!player.IsAlive)
			{
				DisplayMessage(player, "You can't repair while dead.");
				return false;
			}

			if (player.IsSitting)
			{
				DisplayMessage(player, "You can't repair while sitting.");
				return false;
			}

			if (player.InCombat)
			{
				DisplayMessage(player, "You can't repair while in combat.");
				return false;
			}

			if (!player.IsWithinRadius(obj, WorldMgr.INTERACT_DISTANCE))
			{
				DisplayMessage(player, "You are too far away to repair this component.");
				return false;
			}

			int repairamount = (GetTotalWoodForLevel(obj.Level) / 100) * 15;
			int playerswood = CalculatePlayersWood(player, 0);

			if (playerswood < repairamount)
			{
				DisplayMessage(player, "You need another " + (repairamount - playerswood) + " units of wood!");
				return false;
			}

			if (player.GetCraftingSkillValue(eCraftingSkill.WoodWorking) < 1)
			{
				DisplayMessage(player, "You need woodworking skill to repair.");
				return false;
			}

			player.Stealth(false);

//.........这里部分代码省略.........
开发者ID:mynew4,项目名称:DOLSharp,代码行数:101,代码来源:Repair.cs


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