public void AddNPC(Npc npc)
        {
            AddObject(npc);
            _npcs.Add(npc);

            if (_cache.FirstOrDefault(x => x.Id == npc.Id) != null) return;
            _cache.Add(npc);
        }
        public override void Lookup(string name)
        {
            FilterName = name;
            var sql = String.Format(Queries.SelectQuery, ResolveArgs(Queries.SelectArgs));
            var results = Database.QueryHelper.RunQuery(_connection, sql);

            NPCs.Clear();
            UnlockObject();
            foreach (var dictionary in results)
            {
                var npc = new Npc(_queryConfig);
                //npc.SetProperties(Queries, dictionary);
                npc.SetPropertiesFaster(Queries, dictionary);
                AddNPC(npc);
                npc.Created();
            }
            Created();
        }
Beispiel #3
0
        public static void SetNPCProperties(ref Npc npc,ZoneEntryStruct data)
        {
            npc.Name = data.SpawnName;
            npc.Level = data.Level;
            npc.Id = (int)data.SpawnID;
            npc.Size = data.Size;
            npc.LastName = data.LastName;

            npc.Gender = (TypeGender)data.Gender;
            npc.Class = (NPCClass)data.Class;
            npc.Race = (TypeRace)data.Race;
            npc.BodyType = (TypeBodyType)data.BodyType;

            //npc.WalkSpeed = data.WalkSpeed;
            npc.RunSpeed = data.RunSpeed;

            npc.Face = data.Face;
            npc.Findable = data.Findable;

            npc.DMeleeTexture1 = (int)data.MeleeTexture1;
            npc.DMeleeTexture2 = (int)data.MeleeTexture2;

            npc.LuclinBeard = data.Beard;
            npc.LuclinBeardColor = data.BeardColor;
            npc.LuclinEyeColor = data.EyeColor1;
            npc.LuclinEyeColor2 = data.EyeColor2;
            npc.LuclinHairColor = data.HairColor;
            npc.LuclinHairStyle = data.HairStyle;

            npc.Texture = data.EquipChest2;
            npc.HelmTexture = data.Helm;

            npc.ArmorTintBlue = data.ArmorTintBlue;
            npc.ArmorTintGreen = data.ArmorTintGreen;
            npc.ArmorTintRed = data.ArmorTintRed;

            npc.DrakkinDetails = (int)data.DrakkinDetails;
            npc.DrakkinHeritage = (int)data.DrakkinHeritage;
            npc.DrakkinTattoo = (int)data.DrakkinTattoo;
        }
 public void RemoveNPC(Npc npc)
 {
     RemoveObject(npc);
     _npcs.Remove(npc);
     _cache.Remove(npc);
 }
Beispiel #5
0
 public SpawnEntry AddEntry(Npc npc)
 {
     var entry = CreateEntry();
     entry.NpcID = npc.Id;
     entry.NpcLevel = (short)npc.Level;
     entry.NpcName = npc.Name;
     entry.Created();
     AddEntry(entry);
     return entry;
 }
        public override void LookupByZone(string zone)
        {
            if (_lookupByZone != null)
            {
                var sql = String.Format(_lookupByZone.SelectQuery, zone);
                var results = QueryHelper.RunQuery(_connection, sql);

                NPCs.Clear();

                foreach (var dict in results)
                {
                    var npc = new Npc(_queryConfig);
                    npc.SetProperties(Queries, dict);
                    AddNPC(npc);
                    npc.Created();
                }
            }
        }