void InstallAccessory(uint entry, sbyte seatId, bool minion, byte type, uint summonTime) { // @Prevent adding accessories when vehicle is uninstalling. (Bad script in OnUninstall/OnRemovePassenger/PassengerBoarded hook.) if (_status == Status.UnInstalling) { Log.outError(LogFilter.Vehicle, "Vehicle ({0}, Entry: {1}) attempts to install accessory (Entry: {2}) on seat {3} with STATUS_UNINSTALLING! " + "Check Uninstall/PassengerBoarded script hooks for errors.", _me.GetGUID().ToString(), GetCreatureEntry(), entry, seatId); return; } Log.outDebug(LogFilter.Vehicle, "Vehicle ({0}, Entry {1}): installing accessory (Entry: {2}) on seat: {3}", _me.GetGUID().ToString(), GetCreatureEntry(), entry, seatId); TempSummon accessory = _me.SummonCreature(entry, _me, (TempSummonType)type, summonTime); Cypher.Assert(accessory); if (minion) { accessory.AddUnitTypeMask(UnitTypeMask.Accessory); } _me.HandleSpellClick(accessory, seatId); // If for some reason adding accessory to vehicle fails it will unsummon in // @VehicleJoinEvent.Abort }
public CinematicManager(Player playerref) { player = playerref; m_cinematicDiff = 0; m_lastCinematicCheck = 0; m_activeCinematicCameraId = 0; m_cinematicLength = 0; m_cinematicCamera = null; m_remoteSightPosition = new Position(0.0f, 0.0f, 0.0f); m_CinematicObject = null; }
public static bool IsPersonalSummonOfAnotherPlayer(Creature summon, ObjectGuid playerToCheck) { TempSummon tempSummon = summon.ToTempSummon(); if (tempSummon != null) { if (tempSummon.IsVisibleBySummonerOnly() && playerToCheck != tempSummon.GetSummonerGUID()) { return(true); } } return(false); }
public void NextCinematicCamera() { // Sanity check for active camera set if (m_activeCinematic == null || m_activeCinematicCameraIndex >= m_activeCinematic.Camera.Length) { return; } uint cinematicCameraId = m_activeCinematic.Camera[++m_activeCinematicCameraIndex]; if (cinematicCameraId == 0) { return; } var flyByCameras = M2Storage.GetFlyByCameras(cinematicCameraId); if (!flyByCameras.Empty()) { // Initialize diff, and set camera m_cinematicDiff = 0; m_cinematicCamera = flyByCameras; if (!m_cinematicCamera.Empty()) { FlyByCamera firstCamera = m_cinematicCamera.FirstOrDefault(); Position pos = new(firstCamera.locations.X, firstCamera.locations.Y, firstCamera.locations.Z, firstCamera.locations.W); if (!pos.IsPositionValid()) { return; } player.GetMap().LoadGrid(firstCamera.locations.X, firstCamera.locations.Y); m_CinematicObject = player.SummonCreature(1, pos.posX, pos.posY, pos.posZ, 0.0f, TempSummonType.TimedDespawn, 5 * Time.Minute * Time.InMilliseconds); if (m_CinematicObject) { m_CinematicObject.SetActive(true); player.SetViewpoint(m_CinematicObject, true); } // Get cinematic length m_cinematicLength = m_cinematicCamera.LastOrDefault().timeStamp; } } }
public TempSummon SummonPassenger(uint entry, Position pos, TempSummonType summonType, SummonPropertiesRecord properties = null, uint duration = 0, Unit summoner = null, uint spellId = 0, uint vehId = 0) { Map map = GetMap(); if (map == null) { return(null); } UnitTypeMask mask = UnitTypeMask.Summon; if (properties != null) { switch (properties.Control) { case SummonCategory.Pet: mask = UnitTypeMask.Guardian; break; case SummonCategory.Puppet: mask = UnitTypeMask.Puppet; break; case SummonCategory.Vehicle: mask = UnitTypeMask.Minion; break; case SummonCategory.Wild: case SummonCategory.Ally: case SummonCategory.Unk: { switch (properties.Title) { case SummonType.Minion: case SummonType.Guardian: case SummonType.Guardian2: mask = UnitTypeMask.Guardian; break; case SummonType.Totem: case SummonType.LightWell: mask = UnitTypeMask.Totem; break; case SummonType.Vehicle: case SummonType.Vehicle2: mask = UnitTypeMask.Summon; break; case SummonType.Minipet: mask = UnitTypeMask.Minion; break; default: if (properties.Flags.HasAnyFlag(SummonPropFlags.Unk10)) // Mirror Image, Summon Gargoyle { mask = UnitTypeMask.Guardian; } break; } break; } default: return(null); } } TempSummon summon = null; switch (mask) { case UnitTypeMask.Summon: summon = new TempSummon(properties, summoner, false); break; case UnitTypeMask.Guardian: summon = new Guardian(properties, summoner, false); break; case UnitTypeMask.Puppet: summon = new Puppet(properties, summoner); break; case UnitTypeMask.Totem: summon = new Totem(properties, summoner); break; case UnitTypeMask.Minion: summon = new Minion(properties, summoner, false); break; } float x, y, z, o; pos.GetPosition(out x, out y, out z, out o); CalculatePassengerPosition(ref x, ref y, ref z, ref o); if (!summon.Create(map.GenerateLowGuid(HighGuid.Creature), map, entry, x, y, z, o, null, vehId)) { return(null); } PhasingHandler.InheritPhaseShift(summon, summoner ? (WorldObject)summoner : this); summon.SetUInt32Value(UnitFields.CreatedBySpell, spellId); summon.SetTransport(this); summon.m_movementInfo.transport.guid = GetGUID(); summon.m_movementInfo.transport.pos.Relocate(pos); summon.Relocate(x, y, z, o); summon.SetHomePosition(x, y, z, o); summon.SetTransportHomePosition(pos); // @HACK - transport models are not added to map's dynamic LoS calculations // because the current GameObjectModel cannot be moved without recreating summon.AddUnitState(UnitState.IgnorePathfinding); summon.InitStats(duration); if (!map.AddToMap(summon)) { return(null); } _staticPassengers.Add(summon); summon.InitSummon(); summon.SetTempSummonType(summonType); return(summon); }
public ForcedUnsummonDelayEvent(TempSummon owner) { m_owner = owner; }