Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server
You last visited: Today at 20:24

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

Advertisement



Help decrypting 4267 ItemType

Discussion on Help decrypting 4267 ItemType within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jun 2010
Posts: 19
Received Thanks: 2
Help decrypting 4267-4283 ItemType

Has anyone successfully decrypted the 4267-4283 itemtype.dat? I've tryed every datcryptor that has been released, and have searched for about 2 hours.

I'll post the itemtype. If anyone can decrypt it can you give me resources and or the file to do so with? Many thanks!

#EDIT

I suppose according to CptSky I'm looking for a binary reader/writer for the itemtype.dat, so yea. Any help guys?
Attached Files
File Type: rar itemtype.rar (62.6 KB, 29 views)
C#Nooby is offline  
Old 03/21/2012, 14:49   #2


 
CptSky's Avatar
 
elite*gold: 0
Join Date: Jan 2008
Posts: 1,434
Received Thanks: 1,147
Quote:
Originally Posted by C#Nooby View Post
Has anyone successfully decrypted the 4267-4283 itemtype.dat? I've tryed every datcryptor that has been released, and have searched for about 2 hours.

I'll post the itemtype. If anyone can decrypt it can you give me resources and or the file to do so with? Many thanks!
Why you say that it is encrypted?
CptSky is offline  
Old 03/21/2012, 15:06   #3
 
elite*gold: 0
Join Date: Jun 2010
Posts: 19
Received Thanks: 2
I don't quite understand what you mean.
C#Nooby is offline  
Old 03/21/2012, 15:34   #4


 
CptSky's Avatar
 
elite*gold: 0
Join Date: Jan 2008
Posts: 1,434
Received Thanks: 1,147
Quote:
Originally Posted by C#Nooby View Post
I don't quite understand what you mean.
You have searched for a decryptor without knowing if the file was encrypted or not. You supposed it was encrypted because it is impossible to read it in a text editor. Actually, it's not encrypted and you need to read the file in binary and convert it to text. Make a search for itemtype reader/dumper/editor before hum, something around 4348.
CptSky is offline  
Old 03/21/2012, 16:11   #5
 
elite*gold: 0
Join Date: Jun 2010
Posts: 19
Received Thanks: 2
I've searched using your following suggestions, closest thing I could find was someone asking the same question as mine, and you managed to give him a itemtype.ini. Do you have a binary reader/writer or know of one for this specific itemtype?
C#Nooby is offline  
Old 03/21/2012, 16:41   #6


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,125
Received Thanks: 2,518
You could write one, i've supplied a binary reader for the magictype.dat i believe, you could just convert that.
Korvacs is offline  
Thanks
1 User
Old 03/21/2012, 16:48   #7

 
Kiyono's Avatar
 
elite*gold: 20
Join Date: Jun 2006
Posts: 3,296
Received Thanks: 924
Quote:
Originally Posted by Korvacs View Post
You could write one, i've supplied a binary reader for the magictype.dat i believe, you could just convert that.
Actually, you released the binary reader for the 4267 itemtype, exactly what he wants but I guess that he also needs to be able to re-create an edited version which is something you didn't include.
Kiyono is offline  
Thanks
1 User
Old 03/21/2012, 16:59   #8
 
elite*gold: 0
Join Date: Jun 2010
Posts: 19
Received Thanks: 2
Haha, I am no where near that good to attempt such a thing. :P
C#Nooby is offline  
Old 03/21/2012, 17:02   #9


 
CptSky's Avatar
 
elite*gold: 0
Join Date: Jan 2008
Posts: 1,434
Received Thanks: 1,147
Quote:
Originally Posted by Kiyono View Post
Actually, you released the binary reader for the 4267 itemtype, exactly what he wants but I guess that he also needs to be able to re-create an edited version which is something you didn't include.
With a few edition of the CO2_CORE_DLL, he would be able to have a perfect reader/writer for the old itemtype...

