Skip to content

Commit

Permalink
Update protocol to 0.8.125 version
Browse files Browse the repository at this point in the history
  • Loading branch information
Nihisil committed Oct 3, 2020
1 parent 4205844 commit 5c07f77
Show file tree
Hide file tree
Showing 6 changed files with 1,754 additions and 1,213 deletions.
5 changes: 1 addition & 4 deletions example.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ async def connect():
channel = MSRPCChannel(endpoint)

lobby = Lobby(channel)
lobby.version = version

await channel.connect(MS_HOST)
logging.info('Connection was established')
Expand All @@ -82,10 +81,8 @@ async def login(lobby, username, password):
req = pb.ReqLogin()
req.account = username
req.password = hmac.new(b'lailai', password.encode(), hashlib.sha256).hexdigest()
req.device.device_type = 'pc'
req.device.browser = 'safari'
req.device.is_browser = True
req.random_key = uuid_key
req.client_version = lobby.version
req.gen_access_token = True
req.currency_platforms.append(2)

Expand Down
2 changes: 1 addition & 1 deletion ms/liqi.json

Large diffs are not rendered by default.

69 changes: 62 additions & 7 deletions ms/protocol.proto
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ message Account {
message ChallengeLevel {
uint32 season = 1;
uint32 level = 2;
uint32 rank = 3;
}

}
Expand Down Expand Up @@ -446,6 +447,7 @@ message AccountCacheView {
uint32 verified = 15;
uint32 ban_deadline = 16;
uint32 comment_ban = 17;
uint32 ban_state = 18;
}

