Prettified the Game UI

This commit is contained in:
Starstreak 2025-08-07 10:56:59 +00:00
parent b5e38d09de
commit 8e843d4e6c

91
main.go
View file

@ -13,7 +13,7 @@ import (
"github.com/charmbracelet/lipgloss"
)
// These are variables for embeding files - dont remove them, they just look like comments
// =-=-=-=-=-= These are variables for embeding files as hardcoded strings - dont remove them, they just LOOK like comments =-=-=-=-=-=-=
//go:embed menu.txt
var menu string
@ -42,32 +42,42 @@ var hitTheStreets string
//go:embed levels/doctorsRoom.txt
var doctorsRoom string
// End File Ebeds
// =-=-=-=-=-=-= End File String Embeds =-=-=-=-=-=-=
// other variables - keep these from mixing with above embed strigs - its a weird go thing
var stats string
var statsCombat string
var PlayerName string
var condoms = 0
var std = false
var money = 1800
var experience = 100
var level = 1
var whores = 1
var cocaines = 0
var fentanyl = 0
var LSD = 0
var bumfights = 25
// Game Variables - Core Gameplay
var stats string // variable for stats generation output
var statsCombat string // variable used for combat stats during fights
var PlayerName string // player's name...
var condoms = 0 // its better to have them and not need them
var std = false // what happens if you have connies
var money = 1800 // not specific currency
var days = 30 // total number of days (default 30)
var experience = 0 // your experience from combat battle fights (starts at 0)
var level = 1 // your level from combat battle fights (starts at 1)
var whores = 1 // number of sex slaves you own
var cocaines = 0 // cocaine in 1/gram units
var fentanyl = 0 // fentanyl in 500 miligram units
var LSD = 0 // LSD in pills
var bumfights = 25 // number of homeless bum fights per day
// Lipgloss - Props to
var border = lipgloss.NewStyle().
BorderStyle(lipgloss.NormalBorder()).
BorderForeground(lipgloss.Color("63"))
var storyBorder = lipgloss.NewStyle().
var titleStyle = lipgloss.NewStyle().
BorderStyle(lipgloss.NormalBorder()).
BorderForeground(lipgloss.Color("#f20b0bff")).
Foreground(lipgloss.Color("#ffffffff ")).
Background(lipgloss.Color("#f20b0bff"))
var storyStyle = lipgloss.NewStyle().
BorderStyle(lipgloss.NormalBorder()).
Width(75).
BorderForeground(lipgloss.Color("228")).
BorderBackground(lipgloss.Color("#0000FF"))
BorderBackground(lipgloss.Color("#0000FF")).
Foreground(lipgloss.Color("#ffffffff ")).
Background(lipgloss.Color("#0000FF"))
var statsStyle = lipgloss.NewStyle().
BorderStyle(lipgloss.NormalBorder()).
@ -75,20 +85,20 @@ var statsStyle = lipgloss.NewStyle().
Background(lipgloss.Color("#2a2a60ff"))
var red = lipgloss.NewStyle().
Foreground(lipgloss.Color("#ffffffff ")).
Background(lipgloss.Color("#f20b0bff"))
Foreground(lipgloss.Color("#f20b0bff"))
var pink = lipgloss.NewStyle().
Foreground(lipgloss.Color("#ee00e2ff "))
var green = lipgloss.NewStyle().
Foreground(lipgloss.Color("#18e60aff ")).
Background(lipgloss.Color("#55576aff"))
Foreground(lipgloss.Color("#18e60aff "))
// why the fuck does golang not do this - should work on win10/11 (yes it does support ansi escape codes *now*)
func ClearScreen() {
fmt.Print("\033[H\033[2J")
}
// Cool stylized Enter key masher
func MashEnterKey() {
fmt.Println(statsStyle.Render("Mash the 'Enter' key!"))
bufio.NewReader(os.Stdin).ReadBytes('\n')
@ -105,13 +115,13 @@ func HitTheStreets() {
choice := ""
for i < 1 {
ClearScreen()
fmt.Println(storyBorder.Render(hitTheStreets))
fmt.Println(storyStyle.Render(hitTheStreets))
fmt.Println("Your choice,")
fmt.Print(green.Render(PlayerName), ">")
fmt.Scan(&choice)
if strings.ToUpper(choice) == "B" {
ClearScreen()
fmt.Println(storyBorder.Render("Bum Fight!"))
fmt.Println(storyStyle.Render("Bum Fight!"))
fmt.Println()
fmt.Println("You encounter a ", red.Render("homeless piece of shit!"))
fmt.Println("")
@ -161,7 +171,7 @@ func RedRoom() {
i := 0
choice := ""
for i < 1 {
fmt.Println(storyBorder.Render(redRoom))
fmt.Println(storyStyle.Render(redRoom))
fmt.Println("Your choice,")
fmt.Print(green.Render(PlayerName), ">")
fmt.Scan(&choice)
@ -292,13 +302,13 @@ func DoctorsOffice() {
choice := ""
for i < 1 {
ClearScreen()
fmt.Println(storyBorder.Render(doctorsRoom))
fmt.Println(storyStyle.Render(doctorsRoom))
fmt.Println("Your choice,")
fmt.Print(green.Render(PlayerName), ">")
fmt.Scan(&choice)
if strings.ToUpper(choice) == "C" {
ClearScreen()
fmt.Println(storyBorder.Render("Doctor's Miracle STD/STI Cures"))
fmt.Println(storyStyle.Render("Doctor's Miracle STD/STI Cures"))
fmt.Println()
fmt.Println("You encounter ", red.Render("the doctor."))
fmt.Println("")
@ -354,7 +364,7 @@ func PropertyRoom() {
i := 0
choice := ""
for i < 1 {
fmt.Println(storyBorder.Render(propertyRoom))
fmt.Println(storyStyle.Render(propertyRoom))
fmt.Println("Your choice,")
fmt.Print(green.Render(PlayerName), ">")
fmt.Scan(&choice)
@ -448,7 +458,7 @@ func PropertyRoom() {
func ClockOut() {
choice := 0
ClearScreen()
fmt.Println(storyBorder.Render(wifey))
fmt.Println(storyStyle.Render(wifey))
for choice < 1 {
fmt.Println("Your choice,")
fmt.Print(green.Render(PlayerName), ">")
@ -488,11 +498,24 @@ func ClockOut() {
default:
choice = 0
}
ClearScreen()
fmt.Println(border.Render("It is a new day!"))
if days == 0 {
fmt.Println("You have run out of days...")
MashEnterKey()
}
days = days - 1
}
}
func GameOver() {
}
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" + "LSD (tabs): " + strconv.Itoa(LSD) // builds the stats paragraph for the main screen
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" + "LSD (tabs): " + strconv.Itoa(LSD) + "\n" + "Days Left: " + strconv.Itoa(days) // builds the stats paragraph for the main screen
}
func CombatStats() {
@ -555,19 +578,19 @@ func MainMachine() {
func ScreenMachine() {
CheckStats()
fmt.Println(border.Render("OPP Wars - Corruption"))
fmt.Println(storyStyle.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(titleStyle.Render("OPP Wars - Corruption"))
fmt.Println(officerStyle.Render(officers))
MashEnterKey()
ClearScreen()
fmt.Println(border.Render("OPP Wars - Corruption"))
fmt.Println(storyBorder.Render(intro))
fmt.Println(storyStyle.Render("OPP Wars - Corruption"))
fmt.Println(storyStyle.Render(intro))
fmt.Print("Enter your damned name, Constable: ")
reader := bufio.NewReader(os.Stdin)
prompt, _ := reader.ReadString('\n')