Actually, he needs to remove some fields and to add the unique IDs part in the binary I/O.
CptSky is offline  
Old 03/21/2012, 17:14   #10


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,125
Received Thanks: 2,518
Quote:
Originally Posted by Kiyono View Post
Actually, you released the binary reader for the 4267 itemtype, exactly what he wants but I guess that he also needs to be able to re-create an edited version which is something you didn't include.
Ah, i wasnt sure which it was i had released, well there we go.
Korvacs is offline  
Old 03/21/2012, 17:41   #11
 
elite*gold: 0
Join Date: Jun 2010
Posts: 19
Received Thanks: 2
Can anyone throw something together for me with that CO2_CORE_DLL, I've been trying to figure it out. But I don't even know where to approach this.
C#Nooby is offline  
Old 03/21/2012, 19:01   #12

 
Kiyono's Avatar
 
elite*gold: 20
Join Date: Jun 2006
Posts: 3,296
Received Thanks: 924
Quote:
Originally Posted by C#Nooby View Post
Can anyone throw something together for me with that CO2_CORE_DLL, I've been trying to figure it out. But I don't even know where to approach this.
Actually, I attempted that before I saw Korvacs' post. It didn't work, 5017 itemtype is apparently different from the 4267 one.
Kiyono is offline  
Old 03/21/2012, 19:16   #13


 
CptSky's Avatar
 
elite*gold: 0
Join Date: Jan 2008
Posts: 1,434
Received Thanks: 1,147
This class will work... I added some things to the binary ItemType, plus I removed the new fields.

Code:
// * ************************************************************
// * * START:                                       itemtype.cs *
// * ************************************************************

// * ************************************************************
// *                      INFORMATIONS
// * ************************************************************
// * ItemType class for the library.
// * itemtype.cs
// * 
// * --
// *
// * Feel free to use this class in your projects, but don't
// * remove the header to keep the paternity of the class.
// * 
// * ************************************************************
// *                      CREDITS
// * ************************************************************
// * Originally created by CptSky (January 22th, 2012)
// * Copyright (C) 2012 CptSky
// *
// * ************************************************************

using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
using System.Runtime.InteropServices;

namespace CO2_CORE_DLL.IO
{
    /// <summary>
    /// ItemType
    /// </summary>
    public unsafe class ItemType
    {
        public const Int32 MAX_NAMESIZE = 0x10;
        public const Int32 MAX_DESCSIZE = 128;

        //Item monopoly bit field
        public const Int32 ITEM_MONOPOLY_MASK = 0x01;
        public const Int32 ITEM_STORAGE_MASK = 0x02;
        public const Int32 ITEM_DROP_HINT_MASK = 0x04;
        public const Int32 ITEM_SELL_HINT_MASK = 0x08;
        public const Int32 ITEM_NEVER_DROP_WHEN_DEAD_MASK = 0x10;
        public const Int32 ITEM_SELL_DISABLE_MASK = 0x20;

        //Item status bit field
        public const Int32 ITEM_STATUS_NONE = 0;
        public const Int32 ITEM_STATUS_NOT_IDENT = 1;
        public const Int32 ITEM_STATUS_CANNOT_REPAIR = 2;
        public const Int32 ITEM_STATUS_NEVER_DAMAGE = 4;
        public const Int32 ITEM_STATUS_MAGIC_ADD = 8;

        [StructLayout(LayoutKind.Sequential, Pack = 1)]
        public struct Entry
        {
            public Int32 ID;
            public fixed Byte Name[MAX_NAMESIZE];
            public Byte RequiredProfession;
            public Byte RequiredWeaponSkill;
            public Byte RequiredLevel;
            public Byte RequiredSex;
            public UInt16 RequiredForce;
            public UInt16 RequiredSpeed;
            public UInt16 RequiredHealth;
            public UInt16 RequiredSoul;
            public Byte Monopoly;
            public UInt16 Weight;
            public UInt32 Price;
            public Int32 Action; //cq_action
            public UInt16 MaxAttack;
            public UInt16 MinAttack;
            public Int16 Defense;
            public Int16 Dexterity;
            public Int16 Dodge;
            public Int16 Life;
            public Int16 Mana;
            public UInt16 Amount;
            public UInt16 AmountLimit; // x / 100
            public Byte Status;
            public Byte Gem1;
            public Byte Gem2;
            public Byte Magic1;
            public Byte Magic2;
            public Byte Magic3;
            public UInt16 MagicAttack;
            public UInt16 MagicDefence;
            public UInt16 Range;
            public UInt16 AttackSpeed;
            public fixed Byte Desc[MAX_DESCSIZE];
        };

