@echo off
rem ==============================================================
rem  VSESVET / HWID tool (v2)
rem  Prints this machine's HWID (16 hex chars) and copies it to
rem  the clipboard. Formula (same as the game module):
rem    sha256(MachineGuid + COMPUTERNAME + PROCESSOR_IDENTIFIER)
rem    -> first 16 hex chars (UTF-8, lowercase)
rem  Download: vsesvet.pro -> cabinet -> License -> Your HWID
rem  v2 notes: -STA (clipboard needs it), -NonInteractive (a hung
rem  prompt would keep the window open forever), clip.exe fallback
rem  when Set-Clipboard is blocked, plain HWID line for manual
rem  copy, exit /b so the window always closes after a key.
rem  The file is pure ASCII: all glyphs/text are produced by
rem  PowerShell, and the whole script is ONE line because cmd
rem  breaks caret-continuation after quoted arguments.
rem ==============================================================
title VSESVET - HWID
chcp 65001 >nul
powershell -NoProfile -STA -NonInteractive -ExecutionPolicy Bypass -Command "$ErrorActionPreference='Stop'; try{[Console]::OutputEncoding=[Text.Encoding]::UTF8}catch{}; $L=([char]0x2550).ToString();$V=([char]0x2551).ToString();$TL=([char]0x2554).ToString();$TR=([char]0x2557).ToString();$ML=([char]0x2560).ToString();$MR=([char]0x2563).ToString();$BL=([char]0x255A).ToString();$BR=([char]0x255D).ToString();$W=50; $mg='';try{$mg=(Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Cryptography').MachineGuid}catch{}; if(-not $mg){try{$mg=[Microsoft.Win32.RegistryKey]::OpenBaseKey('LocalMachine','Registry64').OpenSubKey('SOFTWARE\Microsoft\Cryptography').GetValue('MachineGuid')}catch{}}; if(-not $mg){Write-Host '';Write-Host '   [!] Не удалось прочитать данные машины (MachineGuid).' -ForegroundColor Red;Write-Host '   Напиши в поддержку: t.me/vsesvet_support' -ForegroundColor Gray;Write-Host '';exit 1}; $s=$mg+$env:COMPUTERNAME+$env:PROCESSOR_IDENTIFIER; $h=(-join([Security.Cryptography.SHA256]::Create().ComputeHash([Text.Encoding]::UTF8.GetBytes($s))|%%{$_.ToString('x2')})).Substring(0,16); $copied='';try{Set-Clipboard -Value $h;$copied='set-clipboard'}catch{}; if(-not $copied){try{$h|clip.exe;$copied='clip'}catch{}}; $t1='VSESVET  ///  HWID ТВОЕЙ МАШИНЫ';$p1=[Math]::Max(0,$W-$t1.Length);$lp1=[int][Math]::Floor($p1/2);$rp1=$p1-$lp1; $pad=[Math]::Max(0,$W-$h.Length);$lp=[int][Math]::Floor($pad/2);$rp=$pad-$lp; Write-Host ''; Write-Host ('   '+$TL+($L*$W)+$TR) -ForegroundColor DarkGray; Write-Host ('   '+$V) -NoNewline -ForegroundColor DarkGray;Write-Host ((' '*$lp1)+$t1+(' '*$rp1)) -NoNewline -ForegroundColor White;Write-Host ($V) -ForegroundColor DarkGray; Write-Host ('   '+$ML+($L*$W)+$MR) -ForegroundColor DarkGray; Write-Host ('   '+$V+(' '*$W)+$V) -ForegroundColor DarkGray; Write-Host ('   '+$V) -NoNewline -ForegroundColor DarkGray;Write-Host ((' '*$lp)+$h+(' '*$rp)) -NoNewline -ForegroundColor Green;Write-Host ($V) -ForegroundColor DarkGray; Write-Host ('   '+$V+(' '*$W)+$V) -ForegroundColor DarkGray; Write-Host ('   '+$BL+($L*$W)+$BR) -ForegroundColor DarkGray; Write-Host ''; Write-Host ('   HWID: '+$h) -ForegroundColor White; Write-Host ''; if($copied){Write-Host '   [OK] HWID скопирован в буфер обмена.' -ForegroundColor Green}else{Write-Host '   [..] Автокопирование не сработало: выдели строку HWID выше и нажми Ctrl+C.' -ForegroundColor Yellow}; Write-Host '   Вставь его в чат с ботом @vsesvet_bot при выдаче ключа (Ctrl+V).' -ForegroundColor Gray; Write-Host '   Файл всегда доступен: vsesvet.pro - кабинет - Лицензия - Твой HWID.' -ForegroundColor Gray; Write-Host ''; Write-Host '   Нажми любую клавишу, чтобы закрыть это окно...' -ForegroundColor DarkGray"
pause >nul
exit /b 0
