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


C# Creature.Warp方法代码示例

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


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

示例1: OnUse

	public override void OnUse(Creature creature, Item item)
	{
		// Avon Feather
		if (item.HasTag("/feather_of_avon/"))
		{
			var regionId = item.MetaData1.GetInt("AFRR");
			var x = item.MetaData1.GetInt("AFRX");
			var y = item.MetaData1.GetInt("AFRY");
			var lastWarp = item.MetaData1.GetDateTime("AFLU");
			var inAvon = (creature.RegionId == AvonRegionId);
			var pos = creature.GetPosition();

			// Stop if on cooldown or creature is in a temp region
			if (DateTime.Now < lastWarp.AddMinutes(AvonCoolDown) || creature.Region.IsTemp)
			{
				Send.ServerMessage(creature, L("Safety error, failed to warp."));
				return;
			}

			// Don't warp if it's the first time and the creature already
			// is in Avon, or if creature already is in the target region.
			if ((regionId == 0 && creature.RegionId == AvonRegionId) || creature.RegionId == regionId)
			{
				Send.ServerMessage(creature, L("Region error, failed to warp."));
				return;
			}

			// Update feather's destination
			item.MetaData1.SetInt("AFRR", creature.RegionId);
			item.MetaData1.SetInt("AFRX", inAvon ? AvonX : pos.X);
			item.MetaData1.SetInt("AFRY", inAvon ? AvonY : pos.Y);
			item.MetaData1.SetLong("AFLU", DateTime.Now);
			Send.ItemUpdate(creature, item);

			// Warp, default to Avon if region is 0
			if (regionId == 0)
				creature.Warp(AvonRegionId, AvonX, AvonY);
			else
				creature.Warp(regionId, x, y);

			return;
		}

		// A few items prepare a skill, instead of sending use, to reduce
		// redundancy we'll call into the skill handler.
		HiddenTownBack.Warp(creature, item);
	}
开发者ID:tkiapril,项目名称:aura,代码行数:47,代码来源:warp_scroll.cs

示例2: CreateRegionAndWarp

	public void CreateRegionAndWarp(Creature creature)
	{
		var region = new DynamicRegion(118);
		ChannelServer.Instance.World.AddRegion(region);

		var rnd = RandomProvider.Get();
		var sheepAmount = SheepAmount;

		// After x ms (success)
		var timer = SetTimeout(Time, () =>
		{
			// Unofficial, I think the msg also depends on how well you did.
			Send.Notice(creature, NoticeType.MiddleSystem, L("The time is over, you did it."));
			Send.RemoveQuestTimer(creature);
			creature.Keywords.Give("TirChonaill_Tutorial_Thinking");
			creature.Warp(1, 27622, 42125);
		});

		// Spawn sheep
		for (int i = 0; i < sheepAmount; ++i)
		{
			var pos = Center.GetRandomInRect(6000, 4000, rnd);

			var npc = new NPC(40001); // Sheep
			npc.Death += (killed, killer) =>
			{
				sheepAmount--;

				// Cancel if success is not possible anymore.
				if (sheepAmount < SheepMinAmount)
				{
					Send.Notice(creature, NoticeType.MiddleSystem, L("You've failed to save the sheep."));
					Send.RemoveQuestTimer(creature);
					StopTimer(timer);
					creature.Warp(1, 27622, 42125);
					return;
				}

				Send.UpdateQuestTimerCounter(creature, L("Remaining sheep: {0}"), sheepAmount);
			};
			npc.Spawn(region.Id, pos.X, pos.Y);
		}

		// Spawn wolves
		for (int i = 0; i < WolfAmount; ++i)
			SpawnWolf(region.Id, rnd);

		// Warp to region and start visible timer
		creature.Warp(region.Id, 60000, 58000);
		Send.SetQuestTimer(creature, Time, L("Protect the sheep from wolves"), L("Deadline: {0}"), L("Remaining sheep: {0}"), sheepAmount);
	}
开发者ID:xKamuna,项目名称:aura,代码行数:51,代码来源:202003_save_my_sheep.cs

示例3: UseMoonGate

	private bool UseMoonGate(Creature creature, string origin, string destination)
	{
		// Check locations
		if (origin == destination)
		{
			Send.Notice(creature, Localization.Get("You cannot teleport using the same Moon Gate."));
			return false;
		}

		// Check gates
		MoonGate originGate, destinationGate;
		if (!gatesStr.TryGetValue(origin, out originGate) || !gatesStr.TryGetValue(destination, out destinationGate))
		{
			Send.Notice(creature, Localization.Get("This moon gate is currently not operable. Please report."));
			return false;
		}

		// Check origin gate
		if (originGate.Prop.State == "closed")
		{
			// Don't log, someone could be waiting with the map open and
			// select a destination too late.
			return false;
		}

		// Check range to origin gate
		if (creature.RegionId != originGate.Prop.Info.Region || !creature.GetPosition().InRange(originGate.Prop.GetPosition(), 1000))
		{
			// Could happen due to desync? The range at least.
			Send.Notice(creature, L("You're too far away."));
			return false;
		}

		// Check if char has target
		if (!CanWarpTo(creature, destinationGate))
		{
			Log.Warning("MoongateScript.MoonGateUse: Creature '{0:X16}' tried to warp to moon gate that he can't use.", creature.EntityId);
			return false;
		}

		creature.Warp(destinationGate.Prop.GetLocation());

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

示例4: Jail

	public static void Jail(Creature creature, TimeSpan time)
	{
		creature.Warp(126, 4400, 4200);
		creature.Vars.Perm["jail_free_time"] = DateTime.Now + time;
	}
开发者ID:xKamuna,项目名称:aura,代码行数:5,代码来源:jail.cs

示例5: OnTouchPortal

	public void OnTouchPortal(Creature creature, Prop portal)
	{
		if (portal.Extensions.HasAny)
			creature.Warp("Ula_Crossroad/_Ula_Crossroad/Cross_from_BanWarpdoor");
	}
开发者ID:aura-project,项目名称:aura,代码行数:5,代码来源:g1_30_bangor_barri_dungeon.cs


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