Register for your free account! | Forgot your password?

You last visited: Today at 11:27

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



MagicType.dat 5017

Discussion on MagicType.dat 5017 within the CO2 Programming forum part of the Conquer Online 2 category.

Reply
 
Old   #1

 
Kiyono's Avatar
 
elite*gold: 20
Join Date: Jun 2006
Posts: 3,296
Received Thanks: 925
MagicType.dat 5017

Well since the source downgrading progress ran into some problems (client closing as soon as other entities appeared) and I couldn't fix it, I decided to mess around with something else that has always bothered me; the magictype.dat for lower patches.

This is the code I have for converting the MagicType.dat to MagicType.txt:
Code:
private void button2_Click(object sender, EventArgs e)
        {
            IniFile Ini = new IniFile("./Config.ini");

            ConquerPath = Ini.ReadString("Config", "ConquerPath", "");
            OutputPath = Ini.ReadString("Config", "OutputPath", "");

            StreamWriter Writer = new StreamWriter(new FileStream(OutputPath + @"MagicType.txt", FileMode.Create));
            using (BinaryReader Reader = new BinaryReader(new FileStream(ConquerPath + @"MagicType.dat", FileMode.Open)))
            {
                int TotalSpells = Reader.ReadInt32();

                for (int i = 0; i < TotalSpells; i++)
                {

                    Writer.WriteLine(Reader.ReadInt32() + " " +
                        Reader.ReadInt32() + " " +
                        Encoding.ASCII.GetString(Reader.ReadBytes(16)) + " " +
                        Reader.ReadInt32() + " " +
                        Reader.ReadInt32() + " " +
                        Reader.ReadInt32() + " " +
                        Reader.ReadInt32() + " " +
                        Reader.ReadInt32() + " " +
                        Reader.ReadInt32() + " " +
                        Reader.ReadInt32() + " " +
                        Reader.ReadInt32() + " " +
                        Reader.ReadInt32() + " " +
                        Reader.ReadInt32() + " " +
                        Reader.ReadInt32() + " " +
                        Reader.ReadInt32() + " " +
                        Reader.ReadInt32() + " " +
                        Reader.ReadInt32() + " " +
                        Reader.ReadInt32() + " " +
                        Reader.ReadInt32() + " " +
                        Reader.ReadInt32() + " " +
                        Reader.ReadInt32() + " " +
                        Reader.ReadInt32() + " " +
                        Reader.ReadInt32() + " " +
                        Reader.ReadInt32() + " " +
                        Reader.ReadInt32() + " " +
                        Reader.ReadInt32() + " " +
                        Reader.ReadInt32() + " " +
                        Reader.ReadInt32() + " " +
                        Reader.ReadInt32() + " " +
                        Reader.ReadInt32() + " " +
                        Reader.ReadInt32() + " " +
                        Reader.ReadInt32() + " " +
                        Reader.ReadInt32() + " " +
                        Reader.ReadInt32() + " " +
                        Encoding.ASCII.GetString(Reader.ReadBytes(64)) + " " +
                        Encoding.ASCII.GetString(Reader.ReadBytes(256)) + " " +
                        Encoding.ASCII.GetString(Reader.ReadBytes(64)) + " " +
                        Encoding.ASCII.GetString(Reader.ReadBytes(260)) + " " +
                        Encoding.ASCII.GetString(Reader.ReadBytes(64)) + " " +
                        Encoding.ASCII.GetString(Reader.ReadBytes(260)) + " " +
                        Reader.ReadInt32() + " " +
                        Encoding.ASCII.GetString(Reader.ReadBytes(64)) + " " +
                        Encoding.ASCII.GetString(Reader.ReadBytes(260)) + " " +
                        Encoding.ASCII.GetString(Reader.ReadBytes(64)) + " " +
                        Encoding.ASCII.GetString(Reader.ReadBytes(64)) + " " +
                        Reader.ReadInt32() + " " +
                        Reader.ReadInt32() + " " +
                        Reader.ReadInt32());
                }
                MessageBox.Show("Finished");
            }
            Writer.Flush();
            Writer.Close();
        }
It's based on this post:
Quote:
Originally Posted by nTL3fTy View Post
Magictype.dat structure:
datatypename
intamount
uint[amount]id
MagicType[amount]magictypes

