-
Notifications
You must be signed in to change notification settings - Fork 0
/
TI-Server-Checker.ps1
614 lines (566 loc) · 24.2 KB
/
TI-Server-Checker.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
<#
This tool relies on:
https://github.com/hjorslev/SteamPS
## Known Servers - this list is handcrafted - meanwhile obsolete due to Get-Serverlist function below
# Australia
#AU1: 13.211.86.139
#AU2: 54.253.198.194
# Brazil
#BR1: 54.94.45.219
#BR2: 54.207.198.78
#BR3: 52.67.88.139
## old #BR4: 15.228.90.72
#BR4: 54.232.65.187
#BR5: 18.228.154.111
#BR6: 18.231.145.14
# North America
#NA1: 54.67.100.202
#NA2: 13.57.204.50
#NA3: 3.101.83.56
#NA4: 52.53.225.74
#NA5: 18.144.168.156
#NA6: 3.101.104.105
#NA7: 18.144.64.94
#NA8: 13.56.16.27
# Europe
#EU1: 3.250.191.172 # is most of the time not used for the Update 3 beta
#EU2: 3.250.111.132
#EU3: 52.48.44.22
#EU4: 18.203.67.73
#EU5: 3.249.154.224 :51717
#EU6: 34.244.123.102
#EU7: 34.240.7.84
#EU8: 54.171.180.126
#EU9: 3.251.77.114
#>
$AUServers =
@{ip="13.211.86.139"; port=28015},
@{ip="54.253.198.194"; port=28015}
$BRServers =
@{ip="54.94.45.219"; port=28015},
@{ip="54.207.198.78"; port=28015},
@{ip="52.67.88.139"; port=28015},
@{ip="54.232.65.187"; port=28015},
@{ip="18.228.154.111"; port=28015},
@{ip="18.231.145.14"; port=28015}
$NAServers =
@{ip="54.67.100.202"; port=28015},
@{ip="13.57.204.50"; port=28015},
@{ip="3.101.83.56"; port=28015},
@{ip="52.53.225.74"; port=28015},
@{ip="18.144.168.156"; port=28015},
@{ip="3.101.104.105"; port=28015},
@{ip="18.144.64.94"; port=28015},
@{ip="13.56.16.27"; port=28015}
$EUServers =
@{ip="3.250.191.172"; port=28015},
@{ip="3.250.111.132"; port=28015},
@{ip="52.48.44.22"; port=28015},
@{ip="18.203.67.73"; port=28015},
@{ip="3.249.154.224"; port=28015},
@{ip="34.244.123.102"; port=28015},
@{ip="34.240.7.84"; port=28015},
@{ip="54.171.180.126"; port=28015},
@{ip="3.251.77.114"; port=28015}
$Progress = ".", "o", "O", "0", "°", "´", "°", "0", "O", "o"
function Get-Serverlist
{
Param(
# Which group of servers to look for:
# Official Evrima:
# * OEAU: Australia
# * OEBR: Brazil
# * OEEU: Europe
# * OENA: North America
# Community
# * 'any other string': Only community servers that are currently full (the server "Die Insel der schrecklichen Echsen" is always in the list - it is the authors own server)
$QUERY,
# https://developer.valvesoftware.com/wiki/Master_Server_Query_Protocol#Filter - like "\full\1", "\empty\1", "\noplayers\1", etc.
$PARAM
)
# https://developer.valvesoftware.com/wiki/Talk:Master_Server_Query_Protocol#new_API
$uri = "https://api.steampowered.com/IGameServersService/GetServerList/v1/?key=4E9C85CBF2B369493F92DCE733EA3D31&filter=gamedir\theisle" + $PARAM + "&limit=999"
# Get the server list
$Servers = (Invoke-RestMethod -Uri $uri).response.Servers
# initialize the array the we will return
$ServerArr = @()
switch -regex ($QUERY)
{
'OE:(AU|BR|EU|NA)' {
$_querystring = "^Official .*" + $QUERY.split(':')[1] + ".*"
Foreach ($Server in $Servers)
{
if ($Server.max_players -gt 0 -and $Server.Name -match "$_querystring")
{
[string]$_ip = $Server.Addr.split(':')[0]
[string]$_port = $Server.Addr.split(':')[1]
[string]$_name = $Server.Name
$ServerArr += @{ip="$_ip"; port="$_port"; name="$_name"}
}
}
}
Default {
if ($QUERY)
{
$_querystring = "(.*" + $QUERY + ".*|.*Echsen.*)"
}
else
{
$_querystring = "(.*Echsen.*)"
}
Foreach ($Server in $Servers)
{
if ($Server.max_players -gt 0 -and $Server.Name -notmatch "^Official .*" -and ($Server.players -ge $Server.max_players -or $Server.Name -match "$_querystring"))
{
[string]$_ip = $Server.Addr.split(':')[0]
[string]$_port = $Server.Addr.split(':')[1]
[string]$_name = $Server.Name
$ServerArr += @{ip="$_ip"; port="$_port"; name="$_name"}
}
}
break
}
}
$ServerArr = $ServerArr | Sort-Object { $_.name }
return ,$ServerArr
}
function Send-UdpDatagram
# https://gist.github.com/PeteGoo/21a5ab7636786670e47c
{
Param ([string] $EndPoint,
[int] $Port,
[string] $Message)
$IP = [System.Net.Dns]::GetHostAddresses($EndPoint)
$Address = [System.Net.IPAddress]::Parse($IP)
$EndPoints = New-Object System.Net.IPEndPoint($Address, $Port)
$Socket = New-Object System.Net.Sockets.UDPClient
$EncodedText = [Text.Encoding]::utf8.GetBytes($Message)
$SendMessage = $Socket.Send($EncodedText, $EncodedText.Length, $EndPoints)
# https://stackoverflow.com/a/47440927
$ReceiveEndPoint = new-object net.ipendpoint([net.ipaddress]::any, 0)
$receiveMessage = $Socket.receive([ref]$ReceiveEndPoint)
Write-Host "received message:"
$arr = $receiveMessage[6..($receiveMessage.Length-1)]
#$arr = $receiveMessage[6..11]
$counter = 0
$iparr = @()
Do
{
[string]$_ip = ""
For ($i=1; $i -le 4; $i++) {
#Write-Host -NoNewline $arr[$counter]
# If we dont convert to string then the _ip var will be casted to int and this will mess up the array / hashtable
$_ip += $arr[$counter].ToString()
if ($i%4 -ne 0)
{
#Write-Host -NoNewline "."
$_ip += "."
}
$counter++
}
$a = $arr[$counter]
$counter++
$b = $arr[$counter]
# https://stackoverflow.com/a/24458649
$short = -Join (("{0:X}" -f $a),("{0:X}" -f $b))
#Write-Host -NoNewline ":"
#Write-Host ([convert]::ToInt64($short,16))
$_port = ([convert]::ToInt64($short,16))
# https://www.alkanesolutions.co.uk/2016/11/22/powershell-array-hashtables-instead-multidimensional-array/
$iparr += (@{ip="$_ip"; port="$_port"})
$counter++
} While ($counter -lt $arr.Length)
#$arr
#$list = ([text.encoding]::utf7.getstring($receiveMessage))
#$list
$Socket.Close()
#https://stackoverflow.com/questions/12620375/how-to-return-several-items-from-a-powershell-function/12621314
#
return ,$iparr
}
workflow GetAllServerInfo_w
{
$Servers = "13.211.86.139", "54.253.198.194", "54.94.45.219", "54.207.198.78", "52.67.88.139", "54.67.100.202", "13.57.204.50", "3.101.83.56", "52.53.225.74", "18.144.168.156", "3.101.104.105", "18.144.64.94", "13.56.16.27", "3.250.191.172", "3.250.111.132", "52.48.44.22", "18.203.67.73", "3.249.154.224", "34.244.123.102", "34.240.7.84", "54.171.180.126", "3.251.77.114"
ForEach -Parallel ($Server in $Servers)
{
Get-SteamServerInfo -ErrorAction SilentlyContinue -WarningAction SilentlyContinue -IPAddress $Server.ip -Port $Server.port | Where-Object {$_.Players -lt $_.MaxPlayers} | Select-Object -Property "ServerName", "Players", "IPAddress" | % { $_.ServerName = $_.ServerName.Replace("Official ", ""); $_ }
}
}
Function GetAllServerInfo_f
{
ForEach ($Server in $Servers)
{
try {
# show only servers which have slots free
#Get-SteamServerInfo -ErrorAction SilentlyContinue -WarningAction SilentlyContinue -Timeout 400 -IPAddress $Server.ip -Port $Server.port | Where-Object {$_.Players -lt $_.MaxPlayers} | Add-Member -MemberType AliasProperty -Name Ver -Value GameName -PassThru | Select-Object -Property "ServerName", "Players", "MaxPlayers", "Ver" | % { $_.ServerName = $_.ServerName.Replace("Official Evrima ", ""); $_.Ver = $_.Ver.Replace("Evrima ", ""); $_ }
# show all server currently reachable
# DEBUG - with name correction, not used anymore with new server list gathering method
#Get-SteamServerInfo -IPAddress $Server.ip -Port $Server.port | Add-Member -MemberType AliasProperty -Name Ver -Value GameName -PassThru | Select-Object -Property "ServerName", "Players", "MaxPlayers", "Ver" | % { $_.ServerName = $_.ServerName.Replace("Official Evrima ", ""); $_.Ver = $_.Ver.Replace("Evrima ", ""); $_ }
Get-SteamServerInfo -ErrorAction SilentlyContinue -WarningAction SilentlyContinue -Timeout 400 -IPAddress $Server.ip -Port $Server.port | Add-Member -MemberType AliasProperty -Name Ver -Value GameName -PassThru | Select-Object -Property "ServerName", "Players", "MaxPlayers", "Ver"
}
catch [Exception] {
#$_.message
}
}
}
Function GetServerInfo
{
Param(
$IP,
$PORT
)
try {
# DEBUG
#Get-SteamServerInfo -IPAddress $IP -Port 28015 | Add-Member -MemberType AliasProperty -Name Ver -Value GameName -PassThru | Select-Object -Property "ServerName", "Players", "MaxPlayers", "Ver" | % { $_.ServerName = $_.ServerName.Replace("Official Evrima ", ""); $_.Ver = $_.Ver.Replace("Evrima ", ""); $_ }
#Get-SteamServerInfo -ErrorAction SilentlyContinue -WarningAction SilentlyContinue -Timeout 400 -IPAddress $IP -Port $PORT | Add-Member -MemberType AliasProperty -Name Ver -Value GameName -PassThru | Select-Object -Property "ServerName", "Players", "MaxPlayers", "Ver" | % { $_.ServerName = $_.ServerName.Replace("Official Evrima ", ""); $_.Ver = $_.Ver.Replace("Evrima ", ""); $_ }
Get-SteamServerInfo -ErrorAction SilentlyContinue -WarningAction SilentlyContinue -Timeout 400 -IPAddress $IP -Port $PORT | Add-Member -MemberType AliasProperty -Name Ver -Value GameName -PassThru | Select-Object -Property "ServerName", "Players", "MaxPlayers", "Ver"
}
catch [Exception] {
#$_.message
}
}
function Show-Region-Menu
{
param (
[string]$Title = 'Regions'
)
Clear-Host
Write-Host "Please choose a region:"
Write-Host "================ $Title ================"
Write-Host "'a' Australia"
Write-Host "'b' Brazil"
Write-Host "'e' Europe"
Write-Host "'n' North America"
Write-Host "'c' Community Servers"
Write-Host "'q' to quit"
}
function Show-Server-Menu
{
param (
[string]$Title = 'Servers'
)
Clear-Host
$ServerID = 0
Write-Host "Please choose a server:"
Write-Host "================ $Title ================"
ForEach ($Server in $Servers)
{
$ServerID++
if ($RegionCode -ne "C")
{
try {
$_fake = [System.Net.Dns]::GetHostEntry($Server.ip.Trim()).HostName
}
catch {
$_fake = "No Hostname"
}
}
if ($RegionCode -ne "C" -and $_fake -notmatch ".*compute.amazonaws.com")
{
Write-Host "'${ServerID}' "$Server.name"- this one might be fake! ($($Server.ip))"
}
else
{
Write-Host "'${ServerID}' "$Server.name
}
}
Write-Host "'a' check all (Only for checking the availability of servers and for timing when to press the 'Refresh' button!)"
Write-Host "'q' return to region menu"
}
function WaitEnd
{
Write-Host "Hit any key to continue or wait for 5 secs..."
Start-Sleep -Milliseconds 100
$host.ui.RawUI.FlushInputBuffer();
$counter = 0
while(!$Host.UI.RawUI.KeyAvailable -and ($counter++ -lt 50))
{
Start-Sleep -Milliseconds 100
}
}
function Get-NetworkStatistics
{
<#
Based on this work:
https://lazywinadmin.com/2011/02/how-to-find-running-processes-and-their.html
#>
$properties = 'Protocol','LocalAddress','LocalPort'
$properties += 'RemoteAddress','RemotePort','State','ProcessName','PID'
netstat -ano | Select-String -Pattern '\s+(UDP)' | ForEach-Object {
$item = $_.line.split(" ",[System.StringSplitOptions]::RemoveEmptyEntries)
if($item[1] -notmatch '^\[::')
{
if (($la = $item[1] -as [ipaddress]).AddressFamily -eq 'InterNetworkV6')
{
$localAddress = $la.IPAddressToString
$localPort = $item[1].split('\]:')[-1]
}
else
{
$localAddress = $item[1].split(':')[0]
$localPort = $item[1].split(':')[-1]
}
if (($ra = $item[2] -as [ipaddress]).AddressFamily -eq 'InterNetworkV6')
{
$remoteAddress = $ra.IPAddressToString
$remotePort = $item[2].split('\]:')[-1]
}
else
{
$remoteAddress = $item[2].split(':')[0]
$remotePort = $item[2].split(':')[-1]
}
New-Object PSObject -Property @{
PID = $item[-1]
ProcessName = (Get-Process -Id $item[-1] -ErrorAction SilentlyContinue).Name
Protocol = $item[0]
LocalAddress = $localAddress
LocalPort = $localPort
RemoteAddress =$remoteAddress
RemotePort = $remotePort
State = if($item[0] -eq 'tcp') {$item[3]} else {$null}
} | Select-Object -Property $properties
}
}
}
function CheckConnection
{
$TrafficHits = 0
Do
{
$port = Get-NetworkStatistics | Where-Object {$_.ProcessName -eq 'steam' -and $_.LocalPort -ge 28000 -and $_.LocalAddress -ne "0.0.0.0" -and $_.LocalAddress -ne "127.0.0.1"} | Select-Object -ExpandProperty LocalPort
if (![string]::IsNullOrWhiteSpace($port))
{
$TrafficHits++
if ($TrafficHits -eq 1)
{
Write-Host
Write-Host "#######################################"
Write-Host "## Connection attempt in progress... ##"
Write-Host "#######################################"
}
if ($TrafficHits -ge 30)
{
return $true
}
Start-Sleep -s 1
}
} While (![string]::IsNullOrWhiteSpace($port))
if ($TrafficHits -gt 0)
{
Write-Host
Write-Host "#######################################################"
Write-Host "## I know it's hard... that's why I wrote this tool. ##"
Write-Host "## ##"
Write-Host "## But it can only do the clicking for you. ##"
Write-Host "## For the last meter you need some luck, ##"
Write-Host "## a bit more patience and fast reflexes. ##"
Write-Host "## ##"
Write-Host "## -- Keep going! ##"
Write-Host "#######################################################"
Start-Sleep -s 10
break
}
return $false
}
function CheckPreRequisites
{
if (Get-Module -ListAvailable -Name SteamPS) {
#Write-Host "SteamPS already Installed"
#WaitEnd
}
else {
Set-ExecutionPolicy RemoteSigned -Force
$PrereqFile = "$pwd\Prerequisites.ps1"
Start-Process -FilePath 'powershell' -Wait -ArgumentList ( '-NoProfile', $PrereqFile )
}
}
# Pre-Requisites:
CheckPreRequisites
# Main
do
{
Show-Region-Menu
# we need to clear the input buffer so the last key input does not interfere with the next one
Start-Sleep -Milliseconds 100
$host.ui.RawUI.FlushInputBuffer();
$key = [Console]::ReadKey("NoEcho,IncludeKeyUp,IncludeKeyDown")
$char = $key.KeyChar
# clear input buffer again so it does not break the next loop early
Start-Sleep -Milliseconds 100
$host.ui.RawUI.FlushInputBuffer();
switch ($char)
{
'A' {
$region = "Australia"
$RegionCode = "AU"
#$Servers = $AUServers
$Servers = Get-Serverlist "OE:AU" "\empty\1\name_match\Official *"
}
'B' {
$region = "Brazil"
$RegionCode = "BR"
#$Servers = $BRServers
$Servers = Get-Serverlist "OE:BR" "\empty\1\name_match\Official *"
}
'E' {
$region = "Europe"
$RegionCode = "EU"
#$Servers = $EUServers
$Servers = Get-Serverlist "OE:EU" "\empty\1\name_match\Official *"
}
'N' {
$region = "North America"
$RegionCode = "NA"
#$Servers = $NAServers
$Servers = Get-Serverlist "OE:NA" "\empty\1\name_match\Official *"
}
'C' {
$region = "Community Servers"
$RegionCode = "C"
#$Servers = $CommunityServers
#Send-UdpDatagram -EndPoint "hl2master.steampowered.com" -Port 27011 -Message "1.0.0.0.0:0.\appid\412680."
# https://developer.valvesoftware.com/wiki/Master_Server_Query_Protocol
# https://steamdb.info/app/412680/
# => "1.0.0.0.0:0.\appid\412680." => Text -> HEX 34 31 32 36 38 30 (The Isle Dedicated Server)
# => "1.0.0.0.0:0.\appid\376210 => Text -> HEX 33 37 36 32 31 30 (The Isle)
$message =
# character "1" + region code x03 = Europe
[char]0x31+[char]0x03+
# 0.0.0.0:0
[char]0x30+[char]0x2e+[char]0x30+[char]0x2e+[char]0x30+[char]0x2e+[char]0x30+[char]0x3a+[char]0x30+
[char]0x00+
# \appid
[char]0x61+[char]0x70+[char]0x70+[char]0x69+[char]0x64+
# \gamedir
#[char]0x5c+[char]0x67+[char]0x61+[char]0x6d+[char]0x65+[char]0x64+[char]0x69+[char]0x72+
# \theisle
#[char]0x5c+[char]0x74+[char]0x68+[char]0x65+[char]0x69+[char]0x73+[char]0x6c+[char]0x65+
# \412680
#[char]0x5c+[char]0x34+[char]0x31+[char]0x32+[char]0x36+[char]0x38+[char]0x30+
# \376210
[char]0x5c+[char]0x33+[char]0x37+[char]0x36+[char]0x32+[char]0x31+[char]0x30+
[char]0x00
#Send-UdpDatagram -EndPoint "208.64.200.39" -Port 27011 -Message $message
#Send-UdpDatagram -EndPoint "208.64.200.52" -Port 27011 -Message $message
#Send-UdpDatagram -EndPoint "208.64.200.65" -Port 27011 -Message $message
#$Servers = Send-UdpDatagram -EndPoint "208.64.200.39" -Port 27011 -Message $message
$_phrase = Read-Host "Please enter a part of the server name you want to check or just hit enter"
$Servers = Get-Serverlist $_phrase
}
}
if ($char -ne 'q')
{
do
{
Show-Server-Menu
# we need to clear the input buffer so the last key input does not interfere with the next one
Start-Sleep -Milliseconds 100
$host.ui.RawUI.FlushInputBuffer();
$key = [Console]::ReadKey("NoEcho,IncludeKeyUp,IncludeKeyDown")
$char = $key.KeyChar
# clear input buffer again so it does not break the next loop early
Start-Sleep -Milliseconds 100
$host.ui.RawUI.FlushInputBuffer();
if ($char -ne 'q')
{
# this is a hack to convert the char from the keypress into an integer:
[Int32]$idx = 0
if ([System.Int32]::TryParse($char, [ref]$idx))
{
# if 3 is pressed then the array index 2 is what we want to work on because array start counting from 0 instead of 1
$idx--
$Server = $Servers[$idx]
}
do
{
<#
# https://devblogs.microsoft.com/powershell/powershell-foreach-object-parallel-feature/
# ^^ this does only speed up if a lot of servers are queried. But usuallly we want to check only the Official servers for our own region
# I keep this for future reference in case the usage of this script ever gets expanded.
$start = Get-Date
$FreeServers = GetAllServerInfo_w
Clear-Host
$FreeServers | Format-Table @{ e='*'; width = 25 }
$end = Get-Date
Write-Host -ForegroundColor Red ($end - $start).TotalSeconds
#>
#$start = Get-Date
if ($char -eq "a")
{
$ServerInfo = GetAllServerInfo_f
}
else {
# DEBUG
#Write-Host $Server
$ServerInfo = GetServerInfo -IP $Server.ip -PORT $Server.port
# DEBUG
#Write-Host $ServerInfo
#Start-Sleep -m 100
}
Clear-Host
$ts = Get-date
Write-Host $ts
Write-Host
Write-Host -NoNewLine $region": "
$modcount++
$step = $modcount%$Progress.Length
Write-Host -NoNewLine $Progress[$step]
# escape character so we can write color escape codes
$e = [char]27
$ServerInfo | Format-Table -AutoSize @{
Label = "ServerName"
Expression =
{
if ($_.Players -lt $_.MaxPlayers) {
$fgcolor = "32"
$bgcolor = "40"
}
elseif ($_.Players -gt $_.MaxPlayers) {
$fgcolor = "31"
$bgcolor = "40"
}
elseif ($_.Players -eq $_.MaxPlayers) {
$fgcolor = "0"
$bgcolor = "0"
}
"$e[${fgcolor};${bgcolor}m$($_.ServerName)"
}
}, Players, MaxPlayers, Ver
# cancel all color codes after printing the qtable
"${e}[0m"
if ($char -ne "a")
{
Write-Host "($($Server.ip))"
}
#$end = Get-Date
#Write-Host -ForegroundColor Red ($end - $start).TotalSeconds
Write-Host "Hit any key to get back to the Region selection."
if ($char -ne "a")
{
if ($ServerInfo.Players -lt $ServerInfo.MaxPlayers)
{
if (CheckConnection)
{
Write-Host
Write-Host
Write-Host "###############################################################"
Write-Host "## Connection to The Isle server detected. Stopping queries. ##"
Write-Host "###############################################################"
Start-Sleep -s 10
break
}
# add a little extra delay (slow down queries) as long as we see a free slot
Start-Sleep -Milliseconds 200
}
elseif ($ServerInfo.Players -gt $ServerInfo.MaxPlayers) {
# slow down queries as long as the server is just spammed with connection attempts anyway
Start-Sleep -Milliseconds 300
}
}
} until ($Host.UI.RawUI.KeyAvailable)
}
} until ($char -eq 'q')
$char = ""
}
} until ($char -eq 'q')