def atk(data: Data) -> dict: args = {"playersId": data.take(), "enemiesName": data.takeString()} dmg = data.takeNumeric(4, signed=True) args["attacker"] = Attacker.Player if dmg >= 0 else Attacker.Enemy args["dmg"] = abs(dmg) return args
def globalStat(data: Data) -> dict: args = { "name": data.takeString(), "hidden": data.takeBool(), "main": data.takeBool() } if not args["hidden"]: for arg in ["min", "max", "value"]: args[arg] = data.takeNumeric(4, signed=True) return args
def diceRollRequest(data: Data) -> dict: args = { "target": data.take(), "message": data.takeString(), "dices": data.take(), "bonus": data.takeNumeric(4, signed=True), "results": {} } count = data.take() dices = args["dices"] for i in range(count): id = data.take() args["results"][id] = [None] * dices for dice in range(dices): args["results"][id][dice] = data.take() return args
def delay(data: Data) -> dict: return {"delay": data.takeNumeric(8)}
def scene(data: Data) -> dict: return {"scene": data.takeNumeric(2)}