Skip to content

Commit

Permalink
update api
Browse files Browse the repository at this point in the history
  • Loading branch information
narumi147 committed Apr 29, 2024
1 parent 3377ac2 commit f9a3682
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/app/modules/import_data/autologin/login_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,14 @@ class _AutoLoginPageState extends State<AutoLoginPage> {
title: 'Loop Count',
text: '3',
keyboardType: TextInputType.number,
onSubmit: (s) {
onSubmit: (s) async {
final count = int.parse(s);
startLoopBattle(count);
try {
await startLoopBattle(count);
} catch (e, s) {
logger.e('loop battle failed', e, s);
EasyLoading.showError(e.toString());
}
},
).showDialog(context);
},
Expand Down Expand Up @@ -670,6 +675,9 @@ class _AutoLoginPageState extends State<AutoLoginPage> {
);
results.addNum(battleResult, 1);
battleCount++;

// 10AP=4,40AP=5,
await agent.itemRecover(recoverId: 5, num: 1);
if (battleResult == 1) {
winCount++;
itemCount += drops[6549] ?? 0;
Expand Down
8 changes: 8 additions & 0 deletions lib/models/faker/quiz/cat_mouse.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,12 @@ class CatMouseGame {
}
return Map<String, dynamic>.from(jsonDecode(text));
}

dynamic decryptBattleResult(String s) {
final key = [for (final v in battleKey) v ^ 4];
final iv = [for (final v in battleIV) v ^ 8];
final result = msgpack.deserialize(Uint8List.fromList(decryptRijndael(base64Decode(s), key, iv)));
print(jsonEncode(result));
return result;
}
}
11 changes: 11 additions & 0 deletions lib/models/faker/req/agent.dart
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,13 @@ class FRequestAgent {
return request.beginRequest();
}

Future<FResponse> itemRecover({required int32_t recoverId, required int32_t num}) async {
final request = FRequestBase(network: network, path: '/item/recover');
request.addFieldInt32('recoverId', recoverId);
request.addFieldInt32('num', num);
return request.beginRequest();
}

Future<FResponse> battleSetup({
required int32_t questId,
required int32_t questPhase,
Expand All @@ -138,6 +145,7 @@ class FRequestAgent {
int32_t followerSpoilerProtectionLimitCount = 4, //?
required int32_t followerSupportDeckId,
int32_t campaignItemId = 0,
int32_t restartWave = 0,
}) {
final request = FRequestBase(network: network, path: '/battle/setup');
request.addFieldInt32("questId", questId);
Expand All @@ -157,6 +165,7 @@ class FRequestAgent {
request.addFieldInt32("followerSpoilerProtectionLimitCount", followerSpoilerProtectionLimitCount);
request.addFieldInt32("followerSupportDeckId", followerSupportDeckId);
request.addFieldInt32("campaignItemId", campaignItemId);
request.addFieldInt32("restartWave", restartWave);
return request.beginRequestAndCheckError();
}

Expand Down Expand Up @@ -189,6 +198,7 @@ class FRequestAgent {
List<int32_t> calledEnemyUniqueIdArray = const [],
List<int32_t> routeSelectIdArray = const [],
List<int32_t> dataLostUniqueIdArray = const [],
List waveInfos = const [],
}) {
final request = FRequestBase(network: network, path: '/battle/result');

Expand Down Expand Up @@ -247,6 +257,7 @@ class FRequestAgent {
]);
dictionary['voicePlayedList'] = jsonEncode(voicePlayedArray);
dictionary['usedTurnList'] = usedTurnArray;
dictionary['waveInfo'] = "[]";
print(jsonEncode(dictionary));
final List<int> packed = msgpack.serialize(dictionary);
final List<int> encryped = network.catMouseGame.catGame5Bytes(packed);
Expand Down

0 comments on commit f9a3682

Please sign in to comment.