public override void SpawnAdds(object crea)
        {
            var Params = (List <object>)crea;

            int        Entry = (int)Params[0];
            int        X     = (int)Params[1];
            int        Y     = (int)Params[2];
            int        Z     = (int)Params[3];
            ushort     O     = (ushort)Params[4];
            GameObject go    = Obj as GameObject;

            if (go != null && !go.IsDead)
            {
                Creature_proto Proto = CreatureService.GetCreatureProto((uint)Entry);

                Creature_spawn Spawn = new Creature_spawn();
                Spawn.Guid = (uint)CreatureService.GenerateCreatureSpawnGUID();
                Spawn.BuildFromProto(Proto);
                Spawn.WorldO = (int)O;
                Spawn.WorldX = X;
                Spawn.WorldY = Y;
                Spawn.WorldZ = Z;
                Spawn.ZoneId = (ushort)Obj.ZoneId;
                //Spawn.Level = 40;
                Creature c = Obj.Region.CreateCreature(Spawn);
                c.EvtInterface.AddEventNotify(EventName.OnDie, RemoveAdds); // We are removing spawns from server when adds die
                addList.Add(c);                                             // Adding adds to the list for easy removal

                go.EvtInterface.AddEvent(SpawnAdds, 15000, 1, Params);
            }
            else
            {
                go.EvtInterface.RemoveEvent(SpawnAdds);
            }
        }
Esempio n. 2
0
        public void SpawnGuard(int team)
        {
            if (Creature != null)
            {
                Creature.Destroy();
            }
            this.team = team;

            Creature_proto Proto = CreatureService.GetCreatureProto(team == 1 ? OrderId : DestroId);

            if (Proto == null)
            {
                Log.Error("FlagGuard", "No FlagGuard Proto");
                return;
            }

            Creature_spawn Spawn = new Creature_spawn();

            Spawn.BuildFromProto(Proto);
            Spawn.WorldO         = o;
            Spawn.WorldY         = y;
            Spawn.WorldZ         = z;
            Spawn.WorldX         = x;
            Spawn.ZoneId         = ZoneId;
            Spawn.RespawnMinutes = 3;

            Creature = new GuardCreature(Spawn, this);
            Region.AddObject(Creature, Spawn.ZoneId);
        }
Esempio n. 3
0
        static public bool NpcSpawn(Player Plr, ref List <string> Values)
        {
            int Entry = GetInt(ref Values);

            Creature_proto Proto = WorldMgr.GetCreatureProto((uint)Entry);

            if (Proto == null)
            {
                Plr.SendMessage(0, "Server", "Invalid npc entry(" + Entry + ")", SystemData.ChatLogFilters.CHATLOGFILTERS_SHOUT);
                return(false);
            }

            Plr.CalcWorldPositions();

            Creature_spawn Spawn = new Creature_spawn();

            Spawn.Guid = (uint)WorldMgr.GenerateSpawnGUID();
            Spawn.BuildFromProto(Proto);
            Spawn.WorldO = Plr._Value.WorldO;
            Spawn.WorldY = Plr._Value.WorldY;
            Spawn.WorldZ = Plr._Value.WorldZ;
            Spawn.WorldX = Plr._Value.WorldX;
            Spawn.ZoneId = Plr.Zone.ZoneId;

            WorldMgr.Database.AddObject(Spawn);

            Plr.Region.CreateCreature(Spawn);

            return(true);
        }
Esempio n. 4
0
        public override void OnDie(Object Obj)
        {
            // Spawn the bad npc
            Creature_proto Proto = CreatureService.GetCreatureProto((uint)135);

            if (Proto == null)
            {
                return;
            }

            Obj.UpdateWorldPosition();

            Creature_spawn Spawn = new Creature_spawn();

            Spawn.Guid = (uint)CreatureService.GenerateCreatureSpawnGUID();
            Spawn.BuildFromProto(Proto);
            Spawn.WorldO  = Obj.Heading;
            Spawn.WorldY  = Obj.WorldPosition.Y;
            Spawn.WorldZ  = Obj.WorldPosition.Z;
            Spawn.WorldX  = Obj.WorldPosition.X;
            Spawn.ZoneId  = Obj.Zone.ZoneId;
            Spawn.Faction = 72;
            Spawn.Emote   = 53;

            Creature c = Obj.Region.CreateCreature(Spawn);

            //  The villager will be disposed in 20 secs
            c.EvtInterface.AddEvent(c.Destroy, 20000, 1);
        }
Esempio n. 5
0
        public void Reset()
        {
            foreach (PQuest_Spawn Spawn in Objective.Spawns)
            {
                //Log.Info("Creature", "npc = " + Name + "  Oid = " + Oid + "  X= " + Spawn.WorldX + "  Y= " + Spawn.WorldY + "  Z= " + Spawn.WorldZ);

                Log.Success("SENDING Spawn.Type", "STARTING Spawn.Type ");


                if (Spawn.Type == 1)
                {
                    Creature_proto Proto = WorldMgr.GetCreatureProto(Spawn.Entry);
                    if (Proto == null)
                    {
                        Log.Error("PQCreatue", "No Proto");
                        return;
                    }

                    Creature_spawn S = new Creature_spawn();

                    S.Guid = (uint)WorldMgr.GenerateCreatureSpawnGUID();
                    S.BuildFromProto(Proto);
                    S.WorldO = Spawn.WorldO;
                    S.WorldY = Spawn.WorldY;
                    S.WorldZ = Spawn.WorldZ;
                    S.WorldX = Spawn.WorldX;
                    S.ZoneId = Spawn.ZoneId;
                    S.Bytes  = "";

                    PQuestCreature NewCreature = new PQuestCreature(S, this);
                    this.ActiveCreatures.Add(NewCreature);
                    Quest.Region.AddObject((Object)NewCreature, Spawn.ZoneId);
                }
            }
        }
Esempio n. 6
0
        public virtual void SpawnAdds(object crea)
        {
            var Params = (List <object>)crea;

            int    Entry = (int)Params[0];
            int    X     = (int)Params[1];
            int    Y     = (int)Params[2];
            int    Z     = (int)Params[3];
            ushort O     = (ushort)Params[4];

            Creature_proto Proto = CreatureService.GetCreatureProto((uint)Entry);

            Creature_spawn Spawn = new Creature_spawn();

            Spawn.Guid = (uint)CreatureService.GenerateCreatureSpawnGUID();
            Spawn.BuildFromProto(Proto);
            Spawn.WorldO = (int)O;
            Spawn.WorldX = X;
            Spawn.WorldY = Y;
            Spawn.WorldZ = Z;
            Spawn.ZoneId = (ushort)Obj.ZoneId;
            Spawn.Level  = 3;
            Creature c = Obj.Region.CreateCreature(Spawn);

            c.EvtInterface.AddEventNotify(EventName.OnDie, RemoveAdds); // We are removing spawns from server when adds die
            addList.Add(c);                                             // Adding adds to the list for easy removal
        }
