Пример #1
0
 public Minion(SummonPropertiesRecord properties, Unit owner, bool isWorldObject)
     : base(properties, owner, isWorldObject)
 {
     m_owner = owner;
     Contract.Assert(m_owner);
     m_unitTypeMask |= UnitTypeMask.Minion;
     m_followAngle   = SharedConst.PetFollowAngle;
 }
Пример #2
0
        public TempSummon(SummonPropertiesRecord properties, Unit owner, bool isWorldObject) : base(isWorldObject)
        {
            m_Properties = properties;
            m_type       = TempSummonType.ManualDespawn;

            m_summonerGUID = owner != null?owner.GetGUID() : ObjectGuid.Empty;

            UnitTypeMask |= UnitTypeMask.Summon;
        }
Пример #3
0
 public Minion(SummonPropertiesRecord properties, Unit owner, bool isWorldObject)
     : base(properties, owner, isWorldObject)
 {
     m_owner = owner;
     Cypher.Assert(m_owner);
     UnitTypeMask |= UnitTypeMask.Minion;
     m_followAngle = SharedConst.PetFollowAngle;
     /// @todo: Find correct way
     InitCharmInfo();
 }
Пример #4
0
        public Guardian(SummonPropertiesRecord properties, Unit owner, bool isWorldObject)
            : base(properties, owner, isWorldObject)
        {
            m_bonusSpellDamage = 0;

            UnitTypeMask |= UnitTypeMask.Guardian;
            if (properties != null && (properties.Title == SummonTitle.Pet || properties.Control == SummonCategory.Pet))
            {
                UnitTypeMask |= UnitTypeMask.ControlableGuardian;
                InitCharmInfo();
            }
        }
Пример #5
0
        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);
        }
Пример #6
0
 public Totem(SummonPropertiesRecord properties, Unit owner) : base(properties, owner, false)
 {
     UnitTypeMask |= UnitTypeMask.Totem;
     m_type        = TotemType.Passive;
 }
Пример #7
0
 public Puppet(SummonPropertiesRecord properties, Unit owner) : base(properties, owner, false)
 {
     Cypher.Assert(owner.IsTypeId(TypeId.Player));
     UnitTypeMask |= UnitTypeMask.Puppet;
 }