Ejemplo n.º 1
0
        static void bbb()
        {
            Program.gdata.AllDungeonMapID.Add(0x9225);
            Program.gdata.AllDungeonMapID.Add(0x70C6);
            Program.gdata.AllDungeonMapID.Add(0xCA19);
            Program.gdata.AllDungeonMapID.Add(0xD747);
            Program.gdata.AllDungeonMapID.Add(0xC11F);
            Program.gdata.AllDungeonMapID.Add(0xDD87);
            Program.gdata.AllDungeonMapID.Add(0xEF29);
            Program.gdata.AllDungeonMapID.Add(0x7441);
            Program.gdata.AllDungeonMapID.Add(0xB593);
            Program.gdata.AllDungeonMapID.Add(0x93F5);
            Program.gdata.AllDungeonMapID.Add(0xF17F);
            Program.gdata.AllDungeonMapID.Add(0x8F82);
            Program.gdata.AllDungeonMapID.Add(0x1420);
            Program.gdata.AllDungeonMapID.Add(0x43F7);
            Program.gdata.AllDungeonMapID.Add(0xB469);
            Program.gdata.AllDungeonMapID.Add(0x9155);
            Program.gdata.AllDungeonMapID.Add(0x8F4);
            Program.gdata.AllDungeonMapID.Add(0x43B4);
            Program.gdata.AllDungeonMapID.Add(0xE5C);
            Program.gdata.AllDungeonMapID.Add(0x3BA1);
            Program.gdata.AllDungeonMapID.Add(0x296B);
            Program.gdata.AllDungeonMapID.Add(0xAD52);
            Program.gdata.AllDungeonMapID.Add(0xCB66);
            Program.gdata.AllDungeonMapID.Add(0x1920);
            Program.gdata.AllDungeonMapID.Add(0xDBD9);
            Program.gdata.AllDungeonMapID.Add(0x6BC9);
            Program.gdata.AllDungeonMapID.Add(0x4CE0);
            Program.gdata.AllDungeonMapID.Add(0x2259);
            Program.gdata.AllDungeonMapID.Add(0x6FED);
            Program.gdata.AllDungeonMapID.Add(0xA980);
            Program.gdata.AllDungeonMapID.Add(0xFF7);
            Program.gdata.AllDungeonMapID.Add(0x845);
            Program.gdata.AllDungeonMapID.Add(0xB470);
            Program.gdata.AllDungeonMapID.Add(0x2113);
            Program.gdata.AllDungeonMapID.Add(0x3D0F);
            Program.gdata.AllDungeonMapID.Add(0x6D7);
            Program.gdata.AllDungeonMapID.Add(0xE98A);
            Program.gdata.AllDungeonMapID.Add(0x3F68);
            Program.gdata.AllDungeonMapID.Add(0xCB99);
            Program.gdata.AllDungeonMapID.Add(0xD769);
            Program.gdata.AllDungeonMapID.Add(0xCE5B);
            Program.gdata.AllDungeonMapID.Add(0xBEDB);
            Program.gdata.AllDungeonMapID.Add(0xF9B4);
            Program.gdata.AllDungeonMapID.Add(0xA5B4);
            Program.gdata.AllDungeonMapID.Add(0x7C9D);
            Program.gdata.AllDungeonMapID.Add(0x637A);
            Program.gdata.AllDungeonMapID.Add(0xD353);
            Program.gdata.AllDungeonMapID.Add(0xCE7);
            Program.gdata.AllDungeonMapID.Add(0xF5EB);
            Program.gdata.AllDungeonMapID.Add(0x80C4);
            Program.gdata.AllDungeonMapID.Add(0x3D3C);
            Program.gdata.AllDungeonMapID.Add(0xCB4B);
            /////////////////////////////////////////////////////////////
            BattleMapInfo map = null;
            //   string filename = @"d:\llllllll.bat";
            string filename = @"llllllll.bat";
            Stream fStream  = null;

            try
            {
                fStream = new FileStream(filename, FileMode.Open, FileAccess.ReadWrite);
            }
            catch (Exception e)
            {
                return;
            }
            int             n         = 0;
            BinaryFormatter binFormat = new BinaryFormatter();

            while (true)
            {
                try
                {
                    map = (BattleMapInfo)binFormat.Deserialize(fStream);
                    string Key = null;
                    switch (map.Level)
                    {
                    case 1:
                        Key = map.strMapName + "*一般";
                        break;

                    case 2:
                        Key = map.strMapName + "*殘酷";
                        break;

                    case 3:
                        Key = map.strMapName + "*無情";
                        break;
                    }
                    try
                    {
                        gdata.AllBattleMap.Add(Key, map);
                    }
                    catch (Exception ee)
                    {
                    }
                }
                catch (Exception e)
                {
                    break;
                }
                ++n;
            }
            //     MessageBox.Show(n.ToString());
            fStream.Close();
            /////////////////////////////////////
            TownMapInfo townmap = null;
            //      string filenametown = @"d:\lllllllll.bat";
            string filenametown = @"lllllllll.bat";
            Stream ftownStream  = null;

            try
            {
                ftownStream = new FileStream(filenametown, FileMode.Open, FileAccess.ReadWrite);
            }
            catch (Exception e)
            {
                return;
            }
            BinaryFormatter binTownFormat = new BinaryFormatter();

            while (true)
            {
                try
                {
                    townmap = (TownMapInfo)binTownFormat.Deserialize(ftownStream);
                    gdata.AllTownMap.Add(townmap.MapID, townmap);
                    gdata.AllTownMapID.Add(townmap.MapID);
                }
                catch (Exception e)
                {
                    break;
                }
            }
            ftownStream.Close();
            ////////////////////////////////////////
        }
Ejemplo n.º 2
0
        static void aaa()
        {
            HashSet <int> filter   = new HashSet <int>();
            FileStream    fsFilter = new FileStream("D:\\中文\\GEN地图ID.txt", FileMode.Open, FileAccess.ReadWrite);
            StreamReader  srFilter = new StreamReader(fsFilter);

            while (true)
            {
                try
                {
                    string text = srFilter.ReadLine();
                    if (text.Length < 1)
                    {
                        break;
                    }

                    string[] ret = text.Split(',');
                    int      f   = Convert.ToInt32(ret[2], 10);
                    filter.Add(f);
                }
                catch (Exception e)
                {
                    break;
                }
            }
            fsFilter.Close();
            //创建新的导出文件
            BattleMapInfo map = new BattleMapInfo();

            map.Block = 0;
            map.Type  = 0;
            //map.strMapName = "测试测试";
            string filename = @"llllllll.bat";
            Stream fStream  = null;

            try
            {
                fStream = new FileStream(filename, FileMode.Create, FileAccess.ReadWrite);
            }
            catch (Exception e)
            {
                return;
            }
            BinaryFormatter binFormat = new BinaryFormatter();
            /////////////////////////////////////
            TownMapInfo townmap      = new TownMapInfo();
            string      filenametown = @"lllllllll.bat";
            Stream      ftownStream  = null;

            try
            {
                ftownStream = new FileStream(filenametown, FileMode.Create, FileAccess.ReadWrite);
            }
            catch (Exception e)
            {
                return;
            }
            BinaryFormatter binTownFormat = new BinaryFormatter();
            ////////////////////////////////////////
            FileStream   fs = new FileStream("d:\\所有地图ID.txt", FileMode.Open, FileAccess.ReadWrite);
            StreamReader sr = new StreamReader(fs);
            int          n  = 0;

            while (true)
            {
                try
                {
                    string text = sr.ReadLine();
                    if (text.Length < 1)
                    {
                        break;
                    }

                    string[] ret = text.Split('|');

                    int    id       = Convert.ToInt32(ret[2], 16);
                    string strGroup = null;
                    if (ret[0].Substring(2, 1) == "1")
                    {
                        strGroup  = "第一章";
                        map.Group = 1;
                    }
                    else if (ret[0].Substring(2, 1) == "2")
                    {
                        strGroup  = "第二章";
                        map.Group = 2;
                    }
                    else if (ret[0].Substring(2, 1) == "3")
                    {
                        strGroup  = "第三章";
                        map.Group = 3;
                    }

                    if (ret[0].Substring(0, 1) == "1")
                    {
                        map.Level = 1;
                        Console.WriteLine("一般," + ret[1] + "," + id.ToString() + "," + strGroup);
                    }
                    else if (ret[0].Substring(0, 1) == "2")
                    {
                        map.Level = 2;
                        Console.WriteLine("殘酷," + ret[1] + "," + id.ToString() + "," + strGroup);
                    }
                    else if (ret[0].Substring(0, 1) == "3")
                    {
                        map.Level = 3;
                        Console.WriteLine("無情," + ret[1] + "," + id.ToString() + "," + strGroup);
                    }

                    if (ret[1] == "獅眼守望")
                    {
                        townmap.Level         = map.Level;
                        townmap.MapID         = id;
                        townmap.strMapName    = ret[1];
                        townmap.NPCNum        = 1;
                        townmap.NPCSellMenu   = 21;
                        townmap.SellNPCPos.x  = 275;
                        townmap.SellNPCPos.y  = 263;
                        townmap.WaypointPos.x = 186;
                        townmap.WaypointPos.y = 164;
                        townmap.TransferPos.x = 153;
                        townmap.TransferPos.y = 231;
                        townmap.StoragePos.x  = 243;
                        townmap.StoragePos.y  = 262;

                        binTownFormat.Serialize(ftownStream, townmap);
                        Console.WriteLine("主城:" + ret[1]);
                        continue;
                    }
                    if (ret[1] == "森林營地")
                    {
                        townmap.Level         = map.Level;
                        townmap.MapID         = id;
                        townmap.strMapName    = ret[1];
                        townmap.NPCNum        = 2;
                        townmap.NPCSellMenu   = 18;
                        townmap.SellNPCPos.x  = 200;
                        townmap.SellNPCPos.y  = 179;
                        townmap.WaypointPos.x = 188;
                        townmap.WaypointPos.y = 116;
                        townmap.TransferPos.x = 249;
                        townmap.TransferPos.y = 163;

                        townmap.StoragePos.x = 193;
                        townmap.StoragePos.y = 199;
                        binTownFormat.Serialize(ftownStream, townmap);
                        continue;
                    }
                    if (ret[1] == "薩恩營地")
                    {
                        townmap.Level         = map.Level;
                        townmap.MapID         = id;
                        townmap.strMapName    = ret[1];
                        townmap.NPCNum        = 3;
                        townmap.NPCSellMenu   = 50;
                        townmap.SellNPCPos.x  = 281;
                        townmap.SellNPCPos.y  = 357;
                        townmap.WaypointPos.x = 219;
                        townmap.WaypointPos.y = 211;
                        townmap.TransferPos.x = 248;
                        townmap.TransferPos.y = 220;

                        townmap.StoragePos.x = 211;
                        townmap.StoragePos.y = 307;
                        binTownFormat.Serialize(ftownStream, townmap);
                        continue;
                    }
                    if (false == filter.Contains(id))
                    {
                        continue;
                    }
                    //if (map.Level!=1)
                    //    Console.WriteLine("");
                    map.MapID      = id;
                    map.strMapName = ret[1];
                    ++n;
                    binFormat.Serialize(fStream, map);
                }
                catch (Exception e)
                {
                    break;
                }
            }
            MessageBox.Show(n.ToString());
            fs.Close();
            fStream.Close();
            ftownStream.Close();
        }