When I do that, I get no error, It Only Reads The First Map, Then It Stops.
Why don't you instead, create a program that decodes the gamemap.dat, change the mapid, then encode it again?
#Edit;
Made the program for you, I haven't tested it fully, so there MIGHT be bugs with it, but I tested it a few times and it worked. So try it.
Here's what it does;
It reads the game map.dat and for each map information read(Mapid, Puzzlesize, Path, Pathlength) it creates a new MapInfo(); and saves the map information read, to a new MapInfo();
It then adds the new information to a dictionary, so it can be used later on.
But if the dictionary already holds the information for a certain mapid, then it creates a "randomly" generated map id, then checks if the dictionary already holds that id, if it does hold the new ID, then it generates a new id. Once the program is fully done with that gamemap.dat, it creates a new gamemap.dat file and writes the TotalMaps, then foreach value in the dictionary, it writes the values' information, to the same structure of gamemap.dat.
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace GameMap
{
public class MapInfo
{
public uint MapID;
public string Path;
public int PathLength;
public int PuzzleSize;
}
class Program
{
static String Path = @"C:\Users\Arco\Desktop\kkkkk\ini\GameMap.dat";
static Dictionary<uint, MapInfo> Dict = new Dictionary<uint, MapInfo>();
static Random Random = new Random();
static String NewPath = @"C:\Users\Arco\Desktop\GameMap.dat";
static void Main(string[] args)
{
Console.Title = "GameMap.dat";
uint TotalMaps;
using (BinaryReader Reader = new BinaryReader(new FileStream(Path, FileMode.Open)))
{
TotalMaps = Reader.ReadUInt32();
Console.WriteLine("Writing....");
for (int i = 0; i < TotalMaps; i++)
{
uint Mapid = Reader.ReadUInt32();
int Length = Reader.ReadInt32();
string newPath = Encoding.ASCII.GetString(Reader.ReadBytes(Length));
int Puz = Reader.ReadInt32();
MapInfo Map = new MapInfo();
Map.MapID = Mapid;
Map.PathLength = Length;
Map.Path = newPath;
Map.PuzzleSize = Puz;
if (!Dict.ContainsKey(Mapid))
{
Dict.Add(Mapid, Map);
}
else
{
trythis:
uint newMap = (uint)Random.Next(1200, 2000);
if (!Dict.ContainsKey(newMap))
{
Map.MapID = newMap;
Dict.Add(newMap, Map);
Console.WriteLine("The map ID " + Mapid + " was a copy, so it was replaced with the new ID, " + newMap);
}
else
{
goto trythis;
}
}
}
Reader.Close();
}
Console.WriteLine("Done!");
Console.WriteLine("Press enter to begin writing the data to a new GameMap.dat");
Console.ReadLine();
FileStream Fil = new FileStream(NewPath, FileMode.Create);
BinaryWriter BW = new BinaryWriter(Fil);
BW.Write(TotalMaps);
foreach (MapInfo Info in Dict.Values)
{
BW.Write(Info.MapID);
BW.Write(Info.PathLength);
BW.Write(Info.Path);
BW.Write(Info.PuzzleSize);
}
Console.WriteLine("Done!");
Console.WriteLine("Finished writing a new GameMap.dat...");
Console.WriteLine("Press enter to close the program...");
Console.ReadLine();
}
}
}
Why don't you instead, create a program that decodes the gamemap.dat, change the mapid, then encode it again?
#Edit;
Made the program for you, I haven't tested it fully, so there MIGHT be bugs with it, but I tested it a few times and it worked. So try it.
Here's what it does;
It reads the game map.dat and for each map information read(Mapid, Puzzlesize, Path, Pathlength) it creates a new MapInfo(); and saves the map information read, to a new MapInfo();
It then adds the new information to a dictionary, so it can be used later on.
But if the dictionary already holds the information for a certain mapid, then it creates a "randomly" generated map id, then checks if the dictionary already holds that id, if it does hold the new ID, then it generates a new id. Once the program is fully done with that gamemap.dat, it creates a new gamemap.dat file and writes the TotalMaps, then foreach value in the dictionary, it writes the values' information, to the same structure of gamemap.dat.
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace GameMap
{
public class MapInfo
{
public uint MapID;
public string Path;
public int PathLength;
public int PuzzleSize;
}
class Program
{
static String Path = @"C:\Users\Arco\Desktop\kkkkk\ini\GameMap.dat";
static Dictionary<uint, MapInfo> Dict = new Dictionary<uint, MapInfo>();
static Random Random = new Random();
static String NewPath = @"C:\Users\Arco\Desktop\GameMap.dat";
static void Main(string[] args)
{
Console.Title = "GameMap.dat";
uint TotalMaps;
using (BinaryReader Reader = new BinaryReader(new FileStream(Path, FileMode.Open)))
{
TotalMaps = Reader.ReadUInt32();
Console.WriteLine("Writing....");
for (int i = 0; i < TotalMaps; i++)
{
uint Mapid = Reader.ReadUInt32();
int Length = Reader.ReadInt32();
string newPath = Encoding.ASCII.GetString(Reader.ReadBytes(Length));
int Puz = Reader.ReadInt32();
MapInfo Map = new MapInfo();
Map.MapID = Mapid;
Map.PathLength = Length;
Map.Path = newPath;
Map.PuzzleSize = Puz;
if (!Dict.ContainsKey(Mapid))
{
Dict.Add(Mapid, Map);
}
else
{
trythis:
uint newMap = (uint)Random.Next(1200, 2000);
if (!Dict.ContainsKey(newMap))
{
Map.MapID = newMap;
Dict.Add(newMap, Map);
Console.WriteLine("The map ID " + Mapid + " was a copy, so it was replaced with the new ID, " + newMap);
}
else
{
goto trythis;
}
}
}
Reader.Close();
}
Console.WriteLine("Done!");
Console.WriteLine("Press enter to begin writing the data to a new GameMap.dat");
Console.ReadLine();
FileStream Fil = new FileStream(NewPath, FileMode.Create);
BinaryWriter BW = new BinaryWriter(Fil);
BW.Write(TotalMaps);
foreach (MapInfo Info in Dict.Values)
{
BW.Write(Info.MapID);
BW.Write(Info.PathLength);
BW.Write(Info.Path);
BW.Write(Info.PuzzleSize);
}
Console.WriteLine("Done!");
Console.WriteLine("Finished writing a new GameMap.dat...");
Console.WriteLine("Press enter to close the program...");
Console.ReadLine();
}
}
}
[Release]GameMap creator/dumper 05/06/2012 - CO2 PServer Guides & Releases - 23 Replies Well this is the first application I ever made and I decided to share it here and the source is included.
When executed you'll see 2 buttons, Create GameMap.dat and Dump GameMap.dat.
Create GameMap.dat will add a new map to the GameMap.dat (specified in the config.ini)
Dump GameMap.dat will dump a list of map names/IDs/sizes in a text file.
The config file:
[MiniRelease] Make new GameMap.dat work with Korv's DmapHandler 02/16/2012 - CO2 PServer Guides & Releases - 6 Replies Ok so for those who don't know...
GameMap.dat in new clients refers to the new packed dmaps that tq uses (.7z). This poses an issue for those wanting to use Korv's dmap handler for their server/bot/etc. It will give all sorts of errors because it is trying to read .7z files as though they were still .DMaps.
This simple program edits your GameMap.dat file to change extensions back to .dmaps.
TO USE
Select all .7z files in the map folder and extract them. Winrar does this without...
Decoding GameMap.dat 09/21/2010 - CO2 Programming - 15 Replies Well I was working on a project tonite, it was decoding Gamemap.dat.
Thanks to the help of haydz I finally got this and it works!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace ConsoleApplication1
tnx 4 reading dis 07/15/2008 - Cabal Online - 6 Replies the past versions(1.05 and 1.06) is not working on my pc as well as this new version(1.07). the control panel do not pop up when my char has logged in on to the game. i did turned my firewall off and my deepfreeze. i also checked files as well and updated GG before starting CR
i tried to download it on a shop and it worked 100%!
can someone explain me this?
i'm using windows xp
@badburn
tol tga bacoor ako sa camella springville
here's my YM: