コード例 #1
0
ファイル: WoWMap.cs プロジェクト: zneel/TheNoobBot
        private static void init()
        {
            if (mapDB2 == null)
            {
                var m_definitions = DBFilesClient.Load(Application.StartupPath + @"\Data\DBFilesClient\dblayout.xml");
                var definitions   = m_definitions.Tables.Where(t => t.Name == "Map");

                if (!definitions.Any())
                {
                    definitions = m_definitions.Tables.Where(t => t.Name == Path.GetFileName("Map"));
                }
                if (definitions.Count() == 1)
                {
                    var table = definitions.First();
                    mapDB2 = DBReaderFactory.GetReader(Application.StartupPath + @"\Data\DBFilesClient\Map.db2", table) as DB6Reader;
                    if (_cachedMapRows == null || _cachedRecords == null)
                    {
                        if (mapDB2 != null)
                        {
                            _cachedMapRows = mapDB2.Rows.ToArray();
                            _cachedRecords = new MapDbcRecord[_cachedMapRows.Length];
                            for (int i = 0; i < _cachedMapRows.Length - 1; i++)
                            {
                                _cachedRecords[i] = DB6Reader.ByteToType <MapDbcRecord>(_cachedMapRows[i]);
                            }
                        }
                    }
                    Logging.Write(mapDB2.FileName + " loaded with " + mapDB2.RecordsCount + " entries.");
                }
                else
                {
                    Logging.Write("DB2 Map not read-able.");
                }
            }
        }
コード例 #2
0
        private WoWLock(uint id)
        {
            Init();
            LockDbcRecord tempLockDbcRecord = new LockDbcRecord();
            bool          found             = false;

            for (int i = 0; i < _lockDB2.RecordsCount - 1; i++)
            {
                tempLockDbcRecord = DB6Reader.ByteToType <LockDbcRecord>(_lockDB2.Rows.ElementAt(i));
                if (tempLockDbcRecord.Id == id)
                {
                    found = true;
                    break;
                }
            }
            _lockDBCRecord0 = found ? tempLockDbcRecord : new LockDbcRecord();
        }
コード例 #3
0
ファイル: WoWItemClass.cs プロジェクト: zneel/TheNoobBot
        private WoWItemClass(string name)
        {
            Init();
            ItemClassDB2Record tempItemClassDb2Record = new ItemClassDB2Record();
            bool found = false;

            for (int i = 0; i < _itemClassDB2.RecordsCount - 1; i++)
            {
                tempItemClassDb2Record = DB6Reader.ByteToType <ItemClassDB2Record>(_itemClassDB2.Rows.ElementAt(i));
                if (tempItemClassDb2Record.Name() == name)
                {
                    found = true;
                    break;
                }
            }
            _rItemClassRec0 = found ? tempItemClassDb2Record : new ItemClassDB2Record();
        }
