Beispiel #1
0
    def __init__(self, req: ServiceRequest) -> None:
        self.hardid = get_xml_attrib(req.xml[0], "hardid")
        self.softid = get_xml_attrib(req.xml[0], "softid")

        # Most likely you'd determine this value from the hardware id?
        # Right now we don't support paseli
        self.paseli_active = False
Beispiel #2
0
    def __init__(self, req: ServiceRequest) -> None:
        self.cardid = get_xml_attrib(req.xml[0], "cardid")
        self.cardtype = int(get_xml_attrib(req.xml[0], "cardtype"))
        self.update = int(get_xml_attrib(req.xml[0], "update"))

        # Model doesn't always exist in the request, unsure what it's used for
        model_value = get_xml_attrib(req.xml[0], "model")
        self.model = model_value if model_value != "None" else None
Beispiel #3
0
 def __init__(self, root: etree) -> None:
     self.no = int(get_xml_attrib(root, "no"))
     self.refid = root.find("refid").text
     self.name = root.find("name").text
     self.chara = int(root.find("chara").text)
     self.uid = root.find("uid").text
     self.cabid = int(root.find("cabid").text)
     self.is_succession = itob(int(root.find("is_succession").text))
Beispiel #4
0
    def read(self) -> etree:
        # Lets grab the raw data from the request
        xml_bin = self._request.data

        # Decrypt the data if necessary
        x_eamuse_info: Optional[str] = None
        if self.encrypted:
            x_eamuse_info, key = self._get_encryption_data()
            xml_bin = EAmuseARC4(key).decrypt(xml_bin)

        # De-Compress the data if necessary
        # Right now we only support `lz77`
        if self.compressed and self.compression == "lz77":
            xml_bin = Lz77().decompress(xml_bin)

        # Convert the binary xml data to text bytes, and save a copy
        xml_bytes = KBinXML(xml_bin).to_text().encode(self.ENCODING)
        self._save_xml(xml_bytes, "req", x_eamuse_info)

        # Convert the XML text to an eTree
        xml_root = etree.fromstring(xml_bytes)

        # Grab the common xml information that we need
        # <call model="_MODEL_" srcid="_SRCID_">
        #     <_MODULE_ method="_METHOD_" command="_COMMAND_">
        # </call>

        # First grab the model
        self.model = Model.from_modelstring(get_xml_attrib(xml_root, "model"))

        # The module is the first child of the root
        module = xml_root[0]
        self.module = get_xml_tag(module)
        self.method = get_xml_attrib(module, "method")
        self.command = get_xml_attrib(module, "command")

        rlogger.info(self.__repr__())
        rlogger.debug(f"Request:\n {xml_bytes.decode(self.ENCODING)}")
        return xml_root
Beispiel #5
0
 def __init__(self, root: etree) -> None:
     self.card = get_xml_attrib(root, "card")
     self.no = int(get_xml_attrib(root, "no"))
     self.refid = root.find("refid").text
     self.request = Request(root.find("request"))
Beispiel #6
0
 def __init__(self, root: etree) -> None:
     self.mode = get_xml_attrib(root, "mode")
     self.stages = [Stage(x) for x in root.findall("stage")]
     self.session = int(root.find("session").text)
Beispiel #7
0
 def __init__(self, root: etree) -> None:
     self.card = get_xml_attrib(root, "card")
     self.no = int(get_xml_attrib(root, "no"))
     self.playerinfo = Playerinfo(root.find("playerinfo"))
     self.playdata = [Playdata(x) for x in root.findall("playdata")]
Beispiel #8
0
 def __init__(self, root: etree) -> None:
     self.mode = get_xml_attrib(root, "mode")
Beispiel #9
0
 def __init__(self, root: etree) -> None:
     self.send = itob(int(get_xml_attrib(root, "send")))
     self.sound_options = SoundOptions(root.find("sound_options"))
     self.game_options = GameOptions(root.find("game_options"))
     self.coin_options = CoinOptions(root.find("coin_options"))
     self.bookkeeping = Bookkeeping(root.find("bookkeeping"))
Beispiel #10
0
 def __init__(self, root: etree) -> None:
     self.no = int(get_xml_attrib(root, "no"))
     self.refid = root.find("refid").text
     self.syogodata = Syogodata(root.find("syogodata"))
Beispiel #11
0
 def __init__(self, req: ServiceRequest) -> None:
     self.refid = get_xml_attrib(req.xml[0], "refid")
     self.newflag = itob(int(get_xml_attrib(req.xml[0], "newflag")))
Beispiel #12
0
 def __init__(self, req: ServiceRequest) -> None:
     self.passwd = get_xml_attrib(req.xml[0], "pass")
     self.refid = get_xml_attrib(req.xml[0], "refid")
Beispiel #13
0
 def __init__(self, req: ServiceRequest) -> None:
     self.cardid = get_xml_attrib(req.xml[0], "cardid")
     self.cardtype = int(get_xml_attrib(req.xml[0], "cardtype"))
     self.newflag = itob(int(get_xml_attrib(req.xml[0], "newflag")))
     self.passwd = get_xml_attrib(req.xml[0], "passwd")
Beispiel #14
0
 def __init__(self, root: etree) -> None:
     self.no = int(get_xml_attrib(root, "no"))
     self.refid = root.find("refid").text
     self.uid = root.find("uid").text
Beispiel #15
0
 def __init__(self, req: ServiceRequest) -> None:
     self.encoding = get_xml_attrib(req.xml[0], "encoding")