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 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. 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 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. 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 NpcBrain(Unit myOwner) : base(myOwner)
 {
     NextAbilityExecution = 0;
     ConditionManager     = new Conditions(_unit, Combat);
     ExecutionManager     = new Executions(_unit, Combat, this);
     Abilities            = new List <CreatureSmartAbilities>();
     AbilityTracker       = new Dictionary <CreatureSmartAbilities, long>();
     if (_unit is Creature)
     {
         Proto = (_unit as Creature).Spawn.Proto;
     }
     else
     {
         throw new Exception("_Unit is not Creature");
     }
 }
Esempio n. 14
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. 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 LandMine(Player owner, Point3D spawnVec, Creature_proto proto)
        {
            Owner           = owner;
            Proto           = proto;
            Realm           = Owner.Realm;
            Level           = Owner.EffectiveLevel;
            Name            = Proto.Name;
            WorldPosition.X = spawnVec.X;
            WorldPosition.Y = spawnVec.Y;
            WorldPosition.Z = spawnVec.Z;

            IsInvulnerable = true;

            Faction = Realm == Realms.REALMS_REALM_ORDER ? (byte)0x41 : (byte)0x81;

            Health    = 1;
            MaxHealth = 1;
        }
Esempio n. 18
0
        public BuffHostObject(Unit owner, Point3D spawnVec, Creature_proto proto, long expireTime)
        {
            Owner           = owner;
            Proto           = proto;
            Name            = proto.Name;
            Realm           = owner.Realm;
            WorldPosition.X = spawnVec.X;
            WorldPosition.Y = spawnVec.Y;
            WorldPosition.Z = spawnVec.Z;
            Level           = Owner.EffectiveLevel;
            Faction         = Realm == Realms.REALMS_REALM_ORDER ? (byte)0x40 : (byte)0x80;

            ExpireTime = expireTime;

            IsInvulnerable = true;

            MaxHealth = 9999;
            Health    = 9999;
        }
Esempio n. 19
0
        public void UpdateFlagOwningRealm()
        {
            Creature_proto Proto = CreatureService.GetCreatureProto(team == 1 ? OrderId : DestroId);

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

            Creature.Spawn = new Creature_spawn();
            Creature.Spawn.BuildFromProto(Proto);
            Creature.Spawn.WorldO         = o;
            Creature.Spawn.WorldY         = y;
            Creature.Spawn.WorldZ         = z;
            Creature.Spawn.WorldX         = x;
            Creature.Spawn.ZoneId         = ZoneId;
            Creature.Spawn.RespawnMinutes = 3;
        }
Esempio n. 20
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. 21
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 static Siege SpawnSiegeWeapon(Player plr, Keep keep, uint entry, bool defender)
        {
            Creature_proto proto = CreatureService.GetCreatureProto(entry);

            Creature_spawn spawn = null;

            if (Constants.DoomsdaySwitch == 0)
            {
                spawn = new Creature_spawn
                {
                    Guid   = (uint)CreatureService.GenerateCreatureSpawnGUID(),
                    WorldO = plr.Heading,
                    WorldY = plr.WorldPosition.Y,
                    WorldZ = plr.Z,
                    WorldX = plr.WorldPosition.X,
                    ZoneId = keep.Info.ZoneId,
                    Level  = (byte)(keep.Info.PQuest.PQTier * 10)
                };
            }
            // We want sieges to be level 40
            else
            {
                spawn = new Creature_spawn
                {
                    Guid   = (uint)CreatureService.GenerateCreatureSpawnGUID(),
                    WorldO = plr.Heading,
                    WorldY = plr.WorldPosition.Y,
                    WorldZ = plr.Z,
                    WorldX = plr.WorldPosition.X,
                    ZoneId = keep.Info.ZoneId,
                    Level  = 40
                };
            }


            spawn.BuildFromProto(proto);

            return(new Siege(spawn, plr, keep, SiegeType.GTAOE));
        }
        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. 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);
                }
            }
        }
        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. 27