コード例 #4
0
        private static void init()
        {
            if (_rSiteDB2 == null)
            {
                var mDefinitions = DBFilesClient.Load(Application.StartupPath + @"\Data\DBFilesClient\dblayout.xml");
                var definitions  = mDefinitions.Tables.Where(t => t.Name == "ResearchSite");

                if (!definitions.Any())
                {
                    definitions = mDefinitions.Tables.Where(t => t.Name == Path.GetFileName("ResearchSite"));
                }
                if (definitions.Count() == 1)
                {
                    var table = definitions.First();
                    if (Usefuls.GetClientLanguage().Length == 4)
                    {
                        _rSiteDB2 = DBReaderFactory.GetReader(Application.StartupPath + @"\Data\DBFilesClient\" + Usefuls.GetClientLanguage() + @"\ResearchSite.db2", table) as DB6Reader;
                    }
                    else
                    {
                        _rSiteDB2 = DBReaderFactory.GetReader(Application.StartupPath + @"\Data\DBFilesClient\AllWoW\ResearchSite.db2", table) as DB6Reader;
                    }
                    if (_cachedResearchSiteRows == null || _cachedRecords == null)
                    {
                        if (_rSiteDB2 != null)
                        {
                            _cachedResearchSiteRows = _rSiteDB2.Rows.ToArray();
                            _cachedRecords          = new ResearchSiteDb2Record[_cachedResearchSiteRows.Length];
                            for (int i = 0; i < _cachedResearchSiteRows.Length - 1; i++)
                            {
                                _cachedRecords[i] = DB6Reader.ByteToType <ResearchSiteDb2Record>(_cachedResearchSiteRows[i]);
                            }
                        }
                    }
                    Logging.Write(_rSiteDB2.FileName + " loaded with " + _rSiteDB2.RecordsCount + " entries.");
                }
                else
                {
                    Logging.Write("DB2 ResearchSite not read-able.");
                }
            }
        }
コード例 #5
0
        private static void Init() // todo make DBC loading shared accross all others reads with a better loading class.
        {
            if (_spellCategoriesDb2 == null)
            {
                var mDefinitions = DBFilesClient.Load(Application.StartupPath + @"\Data\DBFilesClient\dblayout.xml");
                var definitions  = mDefinitions.Tables.Where(t => t.Name == "SpellCategories");

                if (!definitions.Any())
                {
                    definitions = mDefinitions.Tables.Where(t => t.Name == Path.GetFileName("SpellCategories"));
                }
                if (definitions.Count() == 1)
                {
                    var table = definitions.First();
                    _spellCategoriesDb2 = DBReaderFactory.GetReader(Application.StartupPath + @"\Data\DBFilesClient\SpellCategories.db2", table) as DB6Reader;
                    if (_cachedSpellCategoriesRows == null || _cachedRecords == null)
                    {
                        if (_spellCategoriesDb2 != null)
                        {
                            _cachedSpellCategoriesRows = _spellCategoriesDb2.Rows.ToArray();
                            _cachedRecords             = new SpellCategoriesDbcRecord[_cachedSpellCategoriesRows.Length];
                            for (int i = 0; i < _cachedSpellCategoriesRows.Length - 1; i++)
                            {
                                _cachedRecords[i] = DB6Reader.ByteToType <SpellCategoriesDbcRecord>(_cachedSpellCategoriesRows[i]);
                            }
                        }
                    }
                    if (_spellCategoriesDb2 != null)
                    {
                        Logging.Write(_spellCategoriesDb2.FileName + " loaded with " + _spellCategoriesDb2.RecordsCount + " entries.");
                    }
                }
                else
                {
                    Logging.Write("DB2 SpellCategories not read-able.");
                }
            }
        }
コード例 #6
0
        private static void Init()
        {
            if (_lockDB2 == null)
            {
                var mDefinitions = DBFilesClient.Load(Application.StartupPath + @"\Data\DBFilesClient\dblayout.xml");
                var definitions  = mDefinitions.Tables.Where(t => t.Name == "Lock");

                if (!definitions.Any())
                {
                    definitions = mDefinitions.Tables.Where(t => t.Name == Path.GetFileName("Lock"));
                }
                if (definitions.Count() == 1)
                {
                    var table = definitions.First();
                    _lockDB2 = DBReaderFactory.GetReader(Application.StartupPath + @"\Data\DBFilesClient\Lock.db2", table) as DB6Reader;
                    Logging.Write(_lockDB2.FileName + " loaded with " + _lockDB2.RecordsCount + " entries.");
                }
                else
                {
                    Logging.Write("DB2 Lock not read-able.");
                }
            }
        }
コード例 #7
0
ファイル: WoWItemClass.cs プロジェクト: zneel/TheNoobBot
        private static void Init() // todo make DBC loading shared accross all others reads with a better loading class.
        {
            if (_itemClassDB2 == null)
            {
                var mDefinitions = DBFilesClient.Load(Application.StartupPath + @"\Data\DBFilesClient\dblayout.xml");
                var definitions  = mDefinitions.Tables.Where(t => t.Name == "ItemClass");

                if (!definitions.Any())
                {
                    definitions = mDefinitions.Tables.Where(t => t.Name == Path.GetFileName("ItemClass"));
                }
                if (definitions.Count() == 1)
                {
                    var table = definitions.First();
                    _itemClassDB2 = DBReaderFactory.GetReader(Application.StartupPath + @"\Data\DBFilesClient\ItemClass.db2", table) as DB6Reader;
                    Logging.Write(_itemClassDB2.FileName + " loaded with " + _itemClassDB2.RecordsCount + " entries.");
                }
                else
                {
                    Logging.Write("DB2 ItemClass not read-able.");
                }
            }
        }