What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal
RebornBuddy Forums

Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

[Snippet] Skill Tree URL Converter

jgBlack

New Member
Joined
Oct 10, 2014
Messages
23
Since there is a AutoPassives plugin I thought it would be cool to add the ability to parse the PoE skilltree URLs.
Example: https://www.pathofexile.com/passive-skill-tree/AAAAAwEAJSddSXuM
AAAAAwEAJSddSXuM is basically base64 encoded.

The javascript code processing that stuff on the site is:

Code:
            var s = new v;
            s.setDataString(t);
            var o = s.readInt()
              , u = s.readInt8()
              , a = 0;
            o > 0 && (a = s.readInt8());
            if (o != T.CurrentVersion) {
                alert("The build you are trying to load is using an old version of the passive tree and will not work.");
                return
            }
            var f = [];
            while (s.hasData())
                f.push(s.readInt16());
            this.loadCharacterData(u, f),
            a == 1 && this.toggleFullScreen(!0)


I converted it to some basic C#
Code:
        static int[] decodeSkillTreeURL(string urlPart)
        {
            List<int> skills = new List<int>();
            BinaryReader reader = new BinaryReader(new MemoryStream(Convert.FromBase64String(urlPart)));
            int skillTreeVersion = bytesToInt(reader.ReadBytes(4));
            int u = bytesToInt(reader.ReadBytes(1), 1);
            int a = 0;

            if(skillTreeVersion > 0)
            {
                a = bytesToInt(reader.ReadBytes(1), 1);
            }

            while (reader.BaseStream.Position != reader.BaseStream.Length)
            {
                skills.Add(bytesToInt(reader.ReadBytes(2), 2));
            }


            return skills.ToArray();
        }

        static int bytesToInt(byte[] e, int t = 4)
        {
            int n = 0;
            for (int r = 0; r < t; ++r)
            {
                n += e[r];
                if (r < t - 1)
                {
                    n <<= 8;
                }
            }
                
            return n;
        }

In some cases some replace is needed for valid base64 strings. Ex:
Code:
            string skillURL = "AAAAAwEABLMFLQU8B3UJlgm7DjwUIBRxFm8XLxiRGekaOCE0IVUkqicLJyAnLyz7Nuk5DjpSOtg7OzwFQKBBP0a3R35IeEnVUEdR5lXWV1RZ814TXz9gkWDEYVJk52VNZlRmnmhlaPJyD3KpdO12f3asd1N673uMfNl-4ICkggeCm4O2hMSE2YTvhVKGYIbRh2qKIoqzkFWQbJOolG-XeZo7nleexZ_fogCpJ6mUrKqtjbQvvJ-9Nr6nwGbApsRYxVPPftNv2WHZfNrB3DLcPeNq5FHkreoY6wnsOO8O707vfPAf82_z3fZI9zL46_rS";
            skillURL = skillURL.Replace('-', '+').Replace('_', '/');
            decodeSkillTreeURL(skillURL);

So decodeSkillTreeURL("AAAAAwEAJSddSXuM"); would result in an array like this: [9511, 23881, 31628] which should be the skill node Ids right?

Maybe this is usefull and one might implement it into the ExileBuddy AutoPassives Plugin, which would make life easier to use the plugin i guess.
 
Last edited:
Since there is a AutoPassives plugin I thought it would be cool to add the ability to parse the PoE skilltree URLs.
Example: https://www.pathofexile.com/passive-skill-tree/AAAAAwEAJSddSXuM
AAAAAwEAJSddSXuM is basically base64 encoded.

The javascript code processing that stuff on the site is:

Code:
            var s = new v;
            s.setDataString(t);
            var o = s.readInt()
              , u = s.readInt8()
              , a = 0;
            o > 0 && (a = s.readInt8());
            if (o != T.CurrentVersion) {
                alert("The build you are trying to load is using an old version of the passive tree and will not work.");
                return
            }
            var f = [];
            while (s.hasData())
                f.push(s.readInt16());
            this.loadCharacterData(u, f),
            a == 1 && this.toggleFullScreen(!0)


I converted it to some basic C#
Code:
        static int[] decodeSkillTreeURL(string urlPart)
        {
            List<int> skills = new List<int>();
            BinaryReader reader = new BinaryReader(new MemoryStream(Convert.FromBase64String(urlPart)));
            int skillTreeVersion = bytesToInt(reader.ReadBytes(4));
            int u = bytesToInt(reader.ReadBytes(1), 1);
            int a = 0;

            if(skillTreeVersion > 0)
            {
                a = bytesToInt(reader.ReadBytes(1), 1);
            }

            while (reader.BaseStream.Position != reader.BaseStream.Length)
            {
                skills.Add(bytesToInt(reader.ReadBytes(2), 2));
            }


            return skills.ToArray();
        }

        static int bytesToInt(byte[] e, int t = 4)
        {
            int n = 0;
            for (int r = 0; r < t; ++r)
            {
                n += e[r];
                if (r < t - 1)
                {
                    n <<= 8;
                }
            }
                
            return n;
        }

In some cases some replace is needed for valid base64 strings. Ex:
Code:
            string skillURL = "AAAAAwEABLMFLQU8B3UJlgm7DjwUIBRxFm8XLxiRGekaOCE0IVUkqicLJyAnLyz7Nuk5DjpSOtg7OzwFQKBBP0a3R35IeEnVUEdR5lXWV1RZ814TXz9gkWDEYVJk52VNZlRmnmhlaPJyD3KpdO12f3asd1N673uMfNl-4ICkggeCm4O2hMSE2YTvhVKGYIbRh2qKIoqzkFWQbJOolG-XeZo7nleexZ_fogCpJ6mUrKqtjbQvvJ-9Nr6nwGbApsRYxVPPftNv2WHZfNrB3DLcPeNq5FHkreoY6wnsOO8O707vfPAf82_z3fZI9zL46_rS";
            skillURL = skillURL.Replace('-', '+').Replace('_', '/');
            decodeSkillTreeURL(skillURL);

So decodeSkillTreeURL("AAAAAwEAJSddSXuM"); would result in an array like this: [9511, 23881, 31628] which should be the skill node Ids right?

Maybe this is usefull and one might implement it into the ExileBuddy AutoPassives Plugin, which would make life easier to use the plugin i guess.

*Cough*

Code:
Loki.Game.LokiPoe.DecomposeBuildUrl(string)

;)

Also, you might consider that the value returned isn't ordered. Soooooooooooo you can't use it directly in AutoPassives, since it process sequentially one node after another in a specific order. But you learned something in c# and it's a good thing ! :D
 
*Cough*

Code:
Loki.Game.LokiPoe.DecomposeBuildUrl(string)

;)

Also, you might consider that the value returned isn't ordered. Soooooooooooo you can't use it directly in AutoPassives, since it process sequentially one node after another in a specific order. But you learned something in c# and it's a good thing ! :D

Shieeeeet, didn't know it's already in the API sorry. The problem is my Windows 10 doesn't render those .chm help files so I wasn't able to check on that :D But thank you for pointing that out. Once again I wasted time in my life haha :D
 
Shieeeeet, didn't know it's already in the API sorry. The problem is my Windows 10 doesn't render those .chm help files so I wasn't able to check on that :D But thank you for pointing that out. Once again I wasted time in my life haha :D

Everything you do yourself is never pointless. Be proud of what you can achieve even if it already exists, it proves that you're a clever man !
 
Here I am spending my time making one and now you tell me this tony...., welp back to Quest, then.
 
Back
Top