Ejemplo n.º 1
0
 public GameLearnset(string name, LvLearnset lv, EggLearnset egg, TMHMTutorLearnset tm, TMHMTutorLearnset tutor, TMHMTutorLearnset hm, TMHMTutorLearnset e1, TMHMTutorLearnset e2)
 {
     Name  = name;
     Lv    = lv;
     Egg   = egg;
     TM    = tm;
     Tutor = tutor;
     HM    = hm;
     E1    = e1;
     E2    = e2;
 }
Ejemplo n.º 2
0
        private static void LoadEgg(Stream stream, EggLearnset egg)
        {
            var moves = new List <int>();

            using (var sr = new StreamReader(stream))
                for (string line = sr.ReadLine(); !string.IsNullOrWhiteSpace(line); line = sr.ReadLine())
                {
                    //[0].[1] [2],[3]...
                    var s = line.Split(SPLIT_CHARS, StringSplitOptions.RemoveEmptyEntries);
                    for (int i = 2; i < s.Length; ++i)
                    {
                        moves.Add(int.Parse(s[i]));
                    }
                    if (moves.Any())
                    {
                        egg.Set(int.Parse(s[0]), moves.ToArray());
                        moves.Clear();
                    }
                }
        }
Ejemplo n.º 3
0
        internal Learnset()
        {
            Index = new GenLearnset[RomData.GEN - 2];
            var dll = System.Reflection.Assembly.GetExecutingAssembly();

            using (var index = new StreamReader(dll.GetManifestResourceStream("PokemonBattleOnline.Game.dat.Learnset.index.txt")))
            {
                var gll    = new GenLearnset(3);
                var lvs    = new Dictionary <string, LvLearnset>();
                var tmhmts = new Dictionary <string, TMHMTutorLearnset>();
                var eggs   = new Dictionary <string, EggLearnset>();
                for (var line = index.ReadLine(); !string.IsNullOrWhiteSpace(line); line = index.ReadLine())
                {
                    var s   = line.Split(SPLIT_CHARS, StringSplitOptions.RemoveEmptyEntries);
                    var gen = int.Parse(s[0]);
                    if (gen != gll.Gen)
                    {
                        Index[gll.Gen - 3] = gll;
                        gll = new GenLearnset(gen);
                    }
                    LvLearnset        lv = null;
                    EggLearnset       egg = null;
                    TMHMTutorLearnset tm = null, hm = null, tutor = null, e1 = null, e2 = null;
                    for (int i = 2; i < s.Length; ++i)
                    {
                        var table = s[i];
                        switch (table[1])
                        {
                        case 'e':     //Level
                        {
                            lv = lvs.ValueOrDefault(table);
                            if (lv == null)
                            {
                                lv = new LvLearnset();
                                LoadLevel(dll.GetManifestResourceStream("PokemonBattleOnline.Game.dat.Learnset." + table + ".txt"), lv);
                                lvs.Add(table, lv);
                            }
                        }
                        break;

                        case 'g':     //Egg
                        {
                            egg = eggs.ValueOrDefault(table);
                            if (egg == null)
                            {
                                egg = new EggLearnset();
                                LoadEgg(dll.GetManifestResourceStream("PokemonBattleOnline.Game.dat.Learnset." + table + ".txt"), egg);
                                eggs.Add(table, egg);
                            }
                        }
                        break;

                        case 'M':     //TMHM
                        {
                            var needHM = gen == RomData.GEN;
                            var g      = table.Substring(5);
                            var tmk    = "TM_" + g;
                            tm = tmhmts.ValueOrDefault(tmk);
                            if (tm == null)
                            {
                                tm = new TMHMTutorLearnset();
                                if (needHM)
                                {
                                    hm = new TMHMTutorLearnset();
                                }
                                LoadTMHM(dll.GetManifestResourceStream("PokemonBattleOnline.Game.dat.Learnset." + table + ".txt"), tm, hm);
                                tmhmts.Add(tmk, tm);
                                if (needHM)
                                {
                                    tmhmts.Add("HM_" + g, hm);
                                }
                            }
                            else if (needHM)
                            {
                                hm = tmhmts["HM_" + g];
                            }
                        }
                        break;

                        case 'u':     //Tutor
                        {
                            tutor = tmhmts.ValueOrDefault(table);
                            if (tutor == null)
                            {
                                tutor = new TMHMTutorLearnset();
                                LoadTutor(dll.GetManifestResourceStream("PokemonBattleOnline.Game.dat.Learnset." + table + ".txt"), tutor);
                                tmhmts.Add(table, tutor);
                            }
                        }
                        break;

                        case 'v':     //Event
                        {
                            var e = tmhmts.ValueOrDefault(table);
                            if (e == null)
                            {
                                e = new TMHMTutorLearnset();
                                LoadEvents(dll.GetManifestResourceStream("PokemonBattleOnline.Game.dat.Learnset." + table + ".txt"), e);
                                tmhmts.Add(table, e);
                            }
                            if (e1 == null)
                            {
                                e1 = e;
                            }
                            else
                            {
                                e2 = e;
                            }
                        }
                        break;
                        }
                    }//for (int i = 2;
                    gll.Add(s[1], lv, egg, tm, tutor, hm, e1, e2);
                }
                Index[gll.Gen - 3] = gll;
            }
        }
Ejemplo n.º 4
0
 internal void Add(string game, LvLearnset lv, EggLearnset egg, TMHMTutorLearnset tm, TMHMTutorLearnset tutor, TMHMTutorLearnset hm, TMHMTutorLearnset e1, TMHMTutorLearnset e2)
 {
     games.Add(game, new GameLearnset(game, lv, egg, tm, tutor, hm, e1, e2));
 }