0
        /// <summary>
        /// Spawn an npc +Keep
        /// </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 NpcKeepSpawn(Player plr, ref List <string> values)
        {
            var destroId = values[0];
            var orderId  = values[1];

            Creature_proto proto      = null;
            Creature_proto protoOrder = null;

            if (destroId == "0")
            {
                plr.SendClientMessage("NPC SPAWN:  Setting Destro Id -> 0");
            }
            else
            {
                proto = CreatureService.GetCreatureProto(Convert.ToUInt32(destroId));
                if (proto == null)
                {
                    proto = WorldMgr.Database.SelectObject <Creature_proto>("Entry=" + destroId);

                    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(" + destroId + ")");
                    }

                    return(false);
                }
            }
            if (orderId == "0")
            {
                plr.SendClientMessage("NPC SPAWN:  Setting Order Id -> 0");
            }
            else
            {
                protoOrder = CreatureService.GetCreatureProto(Convert.ToUInt32(orderId));
                if (protoOrder == null)
                {
                    protoOrder = WorldMgr.Database.SelectObject <Creature_proto>("Entry=" + orderId);

                    if (protoOrder != 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(" + orderId + ")");
                    }

                    return(false);
                }
            }

            plr.UpdateWorldPosition();

            //Creature_spawn spawn = new Creature_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 kc = new Keep_Creature();

            kc.ZoneId   = plr.Zone.ZoneId;
            kc.DestroId = Convert.ToUInt32(destroId);
            kc.OrderId  = Convert.ToUInt32(orderId);


            kc.IsPatrol = false;
            var keep = plr.Region.Campaign.GetClosestKeep(plr.WorldPosition, (ushort)plr.ZoneId);

            kc.KeepId = keep.Info.KeepId;

            kc.KeepLord     = false;
            kc.X            = plr._Value.WorldX;
            kc.Y            = plr._Value.WorldY;
            kc.Z            = plr._Value.WorldZ;
            kc.O            = plr._Value.WorldO;
            kc.WaypointGUID = 0;

            kc.Dirty = true;

            WorldMgr.Database.AddObject(kc);
            WorldMgr.Database.ForceSave();
            plr.SendClientMessage("Created keep creature");

            GMCommandLog log = new GMCommandLog();

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

            return(true);
        }
Esempio n. 28
0
        public void SummonPet(ushort myID)
        {
            if (myPet != null)
            {
                myPet.Destroy();
                myPet = null;
            }

            Creature_proto proto = new Creature_proto();

            switch (myID)
            {
            case 8474:
                proto.Name    = myPlayer.Name + "'s Pink Horror^M";
                proto.Model1  = 141;
                proto.Faction = 129;
                proto.Ranged  = 100;
                SwitchPetBonusType(1);
                SpawnPet(proto);

                break;

            case 8476:
                proto.Name    = myPlayer.Name + "'s Blue Horror^M";
                proto.Model1  = 142;
                proto.Faction = 129;
                proto.Ranged  = 30;
                SwitchPetBonusType(3);
                SpawnPet(proto);

                break;

            case 8478:
                proto.Name    = myPlayer.Name + "'s Flamer^M";
                proto.Model1  = 143;
                proto.Faction = 129;
                proto.Ranged  = 65;
                SwitchPetBonusType(2);
                SpawnPet(proto);

                break;

            case 1511:
                proto.Name    = myPlayer.Name + "'s Gun Turret^N";
                proto.Model1  = 145;
                proto.Faction = 65;
                proto.Ranged  = 100;
                SwitchPetBonusType(1);
                SpawnPet(proto);

                break;

            case 1518:
                proto.Name    = myPlayer.Name + "'s Bombardment Turret^N";
                proto.Model1  = 146;
                proto.Faction = 65;
                proto.Ranged  = 65;
                SwitchPetBonusType(2);
                SpawnPet(proto);

                break;

            case 1526:
                proto.Name    = myPlayer.Name + "'s Flame Turret^N";
                proto.Model1  = 147;
                proto.Faction = 65;
                proto.Ranged  = 30;
                SwitchPetBonusType(3);
                SpawnPet(proto);

                break;


            case 8535:
                proto.Name    = myPlayer.Name + "'s Firewyrm^N";
                proto.Model1  = 144;      // firewyrm
                proto.Faction = 129;      //dest
                proto.Ranged  = 5;
                SwitchPetBonusType(2);
                SpawnPet(proto);

                break;

            default:
                throw new Exception("Engineer/Magus: Requested pet ID " + myID + " not found for SummonPet");
            }
        }
Esempio n. 29
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;
            }
        }
