Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

94 improve exception strings #21

Closed
Changes from 1 commit
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
1d14e66
Action type (#1)
KingPhilip14 Feb 23, 2023
4954557
Create avatar.py (#2)
KingPhilip14 Feb 24, 2023
7e594d2
Added Generic Tile (#4)
JeanAEckelberg Feb 24, 2023
5e7753d
Created Generic Item (#3)
JeanAEckelberg Feb 25, 2023
aac9df2
Update helpers.py (#7)
JeanAEckelberg Mar 1, 2023
9518a3f
base of interact_controller (#5)
MoodyMan04 Mar 2, 2023
7236b50
Station (#9)
MoodyMan04 Mar 2, 2023
8de2b63
Added avatar implementations into the player.py file (#11)
KingPhilip14 Mar 3, 2023
4f03c8f
Added random seed integration. (#10)
KingPhilip14 Mar 3, 2023
9a12a0d
Movement controller (#6)
JuliaCaesar Mar 3, 2023
5b1720f
Created the vector.py file (#12)
KingPhilip14 Mar 4, 2023
88ef882
wall created (#13)
MoodyMan04 Mar 4, 2023
6343d98
Major changes (#15)
MoodyMan04 Mar 8, 2023
d004d49
Game board (#16)
KingPhilip14 Apr 1, 2023
0d10e63
Vector changes (#18)
KingPhilip14 Apr 1, 2023
2951bdb
Player (#17)
JuliaCaesar Apr 1, 2023
be0cba4
Update item.py (#19)
MoodyMan04 Apr 1, 2023
a3afa91
Circular import fix (#20)
MoodyMan04 Apr 12, 2023
d8ec4d6
Master controller (#14)
JuliaCaesar Apr 15, 2023
78eab66
Item inventory features (#21)
KingPhilip14 Apr 15, 2023
fbe4e4b
Test item/avatar (#23)
KingPhilip14 Apr 19, 2023
2f750f3
tests for game_board + changes (#22)
MoodyMan04 Apr 22, 2023
72216e1
Deleted Duplicate game_board (#27)
KingPhilip14 Apr 22, 2023
4ffbc26
Test interact controller (#25)
MoodyMan04 Apr 22, 2023
4376595
Items/maps/stations documentation (#24)
KingPhilip14 Apr 22, 2023
141b4ba
New Documentation (#28)
KingPhilip14 Apr 29, 2023
547b5d6
Controller documentation (#29)
KingPhilip14 Apr 29, 2023
b8da8e8
Test player (#26)
JuliaCaesar Apr 29, 2023
8ca5d9e
Created Inventory Controller Tests (#30)
KingPhilip14 May 6, 2023
37a3662
tests for station & test fixes (#31)
MoodyMan04 May 6, 2023
1a196a4
Game board get object update (#32)
JeanAEckelberg May 6, 2023
3b06a3d
Test player (#33)
JuliaCaesar May 6, 2023
e43e64e
Avatar improvements (#36)
KingPhilip14 May 20, 2023
0583ae8
Update python-app.yml
JeanAEckelberg May 26, 2023
c02b728
Changed debug to use the logging module (#37)
JeanAEckelberg May 27, 2023
812176f
Made inventory tests (#38)
KingPhilip14 May 27, 2023
90ca0d2
Fix merge (#46)
JeanAEckelberg May 27, 2023
a1a857f
Fixed README (#68)
KingPhilip14 Jul 15, 2023
1413abb
Visualizer (#79)
JeanAEckelberg Sep 2, 2023
c72d003
Base file (#80)
KingPhilip14 Sep 9, 2023
f0fe075
Base models (#81)
KingPhilip14 Sep 9, 2023
50f297b
Added Schemas, main database, main (#82)
JeanAEckelberg Sep 9, 2023
4a09d04
Added Schemas, main database, main (#84)
JeanAEckelberg Sep 16, 2023
a8fe6ee
Univeristy model (#83)
KingPhilip14 Sep 16, 2023
01bd879
fix requirements and imports (#85)
JeanAEckelberg Sep 16, 2023
45b62fc
Game generation tweak (#89)
JeanAEckelberg Sep 22, 2023
e327632
Merge branch 'server' into master
JeanAEckelberg Sep 22, 2023
7c19efd
Fixing sphinx error (#95)
KingPhilip14 Oct 1, 2023
d348bca
Fixing sphinx error (#96)
KingPhilip14 Oct 1, 2023
d55ed2f
Changed bytesprite architecture and implemented new config (#104)
JeanAEckelberg Oct 4, 2023
f0963b4
Fixed error with missing codec by using new codec, after doing so rea…
JeanAEckelberg Oct 5, 2023
ff26acd
Please look over with great power and responsibility (#108)
JeanAEckelberg Oct 7, 2023
a15bb78
Folder docs complete (#109)
KingPhilip14 Oct 7, 2023
c9ed7c2
Made requested changes (#110)
KingPhilip14 Oct 7, 2023
7574fb9
Changed the ValueError message to the structure of f'{self.class.name…
CaitlinAzazel Nov 18, 2023
5f9e72c
Changed the ValueError message to the structure of f'{self.class.name…
CaitlinAzazel Nov 18, 2023
5e29350
Changed the ValueError message to the structure of f'{self.class.name…
CaitlinAzazel Nov 18, 2023
a45b9b6
Changed the ValueError message to the structure of f'{self.class.name…
CaitlinAzazel Nov 18, 2023
baba80e
Changed the ValueError message to the structure of f'{self.class.name…
CaitlinAzazel Nov 18, 2023
06d57ee
Changed the ValueError message to the structure of f'{self.class.name…
CaitlinAzazel Nov 18, 2023
a8e4bd7
Edited test files in occupiable_station.py, test_avatar.py, test_avat…
CaitlinAzazel Nov 26, 2023
08ef01b
Edited test files in occupiable_station.py, test_avatar.py, test_avat…
CaitlinAzazel Nov 26, 2023
612c6db
Changes by ianth
CaitlinAzazel Nov 26, 2023
1869a3e
fixed tests that were failing.
CaitlinAzazel Nov 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added avatar implementations into the player.py file (#11)
* Added avatar implementations into the player.py file

Imported the Avatar class and added getter and setter methods for all the fields of the class. To and From json methods now include avatar as well.

* Changed constructor method

Added type hinting into the constructor method.
  • Loading branch information
KingPhilip14 authored Mar 3, 2023
commit 8de2b6307c73c3625781af83f5cc0d1de7d6bcb6
71 changes: 58 additions & 13 deletions game/common/player.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,64 @@
import uuid

from game.common.action import Action
from game.common.game_object import GameObject
from game.common.avatar import Avatar
from game.common.enums import *


class Player(GameObject):
def __init__(self, code=None, team_name=None, action=None):
def __init__(self, code: object = None, team_name: str = None, action: Action = None, avatar: Avatar = None):
super().__init__()
self.object_type = ObjectType.player

self.functional = True
self.error = None
self.team_name = team_name
self.code = code
self.action = action
self.object_type: ObjectType = ObjectType.PLAYER
self.functional: bool = True
self.error: object = None
self.team_name: str = team_name
self.code: object = code
self.action: Action = action
self.avatar: Avatar = avatar

@property
def action(self) -> Action: # Will need to change Avatar class to the enum eventually
return self.__action

@action.setter
def action(self, action: Action):
if action is None or isinstance(action, Action):
self.__action = action

@property
def functional(self) -> bool:
return self.__functional

@functional.setter
def functional(self, functional: bool):
if functional is None or isinstance(functional, bool):
self.__functional = functional

@property
def team_name(self) -> str:
return self.__team_name

@team_name.setter
def team_name(self, team_name: str):
if team_name is None or isinstance(team_name, str):
self.__team_name = team_name

@property
def avatar(self) -> Avatar:
return self.__avatar

@avatar.setter
def avatar(self, avatar: Avatar):
if avatar is None or isinstance(avatar, Avatar):
self.__avatar = avatar

@property
def object_type(self) -> ObjectType:
return self.object_type

@object_type.setter
def object_type(self, object_type: ObjectType):
if object_type is None or isinstance(object_type, GameObject):
self.__object_type = object_type

def to_json(self):
data = super().to_json()
Expand All @@ -23,6 +67,7 @@ def to_json(self):
data['error'] = self.error
data['team_name'] = self.team_name
data['action'] = self.action.to_json() if self.action is not None else None
data['avatar'] = self.avatar.to_json() if self.avatar is not None else None

return data

Expand All @@ -32,12 +77,12 @@ def from_json(self, data):
self.functional = data['functional']
self.error = data['error']
self.team_name = data['team_name']
act = Action()
self.action = act.from_json(data['action']) if data['action'] is not None else None
self.action = Action().from_json(data['action']) if data['action'] is not None else None
self.avatar = Avatar().from_json(data['avatar']) if data['avatar'] is not None else None

def __str__(self):
p = f"""ID: {self.id}
Team name: {self.team_name}
Action: {self.action}
"""
return p
return p