uuid -> id
This commit is contained in:
@ -18,23 +18,23 @@ def main() -> None:
|
||||
print()
|
||||
print("Initial player position is", game.player.position)
|
||||
|
||||
player_uuid = game.player.uuid
|
||||
player_id = game.player.id
|
||||
|
||||
try:
|
||||
print("Trying to move right")
|
||||
moveResult = fh.move(player_uuid, Direction.RIGHT)
|
||||
moveResult = fh.move(player_id, Direction.RIGHT)
|
||||
print("Successfully moved to", moveResult.player.position)
|
||||
|
||||
print("Trying to move right")
|
||||
moveResult = fh.move(player_uuid, Direction.RIGHT)
|
||||
moveResult = fh.move(player_id, Direction.RIGHT)
|
||||
print("Successfully moved to", moveResult.player.position)
|
||||
|
||||
print("Trying to move right")
|
||||
moveResult = fh.move(player_uuid, Direction.RIGHT)
|
||||
moveResult = fh.move(player_id, Direction.RIGHT)
|
||||
print("Successfully moved to", moveResult.player.position)
|
||||
|
||||
print("Trying to move down")
|
||||
moveResult = fh.move(player_uuid, Direction.DOWN)
|
||||
moveResult = fh.move(player_id, Direction.DOWN)
|
||||
print("Successfully moved to", moveResult.player.position)
|
||||
except PositionError:
|
||||
print("Cant't move in this direction")
|
||||
|
||||
@ -42,7 +42,7 @@ class Destination(BaseModel):
|
||||
|
||||
|
||||
class Player(BaseModel):
|
||||
uuid: str
|
||||
id: str
|
||||
name: str
|
||||
active: bool
|
||||
position: Position
|
||||
@ -95,8 +95,8 @@ class FairHopper:
|
||||
r.raise_for_status()
|
||||
return GameInfoResponse(**r.json())
|
||||
|
||||
def get_player_info(self, uuid: str) -> PlayerInfoResponse:
|
||||
r = requests.get(self.format_url(f"/player/{uuid}"))
|
||||
def get_player_info(self, id: str) -> PlayerInfoResponse:
|
||||
r = requests.get(self.format_url(f"/player/{id}"))
|
||||
|
||||
if r.status_code == 403:
|
||||
raise PlayerInactiveError()
|
||||
@ -107,20 +107,20 @@ class FairHopper:
|
||||
|
||||
return PlayerInfoResponse(**r.json())
|
||||
|
||||
def move_left(self, uuid: str) -> PlayerInfoResponse:
|
||||
return self.move(uuid, Direction.LEFT)
|
||||
def move_left(self, id: str) -> PlayerInfoResponse:
|
||||
return self.move(id, Direction.LEFT)
|
||||
|
||||
def move_right(self, uuid: str) -> PlayerInfoResponse:
|
||||
return self.move(uuid, Direction.RIGHT)
|
||||
def move_right(self, id: str) -> PlayerInfoResponse:
|
||||
return self.move(id, Direction.RIGHT)
|
||||
|
||||
def move_up(self, uuid: str) -> PlayerInfoResponse:
|
||||
return self.move(uuid, Direction.UP)
|
||||
def move_up(self, id: str) -> PlayerInfoResponse:
|
||||
return self.move(id, Direction.UP)
|
||||
|
||||
def move_down(self, uuid: str) -> PlayerInfoResponse:
|
||||
return self.move(uuid, Direction.DOWN)
|
||||
def move_down(self, id: str) -> PlayerInfoResponse:
|
||||
return self.move(id, Direction.DOWN)
|
||||
|
||||
def move(self, uuid: str, direction: Direction) -> PlayerInfoResponse:
|
||||
path = f"/player/{uuid}/move/{direction}"
|
||||
def move(self, id: str, direction: Direction) -> PlayerInfoResponse:
|
||||
path = f"/player/{id}/move/{direction}"
|
||||
r = requests.post(self.format_url(path))
|
||||
|
||||
if r.status_code == 403:
|
||||
|
||||
Reference in New Issue
Block a user