shawenguan 1 年之前
父節點
當前提交
3f0c05ad92
共有 1 個文件被更改,包括 41 次插入8 次删除
  1. 41 8
      Scripts/168/pksPlanHelper.js

+ 41 - 8
Scripts/168/pksPlanHelper.js

@@ -482,7 +482,7 @@ async function checkEvilDragonCSlayingNotify(failItem, pksPlanListData) {
 			let turnOneCost = Math.pow(2, turnCount - 1);
 			let maxBetAmount = getPlanLotteryMaxBetAmount();
 			if (turnCount <= maxTurnCount) {
-				let betRet = await tryDragonBet(latestItem.preDrawIssue, 1, failItem.planC, turnOneCost, maxBetAmount);
+				let betRet = await tryDragonBetPoor(latestItem.preDrawIssue, 1, failItem.planC, turnOneCost, maxBetAmount);
 			}
 		}
 		magicJS.notification.appendNotifyInfo(tipsMsg);
@@ -510,7 +510,7 @@ async function checkEvilDragonBSlayingNotify(failItem, pksPlanListData) {
 			let turnOneCost = Math.pow(2, turnCount - 1);
 			let maxBetAmount = getPlanLotteryMaxBetAmount();
 			if (turnCount <= maxTurnCount) {
-				let betRet = await tryDragonBet(latestItem.preDrawIssue, 1, failItem.planB, turnOneCost, maxBetAmount);
+				let betRet = await tryDragonBetPoor(latestItem.preDrawIssue, 1, failItem.planB, turnOneCost, maxBetAmount);
 			}
 		}
 		magicJS.notification.appendNotifyInfo(tipsMsg);
@@ -538,7 +538,7 @@ async function checkEvilDragonASlayingNotify(failItem, pksPlanListData) {
 			let turnOneCost = Math.pow(2, turnCount - 1);
 			let maxBetAmount = getPlanLotteryMaxBetAmount();
 			if (turnCount <= maxTurnCount) {
-				let betRet = await tryDragonBet(latestItem.preDrawIssue, 1, failItem.planA, turnOneCost, maxBetAmount);
+				let betRet = await tryDragonBetPoor(latestItem.preDrawIssue, 1, failItem.planA, turnOneCost, maxBetAmount);
 			}
 		}
 		magicJS.notification.appendNotifyInfo(tipsMsg);
@@ -691,7 +691,7 @@ async function checkPlanCBuyNotify(pksPlanItemData, pksPlanListData) {
 		let proAllowValue = getAllowBetProbability('C');
 		if (probability >= proAllowValue) {
 			let maxBetAmount = getPlanLotteryMaxBetAmount();
-			let betRet = await tryDragonBet(preDrawIssue, 1, planC, turnOneCost, maxBetAmount);
+			let betRet = await tryDragonBetPoor(preDrawIssue, 1, planC, turnOneCost, maxBetAmount);
 			tipsMsg += `\n预估中奖率:${probability.toFixed(2)}`;
 			tipsMsg += analyseLogMsg;
 		} else {
@@ -751,7 +751,7 @@ async function checkPlanBBuyNotify(pksPlanItemData, pksPlanListData) {
 		let proAllowValue = getAllowBetProbability('B');
 		if (probability >= proAllowValue) {
 			let maxBetAmount = getPlanLotteryMaxBetAmount();
-			let betRet = await tryDragonBet(preDrawIssue, 1, planB, turnOneCost, maxBetAmount);
+			let betRet = await tryDragonBetPoor(preDrawIssue, 1, planB, turnOneCost, maxBetAmount);
 			tipsMsg += analyseLogMsg;
 			tipsMsg += `\n预估中奖率:${probability.toFixed(2)}`;
 		} else {
@@ -811,7 +811,7 @@ async function checkPlanABuyNotify(pksPlanItemData, pksPlanListData) {
 		let proAllowValue = getAllowBetProbability('A');
 		if (probability >= proAllowValue) {
 			let maxBetAmount = getPlanLotteryMaxBetAmount();
-			let betRet = await tryDragonBet(preDrawIssue, 1, planA, turnOneCost, maxBetAmount);
+			let betRet = await tryDragonBetPoor(preDrawIssue, 1, planA, turnOneCost, maxBetAmount);
 			tipsMsg += analyseLogMsg;
 			tipsMsg += `\n预估中奖率:${probability.toFixed(2)}`;
 		} else {
@@ -1013,7 +1013,7 @@ async function checkExpertsRecommend() {
 	magicJS.logger.info(tipsMsg);
 
 	if (isPlanLotteryAutoBet()) {
-		let betRet = await tryDragonBet(preDrawIssue, ranking, recommendCode, turnOneCost, maxBetAmount);
+		let betRet = await tryDragonBetCommon(preDrawIssue, ranking, recommendCode, turnOneCost, maxBetAmount);
 	}
 	magicJS.notification.appendNotifyInfo(tipsMsg);
 }
@@ -1270,7 +1270,7 @@ function updateRequestHeaders() {
 }
 
 
-async function tryDragonBet(drawIssue, ranking, planStr, betAmount, maxBetAmount = 96) {
+async function tryDragonBetPoor(drawIssue, ranking, planStr, betAmount, maxBetAmount = 96) {
 	let numArr = planStr.split(',');
 	let numCount = numArr.length;
 	if (numCount >= 5) {
@@ -1303,6 +1303,39 @@ async function tryDragonBet(drawIssue, ranking, planStr, betAmount, maxBetAmount
 	return result;
 }
 
+async function tryDragonBetCommon(drawIssue, ranking, planStr, betAmount, maxBetAmount = 96) {
+	let numArr = planStr.split(',');
+	let numCount = numArr.length;
+	if (numCount >= 5) {
+		betAmount = Math.floor(betAmount);
+	} else if (numCount >= 4) {
+		betAmount = Math.floor(betAmount);
+	} else {
+		betAmount = Math.floor(betAmount);
+	}
+	if (betAmount < 1) {
+		betAmount = 1;
+	} else if (betAmount > maxBetAmount) {
+		betAmount = maxBetAmount;
+	}
+	let result = await doDragonBet(drawIssue, ranking, planStr, betAmount);
+	if (!result) {
+		let loginRet = await tryReLogin();
+		if (!loginRet) {
+			return;
+		}
+		result = await doDragonBet(drawIssue, ranking, planStr, betAmount);
+	}
+	if (result && result.statusCode == 200) {
+		if (checkBetResult(result)) {
+			magicJS.notification.post(magicJS.scriptName, `🎉下注成功 号码:${planStr} 单注:${betAmount}`);
+		} else {
+			magicJS.notification.post(magicJS.scriptName, `⚠️下注失败 号码:${planStr} 单注:${betAmount}`);
+		}
+	}
+	return result;
+}
+
 function checkBetResult(data) {
 	let result = data.result;
 	let account = result.account;