Skip to content

Commit

Permalink
Merge pull request #555 from constanline/master
Browse files Browse the repository at this point in the history
合并至release
  • Loading branch information
constanline committed Jun 20, 2024
2 parents 59413b3 + c46c3f6 commit f3fb9a3
Show file tree
Hide file tree
Showing 49 changed files with 2,658 additions and 424 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ jobs:
keyAlias: ${{ secrets.ANDROID_KEY_ALIAS }}
keyStorePassword: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }}
buildToolsVersion: 30.0.3
buildToolsVersion: 31.0.0

- name: Upload to Release Action
uses: Shopify/upload-to-release@v1.0.1
uses: termux/upload-release[email protected]
with:
name: xqe-sesame-${{ github.event.release.tag_name }}.apk
path: ${{ steps.sign_app.outputs.signedFile }}
repo-token: ${{ github.token }}
content-type: application/zip
asset_name: xqe-sesame-${{ github.event.release.tag_name }}.apk
file: ${{ steps.sign_app.outputs.signedFile }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
overwrite: true
checksums: sha256
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
minSdk 21
//noinspection ExpiredTargetSdkVersion
targetSdk 29
versionCode 67
versionName "1.2.1"
versionCode 73
versionName "1.2.4"
}
buildTypes {
release {
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
android:name="xposedminversion"
android:value="54"/>

<meta-data android:name="xposedscope" android:resource="@array/xposed_scopes" />


<activity
android:name=".ui.MainActivity"
android:resizeableActivity="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ public static void start() {
@Override
public void run() {
try {
while (FriendIdMap.currentUid == null || FriendIdMap.currentUid.isEmpty())
Thread.sleep(101);
FriendIdMap.waitingCurrentUid();
ancientTree(Config.getAncientTreeCityCodeList()); // 二次检查 有时会返回繁忙漏保护
} catch (Throwable t) {
Log.i(TAG, "start.run err:");
Expand Down Expand Up @@ -64,7 +63,7 @@ private static void ancientTreeProtect(String cityCode) {
JSONObject districtInfo = districtBriefInfo.getJSONObject("districtInfo");
String districtCode = districtInfo.getString("districtCode");
districtDetail(districtCode);
Thread.sleep(500L);
Thread.sleep(1000L);
}
Statistics.ancientTreeToday(cityCode);
}
Expand Down
203 changes: 203 additions & 0 deletions app/src/main/java/pansong291/xposed/quickenergy/AntBookRead.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
package pansong291.xposed.quickenergy;

import org.json.JSONArray;
import org.json.JSONObject;
import pansong291.xposed.quickenergy.data.RuntimeInfo;
import pansong291.xposed.quickenergy.hook.AntBookReadRpcCall;
import pansong291.xposed.quickenergy.util.Config;
import pansong291.xposed.quickenergy.util.Log;
import pansong291.xposed.quickenergy.util.RandomUtils;
import pansong291.xposed.quickenergy.util.StringUtil;

public class AntBookRead {
private static final String TAG = AntBookRead.class.getCanonicalName();

public static void start() {
if (!Config.antBookRead())
return;

long executeTime = RuntimeInfo.getInstance().getLong("consumeGold", 0);
if (System.currentTimeMillis() - executeTime < 21600000) {
return;
}
RuntimeInfo.getInstance().put("consumeGold", System.currentTimeMillis());

new Thread() {
@Override
public void run() {
try {
// queryTaskCenterPage();
queryTask();
queryTreasureBox();
} catch (Throwable t) {
Log.i(TAG, "start.run err:");
Log.printStackTrace(TAG, t);
}
}
}.start();
}

private static void queryTaskCenterPage() {
try {
String s = AntBookReadRpcCall.queryTaskCenterPage();
JSONObject jo = new JSONObject(s);
if (jo.getBoolean("success")) {
JSONObject data = jo.getJSONObject("data");
String todayPlayDurationText = data.getJSONObject("benefitAggBlock").getString("todayPlayDurationText");
int PlayDuration = Integer.parseInt(StringUtil.getSubString(todayPlayDurationText, "今日听读时长", "分钟"));
if (PlayDuration < 450) {
jo = new JSONObject(AntBookReadRpcCall.queryHomePage());
if (jo.getBoolean("success")) {
JSONArray bookList = jo.getJSONObject("data").getJSONArray("dynamicCardList").getJSONObject(0)
.getJSONObject("data").getJSONArray("bookList");
int bookListLength = bookList.length();
int postion = RandomUtils.nextInt(0, bookListLength - 1);
JSONObject book = bookList.getJSONObject(postion);
String bookId = book.getString("bookId");
jo = new JSONObject(AntBookReadRpcCall.queryReaderContent(bookId));
if (jo.getBoolean("success")) {
String nextChapterId = jo.getJSONObject("data").getString("nextChapterId");
String name = jo.getJSONObject("data").getJSONObject("readerHomePageVO").getString("name");
for (int i = 0; i < 17; i++) {
int energy = 0;
jo = new JSONObject(AntBookReadRpcCall.syncUserReadInfo(bookId, nextChapterId));
if (jo.getBoolean("success")) {
jo = new JSONObject(AntBookReadRpcCall.queryReaderForestEnergyInfo(bookId));
if (jo.getBoolean("success")) {
String tips = jo.getJSONObject("data").getString("tips");
if (tips.contains("已得")) {
energy = Integer.parseInt(StringUtil.getSubString(tips, "已得", "g"));
}
Log.forest("阅读书籍📚[" + name + "]#累计能量" + energy + "g");
}
} else {
Log.recordLog(jo.getString("resultDesc"), s);
}
if (energy >= 150) {
break;
} else {
Thread.sleep(1500L);
}
}
}
}
}
} else {
Log.recordLog(jo.getString("resultDesc"), s);
}
} catch (Throwable t) {
Log.i(TAG, "queryTaskCenterPage err:");
Log.printStackTrace(TAG, t);
}
}

private static void queryTask() {
boolean doubleCheck = false;
try {
String s = AntBookReadRpcCall.queryTaskCenterPage();
JSONObject jo = new JSONObject(s);
if (jo.getBoolean("success")) {
JSONObject data = jo.getJSONObject("data");
JSONArray userTaskGroupList = data.getJSONObject("userTaskListModuleVO")
.getJSONArray("userTaskGroupList");
for (int i = 0; i < userTaskGroupList.length(); i++) {
jo = userTaskGroupList.getJSONObject(i);
JSONArray userTaskList = jo.getJSONArray("userTaskList");
for (int j = 0; j < userTaskList.length(); j++) {
JSONObject taskInfo = userTaskList.getJSONObject(j);
String taskStatus = taskInfo.getString("taskStatus");
String taskType = taskInfo.getString("taskType");
String title = taskInfo.getString("title");
if ("TO_RECEIVE".equals(taskStatus)) {
if ("READ_MULTISTAGE".equals(taskType)) {
JSONArray multiSubTaskList = taskInfo.getJSONArray("multiSubTaskList");
for (int k = 0; k < multiSubTaskList.length(); k++) {
taskInfo = multiSubTaskList.getJSONObject(k);
taskStatus = taskInfo.getString("taskStatus");
if ("TO_RECEIVE".equals(taskStatus)) {
String taskId = taskInfo.getString("taskId");
collectTaskPrize(taskId, taskType, title);
}
}
} else {
String taskId = taskInfo.getString("taskId");
collectTaskPrize(taskId, taskType, title);
}
} else if ("NOT_DONE".equals(taskStatus)) {
if ("AD_VIDEO_TASK".equals(taskType)) {
String taskId = taskInfo.getString("taskId");
for (int m = 0; m < 5; m++) {
taskFinish(taskId, taskType);
Thread.sleep(1500L);
collectTaskPrize(taskId, taskType, title);
Thread.sleep(1500L);
}
} else if ("FOLLOW_UP".equals(taskType) || "JUMP".equals(taskType)) {
String taskId = taskInfo.getString("taskId");
taskFinish(taskId, taskType);
doubleCheck = true;
}
}
}
}
if (doubleCheck)
queryTask();
} else {
Log.recordLog(jo.getString("resultDesc"), s);
}
} catch (Throwable t) {
Log.i(TAG, "queryTask err:");
Log.printStackTrace(TAG, t);
}
}

private static void collectTaskPrize(String taskId, String taskType, String name) {
try {
String s = AntBookReadRpcCall.collectTaskPrize(taskId, taskType);
JSONObject jo = new JSONObject(s);
if (jo.getBoolean("success")) {
int coinNum = jo.getJSONObject("data").getInt("coinNum");
Log.other("阅读任务📖[" + name + "]#" + coinNum);
}
} catch (Throwable t) {
Log.i(TAG, "collectTaskPrize err:");
Log.printStackTrace(TAG, t);
}
}

private static void taskFinish(String taskId, String taskType) {
try {
String s = AntBookReadRpcCall.taskFinish(taskId, taskType);
JSONObject jo = new JSONObject(s);
if (jo.getBoolean("success")) {

}
} catch (Throwable t) {
Log.i(TAG, "taskFinish err:");
Log.printStackTrace(TAG, t);
}
}

private static void queryTreasureBox() {
try {
String s = AntBookReadRpcCall.queryTreasureBox();
JSONObject jo = new JSONObject(s);
if (jo.getBoolean("success")) {
JSONObject treasureBoxVo = jo.getJSONObject("data").getJSONObject("treasureBoxVo");
if (treasureBoxVo.has("countdown"))
return;
String status = treasureBoxVo.getString("status");
if ("CAN_OPEN".equals(status)) {
jo = new JSONObject(AntBookReadRpcCall.openTreasureBox());
if (jo.getBoolean("success")) {
int coinNum = jo.getJSONObject("data").getInt("coinNum");
Log.other("阅读任务📖[打开宝箱]#" + coinNum);
}
}
}
} catch (Throwable t) {
Log.i(TAG, "queryTreasureBox err:");
Log.printStackTrace(TAG, t);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ public static void start() {
@Override
public void run() {
try {
while (FriendIdMap.currentUid == null || FriendIdMap.currentUid.isEmpty())
Thread.sleep(100);
FriendIdMap.waitingCurrentUid();
String s = AntCooperateRpcCall.queryUserCooperatePlantList();
if (s == null) {
Thread.sleep(RandomUtils.delay());
Expand All @@ -42,7 +41,7 @@ public void run() {
String name = jo.getString("name");
int waterDayLimit = jo.getInt("waterDayLimit");
CooperationIdMap.putIdMap(cooperationId, name);
if (!Statistics.canCooperateWaterToday(FriendIdMap.currentUid, cooperationId))
if (!Statistics.canCooperateWaterToday(FriendIdMap.getCurrentUid(), cooperationId))
continue;
int index = -1;
for (int j = 0; j < Config.getCooperateWaterList().size(); j++) {
Expand All @@ -58,7 +57,7 @@ public void run() {
if (num > userCurrentEnergy)
num = userCurrentEnergy;
if (num > 0)
cooperateWater(FriendIdMap.currentUid, cooperationId, num, name);
cooperateWater(FriendIdMap.getCurrentUid(), cooperationId, num, name);
}
}
} else {
Expand All @@ -79,7 +78,7 @@ private static void cooperateWater(String uid, String coopId, int count, String
JSONObject jo = new JSONObject(s);
if ("SUCCESS".equals(jo.getString("resultCode"))) {
Log.forest("合种浇水🚿[" + name + "]" + jo.getString("barrageText"));
Statistics.cooperateWaterToday(FriendIdMap.currentUid, coopId);
Statistics.cooperateWaterToday(FriendIdMap.getCurrentUid(), coopId);
} else {
Log.i(TAG, jo.getString("resultDesc"));
}
Expand Down
Loading

0 comments on commit f3fb9a3

Please sign in to comment.