        private Dictionary<Int32, IntPtr> Entries = null;

        /// <summary>
        /// Create a new ItemType instance to handle the TQ's ItemType file.
        /// </summary>
        public ItemType()
        {
            this.Entries = new Dictionary<Int32, IntPtr>();
        }

        ~ItemType()
        {
            Clear();
        }

        /// <summary>
        /// Reset the dictionary and free all the used memory.
        /// </summary>
        public void Clear()
        {
            if (Entries != null)
            {
                lock (Entries)
                {
                    foreach (IntPtr Ptr in Entries.Values)
                        Kernel.free((Entry*)Ptr);
                }
                Entries.Clear();
            }
        }

        /// <summary>
        /// Load the specified itemtype file (in custom binary format) into the dictionary.
        /// </summary>
        public void LoadFromDat(String Path)
        {
            Clear();

            lock (Entries)
            {
                using (FileStream Stream = new FileStream(Path, FileMode.Open, FileAccess.Read, FileShare.Read))
                {
                    Byte[] Buffer = new Byte[Kernel.MAX_BUFFER_SIZE];
                    Entries = new Dictionary<Int32, IntPtr>();

                    Int32 Amount = 0;
                    Stream.Read(Buffer, 0, sizeof(Int32));
                    fixed (Byte* pBuffer = Buffer)
                        Amount = *((Int32*)pBuffer);

                    //Bypass all the useless UIDs that are repeated in the entries...
                    Stream.Seek(sizeof(Int32) * Amount, SeekOrigin.Current);

                    for (Int32 i = 0; i < Amount; i++)
                    {
                        Entry* pEntry = (Entry*)Kernel.malloc(sizeof(Entry));
                        Kernel.memcpy((Byte*)pEntry, Buffer, sizeof(Entry));

                        if (!Entries.ContainsKey(pEntry->ID))
                            Entries.Add(pEntry->ID, (IntPtr)pEntry);
                    }
                }
            }
        }

