public SpawnPoint(SpawnEntry entry, Region region) { m_spawns = new List<Unit>(); m_timer = new TimerEntry { Action = Spawn }; m_timer.Stop(); Region = region; SpawnEntry = entry; }
public static CasterInfo GetOrCreate(Region rgn, EntityId id) { var caster = rgn.GetObject(id); if (caster != null) { return caster.CasterInfo; } return new CasterInfo(id, 1); }
public static ObjectReference GetOrCreate(Region rgn, EntityId id) { var caster = rgn.GetObject(id); if (caster != null) { return caster.SharedReference; } return new ObjectReference(id, 1); }
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; }
public Zone(Region rgn, ZoneInfo info) { Region = rgn; Info = info; if (info.WorldStates != null) { WorldStates = new WorldStateCollection(this, info.WorldStates); } CreateChatChannels(); }
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; }
public Zone(Region rgn, ZoneTemplate template) { Region = rgn; Template = template; if (template.WorldStates != null) { WorldStates = new WorldStateCollection(this, template.WorldStates); } CreateChatChannels(); }
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; }
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); }
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; }
public NPC Create(Region rgn, Vector3 pos) { var npc = NPCCreator(this); npc.SetupNPC(this, null); rgn.AddObject(npc, pos); return npc; }
public ZoneWorldLocation(Region region, Vector3 pos, ZoneTemplate zone) : base(region, pos) { ZoneTemplate = zone; }
/// <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; }
public void NotifyStopped(Region region) { var evt = Started; if (evt != null) { evt(region); } }
public void NotifySpawned(Region region) { var evt = Spawned; if (evt != null) { evt(region); } }
public void TeleportTo(Region region, bool wait) { TeleportTo(region, ref m_position, 3f, wait); }
/// <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); }
/// <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; }
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; } }
/// <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; }
/// <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); }
/// <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; }
/// <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); } } }
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(); } } }
internal void NotifyCreated(Region region) { var evt = Created; if (evt != null) { evt(region); } }
/// <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; } }
public bool NotifyStopping(Region region) { var evt = Stopping; if (evt != null) { return evt(region); } return true; }
public TeleportNode(string defaultName, Region rgn, Vector3 pos) { DefaultName = defaultName; Region = rgn; Position = pos; }
public void NotifyPlayerLeft(Region region, Character chr) { var evt = PlayerLeft; if (evt != null) { evt(region, chr); } }
public NPC SpawnAt(Region rgn, Vector3 pos) { var npc = Create(rgn.DifficultyIndex); rgn.AddObject(npc, pos); return npc; }