[Clientless] Get skill name using skill id

06/16/2019 01:56 Roxeez#1
Everything is in the title, is it possible to get the skill name using it's id
I want to populate a collection with all the skills of the player (when ski packet is received, but i want to show the "real" name of the skill, i've unpacked NSlangData.NOS file, i've found a code_"language"_Skill file containing all the skill name/description but i can't find a way to "link" the skill id and the id in the code_Skill file, for example Hawk eye id in file is zts476e but id in packet is something like 8XX, so do i need to make the "link" between them myself or there is way to get the correct name directly ?
06/16/2019 02:17 MarsBounty#2
[Only registered and activated users can see links. Click Here To Register...]
06/16/2019 03:06 FI0w#3
Quote:
Originally Posted by Roxeez View Post
Everything is in the title, is it possible to get the skill name using it's id
I want to populate a collection with all the skills of the player (when ski packet is received, but i want to show the "real" name of the skill, i've unpacked NSlangData.NOS file, i've found a code_"language"_Skill file containing all the skill name/description but i can't find a way to "link" the skill id and the id in the code_Skill file, for example Hawk eye id in file is zts476e but id in packet is something like 8XX, so do i need to make the "link" between them myself or there is way to get the correct name directly ?
get the Skill id search it in the skill.dat get the zts for name and search it in the code_language_skill file and tada done.

or just import on startup all skills replace each zts by real name from the language file and done.
06/16/2019 16:07 Bejine#4
NSgtdData.NOS -> Skill.dat
you can split by #===... (57 times the "=" sign) and ignore every line but the ones starting with "VNUM" and "NAME", notice there are tabulators (\t) in the beginning of each line and also it's the delimiter for values.
The ID from the packet is the VNUM, and the line under has got your desired zts_e value.
So you'll have to create a list of VNUM=>ztsID, preferably at the start of the clientless.
06/16/2019 21:13 Roxeez#5
Ok thanks, everything seems to work
  1. Decrypt NSgtdData.NOS then get skill id (VNUM) and skill name id(NAME) in Skill.dat
  2. Decrypt NSlangData.NOS get the string value from _code_"languageId"_Skill.txt

That's the c# decryptor class i've "made" based on OnexExplorer decryptor maybe someone will need it idk
Code:
/// <summary>
/// C# version of https://github.com/OnexTale/OnexExplorer/blob/master/Source/Decryptors/NosTextDatFileDecryptor.cpp
/// </summary>
public class NosTextDatFileDecryptor
{
    private readonly byte[] CryptoArray = { 0x00, 0x20, 0x2D, 0x2E, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x0A, 0x00 };


    public string Decrypt(byte[] bytes)
    {
        var decrypted = new StringBuilder();

        int index = 0;

        while (index < bytes.Length)
        {
            byte current = bytes[index];
            index++;

            if (current == 0xFF)
            {
                decrypted.Append(Convert.ToChar(0xD));
                continue;
            }

            int validate = current & 0x7F;

            if ((current & 0x80) != 0)
            {
                for (; validate > 0; validate -= 2)
                {
                    if (index >= bytes.Length)
                        break;

                    current = bytes[index];
                    index++;

                    byte firstByte = CryptoArray[(current & 0xF0) >> 4];
                    decrypted.Append(Convert.ToChar(firstByte));

                    if (validate <= 1)
                        break;

                    byte secondByte = CryptoArray[current & 0xF];

                    if (secondByte == 0)
                        break;

                    decrypted.Append(Convert.ToChar(secondByte));
                }
            }
            else
            {
                for (; validate > 0; --validate)
                {
                    if (index >= bytes.Length)
                        break;

                    current = bytes[index];
                    index++;

                    decrypted.Append(Convert.ToChar((byte)(current ^ 0x33)));
                }
            }
        }
        return decrypted.ToString();
    }
}
06/17/2019 00:21 AfterLife-#6
Quote:
Originally Posted by Roxeez View Post
Ok thanks, everything seems to work
  1. Decrypt NSgtdData.NOS then get skill id (VNUM) and skill name id(NAME) in Skill.dat
  2. Decrypt NSlangData.NOS get the string value from _code_"languageId"_Skill.txt

That's the c# decryptor class i've "made" based on OnexExplorer decryptor maybe someone will need it idk
Code:
/// <summary>
/// C# version of https://github.com/OnexTale/OnexExplorer/blob/master/Source/Decryptors/NosTextDatFileDecryptor.cpp
/// </summary>
public class NosTextDatFileDecryptor
{
    private readonly byte[] CryptoArray = { 0x00, 0x20, 0x2D, 0x2E, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x0A, 0x00 };


    public string Decrypt(byte[] bytes)
    {
        var decrypted = new StringBuilder();

        int index = 0;

        while (index < bytes.Length)
        {
            byte current = bytes[index];
            index++;

            if (current == 0xFF)
            {
                decrypted.Append(Convert.ToChar(0xD));
                continue;
            }

            int validate = current & 0x7F;

            if ((current & 0x80) != 0)
            {
                for (; validate > 0; validate -= 2)
                {
                    if (index >= bytes.Length)
                        break;

                    current = bytes[index];
                    index++;

                    byte firstByte = CryptoArray[(current & 0xF0) >> 4];
                    decrypted.Append(Convert.ToChar(firstByte));

                    if (validate <= 1)
                        break;

                    byte secondByte = CryptoArray[current & 0xF];

                    if (secondByte == 0)
                        break;

                    decrypted.Append(Convert.ToChar(secondByte));
                }
            }
            else
            {
                for (; validate > 0; --validate)
                {
                    if (index >= bytes.Length)
                        break;

                    current = bytes[index];
                    index++;

                    decrypted.Append(Convert.ToChar((byte)(current ^ 0x33)));
                }
            }
        }
        return decrypted.ToString();
    }
}
In case you want something more useable with not getting chopped of texts and having to handle everything on your own..


might not be the best way to rewrite everything but it's somewhat useable.
06/17/2019 02:28 Roxeez#7
Quote:
Originally Posted by AfterLife- View Post
In case you want something more useable with not getting chopped of texts and having to handle everything on your own..


might not be the best way to rewrite everything but it's somewhat useable.
Thanks but i've already made a working "parser" for what i need