[add] Slot1201

This commit is contained in:
建喵 2022-05-29 22:05:59 +08:00
parent d093c5d533
commit 551f2ed0d8
4 changed files with 116 additions and 101 deletions

View File

@ -8,6 +8,7 @@ import locale from "element-plus/lib/locale/lang/zh-tw";
import { createApp } from "vue"; import { createApp } from "vue";
import App from "./App.vue"; import App from "./App.vue";
import "./script/Engine/CatanEngine/CSharp/String"; import "./script/Engine/CatanEngine/CSharp/String";
import "./script/Engine/Utils/CCExtensions/NumberExtension";
createApp(App).use(ElementPlus, { locale }).mount("#app"); createApp(App).use(ElementPlus, { locale }).mount("#app");

View File

@ -2,12 +2,15 @@ import CSMessage from "../../../Base/CSMessage";
import { BJ_Casino_Bot } from "../../../BJ_Casino_Bot"; import { BJ_Casino_Bot } from "../../../BJ_Casino_Bot";
import { BJ_Casino_Bot_Slot } from "../../../BJ_Casino_Bot_Slot"; import { BJ_Casino_Bot_Slot } from "../../../BJ_Casino_Bot_Slot";
import { INetResponse } from "../../../Engine/CatanEngine/NetManagerV2/Core/INetResponse"; import { INetResponse } from "../../../Engine/CatanEngine/NetManagerV2/Core/INetResponse";
import { NumberEx } from "../../../Engine/Utils/Number/NumberEx";
import { CommonSlotFgSpinRequest, CommonSlotSpinRequest } from "../Request/CommonSlotRequest"; import { CommonSlotFgSpinRequest, CommonSlotSpinRequest } from "../Request/CommonSlotRequest";
export default class SlotBase { export default class SlotBase {
//#region public //#region public
public get ID(): number { return this._bj_Casino_Bot.LobbyScript.Slot; } public get ID(): number { return this._bj_Casino_Bot.LobbyScript.Slot; }
public get FreeCount(): number { return this.GameRunData["free"][1]; }
public GameRunData: JSON = null;
//#endregion //#endregion
@ -44,7 +47,7 @@ export default class SlotBase {
await req.SendAsync(); await req.SendAsync();
let resp: INetResponse<JSON> = req.Result; let resp: INetResponse<JSON> = req.Result;
if (resp.IsValid) { if (resp.IsValid) {
gameRunData = resp.Data; gameRunData = this.GameRunData = resp.Data;
} else { } else {
CSMessage.NetError(resp.Method, resp.Status); CSMessage.NetError(resp.Method, resp.Status);
} }
@ -65,12 +68,13 @@ export default class SlotBase {
} }
} }
if (free) { if (free) {
let freeCount: number = free[1]; let freeCount: number = this.FreeCount;
await this.FreeSpin(freeCount); await this.FreeSpin(freeCount);
freeLog = `, hasFree: True, free: ${freeCount}`; freeLog = `, hasFree: True, free: ${freeCount}`;
} }
this._bj_Casino_Bot.UserData.Money = money; this._bj_Casino_Bot.UserData.Money = money;
this._bj_Casino_Bot.SetUI(); this._bj_Casino_Bot.SetUI();
let scale: number = winMoney > 0 ? NumberEx.divide(winMoney, this._bj_Slot.NowBet) : 0;
this._bj_Casino_Bot.AddLog(`Slot${this.ID} Spin Bet: ${this._bj_Slot.NowBet}, Money: ${money}${winMoneyLog}${freeLog}`); this._bj_Casino_Bot.AddLog(`Slot${this.ID} Spin Bet: ${this._bj_Slot.NowBet}, Money: ${money}${winMoneyLog}${freeLog}`);
} }

View File

@ -0,0 +1,10 @@
import SlotBase from "./Base/SlotBase";
export default class Slot1 extends SlotBase {
//#region public
public get FreeCount(): number { return +this.GameRunData["free"]; }
//#endregion
}

View File

