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

Commit

Permalink
修复 合并遗漏的功能:神奇物种-使用道具配置项;修复 网络延迟平衡过多导致收取能量失败的问题;
Browse files Browse the repository at this point in the history
  • Loading branch information
TKaxv-7S committed Jul 17, 2024
1 parent 9b2f8a9 commit 8c8ce4f
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 38 deletions.
10 changes: 5 additions & 5 deletions app/src/main/java/tkaxv7s/xposed/sesame/entity/RpcEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class RpcEntity {

private final String requestRelation;

private final Long requestTime;
//private final Long requestTime;

private volatile Boolean hasResult = false;

Expand All @@ -31,16 +31,16 @@ public RpcEntity(String requestMethod, String requestData) {
this(requestMethod, requestData, null);
}

public RpcEntity(String requestMethod, String requestData, String requestRelation) {
/*public RpcEntity(String requestMethod, String requestData, String requestRelation) {
this(requestMethod, requestData, requestRelation, null);
}
}*/

public RpcEntity(String requestMethod, String requestData, String requestRelation, Long requestTime) {
public RpcEntity(String requestMethod, String requestData, String requestRelation) {
this.requestThread = Thread.currentThread();
this.requestMethod = requestMethod;
this.requestData = requestData;
this.requestRelation = requestRelation;
this.requestTime = requestTime;
//this.requestTime = requestTime;
}

public void setResponseObject(Object result, String resultStr) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -705,9 +705,9 @@ public static String requestString(String method, String data, String relation)
return rpcBridge.requestString(method, data, relation);
}

public static String requestString(String method, String data, String relation, Long time) {
/*public static String requestString(String method, String data, String relation, Long time) {
return rpcBridge.requestString(method, data, relation, time);
}
}*/

public static String requestString(String method, String data, int tryCount, int retryInterval) {
return rpcBridge.requestString(method, data, tryCount, retryInterval);
Expand All @@ -717,9 +717,9 @@ public static String requestString(String method, String data, String relation,
return rpcBridge.requestString(method, data, relation, tryCount, retryInterval);
}

public static String requestString(String method, String data, String relation, Long time, int tryCount, int retryInterval) {
/*public static String requestString(String method, String data, String relation, Long time, int tryCount, int retryInterval) {
return rpcBridge.requestString(method, data, relation, time, tryCount, retryInterval);
}
}*/

public static RpcEntity requestObject(RpcEntity rpcEntity) {
return rpcBridge.requestObject(rpcEntity, 3, -1);
Expand All @@ -737,9 +737,9 @@ public static RpcEntity requestObject(String method, String data, String relatio
return rpcBridge.requestObject(method, data, relation);
}

public static RpcEntity requestObject(String method, String data, String relation, Long time) {
/*public static RpcEntity requestObject(String method, String data, String relation, Long time) {
return rpcBridge.requestObject(method, data, relation, time);
}
}*/

public static RpcEntity requestObject(String method, String data, int tryCount, int retryInterval) {
return rpcBridge.requestObject(method, data, tryCount, retryInterval);
Expand All @@ -749,9 +749,9 @@ public static RpcEntity requestObject(String method, String data, String relatio
return rpcBridge.requestObject(method, data, relation, tryCount, retryInterval);
}

public static RpcEntity requestObject(String method, String data, String relation, Long time, int tryCount, int retryInterval) {
/*public static RpcEntity requestObject(String method, String data, String relation, Long time, int tryCount, int retryInterval) {
return rpcBridge.requestObject(method, data, relation, time, tryCount, retryInterval);
}
}*/

public static void reLoginByBroadcast() {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,16 @@ public ModelGroup getGroup() {
private ChoiceModelField collectToFriendType;
private SelectModelField collectToFriendList;
private SelectModelField sendFriendCard;
private BooleanModelField useProp;

@Override
public ModelFields getFields() {
ModelFields modelFields = new ModelFields();
modelFields.addField(collectToFriend = new BooleanModelField("collectToFriend", "帮好友抽卡 | 开启", false));
modelFields.addField(collectToFriendType = new ChoiceModelField("collectToFriendType", "帮好友抽卡 | 动作", CollectToFriendType.COLLECT, CollectToFriendType.nickNames));
modelFields.addField(collectToFriendList = new SelectModelField("collectToFriendList", "帮好友抽卡 | 好友列表", new LinkedHashSet<>(), AlipayUser::getList));
modelFields.addField(collectToFriend = new BooleanModelField("collectToFriend", "帮抽卡 | 开启", false));
modelFields.addField(collectToFriendType = new ChoiceModelField("collectToFriendType", "帮抽卡 | 动作", CollectToFriendType.COLLECT, CollectToFriendType.nickNames));
modelFields.addField(collectToFriendList = new SelectModelField("collectToFriendList", "帮抽卡 | 好友列表", new LinkedHashSet<>(), AlipayUser::getList));
modelFields.addField(sendFriendCard = new SelectModelField("sendFriendCard", "送卡片好友列表(当前图鉴所有卡片)", new LinkedHashSet<>(), AlipayUser::getList));
modelFields.addField(useProp = new BooleanModelField("useProp", "使用道具", false));
return modelFields;
}

Expand Down Expand Up @@ -262,6 +264,22 @@ private void propList() {
if (holdsNum > 1) {
continue th;
}
} else if (useProp.getValue()) {
JSONArray propIdList = prop.getJSONArray("propIdList");
String propId = propIdList.getString(0);
String propName = prop.getJSONObject("propConfig").getString("propName");
int holdsNum = prop.optInt("holdsNum", 0);
jo = new JSONObject(AntDodoRpcCall.consumeProp(propId, propType));
TimeUtil.sleep(300);
if (!"SUCCESS".equals(jo.getString("resultCode"))) {
Log.record(jo.getString("resultDesc"));
Log.i(jo.toString());
continue;
}
Log.forest("使用道具🎭[" + propName + "]");
if (holdsNum > 1) {
continue th;
}
}
}
}
Expand Down Expand Up @@ -333,7 +351,9 @@ private void collectToFriend() {
JSONArray friendList = jo.getJSONObject("data").getJSONArray("friends");
for (int i = 0; i < friendList.length() && count > 0; i++) {
JSONObject friend = friendList.getJSONObject(i);
if (friend.getBoolean("dailyCollect")) continue;
if (friend.getBoolean("dailyCollect")) {
continue;
}
String useId = friend.getString("userId");
boolean isCollectToFriend = collectToFriendList.getValue().contains(useId);
if (collectToFriendType.getValue() == CollectToFriendType.DONT_COLLECT) {
Expand Down Expand Up @@ -368,7 +388,7 @@ public interface CollectToFriendType {
int COLLECT = 0;
int DONT_COLLECT = 1;

String[] nickNames = {"选中帮开", "选中不帮开"};
String[] nickNames = {"选中帮抽卡", "选中不帮抽卡"};

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ public static String queryFriendHomePage(String userId) {
}

public static RpcEntity getCollectEnergyRpcEntity(String bizType, String userId, long bubbleId) {
return getCollectEnergyRpcEntity(bizType, userId, bubbleId, null);
}

public static RpcEntity getCollectEnergyRpcEntity(String bizType, String userId, long bubbleId, Long produceTime) {
String args1;
if (StringUtil.isEmpty(bizType)) {
args1 = "[{\"bizType\":\"\",\"bubbleIds\":[" + bubbleId
Expand All @@ -65,7 +61,7 @@ public static RpcEntity getCollectEnergyRpcEntity(String bizType, String userId,
args1 = "[{\"bizType\":\"" + bizType + "\",\"bubbleIds\":[" + bubbleId
+ "],\"source\":\"chInfo_ch_appcenter__chsub_9patch\",\"userId\":\"" + userId + "\"}]";
}
return new RpcEntity("alipay.antmember.forest.h5.collectEnergy", args1, null, produceTime);
return new RpcEntity("alipay.antmember.forest.h5.collectEnergy", args1, null);
}

public static String collectEnergy(String bizType, String userId, Long bubbleId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ public class AntForestV2 extends ModelTask {

private Integer retryIntervalInt;

private Integer advanceTimeInt;

private FixedOrRangeIntervalLimit collectIntervalEntity;

private FixedOrRangeIntervalLimit doubleCollectIntervalEntity;
Expand Down Expand Up @@ -231,6 +233,7 @@ public void boot(ClassLoader classLoader) {
RpcIntervalLimit.addIntervalLimit("alipay.antforest.forest.h5.fillUserRobFlag", 500);
tryCountInt = tryCount.getValue();
retryIntervalInt = retryInterval.getValue();
advanceTimeInt = advanceTime.getValue();
dontCollectMap = dontCollectList.getValue();
collectIntervalEntity = new FixedOrRangeIntervalLimit(collectInterval.getValue(), 50, 10000);
doubleCollectIntervalEntity = new FixedOrRangeIntervalLimit(doubleCollectInterval.getValue(), 10, 5000);
Expand Down Expand Up @@ -863,7 +866,7 @@ private void collectEnergy(CollectEnergyEntity collectEnergyEntity, Boolean join
ApplicationHook.requestObject(rpcEntity, 0, 0);
long spendTime = System.currentTimeMillis() - startTime;
if (balanceNetworkDelay.getValue()) {
delayTimeMath.nextInteger((int) (spendTime / 2));
delayTimeMath.nextInteger((int) (spendTime / 3));
}
if (rpcEntity.getHasError()) {
String errorCode = (String) XposedHelpers.callMethod(rpcEntity.getResponseObject(), "getString", "error");
Expand Down Expand Up @@ -2332,7 +2335,7 @@ private class BubbleTimerTask extends ChildModelTask {
* Instantiates a new Bubble timer task.
*/
BubbleTimerTask(String ui, long bi, long pt) {
super(AntForestV2.getBubbleTimerTid(ui, bi), pt - 3000 - advanceTime.getValue());
super(AntForestV2.getBubbleTimerTid(ui, bi), pt - 3000 - advanceTimeInt);
userId = ui;
bubbleId = bi;
produceTime = pt;
Expand All @@ -2343,7 +2346,7 @@ public Runnable setRunnable() {
return () -> {
String userName = UserIdMap.getMaskName(userId);
int averageInteger = offsetTimeMath.getAverageInteger();
long readyTime = produceTime - advanceTime.getValue() - delayTimeMath.getAverageInteger() + averageInteger - System.currentTimeMillis();
long readyTime = produceTime + averageInteger - advanceTimeInt - delayTimeMath.getAverageInteger() - System.currentTimeMillis();
if (readyTime > 0) {
try {
Thread.sleep(readyTime);
Expand All @@ -2353,7 +2356,7 @@ public Runnable setRunnable() {
}
}
Log.record("执行蹲点收取[" + userName + "]" + "时差[" + averageInteger + "]ms");
collectEnergy(new CollectEnergyEntity(userId, null, AntForestRpcCall.getCollectEnergyRpcEntity(null, userId, bubbleId, produceTime)), true);
collectEnergy(new CollectEnergyEntity(userId, null, AntForestRpcCall.getCollectEnergyRpcEntity(null, userId, bubbleId)), true);
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,14 @@ public RpcEntity requestObject(RpcEntity rpcEntity, int tryCount, int retryInter
String method = rpcEntity.getRequestMethod();
String data = rpcEntity.getRequestData();
String relation = rpcEntity.getRequestRelation();
Long time = rpcEntity.getRequestTime();
try {
int count = 0;
do {
count++;
try {
RpcIntervalLimit.enterIntervalLimit(method);
newRpcCallMethod.invoke(
newRpcInstance, method, false, false, "json", parseObjectMethod.invoke(null, "{\"__apiCallStartTime\":" + (time == null ? System.currentTimeMillis() : Math.max(System.currentTimeMillis(), time)) + ",\"apiCallLink\":\"XRiverNotFound\",\"execEngine\":\"XRiver\",\"operationType\":\"" + method + "\",\"requestData\":" + data + (relation == null ? "" : ",\"relationLocal\":" + relation) + "}"), "", null, true, false, 0, false, "", null, null, null, Proxy.newProxyInstance(loader, bridgeCallbackClazzArray, new InvocationHandler() {
newRpcInstance, method, false, false, "json", parseObjectMethod.invoke(null, "{\"__apiCallStartTime\":" + System.currentTimeMillis() + ",\"apiCallLink\":\"XRiverNotFound\",\"execEngine\":\"XRiver\",\"operationType\":\"" + method + "\",\"requestData\":" + data + (relation == null ? "" : ",\"relationLocal\":" + relation) + "}"), "", null, true, false, 0, false, "", null, null, null, Proxy.newProxyInstance(loader, bridgeCallbackClazzArray, new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args) {
if (args.length == 1 && "sendJSONResponse".equals(method.getName())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ default String requestString(String method, String data, String relation) {
return requestString(method, data, relation, 3, -1);
}

default String requestString(String method, String data, String relation, Long time) {
/*default String requestString(String method, String data, String relation, Long time) {
return requestString(method, data, relation, time, 3, -1);
}
}*/

default String requestString(String method, String data, int tryCount, int retryInterval) {
return requestString(new RpcEntity(method, data), tryCount, retryInterval);
Expand All @@ -36,9 +36,9 @@ default String requestString(String method, String data, String relation, int tr
return requestString(new RpcEntity(method, data, relation), tryCount, retryInterval);
}

default String requestString(String method, String data, String relation, Long time, int tryCount, int retryInterval) {
/*default String requestString(String method, String data, String relation, Long time, int tryCount, int retryInterval) {
return requestString(new RpcEntity(method, data, relation, time), tryCount, retryInterval);
}
}*/

RpcEntity requestObject(RpcEntity rpcEntity, int tryCount, int retryInterval);

Expand All @@ -54,9 +54,9 @@ default RpcEntity requestObject(String method, String data, String relation) {
return requestObject(method, data, relation, 3, -1);
}

default RpcEntity requestObject(String method, String data, String relation, Long time) {
/*default RpcEntity requestObject(String method, String data, String relation, Long time) {
return requestObject(method, data, relation, time, 3, -1);
}
}*/

default RpcEntity requestObject(String method, String data, int tryCount, int retryInterval) {
return requestObject(new RpcEntity(method, data), tryCount, retryInterval);
Expand All @@ -66,8 +66,8 @@ default RpcEntity requestObject(String method, String data, String relation, int
return requestObject(new RpcEntity(method, data, relation), tryCount, retryInterval);
}

default RpcEntity requestObject(String method, String data, String relation, Long time, int tryCount, int retryInterval) {
/*default RpcEntity requestObject(String method, String data, String relation, Long time, int tryCount, int retryInterval) {
return requestObject(new RpcEntity(method, data, relation, time), tryCount, retryInterval);
}
}*/

}
2 changes: 1 addition & 1 deletion app/src/main/java/tkaxv7s/xposed/sesame/util/FileUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ public static void clearLog() {
for (File file : files) {
String name = file.getName();
if (name.endsWith(today + ".log")) {
if (file.length() < 209_715_200) {
if (file.length() < 104_857_600) {
continue;
}
}
Expand Down

0 comments on commit 8c8ce4f

Please sign in to comment.