Beispiel #1
0
def numberRequest(data: Data) -> dict:
    return {
        "target": data.take(),
        "question": data.takeString(),
        "min": data.take(),
        "max": data.take()
    }
Beispiel #2
0
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
Beispiel #3
0
def members(data: Data) -> dict:
    count = data.take()

    args = {"members": {}}
    for i in range(count):
        id = data.take()
        args["members"][id] = (data.takeString(), data.takeBool())

    return args
Beispiel #4
0
def optionsRequest(data: Data) -> dict:
    args = {"target": data.take(), "message": data.takeString()}

    count = data.take()
    args["options"] = [None] * count

    for i in range(count):
        args["options"][i] = data.takeString()

    return args
Beispiel #5
0
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
Beispiel #6
0
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
Beispiel #7
0
def yesNoRequest(data: Data) -> dict:
    return {"target": data.take(), "question": data.takeString()}
Beispiel #8
0
def id(data: Data) -> dict:
    return {"id": data.take()}
Beispiel #9
0
def scene(data: Data) -> dict:
    return {"scene": data.takeNumeric(2)}
Beispiel #10
0
def enemiesGroup(data: Data) -> dict:
    return {"group": json.loads(data.takeString())}
Beispiel #11
0
def ids(data: Data) -> dict:
    count = data.take()
    return {"ids": [data.take() for i in range(count)]}
Beispiel #12
0
def confirmRequest(data: Data) -> dict:
    return {"target": data.take()}
Beispiel #13
0
def yesNoQuestion(data: Data) -> dict:
    return {"question": YesNoQuestion(data.take())}
Beispiel #14
0
def reply(data: Data) -> dict:
    return {"id": data.take(), "reply": data.take()}
Beispiel #15
0
def text(data: Data) -> dict:
    return {"text": data.takeString()}
Beispiel #16
0
def name(data: Data) -> dict:
    return {"name": data.takeString()}
Beispiel #17
0
def delay(data: Data) -> dict:
    return {"delay": data.takeNumeric(8)}
Beispiel #18
0
def playerUpdate(data: Data) -> dict:
    return {"id": data.take(), "update": json.loads(data.takeString())}
Beispiel #19
0
def idAndName(data: Data) -> dict:
    return {"id": data.take(), "name": data.takeString()}