@ -1,16 +1,18 @@
declare interface Number { // declare interface Number {
declare global {
interface Number {
/** /**
* (), 2 * (), 2
* 41,038,560.00 * 41,038,560.00
* @param precision * @param precision
* @param isPadZero * @param isPadZero
* */ */
ExFormatNumberWithComma(precision?: number, isPadZero?: boolean): string; ExFormatNumberWithComma(precision?: number, isPadZero?: boolean): string;
/** /**
* 4(9,999-999B-T) * 4(9,999-999B-T)
* */ */
ExTransferToBMK(precision?: number, offset?: number): string; ExTransferToBMK(precision?: number, offset?: number): string;
/** /**
* , 0 * , 0
@ -50,25 +52,26 @@ declare interface Number {
} }
}
Number.prototype.ExFormatNumberWithComma || Object.defineProperty(Number.prototype, 'ExFormatNumberWithComma', { Number.prototype.ExFormatNumberWithComma || Object.defineProperty(Number.prototype, "ExFormatNumberWithComma", {
enumerable: false, enumerable: false,
value: function (precision: number = 2, isPadZero: boolean = true) { value: function (precision: number = 2, isPadZero: boolean = true) {
// let arr = String(this).split('.'); // let arr = String(this).split('.');
let arr = this.ExToStringFloorDecimal(precision, isPadZero).split('.'); let arr = this.ExToStringFloorDecimal(precision, isPadZero).split(".");
let num = arr[0], result = ''; let num = arr[0], result = "";
while (num.length > 3) { while (num.length > 3) {
result = ',' + num.slice(-3) + result; result = "," + num.slice(-3) + result;
num = num.slice(0, num.length - 3); num = num.slice(0, num.length - 3);
} }
if (num.length > 0) result = num + result; if (num.length > 0) { result = num + result; }
return arr[1] ? result + '.' + arr[1] : result; return arr[1] ? result + "." + arr[1] : result;
} }
}) });
Number.prototype.ExTransferToBMK || Object.defineProperty(Number.prototype, 'ExTransferToBMK', { Number.prototype.ExTransferToBMK || Object.defineProperty(Number.prototype, "ExTransferToBMK", {
enumerable: false, enumerable: false,
value: function (precision: number = 2, offset: number = 0) { value: function (precision: number = 2, offset: number = 0) {
/**千 */ /**千 */
@ -101,53 +104,50 @@ Number.prototype.ExTransferToBMK || Object.defineProperty(Number.prototype, 'ExT
// 1,000B~900,000B // 1,000B~900,000B
// 1B~900B // 1B~900B
return (this / MONEY_1B).ExFormatNumberWithComma(3, false) + "B"; return (this / MONEY_1B).ExFormatNumberWithComma(3, false) + "B";
} } else if (this >= MONEY_1M * offset) {
else if (this >= MONEY_1M * offset) {
// 1,000M~900,000M // 1,000M~900,000M
// 1M~900M // 1M~900M
return (this / MONEY_1M).ExFormatNumberWithComma(3, false) + "M"; return (this / MONEY_1M).ExFormatNumberWithComma(3, false) + "M";
} } else if (this >= MONEY_1K * offset) {
else if (this >= MONEY_1K * offset) {
// 1,000K~900,000K // 1,000K~900,000K
// 1K~90K // 1K~90K
return (this / MONEY_1K).ExFormatNumberWithComma(3, false) + "K"; return (this / MONEY_1K).ExFormatNumberWithComma(3, false) + "K";
} } else {
else {
// 0~9,000,000 // 0~9,000,000
// 0~9,000 // 0~9,000
return this.ExFormatNumberWithComma(precision); return this.ExFormatNumberWithComma(precision);
} }
} }
}) });
Number.prototype.Pad || Object.defineProperty(Number.prototype, 'Pad', { Number.prototype.Pad || Object.defineProperty(Number.prototype, "Pad", {
enumerable: false, enumerable: false,
value: function (size: number) { value: function (size: number) {
let s = this + ""; let s = this + "";
while (s.length < size) s = "0" + s; while (s.length < size) { s = "0" + s; }
return s; return s;
} }
}) });
Number.prototype.ExToNumRoundDecimal || Object.defineProperty(Number.prototype, 'ExToNumRoundDecimal', { Number.prototype.ExToNumRoundDecimal || Object.defineProperty(Number.prototype, "ExToNumRoundDecimal", {
enumerable: false, enumerable: false,
value: function (precision: number) { value: function (precision: number) {
return Math.round(Math.round(this * Math.pow(10, (precision || 0) + 1)) / 10) / Math.pow(10, (precision || 0)); return Math.round(Math.round(this * Math.pow(10, (precision || 0) + 1)) / 10) / Math.pow(10, (precision || 0));
} }
}) });
Number.prototype.ExToInt || Object.defineProperty(Number.prototype, 'ExToInt',{ Number.prototype.ExToInt || Object.defineProperty(Number.prototype, "ExToInt", {
enumerable: false, enumerable: false,
value: function () { value: function () {
return ~~this; return ~~this;
} }
}) });
Number.prototype.ExToNumFloorDecimal || Object.defineProperty(Number.prototype, 'ExToNumFloorDecimal', { Number.prototype.ExToNumFloorDecimal || Object.defineProperty(Number.prototype, "ExToNumFloorDecimal", {
enumerable: false, enumerable: false,
value: function (precision: number) { value: function (precision: number) {
let str = this.toPrecision(12); let str = this.toPrecision(12);
let dotPos = str.indexOf('.'); let dotPos = str.indexOf(".");
return dotPos == -1 ? this : +`${str.substr(0, dotPos + 1 + precision)}`; return dotPos === -1 ? this : +`${str.substr(0, dotPos + 1 + precision)}`;
} }
}) });
Number.prototype.ExToStringFloorDecimal || Object.defineProperty(Number.prototype, 'ExToStringFloorDecimal', { Number.prototype.ExToStringFloorDecimal || Object.defineProperty(Number.prototype, "ExToStringFloorDecimal", {
enumerable: false, enumerable: false,
value: function (precision: number, isPadZero: boolean = true) { value: function (precision: number, isPadZero: boolean = true) {
// 取小數點第X位 // 取小數點第X位
@ -155,35 +155,35 @@ Number.prototype.ExToStringFloorDecimal || Object.defineProperty(Number.prototyp
let s = f.toString(); let s = f.toString();
// 補0 // 補0
if (isPadZero) { if (isPadZero) {
let rs = s.indexOf('.'); let rs = s.indexOf(".");
if (rs < 0) { if (rs < 0) {
rs = s.length; rs = s.length;
s += '.'; s += ".";
} }
while (s.length <= rs + precision) { while (s.length <= rs + precision) {
s += '0'; s += "0";
} }
} }
return s; return s;
} }
}) });
Number.prototype.Float2Fixed || Object.defineProperty(Number.prototype, 'Float2Fixed', { Number.prototype.Float2Fixed || Object.defineProperty(Number.prototype, "Float2Fixed", {
enumerable: false, enumerable: false,
value: function () { value: function () {
if (this.toString().indexOf('e') === -1) { if (this.toString().indexOf("e") === -1) {
return Number(this.toString().replace('.', '')); return Number(this.toString().replace(".", ""));
} }
const dLen = this.DigitLength(); const dLen = this.DigitLength();
return dLen > 0 ? +parseFloat((this * Math.pow(10, dLen)).toPrecision(12)) : this; return dLen > 0 ? +parseFloat((this * Math.pow(10, dLen)).toPrecision(12)) : this;
} }
}) });
Number.prototype.DigitLength || Object.defineProperty(Number.prototype, 'DigitLength', { Number.prototype.DigitLength || Object.defineProperty(Number.prototype, "DigitLength", {
enumerable: false, enumerable: false,
value: function () { value: function () {
const eSplit = this.toString().split(/[eE]/); const eSplit = this.toString().split(/[eE]/);
const len = (eSplit[0].split('.')[1] || '').length - (+(eSplit[1] || 0)); const len = (eSplit[0].split(".")[1] || "").length - (+(eSplit[1] || 0));
return len > 0 ? len : 0; return len > 0 ? len : 0;
} }
}) });
export { };