MagicType structure:

I believe this should be all you need to parse the file. The id mentioned in the beginning of the file is type*10+level. With that information, you can build a dictionary.
But I probably applied it in the wrong way since the result is quite odd, I attached it to this post.

Any help?
Attached Files
File Type: rar MagicTypeTXTDAT.rar (29.9 KB, 35 views)
Kiyono is offline  
Old 12/27/2011, 16:55   #2
 
Zero47's Avatar
 
elite*gold: 0
Join Date: Dec 2011
Posts: 76
Received Thanks: 14
Trying to decrypt that for ages, still couldn't. Wanted to get it decrypted so I can modify the spells and then encrypt it back. I don't have my code used to decrypt that but mine was decrypting it in another way (the result was more accurate but it didn't decrypted the whole .dat dunno why, it was messy also).
Zero47 is offline  
Old 12/27/2011, 19:23   #3
 
nTL3fTy's Avatar
 
elite*gold: 0
Join Date: Jun 2005
Posts: 692
Received Thanks: 353
There are several different versions of Magictype.dat, but it looks like the Magictype.dat in the archive is valid for that structure.

Here's some code that will load it correctly:
Extensions:
Code:
public static class Extensions
{
    public static string ReadCString(this BinaryReader reader, int size)
    {
        return Encoding.ASCII.GetString(reader.ReadBytes(size)).Split('\0')[0];
    }
}
Magictype:
Code:
public class Magictype
{
    public uint Id;
    public uint Type;
    public uint Sort;
    public string Name;
    public uint Crime;
    public uint Ground;
    public uint Multi;
    public uint Target;
    public uint Level;
    public uint UseMana;
    public int Power;
    public uint IntoneSpeed;
    public uint Percent;
    public uint StepSecs;
    public uint Range;
    public uint Distance;
    public uint Status;
    public uint NeedProfession;
    public uint NeedExperience;
    public uint NeedLevel;
    public uint UseXp;
    public uint WeaponSubtype;
    public uint ActiveTimes;
    public uint AutoActive;
    public uint FloorAttr;
    public uint AutoLearn;
    public uint LearnLevel;
    public uint DropWeapon;
    public uint UseStamina;
    public uint WeaponHit;
    public uint UseItem;
    public uint NextMagic;
    public uint DelayMS;
    public uint UseItemNum;
    public uint SenderAction;
    public string Description;
    public string DescriptionEx;
    public string IntoneEffect;
    public string IntoneSound;
    public string SenderEffect;
    public string SenderSound;
    public uint TargetDelay;
    public string TargetEffect;
    public string TargetSound;
    public string GroundEffect;
    public string TraceEffect;
    public uint ScreenRepresent;
    public uint UseInMarket;
    public uint TargetWoundDelay;

    public Magictype(uint id, BinaryReader reader)
    {
        Id = id;
        Type = reader.ReadUInt32();
        Sort = reader.ReadUInt32();
        Name = reader.ReadCString(16);
        Crime = reader.ReadUInt32();
        Ground = reader.ReadUInt32();
        Multi = reader.ReadUInt32();
        Target = reader.ReadUInt32();
        Level = reader.ReadUInt32();
        UseMana = reader.ReadUInt32();
        Power = reader.ReadInt32();
        IntoneSpeed = reader.ReadUInt32();
        Percent = reader.ReadUInt32();
        StepSecs = reader.ReadUInt32();
        Range = reader.ReadUInt32();
        Distance = reader.ReadUInt32();
        Status = reader.ReadUInt32();
        NeedProfession = reader.ReadUInt32();
        NeedExperience = reader.ReadUInt32();
        NeedLevel = reader.ReadUInt32();
        UseXp = reader.ReadUInt32();
        WeaponSubtype = reader.ReadUInt32();
        ActiveTimes = reader.ReadUInt32();
        AutoActive = reader.ReadUInt32();
        FloorAttr = reader.ReadUInt32();
        AutoLearn = reader.ReadUInt32();
        LearnLevel = reader.ReadUInt32();
        DropWeapon = reader.ReadUInt32();
        UseStamina = reader.ReadUInt32();
        WeaponHit = reader.ReadUInt32();
        UseItem = reader.ReadUInt32();
        NextMagic = reader.ReadUInt32();
        DelayMS = reader.ReadUInt32();
        UseItemNum = reader.ReadUInt32();
        SenderAction = reader.ReadUInt32();

        Description = reader.ReadCString(64);
        DescriptionEx = reader.ReadCString(256);

        IntoneEffect = reader.ReadCString(64);
        IntoneSound = reader.ReadCString(260);

        SenderEffect = reader.ReadCString(64);
        SenderSound = reader.ReadCString(260);

        TargetDelay = reader.ReadUInt32();

        TargetEffect = reader.ReadCString(64);
        TargetSound = reader.ReadCString(260);

        GroundEffect = reader.ReadCString(64);
        TraceEffect = reader.ReadCString(64);

        ScreenRepresent = reader.ReadUInt32();
        UseInMarket = reader.ReadUInt32();
        TargetWoundDelay = reader.ReadUInt32();
    }
}
MagictypeFile:
Code:
public class MagictypeFile
{
    private readonly IDictionary<uint, Magictype> _magictypes;

    public MagictypeFile(string path)
        : this(File.OpenRead(path))
    {
    }

    public MagictypeFile(Stream stream)
    {
        _magictypes = new Dictionary<uint, Magictype>();

        using (var reader = new BinaryReader(stream))
        {
            // read the number of entries in the file
            var amount = reader.ReadInt32();

            // read the magictype unique id list
            var idArray = new uint[amount];
            for (var i = 0; i < amount; i++)
            {
                idArray[i] = reader.ReadUInt32();
            }

            // read magictypes now
            for (var i = 0; i < amount; i++)
            {
                var id = idArray[i];
                var magictype = new Magictype(id, reader);

                if (_magictypes.ContainsKey(id))
                {
                    _magictypes.Remove(id);
                }

                _magictypes.Add(id, magictype);
            }
        }
    }
}
Usage:
Code:
var file = new MagictypeFile("MagicType.dat");
nTL3fTy is offline  
Thanks
3 Users
Old 12/28/2011, 16:35   #4
 
elite*gold: 0
Join Date: Jun 2006
Posts: 457
Received Thanks: 67
my thanks to nTL3fTy for the detailed class defn for magictype. I never knew what most of the fields are meant for. I only knew a couples fields that are can be understood directly by doing numeric comparisons.
shitboi is offline  
Old 12/28/2011, 16:56   #5

 
Kiyono's Avatar
 
elite*gold: 20
Join Date: Jun 2006
Posts: 3,296
Received Thanks: 925
Oh, I already received a PM with a working en/decrypter, thanks though.
Kiyono is offline  
Reply


Similar Threads Similar Threads
[Help] MagicType.txt
03/13/2010 - CO2 Private Server - 3 Replies
can anyone read this sample code from Magictype.txt pls. 1380 22 Dance2 0 0 0 2 0 0 0 0 100 0 0 5 0 0 0 0 2 0 0 0 0 0 0 0 10 0 0 0 0 1 2 Fixed Dance born4 sound\ball1.wav NULL NULL 0 NULL sound\Health.wav NULL NULL 0 1 0
[RELEASE]Big Project..5095,5065,5017,5017 (command Server)
10/01/2009 - CO2 PServer Guides & Releases - 23 Replies
Hi, Yes i made a big project with my self by my self i host i edit i control i code. The Project contain 3 Co plvling Servers and 1 Command server the plvling servers are Snow Server and Treasure island . snow server works with 5065 client and it have alot of edits , adds , well i have made 135 gears and you can upgrade it in market from De La Vega for 250k CPS for each item also you should get 1 blessing amulet to make dmg -1 and you can get it by killing 1000 Birdman or 1000 Snake man or...
[Help] i need MagicType.dat have the Skill Ninja on Client 5017 Please help
07/01/2009 - CO2 Private Server - 3 Replies
Now My have problem join the Skill Ninja in Client 5017 1- i Copy MagicType.dat in Client 5095 and my got the problem in the Verason how my get the Skill Ninja Please Help.... And all know how my Finsh the problem or all have MagicType.dat have Ninja and uesd on Client 5017 Give my please all Help And thanks :mofo:



All times are GMT +1. The time now is 11:29.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.