首先感謝djch發表的文章內含的工具L2å® ¢戶端dat文件解碼及還原工具:L2ClientDa t.exe
此解密工具作者為:阿迦
以及Asylum這個站下載的l2encdec26.zip
當開啟L2ClientDat.exe後發現能解密的DATæœ ‰:
01.itemname-cn.dat
02.servername-cn.dat
03.etcitemgrp.dat
04.npcgrp.dat
05.questname-cn.dat
06.chargrp-fc.dat
07.npcname-cn.dat
08.skillname-cn.dat
09.weapongrp.dat
10.armorgrp-fc.dat
11.skillgrp.dat
12. staticobject-cn.dat
分別對應台版的檔案為:
01.itemname-tw.dat
02.servername-tw.dat
03.etcitemgrp.dat
04.npcgrp.dat
05.questname-tw.dat
06.chargrp.dat
07.npcname-tw.dat
08.skillname-tw.dat
09.weapongrp.dat
10.armorgrp.dat
11.skillgrp.dat
12. staticobject-tw.dat
l2encdec26.zip解壓縮到某資料夾,例如: C:\l2encdec26,並且將要解密的DAT檔以及L 2ClientDat.exe複製到這目錄下,然後新增 一個純文字檔 (*.txt) ,將其改名為"解密.bat",檔名可以自己設定,不一定要叫"解密"~只要副檔名是.bat就可以了。PS.此檔已 經放在附件下載
利用文字編輯器編輯"解密.bat",將下面指令複製於檔案中,存檔。ç” ±於此檔 (解密.bat) 位於DAT文件的目錄,所以直接擊點"解密.bat"後會自動解密。(ps.若解密後沒有出現1 2個txt檔案,則表示DAT版本跟我的不一æ ¨£,那麼請自行找出沒有解密的檔案, 以及修改參數設定即可)
l2encdec -g itemname-tw.dat itemname-cn.dat
l2encdec -s servername-tw.dat servername-cn.dat
l2encdec -g etcitemgrp.dat etcitemgrp_1.dat
del etcitemgrp.dat
ren etcitemgrp_1.dat etcitemgrp.dat
l2encdec -s npcgrp.dat npcgrp_1.dat
del npcgrp.dat
ren npcgrp_1.dat npcgrp.dat
l2encdec -s questname-tw.dat quest name-cn.dat
l2encdec -s chargrp.dat chargrp-fc.dat
l2encdec -g npcname-tw.dat npcname-cn.dat
l2encdec -s skillname-tw.dat skillname-cn.dat
l2encdec -g weapongrp.dat weapongrp_1.dat
del weapongrp.dat
ren weapongrp_1.dat weapongrp.dat
l2encdec -g armorgrp.dat armorgrp-fc.dat
l2encdec -s skillgrp.dat skillgrp_1.dat
del skillgrp.dat
ren skillgrp_1.dat skillgrp.dat
l2encdec -s staticobject-tw.dat staticobject-cn.dat
接著開啟L2ClientDat.exe,並且選擇對應çš „檔名後按下解密即可。
若您需要解密SINA版,則注意l2encdec的å� ƒ數也許跟台版不同(沒測試過,所以不 太清楚@@~抱歉),然後直接使用L2ClientDa t.exe解密即可~~
還有,l2encdec26.zip內含有三個執行檔:
l2encdec.exe ← 解密用主程式
patcher.exe ← L2.exe解密工具,整個l2encdec26.zip必須解 壓縮到system目錄下,命令提示字元(目é Œ„位置必須切換到patcher.exe的位置)輸入 :patcher ,但要注意system目錄下不能有backup這å€ ‹資料夾,否則會報錯。聽說若沒有將L 2.exe解密,則用此工具還原的DAT檔無法 讀取!!
loader.exe ← 功能我不清楚~~我沒用到~~@@~
還原的部分我沒辦法測試耶^^"
先看看l2encdec.exe的說明:
L2 encoder/decoder version 2.6
You can find the latest version of this tool at http://dstuff.luftbrandzlung.org
Supported headers: 111, 121, 211, 212, 41x legacy, 41x patched
USAGE: l2encdec.exe <command> <source file> [destination file]
command (mandatory):
-d : decrypt
-s : decrypt + strip header
-l : decrypt legacy 41x
-g : decrypt legacy 41x + strip header
-e : encrypt
-h : <hdr> encrypt + use hdr encryption (choose from: 111, 121, 211, 212, 411, 412, 413)
因為參數h是需要加上解密的版本~~
例如:(使用此指令前,請先用L2ClientDa t還原)
l2encdec -h413 itemname-cn.dat itemname-tw.dat
請記得加上413在h參數後面。
不過之前我在測試解密的時候,使用äº †其中兩個參數 (-s/-g) 。而還原的部份也有兩個參數 (-e/-h),如此判斷還原時,應該是選擇 (-h)這個參數,會不會使用到-e這個參數我目前還不知道~~
不過總結,-h的後面要加上413~~
感謝20樓happything的實際操作,使用-h413這個參數是可以成功的還原及執行^ ^
大家可以去20樓看看happything大大的回è¦ †~謝謝~
L2ClientDat (chinese) (http://bbs.99nets.com/job.php?action=download&pid=tpc&tid=289377&aid=129379)
L2encdec 2.6 (http://bbs.99nets.com/job.php?action=download&pid=tpc&tid=289377&aid=129725)
nice guide, i'll explain how to decode dat files with kcinick php since l2clientdat doesn't decode all the dat files.
kcinick decoder can be found in any l2tools version.
First- Decrypt using l2encdec -s any dat file we want and move it to input folder.
ex:
l2encdec -s armorgrp.dat
then move dec-armorgrp.dat to our_folder\input\
right click on decode.bat, click on edit, that will open our notepad, and we have to select what file are we going to decode, in this case it will be armorgrp.dat, so we edit that like and will be like this one
..\php dumparmorgrp.php
the rest should be like
rem ..\php dumpcastlename.php
with the rem at the beggining so it will skip it.
save the bat and run it. it will create a decoded armorgrp.php in output folder.
this is how data is saved
$rs[0] = array("nose01" => "1", "id" => "21", "drop_type" => "0", "drop_anim_type" => "3", "drop_radius" => "7", "drop_height" => "0", "nose02" => "0", "drop_mesh" => "dropitems.drop_mfighter_m001_t02_u_m00", "drop_texture" => "MFighter.MFighter_m001_t02_u", "icon" => array("1" => "", "2" => "", "0" => "icon.armor_t02_u_i00"), "nose03" => "0", "nose04" => "0", "durability" => "90", "weight" => "4830", "material_type" => "cloth", "crystallizable" => "0", "nose06" => "44889960", "body_part" => "chest", "mfighter_mesh" => array("0" => "LineageWarriors.MFighter_m001_u"), "mfighter_texture" => array("0" => "MFighter.MFighter_m001_t02_u"), "ffighter_mesh" => array("0" => "LineageWarriors.FFighter_m001_u"), "ffighter_texture" => array("0" => "FFighter.FFighter_m001_t02_u"), "mdarkelf_mesh" => array("0" => "LineageWarriors.MDarkElf_m001_u"), "mdarkelf_texture" => array("0" => "MDarkElf.MDarkElf_m001_t02_u"), "fdarkelf_mesh" => array("0" => "LineageWarriors.FDarkElf_m001_u"), "fdarkelf_texture" => array("0" => "FDarkElf.FDarkElf_m001_t02_u"), "mdwarf_mesh" => array("0" => "LineageWarriors.MDwarf_m001_u"), "mdwarf_texture" => array("0" => "MDwarf.MDwarf_m001_t02_u"), "fdwarf_mesh" => array("0" => "LineageWarriors.FDwarf_m001_u"), "fdwarf_texture" => array("0" => "FDwarf.FDwarf_m001_t02_u"), "melf_mesh" => array("0" => "LineageWarriors.MElf_m001_u"), "melf_texture" => array("0" => "MElf.MElf_m001_t02_u"), "felf_mesh" => array("0" => "LineageWarriors.FElf_m001_u"), "felf_texture" => array("0" => "FElf.FElf_m001_t02_u"), "mmagic_mesh" => array("0" => "LineageWarriors.MMagic_m005_u"), "mmagic_texture" => array("0" => "MMagic.MMagic_m005_t02_u"), "fmagic_mesh" => array("0" => "LineageWarriors.FMagic_m003_u"), "fmagic_texture" => array("0" => "FMagic.FMagic_m003_t02_u"), "morc_mesh" => array("0" => "LineageWarriors.MOrc_m001_u"), "morc_texture" => array("0" => "MOrc.MOrc_m001_t02_u"), "forc_mesh" => array("0" => "LineageWarriors.FOrc_m001_u"), "forc_texture" => array("0" => "FOrc.FOrc_m001_t02_u"), "mshaman_mesh" => array("0" => "LineageWarriors.MShaman_m001_u"), "mshaman_texture" => array("0" => "MShaman.MShaman_m001_t02_u"), "fshaman_mesh" => array("0" => "LineageWarriors.FShaman_m001_u"), "fshaman_texture" => array("0" => "FShaman.FShaman_m001_t02_u"), "nose08" => "0", "nose09" => "0", "npc_mesh" => array("0" => ""), "npc_texture" => array("0" => ""), "attack_effect" => "LineageEffect.p_u002_a", "item_sound" => array("0" => "MonSound.Hit_normal_3", "1" => "MonSound.Hit_normal_12", "2" => "MonSound.Hit_wood_1", "3" => "MonSound.Hit_Shell_1"), "drop_sound" => "ItemSound.itemdrop_armor_cloth", "equip_sound" => "ItemSound.itemequip_armor_cloth", "armor_type" => "light", "crystal_type" => "none", "nose10" => "0", "physical_defense" => "36", "magical_defense" => "0", "mp_bonus" => "0");
$rs[1] = array("nose01" => "1", "id" => "22", "drop_type" => "0", "drop_anim_type" => "3", "drop_radius" => "7", "drop_height" => "0", "nose02" => "0", "drop_mesh" => "dropitems.drop_mfighter_m001_t04_u_m00", "drop_texture" => "MFighter.MFighter_m001_t04_u", "icon" => array("1" => "", "2" => "", "0" => "icon.armor_t04_u_i00"), "nose03" => "0", "nose04" => "0", "durability" => "90", "weight" => "4830", "material_type" => "leather", "crystallizable" => "0", "nose06" => "40956784", "body_part" => "chest", "mfighter_mesh" => array("0" => "LineageWarriors.MFighter_m001_u"), "mfighter_texture" => array("0" => "MFighter.MFighter_m001_t04_u"), "ffighter_mesh" => array("0" => "LineageWarriors.FFighter_m001_u"), "ffighter_texture" => array("0" => "FFighter.FFighter_m001_t04_u"), "mdarkelf_mesh" => array("0" => "LineageWarriors.MDarkElf_m001_u"), "mdarkelf_texture" => array("0" => "MDarkElf.MDarkElf_m001_t04_u"), "fdarkelf_mesh" => array("0" => "LineageWarriors.FDarkElf_m001_u"), "fdarkelf_texture" => array("0" => "FDarkElf.FDarkElf_m001_t04_u"), "mdwarf_mesh" => array("0" => "LineageWarriors.MDwarf_m001_u"), "mdwarf_texture" => array("0" => "MDwarf.MDwarf_m001_t04_u"), "fdwarf_mesh" => array("0" => "LineageWarriors.FDwarf_m001_u"), "fdwarf_texture" => array("0" => "FDwarf.FDwarf_m001_t04_u"), "melf_mesh" => array("0" => "LineageWarriors.MElf_m001_u"), "melf_texture" => array("0" => "MElf.MElf_m001_t04_u"), "felf_mesh" => array("0" => "LineageWarriors.FElf_m001_u"), "felf_texture" => array("0" => "FElf.FElf_m001_t04_u"), "mmagic_mesh" => array("0" => "LineageWarriors.MMagic_m005_u"), "mmagic_texture" => array("0" => "MMagic.MMagic_m005_t04_u"), "fmagic_mesh" => array("0" => "LineageWarriors.FMagic_m003_u"), "fmagic_texture" => array("0" => "FMagic.FMagic_m003_t04_u"), "morc_mesh" => array("0" => "LineageWarriors.MOrc_m001_u"), "morc_texture" => array("0" => "MOrc.MOrc_m001_t04_u"), "forc_mesh" => array("0" => "LineageWarriors.FOrc_m001_u"), "forc_texture" => array("0" => "FOrc.FOrc_m001_t04_u"), "mshaman_mesh" => array("0" => "LineageWarriors.MShaman_m001_u"), "mshaman_texture" => array("0" => "MShaman.MShaman_m001_t04_u"), "fshaman_mesh" => array("0" => "LineageWarriors.FShaman_m001_u"), "fshaman_texture" => array("0" => "FShaman.FShaman_m001_t04_u"), "nose08" => "0", "nose09" => "0", "npc_mesh" => array("0" => ""), "npc_texture" => array("0" => ""), "attack_effect" => "LineageEffect.p_u002_a", "item_sound" => array("0" => "MonSound.Hit_normal_3", "1" => "ItemSound.armor_leather_3", "2" => "ItemSound.armor_leather_4", "3" => "MonSound.Hit_Shell_1"), "drop_sound" => "ItemSound.itemdrop_armor_leather", "equip_sound" => "ItemSound.itemequip_armor_leather", "armor_type" => "light", "crystal_type" => "none", "nose10" => "0", "physical_defense" => "43", "magical_defense" => "0", "mp_bonus" => "0");
after editing it, save it and edit encode.bat as we did with encode.bat
..\php makearmorgrp.php
and the rem for the rest.
run it, and a encoded dat file will be created in modded folder. then encrypt it with l2encdec -h 412 o 413 deppending on ur l2 version.
:)
Program code for convert decoded skillname-*.dat to txt file or something else if you prefere C# ( converted from PHP with some changes )
If you know .Net, you can use it as example for all decoded *.dat files.
using System;
using System.IO;
using System.Text;
namespace EncDecLib.Dump
{
public class DumpSkillName
{
public DumpSkillName()
{
}
private static uint m__StartByte = 4;
private static string Delimiter = "\t";
public static string[] DumpFile(string m_FilePath, string m_Delimiter)
{
if(m_Delimiter != null)
Delimiter = m_Delimiter;
uint m_DataLength = Re(m_FilePath, 4, 0);
if(m__StartByte != 0)
{
string[] data = new string[m_DataLength];
for(int i=0; i < m_DataLength ; i++)
data[i] = GetString(m_FilePath, m__StartByte);
return data;
}
else return new string[]{"Unable to read decrypted file."};
}
private static string GetString(string m_FileName, uint m_StartByte)
{
using(FileStream fs = File.OpenRead(m_FileName))
{
string m_SkillName = null;
string m_SkillDescr = null;
string m_SkillID = Re(m_FileName, 4, m_StartByte).ToString();
m_StartByte += 4;
string m_SkillLevel = Re(m_FileName, 4, m_StartByte).ToString();
m_StartByte += 4;
uint m_SkillNameLength = GetStringLength(m_FileName, 1, m_StartByte);
m_StartByte++;
byte[] tmp = new byte[m_SkillNameLength];
fs.Position = m_StartByte;
fs.Read(tmp,0,tmp.Length);
m_SkillName = Encoding.ASCII.GetString(tmp);
m_StartByte += m_SkillNameLength;
uint m_SkillDescrLength = GetStringLength(m_FileName, 1, m_StartByte);
tmp = new byte[m_SkillDescrLength];
byte[] check = new byte[1];
fs.Position = m_StartByte + 1;
fs.Read(check,0,check.Length);
uint add_counter = 0;
else if(check[0] >= 1 || check[0] <= 9)
{
m_StartByte += 2;
fs.Position = m_StartByte;
byte[] unknown = new byte[1024];
fs.Read(unknown,0,unknown.Length);
while(unknown[add_counter] != 0)
{
add_counter++;
}
add_counter++;
}
else
m_StartByte += 1;
if(add_counter != 0)
tmp = new byte[add_counter];
fs.Position = m_StartByte;
fs.Read(tmp, 0, tmp.Length);
m_SkillDescr = Encoding.ASCII.GetString(tmp);
m_StartByte += (uint)tmp.Length;
m__StartByte = m_StartByte;
int m_length = m_SkillName.Length;
m_SkillName = m_SkillName.Substring(0,m_length--);
m_length = m_SkillDescr.Length;
m_SkillDescr = m_SkillDescr.Substring(0,m_length--);
return String.Format("{0}{4}{1}{4}{2}{4}{3}", m_SkillID, m_SkillLevel, m_SkillName, m_SkillDescr, Delimiter); //You may chanche output format as you wish
}
}
private static uint GetStringLength(string m_FileName, uint m_BytesToRead, uint m_StartReadingByte)
{
if(File.Exists(m_FileName))
{
FileStream m_FileStream = File.OpenRead(m_FileName);
BinaryReader m_BinaryReader = new BinaryReader(m_FileStream);
byte[] m_BinaryData = m_BinaryReader.ReadBytes(Convert.ToInt32(m_FileStr eam.Length));
byte[] m_Bytes = new byte[m_BytesToRead];
uint m_Tmp = m_StartReadingByte;
uint m_MaxToRead = m_StartReadingByte + m_BytesToRead;
int _c = 0;
for(uint i = m_StartReadingByte; i < m_MaxToRead; i++)
{
m_Bytes[_c] = m_BinaryData[m_Tmp];
m_Tmp++;
_c++;
}
return Convert.ToUInt32(Dump.HexEncoding.ToString(m_Bytes ), 16);
}
else
return 0;
}
private static uint Re(string m_FileName, uint m_BytesToRead, uint m_StartReadingByte)
{
if(File.Exists(m_FileName))
{
FileStream m_FileStream = File.OpenRead(m_FileName);
BinaryReader m_BinaryReader = new BinaryReader(m_FileStream);
byte[] m_BinaryData = m_BinaryReader.ReadBytes(Convert.ToInt32(m_FileStr eam.Length));
byte[] m_Bytes = new byte[m_BytesToRead];
uint m_Tmp = m_BytesToRead + m_StartReadingByte - 1;
uint m_MaxToRead = m_StartReadingByte + m_BytesToRead;
int _c = 0;
for(uint i = m_StartReadingByte; i < m_MaxToRead; i++)
{
m_Bytes[_c] = m_BinaryData[m_Tmp];
m_Tmp--;
_c++;
}
return Convert.ToUInt32(Dump.HexEncoding.ToString(m_Bytes ), 16);
}
else
return 0;
}
}
}
And class that's used for hex calculations
using System;
using System.Text;
namespace EncDecLib.Dump
{
public class HexEncoding
{
public HexEncoding()
{
}
public static int GetByteCount(string hexString)
{
int numHexChars = 0;
char c;
for (int i=0; i<hexString.Length; i++)
{
c = hexString[i];
if (IsHexDigit(c))
numHexChars++;
}
if (numHexChars % 2 != 0)
{
numHexChars--;
}
return numHexChars / 2;
}
public static byte[] GetBytes(string hexString, out int discarded)
{
discarded = 0;
string newString = "";
char c;
for (int i=0; i<hexString.Length; i++)
{
c = hexString[i];
if (IsHexDigit(c))
newString += c;
else
discarded++;
}
if (newString.Length % 2 != 0)
{
discarded++;
newString = newString.Substring(0, newString.Length-1);
}
int byteLength = newString.Length / 2;
byte[] bytes = new byte[byteLength];
string hex;
int j = 0;
for (int i=0; i<bytes.Length; i++)
{
hex = new String(new Char[] {newString[j], newString[j+1]});
bytes[i] = HexToByte(hex);
j = j+2;
}
return bytes;
}
public static string ToString(byte[] bytes)
{
string hexString = "";
for (int i=0; i<bytes.Length; i++)
{
hexString += bytes[i].ToString("X2");
}
return hexString;
}
public static bool InHexFormat(string hexString)
{
bool hexFormat = true;
foreach (char digit in hexString)
{
if (!IsHexDigit(digit))
{
hexFormat = false;
break;
}
}
return hexFormat;
}
public static bool IsHexDigit(Char c)
{
int numChar;
int numA = Convert.ToInt32('A');
int num1 = Convert.ToInt32('0');
c = Char.ToUpper(c);
numChar = Convert.ToInt32(c);
if (numChar >= numA && numChar < (numA + 6))
return true;
if (numChar >= num1 && numChar < (num1 + 10))
return true;
return false;
}
private static byte HexToByte(string hex)
{
if (hex.Length > 2 || hex.Length <= 0)
throw new ArgumentException("hex must be 1 or 2 characters in length");
byte newByte = byte.Parse(hex, System.Globalization.NumberStyles.HexNumber);
return newByte;
}
}
}
Using formatting (what you'll empliment) you'll be able to get array from strings like this (it's easy way to make file you want):
skill_begin skill_id = 3 skill_level = 1 name = [Power Strike] desc = [Gathers power for a fierce strike. Usable when a sword or blunt weapon is equipped. Power 25. Over-hit available.] skill_end
skill_begin skill_id = 3 skill_level = 2 name = [Power Strike] desc = [Gathers power for a fierce strike. Usable when a sword or blunt weapon is equipped. Power 27. Over-hit available.] skill_end
skill_begin skill_id = 3 skill_level = 3 name = [Power Strike] desc = [Gathers power for a fierce strike. Usable when a sword or blunt weapon is equipped. Power 30. Over-hit available.] skill_end
skill_begin skill_id = 3 skill_level = 4 name = [Power Strike] desc = [Gathers power for a fierce strike. Usable when a sword or blunt weapon is equipped. Power 39. Over-hit available.] skill_end
etc
etc
etc...
But..
Can anyone explane how l2encdec works?
What algorithm is used?
Thx for any information.
sorry my English
How to open, change and save correctly ***.u files in system folder of L2 client?
UTPT tool just view this files? but how change and save back to client i don't know
Actuall I dont know wth going on my computer. I could decrypt/encrypt l2.ini with command -s and -h 413. Now I can not.
-d s : Doesnt work. Error below:
Stream error detected during decompression.
There was an error during inner processing
-g -l: Works but after fixing ipaddress and ecrypt back then client doesnt run. Nothing happen when I click l2.exe in system folder.