package characters import ( "fmt" "git.stinnesbeck.com/nils/artifacts/api" ) // Move will try to move a character to a map tile located at x,y func Move(name string, x, y int) (CharacterMovement, error) { // these are the possible response codes, other than 200 OK responseCodes := map[int]string{ 404: "Map not found.", 486: "Character is locked. Action is already in progress.", 490: "Character already at destination.", 498: "Character not found.", 499: "Character in cooldown.", } var movement = struct { X int `json:"x"` Y int `json:"y"` }{ X: x, Y: y, } return api.Post[CharacterMovement](fmt.Sprintf("/my/%s/action/move", name), movement, responseCodes) } // Move will try to move a character to a map tile located at x,y func (c *Character) Move(x, y int) (CharacterMovement, error) { return Move(c.Name, x, y) }