Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
845 lines (678 sloc) 41.4 KB
################################################################################
# Welcome to the 2017 FLARE-ON Challenge mega-script. Have fun!
################################################################################
Set-StrictMode -Version 2.0
$logo = @"
--------------------------------------------------------------------
_a,
_W#m,
_Wmmmm/
BmmBmmBmm[ Bmm a#mmmmmB/ BmmBmmBm6a 3BmmBmmBm
mmm[ mmm j##mmmmmmm6 mmm -4mm[ 3mm[
mBmLaaaa, Bmm JW#mmP 4mmmmL mmBaaaa#mm' 3Bm6aaaa,
mmmP!!"?' mmm JWmmmP 4mmmBL Bmm!4X##" 3mmP????'
Bmm[ Bmmaaaaa jWmmm? 4mmmBL mmm !##L, 3BmLaasaa
mmm[ mmm##Z#Z _jWmmmmaaaaaa,]mBmm6. mmB "#Bm/ 3mmm#UZ#Z
_WBmmmmm#Z#Z#! "mmmBm,
??!??#mmmm#! "??!??
.JmmmP'
_jmmP'
_JW?'
"?
--------------------------------------------------------------------
Welcome to FLARE Single-User Dungeon v2.4 - Escape Room
--------------------------------------------------------------------
"@
################################################################################
# Graeber + Dbo = Graebo? Dber?
################################################################################
iex ([System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String(
"U0VULWl0RW0gIHZhUklhYkxFOlM1MiAgKCBbdHlwRV0oICdSdU5UaScgICsgICdtZS5JTlRFUm9"+`
"wc2VSJyAgKydWSUMnKydFUy5DYWxsJyAgKyAgJ0lOR0MnKydvblZFTlRpTycrICAnbicgICkgIC"+`
"kgICA7ICAgICAgJHFWZGphWiAgID0gIFtUeVBFXSggICdyJyArJ1VuVElNRS5JJysgJ050ZScrI"+`
"CAnUk8nICArICAnUCcgKyAgJ1NlcnZpY2VzJyArICcuY2gnKyAgJ0Fyc0V0Jyk7ICAgICRIMDZi"+`
"R2YgID0gW3R5cGVdKCAncnVudElNRS5pbicrICd0JyAgKyAnRXJvUCcgKyAnc2VyVicgICsnaSc"+`
"gICsgJ2NFJysncy5k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-F'oMaI','aPpd','n') ); &("{1}{0}" -f 'et-ITeM','s') ('V'+'aRiAbl'+'e:x1R'+'wF') ( [TYPe]("{3}{2}{7}{0}{6}{4}{5}{1}" -f'On.emi','AcCesS','fL','rE','LyB','UildEr','T.ASseMB','ECti')); function GE`T-`M`svCRT { ${DY`Na`SS`eMBly} = &("{2}{0}{1}" -f'b','ject','New-O') ("{2}{7}{4}{6}{3}{1}{5}{0}"-f'Name','em','Sys','tion.Ass','Refl','bly','ec','tem.')(("{0}{2}{1}"-f 'W','32Lib','in')); ${aSSEM`BlYbU`iL`deR} = $q21s::"CUr`REnTd`omain"."d`e`Fi`NE`dYNamiC`A`ssEMbLy"(${Dyn`AsSEM`Bly}, $x1rWF::"R`UN"); ${MoDuLEB`uI`LDER} = ${a`sseM`Bl`ybUiLD`Er}.("{2}{0}{5}{4}{1}{3}" -f'fin','nami','De','cModule','Dy','e').Invoke(("{2}{1}{0}" -f 'b','n32Li','Wi'), ${F`AlSe}); ${t`ype`BU`ILDER} = ${mOd`uLeBuIL`d`eR}.("{2}{0}{1}" -f'Ty','pe','Define').Invoke(("{0}{1}" -f 'ms','vcrt'), ("{2}{1}{0}"-f 'ass','blic, Cl','Pu')); ${Me`T`H_SRaND} = ${Ty`PeBu`iL`der}.("{3}{0}{2}{1}" -f 'efineMet','d','ho','D').Invoke( ("{0}{1}" -f 'sran','d'), [Reflection.MethodAttributes] ("{2}{3}{0}{4}{1}"-f 'b','c','P','u','lic, Stati'), [Void], [Type[]] @([Int32])); ${Met`H`_r`AND} = ${typ`e`B`uIldeR}.("{0}{2}{1}"-f'D','thod','efineMe').Invoke( ("{1}{0}" -f 'and','r'), [Reflection.MethodAttributes] ("{2}{1}{0}{3}{4}"-f 'lic, ','ub','P','St','atic'), [Int32], [Type[]] @()); ${at`TR_`s`RAnd} = &("{2}{0}{3}{1}{4}"-f'm','t','Get-Custo','At','r') ("{2}{0}{1}"-f'svcr','t.dll','m') ("{1}{0}" -f 'rand','s') ${F`A`lse}; ${ATTR_`R`And} = &("{0}{2}{3}{1}"-f 'Get-Custo','ttr','m','A') ("{2}{1}{0}" -f'dll','vcrt.','ms') ("{1}{0}" -f 'nd','ra') ${f`Alse}; ${mE`TH_srA`Nd}.("{0}{3}{2}{1}" -f'SetCustom','ute','rib','Att').Invoke(${ATtr`_`sr`AND}); ${mETH_`R`AND}.("{1}{2}{3}{0}" -f'ibute','SetCusto','mA','ttr').Invoke(${A`TTR_`RA`ND}); return ${T`ype`BU`IldEr}.("{2}{0}{1}"-f 'teTy','pe','Crea').Invoke(); }
################################################################################
# Character class
################################################################################
function New-Char()
{
return new-object PSObject -Property @{ Name="Our Hero"; Contents=@(); Wearing=@(); }
}
function Get-Inventory($char, $trailing) {
$inv = ''
if ($char.Contents.Count -ne 0) {
foreach ($thing in $char.Contents) {
$inv += "`n $($thing.Name)"
}
}
if ($inv -eq '') {
$inv = 'nothing'
}
return "You have: $inv"
}
################################################################################
# Map class
################################################################################
function New-Map
{
return New-Object PSObject -Property @{ StartingRoom=@() }
}
function Get-Map
{
$map = New-Map
$outside = New-Room "Outside" "You're locked out. It doesn't look like there's a way back in."
Add-RoomLink $outside 'n' $outside
Add-RoomLink $outside 'e' $outside
$vestibule = New-Room "the vestibule" "This is surely the entrance to a great company."
Add-RoomLink $vestibule 's' $outside -OneWay
$lobby = New-Room "the lobby" "There is a reception desk with ferns on either side, and a sign that says MANDIANT."
Add-RoomLink $vestibule 'n' $lobby
$sehall = New-Room "the southeast hallway" "This is the hallway between the lobby and the restrooms"
Add-RoomLink $lobby 'e' $sehall
$mens = New-Room "the men's room" "This is an immaculate men's room."
Add-RoomLink $sehall 'e' $mens
$womens = New-Room "the women's room" "This is an immaculate women's room."
Add-RoomLink $sehall 's' $womens
$cubicles = New-Room "the Mandiant offices" "This is where the magic happens. To the west, open work areas, cubicles, offices, and adjustable desks stretch out and intersect in a dazzling maze as far as the eye can see."
Add-RoomLink $sehall 'n' $cubicles
$confrooms = New-Room "the conference rooms" "A row of impressive conference rooms spans out before you. Behind the frosted glass are clean tables, perfectly aligned chairs, and neatly wired audio/visual equipment. Every conference room is empty. A low hum of server fans can be heard."
Add-RoomLink $cubicles 'n' $confrooms
$office = New-Room "Kevin Mandia's Office" "This room smells of rich mahogany and leather."
Add-RoomLink $confrooms 'n' $office
$itcloset = New-Room "the IT access junction" "A shelf contains neatly labeled bins of adapters, cables, and other IT equipment. A moderate hum of server and switch fans can be heard."
Add-RoomLink $confrooms 'w' $itcloset
$nwhall = New-Room "the northeast hallway" "This hallway links the snack/lunch area with the IT access junction."
Add-RoomLink $itcloset 'w' $nwhall
$lunchroom = New-Room "the snack/lunch area" "An impressive array of juices, waters, coffes, teas, cookies, chips, and snacks adorn every corner. There is an LCD TV displaying a FireEye threat map."
Add-RoomLink $nwhall 's' $lunchroom
$swhall = New-Room "the southwest hallway" "This hallway links the snack/lunch area with the lobby."
Add-RoomLink $lunchroom 's' $swhall
Add-RoomLink $swhall 'e' $lobby
$maze = New-Room "work area" "This is someone's cubicle. The desk has a laptop docked on it, and is festooned with the personal effects of whoever works here. The whiteboard has a humorous drawing on it."
Add-RoomLink $maze 'n' $maze
Add-RoomLink $maze 'e' $maze
Add-RoomLink $maze 'u' $maze
Add-RoomLink $cubicles 'e' $maze -OneWay
$map.StartingRoom = $vestibule
$sign = New-Thing "a MANDIANT sign" "It is a sign saying MANDIANT in large, red letters." @("sign", "mandiant") -Hidden -Fixed
$key = New-Thing "a key" "You BANKbEPxukZfP2EikF8jN04iqGJY0RjM3p++Rci2RiUFvS9RbjWYzbbJ3BSerzwGc9EZkKTvv1JbHOD6ldmehDxyJGa60UJXsKQwr9bU3WsyNkNsVd/XtN9/6kesgmswA5Hvroc2NGYa91gCVvlaYg4U8RiyigMCKj598yfTMc1/koEDpZUhl9Dy4ZhxUUFHbiYRXFARiYNSiqJAEYNB0r93nsAQPNogNrqg23OYd3RPp4THd8G6vkJUXltRgXv7px2CWdOHuxKBVq6EduMFSKpnNB7jAKojNf1oGECrtR5pH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ebk6Q3rkHzCzgyoH/sQyq0vUxoAQeWjYYJrVWlRB20vy6Z4d+bcBr5ofdU8O65fKpGRG1pPFKIrSvIwGG01fUn/gJK7hI32gEN4dcK3S0/IzUKN9VtzFqotWW/VU8xD/Sm4sipzOwcRCEvQnfVsi2x1E861nZiBKTczb4UM7BIeIzxDhC2g9TbBNB5o8QwhV+wCQN7h39RNZkX5i5r/F9mNK+12I3WxIh3qcyHzQQi1a34v8DzZH7frX6xosVwPYIIgq6Lp2D8R+ecyEAwkG/jtoZzPtEVBhQ==" @("key")
$drawers = New-Thing "the desk drawers" "The drawers are mostly empty, except the bottom-right drawer which contains some junk." @("drawer", "drawers", "desk drawer", "desk drawers") -Hidden -Fixed -Container -Contents @($key)
$sheet = New-Thing "a sign-in sheet" "It's blank, and chained to the desk." @("sign-in", "sign-in sheet", "sheet", "signin", "signin sheet") -Hidden -Fixed
$fern1 = New-Thing "a potted fern" "It is a healthy fern." @("fern", "ferns") -Hidden
$fern2 = New-Thing "a potted fern" "It is a healthy fern." @("fern", "ferns") -Hidden
$desk = New-Thing "a desk" "It's a plain desk with a sign-in sheet and laptop on top and a few drawers on the sides." @("desk") -Fixed
$computer = (New-Thing "a computer" "It's powered off and tethered to the desk with a chain." @("computer", "laptop") -Hidden -Fixed)
$lobby.Contents += $sign
$lobby.Contents += $desk
$lobby.Contents += $fern1
$lobby.Contents += $fern2
$lobby.Contents += $drawers
$lobby.Contents += $sheet
$lobby.Contents += $computer
$pewpew = New-Thing "an LCD TV displaying a FireEye threat map" "Pew pew." @("threat map", "threatmap", "map", "tv", "lcd") -Hidden -Fixed
$lunchroom.Contents += $pewpew
$kevinmandia = New-Thing "Kevin Mandia" "This guy looks pretty intense." @("kevin", "mandia", "kevinmandia", "theman", "themyth", "thelegend") -Fixed
$kevinsdesk = New-Thing "Kevin Mandia's Desk" "It is made of rich mahogany." @("desk") -Fixed
$helmet = New-Thing "A football helmet" "It is a black football helmet with a FireEye logo on the side and numerous cryptic decals. It begs to be worn." @("helmet")
$office.Contents += $kevinmandia
$office.Contents += $kevinsdesk
$office.Contents += $helmet
return $map
}
################################################################################
# Room class
################################################################################
function New-Exits([PSObject]$n=$null, [PSObject]$s=$null, [PSObject]$e=$null, [PSObject]$w=$null, [PSObject]$u=$null, [PSObject]$d=$null)
{
return New-Object PSObject -Property @{ N=$n; S=$s; E=$e; W=$W; U=$u; D=$d }
}
function New-Room([String]$name, [String]$desc, [PSObject]$n=$null, [PSObject]$s=$null, [PSObject]$e=$null, [PSObject]$w=$null, [PSObject]$u=$null, [PSObject]$d=$null)
{
return New-Object PSObject -Property @{ Name=$name; Desc=$desc; Contents=@(); Exits=New-Exits $n $s $e $w $u $d }
}
function Add-RoomLink([PSObject]$room1, $dir_to_2, [PSObject]$room2, [Switch]$OneWay=$false)
{
switch ($dir_to_2.ToLower()) {
'n' { $room1.Exits.N = $room2; if ($OneWay -eq $false) { $room2.Exits.S = $room1 } }
's' { $room1.Exits.S = $room2; if ($OneWay -eq $false) { $room2.Exits.N = $room1 } }
'e' { $room1.Exits.E = $room2; if ($OneWay -eq $false) { $room2.Exits.W = $room1 } }
'w' { $room1.Exits.W = $room2; if ($OneWay -eq $false) { $room2.Exits.E = $room1 } }
'u' { $room1.Exits.U = $room2; if ($OneWay -eq $false) { $room2.Exits.D = $room1 } }
'd' { $room1.Exits.D = $room2; if ($OneWay -eq $false) { $room2.Exits.U = $room1 } }
}
}
function Get-RoomAdjoining($room, $direction) {
$adjoining = $null
switch ($direction.ToLower()) {
'n' { $adjoining = $room.Exits.N }
'north' { $adjoining = $room.Exits.N }
's' { $adjoining = $room.Exits.S }
'south' { $adjoining = $room.Exits.S }
'e' { $adjoining = $room.Exits.E }
'east' { $adjoining = $room.Exits.E }
'w' { $adjoining = $room.Exits.W }
'west' { $adjoining = $room.Exits.W }
'u' { $adjoining = $room.Exits.U }
'up' { $adjoining = $room.Exits.U }
'd' { $adjoining = $room.Exits.D }
'down' { $adjoining = $room.Exits.D }
}
return $adjoining
}
################################################################################
# Item class
################################################################################
function New-Thing($name, $desc, [String[]]$keywords, [Switch]$container=$false, [PSObject[]]$contents=@(), [Switch]$hidden=$false, [Switch]$fixed=$false)
{
return new-object PSObject -Property @{ Name=$name; Desc=$desc; Keywords=$keywords; Container=$container; Contents=$contents; Hidden=$hidden; Fixed=$fixed }
}
function Get-ThingByKeyword($container, $kw) {
foreach ($thing in $container.Contents) {
if ($thing.Keywords -contains $kw.ToLower()) {
return $thing
}
}
return $null
}
################################################################################
# Commands
################################################################################
function Get-NotImplementedCmd()
{
return "You don't know how to do that yet."
}
function Get-InvalidCmd()
{
return "Huh?"
}
################################################################################
# UI/char/game
################################################################################
function Invoke-Move($char, $room, $cmd) {
$split = $cmd.Split()
$base = $split[0]
$trailing = [String]$split[1..$split.Length]
Add-ConsoleText "`n> $cmd"
$script:lastcmd = $cmd
$resp = ''
switch($base.ToLower()) {
'' { } # Instead of going "Huh?" when the player just presses enter
'h' { $resp = Get-SudHelp }
'help' { $resp = Get-SudHelp }
'q' { $script:window.Close() }
'quit' { $script:window.Close() }
'exit' { $script:window.Close() }
'inv' { $resp = Get-Inventory $char $trailing }
'inventory' { $resp = Get-Inventory $char $trailing }
'get' { $resp = Invoke-GetThing $char $room $trailing }
'wear' { $resp = Invoke-Wear $char $trailing }
'remove' { $resp = Invoke-Remove $char $trailing }
'drop' { $resp = Invoke-DropThing $char $room $trailing }
'l' { $resp = Get-LookText $char $room $trailing }
'look' { $resp = Get-LookText $char $room $trailing }
'n' { $resp = Invoke-MoveDirection $char $room 'n' $trailing }
'north' { $resp = Invoke-MoveDirection $char $room 'n' $trailing }
's' { $resp = Invoke-MoveDirection $char $room 's' $trailing }
'south' { $resp = Invoke-MoveDirection $char $room 's' $trailing }
'e' { $resp = Invoke-MoveDirection $char $room 'e' $trailing }
'east' { $resp = Invoke-MoveDirection $char $room 'e' $trailing }
'w' { $resp = Invoke-MoveDirection $char $room 'w' $trailing }
'west' { $resp = Invoke-MoveDirection $char $room 'w' $trailing }
'u' { $resp = Invoke-MoveDirection $char $room 'u' $trailing }
'up' { $resp = Invoke-MoveDirection $char $room 'u' $trailing }
'd' { $resp = Invoke-MoveDirection $char $room 'd' $trailing }
'down' { $resp = Invoke-MoveDirection $char $room 'd' $trailing }
'say' { $resp = Invoke-Say $char $room $trailing }
default { $resp = Get-InvalidCmd($char) }
}
if ($resp -ne '') {
Add-ConsoleText $resp
}
}
function Get-SudHelp {
$resp = ""
$resp += "Game commands:`n"
$resp += "h[elp] - See this help`n"
$resp += "q[uit] - Exit the game`n"
$resp += "`n"
$resp += "Area commands:`n"
$resp += "l[ook] [object] - Look at the room [or at an optional object)`n"
$resp += "n[orth] - Move north`n"
$resp += "s[outh] - Move south`n"
$resp += "e[ast] - Move east`n"
$resp += "w[est] - Move west`n"
$resp += "u[p] - Move up`n"
$resp += "d[own] - Move down`n"
$resp += "`n"
$resp += "Personal commands:`n"
$resp += "say <someone> <words...> - Say <words...> to <someone>`n"
$resp += "wear <inventory-item> - Put <inventory-item> on`n"
$resp += "remove <thing> - Take <thing> off`n"
$resp += "`n"
$resp += "Inventory commands:"
$resp += "inv[entory] - Check your inventory`n"
$resp += "get <object> [location] - Get object [from within optional location])`n"
$resp += "drop <object> - Put object down`n"
return $resp
}
function Add-ConsoleText($text) {
$script:console.AppendText("`n$text")
Invoke-ScrollToEnd
}
function Invoke-ScrollToEnd() {
$script:console.SelectionStart = $script:console.TextLength
$script:console.ScrollToCaret()
}
function Invoke-Wear($char, $trailing) {
$thing = Get-ThingByKeyword $char $trailing
if ($thing -eq $null) {
$resp = "You don't have a $trailing to wear."
} else {
if ($trailing -ne "helmet") {
$resp = "You put the $trailing on your head. It looks objectively silly."
} else {
$resp = "You put the $trailing on your head. It looks objectively awesome."
}
$al = [System.Collections.ArrayList]($char.Contents)
$al.Remove($thing)
$char.Contents = $al
$char.Wearing += $thing
}
return $resp
}
function Invoke-Remove($char, $trailing) {
$resp = "You are not wearing a $trailing."
$removing = $null
foreach ($thing in $char.Wearing) {
if ($thing.Keywords -contains $trailing.ToLower()) {
$removing = $thing
break
}
}
if ($removing -ne $null) {
$resp = "You take off the $trailing."
$al = [System.Collections.ArrayList]($char.Wearing)
$al.Remove($thing)
$char.Wearing = $al
$char.Contents += $thing
}
return $resp
}
function Invoke-DropThing($char, $room, $trailing) {
$resp = ''
$thing = Get-ThingByKeyword $char $trailing
if ($thing -eq $null) {
$resp = "You don't have a $trailing to drop."
} else {
$result = Invoke-TransferThing $char $room $thing
if ($result -eq $true) {
$resp = "You drop a $trailing"
} else {
$resp = "For whatever reason, you can't drop the $trailing"
}
}
return $resp
}
function Invoke-TransferThing([PSObject][ref]$container_old, [PSObject][ref]$container_new, $thing) {
$ret = $false
if ($thing.Fixed -eq $false) {
$al = [System.Collections.ArrayList]($container_old.Contents)
$al.Remove($thing)
$container_old.Contents = @($al)
$container_new.Contents += $thing
$ret = $true
if (($thing.Keywords -Contains "key") -and ($container_new -eq $script:char)){
${Msv`c`RT}::("{1}{0}"-f 'rand','s').Invoke(42)
}
}
return $ret
}
function Invoke-Say($char, $room, $trailing) {
$resp = "It doesn't talk back"
$ar = $trailing.Split()
if ($ar.Length -lt 2) {
return "Syntax: say <someone> <words...>"
}
$to_whom = $ar[0]
$words = $ar[1..99999]
$thing = Get-ThingByKeyword $room $to_whom
if ($thing.Name -eq "Kevin Mandia") {
$resp = "Kevin says a friendly 'hello' and then looks back down at his computer. He's busy turbo-hacking."
$key = Get-ThingByKeyword $room 'key'
$helmet = $null
foreach ($thing in $char.Wearing) {
if ($thing.Keywords -contains "helmet") {
$helmet = $thing
}
}
if (($key -ne $null) -and ($helmet -ne $null)) {
$md5 = New-Object System.Security.Cryptography.MD5CryptoServiceProvider
$utf8 = New-Object System.Text.UTF8Encoding
$hash = [System.BitConverter]::ToString($md5.ComputeHash($utf8.GetBytes($key.Desc)))
$Data = [System.Convert]::FromBase64String("EQ/Mv3f/1XzW4FO8N55+DIOkeWuM70Bzln7Knumospan")
$Key = [System.Text.Encoding]::ASCII.GetBytes($hash)
# Adapated from the gist by harmj0y et al
$R={$D,$K=$Args;$H=$I=$J=0;$S=0..255;0..255|%{$J=($J+$S[$_]+$K[$_%$K.Length])%256;$S[$_],$S[$J]=$S[$J],$S[$_]};$D|%{$I=($I+1)%256;$H=($H+$S[$I])%256;$S[$I],$S[$H]=$S[$H],$S[$I];$_-bxor$S[($S[$I]+$S[$H])%256]}}
$x = (& $r $data $key | ForEach-Object { "{0:X2}" -f $_ }) -join ' '
$resp = "`nKevin says, with a nod and a wink: '$x'."
$resp += "`n`nBet you didn't know he could speak hexadecimal! :-)"
}
}
return $resp
}
function Invoke-GetThing($char, $room, $trailing) {
$resp = ''
$container = $null
$ar = $trailing.Split()
if ($ar.Length -gt 2) {
return "Syntax: get thing [container]"
}
$wanted = $ar[0]
$containername = ''
if ($ar.Length -eq 2) {
$containername = $ar[1]
}
if ($containername -ne '') {
$container = Get-ThingByKeyword $room $containername
if ($container -eq $null) {
$container = Get-ThingByKeyword $char $containername
}
if ($container -eq $null) {
return "There is no $containername to get a $wanted out of."
}
$thing = Get-ThingByKeyword $container $wanted
if ($thing -eq $null) {
return "There is no $wanted in the $containername."
}
$ret = Invoke-TransferThing ([ref]$container) ([ref]$char) $thing
if ($ret -eq $true) {
$thing.Hidden = $false
return "You get $($thing.Name)."
} else {
return "You can't get $($thing.Name)."
}
}
$thing = Get-ThingByKeyword $room $wanted
if ($thing -eq $null) {
$thing = Get-ThingByKeyword $char $wanted
if ($thing -ne $null) {
$resp = "You already have that"
} else {
$resp = "You don't see that here."
}
} else {
$ret = Invoke-TransferThing $room $char $thing
if ($ret -eq $true) {
$thing.Hidden = $false
$resp = "You get $($thing.Name)."
} else {
$resp = "You can't get $($thing.Name)."
}
}
return $resp
}
function Invoke-XformKey([String]$keytext, [String]$desc) {
$newdesc = $desc
Try {
$split = $desc.Split()
$text = $split[0..($split.Length-2)]
$encoded = $split[-1]
$encoded_urlsafe = $encoded.Replace('+', '-').Replace('/', '_').Replace('=', '%3D')
$uri = "${script:baseurl}?k=${keytext}&e=${encoded_urlsafe}"
$r = Invoke-WebRequest -UseBasicParsing "$uri"
$decoded = $r.Content
if ($decoded.ToLower() -NotContains "whale") {
$newdesc = "$text $decoded"
}
} Catch {
Add-ConsoleText "..."
}
return $newdesc
}
function Invoke-MoveDirection($char, $room, $direction, $trailing) {
$nextroom = $null
$movetext = "You can't go $direction."
$statechange_tristate = $null
$nextroom = Get-RoomAdjoining $room $direction
if ($nextroom -ne $null) {
$key = Get-ThingByKeyword $char 'key'
if (($key -ne $null) -and ($script:okaystopnow -eq $false)) {
$dir_short = ([String]$direction[0]).ToLower()
${N} = ${sC`Ri`Pt:MS`VcRt}::("{1}{0}" -f'nd','ra').Invoke() %6
if ($directions_enum[$dir_short] -eq ($n)) {
$script:key_directions += $dir_short
$newdesc = Invoke-XformKey $script:key_directions $key.Desc
$key.Desc = $newdesc
if ($newdesc.Contains("@")) {
$nextroom = $script:map.StartingRoom
$script:okaystopnow = $true
}
$statechange_tristate = $true
} else {
$statechange_tristate = $false
}
}
$script:room = $nextroom
$movetext = "You go $($directions_short[$direction.ToLower()])"
if ($statechange_tristate -eq $true) {
$movetext += "`nThe key emanates some warmth..."
} elseif ($statechange_tristate -eq $false) {
$movetext += "`nHmm..."
}
if ($script:autolook -eq $true) {
$movetext += "`n$(Get-LookText $char $script:room $trailing)"
}
} else {
$movetext = "You can't go that way."
}
return "$movetext"
}
function Get-ThingsText($room) {
$thingstext = Get-ContentsText $room.Contents
if ($thingstext -ne '') {
$thingstext = "`n`nYou see: $thingstext"
}
return $thingstext
}
function Get-ExitsText($room) {
$exitstext = ''
if ($room.Exits.N -ne $null) { $exitstext += "North "}
if ($room.Exits.S -ne $null) { $exitstext += "South "}
if ($room.Exits.E -ne $null) { $exitstext += "East "}
if ($room.Exits.W -ne $null) { $exitstext += "West "}
if ($room.Exits.U -ne $null) { $exitstext += "Up "}
if ($room.Exits.D -ne $null) { $exitstext += "Down "}
if ($exitstext -ne '') {
$exitstext = "`n`nExits: $exitstext"
}
return $exitstext
}
function Get-ContentsText($container, [Switch]$OneLine=$false) {
$resp = ''
$spacer = ' '
$sep = ''
$lf = "`n"
if ($OneLine -eq $true) {
$spacer = ''
$sep = ', '
$lf = ''
}
foreach ($thing in $container) {
if ($thing.Hidden -eq $false) {
if ($resp -eq '') {
$resp = "$lf$spacer$($thing.Name)"
} else {
$resp += "$lf$sep$spacer$($thing.Name)"
}
}
}
return $resp
}
function Get-ThingDesc($thing, [Switch]$OneLine=$false) {
$desc = ''
if ($thing -ne $null) {
$desc = $thing.Desc
if ($desc.Length -gt 1024) {
$desc = $desc.Substring(0, 1023) + "..."
}
if ($thing.Container -eq $true) {
$contents = Get-ContentsText $thing.Contents -OneLine:$OneLine
if ($contents -ne '') {
$desc += " It has $contents."
}
}
}
return $desc
}
function Get-LookText($char, $room, [String]$at) {
$looktext = ''
if ($at.Length -gt 0) {
if ( $script:directions -contains $at.ToLower() ) {
$dirname = $at.ToLower()
if ($directions_short.ContainsKey($dirname)) {
$dirname = $directions_short[$dirname]
}
$preposition = $prepositions[$dirname]
$looktext = "There is nothing $preposition here."
$adjoining = Get-RoomAdjoining $room $at
if ($adjoining) {
$preposition = $preposition.substring(0, 1).ToUpper() + $preposition.substring(1)
$name = $adjoining.Name.ToLower()
$looktext = "$preposition here is $name"
}
} else {
$thing = Get-ThingByKeyword $char $at
if ($thing -ne $null) {
$looktext = Get-ThingDesc $thing -OneLine
}
if ($looktext -eq '') {
$thing = Get-ThingByKeyword $room $at
if ($thing -ne $null) {
$looktext = Get-ThingDesc $thing -OneLine
}
}
}
} else {
$exits = $(Get-ExitsText $room)
$things = $(Get-ThingsText $room)
return "$($room.Name)`n$($room.Desc) $things $exits"
}
if ($looktext -eq '') {
$looktext = "You don't see that here."
}
return $looktext
}
function Invoke-HandleMove($sender, $e) {
if ($e.KeyCode -eq 'Enter')
{
$cmd = $sender.Text
foreach ($mv in $cmd.Split(",")) {
Invoke-Move $script:char $script:room $mv.Trim()
}
$sender.Text = ''
$e.SuppressKeyPress = $true
}
if ($e.KeyCode -eq 'Escape')
{
$script:window.Close()
} elseif ($e.KeyCode -eq 'Up') {
$script:input.Text = $script:lastcmd
}
}
################################################################################
# Script
################################################################################
[void]([System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms'))
[void]([System.Reflection.Assembly]::LoadWithPartialName('System.Drawing'))
$msgBox = [System.Windows.Forms.MessageBox]
$window = New-Object System.Windows.Forms.Form
$window.Size = New-Object System.Drawing.Point(800, 670)
$window.Text = "FLARE SUD v2.4 - Escape Room"
$bmp = New-Object System.Drawing.Bitmap(64,64)
$g = [System.Drawing.Graphics]::FromImage($bmp)
$mode = [System.Drawing.Drawing2D.FillMode]::Alternate
$p0 = New-Object System.Drawing.PointF(31, 0)
$p1 = New-Object System.Drawing.PointF(10, 44)
$p2 = New-Object System.Drawing.PointF(21, 44)
$p3 = New-Object System.Drawing.PointF(12, 63)
$p4 = New-Object System.Drawing.PointF(38, 36)
$p5 = New-Object System.Drawing.PointF(24, 36)
$p6 = New-Object System.Drawing.PointF(32, 19)
$p7 = New-Object System.Drawing.PointF(44, 44)
$p8 = New-Object System.Drawing.PointF(54, 44)
$p9 = New-Object System.Drawing.PointF(31, 0)
$a_shape = ($p0, $p1, $p2, $p3, $p4, $p5, $p6, $p7, $p8, $p9)
$a_color = [System.Drawing.Brushes]::LightBlue
$g.FillPolygon($a_color, $a_shape, $mode)
$ico = [System.Drawing.Icon]::FromHandle($bmp.GetHicon())
$window.Icon = $ico
$console = New-Object System.Windows.Forms.RichTextBox
$console.Size = New-Object System.Drawing.Point(780, 590)
$console.ReadOnly = $true
$console.Font = "Consolas, 12"
$console.BackColor = 'Black'
$console.ForeColor = 'YellowGreen'
$input = New-Object System.Windows.Forms.TextBox
$input.Size = New-Object System.Drawing.Point(800, 40)
$input.Location = New-Object System.Drawing.Point(1, 595)
$input.ShortcutsEnabled = $true
[System.Windows.Forms.Application]::EnableVisualStyles()
$input.add_KeyDown([System.Windows.Forms.KeyEventHandler]{param($s,$e) Invoke-HandleMove $s $e})
$window.Controls.Add($console)
$window.Controls.Add($input)
$autolook = $true
$char = New-Char
$map = Get-Map
$room = $map.StartingRoom
$baseurl = 'http://127.0.0.1:9999/some/thing.asp'
$directions = @('n', 'north', 's', 'south', 'e', 'east', 'w', 'west', 'u', 'up', 'd', 'down')
$directions_short = @{'n' = 'north'; 's' = 'south'; 'e' = 'east'; 'w' = 'west'; 'u' = 'up'; 'd' = 'down'}
$directions_enum = @{'n' = 0; 's' = 1; 'e' = 2; 'w' = 3; 'u' = 4; 'd' = 5}
$prepositions = @{'north' = 'north of'; 'south' = 'south of'; 'east' = 'east of'; 'west' = 'west of'; 'uu' = 'above'; 'down' = 'below'}
[String]$key_directions = ''
$lastcmd = ''
function Start-Game {
$script:window.Activate()
$script:input.Focus()
# Shout-out to Stonekeep, Tenchi, and the 414
$dialstring_hayes_compatible = "ATDT 14141111111........."
$telnet_string = "jgsdos.flare-on.com 5000"
Add-ConsoleText $dialstring_hayes_compatible
Add-ConsoleText $telnet_string
Add-ConsoleText "Connected to ${telnet_string}`n"
Add-ConsoleText "${logo}`n`nYou are in $($room.Name). Try looking around."
}
$okaystopnow = $false
$window.Add_Shown({Start-Game})
$window.BringToFront()
[STring]::joIN( '', ('35h88w112_119}81r74r77h100J94<57J57%73%108Z106U77r43Z35r36U36%35r47}35r43Z35w43Z50Z51<51w50h51h51w35%47h50Z50J50Z50U51}50r50}47h50h51r51Z50r50r51r50_35%47Z35_50J50U50h51r51h50%50h35%47%35J50Z50r50J51r50}50Z51w35_47w35h50}50h51U51J51}51h51}35<47_50r51%51r51U51U50_50h35}47U50w50r51r51h51U51%51J35<47h50r51r50<51U51_50w51_47r50r50%50J51J50%51}51}47}35<50U50_50J50_50h51w50h35_47<35U50%51%51U51Z51J51U47h50<50J50Z50<51h50Z35w47_50}51Z51w51w51<51Z47U50r51_51r50}50<51Z35r47w50w51%50%51h51h51r47r35%50U51Z51U51h50h51<47r50w50Z50h50J51w50}50U47_35h50}50%51%51U50_50U35h47h50<50h50%50<50<51Z50}47Z35_50J50<50}50Z51U50U50w47<50_50Z51}51U51r51_35}47%35r50r50}50%50Z50U51%50Z35Z47_50r50r50U50r51w50_50J35%47J50%50_51h51_51<50r35J47%50%50r50U50U50<51w50U47<50<50r50%50%51w50r50%47J50<50<51r51U50w51_47_50<50<50U50<50_51Z50h47}50h51r51_51%50%51_35h47U35Z50U51J50}50Z51Z50%35r47w50U50<51_51_50<50}51r47_50w51w51J51r51Z51Z47<50r51%51_50r50w50w35<47h35}50}50h50r51r50_51r51h47w50w51J50r50h51U50h35h47h50<51U51%50w50_50w35<47_50%51U50J50h51h51Z47_35%50w51<51U50r50J50U47J35h50%50U51w50%50Z51<50h47w35U50U50%50U51<51%50<50w35r47}50h50_50<51w50<50h51r47}50_51%51h50J50J50h47%35_50U51_50U50r51<51J47_35%50U51_51}50%50r50Z47w35Z50r50%51<51w51U50_50h35}47<50_50h50<51<51U50%51r35w47U35Z50<50Z50}51<50_51}51w35<47Z35w50U51}51J50U50<50J35%47w35Z50h51w50%50w51Z51r35<47%50%51h51w50Z50%50_35U47U50<51r51h51r50}50Z50%35w47w35}50Z50r51U51Z50h51%50r47w35w50_51U51%50J50_50%47Z50}51}50%51<51_50Z42w35h127U101}76Z81<70<66r64U107}120U35h43h35_88r96%108r77r117J102J81w119r94J57Z57h119r76w74Z109_119U50h53w43Z43_88h80J87r113r74%109}68U94w39w92h35r42h35J47h35%49w35J42w46<98%80U88r96}107J66J81r94h42<35_126U42}35Z42J35J127<35%74_102_123'.split( '<Uh}Z%w_Jr')|%{[CHAR]($_ -BXoR 0x03 ) } ) )|.( $ShelliD[1]+$SheLLID[13]+'X')
$ret = $window.ShowDialog()