Aura.Channel.World.Dungeons.DungeonManager.CheckDrop C# (CSharp) Метод

CheckDrop() публичный Метод

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.
public CheckDrop ( Creature creature, Item item ) : bool
creature Aura.Channel.World.Entities.Creature
item Item
Результат bool
		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);
		}