diff --git a/event.go b/event.go index 6ce2984..713a08e 100644 --- a/event.go +++ b/event.go @@ -121,13 +121,14 @@ type EventWin struct { type EventSettings struct { Event - AutoPlay bool - Highlight bool - Pips bool - Moves bool - Flip bool - Advanced bool - Speed int8 + AutoPlay bool + Highlight bool + Pips bool + Moves bool + Flip bool + Traditional bool + Advanced bool + Speed int8 } type EventReplay struct { diff --git a/go.mod b/go.mod index d705fb5..483dc34 100644 --- a/go.mod +++ b/go.mod @@ -32,13 +32,13 @@ require ( github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect - github.com/rivo/uniseg v0.4.6 // indirect + github.com/rivo/uniseg v0.4.7 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf // indirect github.com/vanng822/css v1.0.1 // indirect github.com/vanng822/go-premailer v1.20.2 // indirect golang.org/x/crypto v0.19.0 // indirect - golang.org/x/net v0.20.0 // indirect + golang.org/x/net v0.21.0 // indirect golang.org/x/sys v0.17.0 // indirect golang.org/x/text v0.14.0 // indirect ) diff --git a/go.sum b/go.sum index 47c3fcd..938e6f8 100644 --- a/go.sum +++ b/go.sum @@ -78,8 +78,8 @@ github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.6 h1:Sovz9sDSwbOz9tgUy8JpT+KgCkPYJEN/oYzlJiYTNLg= -github.com/rivo/uniseg v0.4.6/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= +github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= +github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -123,8 +123,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= -golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= diff --git a/pkg/server/account.go b/pkg/server/account.go index d0455dd..6c57e36 100644 --- a/pkg/server/account.go +++ b/pkg/server/account.go @@ -6,13 +6,14 @@ type account struct { username []byte password []byte - autoplay bool - highlight bool - pips bool - moves bool - flip bool - advanced bool - speed int8 + autoplay bool + highlight bool + pips bool + moves bool + flip bool + traditional bool + advanced bool + speed int8 casual *clientRating competitive *clientRating diff --git a/pkg/server/database.go b/pkg/server/database.go index ffb4eec..a0c81a7 100644 --- a/pkg/server/database.go +++ b/pkg/server/database.go @@ -52,6 +52,7 @@ CREATE TABLE account ( pips smallint NOT NULL DEFAULT 1, moves smallint NOT NULL DEFAULT 0, flip smallint NOT NULL DEFAULT 0, + traditional smallint NOT NULL DEFAULT 0, advanced smallint NOT NULL DEFAULT 0, speed smallint NOT NULL DEFAULT 1 ); @@ -343,8 +344,8 @@ func accountByID(id int) (*account, error) { casual: &clientRating{}, competitive: &clientRating{}, } - var autoplay, highlight, pips, moves, flip, advanced int - err = tx.QueryRow(context.Background(), "SELECT id, email, username, password, autoplay, highlight, pips, moves, flip, advanced, speed, casual_backgammon_single, casual_backgammon_multi, casual_acey_single, casual_acey_multi, casual_tabula_single, casual_tabula_multi, rated_backgammon_single, rated_backgammon_multi, rated_acey_single, rated_acey_multi, rated_tabula_single, rated_tabula_multi FROM account WHERE id = $1", id).Scan(&a.id, &a.email, &a.username, &a.password, &autoplay, &highlight, &pips, &moves, &flip, &advanced, &a.speed, &a.casual.backgammonSingle, &a.casual.backgammonMulti, &a.casual.aceySingle, &a.casual.aceyMulti, &a.casual.tabulaSingle, &a.casual.tabulaMulti, &a.competitive.backgammonSingle, &a.competitive.backgammonMulti, &a.competitive.aceySingle, &a.competitive.aceyMulti, &a.competitive.tabulaSingle, &a.competitive.tabulaMulti) + var autoplay, highlight, pips, moves, flip, traditional, advanced int + err = tx.QueryRow(context.Background(), "SELECT id, email, username, password, autoplay, highlight, pips, moves, flip, traditional, advanced, speed, casual_backgammon_single, casual_backgammon_multi, casual_acey_single, casual_acey_multi, casual_tabula_single, casual_tabula_multi, rated_backgammon_single, rated_backgammon_multi, rated_acey_single, rated_acey_multi, rated_tabula_single, rated_tabula_multi FROM account WHERE id = $1", id).Scan(&a.id, &a.email, &a.username, &a.password, &autoplay, &highlight, &pips, &moves, &flip, &traditional, &advanced, &a.speed, &a.casual.backgammonSingle, &a.casual.backgammonMulti, &a.casual.aceySingle, &a.casual.aceyMulti, &a.casual.tabulaSingle, &a.casual.tabulaMulti, &a.competitive.backgammonSingle, &a.competitive.backgammonMulti, &a.competitive.aceySingle, &a.competitive.aceyMulti, &a.competitive.tabulaSingle, &a.competitive.tabulaMulti) if err != nil { return nil, nil } @@ -353,6 +354,7 @@ func accountByID(id int) (*account, error) { a.pips = pips == 1 a.moves = moves == 1 a.flip = flip == 1 + a.traditional = traditional == 1 a.advanced = advanced == 1 return a, nil } diff --git a/pkg/server/server_command.go b/pkg/server/server_command.go index 8be4f24..29f36bb 100644 --- a/pkg/server/server_command.go +++ b/pkg/server/server_command.go @@ -189,13 +189,14 @@ COMMANDS: if cmd.client.account != nil { a := cmd.client.account cmd.client.sendEvent(&bgammon.EventSettings{ - AutoPlay: a.autoplay, - Highlight: a.highlight, - Pips: a.pips, - Moves: a.moves, - Flip: a.flip, - Advanced: a.advanced, - Speed: a.speed, + AutoPlay: a.autoplay, + Highlight: a.highlight, + Pips: a.pips, + Moves: a.moves, + Flip: a.flip, + Traditional: a.traditional, + Advanced: a.advanced, + Speed: a.speed, }) } @@ -1110,7 +1111,7 @@ COMMANDS: } name := string(bytes.ToLower(params[0])) - settings := []string{"autoplay", "highlight", "pips", "moves", "flip", "advanced", "speed"} + settings := []string{"autoplay", "highlight", "pips", "moves", "flip", "traditional", "advanced", "speed"} var found bool for i := range settings { if name == settings[i] {