宠汪汪赛跑添加领取能力补给站功能,(2人赛跑可加5KM,50人赛跑可加25KM)
This commit is contained in:
72
jd_joy.js
72
jd_joy.js
@ -1,9 +1,8 @@
|
||||
/*
|
||||
TODO 能力补给站(2人赛跑可加5KM,50人赛跑可加25KM),抽空添加
|
||||
jd宠汪汪 搬的https://github.com/uniqueque/QuantumultX/blob/4c1572d93d4d4f883f483f907120a75d925a693e/Script/jd_joy.js
|
||||
脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
|
||||
IOS用户支持京东双账号,NodeJs用户支持N个京东账号
|
||||
更新时间:2020-12-14
|
||||
更新时间:2020-12-24
|
||||
建议先凌晨0点运行jd_joy.js脚本获取狗粮后,再运行此脚本(jd_joy_steal.js)可偷好友积分,6点运行可偷好友狗粮
|
||||
feedCount:自定义 每次喂养数量; 等级只和喂养次数有关,与数量无关
|
||||
推荐每次投喂10个,积累狗粮,然后去玩聚宝盆赌
|
||||
@ -136,8 +135,8 @@ async function joinTwoPeopleRun() {
|
||||
let teamLevelTemp = [];
|
||||
teamLevelTemp = $.isNode() ? (process.env.JOY_TEAM_LEVEL ? process.env.JOY_TEAM_LEVEL.split('&') : teamLevel.split('&')) : ($.getdata('JOY_TEAM_LEVEL') ? $.getdata('JOY_TEAM_LEVEL').split('&') : teamLevel.split('&'));
|
||||
teamLevelTemp = teamLevelTemp[$.index - 1] ? teamLevelTemp[$.index - 1] : 2;
|
||||
console.log(`\n===========以下是${teamLevelTemp}人赛跑信息========\n`)
|
||||
await getPetRace();
|
||||
console.log(`\n===以下是京东账号${$.index} ${$.nickName} ${$.petRaceResult.data.teamLimitCount || teamLevelTemp}人赛跑信息===\n`)
|
||||
if ($.petRaceResult) {
|
||||
let petRaceResult = $.petRaceResult.data.petRaceResult;
|
||||
// let raceUsers = $.petRaceResult.data.raceUsers;
|
||||
@ -146,13 +145,13 @@ async function joinTwoPeopleRun() {
|
||||
console.log(`暂未参赛,现在为您参加${teamLevelTemp}人赛跑`);
|
||||
await runMatch(teamLevelTemp * 1);
|
||||
if ($.runMatchResult.success) {
|
||||
console.log(`${teamLevelTemp}人赛跑参加成功\n`);
|
||||
message += `${teamLevelTemp}人赛跑:成功参加\n`;
|
||||
await getPetRace();
|
||||
petRaceResult = $.petRaceResult.data.petRaceResult;
|
||||
await getRankList();
|
||||
// raceUsers = $.petRaceResult.data.raceUsers;
|
||||
// console.log(`参赛后的状态:${petRaceResult}`)
|
||||
await getWinCoin();
|
||||
console.log(`${$.getWinCoinRes.data.teamLimitCount || teamLevelTemp}人赛跑参加成功\n`);
|
||||
message += `${$.getWinCoinRes.data.teamLimitCount || teamLevelTemp}人赛跑:成功参加\n`;
|
||||
// if ($.getWinCoinRes.data['supplyOrder']) await energySupplyStation($.getWinCoinRes.data['supplyOrder']);
|
||||
await energySupplyStation('2');
|
||||
// petRaceResult = $.petRaceResult.data.petRaceResult;
|
||||
// await getRankList();
|
||||
console.log(`双人赛跑助力请自己手动去邀请好友,脚本不带赛跑助力功能\n`);
|
||||
}
|
||||
}
|
||||
@ -165,18 +164,21 @@ async function joinTwoPeopleRun() {
|
||||
if (petRaceResult === 'unreceive') {
|
||||
console.log('今日参赛的比赛已经结束,现在领取奖励');
|
||||
await getWinCoin();
|
||||
let winCoin = 0;
|
||||
let winCoin = 0, teamLimitCount = 2;
|
||||
if ($.getWinCoinRes && $.getWinCoinRes.success) {
|
||||
winCoin = $.getWinCoinRes.data.winCoin;
|
||||
teamLimitCount = $.getWinCoinRes.data.teamLimitCount;
|
||||
}
|
||||
await receiveJoyRunAward();
|
||||
console.log(`领取赛跑奖励结果:${JSON.stringify($.receiveJoyRunAwardRes)}`)
|
||||
if ($.receiveJoyRunAwardRes.success) {
|
||||
$.msg($.name, '', `【京东账号${$.index}】${$.nickName}\n太棒了,${teamLevelTemp}人赛跑取得获胜\n恭喜您已获得${winCoin}积分奖励`);
|
||||
if ($.isNode()) await notify.sendNotify(`${$.name} - 京东账号${$.index} - ${$.nickName}`, `京东账号${$.index}${$.nickName}\n${teamLevelTemp}人赛跑取得获胜\n恭喜您已获得${winCoin}积分奖励`)
|
||||
$.msg($.name, '', `【京东账号${$.index}】${$.nickName}\n太棒了,${teamLimitCount}人赛跑取得获胜\n恭喜您已获得${winCoin}积分奖励`);
|
||||
if ($.isNode()) await notify.sendNotify(`${$.name} - 京东账号${$.index} - ${$.nickName}`, `京东账号${$.index}${$.nickName}\n${teamLimitCount}人赛跑取得获胜\n恭喜您已获得${winCoin}积分奖励`)
|
||||
}
|
||||
}
|
||||
if (petRaceResult === 'participate') {
|
||||
// if ($.getWinCoinRes.data['supplyOrder']) await energySupplyStation($.getWinCoinRes.data['supplyOrder']);
|
||||
await energySupplyStation('2');
|
||||
await getRankList();
|
||||
if($.raceUsers && $.raceUsers.length > 0) {
|
||||
for (let index = 0; index < $.raceUsers.length; index++) {
|
||||
@ -735,6 +737,50 @@ function receiveJoyRunAward() {
|
||||
})
|
||||
})
|
||||
}
|
||||
//能力补给站
|
||||
async function energySupplyStation(showOrder) {
|
||||
let status;
|
||||
await getSupplyInfo(showOrder);
|
||||
if ($.getSupplyInfoRes && $.getSupplyInfoRes.success) {
|
||||
if ($.getSupplyInfoRes.data) {
|
||||
const { marketList } = $.getSupplyInfoRes.data;
|
||||
for (let list of marketList) {
|
||||
if (!list['status']) {
|
||||
await scanMarket('combat/supply', { showOrder, 'supplyType': 'scan_market', 'taskInfo': list.marketLink || list['marketLinkH5'], 'reqSource': 'weapp' });
|
||||
await getSupplyInfo(showOrder);
|
||||
} else {
|
||||
$.log(`能力补给站 ${$.getSupplyInfoRes.data.addDistance}km里程 已领取\n`);
|
||||
status = list['status'];
|
||||
}
|
||||
}
|
||||
if (!status) {
|
||||
await energySupplyStation(showOrder);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function getSupplyInfo(showOrder) {
|
||||
return new Promise(resolve => {
|
||||
const url = `${weAppUrl}/combat/getSupplyInfo?showOrder=${showOrder}`;
|
||||
$.get(taskUrl(url, 'draw.jdfcloud.com', `weapp`), (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
console.log('\n京东宠汪汪: API查询请求失败 ‼️‼️')
|
||||
} else {
|
||||
// console.log('查询应援团信息API',(data))
|
||||
// $.appGetPetTaskConfigRes = JSON.parse(data);
|
||||
if (data) {
|
||||
$.getSupplyInfoRes = JSON.parse(data);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp);
|
||||
} finally {
|
||||
resolve();
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
function showMsg() {
|
||||
jdNotify = $.getdata('jdJoyNotify') ? $.getdata('jdJoyNotify') : jdNotify;
|
||||
if (!jdNotify || jdNotify === 'false') {
|
||||
|
Reference in New Issue
Block a user