Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

新增运动任务 #250

Merged
merged 1 commit into from
Jul 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XposedHelpers;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import tkaxv7s.xposed.sesame.data.ModelFields;
import tkaxv7s.xposed.sesame.data.ModelGroup;
Expand All @@ -17,25 +18,16 @@
import tkaxv7s.xposed.sesame.model.normal.base.BaseModel;
import tkaxv7s.xposed.sesame.util.*;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.LinkedHashSet;
import java.util.List;

public class AntSports extends ModelTask {

private static final String TAG = AntSports.class.getSimpleName();

private int tmpStepCount = -1;

@Override
public String getName() {
return "运动";
}

@Override
public ModelGroup getGroup() {
return ModelGroup.SPORTS;
}

private BooleanModelField openTreasureBox;
private BooleanModelField receiveCoinAsset;
private BooleanModelField donateCharityCoin;
Expand All @@ -48,11 +40,23 @@ public ModelGroup getGroup() {
private BooleanModelField battleForFriends;
private ChoiceModelField battleForFriendType;
private SelectModelField originBossIdList;
private BooleanModelField sportsTasks;

@Override
public String getName() {
return "运动";
}

@Override
public ModelGroup getGroup() {
return ModelGroup.SPORTS;
}

@Override
public ModelFields getFields() {
ModelFields modelFields = new ModelFields();
modelFields.addField(openTreasureBox = new BooleanModelField("openTreasureBox", "开启宝箱", false));
modelFields.addField(sportsTasks = new BooleanModelField("sportsTasks", "开启运动任务", false));
modelFields.addField(receiveCoinAsset = new BooleanModelField("receiveCoinAsset", "收运动币", false));
modelFields.addField(donateCharityCoin = new BooleanModelField("donateCharityCoin", "捐运动币 | 开启", false));
modelFields.addField(donateCharityCoinType = new ChoiceModelField("donateCharityCoinType", "捐运动币 | 方式", DonateCharityCoinType.ONE, DonateCharityCoinType.nickNames));
Expand Down Expand Up @@ -113,13 +117,13 @@ public void run() {
}
}));
}
if (sportsTasks.getValue())
sportsTasks();

ClassLoader loader = ApplicationHook.getClassLoader();
if (openTreasureBox.getValue())
queryMyHomePage(loader);

if (receiveCoinAsset.getValue())
receiveCoinAsset();

if (donateCharityCoin.getValue() && Status.canDonateCharityCoin())
queryProjectList(loader);

Expand All @@ -139,6 +143,9 @@ public void run() {
queryTrainItem();
buyMember();
}

