예제 #1
0
        public static void SynchronizeD2o <T>(string d2oName, string nameOutput = "")
        {
            if (nameOutput == "")
            {
                nameOutput = d2oName.ToLower();
            }

            Reader = new D2oReader(BasePath + d2oName + ".d2o");

            var collection = Database.GetCollection <T>(nameOutput);

            if (collection == null)
            {
                Database.CreateCollection(nameOutput);
                collection = Database.GetCollection <T>(nameOutput);
            }

            int counter = 0;

            foreach (var item in Reader.ReadObjects())
            {
                counter++;
                collection.InsertOne((T)item.Value);
                Console.WriteLine("{0} {1}/{2} added.", d2oName, counter, Reader.IndexCount);
            }

            Console.WriteLine("Collection generated :)", nameOutput);
        }
예제 #2
0
        public static void GetItems(string basePath)
        {
            Reader = new D2oReader(basePath + "Items.d2o");

            var collection = Database.GetCollection <Item>("items");

            if (collection == null)
            {
                Database.CreateCollection("items");
                collection = Database.GetCollection <Item>("items");
            }

            int counter = 0;

            foreach (var item in Reader.ReadObjects())
            {
                if (!item.Value.GetType().Name.Contains("Item"))
                {
                    continue;
                }

                counter++;
                collection.InsertOne((Item)item.Value);
                Console.WriteLine("items {0}/{1} added.", counter, Reader.IndexCount);
            }

            Console.WriteLine("Collection generated :)");

            Console.ReadKey();
        }
예제 #3
0
        public static void GetMonsters(string basePath)
        {
            Reader = new D2oReader(basePath + "Monsters.d2o");

            var collection = Database.GetCollection <Monster>("monsters");

            if (collection == null)
            {
                Database.CreateCollection("monsters");
                collection = Database.GetCollection <Monster>("monsters");
            }

            int counter = 0;

            foreach (var item in Reader.ReadObjects())
            {
                try
                {
                    counter++;
                    collection.InsertOne((Monster)item.Value);
                    Console.WriteLine("monsters {0}/{1} added.", counter, Reader.IndexCount);
                }
                catch
                {
                }
            }

            Console.WriteLine("Collection generated :)");

            Console.ReadKey();
        }
예제 #4
0
        public static void GetSpellsVariants(string basePath)
        {
            Reader = new D2oReader(basePath + "SpellVariants.d2o");

            var collection = Database.GetCollection <SpellVariant>("spells_variants");

            if (collection == null)
            {
                Database.CreateCollection("spells_variants");
                collection = Database.GetCollection <SpellVariant>("spells_variants");
            }

            int counter = 0;

            foreach (var item in Reader.ReadObjects())
            {
                counter++;
                collection.InsertOne((SpellVariant)item.Value);
                Console.WriteLine("spells variants {0}/{1} added.", counter, Reader.IndexCount);
            }

            Console.WriteLine("Collection generated :)");

            Console.ReadKey();
        }
예제 #5
0
        public static void GetSpellsLevels(string basePath)
        {
            Reader = new D2oReader(basePath + "SpellLevels.d2o");

            var collection = Database.GetCollection <SpellLevel>("spells_levels");

            if (collection == null)
            {
                Database.CreateCollection("spells_levels");
                collection = Database.GetCollection <SpellLevel>("spells_levels");
            }

            int counter = 0;

            foreach (var item in Reader.ReadObjects())
            {
                try
                {
                    collection.InsertOne((SpellLevel)item.Value);
                    counter++;
                    Console.WriteLine("spells levels {0}/{1} added.", counter, Reader.IndexCount);
                }
                catch
                {
                    Console.WriteLine("error try again");
                }
            }

            Console.WriteLine("Collection generated :)");

            Console.ReadKey();
        }
예제 #6
0
        public void Initialize(string tableName)
        {
            this.TableName = tableName;
            this.List      = new List <MapPosition>();


            D2oReader reader = new D2oReader("common/" + this.TableName + ".d2o");

            foreach (var obj in reader.ReadObjects())
            {
                this.List.Add((MapPosition)obj.Value);
            }

            reader.Close();

            Console.WriteLine("{0} map positions loaded from d2o.", this.List.Count);
        }
예제 #7
0
        public static void GetCharacterXpAndGuildMapping()
        {
            Reader = new D2oReader(BasePath + "CharacterXPMappings.d2o");

            List <LevelDetail> charactersExp = new List <LevelDetail>();
            List <LevelDetail> guildExp      = new List <LevelDetail>();

            foreach (var item in Reader.ReadObjects())
            {
                CharacterXPMapping content = (CharacterXPMapping)item.Value;
                charactersExp.Add(new LevelDetail(content.Level, content.ExperiencePoints));

                if (content.Level < 201)
                {
                    guildExp.Add(new LevelDetail(content.Level, content.ExperiencePoints * 10));
                }
            }

            Task.Run(async() => await ConvertListToCollection <LevelDetail>("characters_experiences", charactersExp)).Wait();
            Task.Run(async() => await ConvertListToCollection <LevelDetail>("guilds_experiences", guildExp)).Wait();
        }
예제 #8
0
        public void Initialize(string tableName)
        {
            this.TableName = tableName;
            //this.Accessor = new RepositoryAccessor(this.TableName);

            this.List = new List <Burning.DofusProtocol.Datacenter.Head>();

            D2oReader reader = new D2oReader("common/" + this.TableName + ".d2o");

            for (int i = 1; i < reader.IndexCount + 1; i++)
            {
                try
                {
                    this.List.Add((Burning.DofusProtocol.Datacenter.Head)reader.ReadObject(i));
                }
                catch
                {
                }
            }
            reader.Close();
        }