Exemple #1
0
        /// <summary>
        /// Gets the section name starting from guard and section ids.
        /// </summary>
        /// <param name="guardId">id of the guard</param>
        /// <param name="sectionId">id of the section</param>
        /// <returns>name of the section if found, else "Unknown"</returns>
        public string GetSectionName(uint guardId, uint sectionId)
        {
            var ret = "Unknown";

            try
            {
                MapDatabase.Worlds.ToList().ForEach(w =>
                {
                    if (!w.Value.Guards.TryGetValue(guardId, out var g))
                    {
                        return;
                    }
                    if (!g.Sections.TryGetValue(sectionId, out var s))
                    {
                        return;
                    }
                    var nameId = s.NameId;
                    ret        = RegionsDatabase.GetZoneName(nameId);
                });
            }
            catch
            {
                // ignored
            }
            return(ret);
        }
Exemple #2
0
        /// <summary>
        /// Tries to convert a continent id to a guard name or dungeon name.
        /// </summary>
        /// <param name="continentId">id of the continent</param>
        /// <param name="name">resulting name, "Unknown" if not found</param>
        /// <returns>true if value was successfully found</returns>
        public bool TryGetGuardOrDungeonNameFromContinentId(uint continentId, out string name)
        {
            if (DungeonDatabase.Dungeons.TryGetValue(continentId, out var dung))
            {
                name = dung.Name;
                return(true);
            }
            var guard = MapDatabase.Worlds[1].Guards.FirstOrDefault(x => x.Value.ContinentId == continentId);

            if (guard.Value == null)
            {
                name = "Unknown";
                return(false);
            }
            name = RegionsDatabase.GetZoneName(guard.Value.NameId);
            return(true);
        }
 /// <summary>
 /// Tries to convert a continent id to a guard name or dungeon name.
 /// </summary>
 /// <param name="continentId">id of the continent</param>
 /// <param name="name">resulting name, "Unknown" if not found</param>
 /// <returns>true if value was successfully found</returns>
 public bool TryGetGuardOrDungeonNameFromContinentId(uint continentId, out string name)
 {
     if (DungeonDatabase.Dungeons.TryGetValue(continentId, out var dung))
     {
         name = dung.Name;
         return(true);
     }
     var(_, guard) = MapDatabase.Worlds[1].Guards.FirstOrDefault(x => x.Value.ContinentId == continentId);
     // ReSharper disable once ConditionIsAlwaysTrueOrFalse
     if (guard == null)
     {
         name = "Unknown";
         return(false);
     }
     name = RegionsDatabase.GetZoneName(guard.NameId);
     return(true);
 }
 public TccDatabase(string lang)
 {
     MonsterDatabase          = new MonsterDatabase(lang);
     AccountBenefitDatabase   = new AccountBenefitDatabase(lang);
     ItemsDatabase            = new ItemsDatabase(lang);
     ItemExpDatabase          = new ItemExpDatabase(lang);
     SkillsDatabase           = new SkillsDatabase(lang);
     AbnormalityDatabase      = new AbnormalityDatabase(lang);
     DungeonDatabase          = new DungeonDatabase(lang);
     SocialDatabase           = new SocialDatabase(lang);
     SystemMessagesDatabase   = new SystemMessagesDatabase(lang);
     GuildQuestDatabase       = new GuildQuestDatabase(lang);
     AchievementDatabase      = new AchievementDatabase(lang);
     AchievementGradeDatabase = new AchievementGradeDatabase(lang);
     MapDatabase     = new MapDatabase(lang);
     RegionsDatabase = new RegionsDatabase(lang);
     QuestDatabase   = new QuestDatabase(lang);
 }
Exemple #5
0
        /// <summary>
        /// Returns the guard name for the specified dungeon.
        /// </summary>
        /// <param name="dungeonId">id of the dungeon</param>
        /// <returns>guard name of the dungeon if found, else "Unknown"</returns>
        public string GetDungeonGuardName(uint dungeonId)
        {
            var ret       = "Unknown";
            var dungWorld = MapDatabase.Worlds[9999];
            var guardList = dungWorld.Guards.Values.ToList();
            var guard     = guardList.FirstOrDefault(x => x.Sections.ContainsKey(dungeonId));

            if (guard == null)
            {
                return(ret);
            }

            var openWorld = MapDatabase.Worlds[1];

            if (!openWorld.Guards.TryGetValue(guard.Id, out var grd))
            {
                return(ret);
            }

            ret = RegionsDatabase.GetZoneName(grd.NameId);
            return(ret);
        }
Exemple #6
0
 public TccDatabase(string lang)
 {
     Language       = lang;
     ServerDatabase = new ServerDatabase(App.DataPath, Path.Combine(App.ResourcesPath, "config/server-overrides.txt"))
     {
         Language = (LangEnum)Enum.Parse(typeof(LangEnum), lang.Replace("EU-", ""))
     };
     MonsterDatabase          = new MonsterDatabase(lang);
     AccountBenefitDatabase   = new AccountBenefitDatabase(lang);
     ItemsDatabase            = new ItemsDatabase(lang);
     ItemExpDatabase          = new ItemExpDatabase(lang);
     SkillsDatabase           = new SkillsDatabase(lang);
     AbnormalityDatabase      = new AbnormalityDatabase(lang);
     DungeonDatabase          = new DungeonDatabase(lang);
     SocialDatabase           = new SocialDatabase(lang);
     SystemMessagesDatabase   = new SystemMessagesDatabase(lang);
     GuildQuestDatabase       = new GuildQuestDatabase(lang);
     AchievementDatabase      = new AchievementDatabase(lang);
     AchievementGradeDatabase = new AchievementGradeDatabase(lang);
     MapDatabase     = new MapDatabase(lang);
     RegionsDatabase = new RegionsDatabase(lang);
     QuestDatabase   = new QuestDatabase(lang);
 }