Community Wiki

Edit

API:Passive Skill Tree

Extra reference: https://www.pathofexile.com/developer/docs/reference#extra

class PassiveUrl
{
    public function test()
    {
        return $this->toArray('https://www.pathofexile.com/fullscreen-passive-skill-tree/3.20.1/AAAABgMADQQHES0fAiycLR9Ms18qg_eOvpLBz8TfsOvkAAELVs_E');
    }

    public function toArray(string $url): array
    {
        $burl = $this->base64url_decode($this->strip_burl($url));
        $tree = unpack("Nversion/Cclass/Cascendancy/Cn", $burl);
        $burl = substr($burl, 7);
        $tree['hashes'] = unpack("n".$tree['n'], substr($burl, 0, $tree['n']*2));
        if ($tree['version'] != 6) {
            return $tree;
        }
        $burl = substr($burl, $tree['n']*2);
        // extended hashes
        $tree['m'] = unpack("Cm", substr($burl, 0, 1))['m'];
        $burl = substr($burl, 1);
        if ($tree['m']) {
            $tree['extended_hashes'] = unpack("n".$tree['m'], substr($burl, 0, $tree['m']*2));
            $burl = substr($burl, $tree['m']*2);
        }
        // mastery effect pairs
        $tree['o'] = unpack("Co", substr($burl, 0, 1))['o'];
        $burl = substr($burl, 1);
        if ($tree['o']) {
            $tree['mastery_effect_pairs'] = unpack("N".$tree['o'], substr($burl, 0, $tree['o']*4));
            foreach($tree['mastery_effect_pairs'] as $key => $pair) {
                $tree['mastery_effect_pairs'][$key] = [
                    'nodeHash' => $pair & 0xffff,
                    'effectHash' => $pair >> 16,
                ];
            }
        }
        return $tree;
    }

    private function base64url_encode($data)
    {
        return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
    }

    private function base64url_decode($data)
    {
        return base64_decode(strtr($data, '-_', '+/').str_repeat('=', 3-(3+strlen($data))%4));
    }

    private function strip_burl($url)
    {
        return basename(parse_url($url, PHP_URL_PATH));
    }
}

Result:

{
    "version": 6,
    "class": 3,
    "ascendancy": 0,
    "n": 13,
    "hashes": {
        "1": 1031,
        "2": 4397,
        "3": 7938,
        "4": 11420,
        "5": 11551,
        "6": 19635,
        "7": 24362,
        "8": 33783,
        "9": 36542,
        "10": 37569,
        "11": 53188,
        "12": 57264,
        "13": 60388
    },
    "m": 0,
    "o": 1,
    "mastery_effect_pairs": {
        "1": {
            "nodeHash": 53188,
            "effectHash": 2902
        }
    }
}

hashes definition json: https://github.com/grindinggear/skilltree-export

Jewel Information

If you need jewel information, you will need to use API https://www.pathofexile.com/character-window/get-passive-skills?accountName={accountName}&realm=pc&character={character}

Example: https://www.pathofexile.com/character-window/get-passive-skills?accountName=Mathil&realm=pc&character=PrettyLimitedPowerTbh

Development Tool

Site Description
Skilltree Typescript Best reference for how Skilltree worked

Wikis Content is available under CC BY-NC-SA 3.0 unless otherwise noted.