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


C# Creature.Warp方法代码示例

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


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

示例1: Complete

		/// <summary>
		/// Completes skill, teleporting behind target.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="skill"></param>
		/// <param name="packet"></param>
		public void Complete(Creature creature, Skill skill, Packet packet)
		{
			var target = creature.Target;
			if (target != null)
			{
				var pos = creature.GetPosition();
				var targetPos = target.GetPosition();
				var telePos = pos.GetRelative(targetPos, DistanceToTarget);

				Send.Effect(creature, Effect.SilentMoveTeleport, (byte)2, telePos.X, telePos.Y);
				creature.Warp(creature.RegionId, telePos);
			}

			Send.SkillComplete(creature, skill.Info.Id);
		}
开发者ID:aura-project,项目名称:aura,代码行数:21,代码来源:DarkLord.cs

示例2: CreateDungeonAndWarp

		/// <summary>
		/// Creates a dungeon with the given parameters and warps the creature's
		/// party inside.
		/// </summary>
		/// <param name="dungeonName"></param>
		/// <param name="itemId"></param>
		/// <param name="creature"></param>
		/// <returns></returns>
		public bool CreateDungeonAndWarp(string dungeonName, int itemId, Creature creature)
		{
			lock (_createAndCleanUpLock)
			{
				try
				{
					var dungeon = this.CreateDungeon(dungeonName, itemId, creature);
					var regionId = dungeon.Regions.First().Id;
					var pos = creature.GetPosition();

					creature.Warp(regionId, pos);

					return true;
				}
				catch (Exception ex)
				{
					Log.Exception(ex, "Failed to create and warp to dungeon.");
					return false;
				}
			}
		}
开发者ID:xKamuna,项目名称:aura,代码行数:29,代码来源:DungeonManager.cs

示例3: Complete

		/// <summary>
		/// Completes skill, warping to destination.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="skill"></param>
		/// <param name="packet"></param>
		public void Complete(Creature creature, Skill skill, Packet packet)
		{
			var destination = (Continent)packet.GetByte();

			int regionId, x, y;
			switch (destination)
			{
				case Continent.Uladh:
					if (creature.Keywords.Has("portal_dunbarton"))
					{
						regionId = 14; x = 41598; y = 36010; // Dun
					}
					else
					{
						regionId = 1; x = 12789; y = 38399; // Tir
					}
					break;
				case Continent.Iria:
					regionId = 3001; x = 164837; y = 170144; // Qilla
					break;
				case Continent.Belvast:
					regionId = 4005; x = 41760; y = 26924; // Belvast
					break;
				default:
					Send.Notice(creature, "Unknown destination.");
					Send.SkillCancel(creature);
					return;
			}

			creature.Warp(regionId, x, y);

			Send.SkillComplete(creature, skill.Info.Id, (byte)destination);
		}
开发者ID:tkiapril,项目名称:aura,代码行数:39,代码来源:ContinentWarp.cs

