Skip to content

Commit

Permalink
移除日志备份功能,写入runtime和simple、读取config加了同步锁,收取能量、通知赶鸡默认关闭,增加蚂蚁新村。合并来自cwj8…
Browse files Browse the repository at this point in the history
…51的pr,增加送麦子收麦子功能。
  • Loading branch information
constanline committed Aug 22, 2023
1 parent 147cdf3 commit 1ea6565
Show file tree
Hide file tree
Showing 24 changed files with 940 additions and 132 deletions.
57 changes: 20 additions & 37 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,30 @@
name: Questions and Bugs Report / 问题与 BUG 反馈
description: Questions and bugs report must be submitted using this template / 问题反馈必须使用此模板进行提交
name: 问题与 BUG 反馈
description: 问题反馈应当使用此模板进行提交
labels: [ bug ]
title: "[Questions and Bugs Report] (Briefly describe the cause of the problem)"
body:
- type: markdown
attributes:
value: |
### Please fill in the specific reason and steps to reproduce the problem below.
In the event of an exception, crash functional problem, you must submit a problem log, if not, your issues will be closed directly.
value: |
### 请在下方填写问题发生的具体原因和复现步骤。
发生异常、崩溃、闪退或功能性问题,必须提交问题 Log (日志),没有 Log 的 issues 将直接被关闭。
- type: input
attributes:
label: Module App version / 模块版本
description: |
Please fill in the complete version of the Module App currently in use, for example: **1.0**
请填写当前使用的模块完整版本号,例如:**1.0**
label: 模块版本
description: 请填写当前使用的模块完整版本号,例如:**1.0**
validations:
required: true
- type: input
attributes:
label: Device model and system in used / 正在使用的设备型号以及使用的系统
description: |
Fill in the current device model and system here, the system such as (MIUI, ColorOS, OxygenOS, PE/Native)
这里填写当前使用的设备型号以及使用的系统,系统例如 (MIUI、ColorOS、OxygenOS、PE/原生)
label: 正在使用的设备型号以及使用的系统
description: 这里填写当前使用的设备型号以及使用的系统,系统例如 (MIUI、ColorOS、OxygenOS、PE/原生)
validations:
required: true
- type: dropdown
attributes:
label: Android version / Android 版本
label: Android 版本
options:
- 14
- 13
- 12L/12.1
- 12
Expand All @@ -48,42 +40,33 @@ body:
required: true
- type: input
attributes:
label: Xposed Framework name and version / Xposed 框架名称与版本号
description: |
Please fill in the currently used Xposed Framework, for example: **LSPosed 1.8.4 (version code)**
请填写当前使用的 Xposed 框架,例如:**LSPosed 1.8.4 (次版本号)**
label: Xposed 框架名称与版本号
description: 请填写当前使用的 Xposed 框架,例如:**LSPosed 1.8.4 (次版本号)**
validations:
required: true
- type: textarea
attributes:
label: Describe in detail why the problem occurred / 详细描述问题发生的具体原因
label: 详细描述问题发生的具体原因
description: 请在下方详细描述问题发生的具体场景、复现步骤和经过,以便我们能够按照你所描述的步骤复现这个问题。
validations:
required: true
- type: textarea
attributes:
label: Provide module problem logs or necessary logs / 提供模块问题 Log 或必要 Log
description: |
Needs to be committed the problem-related parts of the logs at the File named runtime.Log.
需要提交在runtime.log文件中与问题相关部分的日志。
label: 提供模块问题 Log 或必要 Log
description: 需要提交在runtime.log文件中与问题相关部分的日志。
value: |
<details><summary>Click to expand / 展开查看</summary><pre><code>
<details><summary>展开查看</summary><pre><code>
(Paste problem log here / 此处粘贴问题 Log)
(此处粘贴问题 Log)
</code></pre></details>
<!-- When submitting, you can desensitize personal information, paste the logs you copied, and do not break the code format -->
<!-- 提交时可以将个人信息脱敏,粘贴你复制的日志,不要破坏代码格式 -->
validations:
required: true
- type: checkboxes
attributes:
label: Confirm the contents you submitted / 确认一下你提交的信息
description: |
In order to ensure the quality of issues and avoid wasting unnecessary time, issues that do not check the options below will be closed directly.
Please make sure you have **checked the option below** before submitting.
为了确保 issues 的质量和避免浪费不必要的时间,未勾选下方选项的 issues 将直接被关闭。
请一定确保你已经**勾选下方的选项**后再提交。
label: 确认一下你提交的信息
description: 为了确保 issues 的质量和避免浪费不必要的时间,未勾选下方选项的 issues 将直接被关闭。
options:
- label: I certify that the above contents is correct / 我确保上述信息准确无误
required: false
- label: 我确保上述信息准确无误
required: true
30 changes: 16 additions & 14 deletions .github/ISSUE_TEMPLATE/enhancement.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
name: Enhancement Report / 功能建议
description: 功能建议使用此模板进行提交 / Functional recommendations must be submitted using this template
name: 功能建议
description: 功能建议使用此模板进行提交
labels: [ enhancement ]
title: "[Enhancement Report]"
body:
- type: markdown
attributes:
value: |
### Please fill in the functional requirements or suggestions below.
### 请在下方填写功能需求或建议。
- type: dropdown
attributes:
label: 增强类型
options:
- 功能型增强
- 优化型增强
- 强迫症增强
validations:
required: true
- type: textarea
attributes:
label: Describe in detail / 具体描述
label: 具体描述
description: 请在下方详细描述功能需求或建议。
validations:
required: true
- type: checkboxes
attributes:
label: Confirm the contents you submitted / 确认一下你提交的信息
description: |
In order to ensure the quality of issues and avoid wasting unnecessary time, issues that do not check the options below will be closed directly.
Please make sure you have **checked the option below** before submitting.
为了确保 issues 的质量和避免浪费不必要的时间,未勾选下方选项的 issues 将直接被关闭。
请一定确保你已经**勾选下方的选项**后再提交。
label: 确认一下你提交的信息
description: 为了确保 issues 的质量和避免浪费不必要的时间,未勾选下方选项的 issues 将直接被关闭。
options:
- label: I certify that the above contents is correct / 我确保上述信息准确无误
required: false
- label: 我确保上述信息准确无误
required: true
17 changes: 1 addition & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
- [x] 神奇海洋
- [x] 芭芭农场
- [x] 保护地巡逻
- [ ] 蚂蚁新村
- [x] 蚂蚁新村
- [ ] 绿色营收
- [x] 高版本API存储问题

