Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A new API found: .lq.Lobby.fetchManagerCustomizedContestList #281

Closed
Apricot-S opened this issue Jul 24, 2024 · 5 comments · Fixed by #286
Closed

A new API found: .lq.Lobby.fetchManagerCustomizedContestList #281

Apricot-S opened this issue Jul 24, 2024 · 5 comments · Fixed by #286
Assignees
Labels
bug Something isn't working

Comments

@Apricot-S
Copy link
Owner

概要

大会に入室した際、新しい API .lq.Lobby.fetchManagerCustomizedContestList がやり取りされた。
現在 majsoulrpa に同梱している liqi_pb2.py に入っていないため、 liqi_pb2.py の更新およびメッセージ処理の追加が必要である。

詳細

実行したスクリプト

examples\enter_tournament.py

エラーメッセージ

(前略)
INFO:majsoulrpa.presentation.home:('outbound', '.lq.Lobby.loginSuccess', {}, {}, datetime.datetime(2024, 7, 24, 9, 30, 10, 983251, tzinfo=datetime.timezone.utc))
INFO:majsoulrpa.presentation.home:('outbound', '.lq.Lobby.heatbeat', {'no_operation_counter': 0}, {'error': {'code': 0, 'u32_params': [], 'str_params': [], 'json_param': ''}}, datetime.datetime(2024, 7, 24, 9, 30, 11, 390945, tzinfo=datetime.timezone.utc))
INFO:majsoulrpa.presentation.home:('outbound', '.lq.Lobby.heatbeat', {'no_operation_counter': 0}, {'error': {'code': 0, 'u32_params': [], 'str_params': [], 'json_param': ''}}, datetime.datetime(2024, 7, 24, 9, 30, 12, 542528, tzinfo=datetime.timezone.utc))
INFO:majsoulrpa.presentation.home:('outbound', '.lq.Lobby.loginBeat', {'contract': 'DF2vkXCnfeXp4WoGSBGNcJBufZiMN3UP'}, {}, datetime.datetime(2024, 7, 24, 9, 30, 12, 793821, tzinfo=datetime.timezone.utc))
INFO:majsoulrpa.presentation.home:('outbound', '.lq.Lobby.loginBeat', {'contract': 'DF2vkXCnfeXp4WoGSBGNcJBufZiMN3UP'}, {}, datetime.datetime(2024, 7, 24, 9, 30, 12, 823415, tzinfo=datetime.timezone.utc))
INFO:majsoulrpa.presentation.home:('outbound', '.lq.Lobby.heatbeat', {'no_operation_counter': 0}, {'error': {'code': 0, 'u32_params': [], 'str_params': [], 'json_param': ''}}, datetime.datetime(2024, 7, 24, 9, 30, 16, 452128, tzinfo=datetime.timezone.utc))
Tournament ID: 000000
INFO:majsoulrpa.presentation.home:('outbound', '.lq.Lobby.heatbeat', {'no_operation_counter': 0}, {'error': {'code': 0, 'u32_params': [], 'str_params': [], 'json_param': ''}}, datetime.datetime(2024, 7, 24, 9, 30, 20, 460244, tzinfo=datetime.timezone.utc))
Traceback (most recent call last):
  File "C:\Users\K_K\Documents\Program\mahjong\majsoulrpa\src\majsoulrpa\_impl\zmq_client.py", line 124, in jsonize
    parser = self._message_type_map[name][0]()
             ~~~~~~~~~~~~~~~~~~~~~~^^^^^^
KeyError: '.lq.Lobby.fetchManagerCustomizedContestList'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\xxx\Documents\Program\mahjong\majsoulrpa\examples\enter_tournament.py", line 61, in <module>
    presentation.enter_tournament(tournament_id)
  File "C:\Users\xxx\Documents\Program\mahjong\majsoulrpa\src\majsoulrpa\presentation\home.py", line 504, in enter_tournament
    message = self._message_queue_client.dequeue_message(1)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\xxx\Documents\Program\mahjong\majsoulrpa\src\majsoulrpa\_impl\zmq_client.py", line 147, in dequeue_message
    jsonized_request = jsonize(name, request_data, is_response=False)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\xxx\Documents\Program\mahjong\majsoulrpa\src\majsoulrpa\_impl\zmq_client.py", line 137, in jsonize
    raise RuntimeError(msg) from ke
RuntimeError: A new API found:
  name: .lq.Lobby.fetchManagerCustomizedContestList
Raw data was saved to 2024-07-24-09-30-28-.lq.Lobby.fetchManagerCustomizedContestList.bin.
Please cooperate by providing data. Thank you for your cooperation.

生データ

バイナリのため Hex Editor で表示した内容を添付する

0A 02 6A 70
@Apricot-S
Copy link
Owner Author

liqi_pb2.py を更新したあとの上記メッセージのログ

majsoulrpa.presentation.exceptions.InconsistentMessageError: ("('outbound', '.lq.Lobby.fetchManagerCustomizedContestList', {'lang': 'jp'}, {'contests': []}, datetime.datetime(2024, 7, 24, 10, 30, 56, 677216, tzinfo=datetime.timezone.utc))", '2024-07-24-10-30-57-InconsistentMessageError')

@Apricot-S
Copy link
Owner Author

Apricot-S commented Jul 24, 2024

API に関するメモ

新しい liqi.proto から .lq.Lobby.fetchCustomizedContestExtendInfo が削除されている

新旧ファイルの差分から

  • signupCustomizedContest
  • fetchManagerCustomizedContestList
  • fetchManagerCustomizedContest
  • updateManagerCustomizedContest
  • fetchContestPlayerRank
  • fetchReadyPlayerList
  • fetchReadyPlayerList

などに分解されたと推測される

@Apricot-S
Copy link
Owner Author

大会ロビーで以下のメッセージが 20 秒間隔でやり取りされる
以下は mitmdump のエラーメッセージ

[19:30:12.087] Addon error: An unknown WebSocket message:
direction: outbound
content: b'<= heartbeat -'
Traceback (most recent call last):
  File "C:\Users\xxx\Documents\Program\mahjong\majsoulrpa\src\majsoulrpa\_mitmproxy\sniffer.py", line 128, in websocket_message
    raise RuntimeError(msg)
RuntimeError: An unknown WebSocket message:
direction: outbound
content: b'<= heartbeat -'

@Apricot-S
Copy link
Owner Author

b'<= heartbeat -' に関しては mitmdump 側で読み捨ててメッセージキューには保存しないこととする。

@Apricot-S Apricot-S self-assigned this Aug 19, 2024
@Apricot-S Apricot-S added the bug Something isn't working label Aug 19, 2024
@Apricot-S
Copy link
Owner Author

develop を main にマージしたあとクローズする予定です。

@Apricot-S Apricot-S mentioned this issue Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant