转换SteamID3到旧SteamID

<?php

function SteamID3SteamID64($steamid3) {
    $args = explode(":", $steamid3);
    $accountid = substr($args[2], 0, -1);

    if (($accountid % 2) == 0) {
        $Y = 0;
        $Z = ($accountid / 2);
    } else {
        $Y = 1;
        $Z = (($accountid - 1) / 2);
    }

    return "7656119".(($Z * 2) + (7960265728 + $Y));
}

// Convert SteamID3 to SteamID64
echo SteamID3SteamID64("[U:1:XXXXXXXX]");

?>
.版本 2

.子程序 SteamID3SteamID64
.局部变量 id3
.局部变量 Y
.局部变量 Z
.局部变量 id64, 文本型

id3 = 164317388
.如果 (id3 % 2 = 0)
    Y = 0
    Z = id3 ÷ 2
.否则
    Y = 1
    Z = (id3 - 1) ÷ 2
.如果结束
id64 = “7656119” + 到文本 (Z × 2 + 7960265728 + Y)
输出调试文本 (id64)
Last modification:November 5th, 2017 at 01:49 am
If you think my article is useful to you, please feel free to appreciate

Leave a Comment