Esempio n. 1
0
        public override void OnLoad()
        {
            base.OnLoad();

            var brain = new BossBrain(this);

            brain.Abilities = CreatureService.BossSpawnAbilities.Where(x => x.BossSpawnId == this.BossId).ToList();
            AiInterface.SetBrain(brain);

            //AiInterface.SetBrain(new BossBrain(this));
        }
Esempio n. 2
0
        public Pet(ushort petId, Creature_spawn spawn, Player owner, byte aiMode, bool isStationary, bool isCombative) : base(spawn)
        {
            PetId        = petId;
            Owner        = owner;
            IsStationary = isStationary;
            if (!isStationary)
            {
                FollowMode = 2;
            }
            AIMode         = aiMode;
            _ownerUILinked = isCombative;

            if (!isCombative)
            {
                IsInvulnerable = true;
            }

            else
            {
                SpeedMult = 1.2f;
            }

            switch (aiMode)
            {
            case 3: AiInterface.SetBrain(new PassiveBrain(this)); break;

            case 4: AiInterface.SetBrain(new GuardBrain(this)); break;

            case 5: AiInterface.SetBrain(new AggressiveBrain(this)); break;
            }
            Realm   = owner.Realm;
            Faction = (byte)(owner.Realm == Realms.REALMS_REALM_DESTRUCTION ? 8 : 6);

            Owner.SendStats();

            Health = 1;

            EvtInterface.AddEvent(SendPetInitial, 500, 1);
        }
        public override void OnLoad()
        {
            base.OnLoad();

            AiInterface.SetBrain(new InstanceBossBrain(this));
        }
Esempio n. 4
0
        public override void OnLoad()
        {
            InteractType = Spawn.Proto.InteractType;

            SetFaction(Spawn.Faction != 0 ? Spawn.Faction : Spawn.Proto.Faction);

            ItmInterface.Load(CreatureService.GetCreatureItems(Spawn.Entry));
            if (Spawn.Proto.MinLevel > Spawn.Proto.MaxLevel)
            {
                Spawn.Proto.MinLevel = Spawn.Proto.MaxLevel;
            }

            if (Spawn.Proto.MaxLevel <= Spawn.Proto.MinLevel)
            {
                Spawn.Proto.MaxLevel = Spawn.Proto.MinLevel;
            }

            if (Spawn.Proto.MaxLevel == 0)
            {
                Spawn.Proto.MaxLevel = 1;
            }
            if (Spawn.Proto.MinLevel == 0)
            {
                Spawn.Proto.MinLevel = 1;
            }

            if (Spawn.Level != 0)
            {
                if (Spawn.Level > 2)
                {
                    Level = (byte)StaticRandom.Instance.Next(Spawn.Level - 1, Spawn.Level + 1);
                }
                else
                {
                    Level = (byte)StaticRandom.Instance.Next(Spawn.Level, Spawn.Level + 1);
                }
            }
            else
            {
                Level = (byte)StaticRandom.Instance.Next(Spawn.Proto.MinLevel, Spawn.Proto.MaxLevel + 1);
            }

            SetCreatureStats();

            Health = TotalHealth;

            X = Zone.CalculPin((uint)Spawn.WorldX, true);
            Y = Zone.CalculPin((uint)Spawn.WorldY, false);
            Z = (ushort)Spawn.WorldZ;

            // TODO : Bad Height Formula

            /*int HeightMap = HeightMapMgr.GetHeight(Zone.ZoneId, X, Y);
             * if (Z < HeightMap)
             * {
             *  Log.Error("Creature", "["+Spawn.Entry+"] Invalid Height : Min=" + HeightMap + ",Z=" + Z);
             *  return;
             * }*/

            Heading         = (ushort)Spawn.WorldO;
            WorldPosition.X = Spawn.WorldX;
            WorldPosition.Y = Spawn.WorldY;
            WorldPosition.Z = Spawn.WorldZ;

            SetOffset((ushort)(Spawn.WorldX >> 12), (ushort)(Spawn.WorldY >> 12));
            ScrInterface.AddScript(Spawn.Proto.ScriptName);

            SaveSpawnData();
            LoadInterfaces();

            AiInterface.SetBrain(new DummyBrain(this));

            States.Add(0x12);
            States.Add((byte)CreatureState.UnkOmnipresent);

            Speed = 350;
            StsInterface.Speed = 350;
            MvtInterface.SetBaseSpeed(Speed);
            MvtInterface.FollowReacquisitionInterval = 100;

            IsActive = true;
        }