示例4: Warp

		/// <summary>
		/// Warps creature, based on the item's properties.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="item"></param>
		/// <returns>Whether a warp happened or not.</returns>
		public static bool Warp(Creature creature, Item item)
		{
			if (creature == null)
				throw new ArgumentNullException("creature");

			if (item == null)
				throw new ArgumentNullException("item");

			// Check meta data
			if (!item.MetaData1.Has("TARGET"))
			{
				Send.ServerMessage(creature, Localization.Get("No target found."));
				return false;
			}

			// Get target
			var target = item.MetaData1.GetString("TARGET");

			// Get location based on target
			Location loc;
			if (target.StartsWith("pos")) // [email protected],x,y
			{
				var match = Regex.Match(target, @"[email protected](?<regionId>[0-9]+),(?<x>[0-9]+),(?<y>[0-9]+)");
				if (!match.Success)
				{
					Log.Warning("HiddenTownBack: Invalid position target: {0}", target);
					Send.ServerMessage(creature, Localization.Get("Invalid target."));
					return false;
				}

				loc.RegionId = Convert.ToInt32(match.Groups["regionId"].Value);
				loc.X = Convert.ToInt32(match.Groups["x"].Value);
				loc.Y = Convert.ToInt32(match.Groups["y"].Value);
			}
			else if (target.StartsWith("portal")) // [email protected]
			{
				// Remove "[email protected]" prefix
				target = target.Substring(7).Trim();

				// Get portal data
				var portalData = AuraData.PortalDb.Find(target);
				if (portalData == null)
				{
					Log.Warning("HiddenTownBack: Unknown target: {0}", target);
					Send.ServerMessage(creature, Localization.Get("Unknown target."));
					return false;
				}

				// Get location
				try
				{
					loc = new Location(portalData.Location);
				}
				catch
				{
					Log.Warning("HiddenTownBack: Invalid portal location: {0}", target);
					Send.ServerMessage(creature, Localization.Get("Invalid portal location."));
					return false;
				}
			}
			else if (target == "last_town")
			{
				loc = new Location(creature.LastTown);
			}
			else
			{
				Log.Warning("HiddenTownBack: Unknown target type: {0}", target);
				Send.ServerMessage(creature, Localization.Get("Unknown target type."));
				return false;
			}

			// Warp
			creature.Warp(loc);

			return true;
		}
开发者ID:tkiapril,项目名称:aura,代码行数:82,代码来源:HiddenTownBack.cs

示例5: CheckDrop

		/// <summary>
		/// Checks if creature is able to enter a dungeon with the given item,
		/// at his current position, if so, a dungeon is created and the
		/// party is moved inside.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="item"></param>
		/// <returns></returns>
		public bool CheckDrop(Creature creature, Item item)
		{
			var currentRegionId = creature.RegionId;
			if (!_entryRegionIds.Contains(currentRegionId))
				return false;

			var pos = creature.GetPosition();

			var clientEvent = creature.Region.GetClientEvent(a => a.Data.IsAltar);
			if (clientEvent == null)
			{
				Log.Warning("DungeonManager.CheckDrop: No altar found.");
				return false;
			}

			if (!clientEvent.IsInside(pos.X, pos.Y))
			{
				// Tell player to step on altar?
				return false;
			}

			var parameter = clientEvent.Data.Parameters.FirstOrDefault(a => a.EventType == EventType.Altar);
			if (parameter == null || parameter.XML == null || parameter.XML.Attribute("dungeonname") == null)
			{
				Log.Warning("DungeonManager.CheckDrop: No dungeon name found in altar event '{0:X16}'.", clientEvent.EntityId);
				return false;
			}

			var dungeonName = parameter.XML.Attribute("dungeonname").Value.ToLower();

			// Check script
			var dungeonScript = ChannelServer.Instance.ScriptManager.DungeonScripts.Get(dungeonName);
			if (dungeonScript == null)
			{
				Send.ServerMessage(creature, "This dungeon hasn't been added yet.");
				Log.Warning("DungeonManager.CheckDrop: No routing dungeon script found for '{0}'.", dungeonName);
				return false;
			}

			// Check arenas
			if (dungeonScript.Name == "tircho_alby_dungeon" && item.HasTag("/alby_battle_arena/"))
			{
				creature.Warp(28, 1174, 795);
				return true;
			}

			// Check route
			if (!dungeonScript.Route(creature, item, ref dungeonName))
			{
				// The response in case of a fail is handled by the router.
				return false;
			}

			// Check party
			if (creature.IsInParty && creature.Party.Leader != creature)
			{
				// Unofficial
				Send.Notice(creature, Localization.Get("Only the leader may create the dungeon."));
				return false;
			}

			return this.CreateDungeonAndWarp(dungeonName, item.Info.Id, creature);
		}
开发者ID:aura-project,项目名称:aura,代码行数:71,代码来源:DungeonManager.cs


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