        /// <summary>
        /// Load the specified itemtype file (in plain format) into the dictionary.
        /// </summary>
        public void LoadFromTxt(String Path)
        {
            Clear();

            lock (Entries)
            {
                using (StreamReader Stream = new StreamReader(Path, Encoding.GetEncoding("Windows-1252")))
                {
                    Entries = new Dictionary<Int32, IntPtr>();

                    String Line = null;
                    Int32 LineC = 0;
                    while ((Line = Stream.ReadLine()) != null)
                    {
                        if (LineC == 0) //Amount = X
                        {
                            LineC++;
                            continue;
                        }
                        LineC++;

                        String[] Parts = Line.Split(' ');
                        Entry* pEntry = (Entry*)Kernel.calloc(sizeof(Entry));

                        try
                        {
                            pEntry->ID = Int32.Parse(Parts[0]);
                            Kernel.memcpy(pEntry->Name, Parts[1].ToPointer(), Math.Min(MAX_NAMESIZE - 1, Parts[1].Length));
                            pEntry->RequiredProfession = Byte.Parse(Parts[2]);
                            pEntry->RequiredWeaponSkill = Byte.Parse(Parts[3]);
                            pEntry->RequiredLevel = Byte.Parse(Parts[4]);
                            pEntry->RequiredSex = Byte.Parse(Parts[5]);
                            pEntry->RequiredForce = UInt16.Parse(Parts[6]);
                            pEntry->RequiredSpeed = UInt16.Parse(Parts[7]);
                            pEntry->RequiredHealth = UInt16.Parse(Parts[8]);
                            pEntry->RequiredSoul = UInt16.Parse(Parts[9]);
                            pEntry->Monopoly = Byte.Parse(Parts[10]);
                            pEntry->Weight = UInt16.Parse(Parts[11]);
                            pEntry->Price = UInt32.Parse(Parts[12]);
                            pEntry->Action = Int32.Parse(Parts[13]);
                            pEntry->MaxAttack = UInt16.Parse(Parts[14]);
                            pEntry->MinAttack = UInt16.Parse(Parts[15]);
                            pEntry->Defense = Int16.Parse(Parts[16]);
                            pEntry->Dexterity = Int16.Parse(Parts[17]);
                            pEntry->Dodge = Int16.Parse(Parts[18]);
                            pEntry->Life = Int16.Parse(Parts[19]);
                            pEntry->Mana = Int16.Parse(Parts[20]);
                            pEntry->Amount = UInt16.Parse(Parts[21]);
                            pEntry->AmountLimit = UInt16.Parse(Parts[22]);
                            pEntry->Status = Byte.Parse(Parts[23]);
                            pEntry->Gem1 = Byte.Parse(Parts[24]);
                            pEntry->Gem2 = Byte.Parse(Parts[25]);
                            pEntry->Magic1 = Byte.Parse(Parts[26]);
                            pEntry->Magic2 = Byte.Parse(Parts[27]);
                            pEntry->Magic3 = Byte.Parse(Parts[28]);
                            pEntry->MagicAttack = UInt16.Parse(Parts[29]);
                            pEntry->MagicDefence = UInt16.Parse(Parts[30]);
                            pEntry->Range = UInt16.Parse(Parts[31]);
                            pEntry->AttackSpeed = UInt16.Parse(Parts[32]);
                            Kernel.memcpy(pEntry->Desc, Parts[33].ToPointer(), Math.Min(MAX_DESCSIZE - 1, Parts[33].Length));

                            if (!Entries.ContainsKey(pEntry->ID))
                                Entries.Add(pEntry->ID, (IntPtr)pEntry);
                        }
                        catch (Exception Exc)
                        {
                            Console.WriteLine("Error at line {0}.\n{1}", LineC, Exc);
                            Kernel.free(pEntry);
                        }
                    }
                }
            }
        }

        /// <summary>
        /// Save all the dictionary to the specified itemtype file (in custom binary format).
        /// </summary>
        public void SaveToDat(String Path)
        {
            using (FileStream Stream = new FileStream(Path, FileMode.Create, FileAccess.ReadWrite, FileShare.Read))
            {
                Byte[] Buffer = new Byte[Kernel.MAX_BUFFER_SIZE];
                IntPtr[] Pointers = new IntPtr[0];

                lock (Entries)
                {
                    Pointers = new IntPtr[Entries.Count];
                    Entries.Values.CopyTo(Pointers, 0);
                }

                Int32 Amount = Pointers.Length;
                Kernel.memcpy(Buffer, &Amount, sizeof(Int32));
                Stream.Write(Buffer, 0, sizeof(Int32));

                for (Int32 i = 0; i < Pointers.Length; i++)
                {
                    Int32 UniqId = ((Entry*)Pointers[i])->ID;
                    Kernel.memcpy(Buffer, &UniqId, sizeof(Int32));
                    Stream.Write(Buffer, 0, sizeof(Int32));
                }

                for (Int32 i = 0; i < Pointers.Length; i++)
                {
                    Kernel.memcpy(Buffer, (Entry*)Pointers[i], sizeof(Entry));
                    Stream.Write(Buffer, 0, sizeof(Entry));
                }
            }
        }

