Skip to content

Commit 43c5212

Browse files
committed
Update jd_cfd.js
1 parent 681bf29 commit 43c5212

File tree

1 file changed

+95
-35
lines changed

1 file changed

+95
-35
lines changed

jd_cfd.js

Lines changed: 95 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ $.appId = 10028;
7070
await $.wait(1000)
7171
res2 = await getAuthorShareCode('https://cdn.jsdelivr.net/gh/zero205/updateTeam@main/shareCodes/cfd.json')
7272
}
73-
$.strMyShareIds = [...(res && res.shareId || [])]
73+
$.strMyShareIds = [...(res && res.shareId || []), ...(res2 && res2.shareId || [])]
7474
for (let i = 0; i < cookiesArr.length; i++) {
7575
if (cookiesArr[i]) {
7676
cookie = cookiesArr[i];
@@ -166,10 +166,30 @@ async function cfd() {
166166
for(let key of Object.keys($.info.buildInfo.buildList)) {
167167
let vo = $.info.buildInfo.buildList[key]
168168
let body = `strBuildIndex=${vo.strBuildIndex}`
169-
await getBuildInfo(body, vo.strBuildIndex)
169+
await getBuildInfo(body, vo)
170170
await $.wait(1000)
171171
}
172172

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+
173193
//倒垃圾
174194
await $.wait(2000)
175195
await queryRubbishInfo()
@@ -209,6 +229,39 @@ async function cfd() {
209229
}
210230
}
211231

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+
212265
// 卖贝壳
213266
async function querystorageroom() {
214267
return new Promise(async (resolve) => {
@@ -385,7 +438,11 @@ function helpdraw(dwUserId) {
385438
} else {
386439
data = JSON.parse(data);
387440
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+
}
389446
} else {
390447
console.log(`领取助力奖励失败:${data.sErrMsg}`)
391448
}
@@ -410,23 +467,30 @@ async function queryRubbishInfo() {
410467
} else {
411468
data = JSON.parse(data);
412469
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+
}
429491
}
492+
} else {
493+
console.log(`当前暂无垃圾\n`)
430494
}
431495
}
432496
} catch (e) {
@@ -608,7 +672,7 @@ function employTourGuide(body, buildNmae) {
608672
}
609673

610674
// 升级建筑
611-
async function getBuildInfo(body, strBuildIndex, type = true) {
675+
async function getBuildInfo(body, buildList, type = true) {
612676
let twobody = body
613677
return new Promise(async (resolve) => {
614678
$.get(taskUrl(`user/GetBuildInfo`, body), async (err, resp, data) => {
@@ -620,7 +684,7 @@ async function getBuildInfo(body, strBuildIndex, type = true) {
620684
data = JSON.parse(data);
621685
if (type) {
622686
let buildNmae;
623-
switch(strBuildIndex) {
687+
switch(buildList.strBuildIndex) {
624688
case 'food':
625689
buildNmae = '京喜美食城'
626690
break
@@ -641,7 +705,7 @@ async function getBuildInfo(body, strBuildIndex, type = true) {
641705
console.log(`【${buildNmae}】当前建筑还未创建,开始创建`)
642706
await createbuilding(`strBuildIndex=${data.strBuildIndex}`, buildNmae)
643707
await $.wait(2000)
644-
data = await getBuildInfo(twobody, strBuildIndex, false)
708+
data = await getBuildInfo(twobody, buildList, false)
645709
await $.wait(2000)
646710
}
647711
console.log(`收金币`)
@@ -651,8 +715,9 @@ async function getBuildInfo(body, strBuildIndex, type = true) {
651715
await $.wait(2000)
652716
await getUserInfo(false)
653717
console.log(`升级建筑`)
718+
console.log(`【${buildNmae}】当前等级:${buildList.dwLvl} 升级获得财富:${data.ddwLvlRich}`)
654719
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) {
656721
console.log(`【${buildNmae}】满足升级条件,开始升级`)
657722
const body = `ddwCostCoin=${data.ddwNextLvlCostCoin}&strBuildIndex=${data.strBuildIndex}`
658723
let buildLvlUpRes = await buildLvlUp(body)
@@ -809,18 +874,15 @@ function getUserInfo(showInvite = true) {
809874
} else {
810875
data = JSON.parse(data);
811876
const {
812-
iret,
813877
buildInfo = {},
814878
ddwRichBalance,
815879
ddwCoinBalance,
816-
JxUserWelfare,
817880
sErrMsg,
818881
strMyShareId,
819-
strNickName,
820882
dwLandLvl,
821-
Fund = {}
883+
Fund = {},
884+
StoryInfo = {}
822885
} = data;
823-
const dwIsJxNewUser = JxUserWelfare["dwIsJxNewUser"]
824886
if (showInvite) {
825887
console.log(`\n获取用户信息:${sErrMsg}\n${$.showLog ? data : ""}`);
826888
console.log(`\n当前等级:${dwLandLvl},金币:${ddwCoinBalance},财富值:${ddwRichBalance}\n`)
@@ -835,20 +897,18 @@ function getUserInfo(showInvite = true) {
835897
buildInfo,
836898
ddwRichBalance,
837899
ddwCoinBalance,
838-
dwIsJxNewUser,
839900
strMyShareId,
840-
strNickName,
841901
dwLandLvl,
842-
Fund
902+
Fund,
903+
StoryInfo
843904
};
844905
resolve({
845906
buildInfo,
846907
ddwRichBalance,
847908
ddwCoinBalance,
848-
dwIsJxNewUser,
849909
strMyShareId,
850-
strNickName,
851-
Fund
910+
Fund,
911+
StoryInfo
852912
});
853913
}
854914
} catch (e) {
@@ -997,7 +1057,7 @@ function awardTask(taskType, taskinfo) {
9971057
if (msg.indexOf('活动太火爆了') !== -1) {
9981058
str = '任务为成就任务或者未到任务时间';
9991059
} else {
1000-
str = msg + prizeInfo ? ` 获得金币 ¥ ${JSON.parse(prizeInfo).ddwCoin}` : '';
1060+
str = msg + prizeInfo ? `获得金币 ¥ ${JSON.parse(prizeInfo).ddwCoin}` : '';
10011061
}
10021062
console.log(`【领日常奖励】${taskName} ${str}\n${$.showLog ? data : ''}`);
10031063
}

0 commit comments

Comments
 (0)