Beispiel #1
0
        public void Update(SpawnNpcServerMessage m)
        {
            var newEntity = new NpcEntity(m.Id, m.OwnerId, GetOrPlaceholder(m.OwnerId),
                                          _npcDatabase.GetOrPlaceholder(m.NpcArea, m.NpcId), m.Position, m.Heading);

            Register(newEntity);
        }
Beispiel #2
0
        public PetSkillDatabase(string folder, string language, NpcDatabase npcDatabase)
        {
            StreamReader reader;

            try
            {
                reader = new StreamReader(File.OpenRead(Path.Combine(folder, $"skills\\pets-skills-{language}.tsv")));
            }
            catch
            {
                return;
            }
            while (!reader.EndOfStream)
            {
                var line = reader.ReadLine();
                if (line == null)
                {
                    continue;
                }
                var values = line.Split('\t');

                var huntingZoneId = ushort.Parse(values[0]);
                var templateId    = uint.Parse(values[1]);
                var petName       = values[2];
                var skillId       = (huntingZoneId << 16) + ushort.Parse(values[3]);
                var skillName     = values[4];
                var icon          = values[5];
                var npcinfo       = npcDatabase.GetOrPlaceholder(huntingZoneId, templateId);
                var skill         = new UserSkill(skillId, new RaceGenderClass(Race.Common, Gender.Common, PlayerClass.Common), skillName, null, string.IsNullOrWhiteSpace(petName) ? npcinfo.Name : petName, icon, npcinfo);
                var lookup        = Tuple.Create(huntingZoneId, templateId);
                if (!_petSkilldata.ContainsKey(lookup))
                {
                    _petSkilldata[lookup] = new List <UserSkill>();
                }
                _petSkilldata[lookup].Add(skill);
            }
        }