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

Commit 03f27ec

Browse files
authored
Merge pull request #242 from LazyImmortal/beta
添加 安心豆兑换时光加速器
2 parents 68cac3c + ec6dc9f commit 03f27ec

File tree

3 files changed

+99
-43
lines changed

3 files changed

+99
-43
lines changed

app/src/main/java/tkaxv7s/xposed/sesame/model/task/antFarm/AntFarm.java

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -295,13 +295,15 @@ public void run() {
295295
needReload = true;
296296
}
297297
}
298-
if (AnimalBuff.ACCELERATING.name().equals(ownerAnimal.animalBuff)) {
299-
Log.record("小鸡在加速吃饭");
300-
} else if (useAccelerateTool.getValue() && !AnimalFeedStatus.HUNGRY.name().equals(ownerAnimal.animalFeedStatus)) {
301-
// 加速卡
302-
// if (useFarmTool(ownerFarmId, ToolType.ACCELERATETOOL)) {
303-
// needReload = true;
304-
// }
298+
// if (AnimalBuff.ACCELERATING.name().equals(ownerAnimal.animalBuff)) {
299+
// Log.record("小鸡在加速吃饭");
300+
// } else if (useAccelerateTool.getValue() && !AnimalFeedStatus.HUNGRY.name().equals(ownerAnimal.animalFeedStatus)) {
301+
// // 加速卡
302+
// if (useFarmTool(ownerFarmId, ToolType.ACCELERATETOOL)) {
303+
// needReload = true;
304+
// }
305+
// }
306+
if (useAccelerateTool.getValue() && !AnimalFeedStatus.HUNGRY.name().equals(ownerAnimal.animalFeedStatus)) {
305307
if (useAccelerateTool()) {
306308
needReload = true;
307309
}
@@ -1153,21 +1155,25 @@ private boolean useAccelerateTool() {
11531155
return false;
11541156
}
11551157
syncAnimalStatus(ownerFarmId);
1156-
double eatten = 0d;
1157-
long nowTime = System.currentTimeMillis();
1158+
double consumeSpeed = 0d;
1159+
double allFoodHaveEatten = 0d;
1160+
long nowTime = System.currentTimeMillis() / 1000;
11581161
for (Animal animal : animals) {
1159-
long time = (nowTime - animal.startEatTime) / 1000;
1160-
double animalEatten = animal.consumeSpeed * time;
1161-
eatten += animalEatten;
1162-
1162+
if (animal.masterFarmId.equals(ownerFarmId)) {
1163+
consumeSpeed = animal.consumeSpeed;
1164+
}
1165+
allFoodHaveEatten += animal.foodHaveEatten;
1166+
allFoodHaveEatten += animal.consumeSpeed * (nowTime - animal.startEatTime / 1000);
11631167
}
1168+
// consumeSpeed: g/s
1169+
// AccelerateTool: -1h = -60m = -3600s
11641170
boolean isUseAccelerateTool = false;
1165-
// 180 - eatten >= 36
1166-
while (eatten <= 144 && useFarmTool(ownerFarmId, ToolType.ACCELERATETOOL)) {
1171+
while (180 - allFoodHaveEatten >= consumeSpeed * 3600
1172+
&& useFarmTool(ownerFarmId, ToolType.ACCELERATETOOL)) {
1173+
allFoodHaveEatten += consumeSpeed * 3600;
1174+
isUseAccelerateTool = true;
11671175
Status.useAccelerateTool();
11681176
TimeUtil.sleep(1000);
1169-
isUseAccelerateTool = true;
1170-
eatten += 36;
11711177
}
11721178
return isUseAccelerateTool;
11731179
}

app/src/main/java/tkaxv7s/xposed/sesame/model/task/antMember/AntMember.java

Lines changed: 52 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@
1212

1313
import java.util.Iterator;
1414

15-
/**
16-
* 会员
17-
*
18-
* @author xiong
19-
*/
2015
public class AntMember extends ModelTask {
2116
private static final String TAG = AntMember.class.getSimpleName();
2217

@@ -40,6 +35,7 @@ public ModelGroup getGroup() {
4035
private BooleanModelField zcjSignIn;
4136
private BooleanModelField merchantKmdk;
4237
private BooleanModelField beanSignIn;
38+
private BooleanModelField beanExchangeBubbleBoost;
4339

4440
@Override
4541
public ModelFields getFields() {
@@ -54,6 +50,7 @@ public ModelFields getFields() {
5450
modelFields.addField(zcjSignIn = new BooleanModelField("zcjSignIn", "招财金签到", false));
5551
modelFields.addField(merchantKmdk = new BooleanModelField("merchantKmdk", "商户开门打卡", false));
5652
modelFields.addField(beanSignIn = new BooleanModelField("beanSignIn", "安心豆签到", false));
53+
modelFields.addField(beanExchangeBubbleBoost = new BooleanModelField("beanExchangeBubbleBoost", "安心豆兑换时光加速器", false));
5754
return modelFields;
5855
}
5956

@@ -86,6 +83,9 @@ public void run() {
8683
if (beanSignIn.getValue()) {
8784
beanSignIn();
8885
}
86+
if (beanExchangeBubbleBoost.getValue()) {
87+
beanExchangeBubbleBoost();
88+
}
8989
if (zcjSignIn.getValue() || merchantKmdk.getValue()) {
9090
JSONObject jo = new JSONObject(AntMemberRpcCall.transcodeCheck());
9191
if (!jo.getBoolean("success")) {
@@ -428,7 +428,7 @@ private void queryAllStatusTaskList() {
428428

429429
private void collectSecurityFund() {
430430
try {
431-
//模拟从生活记录->明细->任务->明细(两次,不知原因)
431+
// 模拟从生活记录->明细->任务->明细(两次,不知原因)
432432
String str = AntMemberRpcCall.promiseQueryHome();
433433
JSONObject jsonObject = new JSONObject(str);
434434
if (!jsonObject.getBoolean("success")) {
@@ -443,7 +443,7 @@ private void collectSecurityFund() {
443443
for (int i = 0; i < jsonArray.length(); i++) {
444444
jsonObject = jsonArray.getJSONObject(i);
445445
String recordId = jsonObject.getString("recordId");
446-
//如果当天任务做完后就结束了,则可以再继续一次,缩短任务时间。
446+
// 如果当天任务做完后就结束了,则可以再继续一次,缩短任务时间。
447447
boolean isRepeat = jsonObject.getInt("totalNums") - jsonObject.getInt("finishNums") == 1;
448448
String promiseName = jsonObject.getString("promiseName");
449449
if ("坚持攒保障金".equals(promiseName) && collectSecurityFund.getValue()) {
@@ -453,7 +453,7 @@ private void collectSecurityFund() {
453453
promiseQueryDetail(recordId);
454454
}
455455
if ("坚持锻炼,走运动路线".equals(promiseName)) {
456-
//已经加入了,运动会自动行走,暂不做处理
456+
// 已经加入了,运动会自动行走,暂不做处理
457457
isSportsRoute = false;
458458
}
459459
}
@@ -507,13 +507,13 @@ private void securityFund(boolean isRepeat, String recordId) {
507507
// 获取键对应的值
508508
Object propertyValue = jsonObject.get(key);
509509
if (propertyValue instanceof JSONArray) {
510-
//如eventToWaitDTOList、helpChildSumInsuredDTOList
510+
// 如eventToWaitDTOList、helpChildSumInsuredDTOList
511511
JSONArray jsonArray = ((JSONArray) propertyValue);
512512
for (int i = 0; i < jsonArray.length(); i++) {
513513
isRepeat = gainMyAndFamilySumInsured(jsonArray.getJSONObject(i), isRepeat, recordId);
514514
}
515515
} else if (propertyValue instanceof JSONObject) {
516-
//如signInDTO、priorityChannelDTO
516+
// 如signInDTO、priorityChannelDTO
517517
JSONObject jo = ((JSONObject) propertyValue);
518518
if (jo.length() == 0) {
519519
continue;
@@ -657,9 +657,9 @@ public void kbMember() {
657657

658658
private void goldTicket() {
659659
try {
660-
//签到
660+
// 签到
661661
goldBillCollect("\"campId\":\"CP1417744\",\"directModeDisableCollect\":true,\"from\":\"antfarm\",");
662-
//收取其他
662+
// 收取其他
663663
goldBillCollect("");
664664
} catch (Throwable t) {
665665
Log.printStackTrace(TAG, t);
@@ -789,15 +789,19 @@ private void collectSesame() {
789789

790790
private void beanSignIn() {
791791
try {
792-
JSONObject jo = new JSONObject(AntMemberRpcCall.querySignInProcess());
792+
JSONObject jo = new JSONObject(AntMemberRpcCall.querySignInProcess("AP16242232", "INS_BLUE_BEAN_SIGN"));
793793
if (!jo.getBoolean("success")) {
794+
Log.i(jo.toString());
794795
return;
795796
}
796797
if (jo.getJSONObject("result").getBoolean("canPush")) {
797-
jo = new JSONObject(AntMemberRpcCall.signInTrigger());
798+
jo = new JSONObject(AntMemberRpcCall.signInTrigger("AP16242232", "INS_BLUE_BEAN_SIGN"));
798799
if (jo.getBoolean("success")) {
799-
String prizeName = jo.getJSONObject("result").getJSONArray("prizeSendOrderDTOList").getJSONObject(0).getString("prizeName");
800+
String prizeName = jo.getJSONObject("result").getJSONArray("prizeSendOrderDTOList").getJSONObject(0)
801+
.getString("prizeName");
800802
Log.record("安心豆🫘[" + prizeName + "]");
803+
} else {
804+
Log.i(jo.toString());
801805
}
802806
}
803807

@@ -806,4 +810,37 @@ private void beanSignIn() {
806810
Log.printStackTrace(TAG, t);
807811
}
808812
}
813+
814+
private void beanExchangeBubbleBoost() {
815+
try {
816+
JSONObject jo = new JSONObject(AntMemberRpcCall.queryUserAccountInfo("INS_BLUE_BEAN"));
817+
if (!jo.getBoolean("success")) {
818+
Log.i(jo.toString());
819+
return;
820+
}
821+
int userCurrentPoint = jo.getJSONObject("result").getInt("userCurrentPoint");
822+
jo = new JSONObject(AntMemberRpcCall.beanExchangeDetail("IT20230214000700069722"));
823+
if (!jo.getBoolean("success")) {
824+
Log.i(jo.toString());
825+
return;
826+
}
827+
jo = jo.getJSONObject("result").getJSONObject("rspContext").getJSONObject("params").getJSONObject("exchangeDetail");
828+
String itemId = jo.getString("itemId");
829+
String itemName = jo.getString("itemName");
830+
jo = jo.getJSONObject("itemExchangeConsultDTO");
831+
int realConsumePointAmount = jo.getInt("realConsumePointAmount");
832+
if (!jo.getBoolean("canExchange") || realConsumePointAmount > userCurrentPoint) {
833+
return;
834+
}
835+
jo = new JSONObject(AntMemberRpcCall.beanExchange(itemId, realConsumePointAmount));
836+
if (jo.getBoolean("success")) {
837+
Log.record("安心豆🫘[兑换:" + itemName + "]");
838+
} else {
839+
Log.i(jo.toString());
840+
}
841+
} catch (Throwable t) {
842+
Log.i(TAG, "beanExchangeBubbleBoost err:");
843+
Log.printStackTrace(TAG, t);
844+
}
845+
}
809846
}

app/src/main/java/tkaxv7s/xposed/sesame/model/task/antMember/AntMemberRpcCall.java

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,15 @@
66
import tkaxv7s.xposed.sesame.hook.ApplicationHook;
77
import tkaxv7s.xposed.sesame.util.RandomUtil;
88

9-
/**
10-
* 会员RpcCall类
11-
* @author xiong
12-
*/
139
public class AntMemberRpcCall {
1410

1511
private static String getUniqueId() {
1612
return String.valueOf(System.currentTimeMillis()) + RandomUtil.nextLong();
1713
}
1814

1915
public static Boolean check() {
20-
RpcEntity rpcEntity = ApplicationHook.requestObject("alipay.antmember.biz.rpc.member.h5.queryPointCert", "[{\"page\":" + 1 + ",\"pageSize\":" + 8 + "}]", 1, 0);
16+
RpcEntity rpcEntity = ApplicationHook.requestObject("alipay.antmember.biz.rpc.member.h5.queryPointCert",
17+
"[{\"page\":" + 1 + ",\"pageSize\":" + 8 + "}]", 1, 0);
2118
return rpcEntity != null && !rpcEntity.getHasError();
2219
}
2320

@@ -37,7 +34,6 @@ public static String queryMemberSigninCalendar() {
3734
"[{\"autoSignIn\":true,\"invitorUserId\":\"\",\"sceneCode\":\"QUERY\"}]");
3835
}
3936

40-
4137
/* 商家服务 */
4238
public static String transcodeCheck() {
4339
return ApplicationHook.requestString("alipay.mrchservbase.mrchbusiness.sign.transcode.check",
@@ -161,7 +157,7 @@ public static String continueSignIn() {
161157
/**
162158
* 游戏中心查询待领取乐豆列表
163159
*/
164-
public static String queryPointBallList(){
160+
public static String queryPointBallList() {
165161
return ApplicationHook.requestString("com.alipay.gamecenteruprod.biz.rpc.v3.queryPointBallList",
166162
"[{\"source\":\"ch_appcenter__chsub_9patch\"}]");
167163
}
@@ -272,13 +268,30 @@ public static String gainMyAndFamilySumInsured(JSONObject jsonObject) throws JSO
272268
}
273269

274270
// 安心豆
275-
public static String querySignInProcess() {
271+
public static String querySignInProcess(String appletId, String scene) {
276272
return ApplicationHook.requestString("com.alipay.insmarketingbff.bean.querySignInProcess",
277-
"[{\"appletId\":\"AP16242232\",\"scene\":\"INS_BLUE_BEAN_SIGN\"}]");
273+
"[{\"appletId\":\"" + appletId + "\",\"scene\":\"" + scene + "\"}]");
278274
}
279275

280-
public static String signInTrigger() {
276+
public static String signInTrigger(String appletId, String scene) {
281277
return ApplicationHook.requestString("com.alipay.insmarketingbff.bean.signInTrigger",
282-
"[{\"appletId\":\"AP16242232\",\"scene\":\"INS_BLUE_BEAN_SIGN\"}]");
278+
"[{\"appletId\":\"" + appletId + "\",\"scene\":\"" + scene + "\"}]");
279+
}
280+
281+
public static String beanExchangeDetail(String itemId) {
282+
return ApplicationHook.requestString("com.alipay.insmarketingbff.onestop.planTrigger",
283+
"[{\"extParams\":{\"itemId\":\"" + itemId + "\"},"
284+
+ "\"planCode\":\"bluebean_onestop\",\"planOperateCode\":\"exchangeDetail\"}]");
285+
}
286+
287+
public static String beanExchange(String itemId, int pointAmount) {
288+
return ApplicationHook.requestString("com.alipay.insmarketingbff.onestop.planTrigger",
289+
"[{\"extParams\":{\"itemId\":\"" + itemId + "\",\"pointAmount\":\"" + Integer.toString(pointAmount) + "\"},"
290+
+ "\"planCode\":\"bluebean_onestop\",\"planOperateCode\":\"exchange\"}]");
291+
}
292+
293+
public static String queryUserAccountInfo(String pointProdCode) {
294+
return ApplicationHook.requestString("com.alipay.insmarketingbff.point.queryUserAccountInfo",
295+
"[{\"channel\":\"HiChat\",\"pointProdCode\":\"" + pointProdCode + "\",\"pointUnitType\":\"COUNT\"}]");
283296
}
284297
}

0 commit comments

Comments
 (0)