Ejemplo n.º 1
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;
		}
Ejemplo n.º 2
0
		public static CasterInfo GetOrCreate(Region rgn, EntityId id)
		{
			var caster = rgn.GetObject(id);
			if (caster != null)
			{
				return caster.CasterInfo;
			}
			return new CasterInfo(id, 1);
		}
Ejemplo n.º 3
0
		public static ObjectReference GetOrCreate(Region rgn, EntityId id)
		{
			var caster = rgn.GetObject(id);
			if (caster != null)
			{
				return caster.SharedReference;
			}
			return new ObjectReference(id, 1);
		}
Ejemplo n.º 4
0
		public static Portal Create(Region targetRgn, Vector3 targetPos)
		{
			var entry = GOMgr.GetEntry(GOPortalEntry.PortalId);
			if (entry == null)
			{
				return null;
			}
			var portal = (Portal)Create(entry, entry.FirstTemplate);
			portal.Target = new WorldLocation(targetRgn, targetPos);
			return portal;
		}
Ejemplo n.º 5
0
		public Zone(Region rgn, ZoneInfo info)
		{
			Region = rgn;
			Info = info;
			if (info.WorldStates != null)
			{
				WorldStates = new WorldStateCollection(this, info.WorldStates);
			}

			CreateChatChannels();
		}
Ejemplo n.º 6
0
		public Ticket(Character chr, string message, TicketType type)
		{
			m_owner = chr;
			m_ownerName = chr.Name;
			m_charId = chr.EntityId.Low;
			m_Message = message;
			m_region = chr.Region;
			m_position = chr.Position;
			m_Timestamp = DateTime.Now;
			m_Type = type;
		}
Ejemplo n.º 7
0
Archivo: Zone.cs Proyecto: NVN/WCell
		public Zone(Region rgn, ZoneTemplate template)
		{
			Region = rgn;
			Template = template;
			if (template.WorldStates != null)
			{
				WorldStates = new WorldStateCollection(this, template.WorldStates);
			}

			CreateChatChannels();
		}
Ejemplo n.º 8
0
		public static IMessage GetRemoveObjectTask(WorldObject obj, Region rgn)
		{
		    var moveTask = new Message2<WorldObject, Region>();

			moveTask.Parameter1 = obj;
			moveTask.Parameter2 = rgn;

            moveTask.Callback = ((worldObj, objRgn) =>
            {
                objRgn.RemoveObjectNow(worldObj);
            });

			return moveTask;
		}
Ejemplo n.º 9
0
		public DynamicObject(Unit creator, SpellId spellId, float radius, Region region, Vector3 pos)
		{
			if (creator == null)
				throw new ArgumentNullException("creator", "creator must not be null");

			Master = m_creator = creator;
			EntityId = EntityId.GetDynamicObjectId(++lastId);
			Type |= ObjectTypes.DynamicObject;
			SetEntityId(DynamicObjectFields.CASTER, Caster.EntityId);
			SpellId = spellId;
			Radius = radius;
			Bytes = 0x01EEEEEE;
			ScaleX = 1;

			m_position = pos;
			region.AddObjectLater(this);
		}
Ejemplo n.º 10
0
		public static IMessage GetInitializeCharacterTask(Character chr, Region rgn)
		{
			var initTask = new Message2<Character, Region>();

			initTask.Parameter1 = chr;
			initTask.Parameter2 = rgn;

			initTask.Callback = ((initChr, initRgn) =>
			{
				initRgn.AddObjectNow(chr);
				//Region.s_log.Debug("Owner added to the region");

				//Region.s_log.Debug("Owner initialized");
			});

			return initTask;
		}
Ejemplo n.º 11
0
		public NPC Create(Region rgn, Vector3 pos)
		{
			var npc = NPCCreator(this);
			npc.SetupNPC(this, null);
			rgn.AddObject(npc, pos);
			return npc;
		}
Ejemplo n.º 12
0
		public ZoneWorldLocation(Region region, Vector3 pos, ZoneTemplate zone)
			: base(region, pos)
		{
			ZoneTemplate = zone;
		}