Esempio n. 7
0
        public override void SpawnAdds(object crea)
        {
            var Params = (List <object>)crea;

            int        Entry = (int)Params[0];
            int        X     = (int)Params[1];
            int        Y     = (int)Params[2];
            int        Z     = (int)Params[3];
            ushort     O     = (ushort)Params[4];
            GameObject go    = Obj as GameObject;

            if (go != null && !go.IsDead)
            {
                Creature_proto Proto = CreatureService.GetCreatureProto((uint)Entry);

                Creature_spawn Spawn = new Creature_spawn();
                Spawn.Guid = (uint)CreatureService.GenerateCreatureSpawnGUID();
                Spawn.BuildFromProto(Proto);
                Spawn.WorldO = (int)O;
                Spawn.WorldX = X;
                Spawn.WorldY = Y;
                Spawn.WorldZ = Z;
                Spawn.ZoneId = (ushort)Obj.ZoneId;

                int count = 0;

                foreach (Player player in Obj.PlayersInRange)
                {
                    if (player.Realm == GameData.Realms.REALMS_REALM_ORDER)
                    {
                        count++;
                    }
                    else
                    {
                        count--;
                    }
                }

                if (count > 0)
                {
                    Spawn.Faction = 131;
                }
                else
                {
                    Spawn.Faction = 67;
                }

                //Spawn.Level = 40;
                Creature c = Obj.Region.CreateCreature(Spawn);
                c.EvtInterface.AddEventNotify(EventName.OnDie, RemoveAdds); // We are removing spawns from server when adds die
                addList.Add(c);                                             // Adding adds to the list for easy removal

                go.EvtInterface.AddEvent(SpawnAdds, 20 * 1000, 1, Params);
            }
            else
            {
                go.EvtInterface.RemoveEvent(SpawnAdds);
            }
        }
        public void SpawnGuard(Realms realm)
        {
            if (Creature != null)
            {
                Creature.Destroy();
                Creature = null;

                /*if (Info.KeepLord)
                 *  Log.Info(Keep.Info.Name, (Keep.Realm == Realms.REALMS_REALM_ORDER ? "Order" : "Destruction") + " keep lord disposed.");*/
            }

            if (realm != Realms.REALMS_REALM_NEUTRAL)
            {
                Creature_proto proto = CreatureService.GetCreatureProto(realm == Realms.REALMS_REALM_ORDER ? Info.OrderId : Info.DestroId);
                if (proto == null)
                {
                    Log.Error("KeepNPC", "No FlagGuard Proto");
                    return;
                }

                Creature_spawn spawn = new Creature_spawn();
                spawn.BuildFromProto(proto);
                spawn.WorldO = Info.O;

                /*
                 * if (proto.CreatureType == 32 && Info.Y < 70000)
                 * {
                 *  WorldMgr.Database.DeleteObject(Info);
                 *  Keep_Creature newInfo = new Keep_Creature
                 *  {
                 *      KeepId = Info.KeepId,
                 *      ZoneId = Info.ZoneId,
                 *      OrderId = Info.OrderId,
                 *      DestroId = Info.DestroId,
                 *      X = Info.X,
                 *      Y = ZoneMgr.CalculWorldPosition(WorldMgr.GetZone_Info(Info.ZoneId), 0, (ushort) Info.Y, 0).Y,
                 *      Z = Info.Z,
                 *      O = Info.O
                 *  };
                 *  WorldMgr.Database.AddObject(newInfo);
                 *
                 *  Info = newInfo;
                 * }*/
                spawn.WorldY = Info.Y;
                spawn.WorldZ = Info.Z;
                spawn.WorldX = Info.X;
                spawn.ZoneId = Info.ZoneId;

                Creature = new KeepCreature(spawn, this, Keep);

                /*if (Info.KeepLord)
                 *  Log.Info(Keep.Info.Name, (Keep.Realm == Realms.REALMS_REALM_ORDER ? "Order" : "Destruction") + " keep lord spawned.");*/
                Region.AddObject(Creature, spawn.ZoneId);
            }
        }
Esempio n. 9
0
        /// <summary>
        /// Spawn an npc
        /// </summary>
        /// <param name="plr">Player that initiated the command</param>
        /// <param name="values">List of command arguments (after command name)</param>
        /// <returns>True if command was correctly handled, false if operation was canceled</returns>
        public static bool NpcSpawn(Player plr, ref List <string> values)
        {
            int entry = GetInt(ref values);

            Creature_proto proto = CreatureService.GetCreatureProto((uint)entry);

            if (proto == null)
            {
                proto = WorldMgr.Database.SelectObject <Creature_proto>("Entry=" + entry);

                if (proto != null)
                {
                    plr.SendClientMessage("NPC SPAWN: Npc Entry is valid but npc stats are empty. No sniff data about this npc");
                }
                else
                {
                    plr.SendClientMessage("NPC SPAWN:  Invalid npc entry(" + entry + ")");
                }

                return(false);
            }

            plr.UpdateWorldPosition();

            Creature_spawn spawn = new Creature_spawn();

            spawn.Guid = (uint)CreatureService.GenerateCreatureSpawnGUID();
            spawn.BuildFromProto(proto);
            spawn.WorldO  = plr._Value.WorldO;
            spawn.WorldY  = plr._Value.WorldY;
            spawn.WorldZ  = plr._Value.WorldZ;
            spawn.WorldX  = plr._Value.WorldX;
            spawn.ZoneId  = plr.Zone.ZoneId;
            spawn.Enabled = 1;

            WorldMgr.Database.AddObject(spawn);

            var c = plr.Region.CreateCreature(spawn);

            c.AiInterface.SetBrain(new PassiveBrain(c));


            GMCommandLog log = new GMCommandLog();

            log.PlayerName = plr.Name;
            log.AccountId  = (uint)plr.Client._Account.AccountId;
            log.Command    = "SPAWN CREATURE " + spawn.Entry + " " + spawn.Guid + " AT " + spawn.ZoneId + " " + plr._Value.WorldX + " " + plr._Value.WorldY;
            log.Date       = DateTime.Now;
            CharMgr.Database.AddObject(log);

            return(true);
        }
Esempio n. 10
0
        public override void OnDie(Object Obj)
        {
            // Respawn the orginal npc
            Creature_proto Proto = CreatureService.GetCreatureProto((uint)32);

            if (Proto == null)
            {
                return;
            }

            Obj.UpdateWorldPosition();

            Creature_spawn Spawn = new Creature_spawn();

            Spawn.Guid   = (uint)CreatureService.GenerateCreatureSpawnGUID();
            Proto.Model1 = Obj.GetCreature().Spawn.Proto.Model1;
            Spawn.BuildFromProto(Proto);
            Spawn.WorldO = O;
            Spawn.WorldY = Y;
            Spawn.WorldZ = Z;
            Spawn.WorldX = X;
            Spawn.ZoneId = Obj.Zone.ZoneId;
            //Spawn.Faction = 65;

            Creature c = Obj.Region.CreateCreature(Spawn);

            //  Set the new NPC to dead, there should be a method to do this perhaps.
            c.Health = 0;

            c.States.Add(3); // Death State

            PacketOut Out = new PacketOut((byte)Opcodes.F_OBJECT_DEATH);

            Out.WriteUInt16(c.Oid);
            Out.WriteByte(1);
            Out.WriteByte(0);
            Out.WriteUInt16(0);
            Out.Fill(0, 6);
            c.DispatchPacket(Out, true);

            //  Make it respawn
            //var prms = new List<object>() { c };

            //c.EvtInterface.AddEvent(TeleportToSpawnPlace, 29000 + c.Level * 1000, 1, prms);
            c.EvtInterface.AddEvent(c.RezUnit, 30000 + c.Level * 1000, 1); // 30 seconde Rez

            // Remove the old npc
            Obj.Destroy();

            return;
        }
Esempio n. 11
0
        private void SpawnPet(Creature_proto proto)
        {
            Creature_spawn spawn = new Creature_spawn();

            proto.MinScale = 50;
            proto.MaxScale = 50;
            spawn.BuildFromProto(proto);
            spawn.WorldO         = myPlayer._Value.WorldO;
            spawn.WorldY         = myPlayer._Value.WorldY;
            spawn.WorldZ         = myPlayer._Value.WorldZ;
            spawn.WorldX         = myPlayer._Value.WorldX;
            spawn.ZoneId         = myPlayer.Zone.ZoneId;
            spawn.Icone          = 18;
            spawn.WaypointType   = 0;
            spawn.Proto.MinLevel = spawn.Proto.MaxLevel = myPlayer.EffectiveLevel;

            if (spawn.Proto.MinLevel > 40)
            {
                spawn.Proto.MinLevel = 40;
                spawn.Proto.MaxLevel = 40;
            }

            myPet = new Pet(0, spawn, myPlayer, AIMode, true, true);
            myPet.StsInterface.Speed = 0;
            if (_boostStacks > 0)
            {
                switch (_careerResource)
                {
                case 1:
                    // Pet range increase
                    myPet.StsInterface.AddBonusMultiplier(Stats.Range, _rangeBonusPct1 * 0.01f * _boostStacks, BuffClass.Tactic);
                    break;

                case 2:
                    // Pet range increase
                    myPet.StsInterface.AddBonusMultiplier(Stats.Range, _rangeBonusPct2Pet * 0.01f * _boostStacks, BuffClass.Tactic);
                    break;

                case 3:
                    // Pet dodge/disrupt increase
                    myPet?.StsInterface.AddBonusStat(Stats.Evade, (ushort)(_dodgeDisruptBonusPet * _boostStacks), BuffClass.Tactic);
                    myPet?.StsInterface.AddBonusStat(Stats.Disrupt, (ushort)(_dodgeDisruptBonusPet * _boostStacks), BuffClass.Tactic);
                    break;
                }
            }
            myPet.UpdateSpeed();
            myPlayer.Region.AddObject(myPet, spawn.ZoneId);

            myPlayer.BuffInterface.NotifyPetEvent(myPet);
        }
