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

Commit

Permalink
Merge branch 'refs/heads/main' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
TKaxv-7S committed Jul 17, 2024
2 parents f267af3 + 0e04d06 commit 3d45bdf
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 229 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ public void run() {
handleDonation(donationCount.getValue());
}

if (answerQuestion.getValue() && Status.canAnswerQuestionToday(UserIdMap.getCurrentUid())) {
if (answerQuestion.getValue() && Status.canAnswerQuestionToday()) {
answerQuestion();
}

Expand All @@ -288,8 +288,11 @@ public void run() {
needReload = true;
}
}
while (useAccelerateToolBeforeCheck()) {
enterFarm();
if (useAccelerateTool.getValue()) {
while (useAccelerateToolBeforeCheck()) {
needReload = true;
TimeUtil.sleep(1000);
}
}
// if (AnimalBuff.ACCELERATING.name().equals(ownerAnimal.animalBuff)) {
// Log.record("小鸡在加速吃饭");
Expand Down Expand Up @@ -850,7 +853,7 @@ private void answerQuestion() {
}
Log.record("答题" + (correct ? "正确" : "错误") + "可领取["
+ extInfo.getString("award") + "克]");
Status.answerQuestionToday(UserIdMap.getCurrentUid());
Status.answerQuestionToday();

JSONArray operationConfigList = joDailySubmit
.getJSONArray("operationConfigList");
Expand Down Expand Up @@ -880,12 +883,12 @@ private void answerQuestion() {

case RECEIVED:
Log.record("今日答题已完成");
Status.answerQuestionToday(UserIdMap.getCurrentUid());
Status.answerQuestionToday();
break;

case FINISHED:
Log.record("已经答过题了,饲料待领取");
Status.answerQuestionToday(UserIdMap.getCurrentUid());
Status.answerQuestionToday();
break;
}
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
import tkaxv7s.xposed.sesame.data.RuntimeInfo;
import tkaxv7s.xposed.sesame.data.modelFieldExt.*;
import tkaxv7s.xposed.sesame.data.task.ModelTask;
import tkaxv7s.xposed.sesame.entity.AlipayUser;
import tkaxv7s.xposed.sesame.entity.CollectEnergyEntity;
import tkaxv7s.xposed.sesame.entity.FriendWatch;
import tkaxv7s.xposed.sesame.entity.RpcEntity;
import tkaxv7s.xposed.sesame.entity.*;
import tkaxv7s.xposed.sesame.hook.ApplicationHook;
import tkaxv7s.xposed.sesame.hook.Toast;
import tkaxv7s.xposed.sesame.model.base.TaskCommon;
Expand Down Expand Up @@ -444,16 +441,38 @@ public void run() {
Map<String, Integer> friendMap = waterFriendList.getValue();
for (Map.Entry<String, Integer> friendEntry : friendMap.entrySet()) {
String uid = friendEntry.getKey();
if (selfId.equals(uid))
if (selfId.equals(uid)) {
continue;
}
Integer waterCount = friendEntry.getValue();
if (waterCount == null || waterCount <= 0) {
continue;
}
if (waterCount > 3)
waterCount = 3;
if (Status.canWaterFriendToday(uid, waterCount)) {
waterFriendEnergy(uid, waterCount);
try {
String s = AntForestRpcCall.queryFriendHomePage(uid);
TimeUtil.sleep(100);
JSONObject jo = new JSONObject(s);
if ("SUCCESS".equals(jo.getString("resultCode"))) {
String bizNo = jo.getString("bizNo");
KVNode<Integer, Boolean> waterCountKVNode = returnFriendWater(uid, bizNo, waterCount, waterFriendCount.getValue());
waterCount = waterCountKVNode.getKey();
if (waterCount > 0) {
Status.waterFriendToday(uid, waterCount);
}
if (!waterCountKVNode.getValue()) {
break;
}
} else {
Log.record(jo.getString("resultDesc"));
Log.i(s);
}
} catch (Throwable t) {
Log.i(TAG, "waterFriendEnergy err:");
Log.printStackTrace(TAG, t);
}
}
}
Set<String> set = whoYouWantToGiveTo.getValue();
Expand Down Expand Up @@ -1200,31 +1219,12 @@ private void popupTask() {
}
}

private void waterFriendEnergy(String userId, int count) {
try {
String s = AntForestRpcCall.queryFriendHomePage(userId);
TimeUtil.sleep(100);
JSONObject jo = new JSONObject(s);
if ("SUCCESS".equals(jo.getString("resultCode"))) {
String bizNo = jo.getString("bizNo");
count = returnFriendWater(userId, bizNo, count, waterFriendCount.getValue());
if (count > 0)
Status.waterFriendToday(userId, count);
} else {
Log.record(jo.getString("resultDesc"));
Log.i(s);
}
} catch (Throwable t) {
Log.i(TAG, "waterFriendEnergy err:");
Log.printStackTrace(TAG, t);
}
}

private int returnFriendWater(String userId, String bizNo, int count, int waterEnergy) {
private KVNode<Integer, Boolean> returnFriendWater(String userId, String bizNo, int count, int waterEnergy) {
if (bizNo == null || bizNo.isEmpty()) {
return 0;
return new KVNode<>(0, true);
}
int wateredTimes = 0;
boolean isContinue = true;
try {
String s;
JSONObject jo;
Expand All @@ -1249,6 +1249,7 @@ private int returnFriendWater(String userId, String bizNo, int count, int waterE
break label;
case "ENERGY_INSUFFICIENT":
Log.record("好友浇水🚿" + jo.getString("resultDesc"));
isContinue = false;
break label;
default:
Log.record("好友浇水🚿" + jo.getString("resultDesc"));
Expand All @@ -1260,7 +1261,7 @@ private int returnFriendWater(String userId, String bizNo, int count, int waterE
Log.i(TAG, "returnFriendWater err:");
Log.printStackTrace(TAG, t);
}
return wateredTimes;
return new KVNode<>(wateredTimes, isContinue);
}

private int getEnergyId(int waterEnergy) {
Expand Down
Loading

0 comments on commit 3d45bdf

Please sign in to comment.