Expand All @@ -48,18 +48,3 @@
本项目基于 [XQuickEnergy](https://github.com/pansong291/XQuickEnergy) 开发,遵循 Apache-2.0 协议
所有图片由 ༒激༙྇流༙྇泉༙྇༒ 授权使用

## 反馈模板
***问题、建议、提问三选一***

***发issue前请先检查是否已存在类似问题,请不要重复提交***

例子如下

- 系统: MIUI14 Android13
- 方式: Magisk26.1 + LSPosed1.8.6
- 版本: 谷歌版支付宝10.3.12 + 芝麻粒v1.1.3
- 问题: 芝麻粒运行一段时间之后,通知栏提示“登录超时”,打开支付宝界面无效,需要杀掉进程重启才正常
- 建议: 希望增加蚂蚁新村功能
- 提问: 小鸡睡眠时间如何配置,与检测时间有什么关系
- 日志: 闪退请提交闪退日志,运行问题请提交runtime日志。
- 其他: 使用“存储空间隔离”请备注、双开/多开请提供用户id
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 55
versionName "1.1.3"
versionCode 56
versionName "1.1.4"
}
buildTypes {
release {
Expand Down
95 changes: 92 additions & 3 deletions app/src/main/java/pansong291/xposed/quickenergy/AntFarm.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import org.json.JSONArray;
import org.json.JSONObject;
import pansong291.xposed.quickenergy.hook.AntFarmRpcCall;
import pansong291.xposed.quickenergy.hook.DadaDailyRpcCall;
import pansong291.xposed.quickenergy.util.*;
import pansong291.xposed.quickenergy.hook.DadaDailyRpcCall;

import java.util.HashSet;
import java.util.Set;
Expand Down Expand Up @@ -93,7 +93,7 @@ private static class FarmTool {
private static double harvestBenevolenceScore;
private static int unreceiveTaskAward = 0;

private static FarmTool[] farmTools;
private static FarmTool[] farmTools;

public static void start() {
if (!Config.enableFarm())
Expand Down Expand Up @@ -125,6 +125,10 @@ public void run() {
if (jo.has("lotteryPlusInfo")) {
drawLotteryPlus(jo.getJSONObject("lotteryPlusInfo"));
}
if (Config.acceptGift() && joFarmVO.getJSONObject("subFarmVO").has("giftRecord")
&& foodStockLimit - foodStock >= 10) {
acceptGift();
}
} else {
Log.recordLog("", s);
}
Expand Down Expand Up @@ -262,6 +266,9 @@ public void run() {

}

// 送麦子
visit();

// 帮好友喂鸡
feedFriend();

Expand Down Expand Up @@ -444,7 +451,7 @@ private static void receiveToolTaskReward() {
JSONObject joItem = jaList.getJSONObject(i);
if (joItem.has("taskStatus")
&& TaskStatus.FINISHED.name().equals(joItem.getString("taskStatus"))) {
JSONObject bizInfo = new JSONObject(jo.getString("bizInfo"));
JSONObject bizInfo = new JSONObject(joItem.getString("bizInfo"));
String awardType = bizInfo.getString("awardType");
ToolType toolType = ToolType.valueOf(awardType);
boolean isFull = false;
Expand Down Expand Up @@ -1268,4 +1275,86 @@ private static void drawLotteryPlus(JSONObject lotteryPlusInfo) {
Log.printStackTrace(TAG, t);
}
}

private static void visit() {
try {
String s, memo;
JSONObject jo;
for (int i = 0; i < Config.getVisitFriendList().size(); i++) {
String userId = Config.getVisitFriendList().get(i);
if (userId.equals(FriendIdMap.currentUid))
continue;
int visitCount = Config.getVisitFriendCountList().get(i);
if (visitCount <= 0)
continue;
if (visitCount > 3)
visitCount = 3;
if (Statistics.canVisitFriendToday(userId, visitCount)) {
visitCount = visitFriend(userId, visitCount);
if (visitCount > 0)
Statistics.visitFriendToday(userId, visitCount);
}
}
} catch (Throwable t) {
Log.i(TAG, "visit err:");
Log.printStackTrace(TAG, t);
}
}

private static int visitFriend(String userId, int count) {
int visitedTimes = 0;
try {
String s = AntFarmRpcCall.enterFarm("", userId);
JSONObject jo = new JSONObject(s);
if ("SUCCESS".equals(jo.getString("memo"))) {
JSONObject farmVO = jo.getJSONObject("farmVO");
foodStock = farmVO.getInt("foodStock");
JSONObject subFarmVO = farmVO.getJSONObject("subFarmVO");
if (subFarmVO.optBoolean("visitedToday", true))
return 3;
String farmId = subFarmVO.getString("farmId");
for (int i = 0; i < count; i++) {
if (foodStock < 10)
break;
jo = new JSONObject(AntFarmRpcCall.visitFriend(farmId));
if ("SUCCESS".equals(jo.getString("memo"))) {
foodStock = jo.getInt("foodStock");
Log.farm("赠送麦子🌾[" + FriendIdMap.getNameById(userId) + "]#" + jo.getInt("giveFoodNum") + "g");
visitedTimes++;
if (jo.optBoolean("isReachLimit")) {
Log.recordLog("今日给[" + FriendIdMap.getNameById(userId) + "]送麦子已达上限", "");
visitedTimes = 3;
break;
}
} else {
Log.recordLog(jo.getString("memo"), jo.toString());
}
Thread.sleep(200);
}
} else {
Log.recordLog(jo.getString("memo"), s);
}
} catch (Throwable t) {
Log.i(TAG, "visitFriend err:");
Log.printStackTrace(TAG, t);
}
return visitedTimes;
}

private static void acceptGift() {
try {
JSONObject jo = new JSONObject(AntFarmRpcCall.acceptGift());
if ("SUCCESS".equals(jo.getString("memo"))) {
int receiveFoodNum = jo.getInt("receiveFoodNum");
Log.farm("收取麦子🌾[" + receiveFoodNum + "g]");
} else {
Log.i(TAG, jo.toString());
}

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

}
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ public static void stop() {
* Check energy ranking.
*
* @param loader the loader
* @param times the times
*/
public static void checkEnergyRanking(ClassLoader loader) {
if (RuntimeInfo.getInstance().getLong(RuntimeInfo.RuntimeInfoKey.ForestPauseTime) > System
Expand Down Expand Up @@ -610,7 +609,7 @@ private static int collectEnergy(String userId, long bubbleId, String bizNo, Str
if (collected > 0) {
totalCollected += collected;
Statistics.addData(Statistics.DataType.COLLECTED, collected);
String str = "偷取能量🪂[" + FriendIdMap.getNameById(userId) + "]#" + collected + "g"
String str = "收取能量🪂[" + FriendIdMap.getNameById(userId) + "]#" + collected + "g"
+ (StringUtil.isEmpty(extra) ? "" : "[" + extra + "]");
Log.forest(str);
AntForestToast.show(str);
Expand Down
Loading

0 comments on commit 1ea6565

Please sign in to comment.