Ejemplo n.º 13
0
		/// <summary>
		/// Spawns and returns a new Corpse at the given location
		/// </summary>
		/// <param name="bones"></param>
		/// <param name="lootable"></param>
		/// <returns></returns>
		public Corpse SpawnCorpse(bool bones, bool lootable, Region region, Vector3 pos, float o)
		{
			var corpse = new Corpse(this, pos, o, DisplayId, Facial, Skin,
				HairStyle, HairColor, FacialHair, GuildId, Gender, Race,
				bones ? CorpseFlags.Bones : CorpseFlags.None, lootable ? CorpseDynamicFlags.PlayerLootable : CorpseDynamicFlags.None);

			for (var i = EquipmentSlot.Head; i <= EquipmentSlot.Tabard; i++)
			{
				var item = m_inventory[(int)i];
				if (item != null)
				{
					corpse.SetItem(i, item.Template);
				}
			}

			corpse.Position = pos;
			region.AddObjectLater(corpse);
			return corpse;
		}
Ejemplo n.º 14
0
		public void NotifyStopped(Region region)
		{
			var evt = Started;
			if (evt != null)
			{
				evt(region);
			}
		}
Ejemplo n.º 15
0
		public void NotifySpawned(Region region)
		{
			var evt = Spawned;
			if (evt != null)
			{
				evt(region);
			}
		}
Ejemplo n.º 16
0
		public void TeleportTo(Region region, bool wait)
		{
			TeleportTo(region, ref m_position, 3f, wait);
		}
Ejemplo n.º 17
0
		/// <summary>
		/// Teleports the owner to the given position in the given region.
		/// </summary>
		/// <param name="region">the target <see cref="Region" /></param>
		/// <param name="pos">the target <see cref="Vector3">position</see></param>
		/// <param name="orientation">the target orientation</param>
		public void TeleportTo(Region region, Vector3 pos, float? orientation)
		{
			TeleportTo(region, ref pos, orientation);
		}
Ejemplo n.º 18
0
		/// <summary>
		/// Spawns and returns a new GameObject from this template into the given region
		/// </summary>
		/// <returns>The newly spawned GameObject or null, if the Template has no Entry associated with it.</returns>
		public GameObject Spawn(Region region)
		{
			if (Entry == null)
			{
				return null;
			}
			var go = GameObject.Create(Entry, this);
			go.Position = Pos;
			region.AddObject(go);
			return go;
		}
Ejemplo n.º 19
0
		public void TeleportTo(Region region, ref Vector3 pos, float? orientation, bool wait)
		{
			if (!HasNode)
			{
				m_region = null;
			}

			Assert.IsNotNull(region);
			if (Region == region)
			{
				Assert.IsTrue(Region.MoveObject(this, ref pos));

				if (orientation.HasValue)
				{
					Orientation = orientation.Value;
				}
			}
			else
			{
				region.TransferObject(this, pos, wait);

				if (orientation != null)
				{
					Orientation = orientation.Value;
				}

				LastPosition = pos;
			}
		}
Ejemplo n.º 20
0
		/// <summary>
		/// Returns the character to their original location prior to entering the Battleground.
		/// </summary>
		public void TeleportBack()
		{
			if (_entryRegion == null || _entryRegion.IsDisposed || _entryPosition.X == 0)
			{
				_chr.TeleportToBindLocation();
			}
			else
			{
				_chr.TeleportTo(_entryRegion, ref _entryPosition, _entryOrientation);
			}

			_entryRegion = null;
		}
Ejemplo n.º 21
0
		/// <summary>
		/// Teleports the owner to the given position in the given region.
		/// </summary>
		/// <param name="region">the target <see cref="Region" /></param>
		/// <param name="pos">the target <see cref="Vector3">position</see></param>
		public void TeleportTo(Region region, Vector3 pos)
		{
			TeleportTo(region, ref pos, null);
		}
Ejemplo n.º 22
0
		/// <summary>
		/// Sets the entry position of the character.
		/// </summary>
		public void SetCharacterEntry(Region region, ref Vector3 pos, float orientation)
		{
			_entryRegion = region;
			_entryPosition = pos;
			_entryOrientation = orientation;
		}
Ejemplo n.º 23
0
		/// <summary>
		/// Teleports the owner to the given position in the given region.
		/// </summary>
		/// <param name="region">the target <see cref="Region" /></param>
		/// <param name="pos">the target <see cref="Vector3">position</see></param>
		/// <param name="orientation">the target orientation</param>
		public void TeleportTo(Region region, ref Vector3 pos, float? orientation)
		{
			var ownerRegion = m_region;
			if (region.IsDisposed)
				return;

			// must not be moving or logging out when being teleported
			CancelMovement();
			CancelAllActions();
			if (this is Character)
			{
				((Character)this).CancelLogout();
			}

			if (ownerRegion == region)
			{
				if (Region.MoveObject(this, ref pos))
				{
					if (orientation.HasValue)
						Orientation = orientation.Value;

					if (this is Character)
					{
						var chr = ((Character)this);
						chr.LastPosition = pos;

						MovementHandler.SendMoved(chr);
					}
				}
			}
			else
			{
				if (ownerRegion != null && !ownerRegion.IsInContext)
				{
					var position = pos;
					ownerRegion.AddMessage(new Message(() => TeleportTo(region, ref position, orientation)));
				}
				else if (region.TransferObjectLater(this, pos))
				{
					if (orientation.HasValue)
					{
						Orientation = orientation.Value;
					}

					if (this is Character)
					{
						var chr = ((Character)this);
						chr.LastPosition = pos;

						MovementHandler.SendNewWorld(chr.Client, region.Id, ref pos, Orientation);
					}
				}
				else
				{
					// apparently, the target region has a colliding entity ID. this should NEVER 
					// happen for any kind of Unit

					log.Error("ERROR: Tried to teleport object, but failed to add player to the new region - " + this);
				}
			}
		}
Ejemplo n.º 24
0
		internal static void LoadDefaultRegions()
		{
			foreach (var rgnInfo in s_regionInfos)
			{
				if (rgnInfo != null && rgnInfo.Type == MapType.Normal)
				{
					var region = new Region(rgnInfo);

					if (region.Id == MapId.Outland)
					{
						region.XpCalculator = XpGenerator.CalcOutlandXp;
					}
					else
					{
						region.XpCalculator = XpGenerator.CalcDefaultXp;
					}

					region.InitRegion();
				}
			}
		}
Ejemplo n.º 25
0
		internal void NotifyCreated(Region region)
		{
			var evt = Created;
			if (evt != null)
			{
				evt(region);
			}
		}
Ejemplo n.º 26
0
		/// <summary>
		/// Adds a region, associated with its unique Id (and InstanceId).
		/// </summary>
		/// <param name="region">the region to add</param>
		internal static void AddRegion(Region region)
		{
			RegionCount++;

			if (!region.IsInstance)
			{
				ArrayUtil.Set(ref s_Regions, (uint)region.Id, region);
			}
			else
			{
				var instances = GetInstances(region.Id);
				if (region.InstanceId >= instances.Length)
				{
					Array.Resize(ref instances, (int)(region.InstanceId * ArrayUtil.LoadConstant));
					s_instances[(uint)region.Id] = instances;
				}
				instances[region.InstanceId] = (InstancedRegion)region;
			}
		}
Ejemplo n.º 27
0
		public bool NotifyStopping(Region region)
		{
			var evt = Stopping;
			if (evt != null)
			{
				return evt(region);
			}
			return true;
		}
Ejemplo n.º 28
0
		public TeleportNode(string defaultName, Region rgn, Vector3 pos)
		{
			DefaultName = defaultName;
			Region = rgn;
			Position = pos;
		}
Ejemplo n.º 29
0
		public void NotifyPlayerLeft(Region region, Character chr)
		{
			var evt = PlayerLeft;
			if (evt != null)
			{
				evt(region, chr);
			}
		}
Ejemplo n.º 30
0
		public NPC SpawnAt(Region rgn, Vector3 pos)
		{
			var npc = Create(rgn.DifficultyIndex);
			rgn.AddObject(npc, pos);
			return npc;
		}