MCPcopy Create free account
hub / github.com/Semporia/Scripts / doFriendsWater

Function doFriendsWater

jd_fruit.js:820–875  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

818}
819//给好友浇水
820async function doFriendsWater() {
821 await friendListInitForFarm();
822 console.log('开始给好友浇水...');
823 await taskInitForFarm();
824 const { waterFriendCountKey, waterFriendMax } = $.farmTask.waterFriendTaskInit;
825 console.log(`今日已给${waterFriendCountKey}个好友浇水`);
826 if (waterFriendCountKey < waterFriendMax) {
827 let needWaterFriends = [];
828 if ($.friendList.friends && $.friendList.friends.length > 0) {
829 $.friendList.friends.map((item, index) => {
830 if (item.friendState === 1) {
831 if (needWaterFriends.length < (waterFriendMax - waterFriendCountKey)) {
832 needWaterFriends.push(item.shareCode);
833 }
834 }
835 });
836 console.log(`需要浇水的好友列表shareCodes:${JSON.stringify(needWaterFriends)}`);
837 let waterFriendsCount = 0, cardInfoStr = '';
838 for (let index = 0; index < needWaterFriends.length; index ++) {
839 await waterFriendForFarm(needWaterFriends[index]);
840 console.log(`为第${index+1}个好友浇水结果:${JSON.stringify($.waterFriendForFarmRes)}\n`)
841 if ($.waterFriendForFarmRes.code === '0') {
842 waterFriendsCount ++;
843 if ($.waterFriendForFarmRes.cardInfo) {
844 console.log('为好友浇水获得道具了');
845 if ($.waterFriendForFarmRes.cardInfo.type === 'beanCard') {
846 console.log(`获取道具卡:${$.waterFriendForFarmRes.cardInfo.rule}`);
847 cardInfoStr += `水滴换豆卡,`;
848 } else if ($.waterFriendForFarmRes.cardInfo.type === 'fastCard') {
849 console.log(`获取道具卡:${$.waterFriendForFarmRes.cardInfo.rule}`);
850 cardInfoStr += `快速浇水卡,`;
851 } else if ($.waterFriendForFarmRes.cardInfo.type === 'doubleCard') {
852 console.log(`获取道具卡:${$.waterFriendForFarmRes.cardInfo.rule}`);
853 cardInfoStr += `水滴翻倍卡,`;
854 } else if ($.waterFriendForFarmRes.cardInfo.type === 'signCard') {
855 console.log(`获取道具卡:${$.waterFriendForFarmRes.cardInfo.rule}`);
856 cardInfoStr += `加签卡,`;
857 }
858 }
859 } else if ($.waterFriendForFarmRes.code === '11') {
860 console.log('水滴不够,跳出浇水')
861 }
862 }
863 // message += `【好友浇水】已给${waterFriendsCount}个好友浇水,消耗${waterFriendsCount * 10}g水\n`;
864 console.log(`【好友浇水】已给${waterFriendsCount}个好友浇水,消耗${waterFriendsCount * 10}g水\n`);
865 if (cardInfoStr && cardInfoStr.length > 0) {
866 // message += `【好友浇水奖励】${cardInfoStr.substr(0, cardInfoStr.length - 1)}\n`;
867 console.log(`【好友浇水奖励】${cardInfoStr.substr(0, cardInfoStr.length - 1)}\n`);
868 }
869 } else {
870 console.log('您的好友列表暂无好友,快去邀请您的好友吧!')
871 }
872 } else {
873 console.log(`今日已为好友浇水量已达${waterFriendMax}个`)
874 }
875}
876//领取给3个好友浇水后的奖励水滴
877async function getWaterFriendGotAward() {

Callers 1

doDailyTaskFunction · 0.85

Calls 4

friendListInitForFarmFunction · 0.85
taskInitForFarmFunction · 0.85
waterFriendForFarmFunction · 0.85
logMethod · 0.45

Tested by

no test coverage detected