示例#1
0
		public void FinalizeDataHolder()
		{
			SpawnEntry = NPCMgr.GetSpawnEntry(SpawnId);
			if (SpawnEntry == null)
			{
				ContentHandler.OnInvalidDBData("{0} had an invalid SpawnId.", this);
			}
			else
			{
				var added = false;
				var cur = SpawnEntry.Waypoints.First;
				while (cur != null)
				{
					if (cur.Value.Id > Id)
					{
						Node = cur.List.AddBefore(cur, this);
						added = true;
						break;
					}
					else if (cur.Value.Id == Id)
					{
						ContentHandler.OnInvalidDBData("Found multiple Waypoints with the same Id {0} for SpawnEntry {1}", Id, SpawnEntry);
						return;
					}
					cur = cur.Next;
				}

				if (!added)
				{
					SpawnEntry.HasDefaultWaypoints = false;
					Node = SpawnEntry.Waypoints.AddLast(this);
				}
			}
		}
示例#2
0
		public SpawnPoint(SpawnEntry entry, Region region)
		{
			m_spawns = new List<Unit>();
			m_timer = new TimerEntry { Action = Spawn };
			m_timer.Stop();
			Region = region;
			SpawnEntry = entry;
		}
示例#3
0
文件: NPCs.cs 项目: ray2006/WCell
		public static void CreateTeleportNPC(NPCId id, Vector3 location, MapId regionId)
		{
			var spawn = new SpawnEntry
			{
				EntryId = id
			};
			spawn.FinalizeDataHolder();

			spawn.Spawned += npc =>
			{
				npc.Invulnerable++;
				npc.GossipMenu = WorldLocationMgr.CreateTeleMenu();
			};
		}
示例#4
0
		/// <summary>
		/// Creates but doesn't add the SpawnEntry
		/// </summary>
		public SpawnEntry CreateSpawnEntry(Vector3 location, int amount, int minRespawnSeconds, int maxRespawnSeconds, bool autoSpawn)
		{
			var entry = new SpawnEntry
			{
				EntryId = NPCId,
				Entry = this,
				MaxAmount = amount,
				RespawnSecondsMin = minRespawnSeconds,
				RespawnSecondsMax = maxRespawnSeconds,
				AutoSpawn = autoSpawn
			};

			entry.FinalizeDataHolder();
			return entry;
		}