if (receiveCoinAsset.getValue())
receiveCoinAsset();
} catch (Throwable t) {
Log.i(TAG, "start.run err:");
Log.printStackTrace(TAG, t);
Expand All @@ -159,6 +166,57 @@ public int tmpStepCount() {
return tmpStepCount;
}

// 运动
private void sportsTasks() {
try {
Log.record("运动任务开始");

JSONObject jo = new JSONObject(AntSportsRpcCall.queryCoinTaskPanel());
if (jo.getBoolean("success")) {
JSONObject data = jo.getJSONObject("data");
JSONArray taskList = data.getJSONArray("taskList");

for (int i = 0; i < taskList.length(); i++) {
JSONObject taskDetail = taskList.getJSONObject(i);

String taskId = taskDetail.getString("taskId");
String taskName = taskDetail.getString("taskName");
String prizeAmount = taskDetail.getString("prizeAmount");
String taskStatus = taskDetail.getString("taskStatus");
int currentNum = taskDetail.getInt("currentNum");
// 要完成的次数
int limitConfigNum = taskDetail.getInt("limitConfigNum")-currentNum;

if (taskStatus.equals("HAS_RECEIVED"))
return;
for (int i1 = 0; i1 < limitConfigNum; i1++) {
jo = new JSONObject(AntSportsRpcCall.completeExerciseTasks(taskId));
if (jo.getBoolean("success")) {
Log.record("做任务得运动币👯[完成任务:" + taskName + ",得" + prizeAmount + "🪙]");
// Log.record(jo.toString());
receiveCoinAsset();
}else {
// Log.record(jo.toString());
}
if (limitConfigNum>1)
Thread.sleep(5000);
else
Thread.sleep(1000);
}


}
}
} catch (JSONException e) {
Log.i(TAG, "sportsTasks err:");
Log.printStackTrace(e);
throw new RuntimeException(e);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}


private void receiveCoinAsset() {
try {
String s = AntSportsRpcCall.queryCoinBubbleModule();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,70 @@ public class AntSportsRpcCall {
timeZone = "Asia\\/Shanghai", version = "3.0.1.2", alipayAppVersion = "0.0.852",
cityCode = "330100", appId = "2021002116659397";

// 运动任务查询
public static String queryCoinTaskPanel() {
String args1 = "[\n" +
" {\n" +
" \"canAddHome\": false,\n" +
" \"chInfo\": \"ch_appcenter__chsub_9patch\",\n" +
" \"clientAuthStatus\": \"not_support\",\n" +
" \"clientOS\": \"android\",\n" +
" \"features\": [\n" +
" \"DAILY_STEPS_RANK_V2\",\n" +
" \"STEP_BATTLE\",\n" +
" \"CLUB_HOME_CARD\",\n" +
" \"NEW_HOME_PAGE_STATIC\",\n" +
" \"CLOUD_SDK_AUTH\",\n" +
" \"STAY_ON_COMPLETE\",\n" +
" \"EXTRA_TREASURE_BOX\",\n" +
" \"NEW_HOME_PAGE_STATIC\",\n" +
" \"SUPPORT_AI\",\n" +
" \"SUPPORT_TAB3\",\n" +
" \"SUPPORT_FLYRABBIT\",\n" +
" \"SUPPORT_NEW_MATCH\",\n" +
" \"EXTERNAL_ADVERTISEMENT_TASK\",\n" +
" \"PROP\",\n" +
" \"PROPV2\",\n" +
" \"ASIAN_GAMES\"\n" +
" ],\n" +
" \"topTaskId\": \"\"\n" +
" }\n" +
"]";

return ApplicationHook.requestString("com.alipay.sportshealth.biz.rpc.SportsHealthCoinTaskRpc.queryCoinTaskPanel", args1);
}
// 去完成任务
public static String completeExerciseTasks(String taskId) {
String args1 = "[\n" +
" {\n" +
" \"chInfo\": \"ch_appcenter__chsub_9patch\",\n" +
" \"clientOS\": \"android\",\n" +
" \"features\": [\n" +
" \"DAILY_STEPS_RANK_V2\",\n" +
" \"STEP_BATTLE\",\n" +
" \"CLUB_HOME_CARD\",\n" +
" \"NEW_HOME_PAGE_STATIC\",\n" +
" \"CLOUD_SDK_AUTH\",\n" +
" \"STAY_ON_COMPLETE\",\n" +
" \"EXTRA_TREASURE_BOX\",\n" +
" \"NEW_HOME_PAGE_STATIC\",\n" +
" \"SUPPORT_AI\",\n" +
" \"SUPPORT_TAB3\",\n" +
" \"SUPPORT_FLYRABBIT\",\n" +
" \"SUPPORT_NEW_MATCH\",\n" +
" \"EXTERNAL_ADVERTISEMENT_TASK\",\n" +
" \"PROP\",\n" +
" \"PROPV2\",\n" +
" \"ASIAN_GAMES\"\n" +
" ],\n" +
" \"taskAction\": \"JUMP\",\n" +
" \"taskId\": \""+taskId+"\"\n" +
" }\n" +
"]";

return ApplicationHook.requestString("com.alipay.sportshealth.biz.rpc.SportsHealthCoinTaskRpc.completeTask", args1);
}

public static String queryCoinBubbleModule() {
return ApplicationHook.requestString("com.alipay.sportshealth.biz.rpc.sportsHealthHomeRpc.queryCoinBubbleModule",
"[{\"bubbleId\":\"\",\"canAddHome\":false,\"chInfo\":\"" + chInfo
Expand Down