graph-games-proto 0.3.1756__py3-none-any.whl → 0.3.1757__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- graph_games_proto/fns.py +47 -3
- {graph_games_proto-0.3.1756.dist-info → graph_games_proto-0.3.1757.dist-info}/METADATA +1 -1
- {graph_games_proto-0.3.1756.dist-info → graph_games_proto-0.3.1757.dist-info}/RECORD +5 -5
- {graph_games_proto-0.3.1756.dist-info → graph_games_proto-0.3.1757.dist-info}/WHEEL +0 -0
- {graph_games_proto-0.3.1756.dist-info → graph_games_proto-0.3.1757.dist-info}/top_level.txt +0 -0
graph_games_proto/fns.py
CHANGED
@@ -2361,6 +2361,35 @@ class PublicPlayerScore(PClass):
|
|
2361
2361
|
items=[ScoreItem2.__fromdict__(x) for x in d["items"]],
|
2362
2362
|
total=d["total"]
|
2363
2363
|
)
|
2364
|
+
|
2365
|
+
|
2366
|
+
class ScoreItemBonus(PClass):
|
2367
|
+
bonus_uuid = field(type=str)
|
2368
|
+
def __todict__(self):
|
2369
|
+
return {
|
2370
|
+
"bonus_uuid": self.bonus_uuid,
|
2371
|
+
}
|
2372
|
+
@staticmethod
|
2373
|
+
def __fromdict__(d):
|
2374
|
+
return ScoreItemBonus(
|
2375
|
+
bonus_uuid=d["bonus_uuid"],
|
2376
|
+
)
|
2377
|
+
|
2378
|
+
|
2379
|
+
class ScoreItemGoal(PClass):
|
2380
|
+
goal_uuid = field(type=str)
|
2381
|
+
complete = field(type=bool)
|
2382
|
+
def __todict__(self):
|
2383
|
+
return {
|
2384
|
+
"goal_uuid": self.goal_uuid,
|
2385
|
+
"complete": self.complete,
|
2386
|
+
}
|
2387
|
+
@staticmethod
|
2388
|
+
def __fromdict__(d):
|
2389
|
+
return ScoreItemGoal(
|
2390
|
+
goal_uuid=d["goal_uuid"],
|
2391
|
+
complete=d["complete"],
|
2392
|
+
)
|
2364
2393
|
|
2365
2394
|
|
2366
2395
|
class ScoreItemOwnsPath(PClass):
|
@@ -2386,18 +2415,24 @@ class ScoreItem2(PClass):
|
|
2386
2415
|
amount = field(type=int)
|
2387
2416
|
description = field(type=(str, type(None)), initial=None)
|
2388
2417
|
owns_path = field(type=(ScoreItemOwnsPath, type(None)), initial=None) # Optional[ScoreItemOwnsPath]
|
2418
|
+
goal = field(type=(ScoreItemGoal, type(None)), initial=None) # Optional[FrozenGoal]
|
2419
|
+
bonus = field(type=(ScoreItemBonus, type(None)), initial=None) # Optional[FrozenGoal]
|
2389
2420
|
def __todict__(self):
|
2390
2421
|
return {
|
2391
2422
|
"amount": self.amount,
|
2392
2423
|
"description": self.description,
|
2393
2424
|
"owns_path": self.owns_path.__todict__() if self.owns_path else None,
|
2425
|
+
"goal": self.goal.__todict__() if self.goal else None,
|
2426
|
+
"bonus": self.bonus.__todict__() if self.bonus else None,
|
2394
2427
|
}
|
2395
2428
|
@staticmethod
|
2396
2429
|
def __fromdict__(d):
|
2397
2430
|
return ScoreItem2(
|
2398
2431
|
amount=d["amount"],
|
2399
2432
|
description=d.get("description"), # Handle None case
|
2400
|
-
owns_path=ScoreItemOwnsPath.__fromdict__(d["owns_path"]) if d.get("owns_path") else None
|
2433
|
+
owns_path=ScoreItemOwnsPath.__fromdict__(d["owns_path"]) if d.get("owns_path") else None,
|
2434
|
+
goal=ScoreItemGoal.__fromdict__(d["goal"]) if d.get("goal") else None,
|
2435
|
+
bonus=ScoreItemBonus.__fromdict__(d["bonus"]) if d.get("bonus") else None,
|
2401
2436
|
)
|
2402
2437
|
|
2403
2438
|
|
@@ -3026,6 +3061,7 @@ def score_public_items(game, player_idx):
|
|
3026
3061
|
ScoreItem2(
|
3027
3062
|
amount=bonus.score,
|
3028
3063
|
description="Player {} wins bonus {}".format(player_idx, bonus.code),
|
3064
|
+
bonus=ScoreItemBonus(bonus_uuid=bonus.uuid),
|
3029
3065
|
)
|
3030
3066
|
)
|
3031
3067
|
return items
|
@@ -3040,12 +3076,20 @@ def score_private_items(game, player_idx):
|
|
3040
3076
|
for complete_goal_uuid in complete_goal_uuids:
|
3041
3077
|
goal = goaluuid2goal[complete_goal_uuid]
|
3042
3078
|
items.append(
|
3043
|
-
ScoreItem2(
|
3079
|
+
ScoreItem2(
|
3080
|
+
amount=goal.score,
|
3081
|
+
description="Player {} completed goal {}".format(player_idx, complete_goal_uuid),
|
3082
|
+
goal=ScoreItemGoal(goal_uuid=complete_goal_uuid, complete=True)
|
3083
|
+
)
|
3044
3084
|
)
|
3045
3085
|
for incomplete_goal_uuid in incomplete_goal_uuids:
|
3046
3086
|
goal = goaluuid2goal[incomplete_goal_uuid]
|
3047
3087
|
items.append(
|
3048
|
-
ScoreItem2(
|
3088
|
+
ScoreItem2(
|
3089
|
+
amount=(-1*goal.score),
|
3090
|
+
description="Player {} incomplete goal {}".format(player_idx, incomplete_goal_uuid),
|
3091
|
+
goal=ScoreItemGoal(goal_uuid=incomplete_goal_uuid, complete=False)
|
3092
|
+
)
|
3049
3093
|
)
|
3050
3094
|
return items
|
3051
3095
|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
graph_games_proto/__init__.py,sha256=O5XjRfe3DlxbJn4zezDvvy7cXvL4IzIRPZCL3Y-n7s8,776
|
2
2
|
graph_games_proto/all_types.py,sha256=IpbwftEcHS5Ewz-saFNk0lO9FvcbuHG36odRTayCXUk,54911
|
3
|
-
graph_games_proto/fns.py,sha256=
|
3
|
+
graph_games_proto/fns.py,sha256=6yx3VjDwYJuHTuOieunbSOS3AAFo8s62E2brZs2r4yQ,239571
|
4
4
|
graph_games_proto/main.py,sha256=fj2U7KcwrpZtuUhjOX5yVxY18LZvvsxDFYZ_S5mxe04,145
|
5
5
|
graph_games_proto/state.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
-
graph_games_proto-0.3.
|
7
|
-
graph_games_proto-0.3.
|
8
|
-
graph_games_proto-0.3.
|
9
|
-
graph_games_proto-0.3.
|
6
|
+
graph_games_proto-0.3.1757.dist-info/METADATA,sha256=8Ti-bHAVP6pBkaRIpaqEcG5CZOVchOirDbHhebypDtY,188
|
7
|
+
graph_games_proto-0.3.1757.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
8
|
+
graph_games_proto-0.3.1757.dist-info/top_level.txt,sha256=-4QSrBMf_MM4BGsr2QXBpqDx8c8k_OPnzGyFjqjakes,18
|
9
|
+
graph_games_proto-0.3.1757.dist-info/RECORD,,
|
File without changes
|
File without changes
|