Esempio n. 30
0
        private static void AssignProtoStates(Creature_proto proto)
        {
            proto.InteractType = Unit.GenerateInteractType(proto);

            // Interact type
            switch (proto.TitleId)
            {
            case CreatureTitle.Apothecary:     // Trade skill start
            case CreatureTitle.Butcher:
            case CreatureTitle.Salvager:
            case CreatureTitle.Scavenger:
            case CreatureTitle.Cultivator:
            case CreatureTitle.HedgeWizard:
                proto.InteractTrainerType = 1;
                break;

            case CreatureTitle.Trainer:
            case CreatureTitle.CareerTrainer:
            case CreatureTitle.ApprenticeCareerTrainer:
                proto.InteractTrainerType = 6;
                break;

            case CreatureTitle.RenownTrainer:
            case CreatureTitle.ApprenticeRenownTrainer:
                proto.InteractTrainerType = 8;
                break;
            }

            List <byte> states = proto.States != null ? new List <byte>(proto.States) : new List <byte>();

            if (proto.VendorID > 0)
            {
                states.Add((byte)CreatureState.Merchant);
            }

            switch (proto.InteractType)
            {
            case InteractType.INTERACTTYPE_TRAINER:
                if (proto.InteractTrainerType == 1)
                {
                    states.Add((byte)CreatureState.Merchant);
                }
                states.Add((byte)CreatureState.SkillTrainer);
                if (proto.InteractTrainerType == 1)
                {
                    states.Add((byte)CreatureState.ConsistentAppearance);
                }
                break;

            case InteractType.INTERACTTYPE_BANKER:
                states.Add((byte)CreatureState.Banker);
                break;

            case InteractType.INTERACTTYPE_AUCTIONEER:
                states.Add((byte)CreatureState.Auctioneer);
                break;

            case InteractType.INTERACTTYPE_GUILD_REGISTRAR:
                states.Add((byte)CreatureState.GuildRegistrar);
                break;

            case InteractType.INTERACTTYPE_FLIGHT_MASTER:
                states.Add((byte)CreatureState.FlightMaster);
                break;

            case InteractType.INTERACTTYPE_HEALER:
                states.Add((byte)CreatureState.Healer);
                break;

            case InteractType.INTERACTTYPE_LASTNAMESHOP:
                states.Add((byte)CreatureState.NameRegistrar);
                break;
            }

            if (proto.TitleId == CreatureTitle.KillCollector)
            {
                states.Add((byte)CreatureState.KillCollector);
                states.Add((byte)CreatureState.ConsistentAppearance);
            }

            if (proto.TitleId == CreatureTitle.RallyMaster) // Rally Master
            {
                byte chapterId = (byte)ChapterService.GetChapterByNPCID(proto.Entry);
                if (chapterId > 0)
                {
                    states.Add((byte)CreatureState.Influence);
                }

                states.Add((byte)CreatureState.RallyMasterIcon);
                states.Add((byte)CreatureState.ConsistentAppearance);
            }

            if (proto.CreatureType == (byte)GameData.CreatureTypes.SIEGE)
            {
                states.Add((byte)CreatureState.RvRFlagged);
            }

            if (proto.VendorID == 0 && proto.InteractType == InteractType.INTERACTTYPE_DYEMERCHANT)
            {
                states.Add((byte)CreatureState.Merchant);
                states.Add((byte)CreatureState.DyeMerchant);
            }

            // Seems omnipresent, function unknown
            else
            {
                states.Add((byte)CreatureState.UnkOmnipresent);
            }

            proto.States = states.ToArray();

            /* Assign fig leaf data here.
             *
             * Notes:
             *
             * It seems as though in a 0, 0, 0, X, 1, 10 chain, the X byte is a bitfield. Possible values:
             *
             * 8 - Non-combatant (hides name, shows in white - used widely in capital city maps)
             * 4 - Cannot be targeted
             * 2 - ?
             * 1 - ?
             *
             */

            if (proto.FigLeafData == null)
            {
                if (proto.CreatureType == (byte)GameData.CreatureTypes.SIEGE)
                {
                    proto.FigLeafData = new byte[] { 0, 0, 0, 11, 1, 10 }
                }
                ;
                else
                {
                    switch (proto.Title)
                    {
                    case 1:
                    case 2:
                    case 40:
                    case 144:     // Career Trainer
                        proto.FigLeafData = new byte[] { 0, 0, 0, 1, 1, 10 };
                        break;

                    case 17:     // Rally Master
                        byte chapterId = (byte)ChapterService.GetChapterByNPCID(proto.Entry);
                        if (chapterId > 0)
                        {
                            proto.FigLeafData = new byte[] { 0, 0, 0, 3, 0, chapterId, 1, 10 }
                        }
                        ;
                        else
                        {
                            proto.FigLeafData = _defaultData;
                        }
                        break;

                    case 4:     // Trade skill start
                    case 5:
                    case 6:
                    case 7:
                    case 8:
                    case 9:     // Trade skill end
                    case 18:    // Flight Master
                    case 20:    // Healer
                    case 32:    // Kill collector
                        proto.FigLeafData = new byte[] { 0, 0, 0, 3, 1, 10 };
                        break;

                    default:
                        proto.FigLeafData = _defaultData;
                        break;
                    }
                }
            }
        }