shawenguan 1 سال پیش
والد
کامیت
1ee6f92605
1فایلهای تغییر یافته به همراه90 افزوده شده و 13 حذف شده
  1. 90 13
      Scripts/168/pksPlanHelper.js

+ 90 - 13
Scripts/168/pksPlanHelper.js

@@ -71,6 +71,8 @@ hostname = *.168.*.com
 <li value="10009" data-text="cqxync">重庆幸运农场 <span class="stopSelling"></span></li>
 */
 
+const { time } = require("console");
+
 const scriptName = `168计划`;
 const magicJS = MagicJS(scriptName, "INFO");
 
@@ -515,7 +517,7 @@ async function checkTimeSlotPlanBuy() {
 	// let htmlContent = await getHtmlContent(htmlUrl, gBuyPlanHeaders);
 
 	let nowDate = formatNow();
-	let pksPlanListData = await getPksPlanList(gLotteryCode, nowDate);
+	let pksPlanListData = await getPksPlanList(gLotteryCode, nowDate, 100);
 	if (!pksPlanListData) {
 		return;
 	}
@@ -616,8 +618,8 @@ async function checkLastRecordPlanBuy() {
 	magicJS.data.write('168_PksPlanTailDrawIssue', strDrawIssue);
 }
 
-async function checkLongDragonNotify(pksPlanListData, pksPlanItemData) {
-	// 挑选出来恶龙
+function checkRecentLongFail(pksPlanListData, nIssue = 10) {
+	let seriesCost = Math.pow(2, nIssue - 1);//512
 	let failItemC = null;
 	let failItemB = null;
 	let failItemA = null;
@@ -634,36 +636,61 @@ async function checkLongDragonNotify(pksPlanListData, pksPlanItemData) {
 		let oneCostB = Math.floor(lotteryCostB / 4);
 		let oneCostA = Math.floor(lotteryCostA / 5);
 		//let buySeriesNum = Math.floor(Math.log2(oneCostC)) + 1;
-		let series10Cost = 512;//Math.pow(2,9)
-		if (oneCostC >= series10Cost) {
+		if (oneCostC >= seriesCost) {
 			if (!checkHitPrize(element.preDrawCode, element.planC, 0)) {
 				failItemC = element;
 			}
 		}
-		if (oneCostB >= series10Cost) {
+		if (oneCostB >= seriesCost) {
 			if (!checkHitPrize(element.preDrawCode, element.planB, 0)) {
 				failItemB = element;
 			}
 		}
-		if (oneCostA >= series10Cost) {
+		if (oneCostA >= seriesCost) {
 			if (!checkHitPrize(element.preDrawCode, element.planA, 0)) {
 				failItemA = element;
 			}
 		}
 	}
+	return {
+		failItemA: failItemA,
+		failItemB: failItemB,
+		failItemC: failItemC,
+	};
+}
+
+function checkHitPrizeAfterFailOnce(pksPlanListData, failItem) {
+	let unHitCount = 0;
+	for (let i = failItem.index - 1; i >= 0; i--) {
+		let element = pksPlanListData[i];
+		if (!checkHitPrize(element.preDrawCode, element.planC, 0)) {
+			unHitCount += 1;
+		} else {
+			break;
+		}
+	}
+	return unHitCount == failItem.index;
+}
+
+async function checkLongDragonNotify(pksPlanListData, pksPlanItemData) {
+	// 挑选出来恶龙
+	let failItemData = checkRecentLongFail(pksPlanListData);
+	let failItemC = failItemData.failItemC;
+	let failItemB = failItemData.failItemB;
+	let failItemA = failItemData.failItemA;
 	// 检查是否后面屠杀成功
 	if (failItemC) {
-		await checkEvilDragonCSlayingNotify(failItemC, pksPlanListData);
+		await checkEvilDragonCSlayingNotify(failItemC, pksPlanListData, pksPlanItemData);
 	}
 	if (failItemB) {
-		await checkEvilDragonBSlayingNotify(failItemB, pksPlanListData);
+		await checkEvilDragonBSlayingNotify(failItemB, pksPlanListData, pksPlanItemData);
 	}
 	if (failItemA) {
-		await checkEvilDragonASlayingNotify(failItemA, pksPlanListData);
+		await checkEvilDragonASlayingNotify(failItemA, pksPlanListData, pksPlanItemData);
 	}
 }
 
-async function checkEvilDragonCSlayingNotify(failItem, pksPlanListData) {
+async function checkEvilDragonCSlayingNotify(failItem, pksPlanListData, pksPlanItemData) {
 	let latestItem = pksPlanListData[0];
 	let unHitCount = 0;
 	for (let i = failItem.index - 1; i >= 0; i--) {
@@ -691,7 +718,7 @@ async function checkEvilDragonCSlayingNotify(failItem, pksPlanListData) {
 	}
 }
 
-async function checkEvilDragonBSlayingNotify(failItem, pksPlanListData) {
+async function checkEvilDragonBSlayingNotify(failItem, pksPlanListData, pksPlanItemData) {
 	let latestItem = pksPlanListData[0];
 	let unHitCount = 0;
 	for (let i = failItem.index - 1; i >= 0; i--) {
@@ -719,7 +746,7 @@ async function checkEvilDragonBSlayingNotify(failItem, pksPlanListData) {
 	}
 }
 
-async function checkEvilDragonASlayingNotify(failItem, pksPlanListData) {
+async function checkEvilDragonASlayingNotify(failItem, pksPlanListData, pksPlanItemData) {
 	let latestItem = pksPlanListData[0];
 	let unHitCount = 0;
 	for (let i = failItem.index - 1; i >= 0; i--) {
@@ -890,12 +917,16 @@ async function checkPlanCBuyNotify(pksPlanItemData, pksPlanListData) {
 	}
 
 	if (isPlanLotteryAutoBet()) {
+		turnOneCost = turnOneCost * getLuckyRandCostTimes(turnOneCost);
+
 		let [probability, analyseLogMsg] = await analyseBetProbability('C', pksPlanItemData, pksPlanListData);
 		let proAllowValue = getAllowBetProbability('C');
+
 		turnOneCost = getPlanFixCost(pksPlanListData, turnOneCost, 'planC');
 		if (probability < 50) {
 			turnOneCost = Math.floor(turnOneCost / 2);
 		}
+		turnOneCost = turnOneCost * getChangLongCostTimes('C', pksPlanListData);
 		if (probability >= proAllowValue) {
 			let maxBetAmount = getPlanLotteryMaxBetAmount();
 			let betRet = await tryDragonBetPoor(preDrawIssue, ranking, planC, turnOneCost, maxBetAmount);
@@ -913,6 +944,52 @@ async function checkPlanCBuyNotify(pksPlanItemData, pksPlanListData) {
 	return true;
 }
 
+function getLuckyRandCostTimes(turnOneCost) {
+	let times = 1;
+	let nIssue = Math.log2(turnOneCost) + 1;
+	if (nIssue >= 8) {
+		let rv = Math.random();
+		if (rv > 0.8) {
+			times = 1 / 2;
+		} else if (rv > 0.6) {
+			times = 1.5;
+		} else if (rv < 0.35) {
+			times = 1 / 2;
+		}
+	} else if (nIssue >= 6) {
+		let rv = Math.random();
+		if (rv > 0.5) {
+			times = 2;
+		}
+	}
+	return times;
+}
+
+function getChangLongCostTimes(planType, pksPlanListData) {
+	let times = 1;
+	let failItemData = checkRecentLongFail(pksPlanListData);
+	let failItem = failItemData.failItemC;
+	if (planType == 'C') {
+		failItem = failItemData.failItemC;
+	} else if (planType == 'B') {
+		failItem = failItemData.failItemB;
+	} else {
+		failItem = failItemData.failItemA;
+	}
+	if (failItem) {
+		if (!checkHitPrizeAfterFailOnce(failItem, pksPlanListData)) {
+			let timesDict = {
+				[1]: 2,
+				[3]: 4,
+				[5]: 4,
+				[6]: 2,
+			};
+			times = timesDict[failItem.index] || 1;
+		}
+	}
+	return times;
+}
+
 async function checkPlanBBuyNotify(pksPlanItemData, pksPlanListData) {
 	let initCost = 1;
 	let turnCount = magicJS.data.read('168_PksPlanDrawTurnCountB', 0);