oppwars/main.go
2025-08-07 06:38:43 +00:00

291 lines
7.3 KiB
Go

package main
import (
"fmt"
"math/rand/v2"
"os"
"strconv"
"strings"
"bufio"
_ "embed"
"github.com/charmbracelet/lipgloss"
)
//go:embed menu.txt
var menu string
//go:embed levels/wifey.txt
var wifey string
//go:embed levels/wife-fucked.txt
var wifeyFucked string
//go:embed officers.txt
var officers string
//go:embed intro.txt
var intro string
//go:embed levels/propertyRoom.txt
var propertyRoom string
// other variables - keep these from mixing with above embed strigs - its a weird go thing
var stats string
var PlayerName string
var condoms = 10
var money = 1800
var whores = 1
var cocaines = 0
var fentanyl = 0
var oxies = 0
var LSD = 0
var border = lipgloss.NewStyle().
BorderStyle(lipgloss.NormalBorder()).
BorderForeground(lipgloss.Color("63"))
var storyBorder = lipgloss.NewStyle().
BorderStyle(lipgloss.NormalBorder()).
Width(75).
BorderForeground(lipgloss.Color("228")).
BorderBackground(lipgloss.Color("#0000FF"))
var statsStyle = lipgloss.NewStyle().
BorderStyle(lipgloss.NormalBorder()).
Foreground(lipgloss.Color("#ffffffff ")).
Background(lipgloss.Color("#2a2a60ff"))
var red = lipgloss.NewStyle().
Foreground(lipgloss.Color("#ffffffff ")).
Background(lipgloss.Color("#f20b0bff"))
var green = lipgloss.NewStyle().
Foreground(lipgloss.Color("#18e60aff ")).
Background(lipgloss.Color("#55576aff"))
func ClearScreen() {
fmt.Print("\033[H\033[2J")
}
func MashEnterKey() {
fmt.Println(statsStyle.Render("Mash the 'Enter' key!"))
bufio.NewReader(os.Stdin).ReadBytes('\n')
}
func breakRoom() {
fmt.Println("Not Implemented")
MainMachine()
}
func doctorsRoom() {
fmt.Println("Not Implemented")
MainMachine()
}
func hitTheStreets() {
fmt.Println("Not Implemented")
MainMachine()
}
func PropertyRoom() {
ClearScreen()
i := 0
choice := ""
for i < 1 {
fmt.Println(storyBorder.Render(propertyRoom))
fmt.Println("Your choice,")
fmt.Print(green.Render(PlayerName), ">")
fmt.Scan(&choice)
if strings.ToUpper(choice) == "C" {
ClearScreen()
fmt.Println(border.Render("Cocaine Menu"))
fmt.Println("Price: ", red.Render("$1000 per gram."))
fmt.Println("Your cash: $", strconv.Itoa(money))
fmt.Println("")
fmt.Println("Buy one gram (Y/N)?")
cokePurchase := ""
fmt.Scan(&cokePurchase)
if strings.ToUpper(cokePurchase) == "Y" {
if money > 1000 {
cocaines = cocaines + 1
money = money - 1000
fmt.Println("You just purchased 1 gram of coke!")
MashEnterKey()
i = 0
} else {
fmt.Println(red.Render("Get some money, broke-ass!"))
MashEnterKey()
i = 0
}
} else {
i = 0
}
} else if strings.ToUpper(choice) == "L" {
ClearScreen()
fmt.Println(border.Render("LSD Menu"))
fmt.Println("Price: ", red.Render("$100 for five tabs."))
fmt.Println("Your cash: $", strconv.Itoa(money))
fmt.Println("")
fmt.Println("Buy six tabs (Y/N)?")
LSDPurchase := ""
fmt.Scan(&LSDPurchase)
if strings.ToUpper(LSDPurchase) == "Y" {
if money > 100 {
LSD = LSD + 5
money = money - 100
fmt.Println("You just purchased 5 tabs of LSD!")
MashEnterKey()
i = 0
} else {
fmt.Println(red.Render("Get some money, broke-ass!"))
MashEnterKey()
i = 0
}
} else {
i = 0
}
} else if strings.ToUpper(choice) == "F" {
ClearScreen()
fmt.Println(border.Render("Fentanyl Menu"))
fmt.Println("Price: ", red.Render("$500 per hundred milligrams."))
fmt.Println("Your cash: $", strconv.Itoa(money))
fmt.Println("")
fmt.Println("Buy 100 milligrams (Y/N)?")
fentyPurchase := ""
fmt.Scan(&fentyPurchase)
if strings.ToUpper(fentyPurchase) == "Y" {
if money > 500 {
fentanyl = fentanyl + 1
money = money - 500
fmt.Println("You just purchased 1 bag of fenty!")
MashEnterKey()
i = 0
} else {
fmt.Println(red.Render("Get some money, broke-ass!"))
MashEnterKey()
i = 0
}
} else {
i = 0
}
} else if strings.ToUpper(choice) == "R" {
i = 1
MainMachine()
} else {
i = 0
}
}
}
func redRoom() {
fmt.Println("Not Implemented")
MainMachine()
}
func ClockOut() {
choice := 0
ClearScreen()
fmt.Println(storyBorder.Render(wifey))
for choice < 1 {
fmt.Println("Your choice,")
fmt.Print(green.Render(PlayerName), ">")
fmt.Scan(&choice)
switch choice {
case 1:
chance := rand.IntN(100)
if chance < 50 {
ClearScreen()
if cocaines < 1 {
fmt.Println(red.Render("You pull out 1kg of cocaine and smash it open all over your face"))
cocaines = cocaines - 1
fmt.Println(red.Render("You shout 'COKE SLAM!'"))
fmt.Println(red.Render("You bust your wife right in the fucking face!"))
fmt.Println(red.Render("YARRRRR! (You don't know why you're a pirate now)"))
MashEnterKey()
} else {
fmt.Println(red.Render("You bust your wife right in the fucking face!"))
}
} else {
ClearScreen()
fmt.Println(red.Render("You try to bust your wife in the face but she dodges you and runs out the front door!"))
fmt.Println(red.Render("Oh well.. who is she gonna call bro?"))
MashEnterKey()
}
choice = 1
case 2:
fmt.Println(border.Render(wifeyFucked))
fmt.Println("You fuck your wife like one of your dirty whores!")
MashEnterKey()
choice = 1
case 3:
fmt.Println("You take some of your drugs. You are enjoying your life for once.")
choice = 1
default:
choice = 0
}
}
}
func CheckStats() {
stats = "PLAYER STATS" + "\n\n" + "Name " + "\n" + PlayerName + "\n" + "Condoms: " + strconv.Itoa(condoms) + "\n" + "Money: $" + strconv.Itoa(money) + "\n" + "Whores:" + strconv.Itoa(whores) + "\n" + "Cocaine (1 gram bags): " + strconv.Itoa(cocaines) + "\n" + "Fentanyl (100/mg bags): " + strconv.Itoa(fentanyl) + "\n" + "Oxycodone (pills): " + strconv.Itoa(oxies) + "\n" + "LSD (tabs): " + strconv.Itoa(LSD) // builds the stats paragraph for the main screen
}
func MainMachine() {
ClearScreen()
i := 0
choice := ""
for i < 1 {
ScreenMachine()
fmt.Println("Your choice,")
fmt.Print(green.Render(PlayerName), ">")
fmt.Scan(&choice)
if strings.ToUpper(choice) == "H" {
hitTheStreets()
i = 1
} else if strings.ToUpper(choice) == "P" {
PropertyRoom()
i = 1
} else if strings.ToUpper(choice) == "B" {
breakRoom()
i = 1
} else if strings.ToUpper(choice) == "R" {
redRoom()
i = 1
} else if strings.ToUpper(choice) == "D" {
doctorsRoom()
i = 1
} else if strings.ToUpper(choice) == "G" {
ClockOut()
i = 1
} else {
i = 0
}
}
}
func ScreenMachine() {
CheckStats()
fmt.Println(border.Render("OPP Wars - Corruption"))
fmt.Println(lipgloss.JoinHorizontal(lipgloss.Top, border.Render(menu), statsStyle.Render(stats))) // makes a horizontal display joining two paras
}
func main() {
officerStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("0000FF"))
fmt.Println(border.Render("OPP Wars - Corruption"))
fmt.Println(officerStyle.Render(officers))
MashEnterKey()
ClearScreen()
fmt.Println(border.Render("OPP Wars - Corruption"))
fmt.Println(storyBorder.Render(intro))
fmt.Print("Enter your damned name, Constable: ")
reader := bufio.NewReader(os.Stdin)
prompt, _ := reader.ReadString('\n')
playerNameMaker := strings.Clone(prompt)
PlayerName = strings.TrimRight(playerNameMaker, "\n") // removes a trailing "Return" key that fucks everything up (i dont want the enter key IN the variable)
ClearScreen()
MainMachine()
}