message PlayerBaseView {
Expand All @@ -457,6 +459,7 @@ message PlayerBaseView {
AccountLevel level3 = 6;
uint32 avatar_frame = 7;
uint32 verified = 8;
uint32 is_banned = 9;
}

message PlayerGameView {
Expand Down Expand Up @@ -745,10 +748,20 @@ message AccountShiLian {
}

message ClientDeviceInfo {
string device_type = 1;
string os = 2;
string os_version = 3;
string browser = 4;
string platform = 1;
string hardware = 2;
string os = 3;
string os_version = 4;
bool is_browser = 5;
string software = 6;
string sale_platform = 7;
string hardware_vendor = 8;
string model_number = 9;
}

message ClientVersionInfo {
string resource = 1;
string package = 2;
}

enum GamePlayerState {
Expand Down Expand Up @@ -839,6 +852,7 @@ message RollingNotice {
uint32 start_time = 3;
uint32 end_time = 4;
uint32 repeat_interval = 5;
string lang = 6;
}

message BillingGoods {
Expand Down Expand Up @@ -916,11 +930,19 @@ message ServerSettings {
message PaymentSettingV2 {
uint32 open_payment = 1;
repeated PaymentSettingUnit payment_platforms = 2;
message PaymentMaintain {
uint32 start_time = 1;
uint32 end_time = 2;
uint32 goods_click_action = 3;
string goods_click_text = 4;
}

message PaymentSettingUnit {
string platform = 1;
bool is_show = 2;
uint32 goods_click_action = 3;
string goods_click_text = 4;
PaymentMaintain maintain = 5;
}

}
Expand Down Expand Up @@ -1294,6 +1316,7 @@ service Lobby {
rpc fetchAccountInfo (ReqAccountInfo) returns (ResAccountInfo);
rpc changeAvatar (ReqChangeAvatar) returns (ResCommon);
rpc fetchAccountStatisticInfo (ReqAccountStatisticInfo) returns (ResAccountStatisticInfo);
rpc fetchAccountChallengeRankInfo (ReqAccountInfo) returns (ResAccountChallengeRankInfo);
rpc fetchAccountCharacterInfo (ReqCommon) returns (ResAccountCharacterInfo);
rpc shopPurchase (ReqShopPurchase) returns (ResShopPurchase);
rpc fetchGameRecord (ReqGameRecord) returns (ResGameRecord);
Expand Down Expand Up @@ -1363,6 +1386,7 @@ service Lobby {
rpc doDailySignIn (ReqCommon) returns (ResCommon);
rpc doActivitySignIn (ReqDoActivitySignIn) returns (ResDoActivitySignIn);
rpc fetchCharacterInfo (ReqCommon) returns (ResCharacterInfo);
rpc updateCharacterSort (ReqUpdateCharacterSort) returns (ResCommon);
rpc changeMainCharacter (ReqChangeMainCharacter) returns (ResCommon);
rpc changeCharacterSkin (ReqChangeCharacterSkin) returns (ResCommon);
rpc changeCharacterView (ReqChangeCharacterView) returns (ResCommon);
Expand Down Expand Up @@ -1413,6 +1437,7 @@ service Lobby {
rpc verifySteamOrder (ReqVerifySteamOrder) returns (ResCommon);
rpc createMyCardAndroidOrder (ReqCreateMyCardOrder) returns (ResCreateMyCardOrder);
rpc createMyCardWebOrder (ReqCreateMyCardOrder) returns (ResCreateMyCardOrder);
rpc createPaypalOrder (ReqCreatePaypalOrder) returns (ResCreatePaypalOrder);
rpc verifyMyCardOrder (ReqVerifyMyCardOrder) returns (ResCommon);
rpc verificationIAPOrder (ReqVerificationIAPOrder) returns (ResVerificationIAPOrder);
rpc createYostarSDKOrder (ReqCreateYostarOrder) returns (ResCreateYostarOrder);
Expand Down Expand Up @@ -1490,7 +1515,7 @@ message ReqLogin {
bool reconnect = 3;
ClientDeviceInfo device = 4;
string random_key = 5;
string client_version = 6;
ClientVersionInfo client_version = 6;
bool gen_access_token = 7;
repeated uint32 currency_platforms = 8;
uint32 type = 9;
Expand Down Expand Up @@ -1615,7 +1640,8 @@ message ReqOauth2Login {
bool reconnect = 3;
ClientDeviceInfo device = 4;
string random_key = 5;
string client_version = 6;
ClientVersionInfo client_version = 6;
bool gen_access_token = 7;
repeated uint32 currency_platforms = 8;
}

Expand Down Expand Up @@ -1732,6 +1758,17 @@ message ResAccountStatisticInfo {
AccountDetailStatisticV2 detail_data = 3;
}

message ResAccountChallengeRankInfo {
Error error = 1;
repeated ChallengeRank season_info = 2;
message ChallengeRank {
uint32 season = 1;
uint32 rank = 2;
uint32 level = 3;
}

}

message ResAccountCharacterInfo {
repeated uint32 unlock_list = 1;
}
Expand Down Expand Up @@ -1838,6 +1875,7 @@ message ResChallengeLeaderboard {
message Item {
uint32 account_id = 1;
uint32 level = 2;
string nickname = 3;
}

}
Expand Down Expand Up @@ -2159,7 +2197,7 @@ message ReqUpdateReadComment {
}

message ReqRollingNotice {
RollingNotice notice = 1;
repeated RollingNotice notice = 1;
}

message ResServerTime {
Expand Down Expand Up @@ -2506,6 +2544,18 @@ message ReqVerifyMyCardOrder {
uint32 account_id = 2;
}

message ReqCreatePaypalOrder {
uint32 goods_id = 1;
uint32 client_type = 2;
uint32 account_id = 3;
}

message ResCreatePaypalOrder {
Error error = 1;
string order_id = 2;
string url = 3;
}

message ReqOpenChest {
uint32 chest_id = 1;
uint32 count = 2;
Expand Down Expand Up @@ -2560,6 +2610,11 @@ message ResCharacterInfo {
uint32 send_gift_limit = 6;
repeated uint32 finished_endings = 7;
repeated uint32 rewarded_endings = 8;
repeated uint32 character_sort = 9;
}

message ReqUpdateCharacterSort {
repeated uint32 sort = 1;
}

message ReqChangeMainCharacter {
Expand Down
2,872 changes: 1,673 additions & 1,199 deletions ms/protocol_pb2.py

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions ms/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class Lobby(MSRPCService):
'fetchAccountInfo': pb.ReqAccountInfo,
'changeAvatar': pb.ReqChangeAvatar,
'fetchAccountStatisticInfo': pb.ReqAccountStatisticInfo,
'fetchAccountChallengeRankInfo': pb.ReqAccountInfo,
'fetchAccountCharacterInfo': pb.ReqCommon,
'shopPurchase': pb.ReqShopPurchase,
'fetchGameRecord': pb.ReqGameRecord,
Expand Down Expand Up @@ -117,6 +118,7 @@ class Lobby(MSRPCService):
'doDailySignIn': pb.ReqCommon,
'doActivitySignIn': pb.ReqDoActivitySignIn,
'fetchCharacterInfo': pb.ReqCommon,
'updateCharacterSort': pb.ReqUpdateCharacterSort,
'changeMainCharacter': pb.ReqChangeMainCharacter,
'changeCharacterSkin': pb.ReqChangeCharacterSkin,
'changeCharacterView': pb.ReqChangeCharacterView,
Expand Down Expand Up @@ -167,6 +169,7 @@ class Lobby(MSRPCService):
'verifySteamOrder': pb.ReqVerifySteamOrder,
'createMyCardAndroidOrder': pb.ReqCreateMyCardOrder,
'createMyCardWebOrder': pb.ReqCreateMyCardOrder,
'createPaypalOrder': pb.ReqCreatePaypalOrder,
'verifyMyCardOrder': pb.ReqVerifyMyCardOrder,
'verificationIAPOrder': pb.ReqVerificationIAPOrder,
'createYostarSDKOrder': pb.ReqCreateYostarOrder,
Expand Down Expand Up @@ -261,6 +264,7 @@ class Lobby(MSRPCService):
'fetchAccountInfo': pb.ResAccountInfo,
'changeAvatar': pb.ResCommon,
'fetchAccountStatisticInfo': pb.ResAccountStatisticInfo,
'fetchAccountChallengeRankInfo': pb.ResAccountChallengeRankInfo,
'fetchAccountCharacterInfo': pb.ResAccountCharacterInfo,
'shopPurchase': pb.ResShopPurchase,
'fetchGameRecord': pb.ResGameRecord,
Expand Down Expand Up @@ -330,6 +334,7 @@ class Lobby(MSRPCService):
'doDailySignIn': pb.ResCommon,
'doActivitySignIn': pb.ResDoActivitySignIn,
'fetchCharacterInfo': pb.ResCharacterInfo,
'updateCharacterSort': pb.ResCommon,
'changeMainCharacter': pb.ResCommon,
'changeCharacterSkin': pb.ResCommon,
'changeCharacterView': pb.ResCommon,
Expand Down Expand Up @@ -380,6 +385,7 @@ class Lobby(MSRPCService):
'verifySteamOrder': pb.ResCommon,
'createMyCardAndroidOrder': pb.ResCreateMyCardOrder,
'createMyCardWebOrder': pb.ResCreateMyCardOrder,
'createPaypalOrder': pb.ResCreatePaypalOrder,
'verifyMyCardOrder': pb.ResCommon,
'verificationIAPOrder': pb.ResVerificationIAPOrder,
'createYostarSDKOrder': pb.ResCreateYostarOrder,
Expand Down Expand Up @@ -564,6 +570,9 @@ async def change_avatar(self, req):
async def fetch_account_statistic_info(self, req):
return await self.call_method('fetchAccountStatisticInfo', req)

async def fetch_account_challenge_rank_info(self, req):
return await self.call_method('fetchAccountChallengeRankInfo', req)

async def fetch_account_character_info(self, req):
return await self.call_method('fetchAccountCharacterInfo', req)

Expand Down Expand Up @@ -771,6 +780,9 @@ async def do_activity_sign_in(self, req):
async def fetch_character_info(self, req):
return await self.call_method('fetchCharacterInfo', req)

async def update_character_sort(self, req):
return await self.call_method('updateCharacterSort', req)

async def change_main_character(self, req):
return await self.call_method('changeMainCharacter', req)

Expand Down Expand Up @@ -921,6 +933,9 @@ async def create_my_card_android_order(self, req):
async def create_my_card_web_order(self, req):
return await self.call_method('createMyCardWebOrder', req)

async def create_paypal_order(self, req):
return await self.call_method('createPaypalOrder', req)

async def verify_my_card_order(self, req):
return await self.call_method('verifyMyCardOrder', req)

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
packages=[
'ms',
],
version='0.8.93',
description='Python connectors to the Mahjong Soul API',
version='0.8.125',
description='Python wrapper for the Mahjong Soul (Majsoul) Protobuf objects. It allows to use their API.',
long_description='',
author='Nihisil',
author_email='alexey@nihisil.com',
Expand Down

0 comments on commit 5c07f77

Please sign in to comment.