Esempio n. 12
0
        public void SpawnBaddies()
        {
            Creature_proto Proto = CreatureService.GetCreatureProto((uint)43);

            if (Proto == null)
            {
                return;
            }

            if (Quote == 0)
            {
                Obj.Say("Hold your ground, hold your ground! ", SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_SAY);
            }
            else if (Quote == 1)
            {
                Obj.Say("I see in your eyes the same fear that would take the heart of me.", SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_SAY);
            }
            else if (Quote == 2)
            {
                Obj.Say("A day may come when the courage of men fails, when we forsake our friends and break all bonds of fellowship, but it is not this day.", SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_SAY);
            }
            else if (Quote == 3)
            {
                Obj.Say("An hour of wolves and shattered shields, when the age of men comes crashing down!", SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_SAY);
            }
            else if (Quote == 4)
            {
                Obj.Say("But it is not this day! This day we fight!", SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_SAY);
            }

            Quote++;

            Random rand = new Random();

            for (int i = 0; i < 3; i++)
            {
                Creature_spawn Spawn = new Creature_spawn();
                Spawn.Guid = (uint)CreatureService.GenerateCreatureSpawnGUID();
                Spawn.BuildFromProto(Proto);
                Spawn.WorldO = Obj.Heading;
                Spawn.WorldX = (int)(Obj.WorldPosition.X + 150 - 300 * rand.NextDouble());
                Spawn.WorldY = (int)(Obj.WorldPosition.Y + 150 - 300 * rand.NextDouble());
                Spawn.WorldZ = Obj.WorldPosition.Z;
                Spawn.ZoneId = Obj.Zone.ZoneId;
                Creature c = Obj.Region.CreateCreature(Spawn);
                //c.GetCreature().MvtInterface.WalkTo(Obj.WorldPosition.X, Obj.WorldPosition.Y, Obj.WorldPosition.Z, MovementInterface.CREATURE_SPEED);
                c.EvtInterface.AddEvent(c.Destroy, 20000, 1);
            }
        }
Esempio n. 13
0
        public virtual void SpawnAdds(List <List <object> > listOfSpawnAdds)
        {
            List <object> Params = GetRandomSpawnParams(listOfSpawnAdds);

            List <uint> Entries = (List <uint>)Params[0];
            int         X       = (int)Params[1];
            int         Y       = (int)Params[2];
            int         Z       = (int)Params[3];
            ushort      O       = Convert.ToUInt16(Params[4]);

            foreach (var entry in Entries)
            {
                Creature_proto Proto = CreatureService.GetCreatureProto(entry);

                Creature_spawn Spawn = new Creature_spawn
                {
                    Guid = (uint)CreatureService.GenerateCreatureSpawnGUID()
                };
                Spawn.BuildFromProto(Proto);
                Spawn.WorldO = O;
                Spawn.WorldX = X + ShuffleWorldCoordinateOffset(20, 100);
                Spawn.WorldY = Y + ShuffleWorldCoordinateOffset(20, 100);
                Spawn.WorldZ = Z;
                Spawn.ZoneId = (ushort)ZoneId;

                Creature c = Region.CreateCreature(Spawn);
                //c.SetZone(Region.GetZoneMgr((ushort)ZoneId));
                c.EvtInterface.AddEventNotify(EventName.OnDie, RemoveAdds); // We are removing spawns from server when adds die
                c.PlayersInRange = PlayersInRange;

                // brain distribution
                switch (entry)
                {
                //case 6861: // healerbrain for shamans
                //    c.AiInterface.SetBrain(new SimpleLVHealerBrain(c));
                //    //GoToMommy(c);
                //    SetRandomTarget(c);
                //    break;

                default:
                    SetRandomTarget(c);
                    break;
                }

                AddList.Add(c); // Adding adds to the list for easy removal
            }
        }
Esempio n. 14
0
        private void Spawn(BossSpawn entry)
        {
            ushort facing = 2093;

            var X = Owner.WorldPosition.X;
            var Y = Owner.WorldPosition.Y;
            var Z = Owner.WorldPosition.Z;


            var spawn = new Creature_spawn {
                Guid = (uint)CreatureService.GenerateCreatureSpawnGUID()
            };
            var proto = CreatureService.GetCreatureProto(entry.ProtoId);

            if (proto == null)
            {
                return;
            }
            spawn.BuildFromProto(proto);

            spawn.WorldO = facing;
            spawn.WorldX = X + StaticRandom.Instance.Next(500);
            spawn.WorldY = Y + StaticRandom.Instance.Next(500);
            spawn.WorldZ = Z;
            spawn.ZoneId = (ushort)Owner.ZoneId;


            var creature = Owner.Region.CreateCreature(spawn);

            creature.EvtInterface.AddEventNotify(EventName.OnDie, RemoveNPC);
            entry.Creature = creature;
            (Owner as Boss).SpawnDictionary.Add(entry);

            if (entry.Type == BrainType.AggressiveBrain)
            {
                creature.AiInterface.SetBrain(new AggressiveBrain(creature));
            }
            if (entry.Type == BrainType.HealerBrain)
            {
                creature.AiInterface.SetBrain(new HealerBrain(creature));
            }
            if (entry.Type == BrainType.PassiveBrain)
            {
                creature.AiInterface.SetBrain(new PassiveBrain(creature));
            }
        }
Esempio n. 15
0
        public Creature CreateCreature(uint Entry, ushort ZoneId, ushort Px, ushort Py, ushort Pz)
        {
            Creature_proto Proto = WorldMgr.GetCreatureProto((uint)Entry);

            if (Proto == null)
            {
                return(null);
            }

            Creature_spawn Spawn = new Creature_spawn();

            Spawn.Guid = (uint)WorldMgr.GenerateCreatureSpawnGUID();
            Spawn.BuildFromProto(Proto);
            Spawn.ZoneId = ZoneId;
            ZoneMgr.CalculWorldPosition(ZoneId, Px, Py, Pz, ref Spawn._WorldO, ref Spawn._WorldY, ref Spawn._WorldZ);
            return(CreateCreature(Spawn));
        }
Esempio n. 16
0
        public void SpawnGuard(Realms realm)
        {
            if (Creature != null)
            {
                Creature.Destroy();
                Creature = null;
            }

            if (realm != Realms.REALMS_REALM_NEUTRAL)
            {
                if (Info.DestroId == 0 && realm == Realms.REALMS_REALM_DESTRUCTION)
                {
                    _logger.Trace($"Creature Id = 0, no spawning");
                }
                else
                {
                    Creature_proto proto = CreatureService.GetCreatureProto(realm == Realms.REALMS_REALM_ORDER ? Info.OrderId : Info.DestroId);

                    if (proto == null)
                    {
                        Log.Error("KeepNPC", "No FlagGuard Proto");
                        return;
                    }
                    _logger.Trace($"Spawning Guard {proto.Name} ({proto.Entry})");

                    Creature_spawn spawn = new Creature_spawn();
                    spawn.BuildFromProto(proto);
                    spawn.WorldO = Info.O;
                    spawn.WorldX = Info.X;
                    spawn.WorldY = Info.Y;
                    spawn.WorldZ = Info.Z;
                    spawn.ZoneId = Info.ZoneId;

                    Creature = new KeepCreature(spawn, this, Keep);
                    Creature.WaypointGUID = Convert.ToUInt32(Info.WaypointGUID);
                    if (Info.WaypointGUID > 0)
                    {
                        Creature.AiInterface.Waypoints = WaypointService.GetKeepNpcWaypoints(Info.WaypointGUID);
                    }


                    Region.AddObject(Creature, spawn.ZoneId);
                }
            }
        }
Esempio n. 17
0
        public static Siege SpawnSiegeWeapon(Player plr, ushort zoneId, uint entry, bool defender)
        {
            Creature_proto proto = CreatureService.GetCreatureProto(entry);

            Creature_spawn spawn = null;

            spawn = new Creature_spawn
            {
                Guid   = (uint)CreatureService.GenerateCreatureSpawnGUID(),
                WorldO = plr.Heading,
                WorldY = plr.WorldPosition.Y,
                WorldZ = plr.Z,
                WorldX = plr.WorldPosition.X,
                ZoneId = zoneId,
                Level  = 40
            };

            spawn.BuildFromProto(proto);

            return(new Siege(spawn, plr, GetSiegeType(entry).Value));
        }
Esempio n. 18
0
        public override void OnInteract(Object Obj, Player Target, InteractMenu Menu)
        {
            // Make sure the player has the quest and hasn't already finished the objectives.
            if (!Target.GetPlayer().QtsInterface.HasQuest(30003) || Target.GetPlayer().QtsInterface.HasFinishQuest(30003))
            {
                return;
            }

            // Spawn the bad npc
            Creature_proto Proto = CreatureService.GetCreatureProto((uint)31);

            if (Proto == null)
            {
                return;
            }

            Obj.UpdateWorldPosition();

            Creature_spawn Spawn = new Creature_spawn();

            Spawn.Guid   = (uint)CreatureService.GenerateCreatureSpawnGUID();
            Proto.Model1 = Obj.GetCreature().Spawn.Proto.Model1;
            Proto.Model2 = Obj.GetCreature().Spawn.Proto.Model2;
            Spawn.BuildFromProto(Proto);
            Spawn.WorldO  = Obj.Heading;
            Spawn.WorldY  = Obj.WorldPosition.Y;
            Spawn.WorldZ  = Obj.WorldPosition.Z;
            Spawn.WorldX  = Obj.WorldPosition.X;
            Spawn.ZoneId  = Obj.Zone.ZoneId;
            Spawn.Faction = 129;

            Creature c = Obj.Region.CreateCreature(Spawn);

            c.EvtInterface.AddEventNotify(EventName.OnDie, RemoveAdds);

            // Remove the old npc
            Obj.Destroy();

            return;
        }
        public void SpawnMaggots()
        {
            //Creature_proto Proto = CreatureService.GetCreatureProto((uint)38236);
            Creature_proto Proto = CreatureService.GetCreatureProto((uint)1002074);

            Random rand = new Random();

            for (int i = 0; i < 6; i++)
            {
                Creature_spawn Spawn = new Creature_spawn();
                Spawn.Guid = (uint)CreatureService.GenerateCreatureSpawnGUID();
                Spawn.BuildFromProto(Proto);
                Spawn.WorldO = Obj.Heading;
                Spawn.WorldX = (int)(137065 + 150 - 300 * rand.NextDouble());
                Spawn.WorldY = (int)(524884 + 150 - 300 * rand.NextDouble());
                Spawn.WorldZ = 11103;
                Spawn.ZoneId = 169;
                Spawn.Level  = 1;
                Creature c = Obj.Region.CreateCreature(Spawn);
                c.EvtInterface.AddEventNotify(EventName.OnDie, RemoveAdds);
                addList.Add(c);
            }
        }
        public void SpawnNurglings() // Spawning nurgling adds
        {
            //Creature_proto Proto = CreatureService.GetCreatureProto((uint)6409);
            Creature_proto Proto = CreatureService.GetCreatureProto((uint)1002073);

            Random rand = new Random();

            for (int i = 0; i < 6; i++) // We want 6 nurglings
            {
                Creature_spawn Spawn = new Creature_spawn();
                Spawn.Guid = (uint)CreatureService.GenerateCreatureSpawnGUID();
                Spawn.BuildFromProto(Proto);
                Spawn.WorldO = Obj.Heading;
                Spawn.WorldX = (int)(137065 + 150 - 300 * rand.NextDouble());
                Spawn.WorldY = (int)(524884 + 150 - 300 * rand.NextDouble());
                Spawn.WorldZ = 11103;
                Spawn.ZoneId = 169;
                Spawn.Level  = 1;
                Creature c = Obj.Region.CreateCreature(Spawn);
                c.EvtInterface.AddEventNotify(EventName.OnDie, RemoveAdds); // We are removing spawns from server when adds die
                addList.Add(c);                                             // Adding adds to the list for easy removal
            }
        }
Esempio n. 21
0
        private void LoadSpawns()
        {
            InstanceService._InstanceSpawns.TryGetValue(ZoneID, out List <Instance_Spawn> Obj);

            List <uint> deadbossIds = new List <uint>();

            if (Lockout != null)
            {
                for (int i = 0; i < Lockout.Bosseskilled.Split(';').Count(); i++)
                {
                    deadbossIds.Add(uint.Parse(Lockout.Bosseskilled.Split(';')[i].Split(':')[1]));
                }
            }

            if (Obj == null)
            {
                return;
            }

            foreach (var obj in Obj)
            {
                if (deadbossIds.Contains(obj.ConnectedbossId))
                {
                    continue;
                }

                if (obj.Realm == 0 || obj.Realm == Realm)
                {
                    Creature_spawn spawn = new Creature_spawn
                    {
                        Guid = (uint)CreatureService.GenerateCreatureSpawnGUID()
                    };
                    spawn.BuildFromProto(CreatureService.GetCreatureProto(obj.Entry));
                    if (spawn.Proto == null)
                    {
                        Log.Error("Creature Proto not found", " " + obj.Entry);
                        continue;
                    }

                    spawn.WorldO  = (int)obj.WorldO;
                    spawn.WorldY  = obj.WorldY;
                    spawn.WorldZ  = obj.WorldZ;
                    spawn.WorldX  = obj.WorldX;
                    spawn.ZoneId  = obj.ZoneID;
                    spawn.Enabled = 1;

                    InstanceSpawn IS = new InstanceSpawn(spawn, obj.ConnectedbossId, this);

                    if (obj.SpawnGroupID > 0)
                    {
                        _Spawns.TryGetValue(obj.SpawnGroupID, out List <InstanceSpawn> spawns);
                        if (spawns == null)
                        {
                            spawns = new List <InstanceSpawn>();
                        }
                        spawns.Add(IS);
                        _Spawns[obj.SpawnGroupID] = spawns;
                    }
                    Region.AddObject(IS, obj.ZoneID);
                }
            }
        }
