Moved definition of what robots have which stats into the player interface

This commit is contained in:
Fraser Graham
2016-07-13 16:04:48 -06:00
parent 70adb5b713
commit 35cb8431f6
6 changed files with 273 additions and 148 deletions
+3 -5
View File
@@ -52,7 +52,7 @@ type decoder interface {
}
// Negotiate runs through the hackerbots negociation protocol.
func (c *Client) Negotiate(clientType string) (err error) {
func (c *Client) Negotiate(clientType string, player Player) (err error) {
c.ws, err = connect(c.Server, c.Port)
if err != nil {
return errors.New(fmt.Sprintf("connection failure: %s", err))
@@ -114,10 +114,8 @@ func (c *Client) Negotiate(clientType string) (err error) {
switch clientType {
case "robot":
conf := server.ClientConfig{
ID: c.GameId,
Stats: map[string]server.StatsRequest{
c.Name: c.StatsReq,
},
ID: c.GameId,
Stats: player.GetStats(),
}
err = websocket.JSON.Send(c.ws, conf)