[add] Slot1201
This commit is contained in:
parent
d093c5d533
commit
551f2ed0d8
@ -8,6 +8,7 @@ import locale from "element-plus/lib/locale/lang/zh-tw";
|
||||
import { createApp } from "vue";
|
||||
import App from "./App.vue";
|
||||
import "./script/Engine/CatanEngine/CSharp/String";
|
||||
import "./script/Engine/Utils/CCExtensions/NumberExtension";
|
||||
|
||||
|
||||
createApp(App).use(ElementPlus, { locale }).mount("#app");
|
||||
|
@ -2,12 +2,15 @@ import CSMessage from "../../../Base/CSMessage";
|
||||
import { BJ_Casino_Bot } from "../../../BJ_Casino_Bot";
|
||||
import { BJ_Casino_Bot_Slot } from "../../../BJ_Casino_Bot_Slot";
|
||||
import { INetResponse } from "../../../Engine/CatanEngine/NetManagerV2/Core/INetResponse";
|
||||
import { NumberEx } from "../../../Engine/Utils/Number/NumberEx";
|
||||
import { CommonSlotFgSpinRequest, CommonSlotSpinRequest } from "../Request/CommonSlotRequest";
|
||||
|
||||
export default class SlotBase {
|
||||
//#region public
|
||||
|
||||
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
|
||||
|
||||
@ -44,7 +47,7 @@ export default class SlotBase {
|
||||
await req.SendAsync();
|
||||
let resp: INetResponse<JSON> = req.Result;
|
||||
if (resp.IsValid) {
|
||||
gameRunData = resp.Data;
|
||||
gameRunData = this.GameRunData = resp.Data;
|
||||
} else {
|
||||
CSMessage.NetError(resp.Method, resp.Status);
|
||||
}
|
||||
@ -65,12 +68,13 @@ export default class SlotBase {
|
||||
}
|
||||
}
|
||||
if (free) {
|
||||
let freeCount: number = free[1];
|
||||
let freeCount: number = this.FreeCount;
|
||||
await this.FreeSpin(freeCount);
|
||||
freeLog = `, hasFree: True, free: ${freeCount}`;
|
||||
}
|
||||
this._bj_Casino_Bot.UserData.Money = money;
|
||||
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}`);
|
||||
}
|
||||
|
||||
|
10
src/script/Common/Game/Slot1201.ts
Normal file
10
src/script/Common/Game/Slot1201.ts
Normal 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
|
||||
}
|
@ -1,16 +1,18 @@
|
||||
|
||||
declare interface Number {
|
||||
// declare interface Number {
|
||||
declare global {
|
||||
interface Number {
|
||||
|
||||
/**
|
||||
* 金額每三位數(千)加逗號, 並且補到小數點第2位
|
||||
* 輸出 41,038,560.00
|
||||
* @param precision 補到小數點第幾位
|
||||
* @param isPadZero 是否要補零
|
||||
* */
|
||||
*/
|
||||
ExFormatNumberWithComma(precision?: number, isPadZero?: boolean): string;
|
||||
/**
|
||||
* 基本4位數(9,999-999B-T)
|
||||
* */
|
||||
*/
|
||||
ExTransferToBMK(precision?: number, offset?: number): string;
|
||||
/**
|
||||
* 數字轉字串, 頭補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,
|
||||
value: function (precision: number = 2, isPadZero: boolean = true) {
|
||||
|
||||
// let arr = String(this).split('.');
|
||||
let arr = this.ExToStringFloorDecimal(precision, isPadZero).split('.');
|
||||
let num = arr[0], result = '';
|
||||
let arr = this.ExToStringFloorDecimal(precision, isPadZero).split(".");
|
||||
let num = arr[0], result = "";
|
||||
while (num.length > 3) {
|
||||
result = ',' + num.slice(-3) + result;
|
||||
result = "," + num.slice(-3) + result;
|
||||
num = num.slice(0, num.length - 3);
|
||||
}
|
||||
if (num.length > 0) result = num + result;
|
||||
return arr[1] ? result + '.' + arr[1] : result;
|
||||
if (num.length > 0) { result = num + 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,
|
||||
value: function (precision: number = 2, offset: number = 0) {
|
||||
/**千 */
|
||||
@ -101,53 +104,50 @@ Number.prototype.ExTransferToBMK || Object.defineProperty(Number.prototype, 'ExT
|
||||
// 1,000B~900,000B
|
||||
// 1B~900B
|
||||
return (this / MONEY_1B).ExFormatNumberWithComma(3, false) + "B";
|
||||
}
|
||||
else if (this >= MONEY_1M * offset) {
|
||||
} else if (this >= MONEY_1M * offset) {
|
||||
// 1,000M~900,000M
|
||||
// 1M~900M
|
||||
return (this / MONEY_1M).ExFormatNumberWithComma(3, false) + "M";
|
||||
}
|
||||
else if (this >= MONEY_1K * offset) {
|
||||
} else if (this >= MONEY_1K * offset) {
|
||||
// 1,000K~900,000K
|
||||
// 1K~90K
|
||||
return (this / MONEY_1K).ExFormatNumberWithComma(3, false) + "K";
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// 0~9,000,000
|
||||
// 0~9,000
|
||||
return this.ExFormatNumberWithComma(precision);
|
||||
}
|
||||
}
|
||||
})
|
||||
Number.prototype.Pad || Object.defineProperty(Number.prototype, 'Pad', {
|
||||
});
|
||||
Number.prototype.Pad || Object.defineProperty(Number.prototype, "Pad", {
|
||||
enumerable: false,
|
||||
value: function (size: number) {
|
||||
let s = this + "";
|
||||
while (s.length < size) s = "0" + s;
|
||||
while (s.length < size) { s = "0" + s; }
|
||||
return s;
|
||||
}
|
||||
})
|
||||
Number.prototype.ExToNumRoundDecimal || Object.defineProperty(Number.prototype, 'ExToNumRoundDecimal', {
|
||||
});
|
||||
Number.prototype.ExToNumRoundDecimal || Object.defineProperty(Number.prototype, "ExToNumRoundDecimal", {
|
||||
enumerable: false,
|
||||
value: function (precision: number) {
|
||||
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,
|
||||
value: function () {
|
||||
return ~~this;
|
||||
}
|
||||
})
|
||||
Number.prototype.ExToNumFloorDecimal || Object.defineProperty(Number.prototype, 'ExToNumFloorDecimal', {
|
||||
});
|
||||
Number.prototype.ExToNumFloorDecimal || Object.defineProperty(Number.prototype, "ExToNumFloorDecimal", {
|
||||
enumerable: false,
|
||||
value: function (precision: number) {
|
||||
let str = this.toPrecision(12);
|
||||
let dotPos = str.indexOf('.');
|
||||
return dotPos == -1 ? this : +`${str.substr(0, dotPos + 1 + precision)}`;
|
||||
let dotPos = str.indexOf(".");
|
||||
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,
|
||||
value: function (precision: number, isPadZero: boolean = true) {
|
||||
// 取小數點第X位
|
||||
@ -155,35 +155,35 @@ Number.prototype.ExToStringFloorDecimal || Object.defineProperty(Number.prototyp
|
||||
let s = f.toString();
|
||||
// 補0
|
||||
if (isPadZero) {
|
||||
let rs = s.indexOf('.');
|
||||
let rs = s.indexOf(".");
|
||||
if (rs < 0) {
|
||||
rs = s.length;
|
||||
s += '.';
|
||||
s += ".";
|
||||
}
|
||||
while (s.length <= rs + precision) {
|
||||
s += '0';
|
||||
s += "0";
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
})
|
||||
Number.prototype.Float2Fixed || Object.defineProperty(Number.prototype, 'Float2Fixed', {
|
||||
});
|
||||
Number.prototype.Float2Fixed || Object.defineProperty(Number.prototype, "Float2Fixed", {
|
||||
enumerable: false,
|
||||
value: function () {
|
||||
if (this.toString().indexOf('e') === -1) {
|
||||
return Number(this.toString().replace('.', ''));
|
||||
if (this.toString().indexOf("e") === -1) {
|
||||
return Number(this.toString().replace(".", ""));
|
||||
}
|
||||
const dLen = this.DigitLength();
|
||||
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,
|
||||
value: function () {
|
||||
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;
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
export { };
|
||||
|
Loading…
x
Reference in New Issue
Block a user