@@ -70,7 +70,7 @@ $.appId = 10028;
70
70
await $ . wait ( 1000 )
71
71
res2 = await getAuthorShareCode ( 'https://cdn.jsdelivr.net/gh/zero205/updateTeam@main/shareCodes/cfd.json' )
72
72
}
73
- $ . strMyShareIds = [ ...( res && res . shareId || [ ] ) ]
73
+ $ . strMyShareIds = [ ...( res && res . shareId || [ ] ) , ... ( res2 && res2 . shareId || [ ] ) ]
74
74
for ( let i = 0 ; i < cookiesArr . length ; i ++ ) {
75
75
if ( cookiesArr [ i ] ) {
76
76
cookie = cookiesArr [ i ] ;
@@ -166,10 +166,30 @@ async function cfd() {
166
166
for ( let key of Object . keys ( $ . info . buildInfo . buildList ) ) {
167
167
let vo = $ . info . buildInfo . buildList [ key ]
168
168
let body = `strBuildIndex=${ vo . strBuildIndex } `
169
- await getBuildInfo ( body , vo . strBuildIndex )
169
+ await getBuildInfo ( body , vo )
170
170
await $ . wait ( 1000 )
171
171
}
172
172
173
+ //接待贵宾
174
+ console . log ( `接待贵宾` )
175
+ if ( $ . info . StoryInfo . StoryList ) {
176
+ await $ . wait ( 2000 )
177
+ for ( let key of Object . keys ( $ . info . StoryInfo . StoryList ) ) {
178
+ let vo = $ . info . StoryInfo . StoryList [ key ]
179
+ if ( vo . Special ) {
180
+ console . log ( `请贵宾下船,需等待${ vo . Special . dwWaitTime } 秒` )
181
+ await specialUserOper ( vo . strStoryId , '2' , vo . ddwTriggerDay , vo )
182
+ await $ . wait ( vo . Special . dwWaitTime * 1000 )
183
+ await specialUserOper ( vo . strStoryId , '3' , vo . ddwTriggerDay , vo )
184
+ await $ . wait ( 2000 )
185
+ } else {
186
+ console . log ( `当前暂无贵宾\n` )
187
+ }
188
+ }
189
+ } else {
190
+ console . log ( `当前暂无贵宾\n` )
191
+ }
192
+
173
193
//倒垃圾
174
194
await $ . wait ( 2000 )
175
195
await queryRubbishInfo ( )
@@ -209,6 +229,39 @@ async function cfd() {
209
229
}
210
230
}
211
231
232
+ // 接待贵宾
233
+ function specialUserOper ( strStoryId , dwType , ddwTriggerDay , StoryList ) {
234
+ return new Promise ( ( resolve ) => {
235
+ $ . get ( taskUrl ( `story/SpecialUserOper` , `strStoryId=${ strStoryId } &dwType=${ dwType } &triggerType=0&ddwTriggerDay=${ ddwTriggerDay } ` ) , ( err , resp , data ) => {
236
+ try {
237
+ if ( err ) {
238
+ console . log ( `${ JSON . stringify ( err ) } ` )
239
+ console . log ( `${ $ . name } SpecialUserOper API请求失败,请检查网路重试` )
240
+ } else {
241
+ data = JSON . parse ( data ) ;
242
+ if ( dwType === '2' ) {
243
+ if ( data . iRet === 0 || data . sErrMsg === "success" ) {
244
+ console . log ( `贵宾'${ StoryList . Special . strName } '下船成功` )
245
+ } else {
246
+ console . log ( `贵宾'${ StoryList . Special . strName } '下船失败 ${ data . sErrMsg } \n` )
247
+ }
248
+ } else if ( dwType === '3' ) {
249
+ if ( data . iRet === 0 || data . sErrMsg === "success" ) {
250
+ console . log ( `贵宾'${ StoryList . Special . strName } '用餐成功:获得${ StoryList . Special . ddwCoin } 金币\n` )
251
+ } else {
252
+ console . log ( `贵宾'${ StoryList . Special . strName } '用餐失败:${ data . sErrMsg } \n` )
253
+ }
254
+ }
255
+ }
256
+ } catch ( e ) {
257
+ $ . logErr ( e , resp ) ;
258
+ } finally {
259
+ resolve ( ) ;
260
+ }
261
+ } )
262
+ } )
263
+ }
264
+
212
265
// 卖贝壳
213
266
async function querystorageroom ( ) {
214
267
return new Promise ( async ( resolve ) => {
@@ -385,7 +438,11 @@ function helpdraw(dwUserId) {
385
438
} else {
386
439
data = JSON . parse ( data ) ;
387
440
if ( data . iRet === 0 || data . sErrMsg === "success" ) {
388
- console . log ( `领取助力奖励成功:获得${ data . Data . ddwCoin } 金币` )
441
+ if ( data . Data . StagePrizeInfo ) {
442
+ console . log ( `领取助力奖励成功:获得${ data . Data . ddwCoin } 金币 ${ data . Data . StagePrizeInfo . ddwMoney } 财富 ${ data . Data . StagePrizeInfo . strPrizeName } 红包` )
443
+ } else {
444
+ console . log ( `领取助力奖励成功:获得${ data . Data . ddwCoin } 金币` )
445
+ }
389
446
} else {
390
447
console . log ( `领取助力奖励失败:${ data . sErrMsg } ` )
391
448
}
@@ -410,23 +467,30 @@ async function queryRubbishInfo() {
410
467
} else {
411
468
data = JSON . parse ( data ) ;
412
469
console . log ( `倒垃圾` )
413
- if ( data . Data . StoryInfo . StoryList . length === 0 ) {
414
- console . log ( `暂时没有垃圾\n` )
415
- } else {
416
- console . log ( `获取到垃圾信息,开始倒垃圾` )
417
- await $ . wait ( 2000 )
418
- let rubbishOperRes = await rubbishOper ( '1' )
419
- for ( let key of Object . keys ( rubbishOperRes . Data . ThrowRubbish . Game . RubbishList ) ) {
420
- let vo = rubbishOperRes . Data . ThrowRubbish . Game . RubbishList [ key ]
421
- await $ . wait ( 2000 )
422
- var rubbishOperTwoRes = await rubbishOper ( '2' , `dwRubbishId=${ vo . dwId } ` )
423
- }
424
- if ( rubbishOperTwoRes . iRet === 0 ) {
425
- let AllRubbish = rubbishOperTwoRes . Data . RubbishGame . AllRubbish
426
- console . log ( `倒垃圾成功:获得${ AllRubbish . ddwCoin } 金币 ${ AllRubbish . ddwMoney } 财富\n` )
427
- } else {
428
- console . log ( `倒垃圾失败:${ rubbishOperTwoRes . sErrMsg } \n` )
470
+ if ( data . Data . StoryInfo . StoryList . length !== 0 ) {
471
+ for ( let key of Object . keys ( data . Data . StoryInfo . StoryList ) ) {
472
+ let vo = data . Data . StoryInfo . StoryList [ key ]
473
+ if ( vo . Rubbish && vo . Rubbish . dwIsFirstGame === 1 ) {
474
+ console . log ( `获取到垃圾信息:次数 1/2` )
475
+ await $ . wait ( 2000 )
476
+ let rubbishOperRes = await rubbishOper ( '1' )
477
+ for ( let key of Object . keys ( rubbishOperRes . Data . ThrowRubbish . Game . RubbishList ) ) {
478
+ let vo = rubbishOperRes . Data . ThrowRubbish . Game . RubbishList [ key ]
479
+ await $ . wait ( 2000 )
480
+ var rubbishOperTwoRes = await rubbishOper ( '2' , `dwRubbishId=${ vo . dwId } ` )
481
+ }
482
+ if ( rubbishOperTwoRes . iRet === 0 ) {
483
+ let AllRubbish = rubbishOperTwoRes . Data . RubbishGame . AllRubbish
484
+ console . log ( `倒垃圾成功:获得${ AllRubbish . ddwCoin } 金币 ${ AllRubbish . ddwMoney } 财富\n` )
485
+ } else {
486
+ console . log ( `倒垃圾失败:${ rubbishOperTwoRes . sErrMsg } \n` )
487
+ }
488
+ } else {
489
+ console . log ( `当前暂无垃圾:完成次数 1/2\n` )
490
+ }
429
491
}
492
+ } else {
493
+ console . log ( `当前暂无垃圾\n` )
430
494
}
431
495
}
432
496
} catch ( e ) {
@@ -608,7 +672,7 @@ function employTourGuide(body, buildNmae) {
608
672
}
609
673
610
674
// 升级建筑
611
- async function getBuildInfo ( body , strBuildIndex , type = true ) {
675
+ async function getBuildInfo ( body , buildList , type = true ) {
612
676
let twobody = body
613
677
return new Promise ( async ( resolve ) => {
614
678
$ . get ( taskUrl ( `user/GetBuildInfo` , body ) , async ( err , resp , data ) => {
@@ -620,7 +684,7 @@ async function getBuildInfo(body, strBuildIndex, type = true) {
620
684
data = JSON . parse ( data ) ;
621
685
if ( type ) {
622
686
let buildNmae ;
623
- switch ( strBuildIndex ) {
687
+ switch ( buildList . strBuildIndex ) {
624
688
case 'food' :
625
689
buildNmae = '京喜美食城'
626
690
break
@@ -641,7 +705,7 @@ async function getBuildInfo(body, strBuildIndex, type = true) {
641
705
console . log ( `【${ buildNmae } 】当前建筑还未创建,开始创建` )
642
706
await createbuilding ( `strBuildIndex=${ data . strBuildIndex } ` , buildNmae )
643
707
await $ . wait ( 2000 )
644
- data = await getBuildInfo ( twobody , strBuildIndex , false )
708
+ data = await getBuildInfo ( twobody , buildList , false )
645
709
await $ . wait ( 2000 )
646
710
}
647
711
console . log ( `收金币` )
@@ -651,8 +715,9 @@ async function getBuildInfo(body, strBuildIndex, type = true) {
651
715
await $ . wait ( 2000 )
652
716
await getUserInfo ( false )
653
717
console . log ( `升级建筑` )
718
+ console . log ( `【${ buildNmae } 】当前等级:${ buildList . dwLvl } 升级获得财富:${ data . ddwLvlRich } ` )
654
719
console . log ( `【${ buildNmae } 】升级需要${ data . ddwNextLvlCostCoin } 金币,当前拥有${ $ . info . ddwCoinBalance } ` )
655
- if ( data . dwCanLvlUp === 1 && $ . info . ddwCoinBalance >= data . ddwNextLvlCostCoin ) {
720
+ if ( data . dwCanLvlUp > 0 && $ . info . ddwCoinBalance >= data . ddwNextLvlCostCoin ) {
656
721
console . log ( `【${ buildNmae } 】满足升级条件,开始升级` )
657
722
const body = `ddwCostCoin=${ data . ddwNextLvlCostCoin } &strBuildIndex=${ data . strBuildIndex } `
658
723
let buildLvlUpRes = await buildLvlUp ( body )
@@ -809,18 +874,15 @@ function getUserInfo(showInvite = true) {
809
874
} else {
810
875
data = JSON . parse ( data ) ;
811
876
const {
812
- iret,
813
877
buildInfo = { } ,
814
878
ddwRichBalance,
815
879
ddwCoinBalance,
816
- JxUserWelfare,
817
880
sErrMsg,
818
881
strMyShareId,
819
- strNickName,
820
882
dwLandLvl,
821
- Fund = { }
883
+ Fund = { } ,
884
+ StoryInfo = { }
822
885
} = data ;
823
- const dwIsJxNewUser = JxUserWelfare [ "dwIsJxNewUser" ]
824
886
if ( showInvite ) {
825
887
console . log ( `\n获取用户信息:${ sErrMsg } \n${ $ . showLog ? data : "" } ` ) ;
826
888
console . log ( `\n当前等级:${ dwLandLvl } ,金币:${ ddwCoinBalance } ,财富值:${ ddwRichBalance } \n` )
@@ -835,20 +897,18 @@ function getUserInfo(showInvite = true) {
835
897
buildInfo,
836
898
ddwRichBalance,
837
899
ddwCoinBalance,
838
- dwIsJxNewUser,
839
900
strMyShareId,
840
- strNickName,
841
901
dwLandLvl,
842
- Fund
902
+ Fund,
903
+ StoryInfo
843
904
} ;
844
905
resolve ( {
845
906
buildInfo,
846
907
ddwRichBalance,
847
908
ddwCoinBalance,
848
- dwIsJxNewUser,
849
909
strMyShareId,
850
- strNickName ,
851
- Fund
910
+ Fund ,
911
+ StoryInfo
852
912
} ) ;
853
913
}
854
914
} catch ( e ) {
@@ -997,7 +1057,7 @@ function awardTask(taskType, taskinfo) {
997
1057
if ( msg . indexOf ( '活动太火爆了' ) !== - 1 ) {
998
1058
str = '任务为成就任务或者未到任务时间' ;
999
1059
} else {
1000
- str = msg + prizeInfo ? ` 获得金币 ¥ ${ JSON . parse ( prizeInfo ) . ddwCoin } ` : '' ;
1060
+ str = msg + prizeInfo ? `获得金币 ¥ ${ JSON . parse ( prizeInfo ) . ddwCoin } ` : '' ;
1001
1061
}
1002
1062
console . log ( `【领日常奖励】${ taskName } ${ str } \n${ $ . showLog ? data : '' } ` ) ;
1003
1063
}
0 commit comments