mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-12-26 12:30:48 +00:00
12 lines
No EOL
307 B
Ruby
12 lines
No EOL
307 B
Ruby
module SteamID
|
|
def self.to_steamID(steamid)
|
|
m = steamid.match(/^(STEAM_){0,1}([0-5]):([01]:\d+)$/)
|
|
return ((m[3].to_i * 2) + m[2].to_i) + 76561197960265728
|
|
end
|
|
|
|
def self.from_steamID64(sid)
|
|
y = sid.to_i - 76561197960265728
|
|
x = y % 2
|
|
return "0:%d:%d" % [x, (y - x).div(2)]
|
|
end
|
|
end |