        /// <summary>
        /// Save all the dictionary to the specified itemtype file (in plain format).
        /// </summary>
        public void SaveToTxt(String Path)
        {
            using (StreamWriter Stream = new StreamWriter(Path, false, Encoding.GetEncoding("Windows-1252")))
            {
                IntPtr[] Pointers = new IntPtr[0];

                lock (Entries)
                {
                    Pointers = new IntPtr[Entries.Count];
                    Entries.Values.CopyTo(Pointers, 0);
                }

                Stream.WriteLine("Amount={0}", Pointers.Length);
                for (Int32 i = 0; i < Pointers.Length; i++)
                {
                    Entry* pEntry = (Entry*)Pointers[i];

                    StringBuilder Builder = new StringBuilder(Kernel.MAX_BUFFER_SIZE);
                    Builder.Append(pEntry->ID + " ");
                    Builder.Append(Kernel.cstring(pEntry->Name, MAX_NAMESIZE) + " ");
                    Builder.Append(pEntry->RequiredProfession + " ");
                    Builder.Append(pEntry->RequiredWeaponSkill + " ");
                    Builder.Append(pEntry->RequiredLevel + " ");
                    Builder.Append(pEntry->RequiredSex + " ");
                    Builder.Append(pEntry->RequiredForce + " ");
                    Builder.Append(pEntry->RequiredSpeed + " ");
                    Builder.Append(pEntry->RequiredHealth + " ");
                    Builder.Append(pEntry->RequiredSoul + " ");
                    Builder.Append(pEntry->Monopoly + " ");
                    Builder.Append(pEntry->Weight + " ");
                    Builder.Append(pEntry->Price + " ");
                    Builder.Append(pEntry->Action + " ");
                    Builder.Append(pEntry->MaxAttack + " ");
                    Builder.Append(pEntry->MinAttack + " ");
                    Builder.Append(pEntry->Defense + " ");
                    Builder.Append(pEntry->Dexterity + " ");
                    Builder.Append(pEntry->Dodge + " ");
                    Builder.Append(pEntry->Life + " ");
                    Builder.Append(pEntry->Mana + " ");
                    Builder.Append(pEntry->Amount + " ");
                    Builder.Append(pEntry->AmountLimit + " ");
                    Builder.Append(pEntry->Status + " ");
                    Builder.Append(pEntry->Gem1 + " ");
                    Builder.Append(pEntry->Gem2 + " ");
                    Builder.Append(pEntry->Magic1 + " ");
                    Builder.Append(pEntry->Magic2 + " ");
                    Builder.Append(pEntry->Magic3 + " ");
                    Builder.Append(pEntry->MagicAttack + " ");
                    Builder.Append(pEntry->MagicDefence + " ");
                    Builder.Append(pEntry->Range + " ");
                    Builder.Append(pEntry->AttackSpeed + " ");
                    Builder.Append(Kernel.cstring(pEntry->Desc, MAX_DESCSIZE));
                    Stream.WriteLine(Builder.ToString());
                }
            }
        }

        /// <summary>
        /// Get the number of key/value pairs contained in the dictionary.
        /// </summary>
        public Int32 Count { get { return Entries.Count; } }

        /// <summary>
        /// Get an array containing the keys of the dictionary.
        /// </summary>
        public Int32[] Keys
        {
            get
            {
                lock (Entries)
                {
                    Int32[] Keys = new Int32[Entries.Count];
                    Entries.Keys.CopyTo(Keys, 0);
                    return Keys;
                }
            }
        }

        /// <summary>
        /// Get an array containing the values of the dictionary.
        /// </summary>
        public Entry[] Values
        {
            get
            {
                lock (Entries)
                {
                    Entry[] Values = new Entry[Entries.Count];

                    Int32 i = 0;
                    foreach (IntPtr Ptr in Entries.Values)
                    {
                        fixed (Entry* pEntry = &Values[i])
                            Kernel.memcpy(pEntry, (Entry*)Ptr, sizeof(Entry));
                        i++;
                    }
                    return Values;
                }
            }
        }

        /// <summary>
        /// Determine whether the dictionary contains the specified key.
        /// </summary>
        public Boolean ContainsKey(Int32 ID)
        {
            lock (Entries)
            {
                if (Entries.ContainsKey(ID))
                    return true;
            }
            return false;
        }

        /// <summary>
        /// Get the information of the specified type for the specified item.
        /// To get a valid string for some fields, use Kernel.cstring function.
        /// </summary>
        public Boolean TryGetValue(Int32 ID, out Entry Entry)
        {
            Entry = new Entry();
            lock (Entries)
            {
                if (Entries.ContainsKey(ID))
                {
                    fixed (Entry* pEntry = &Entry)
                        Kernel.memcpy(pEntry, (Entry*)Entries[ID], sizeof(Entry));
                    return true;
                }
            }
            return false;
        }