Esempio n. 22
0
        private void LoadBossSpawns()
        {
            List <uint> deadbossIds = new List <uint>();

            if (Lockout != null)
            {
                for (int i = 0; i < Lockout.Bosseskilled.Split(':').Count(); i++)
                {
                    deadbossIds.Add(uint.Parse(Lockout.Bosseskilled.Split(':')[i]));
                }
            }

            InstanceService._InstanceBossSpawns.TryGetValue(Info.Entry, out List <Instance_Boss_Spawn> Obj);

            if (Obj == null)
            {
                return;
            }

            foreach (var obj in Obj)
            {
                if (obj.Realm == 0 || obj.Realm == Realm)
                {
                    if (deadbossIds.Contains(obj.bossId))
                    {
                        continue;
                    }

                    if (obj.ZoneID != ZoneID)
                    {
                        continue;
                    }

                    Creature_spawn spawn = new Creature_spawn
                    {
                        Guid = (uint)CreatureService.GenerateCreatureSpawnGUID()
                    };
                    spawn.BuildFromProto(CreatureService.GetCreatureProto(obj.Entry));
                    spawn.WorldO  = (int)obj.WorldO;
                    spawn.WorldY  = obj.WorldY;
                    spawn.WorldZ  = obj.WorldZ;
                    spawn.WorldX  = obj.WorldX;
                    spawn.ZoneId  = obj.ZoneID;
                    spawn.Enabled = 1;

                    InstanceBossSpawn IS = null;

                    switch (obj.Entry)
                    {
                    //zone 50
                    case 97425:
                        IS = new SimpleThananTreeLord(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 97441:
                        IS = new SimpleTheCadaithaineLion(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 97430:
                        IS = new SimpleSpiritofKurnous(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    //zone 63
                    case 38829:
                        IS = new SimpleGlompdaSquigMasta(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    //zone 64
                    case 37967:
                        IS = new SimpleMastaMixa(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    //zone 65
                    case 15102:
                        IS = new SimpleArdtaFeed(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    //zone 66
                    case 42207:
                        IS = new SimpleWightLordSolithex(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    //zone 152
                    case 19409:
                        IS = new SimpleKokritManEater(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    //zone 153
                    case 3650:
                        IS = new SimpleBulbousOne(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 3651:
                        IS = new SimpleProtFangchitter(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 3649:
                        IS = new SimpleVermerFangchitter(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    //zone 154
                    case 2501335:
                        IS = new SimpleGreySeerQuoltik(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 2501338:
                        IS = new SimpleMasterMoulderSkrot(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 2501340:
                        IS = new SimpleBrauk(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    //zone 155
                    case 10256:
                        IS = new SimpleHoarfrost(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 26812:
                        IS = new SimpleSebcrawtheDiscarded(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 26814:
                        IS = new SimpleLorthThunderbelly(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 26815:
                        IS = new SimpleSlorthThunderbelly(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    //zone 156
                    case 25721:
                        IS = new SimpleGhalmarRagehorn(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 33180:
                        IS = new SimpleUzhaktheBetrayer(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 33173:
                        IS = new SimpleVultheBloodchosen(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    //zone 163
                    case 45084:
                        IS = new SimpleTharlgnan(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    //zone 164
                    case 48112:
                        IS = new SimpleLordSlaurith(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    //zone 165
                    case 2000751:
                        IS = new SimpleKaarntheVanquisher(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    //zone 166
                    case 64106:
                        IS = new SimpleSkullLordVarIthrok(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    //zone 169
                    case 33401:
                        IS = new SimpleGoradiantheCreator(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 18762:
                        IS = new SimpleMasterMoulderVitchek(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    //zone 173
                    case 33172:
                        IS = new SimpleSnaptailtheBreeder(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 33182:
                        IS = new SimpleGoremane(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 33181:
                        IS = new SimpleViraxiltheBroken(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    //zone 176
                    case 2500954:
                        IS = new SimpleTheReaper(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 2500953:
                        IS = new SimpleCryptwebQueen(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 2500952:
                        IS = new SimpleSeraphinePaleEye(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 2500951:
                        IS = new SimpleSisterEudocia(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 2500950:
                        IS = new SimpleArchLectorVerrimus(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 2500949:
                        IS = new SimpleArchLectorZakarai(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 2500948:
                        IS = new SimpleTobiastheFallen(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 2500947:
                        IS = new SimpleNecromancerMalcidious(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    //zone 177
                    case 2501325:
                        IS = new SimpleSkivRedwarp(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 2501326:
                        IS = new SimpleWarlockPeenk(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    //zone 179
                    case 93757:
                        IS = new SimpleHandofUalatp(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 93814:
                        IS = new SimpleUsiriansKeeper(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 93834:
                        IS = new SimpleHighPriestHerakh1(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    //case 93834:
                    //  IS = new SimpleHighPriestHerakh2(spawn,  obj.bossId, obj.InstanceID, this);
                    //  break;
                    //case 93834:
                    //    IS = new SimpleHighPriestHerakh3(spawn,  obj.bossId, obj.InstanceID, this);
                    //    break;
                    case 94102:
                        IS = new SimpleAkiltheShrewd(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 94101:
                        IS = new SimpleJahitheIndignant(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 94103:
                        IS = new SimpleTumainitheHopeless(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 94191:
                        IS = new SimpleHierophantEutrata(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 94389:
                        IS = new SimpleKingAmenemhetumtheVultureLord(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    //zone 195
                    case 2000763:
                        IS = new SimpleCuliusEmbervine(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 46995:
                        IS = new SimpleSarlothBloodtouched(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 2000757:
                        IS = new SimpleKorthuktheRaging(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 46205:
                        IS = new SimpleBarakustheGodslayer(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    //zone 196
                    case 52594:
                        IS = new SimpleTheBileLord(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 52462:
                        IS = new SimpleSsrydianMorbidae(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 48128:
                        IS = new SimpleBartholomeustheSickly(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    //zone 241
                    case 2000772:
                        IS = new SimpleTsekaniHeyafa(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    //zone 242
                    case 2000764:
                        IS = new SimpleHapuShebikef(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    //zone 243
                    case 2000767:
                        IS = new SimpleBennuApeht(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    //zone 244
                    case 2000774:
                        IS = new SimpleSaaKhasef(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    //zone 260
                    case 4276:
                        IS = new SimpleTheDeamonicBeast(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 59211:
                        IS = new SimpleAhzranok(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 6821:
                        IS = new SimpleMalghorGreathorn(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 6841:
                        IS = new SimpleHorgulul(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 6843:
                        IS = new SimpleDralel(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 6807:
                        IS = new SimpleChulEarthkeeper(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 6856:
                        IS = new SimpleLargtheDevourer(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 6834:
                        IS = new SimpleButcherGutbeater(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 6850:
                        IS = new SimpleGoraktheAncient(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 6842:
                        IS = new SimpleSarthaintheWorldbearer(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 61601:
                        IS = new SimpleZaarthePainseeker(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    //case 4276:
                    //    IS = new SimpleTheDarkpromiseBeast2(spawn,  obj.bossId, obj.InstanceID, this);
                    //    break;
                    case 61598:
                        IS = new SimpleSechartheDarkpromiseChieftain(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    case 62147:
                        IS = new SimpleNKariKeeperofSecrets(spawn, obj.bossId, obj.InstanceID, this);
                        break;

                    //REMOVED BOSSES
                    //case 2000899:
                    //    IS = new SimpleFulgurThunderborn(spawn,  obj.bossId, obj.InstanceID, this);
                    //    break;

                    //case 2000901:
                    //    IS = new SimpleTonragThunderborn(spawn,  obj.bossId, obj.InstanceID, this);
                    //    break;
                    default:
                        IS = new InstanceBossSpawn(spawn, obj.bossId, obj.InstanceID, this);
                        break;
                    }

                    if (IS == null)
                    {
                        return;
                    }

                    if (obj.SpawnGroupID > 0)
                    {
                        _BossSpawns.TryGetValue(obj.SpawnGroupID, out List <InstanceBossSpawn> spawns);
                        if (spawns == null)
                        {
                            spawns = new List <InstanceBossSpawn>();
                        }
                        spawns.Add(IS);
                        _BossSpawns[obj.SpawnGroupID] = spawns;
                    }
                    Region.AddObject(IS, obj.ZoneID);
                }
            }
        }
        private void LoadBossSpawns()
        {
            List <Instance_Boss_Spawn> Obj;

            List <uint> deadbossids = new List <uint>();

            if (Lockout != null)
            {
                for (int i = 0; i < Lockout.Bosseskilled.Split(';').Count(); i++)
                {
                    deadbossids.Add(UInt16.Parse(Lockout.Bosseskilled.Split(';')[i].Split(':')[1]));
                }
            }


            InstanceService._InstanceBossSpawns.TryGetValue(Info.Entry, out Obj);


            if (Obj == null)
            {
                return;
            }

            foreach (var obj in Obj)
            {
                if (obj.Realm == 0 || obj.Realm == this.Realm)
                {
                    if (deadbossids.Contains(obj.BossID))
                    {
                        continue;
                    }

                    if (obj.ZoneID != ZoneID)
                    {
                        continue;
                    }


                    Creature_spawn spawn = new Creature_spawn();
                    spawn.Guid = (uint)CreatureService.GenerateCreatureSpawnGUID();
                    spawn.BuildFromProto(CreatureService.GetCreatureProto((uint)obj.Entry));
                    spawn.WorldO  = (int)obj.WorldO;
                    spawn.WorldY  = obj.WorldY;
                    spawn.WorldZ  = obj.WorldZ;
                    spawn.WorldX  = obj.WorldX;
                    spawn.ZoneId  = obj.ZoneID;
                    spawn.Enabled = 1;


                    InstanceBossSpawn IS = new InstanceBossSpawn(spawn, obj.SpawnGroupID, obj.BossID, obj.InstanceID, this);

                    if (obj.SpawnGroupID > 0)
                    {
                        List <InstanceBossSpawn> spawns;
                        _BossSpawns.TryGetValue(obj.SpawnGroupID, out spawns);
                        if (spawns == null)
                        {
                            spawns = new List <InstanceBossSpawn>();
                        }
                        spawns.Add(IS);
                        _BossSpawns[obj.SpawnGroupID] = spawns;
                    }
                    Region.AddObject(IS, obj.ZoneID);
                }
            }
        }
        private void SpawnNPCFromGO(Unit killer = null)
        {
            long now = TCPManager.GetTimeStampMS();

            if (now > CreatureSpawnCooldown)
            {
                Random rand = new Random();

                Creature_proto Proto = CreatureService.GetCreatureProto(this.Spawn.Proto.CreatureId);
                for (int i = 0; i < this.Spawn.Proto.CreatureCount; i++) // CreatureCount - how many creatures are spawned
                {
                    Creature_spawn CreSpawn = new Creature_spawn();
                    CreSpawn.Guid = (uint)CreatureService.GenerateCreatureSpawnGUID();
                    CreSpawn.BuildFromProto(Proto);
                    CreSpawn.WorldO = this.Spawn.WorldO;
                    CreSpawn.WorldX = (int)(this.Spawn.WorldX + 50 - 150 * rand.NextDouble());
                    CreSpawn.WorldY = (int)(this.Spawn.WorldY + 50 - 150 * rand.NextDouble());
                    CreSpawn.WorldZ = this.Spawn.WorldZ;
                    CreSpawn.ZoneId = this.Spawn.ZoneId;
                    Creature c = null;
                    if (killer != null && killer is Player)
                    {
                        c = killer.Region.CreateCreature(CreSpawn);
                    }
                    else
                    {
                        c = this.Region.CreateCreature(CreSpawn);
                    }

                    if (this.Spawn.Proto.CreatureCooldownMinutes > 0)
                    {
                        CreatureSpawnCooldown = TCPManager.GetTimeStampMS() + (int)this.Spawn.Proto.CreatureCooldownMinutes * 60000; // Cannot be spawned more often than once per respawn time
                        c.EvtInterface.AddEventNotify(EventName.OnDie, RemoveNPC);
                        c.EvtInterface.AddEvent(c.Destroy, (int)this.Spawn.Proto.CreatureCooldownMinutes * 60000, 1);                // Creature goes away after the respawn time
                        this.EvtInterface.AddEvent(EventSendMeTo, (int)this.Spawn.Proto.CreatureCooldownMinutes * 60000, 1);
                    }
                    else
                    {
                        CreatureSpawnCooldown = TCPManager.GetTimeStampMS() + 120000; // Creature cannot be spawned more than once every 120 second if it is normal NPC
                        c.EvtInterface.AddEventNotify(EventName.OnDie, RemoveNPC);
                        c.EvtInterface.AddEvent(c.Destroy, 120000, 1);                // Creature goes away after 2 minutes
                        this.EvtInterface.AddEvent(EventSendMeTo, 120000, 1);
                    }

                    var prms = new List <object>()
                    {
                        c, Spawn.Proto.CreatureSpawnText
                    };

                    if (!String.IsNullOrEmpty(this.Spawn.Proto.CreatureSpawnText)) // It is possible to allow the GO to say something after the NPCs spawned
                    //if (c != null)
                    {
                        EvtInterface.AddEvent(DelayedSay, 500, 1, prms);
                    }
                    //c.Say(this.Spawn.Proto.CreatureSpawnText, ChatLogFilters.CHATLOGFILTERS_MONSTER_SAY);
                }

                /*if (!String.IsNullOrEmpty(this.Spawn.Proto.CreatureSpawnText)) // It is possible to allow the GO to say something after the NPCs spawned
                 *  this.Say(this.Spawn.Proto.CreatureSpawnText, ChatLogFilters.CHATLOGFILTERS_MONSTER_SAY);*/

                // This check if the GO we clicked is a Door - if it is we don't want to mess with its
                // VFXState because we can break it
                if (this.Spawn.DoorId == 0)
                {
                    this.EvtInterface.AddEvent(EventSendMeTo, 60000, 1);
                    if (this.Spawn.AllowVfxUpdate == 1)
                    {
                        this.VfxState = 1;
                    }
                    foreach (Player plr in PlayersInRange)
                    {
                        this.UpdateVfxState(this.VfxState);
                    }
                }
            }
            else
            {
                this.Say("**You must wait a little longer...**", ChatLogFilters.CHATLOGFILTERS_MONSTER_SAY);
            }
        }
Esempio n. 25
0
        public void Reset()
        {
            if (Objective == null)
            {
                Log.Error("PQuestObjective.Reset", string.Concat(Quest.Name, " has no objective!"));
                return;
            }

            if (Objective.Spawns == null)
            {
                Log.Error("PQuestObjective.Reset", string.Concat(Quest.Name, " - ", Objective.StageName, " has no spawn set"));
                return;
            }

            foreach (PQuest_Spawn spawn in Objective.Spawns)
            {
                if (spawn.Type == 1)
                {
                    Creature_proto proto = CreatureService.GetCreatureProto(spawn.Entry);
                    if (proto == null)
                    {
                        Log.Error("PQCreature", "No Proto");
                        continue;
                    }

                    if (Quest == null)
                    {
                        Log.Error("PQuestObjective", "Missing quest for: " + Objective.Objective);
                        continue;
                    }

                    Creature_spawn S = new Creature_spawn
                    {
                        Guid   = (uint)CreatureService.GenerateCreatureSpawnGUID(),
                        WorldO = spawn.WorldO,
                        WorldY = spawn.WorldY,
                        WorldZ = spawn.WorldZ,
                        WorldX = spawn.WorldX,
                        ZoneId = spawn.ZoneId
                    };
                    S.BuildFromProto(proto);
                    //This sets the emotes for NPCs in PQ
                    S.Emote = spawn.Emote;
                    //This sets NPC level from puest_spawns table, we are not using creature_protos here
                    S.Level = spawn.Level;

                    PQuestCreature newCreature = new PQuestCreature(S, this, Quest);
                    newCreature.PQSpawnId = spawn.pquest_spawns_ID.Replace(" ", "");

                    if (newCreature != null)
                    {
                        lock (ActiveCreatures)
                        {
                            ActiveCreatures.Add(newCreature);
                        }

                        Quest.Region.AddObject(newCreature, spawn.ZoneId);
                    }
                }
                if (spawn.Type == 2)
                {
                    GameObject_proto Proto = GameObjectService.GetGameObjectProto(spawn.Entry);
                    if (Proto == null)
                    {
                        Log.Error("PQGO", "No Proto");
                        return;
                    }

                    GameObject_spawn S = new GameObject_spawn();
                    S.Guid = (uint)GameObjectService.GenerateGameObjectSpawnGUID();
                    S.BuildFromProto(Proto);
                    S.WorldO         = spawn.WorldO;
                    S.WorldY         = spawn.WorldY;
                    S.WorldZ         = spawn.WorldZ;
                    S.WorldX         = spawn.WorldX;
                    S.ZoneId         = spawn.ZoneId;
                    S.SoundId        = spawn.SoundId;
                    S.VfxState       = spawn.VfxState;
                    S.AllowVfxUpdate = spawn.AllowVfxUpdate;
                    S.Unks           = spawn.Unks;
                    S.Unk3           = spawn.Unk3;


                    PQuestGameObject NewGo = new PQuestGameObject(S, this);
                    if (NewGo != null)
                    {
                        lock (ActiveGameObjects)
                        {
                            ActiveGameObjects.Add(NewGo);
                        }
                        Quest.Region.AddObject(NewGo, spawn.ZoneId);
                    }

                    // PQ Sound player - this will play sounds on PQ Stage, need to be setup in DB
                    if (spawn.Entry == 2000489 && Objective.SoundId != 0)
                    {
                        string text = "";

                        var prms = new List <object>()
                        {
                            NewGo, (ushort)Objective.SoundId, text
                        };

                        for (int i = 0; i < Objective.SoundIteration; i++)
                        {
                            NewGo.EvtInterface.AddEvent(PlayPQSound, i * (int)Objective.SoundDelay * 1000 + 500, 1, prms);
                        }
                    }
                }
                if (spawn.Type == 3)
                {
                    return;

#warning this sucks cant get gos by spawn id

                    ActiveInteractableGameObjects.Add(spawn.Entry);
                }
            }
        }
Esempio n. 26
0
        public void SummonPet(ushort myID)
        {
            if (_summoning)
            {
                return;
            }
            try
            {
                _summoning = true; // Happens when pet is automatically reset after zone change
                if (myPet != null)
                {
                    myPet.Destroy();
                    myPet = null;
                }
                if (myPlayer.Zone == null)
                {
                    return;
                }

                ushort model1;
                byte   faction;
                string name;

                if (myPlayer.Realm == GameData.Realms.REALMS_REALM_ORDER)
                {
                    model1  = (ushort)(132 + ((myPlayer.Level - 1) * 0.1f));
                    faction = 65;
                    if (myPlayer.Level < 16)
                    {
                        name = "Lion Cub";
                    }
                    else
                    {
                        name = "War Lion";
                    }
                }
                else
                {
                    Random rand = new Random();
                    switch (rand.Next(1, 4))
                    {
                    case 1:
                        model1  = 1156;
                        faction = 129;
                        name    = "War Manticore";
                        break;

                    case 2:
                        model1  = 1142;
                        faction = 129;
                        name    = "War Scorpion";
                        break;

                    case 3:
                        model1  = 1086;
                        faction = 129;
                        name    = "Vicious Harpy";
                        break;

                    default:
                        model1  = 1272;
                        faction = 129;
                        name    = "Hydra Wyrmling";
                        break;
                    }
                }

                if (myPlayer.Info.PetModel != 0)
                {
                    model1 = myPlayer.Info.PetModel;
                }

                if (!String.IsNullOrEmpty(myPlayer.Info.PetName))
                {
                    myPetName = myPlayer.Info.PetName;
                }

                Creature_proto Proto = new Creature_proto
                {
                    Name    = string.IsNullOrEmpty(myPetName) ? name : myPetName,
                    Ranged  = 0,
                    Faction = faction,
                    Model1  = model1
                };

                Creature_spawn Spawn = new Creature_spawn();
                if (model1 == 1272)
                {
                    Proto.MinScale = 15;
                    Proto.MaxScale = 15;
                }
                else
                {
                    Proto.MinScale = 50;
                    Proto.MaxScale = 50;
                }
                Spawn.BuildFromProto(Proto);
                Spawn.WorldO         = myPlayer._Value.WorldO;
                Spawn.WorldY         = myPlayer._Value.WorldY;
                Spawn.WorldZ         = myPlayer._Value.WorldZ;
                Spawn.WorldX         = myPlayer._Value.WorldX;
                Spawn.ZoneId         = myPlayer.Zone.ZoneId;
                Spawn.Icone          = 18;
                Spawn.WaypointType   = 0;
                Spawn.Proto.MinLevel = Spawn.Proto.MaxLevel = myPlayer.EffectiveLevel;

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

                myPet = new Pet(myID, Spawn, myPlayer, AIMode, false, true);

                myPlayer.Region.AddObject(myPet, Spawn.ZoneId);

                if (_careerResource != 0)
                {
                    //currentHealth = myPet.Health;
                    myPet.BuffInterface.QueueBuff(new BuffQueueInfo(myPlayer, myPlayer.EffectiveLevel, AbilityMgr.GetBuffInfo(_petTrainBuffs[_careerResource - 1], myPlayer, myPet)));
                    //myPet.EvtInterface.AddEvent(SetHealth, 100, 1);
                }

                myPlayer.BuffInterface.NotifyPetEvent(myPet);
            }
            finally
            {
                _summoning = false;
            }
        }
        public void SummonPet(ushort myID)
        {
            if (_summoning)
            {
                return;
            }
            try
            {
                _summoning = true; // Happens when pet is automatically reset after zone change
                if (myPet != null)
                {
                    myPet.ReceiveDamage(myPet, uint.MaxValue);
                    myPet = null;
                }
                if (myPlayer.Zone == null)
                {
                    return;
                }

                _currentPetID = myID;

                Creature_proto Proto = new Creature_proto {
                    Faction = 129
                };

                switch (myID)
                {
                case 1841:
                    Proto.Name   = myPlayer.Name + "'s Squig";
                    Proto.Model1 = 136;
                    Proto.Ranged = 0;
                    break;

                case 1842:
                    Proto.Name   = myPlayer.Name + "'s Horned Squig";
                    Proto.Model1 = 137;
                    Proto.Ranged = 0;
                    break;

                case 1843:
                    Proto.Name   = myPlayer.Name + "'s Gas Squig";
                    Proto.Model1 = 139;
                    Proto.Ranged = 100;
                    break;

                case 1844:
                    Proto.Name   = myPlayer.Name + "'s Spiked Squig";
                    Proto.Model1 = 138;
                    Proto.Ranged = 100;
                    break;

                case 1845:
                    Proto.Name   = myPlayer.Name + "'s Battle Squig";
                    Proto.Model1 = 140;
                    Proto.Ranged = 0;
                    break;

                case 2828:
                    Proto.Name   = myPlayer.Name + "'s Horned Squig";
                    Proto.Model1 = 137;
                    Proto.Ranged = 0;
                    break;

                case 2829:
                    Proto.Name   = myPlayer.Name + "'s Gas Squig";
                    Proto.Model1 = 139;
                    Proto.Ranged = 100;
                    break;
                }

                Creature_spawn Spawn = new Creature_spawn();


                Proto.MinScale = 50;
                Proto.MaxScale = 50;
                Spawn.BuildFromProto(Proto);
                Spawn.WorldO         = myPlayer._Value.WorldO;
                Spawn.WorldY         = myPlayer._Value.WorldY;
                Spawn.WorldZ         = myPlayer._Value.WorldZ;
                Spawn.WorldX         = myPlayer._Value.WorldX;
                Spawn.ZoneId         = myPlayer.Zone.ZoneId;
                Spawn.Icone          = 18;
                Spawn.WaypointType   = 0;
                Spawn.Proto.MinLevel = Spawn.Proto.MaxLevel = myPlayer.EffectiveLevel;

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

                _myPet = new Pet(myID, Spawn, myPlayer, _AIMode, false, true);

                if (myID == 1844)
                {
                    myPet.BuffInterface.QueueBuff(new BuffQueueInfo(myPet, 1, AbilityMgr.GetBuffInfo(14)));
                }

                myPlayer.Region.AddObject(_myPet, Spawn.ZoneId);

                myPlayer.BuffInterface.NotifyPetEvent(myPet);
            }
            finally
            {
                _summoning = false;
            }
        }
Esempio n. 28
0
        public void SendCurrentStage(Player Plr)
        {
            Plr.QtsInterface.updateObjects();
            PacketOut Out = new PacketOut((byte)Opcodes.F_OBJECTIVE_INFO);

            Out.WriteUInt32(Info.Entry);
            Out.WriteByte(0);
            Out.WriteByte((byte)Plr.Realm);
            Out.WriteByte(Info.Type);
            Out.WriteUInt16(0);
            Out.WritePascalString(Info.Name);
            Out.WriteByte((byte)Plr.Realm);
            Out.WriteUInt16(0);



            Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Guid);
            Out.WriteByte((byte)Stage.Objectives.First().Objective.G0);
            Out.WriteByte((byte)Stage.Objectives.First().Objective.G1);
            Out.WriteByte(Stage.Objectives.First().Objective.RedDot);



            // SEND GREEN DOT 1
            Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count);
            Out.WriteUInt16((ushort)0);
            Out.WriteByte(0);
            Out.WritePascalString(Stage.Objectives.First().Objective.Objective);



            //RUINS OF SCHLOS EASY (2 dots) ST 1
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x0385)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count2);
                Out.WriteUInt16(0); // count killed ?
                Out.WriteByte(0);   //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective2);
            }
            //RUINS OF SCHLOS EASY (2 dots) ST 2
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x0386)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count2); //second dot counter 0/4
                Out.WriteUInt16(0);                                                 // count killed ?
                Out.WriteByte(0);
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective2);
            }


            //THE WEBWORKS EASY
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x0439)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count); //second dot counter 0/4
                Out.WriteUInt16(0);                                                // count killed ?
                Out.WriteByte(0);                                                  //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective2);
            }



            // PLAGUE ON THE WIND EASY
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x0472)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count); //second dot counter 0/4
                Out.WriteUInt16(0);                                                // count killed ?
                Out.WriteByte(0);                                                  //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective2);
            }



            // THE BLACK MIRE  EASY (OSTLAND)
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x049D)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count); //second dot counter 0/4
                Out.WriteUInt16(0);                                                // count killed ?
                Out.WriteByte(0);                                                  //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective2);
            }



            // HOCHNAR  EASY (OSTLAND) //
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x0488)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count); //second dot counter 0/4
                Out.WriteUInt16(0);                                                // count killed ?
                Out.WriteByte(0);                                                  //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective2);
            }


            // THE GRISLY HEARD  EASY (HIGH PASS)
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x057D)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count); //second dot counter 0/4
                Out.WriteUInt16(0);                                                // count killed ?
                Out.WriteByte(0);                                                  //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective2);
            }


            // CULT OF THE MAGUS  EASY (HIGH PASS)
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x0559)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count); //second dot counter 0/4
                Out.WriteUInt16(0);                                                // count killed ?
                Out.WriteByte(0);                                                  //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective2);
            }

            // CULT OF THE MAGUS  EASY (HIGH PASS)
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x0559)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count); //second dot counter 0/4
                Out.WriteUInt16(0);                                                // count killed ?
                Out.WriteByte(0);                                                  //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective3);
            }



            // TOMB OF THE TRAITOR  EASY (HIGH PASS)
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x0565)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count); //second dot counter 0/4
                Out.WriteUInt16(0);                                                // count killed ?
                Out.WriteByte(0);                                                  //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective2);
            }


            // THE FALL OF NIGHT EASY (CHAOS WASTE) (3 COUNTERS)
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x06E9)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count); //second dot counter 0/4
                Out.WriteUInt16(0);                                                // count killed ?
                Out.WriteByte(0);                                                  //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective2);
            }

            // THE FALL OF NIGHT EASY (CHAOS WASTE) (3 COUNTERS)
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x06E9)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count); //second dot counter 0/4
                Out.WriteUInt16(0);                                                // count killed ?
                Out.WriteByte(0);                                                  //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective3);
            }


            // THE siren sea EASY (CHAOS WASTE) (2 COUNTERS)
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x06A1)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count); //second dot counter 0/4
                Out.WriteUInt16(0);                                                // count killed ?
                Out.WriteByte(0);                                                  //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective2);
            }

            // burning windmill NORMAL(nordland st3)
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x036C)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count2); //second dot counter 0/4
                Out.WriteUInt16(0);                                                 // count killed ?
                Out.WriteByte(0);                                                   //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective2);
            }



            // lost artifacts normal (CHAOS WASTE)
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x06B8)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count); //second dot counter 0/4
                Out.WriteUInt16(0);                                                // count killed ?
                Out.WriteByte(0);                                                  //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective2);
            }



            // PLAGUE TROLLS NORMAL(TROLL COUNTRY)
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x049A)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count); //second dot counter 0/4
                Out.WriteUInt16(0);                                                // count killed ?
                Out.WriteByte(0);                                                  //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective2);
            }


            // siege of bohsenfels NORMAL (OSTLAND)
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x04AF)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count); //second dot counter 0/4
                Out.WriteUInt16(0);                                                // count killed ?
                Out.WriteByte(0);                                                  //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective2);
            }



            // TEMPLE OF CHANGE NORMAL (HIGH PASS)
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x055C)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count); //second dot counter 0/4
                Out.WriteUInt16(0);                                                // count killed ?
                Out.WriteByte(0);                                                  //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective2);
            }

            // TEMPLE OF CHANGE NORMAL (HIGH PASS)
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x055C)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count); //second dot counter 0/4
                Out.WriteUInt16(0);                                                // count killed ?
                Out.WriteByte(0);                                                  //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective3);
            }


            // THE FOETID PLAINS NORMAL(HIGH PASS)
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x0568)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count); //second dot counter 0/4
                Out.WriteUInt16(0);                                                // count killed ?
                Out.WriteByte(0);                                                  //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective2);
            }

            // ALTAR OF MADNESS NORMAL(chaos waste)
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x06E5)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count); //second dot counter 0/4
                Out.WriteUInt16(0);                                                // count killed ?
                Out.WriteByte(0);                                                  //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective2);
            }



            // ALTAR OF MADNESS NORMAL(chaos waste)
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x06E5)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count); //second dot counter 0/4
                Out.WriteUInt16(0);                                                // count killed ?
                Out.WriteByte(0);                                                  //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective3);
            }
            // MADNESS NORMAL(chaos wastes)
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x06AB)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count); //second dot counter 0/4
                Out.WriteUInt16(0);                                                // count killed ?
                Out.WriteByte(0);                                                  //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective2);
            }


            // GREEN DOT 2
            ///////////////

            if (Stage.Objectives.First().Objective.Guid == (ushort)0x034F)
            {
                ///////////////SECOND STUFF counter///////////////
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count); //second dot counter 0/4
                Out.WriteUInt16(0);                                                // count killed ?
                Out.WriteByte(0);                                                  //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective2);
            }



            // DEATHSTONE QUARRY HARD (sent 4 times)  2
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x0469)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count); //second dot counter 0/4
                Out.WriteUInt16(0);                                                // count killed ?
                Out.WriteByte(0);                                                  //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective2);
            }

            // DEATHSTONE QUARRY HARD   3
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x0469)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count); //second dot counter 0/4
                Out.WriteUInt16(0);                                                // count killed ?
                Out.WriteByte(0);                                                  //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective3);
            }

            // DEATHSTONE QUARRY HARD   4
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x0469)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count); //second dot counter 0/4
                Out.WriteUInt16(0);                                                // count killed ?
                Out.WriteByte(0);                                                  //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective4);
            }

            //Gore Wood HARD (ostland)
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x04C3)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count); //second dot counter 0/4
                Out.WriteUInt16(0);                                                // count killed ?
                Out.WriteByte(0);                                                  //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective2);
            }


            //LAKE OF THE DAMNED HARD (HIGH PASS)
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x055F)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count); //second dot counter 0/4
                Out.WriteUInt16(0);                                                // count killed ?
                Out.WriteByte(0);                                                  //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective2);
            }


            //The Reaping Field HARD (chaos wastes)
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x06A8)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count); //second dot counter 0/4
                Out.WriteUInt16(0);                                                // count killed ?
                Out.WriteByte(0);                                                  //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective2);
            }


            //The Reaping Field HARD (chaos wastes)
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x06A8)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count); //second dot counter 0/4
                Out.WriteUInt16(0);                                                // count killed ?
                Out.WriteByte(0);                                                  //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective3);
            }



            //Ebon keep HARD (chaos wastes)
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x06E0)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count); //second dot counter 0/4
                Out.WriteUInt16(0);                                                // count killed ?
                Out.WriteByte(0);                                                  //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective2);
            }


            //Ebon keep HARD (chaos wastes)
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x06E0)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count); //second dot counter 0/4
                Out.WriteUInt16(0);                                                // count killed ?
                Out.WriteByte(0);                                                  //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective3);
            }


            //Ebon keep HARD (chaos wastes)
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x06E0)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count); //second dot counter 0/4
                Out.WriteUInt16(0);                                                // count killed ?
                Out.WriteByte(0);                                                  //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective4);
            }


            //DANCE OF BONES HARD (chaos wastes)
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x06AE)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count); //second dot counter 0/4
                Out.WriteUInt16(0);                                                // count killed ?
                Out.WriteByte(0);                                                  //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective);
            }



            //Broken ground HARD (pragg)
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x062F)
            {
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count); //second dot counter 0/4
                Out.WriteUInt16(0);                                                // count killed ?
                Out.WriteByte(0);                                                  //
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective2);
            }



            // DISABLING THIS MAKES NORSE ARE COMING EASY GREEN

            // GREEN DOT 3  // some bug on guidbyte1 set at  3dots
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x034F)
            {
                ///////////////THIRD STUFF counter///////////////
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);          // 0= green 1= red //turns THIRD  dot red
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count); //
                Out.WriteUInt16(0);                                                // THIRD HOW MANY BEEN KILLED COUNT  0028= 40
                Out.WriteByte(0);
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective3);

                /////////////////////////////////////////////////////////
            }
            // ENABLING this makes PILLAGERS APPROCH RED HARD
            // GREEN DOT 4 // 0445= 1093= pillagers approch
            if (Stage.Objectives.First().Objective.Guid == (ushort)0x0445)
            {
                //////////////////////////////
                Out.WriteByte(Stage.Objectives.First().Objective.RedDot);           // 0= green 1= red //turns THIRD  dot red
                Out.WriteUInt16((ushort)Stage.Objectives.First().Objective.Count2); //
                Out.WriteUInt16(0);                                                 // THIRD HOW MANY BEEN KILLED COUNT  0028= 40
                Out.WriteByte(0);
                Out.WritePascalString(Stage.Objectives.First().Objective.Objective2);

                /////////////////////////////////////////////////////////
            }
            foreach (PQuest_Spawn Spawn in Stage.Objectives.First().Objective.Spawns)
            {
                Log.Info("Creature", "npc = " + Name + "  Oid = " + Oid + "  X= " + Spawn.WorldX + "  Y= " + Spawn.WorldY + "  Z= " + Spawn.WorldZ);

                // Log.Success("SENDING Spawn.Type", "STARTING Spawn.Type ");

                //if (Stage.Objectives.First().Objective.Guid == (UInt16)0x052E)

                if (Spawn.Type == 1 & Stage.Objectives.First().Objective.Guid == (UInt16)0x052E)
                {
                    Creature_proto Proto = WorldMgr.GetCreatureProto(Spawn.Entry);
                    if (Proto == null)
                    {
                        Log.Error("PQCreatue", "No Proto");
                        return;
                    }


                    Creature_spawn S = new Creature_spawn();


                    S.Guid = (uint)WorldMgr.GenerateCreatureSpawnGUID();
                    S.BuildFromProto(Proto);
                    S.WorldO = Spawn.WorldO;
                    S.WorldY = Spawn.WorldY;
                    S.WorldZ = Spawn.WorldZ;
                    S.WorldX = Spawn.WorldX;
                    S.ZoneId = Spawn.ZoneId;
                    S.Bytes  = "";
                }
            }

            /////////////////////////////////////////////////
            Out.WriteByte(Stage.Objectives.First().Objective.PQDifficulty); // THIS SHOULD BE 0   // dificulty // 0= easy 2-3 players 1= normal but shows no players //  2= hard 9 or more players //  4,5= normal 6-9 players
            Out.WriteByte(0);
            Out.WritePascalString(Stage.StageName);
            Out.WriteByte(0);                                                      // added this which shows the description in white writing kill the raven host marauders terr
            Out.WritePascalString(Stage.Objectives.First().Objective.Description); //52=size of string= 4B 69 6C 6C 20 74 68 65 20 52 61 76 65 6E 20 48 6F 73



            Out.WriteUInt32((uint)Stage.Objectives.First().Objective.Timer); //00 00 00 00// clock////////////
            Out.WriteUInt32((uint)Stage.Objectives.First().Objective.Timer); // 00 00 00 00 // clock////////////

            //Out.WriteUInt32(0);//00 00 00 00
            Out.WriteUInt16(0);/////////////////


            Out.WriteByte(0);// is this in here ???

            // MAY BE ADD THE IF TO THIS FOR BATTLEFEALD OBJECTIVE ?
            //         Out.WritePascalString(Info.Name);// weard this shows battle feald objective if anabled

            //Out.WriteUInt16(0x0048);//  GetInfluenceInfo()->influenceid);//////////////////////
            Out.WriteUInt16(0x0044);// only for pillger pq//////////////
            Out.WriteUInt32(0);
            Plr.SendPacket(Out);


            // GOLD CHEST ON MAP TURNS GOLD WHEN MORE THAN ONE PLAYER IS IN THE ZONE
            Out = new PacketOut((byte)Opcodes.F_OBJECTIVE_UPDATE);
            Out.WriteUInt32(0);
            Out.WriteByte(6);
            Out.WriteUInt32(Info.ZoneId);                 //zoneid
            Out.WriteUInt16(2);                           // zone public quests size 00 02 zone.public quest counts
            Out.WriteUInt32(Info.Entry);                  //(entry);//02 26// entry=550
            Out.WriteUInt16((ushort)Zone._Players.Count); //(0x0004);// get player counts
            //Out.WriteUInt16((UInt16)1);
            Out.WriteUInt16(0);
            Out.WriteUInt16(0x0238);// ???
            Out.WriteUInt16(0);
            DispatchPacket(Out, true);



            // SENDS STATE OF BO FLAGS
        }