|  |  | @ -160,7 +160,7 @@ func printWelcomeScreen(redisClient *redis.Client) string { | 
			
		
	
		
		
			
				
					
					|  |  |  | 			printRegisterScreen(redisClient) |  |  |  | 			printRegisterScreen(redisClient) | 
			
		
	
		
		
			
				
					
					|  |  |  | 		case "w": |  |  |  | 		case "w": | 
			
		
	
		
		
			
				
					
					|  |  |  | 			clearScreen() |  |  |  | 			clearScreen() | 
			
		
	
		
		
			
				
					
					|  |  |  | 			printProgressScreen(redisClient) |  |  |  | 			printProgressScreen(redisClient, "") | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 		case "q": |  |  |  | 		case "q": | 
			
		
	
		
		
			
				
					
					|  |  |  | 			exec.Command("stty", "-F", "/dev/tty", "echo", "-cbreak").Run() |  |  |  | 			exec.Command("stty", "-F", "/dev/tty", "echo", "-cbreak").Run() | 
			
		
	
		
		
			
				
					
					|  |  |  | 			clearScreen() |  |  |  | 			clearScreen() | 
			
		
	
	
		
		
			
				
					|  |  | @ -200,7 +200,7 @@ func printUserScreen(redisClient *redis.Client, username string) string { | 
			
		
	
		
		
			
				
					
					|  |  |  | 			printWelcomeScreen(redisClient) |  |  |  | 			printWelcomeScreen(redisClient) | 
			
		
	
		
		
			
				
					
					|  |  |  | 		case "w": |  |  |  | 		case "w": | 
			
		
	
		
		
			
				
					
					|  |  |  | 			clearScreen() |  |  |  | 			clearScreen() | 
			
		
	
		
		
			
				
					
					|  |  |  | 			printProgressScreen(redisClient) |  |  |  | 			printProgressScreen(redisClient, username) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 		case "p": |  |  |  | 		case "p": | 
			
		
	
		
		
			
				
					
					|  |  |  | 			wg.Add(1) |  |  |  | 			wg.Add(1) | 
			
		
	
		
		
			
				
					
					|  |  |  | 			currentTime := time.Now().UTC() |  |  |  | 			currentTime := time.Now().UTC() | 
			
		
	
	
		
		
			
				
					|  |  | @ -342,6 +342,12 @@ func printRegisterScreen(redisClient *redis.Client) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 			userPath := fmt.Sprintf("%s/user/%s/ttyrec/", config.NethackLauncher.HackDir, username) |  |  |  | 			userPath := fmt.Sprintf("%s/user/%s/ttyrec/", config.NethackLauncher.HackDir, username) | 
			
		
	
		
		
			
				
					
					|  |  |  | 			exec.Command("mkdir", "-p", userPath).Run() |  |  |  | 			exec.Command("mkdir", "-p", userPath).Run() | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			// copy in rc file
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			// TODO make sure rc file exists before copying
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			hackRCLoc := fmt.Sprintf("%s/.nethackrc", config.NethackLauncher.HackDir) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			hackRCDest := fmt.Sprintf("%s/user/%s/.nethackrc", config.NethackLauncher.HackDir, username) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			exec.Command("cp", hackRCLoc, hackRCDest).Run() | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 			// back to main screen
 |  |  |  | 			// back to main screen
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 			printUserScreen(redisClient, username) |  |  |  | 			printUserScreen(redisClient, username) | 
			
		
	
		
		
			
				
					
					|  |  |  | 		} |  |  |  | 		} | 
			
		
	
	
		
		
			
				
					|  |  | @ -351,7 +357,7 @@ func printRegisterScreen(redisClient *redis.Client) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | func printProgressScreen(redisClient *redis.Client) { |  |  |  | func printProgressScreen(redisClient *redis.Client, username string) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 	// print header
 |  |  |  | 	// print header
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	fmt.Printf(" %s\n", config.NethackLauncher.ServerDisplay) |  |  |  | 	fmt.Printf(" %s\n", config.NethackLauncher.ServerDisplay) | 
			
		
	
		
		
			
				
					
					|  |  |  | 	println("") |  |  |  | 	println("") | 
			
		
	
	
		
		
			
				
					|  |  | @ -401,7 +407,11 @@ func printProgressScreen(redisClient *redis.Client) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 		if string(b) == "\n" { |  |  |  | 		if string(b) == "\n" { | 
			
		
	
		
		
			
				
					
					|  |  |  | 			exec.Command("stty", "-F", "/dev/tty", "echo", "-cbreak").Run() |  |  |  | 			exec.Command("stty", "-F", "/dev/tty", "echo", "-cbreak").Run() | 
			
		
	
		
		
			
				
					
					|  |  |  | 			clearScreen() |  |  |  | 			clearScreen() | 
			
		
	
		
		
			
				
					
					|  |  |  | 			printWelcomeScreen(redisClient) |  |  |  | 			if username == "" { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				printWelcomeScreen(redisClient) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			} else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				printUserScreen(redisClient, username) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  | 		} |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 		// check if selection is in out map
 |  |  |  | 		// check if selection is in out map
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -421,10 +431,12 @@ func printProgressScreen(redisClient *redis.Client) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 			nh.Stdin = os.Stdin |  |  |  | 			nh.Stdin = os.Stdin | 
			
		
	
		
		
			
				
					
					|  |  |  | 			nh.Stderr = os.Stderr |  |  |  | 			nh.Stderr = os.Stderr | 
			
		
	
		
		
			
				
					
					|  |  |  | 			nh.Run() |  |  |  | 			nh.Run() | 
			
		
	
		
		
			
				
					
					|  |  |  | 			// TODO add username to this
 |  |  |  | 			if username == "" { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				printWelcomeScreen(redisClient) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			} else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				printUserScreen(redisClient, username) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  | 			// TODO fix bug where user has to <ctrl-c> when game exists
 |  |  |  | 			// TODO fix bug where user has to <ctrl-c> when game exists
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 			//printUserScreen(redisClient, username)
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 			printWelcomeScreen(redisClient) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 		} |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
	
		
		
			
				
					|  |  | 
 |