@@ -46,6 +46,8 @@ public ModelGroup getGroup() {
4646 private BooleanModelField cleanOcean ;
4747 private ChoiceModelField cleanOceanType ;
4848 private SelectModelField cleanOceanList ;
49+ private BooleanModelField exchangeProp ;
50+ private BooleanModelField usePropByType ;
4951 private BooleanModelField protectOcean ;
5052 private SelectAndCountModelField protectOceanList ;
5153
@@ -57,6 +59,8 @@ public ModelFields getFields() {
5759 modelFields .addField (cleanOcean = new BooleanModelField ("cleanOcean" , "清理 | 开启" , false ));
5860 modelFields .addField (cleanOceanType = new ChoiceModelField ("cleanOceanType" , "清理 | 动作" , CleanOceanType .DONT_CLEAN , CleanOceanType .nickNames ));
5961 modelFields .addField (cleanOceanList = new SelectModelField ("cleanOceanList" , "清理 | 好友列表" , new LinkedHashSet <>(), AlipayUser ::getList ));
62+ modelFields .addField (exchangeProp = new BooleanModelField ("exchangeProp" , "神奇海洋 | 制作万能拼图" , false ));
63+ modelFields .addField (usePropByType = new BooleanModelField ("usePropByType" , "神奇海洋 | 使用万能拼图" , false ));
6064 modelFields .addField (protectOcean = new BooleanModelField ("protectOcean" , "保护 | 开启" , false ));
6165 modelFields .addField (protectOceanList = new SelectAndCountModelField ("protectOceanList" , "保护 | 海洋列表" , new LinkedHashMap <>(), AlipayBeach ::getList ));
6266 return modelFields ;
@@ -125,6 +129,14 @@ private void queryHomePage() {
125129 if (receiveOceanTaskAward .getValue ()) {
126130 receiveTaskAward ();
127131 }
132+ // 制作万能碎片
133+ if (exchangeProp .getValue ()) {
134+ exchangeProp ();
135+ }
136+ // 使用万能拼图
137+ if (usePropByType .getValue ()) {
138+ usePropByType ();
139+ }
128140
129141 } else {
130142 Log .i (TAG , joHomePage .getString ("resultDesc" ));
@@ -178,6 +190,7 @@ private static void cleanOcean(String userId, int rubbishNumber) {
178190 if ("SUCCESS" .equals (jo .getString ("resultCode" ))) {
179191 JSONArray cleanRewardVOS = jo .getJSONArray ("cleanRewardVOS" );
180192 checkReward (cleanRewardVOS );
193+ Log .forest ("神奇海洋🐳[清理:" + UserIdMap .getMaskName (userId ) + "海域]" );
181194 } else {
182195 Log .i (TAG , jo .getString ("resultDesc" ));
183196 }
@@ -225,10 +238,10 @@ private static void checkReward(JSONArray rewards) {
225238 try {
226239 for (int i = 0 ; i < rewards .length (); i ++) {
227240 JSONObject reward = rewards .getJSONObject (i );
241+ String name = reward .getString ("name" );
228242 JSONArray attachReward = reward .getJSONArray ("attachRewardBOList" );
229-
230243 if (attachReward .length () > 0 ) {
231- Log .forest ("神奇海洋🐳[获取碎片奖励 ]" );
244+ Log .forest ("神奇海洋🐳[获得:" + name + "碎片 ]" );
232245 boolean canCombine = true ;
233246 for (int j = 0 ; j < attachReward .length (); j ++) {
234247 JSONObject detail = attachReward .getJSONObject (j );
@@ -438,6 +451,8 @@ private void cleanFriendOcean(JSONObject fillFlag) {
438451 if ("SUCCESS" .equals (jo .getString ("resultCode" ))) {
439452 s = AntOceanRpcCall .cleanFriendOcean (userId );
440453 jo = new JSONObject (s );
454+ Log .forest ("神奇海洋🐳[帮助:" + UserIdMap .getMaskName
455+ (userId ) + "清理海域]" );
441456 if ("SUCCESS" .equals (jo .getString ("resultCode" ))) {
442457 JSONArray cleanRewardVOS = jo .getJSONArray ("cleanRewardVOS" );
443458 checkReward (cleanRewardVOS );
@@ -764,6 +779,123 @@ private static int queryCultivationDetail(String cultivationCode, String project
764779 return appliedTimes ;
765780 }
766781
782+ // 制作万能碎片
783+ private static void exchangeProp () {
784+ try {
785+ boolean shouldContinue = true ;
786+ while (shouldContinue ) {
787+ // 获取道具兑换列表的JSON数据
788+ String propListJson = AntOceanRpcCall .exchangePropList ();
789+ JSONObject propListObj = new JSONObject (propListJson );
790+ // 检查是否成功获取道具列表
791+ if ("SUCCESS" .equals (propListObj .getString ("resultCode" ))) {
792+ // 获取道具重复数量
793+ int duplicatePieceNum = propListObj .getInt ("duplicatePieceNum" );
794+ // 如果道具重复数量小于10,直接返回并停止循环
795+ if (duplicatePieceNum < 10 ) {
796+ shouldContinue = false ;
797+ return ;
798+ }
799+ // 如果道具重复数量大于等于10,则执行道具兑换操作
800+ String exchangeResultJson = AntOceanRpcCall .exchangeProp ();
801+ JSONObject exchangeResultObj = new JSONObject (exchangeResultJson );
802+
803+ // 获取兑换后的碎片数量和兑换数量
804+ String exchangedPieceNum = exchangeResultObj .getString ("duplicatePieceNum" );
805+ String exchangeNum = exchangeResultObj .getString ("exchangeNum" );
806+
807+ // 检查道具兑换操作是否成功
808+ if ("SUCCESS" .equals (exchangeResultObj .getString ("resultCode" ))) {
809+ // 输出日志信息
810+ Log .forest ("神奇海洋🏖️[制作:" + exchangeNum + "张万能拼图]剩余" + exchangedPieceNum + "张碎片" );
811+ // 制作完成后休眠1秒钟
812+ TimeUtil .sleep (1000 );
813+ }
814+ } else {
815+ // 如果未成功获取道具列表,停止循环
816+ shouldContinue = false ;
817+ }
818+ }
819+ } catch (Throwable t ) {
820+ // 捕获并记录异常
821+ Log .i (TAG , "exchangeProp error:" );
822+ Log .printStackTrace (TAG , t );
823+ }
824+ }
825+
826+ // 使用万能拼图
827+ private static void usePropByType () {
828+ try {
829+ // 获取道具使用类型列表的JSON数据
830+ String propListJson = AntOceanRpcCall .usePropByTypeList ();
831+ JSONObject propListObj = new JSONObject (propListJson ); // 使用 JSONObject 解析返回的 JSON 数据
832+ if ("SUCCESS" .equals (propListObj .getString ("resultCode" ))) {
833+ // 获取道具类型列表中的holdsNum值
834+ JSONArray oceanPropVOByTypeList = propListObj .getJSONArray ("oceanPropVOByTypeList" ); // 获取数组中的数据
835+ // 遍历每个道具类型信息
836+ for (int i = 0 ; i < oceanPropVOByTypeList .length (); i ++) {
837+ JSONObject propInfo = oceanPropVOByTypeList .getJSONObject (i );
838+ int holdsNum = propInfo .getInt ("holdsNum" );
839+ // 只要holdsNum大于0,就继续执行循环操作
840+ while (holdsNum > 0 ) {
841+ // 查询鱼列表的JSON数据
842+ String fishListJson = AntOceanRpcCall .queryFishList ();
843+ JSONObject fishListObj = new JSONObject (fishListJson );
844+ // 检查是否成功获取到鱼列表并且 hasMore 为 true
845+ if ("SUCCESS" .equals (fishListObj .getString ("resultCode" )) && fishListObj .optBoolean ("hasMore" )) {
846+ // 获取鱼列表中的fishVOS数组
847+ JSONArray fishVOS = fishListObj .optJSONArray ("fishVOS" );
848+ // 遍历fishVOS数组,寻找pieces中num值为0的鱼的order和id
849+ for (int j = 0 ; j < fishVOS .length (); j ++) {
850+ JSONObject fish = fishVOS .getJSONObject (j );
851+ JSONArray pieces = fish .getJSONArray ("pieces" );
852+ // 遍历pieces数组,寻找num值为0的拼图片段
853+ boolean foundNumZero = false ; // 添加一个标志,用来记录是否找到了符合条件的拼图片段
854+ for (int k = 0 ; k < pieces .length (); k ++) {
855+ JSONObject piece = pieces .getJSONObject (k );
856+ int num = piece .getInt ("num" );
857+ // 找到num值为0的拼图片段
858+ if (num == 0 ) {
859+ int order = fish .getInt ("order" );
860+ String id = piece .getString ("id" );
861+ String name = fish .getString ("name" );
862+ // 调用usePropByType方法执行道具使用
863+ String usePropResult = AntOceanRpcCall .usePropByType (order , Integer .parseInt (id )); // 传递order和id作为参数
864+ JSONObject usePropResultObj = new JSONObject (usePropResult );
865+ // 检查道具使用操作是否成功
866+ if ("SUCCESS" .equals (usePropResultObj .getString ("resultCode" ))) {
867+ Log .forest ("神奇海洋🏖️[使用:万能拼图]" + name );
868+ TimeUtil .sleep (1000 );
869+ holdsNum --; // 每使用一次道具,将holdsNum减1
870+ foundNumZero = true ; // 设置标志为true,表示已经找到了符合条件的拼图片段
871+ // 继续下一个鱼的查找
872+ break ;
873+ }
874+ }
875+ }
876+ if (foundNumZero ) {
877+ // 如果找到了符合条件的拼图片段,就停止遍历fishVOS数组
878+ break ;
879+ }
880+ }
881+ } else {
882+ // 如果没有成功获取到鱼列表或者 hasMore 为 false,则停止后续操作
883+ break ;
884+ }
885+ }
886+ if (holdsNum == 0 ) {
887+ return ; // 结束当前方法的执行
888+ }
889+ }
890+ }
891+ } catch (Throwable t ) {
892+ Log .i (TAG , "usePropByType error:" );
893+ Log .printStackTrace (TAG , t );
894+ }
895+ }
896+
897+
898+
767899 public interface CleanOceanType {
768900
769901 int CLEAN = 0 ;
0 commit comments