Chore: refactor; mark words [WIP]
This commit is contained in:
		| @@ -63,6 +63,11 @@ type BotPlayer struct { | ||||
| 	Team UserTeam | ||||
| } | ||||
|  | ||||
| type CardMark struct { | ||||
| 	Username string | ||||
| 	Active   bool | ||||
| } | ||||
|  | ||||
| type Room struct { | ||||
| 	ID             string    `json:"id" db:"id"` | ||||
| 	CreatedAt      time.Time `json:"created_at" db:"created_at"` // limit? | ||||
| @@ -89,11 +94,24 @@ type Room struct { | ||||
| 	RoundTime      int32  `json:"round_time"` | ||||
| 	IsOver         bool | ||||
| 	TeamWon        UserTeam // blue | red | ||||
| 	// | ||||
| 	Mark CardMark // card is marked | ||||
| 	// needed for debug | ||||
| 	LogJournal   []string | ||||
| 	LastActionTS time.Time | ||||
| } | ||||
|  | ||||
| func (r *Room) RemovePlayer(username string) { | ||||
| 	r.RedTeam.Guessers = utils.RemoveFromSlice(username, r.RedTeam.Guessers) | ||||
| 	r.BlueTeam.Guessers = utils.RemoveFromSlice(username, r.BlueTeam.Guessers) | ||||
| 	if r.RedTeam.Mime == username { | ||||
| 		r.RedTeam.Mime = "" | ||||
| 	} | ||||
| 	if r.BlueTeam.Mime == username { | ||||
| 		r.BlueTeam.Mime = "" | ||||
| 	} | ||||
| } | ||||
|  | ||||
| // FindBotByTeamRole returns bot name if found; otherwise empty string | ||||
| func (r *Room) FindBotByTeamRole(team, role string) string { | ||||
| 	for bn, b := range r.BotMap { | ||||
| @@ -249,9 +267,10 @@ func (r *Room) RevealSpecificWord(word string) { | ||||
| } | ||||
|  | ||||
| type WordCard struct { | ||||
| 	Word     string    `json:"word"` | ||||
| 	Color    WordColor `json:"color"` | ||||
| 	Revealed bool      `json:"revealed"` | ||||
| 	Word     string     `json:"word"` | ||||
| 	Color    WordColor  `json:"color"` | ||||
| 	Revealed bool       `json:"revealed"` | ||||
| 	Mark     []CardMark `json:"marks"` | ||||
| } | ||||
|  | ||||
| type GameSettings struct { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Grail Finder
					Grail Finder