        /// <summary>
        /// Add the item's information in the dictionary.
        /// It can be used to create an editor or an temp item.
        /// </summary>
        public Boolean Add(Entry Entry)
        {
            lock (Entries)
            {
                if (!Entries.ContainsKey(Entry.ID))
                {
                    Entry* pEntry = (Entry*)Kernel.calloc(sizeof(Entry));
                    Kernel.memcpy(pEntry, &Entry, sizeof(Entry));

                    Entries.Add(Entry.ID, (IntPtr)pEntry);
                    return true;
                }
            }
            return false;
        }

        /// <summary>
        /// Delete the item's information in the dictionary.
        /// </summary>
        public Boolean Remove(Int32 ID)
        {
            lock (Entries)
            {
                if (Entries.ContainsKey(ID))
                {
                    Entries.Remove(ID);
                    return true;
                }
            }
            return false;
        }

        /// <summary>
        /// Update the item's information in the dictionary.
        /// </summary>
        public Boolean Update(Int32 ID, Entry Entry)
        {
            lock (Entries)
            {
                if (Entries.ContainsKey(ID))
                {
                    Kernel.memcpy((Entry*)Entries[ID], &Entry, sizeof(Entry));
                    return true;
                }
            }
            return false;
        }
    }
}

// * ************************************************************
// * * END:                                         itemtype.cs *
// * ************************************************************
CptSky is offline  
Thanks
1 User
Old 03/21/2012, 21:05   #14
 
elite*gold: 0
Join Date: Jun 2010
Posts: 19
Received Thanks: 2
***, I've tried so much, I updated the ItemType.cs and rebuilt the project. And I've referenced the dll to my exe project, now how do I call upon the write/read functions of the dll?
C#Nooby is offline  
Old 03/22/2012, 12:23   #15

 
Kiyono's Avatar
 
elite*gold: 20
Join Date: Jun 2006
Posts: 3,296
Received Thanks: 924
Quote:
Originally Posted by C#Nooby View Post
***, I've tried so much, I updated the ItemType.cs and rebuilt the project. And I've referenced the dll to my exe project, now how do I call upon the write/read functions of the dll?
Not that hard. I'll assume that you're using windows forms and that you have 2 buttons.
Add the .dll reference first then double click the button and it will bring you to the code that the button will execute when clicked.
The code should look like this:
ItemType IT = new ItemType();
IT.LoadFromDat("itemtype.dat"); //using itemtype.dat assumes that the itemtype is in the same folder as the exe.
IT.SaveToTxt("itemtype.txt");
That should convert .dat -> .txt, now for the .txt -> .dat. Double click the other button and stick in this:
ItemType IT = new ItemType();
IT.LoadFromTxt("itemtype.txt");
IT.SaveToDat("itemtype.dat");
The actual code might look different but I don't have access to a compiler right now so can't check.
Kiyono is offline  
Reply


Similar Threads Similar Threads
[Release]Loading the 4267 Itemtype.dat
04/09/2012 - CO2 PServer Guides & Releases - 7 Replies
I recently got a pm about loading the itemtype.dat from the 4267 client and decided i would just make a release for it, this is how i do it anyway. This will not work for the later clients because they are setup differently. First you will need a data structure to hold the information your going to load, this could be a class if you really wanted although i dont recommend it. Im using a struct: public struct ItemDetail { public string Name, Description; ...
[Request/Help] 4267 ItemType Decrypted
12/02/2009 - CO2 Private Server - 9 Replies
Hi all! i need help in how to decrypt or if someone can decrypt it for me please... Obs.: already try to decrypt with many programs but doesn't works.... someone can help me please.... Here is :



All times are GMT +2. The time now is 20:24.


Powered by vBulletin®
Copyright ©2000 - 2024, 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 ©2024 elitepvpers All Rights Reserved.