Skip to content

Commit

Permalink
Merge branch 'constanline:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
995william authored Aug 4, 2023
2 parents 17b2273 + 28efa40 commit c17b29d
Show file tree
Hide file tree
Showing 26 changed files with 1,020 additions and 139 deletions.
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ android {

defaultConfig {
applicationId "pansong291.xposed.quickenergy.repair"
minSdkVersion 23
minSdk 21
//noinspection ExpiredTargetSdkVersion
targetSdkVersion 29
versionCode 29
versionName "1.0.12"
targetSdk 29
versionCode 33
versionName "1.0.13-fix1"
}
buildTypes {
release {
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
android:theme="@style/AppTheme"
android:allowBackup="true"
android:requestLegacyExternalStorage="true"
android:icon="@android:drawable/sym_def_app_icon"
android:icon="@drawable/icon"
android:roundIcon="@drawable/icon"
android:label="@string/app_name"
tools:targetApi="q">

Expand Down
208 changes: 198 additions & 10 deletions app/src/main/java/pansong291/xposed/quickenergy/AntOcean.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private static void queryHomePage() {
try {
JSONObject joHomePage = new JSONObject(AntOceanRpcCall.queryHomePage());
if ("SUCCESS".equals(joHomePage.getString("resultCode"))) {
if (joHomePage.has("bubbleVOList")) {
if (Config.collectEnergy() && joHomePage.has("bubbleVOList")) {
collectEnergy(joHomePage.getJSONArray("bubbleVOList"));
}

Expand All @@ -65,6 +65,13 @@ private static void queryHomePage() {
ipOpenSurprise();
}
}

queryReplicaHome();

queryMiscInfo();

queryUserRanking();

} else {
Log.i(TAG, joHomePage.getString("resultDesc"));
}
Expand Down Expand Up @@ -139,6 +146,23 @@ private static void ipOpenSurprise() {
}
}

private static void combineFish(String fishId) {
try {
String s = AntOceanRpcCall.combineFish(fishId);
JSONObject jo = new JSONObject(s);
if ("SUCCESS".equals(jo.getString("resultCode"))) {
JSONObject fishDetailVO = jo.getJSONObject("fishDetailVO");
String name = fishDetailVO.getString("name");
Log.forest("【神奇海洋】合成海洋生物" + name);
} else {
Log.i(TAG, jo.getString("resultDesc"));
}
} catch(Throwable t) {
Log.i(TAG, "combineFish err:");
Log.printStackTrace(TAG, t);
}
}

private static void checkReward(JSONArray rewards) {
try {
for (int i = 0; i < rewards.length(); i++) {
Expand All @@ -157,15 +181,7 @@ private static void checkReward(JSONArray rewards) {
}
if (canCombine && reward.optBoolean("unlock", false)) {
String fishId = reward.getString("id");
String s = AntOceanRpcCall.combineFish(fishId);
JSONObject jo = new JSONObject(s);
if ("SUCCESS".equals(jo.getString("resultCode"))) {
JSONObject fishDetailVO = jo.getJSONObject("fishDetailVO");
String name = fishDetailVO.getString("name");
Log.forest("【神奇海洋】合成海洋生物" + name);
} else {
Log.i(TAG, jo.getString("resultDesc"));
}
combineFish(fishId);
}
}

Expand All @@ -175,4 +191,176 @@ private static void checkReward(JSONArray rewards) {
Log.printStackTrace(TAG, t);
}
}

private static void collectReplicaAsset(int canCollectAssetNum) {
try {
for (int i = 0; i < canCollectAssetNum; i++) {
String s = AntOceanRpcCall.collectReplicaAsset();
JSONObject jo = new JSONObject(s);
if ("SUCCESS".equals(jo.getString("resultCode"))) {
Log.forest("【神奇海洋】学习海洋科普知识,潘多拉能量+1");
} else {
Log.i(TAG, jo.getString("resultDesc"));
}
}
} catch(Throwable t) {
Log.i(TAG, "collectReplicaAsset err:");
Log.printStackTrace(TAG, t);
}
}

private static void unLockReplicaPhase(String replicaCode, String replicaPhaseCode) {
try {
String s = AntOceanRpcCall.unLockReplicaPhase(replicaCode, replicaPhaseCode);
JSONObject jo = new JSONObject(s);
if ("SUCCESS".equals(jo.getString("resultCode"))) {
String name = jo.getJSONObject("currentPhaseInfo").getJSONObject("extInfo").getString("name");
Log.forest("【神奇海洋】迎回[" + name + "]");
} else {
Log.i(TAG, jo.getString("resultDesc"));
}
} catch(Throwable t) {
Log.i(TAG, "unLockReplicaPhase err:");
Log.printStackTrace(TAG, t);
}
}

private static void queryReplicaHome() {
try {
String s = AntOceanRpcCall.queryReplicaHome();
JSONObject jo = new JSONObject(s);
if ("SUCCESS".equals(jo.getString("resultCode"))) {
if (jo.has("userReplicaAssetVO")) {
JSONObject userReplicaAssetVO = jo.getJSONObject("userReplicaAssetVO");
int canCollectAssetNum = userReplicaAssetVO.getInt("canCollectAssetNum");
collectReplicaAsset(canCollectAssetNum);
}

if (jo.has("userCurrentPhaseVO")) {
JSONObject userCurrentPhaseVO = jo.getJSONObject("userCurrentPhaseVO");
String phaseCode = userCurrentPhaseVO.getString("phaseCode");
String code = jo.getJSONObject("userReplicaInfoVO").getString("code");
if ("COMPLETED".equals(userCurrentPhaseVO.getString("phaseStatus"))) {
unLockReplicaPhase(code, phaseCode);
}
}
} else {
Log.i(TAG, jo.getString("resultDesc"));
}
} catch(Throwable t) {
Log.i(TAG, "queryReplicaHome err:");
Log.printStackTrace(TAG, t);
}
}

private static void queryOceanPropList() {
try {
String s = AntOceanRpcCall.queryOceanPropList();
JSONObject jo = new JSONObject(s);
if ("SUCCESS".equals(jo.getString("resultCode"))) {
AntOceanRpcCall.repairSeaArea();
} else {
Log.i(TAG, jo.getString("resultDesc"));
}
} catch(Throwable t) {
Log.i(TAG, "queryOceanPropList err:");
Log.printStackTrace(TAG, t);
}
}

private static void querySeaAreaDetailList() {
try {
String s = AntOceanRpcCall.querySeaAreaDetailList();
JSONObject jo = new JSONObject(s);
if ("SUCCESS".equals(jo.getString("resultCode"))) {
int seaAreaNum = jo.getInt("seaAreaNum");
int fixSeaAreaNum = jo.getInt("fixSeaAreaNum");
int currentSeaAreaIndex = jo.getInt("currentSeaAreaIndex");
if (currentSeaAreaIndex < fixSeaAreaNum && seaAreaNum > fixSeaAreaNum) {
queryOceanPropList();
}
JSONArray seaAreaVOs = jo.getJSONArray("seaAreaVOs");
for (int i = 0; i < seaAreaVOs.length(); i++) {
JSONObject seaAreaVO = seaAreaVOs.getJSONObject(i);
JSONArray fishVOs = seaAreaVO.getJSONArray("fishVO");
for (int j = 0; j < fishVOs.length(); j++) {
JSONObject fishVO = fishVOs.getJSONObject(j);
if (!fishVO.getBoolean("unlock") && "COMPLETED".equals(fishVO.getString("status"))) {
String fishId = fishVO.getString("id");
combineFish(fishId);
}
}
}
} else {
Log.i(TAG, jo.getString("resultDesc"));
}
} catch(Throwable t) {
Log.i(TAG, "querySeaAreaDetailList err:");
Log.printStackTrace(TAG, t);
}
}

private static void queryMiscInfo() {
try {
String s = AntOceanRpcCall.queryMiscInfo();
JSONObject jo = new JSONObject(s);
if ("SUCCESS".equals(jo.getString("resultCode"))) {
JSONObject miscHandlerVOMap = jo.getJSONObject("miscHandlerVOMap");
JSONObject homeTipsRefresh = miscHandlerVOMap.getJSONObject("HOME_TIPS_REFRESH");
if (homeTipsRefresh.optBoolean("fishCanBeCombined") || homeTipsRefresh.optBoolean("canBeRepaired")) {
querySeaAreaDetailList();
}
} else {
Log.i(TAG, jo.getString("resultDesc"));
}
} catch(Throwable t) {
Log.i(TAG, "queryMiscInfo err:");
Log.printStackTrace(TAG, t);
}
}

private static void cleanFriendOcean(JSONObject fillFlag) {
if (!fillFlag.optBoolean("canClean")) {
return;
}
try {
String userId = fillFlag.getString("userId");
String s = AntOceanRpcCall.queryFriendPage(userId);
JSONObject jo = new JSONObject(s);
if ("SUCCESS".equals(jo.getString("resultCode"))) {
s = AntOceanRpcCall.cleanFriendOcean(userId);
jo = new JSONObject(s);
if ("SUCCESS".equals(jo.getString("resultCode"))) {
JSONArray cleanRewardVOS = jo.getJSONArray("cleanRewardVOS");
checkReward(cleanRewardVOS);
} else {
Log.i(TAG, jo.getString("resultDesc"));
}
} else {
Log.i(TAG, jo.getString("resultDesc"));
}
} catch(Throwable t) {
Log.i(TAG, "queryMiscInfo err:");
Log.printStackTrace(TAG, t);
}
}

private static void queryUserRanking() {
try {
String s = AntOceanRpcCall.queryUserRanking();
JSONObject jo = new JSONObject(s);
if ("SUCCESS".equals(jo.getString("resultCode"))) {
JSONArray fillFlagVOList = jo.getJSONArray("fillFlagVOList");
for (int i = 0; i < fillFlagVOList.length(); i++) {
JSONObject fillFlag = fillFlagVOList.getJSONObject(i);
cleanFriendOcean(fillFlag);
}
} else {
Log.i(TAG, jo.getString("resultDesc"));
}
} catch(Throwable t) {
Log.i(TAG, "queryMiscInfo err:");
Log.printStackTrace(TAG, t);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,94 @@ public static String cleanOcean(String userId) {
"[{\"cleanedUserId\":\"" + userId + "\",\"source\":\"ANT_FOREST\",\"uniqueId\":\"" + getUniqueId() + "\"}]");
}

public static String ipOpenSurprise() {
return RpcUtil.request("alipay.antocean.ocean.h5.ipOpenSurprise",
"[{\"source\":\"chInfo_ch_appcenter__chsub_9patch\",\"uniqueId\":\"" + getUniqueId() + "\"}]");
}

public static String collectReplicaAsset() {
return RpcUtil.request("alipay.antocean.ocean.h5.collectReplicaAsset",
"[{\"replicaCode\":\"avatar\",\"source\":\"senlinzuoshangjiao\",\"uniqueId\":\"" + getUniqueId() +
"\",\"version\":\"" + VERSION + "\"}]");
}

public static String receiveTaskAward(String sceneCode, String taskType) {
return RpcUtil.request("com.alipay.antiep.receiveTaskAward",
"[{\"ignoreLimit\":false,\"requestType\":\"RPC\",\"sceneCode\":\"" + sceneCode + "\",\"source\":\"ANT_FOREST\",\"taskType\":\"" +
taskType + "\",\"uniqueId\":\"" + getUniqueId() + "\"}]");
}

public static String finishTask(String sceneCode, String taskType) {
String outBizNo = taskType + "_" + RandomUtils.nextDouble();
return RpcUtil.request("com.alipay.antiep.finishTask",
"[{\"outBizNo\":\"" + outBizNo + "\",\"requestType\":\"RPC\",\"sceneCode\":\"" +
sceneCode + "\",\"source\":\"ANTFOCEAN\",\"taskType\":\"" + taskType + "\",\"uniqueId\":\"" + getUniqueId() + "\"}]");
}

public static String queryTaskList() {
return RpcUtil.request("alipay.antocean.ocean.h5.queryTaskList",
"[{\"extend\":{},\"fromAct\":\"dynamic_task\",\"sceneCode\":\"ANTOCEAN_TASK\",\"source\":\"ANT_FOREST\",\"uniqueId\":\"" +
getUniqueId() + "\",\"version\":\"" + VERSION + "\"}]");
}

public static String unLockReplicaPhase(String replicaCode, String replicaPhaseCode) {
return RpcUtil.request("alipay.antocean.ocean.h5.unLockReplicaPhase",
"[{\"replicaCode\":\"" + replicaCode + "\",\"replicaPhaseCode\":\"" + replicaPhaseCode +
"\",\"source\":\"senlinzuoshangjiao\",\"uniqueId\":\"" + getUniqueId() + "\",\"version\":\"20220707\"}]");
}

public static String queryReplicaHome() {
return RpcUtil.request("alipay.antocean.ocean.h5.queryReplicaHome",
"[{\"replicaCode\":\"avatar\",\"source\":\"senlinzuoshangjiao\",\"uniqueId\":\"" + getUniqueId() + "\"}]");
}

public static String repairSeaArea() {
return RpcUtil.request("alipay.antocean.ocean.h5.repairSeaArea",
"[{\"source\":\"chInfo_ch_appcenter__chsub_9patch\",\"uniqueId\":\"" + getUniqueId() + "\"}]");
}

public static String queryOceanPropList() {
return RpcUtil.request("alipay.antocean.ocean.h5.queryOceanPropList",
"[{\"propTypeList\":\"UNIVERSAL_PIECE\",\"skipPropId\":false,\"source\":\"chInfo_ch_appcenter__chsub_9patch\",\"uniqueId\":\"" +
getUniqueId() + "\"}]");
}

public static String querySeaAreaDetailList() {
return RpcUtil.request("alipay.antocean.ocean.h5.querySeaAreaDetailList",
"[{\"seaAreaCode\":\"\",\"source\":\"chInfo_ch_appcenter__chsub_9patch\",\"targetUserId\":\"\",\"uniqueId\":\"" +
getUniqueId() + "\"}]");
}

public static String queryMiscInfo() {
return RpcUtil.request("alipay.antocean.ocean.h5.queryMiscInfo",
"[{\"queryBizTypes\":[\"HOME_TIPS_REFRESH\"],\"source\":\"chInfo_ch_appcenter__chsub_9patch\",\"uniqueId\":\"" +
getUniqueId() + "\"}]");
}

public static String combineFish(String fishId) {
return RpcUtil.request("alipay.antocean.ocean.h5.combineFish", "[{\"fishId\":\"" + fishId +
"\",\"source\":\"ANT_FOREST\",\"uniqueId\":\"" + getUniqueId() + "\"}]");
}

public static String ipOpenSurprise() {
return RpcUtil.request("alipay.antocean.ocean.h5.ipOpenSurprise",
"[{\"source\":\"chInfo_ch_appcenter__chsub_9patch\",\"uniqueId\":\"" + getUniqueId() + "\"}]");
public static String querySeaAreaDetailList(String bubbleId, String userId) {
return RpcUtil.request("alipay.antmember.forest.h5.collectEnergy",
"[{\"bubbleIds\":[" + bubbleId + "],\"channel\":\"ocean\",\"source\":\"ANT_FOREST\",\"uniqueId\":\"" +
getUniqueId() + "\",\"userId\":\"" + userId + "\",\"version\":\"" + VERSION + "\"}]");
}

public static String cleanFriendOcean(String userId) {
return RpcUtil.request("alipay.antocean.ocean.h5.cleanFriendOcean",
"[{\"cleanedUserId\":\"" + userId + "\",\"source\":\"ANT_FOREST\",\"uniqueId\":\"" + getUniqueId() + "\"}]");
}

public static String queryFriendPage(String userId) {
return RpcUtil.request("alipay.antocean.ocean.h5.queryFriendPage",
"[{\"friendUserId\":\"" + userId + "\",\"interactFlags\":\"T\",\"source\":\"ANT_FOREST\",\"uniqueId\":\"" +
getUniqueId() + "\",\"version\":\"" + VERSION + "\"}]");
}

public static String queryUserRanking() {
return RpcUtil.request("alipay.antocean.ocean.h5.queryUserRanking",
"[{\"source\":\"ANT_FOREST\",\"uniqueId\":\"" + getUniqueId() + "\"}]");
}
}
Loading

0 comments on commit c17b29d

Please sign in to comment.