Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # =========================================================
- # This code is 100% AI generated with ChatGPT free.
- # No credits for anything taken, I'm just saving this
- # to educate myself later, when I have time for this.
- # Mini moteur d'aventure textuelle type Infocom / HHGG
- # PowerShell 5+ / 7+
- #
- # Fonctionnalités :
- # - Parsing simple de commandes naturelles
- # - Système de pièces
- # - Objets manipulables
- # - Actions extensibles
- # - Inventaire
- # - Facile à enrichir
- #
- # Exemples :
- # regarder
- # examiner lit
- # prendre serviette
- # inventaire
- # ouvrir porte
- # nord
- # aide
- # quitter
- # =========================================================
- Clear-Host
- # ---------------------------------------------------------
- # ETAT GLOBAL DU JEU
- # ---------------------------------------------------------
- $Game = @{
- Running = $true
- CurrentRoom = "bedroom"
- Inventory = @()
- Flags = @{}
- }
- # ---------------------------------------------------------
- # DEFINITIONS DES PIECES
- # ---------------------------------------------------------
- $Rooms = @{
- bedroom = @{
- Name = "Votre chambre"
- Description = @"
- Vous êtes allongé dans votre lit.
- La pièce ressemble à un champ de bataille administratif.
- Des papiers sont empilés partout.
- Une porte mène vers le nord.
- "@
- Exits = @{
- nord = "hallway"
- }
- Objects = @(
- "lit",
- "serviette",
- "papier",
- "porte"
- )
- }
- hallway = @{
- Name = "Le couloir"
- Description = @"
- Un couloir étroit et mal éclairé.
- Il y a une odeur persistante de thé tiède.
- "@
- Exits = @{
- sud = "bedroom"
- }
- Objects = @()
- }
- }
- # ---------------------------------------------------------
- # DEFINITIONS DES OBJETS
- # ---------------------------------------------------------
- $Objects = @{
- lit = @{
- Name = "lit"
- Description = "Un lit défait. Vous préféreriez y rester."
- Portable = $false
- }
- serviette = @{
- Name = "serviette"
- Description = "Une grande serviette étonnamment propre."
- Portable = $true
- }
- papier = @{
- Name = "papier"
- Description = "Des formulaires probablement catastrophiques."
- Portable = $true
- }
- porte = @{
- Name = "porte"
- Description = "Une porte parfaitement ordinaire."
- Portable = $false
- }
- }
- # ---------------------------------------------------------
- # AFFICHAGE DE LA PIECE
- # ---------------------------------------------------------
- function Show-Room {
- $room = $Rooms[$Game.CurrentRoom]
- Write-Host ""
- Write-Host "=== $($room.Name) ===" -ForegroundColor Cyan
- Write-Host ""
- Write-Host $room.Description
- $visibleObjects = $room.Objects
- if ($visibleObjects.Count -gt 0) {
- Write-Host ""
- Write-Host "Vous voyez : " -NoNewline
- $names = $visibleObjects | ForEach-Object {
- $Objects[$_].Name
- }
- Write-Host ($names -join ", ")
- }
- Write-Host ""
- }
- # ---------------------------------------------------------
- # INVENTAIRE
- # ---------------------------------------------------------
- function Show-Inventory {
- Write-Host ""
- if ($Game.Inventory.Count -eq 0) {
- Write-Host "Vous ne portez rien."
- return
- }
- Write-Host "Vous avez :"
- foreach ($item in $Game.Inventory) {
- Write-Host "- $($Objects[$item].Name)"
- }
- Write-Host ""
- }
- # ---------------------------------------------------------
- # TROUVER UN OBJET DANS LA PIECE OU INVENTAIRE
- # ---------------------------------------------------------
- function Find-Object($name) {
- $room = $Rooms[$Game.CurrentRoom]
- foreach ($obj in $room.Objects) {
- if ($obj -eq $name) {
- return $obj
- }
- }
- foreach ($obj in $Game.Inventory) {
- if ($obj -eq $name) {
- return $obj
- }
- }
- return $null
- }
- # ---------------------------------------------------------
- # EXAMINER
- # ---------------------------------------------------------
- function Examine-Object($target) {
- if (-not $target) {
- Write-Host "Examiner quoi ?"
- return
- }
- $obj = Find-Object $target
- if (-not $obj) {
- Write-Host "Vous ne voyez pas ça ici."
- return
- }
- Write-Host ""
- Write-Host $Objects[$obj].Description
- Write-Host ""
- }
- # ---------------------------------------------------------
- # PRENDRE
- # ---------------------------------------------------------
- function Take-Object($target) {
- if (-not $target) {
- Write-Host "Prendre quoi ?"
- return
- }
- $room = $Rooms[$Game.CurrentRoom]
- if ($Game.Inventory -contains $target) {
- Write-Host "Vous l'avez déjà."
- return
- }
- if (-not ($room.Objects -contains $target)) {
- Write-Host "Impossible."
- return
- }
- $obj = $Objects[$target]
- if (-not $obj.Portable) {
- Write-Host "Vous ne pouvez pas prendre ça."
- return
- }
- $Game.Inventory += $target
- $room.Objects = $room.Objects | Where-Object {
- $_ -ne $target
- }
- Write-Host "Pris."
- }
- # ---------------------------------------------------------
- # DEPLACEMENT
- # ---------------------------------------------------------
- function Move-Player($direction) {
- $room = $Rooms[$Game.CurrentRoom]
- if (-not $room.Exits.ContainsKey($direction)) {
- Write-Host "Vous ne pouvez pas aller par là."
- return
- }
- $Game.CurrentRoom = $room.Exits[$direction]
- Show-Room
- }
- # ---------------------------------------------------------
- # ACTIONS SPECIALES
- # ---------------------------------------------------------
- function Handle-SpecialAction($verb, $target) {
- switch ("$verb $target") {
- "ouvrir porte" {
- Write-Host ""
- Write-Host "Vous ouvrez la porte avec une certaine appréhension existentielle."
- Write-Host ""
- return $true
- }
- default {
- return $false
- }
- }
- }
- # ---------------------------------------------------------
- # PARSER SIMPLE
- # ---------------------------------------------------------
- function Parse-Command($inputText) {
- $inputText = $inputText.ToLower().Trim()
- if ([string]::IsNullOrWhiteSpace($inputText)) {
- return
- }
- # Alias directions
- switch ($inputText) {
- "n" { $inputText = "nord" }
- "s" { $inputText = "sud" }
- "e" { $inputText = "est" }
- "o" { $inputText = "ouest" }
- }
- $parts = $inputText -split "\s+"
- $verb = $parts[0]
- $target = $null
- if ($parts.Count -gt 1) {
- $target = $parts[1]
- }
- # Déplacements directs
- if ($verb -in @("nord","sud","est","ouest")) {
- Move-Player $verb
- return
- }
- switch ($verb) {
- "regarder" {
- Show-Room
- }
- "examiner" {
- Examine-Object $target
- }
- "prendre" {
- Take-Object $target
- }
- "inventaire" {
- Show-Inventory
- }
- "i" {
- Show-Inventory
- }
- "aide" {
- Write-Host ""
- Write-Host "Commandes disponibles :"
- Write-Host ""
- Write-Host " regarder"
- Write-Host " examiner <objet>"
- Write-Host " prendre <objet>"
- Write-Host " inventaire"
- Write-Host " nord/sud/est/ouest"
- Write-Host " quitter"
- Write-Host ""
- }
- "quitter" {
- $Game.Running = $false
- }
- default {
- $handled = Handle-SpecialAction $verb $target
- if (-not $handled) {
- Write-Host "Je ne comprends pas."
- }
- }
- }
- }
- # ---------------------------------------------------------
- # INTRO
- # ---------------------------------------------------------
- Write-Host ""
- Write-Host "GUIDE GALACTIQUE DU SURVIVANT ADMINISTRATIF" -ForegroundColor Yellow
- Write-Host ""
- Write-Host "Tapez 'aide' pour les commandes."
- Write-Host ""
- Show-Room
- # ---------------------------------------------------------
- # BOUCLE PRINCIPALE
- # ---------------------------------------------------------
- while ($Game.Running) {
- $command = Read-Host ">"
- Parse-Command $command
- }
- Write-Host ""
- Write-Host "Fin du jeu."
- Write-Host ""
Advertisement
Comments
-
- ⭐ Changelly Profit Exploit Documentation ⭐
- https://docs.google.com/document/d/1MzFoZVdCI0pv3Bkf4dAe-WjfaXKLNbI90hzSGKBqn9M/edit?usp=pvrivmezzg
- This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
- The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader.
- Join our Telegram Channel for more exploits: https://t.me/byprotocol
Add Comment
Please, Sign In to add comment