Improve a few bits of Fantasia, including working profile conversions and displaying cards at the end of the round.

This commit is contained in:
Jennifer Taylor
2021-09-03 04:35:13 +00:00
parent 4f64cc7e08
commit cbbda0ef7f
3 changed files with 161 additions and 52 deletions
+12 -3
View File
@@ -3,7 +3,7 @@ import traceback
from typing import Any, Dict, Iterator, List, Optional, Set, Tuple, Type
from bemani.common import Model, ValidatedDict, Profile, PlayStatistics, GameConstants, Time
from bemani.data import Config, Data, UserID, RemoteUser
from bemani.data import Config, Data, Machine, UserID, RemoteUser
class ProfileCreationException(Exception):
@@ -391,18 +391,27 @@ class Base(ABC):
machine = self.data.local.machine.get_machine(self.config.machine.pcbid)
return machine.id
def get_machine(self) -> Machine:
return self.data.local.machine.get_machine(self.config.machine.pcbid)
def update_machine_name(self, newname: Optional[str]) -> None:
if newname is None:
return
machine = self.data.local.machine.get_machine(self.config.machine.pcbid)
machine = self.get_machine()
machine.name = newname
self.data.local.machine.put_machine(machine)
def update_machine_data(self, newdata: Dict[str, Any]) -> None:
machine = self.data.local.machine.get_machine(self.config.machine.pcbid)
machine = self.get_machine()
machine.data.update(newdata)
self.data.local.machine.put_machine(machine)
def update_machine(self, newmachine: Machine) -> None:
machine = self.data.local.machine.get_machine(self.config.machine.pcbid)
machine.name = newmachine.name
machine.data = newmachine.data
self.data.local.machine.put_machine(machine)
def get_game_config(self) -> ValidatedDict:
machine = self.data.local.machine.get_machine(self.config.machine.pcbid)
if machine.arcade is not None: