[add] Slot
This commit is contained in:
parent
551f2ed0d8
commit
51cf8bd3d8
25
deploy.sh
Normal file
25
deploy.sh
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# 当发生错误时中止脚本
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# 构建
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
# cd 到构建输出的目录下
|
||||||
|
cd dist
|
||||||
|
|
||||||
|
# 部署到自定义域域名
|
||||||
|
# echo 'www.example.com' > CNAME
|
||||||
|
|
||||||
|
git init
|
||||||
|
git add -A
|
||||||
|
git commit -m 'deploy'
|
||||||
|
|
||||||
|
# 部署到 https://<USERNAME>.github.io
|
||||||
|
# git push -f git@github.com:<USERNAME>/<USERNAME>.github.io.git master
|
||||||
|
|
||||||
|
# 部署到 https://<USERNAME>.github.io/<REPO>
|
||||||
|
# git push -f git@github.com:<USERNAME>/<REPO>.git master:gh-pages
|
||||||
|
|
||||||
|
cd -
|
@ -17,8 +17,8 @@ export class BJ_Casino_Bot_Lobby {
|
|||||||
]];
|
]];
|
||||||
|
|
||||||
public LobbyShow: Ref<boolean> = ref(false);
|
public LobbyShow: Ref<boolean> = ref(false);
|
||||||
public Lobby: Ref<number> = ref(1);
|
public Lobby: Ref<number> = ref(2);
|
||||||
public LobbyDefault: Ref<string> = ref(this.LobbyCongig[1][this.Lobby.value]);
|
public LobbyDefault: Ref<string> = ref(this.LobbyCongig[1][this.Lobby.value - 1]);
|
||||||
public InputSlot: Ref<string> = ref("");
|
public InputSlot: Ref<string> = ref("");
|
||||||
public Slot: number;
|
public Slot: number;
|
||||||
public Table: Ref<number> = ref(0);
|
public Table: Ref<number> = ref(0);
|
||||||
@ -77,7 +77,6 @@ export class BJ_Casino_Bot_Lobby {
|
|||||||
if (this.IsSlotIn.value || slot === 0 || slot == null) {
|
if (this.IsSlotIn.value || slot === 0 || slot == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
hall += 1;
|
|
||||||
this.IsSlotIn.value = true;
|
this.IsSlotIn.value = true;
|
||||||
let table: number = 1;
|
let table: number = 1;
|
||||||
let req: SeatListRequest = new SeatListRequest(hall, slot);
|
let req: SeatListRequest = new SeatListRequest(hall, slot);
|
||||||
@ -140,7 +139,7 @@ export class BJ_Casino_Bot_Lobby {
|
|||||||
await req.SendAsync(true);
|
await req.SendAsync(true);
|
||||||
let resp: INetResponse<JSON> = req.Result;
|
let resp: INetResponse<JSON> = req.Result;
|
||||||
if (resp.IsValid) {
|
if (resp.IsValid) {
|
||||||
this._bj_Casino_Bot.AddLog(`進機台成功 slot: ${slot}, hall: ${this.LobbyDefault.value}, table: ${uid}`);
|
this._bj_Casino_Bot.AddLog(`進機台成功 slot: ${slot}, hall: ${this.LobbyCongig[1][hall - 1]}, table: ${uid}`);
|
||||||
} else {
|
} else {
|
||||||
switch (resp.Status) {
|
switch (resp.Status) {
|
||||||
case 11:
|
case 11:
|
||||||
|
@ -4,13 +4,18 @@ 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 { NumberEx } from "../../../Engine/Utils/Number/NumberEx";
|
||||||
import { CommonSlotFgSpinRequest, CommonSlotSpinRequest } from "../Request/CommonSlotRequest";
|
import { CommonSlotFgSpinRequest, CommonSlotSpinRequest } from "../Request/CommonSlotRequest";
|
||||||
|
import { Slot_ChoiceRequest } from "../Request/SlotRequest";
|
||||||
|
|
||||||
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 get FreeID(): number { return 1; }
|
||||||
|
public get HasChoiceFreeGame(): boolean { return false; }
|
||||||
|
public get SlotReqRespIsCount(): boolean { return false; }
|
||||||
|
public get HasRetriggerFreeSpin(): boolean { return false; }
|
||||||
public GameRunData: JSON = null;
|
public GameRunData: JSON = null;
|
||||||
|
public ChoiceFreeCount: Object = {};
|
||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
@ -51,26 +56,34 @@ export default class SlotBase {
|
|||||||
} else {
|
} else {
|
||||||
CSMessage.NetError(resp.Method, resp.Status);
|
CSMessage.NetError(resp.Method, resp.Status);
|
||||||
}
|
}
|
||||||
let money: number = +gameRunData["money"];
|
let money: number = gameRunData["money"] ? +gameRunData["money"] : 0;
|
||||||
let winMoney: number = 0;
|
let winMoney: number = 0;
|
||||||
let winMoneyLog: string = "";
|
let winMoneyLog: string = "";
|
||||||
let freeLog: string = "";
|
let freeLog: string = "";
|
||||||
let resources: any[] = gameRunData["get"];
|
let resources: any[] = gameRunData["get"];
|
||||||
let free: any[] = gameRunData["free"];
|
let free: any = gameRunData["free"];
|
||||||
|
let choiceFreeGame: boolean = gameRunData["rs"] === 0;
|
||||||
if (resources) {
|
if (resources) {
|
||||||
for (let i: number = 0; i < resources.length; i++) {
|
winMoney = this._getWinMoney(resources);
|
||||||
const resource: any[] = resources[i];
|
|
||||||
if (resource[0] === 1) {
|
|
||||||
winMoney = resource[1];
|
|
||||||
winMoneyLog = `, winMoney: ${winMoney}`;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (choiceFreeGame && this.HasChoiceFreeGame) {
|
||||||
|
free = true;
|
||||||
}
|
}
|
||||||
if (free) {
|
if (free) {
|
||||||
let freeCount: number = this.FreeCount;
|
let freeCount: number = await this._getFreeCount();
|
||||||
await this.FreeSpin(freeCount);
|
let fswinMoney: number = 0;
|
||||||
freeLog = `, hasFree: True, free: ${freeCount}`;
|
let fsmoney: number = 0;
|
||||||
|
[freeCount, fswinMoney, fsmoney] = await this.FreeSpin(freeCount);
|
||||||
|
if (fsmoney > 0) {
|
||||||
|
money = fsmoney;
|
||||||
|
}
|
||||||
|
if (fswinMoney > 0) {
|
||||||
|
winMoney = fswinMoney;
|
||||||
|
}
|
||||||
|
freeLog = `, hasFree: ${freeCount}`;
|
||||||
|
}
|
||||||
|
if (winMoney > 0) {
|
||||||
|
winMoneyLog = `, winMoney: ${winMoney}`;
|
||||||
}
|
}
|
||||||
this._bj_Casino_Bot.UserData.Money = money;
|
this._bj_Casino_Bot.UserData.Money = money;
|
||||||
this._bj_Casino_Bot.SetUI();
|
this._bj_Casino_Bot.SetUI();
|
||||||
@ -78,7 +91,9 @@ export default class SlotBase {
|
|||||||
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}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async FreeSpin(freeCount: number): Promise<void> {
|
public async FreeSpin(freeCount: number): Promise<number[]> {
|
||||||
|
let fswinMoney: number = 0;
|
||||||
|
let fsmoney: number = 0;
|
||||||
for (let i: number = 0; i < freeCount; i++) {
|
for (let i: number = 0; i < freeCount; i++) {
|
||||||
let gameRunData: JSON = null;
|
let gameRunData: JSON = null;
|
||||||
let req: CommonSlotFgSpinRequest = new CommonSlotFgSpinRequest(this.ID);
|
let req: CommonSlotFgSpinRequest = new CommonSlotFgSpinRequest(this.ID);
|
||||||
@ -86,11 +101,67 @@ export default class SlotBase {
|
|||||||
let resp: INetResponse<JSON> = req.Result;
|
let resp: INetResponse<JSON> = req.Result;
|
||||||
if (resp.IsValid) {
|
if (resp.IsValid) {
|
||||||
gameRunData = resp.Data;
|
gameRunData = resp.Data;
|
||||||
|
if (this.HasRetriggerFreeSpin) {
|
||||||
|
let retriggercount: number = this._getRetriggerFreeSpinCount(gameRunData);
|
||||||
|
freeCount += retriggercount;
|
||||||
|
}
|
||||||
|
if (i === freeCount - 1) {
|
||||||
|
let resources: any[] = gameRunData["get"];
|
||||||
|
if (resources) {
|
||||||
|
fswinMoney = this._getWinMoney(resources);
|
||||||
|
}
|
||||||
|
fsmoney = gameRunData["money"] ? +gameRunData["money"] : 0;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
CSMessage.NetError(resp.Method, resp.Status);
|
CSMessage.NetError(resp.Method, resp.Status);
|
||||||
}
|
}
|
||||||
this._bj_Casino_Bot.AddLog(`Slot${this.ID} FreeSpin MaxCount: ${freeCount}, Count: ${i + 1}`);
|
this._bj_Casino_Bot.AddLog(`Slot${this.ID} FreeSpin MaxCount: ${freeCount}, Count: ${i + 1}`);
|
||||||
}
|
}
|
||||||
|
return [freeCount, fswinMoney, fsmoney];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected _getWinMoney(resources: any[]): number {
|
||||||
|
for (let i: number = 0; i < resources.length; i++) {
|
||||||
|
const resource: any[] = resources[i];
|
||||||
|
if (resource[0] === 1) {
|
||||||
|
return resource[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected _getRetriggerFreeSpinCount(gameRunData: JSON): number {
|
||||||
|
if (gameRunData["free"]) {
|
||||||
|
return gameRunData["free"][1];
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async _getFreeCount(): Promise<number> {
|
||||||
|
if (this.HasChoiceFreeGame) {
|
||||||
|
return await this._getChoiceFreeCount();
|
||||||
|
} else {
|
||||||
|
return this.GameRunData["free"][1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async _getChoiceFreeCount(): Promise<number> {
|
||||||
|
let id: number = this._getFreeID();
|
||||||
|
let request: Slot_ChoiceRequest = new Slot_ChoiceRequest(id);
|
||||||
|
await request.SendAsync(true);
|
||||||
|
var result: INetResponse<number> = request.Result;
|
||||||
|
if (result.IsValid) {
|
||||||
|
if (this.SlotReqRespIsCount) {
|
||||||
|
return result.Data;
|
||||||
|
} else if (this.ChoiceFreeCount[result.Data]) {
|
||||||
|
return this.ChoiceFreeCount[result.Data];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected _getFreeID(): number {
|
||||||
|
return this.FreeID;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
|
78
src/script/Common/Game/Request/SlotRequest.ts
Normal file
78
src/script/Common/Game/Request/SlotRequest.ts
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
import { NetRequest } from "../../../Engine/CatanEngine/NetManagerV2/NetRequest";
|
||||||
|
|
||||||
|
//=======================================================================================
|
||||||
|
interface ChoiceRequest {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**五龍選擇協定 */
|
||||||
|
export class Slot_ChoiceRequest extends NetRequest<ChoiceRequest, number> {
|
||||||
|
get Method(): string {
|
||||||
|
return "slot.req";
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(id: number) {
|
||||||
|
super();
|
||||||
|
this.Data = id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//=======================================================================================
|
||||||
|
interface GmRequest {
|
||||||
|
pay: number;
|
||||||
|
slot: string;
|
||||||
|
type: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Slot_GMRequest extends NetRequest<GmRequest, JSON>{
|
||||||
|
get Method(): string {
|
||||||
|
return "slot.gm";
|
||||||
|
}
|
||||||
|
|
||||||
|
get MethodBack(): string {
|
||||||
|
return "slot" + this._id + ".spin";
|
||||||
|
}
|
||||||
|
|
||||||
|
private _id: number = 1;
|
||||||
|
|
||||||
|
constructor(id: number, totalBet: number, symbols: string, type: number) {
|
||||||
|
super();
|
||||||
|
this._id = id;
|
||||||
|
this.Data = {
|
||||||
|
pay: totalBet,
|
||||||
|
slot: symbols,
|
||||||
|
type: type,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//=======================================================================================
|
||||||
|
export class Bingo_GMRequest extends NetRequest<GmRequest, JSON>{
|
||||||
|
get Method(): string {
|
||||||
|
return "bingo.gm";
|
||||||
|
}
|
||||||
|
|
||||||
|
get MethodBack(): string {
|
||||||
|
return "slot" + this._id + ".spin";
|
||||||
|
}
|
||||||
|
|
||||||
|
private _id: number = 0;
|
||||||
|
|
||||||
|
constructor(id: number, totalBet: number, bingos: string, type: number) {
|
||||||
|
super();
|
||||||
|
this._id = id;
|
||||||
|
this.Data = {
|
||||||
|
pay: totalBet,
|
||||||
|
slot: bingos,
|
||||||
|
type: type,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//=======================================================================================
|
||||||
|
/**前後端金額對不上協定 */
|
||||||
|
export class Slot_ErrorRequest extends NetRequest<any, JSON> {
|
||||||
|
get Method(): string {
|
||||||
|
return "slot.error";
|
||||||
|
}
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//=======================================================================================
|
@ -5,24 +5,7 @@ export default class Slot1 extends SlotBase {
|
|||||||
//#region public
|
//#region public
|
||||||
|
|
||||||
public get ID(): number { return 1; }
|
public get ID(): number { return 1; }
|
||||||
|
public get HasRetriggerFreeSpin(): boolean { return true; }
|
||||||
//#endregion
|
|
||||||
|
|
||||||
//#endregion
|
|
||||||
|
|
||||||
//#region private
|
|
||||||
|
|
||||||
//#endregion
|
|
||||||
|
|
||||||
//#region Lifecycle
|
|
||||||
|
|
||||||
public async onLoad(): Promise<void> {
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
//#endregion
|
|
||||||
|
|
||||||
//#region Custom
|
|
||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
}
|
}
|
||||||
|
13
src/script/Common/Game/Slot48.ts
Normal file
13
src/script/Common/Game/Slot48.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import SlotBase from "./Base/SlotBase";
|
||||||
|
|
||||||
|
|
||||||
|
export default class Slot50 extends SlotBase {
|
||||||
|
//#region public
|
||||||
|
|
||||||
|
public get ID(): number { return 48; }
|
||||||
|
public get FreeID(): number { return 3; }
|
||||||
|
public get HasChoiceFreeGame(): boolean { return true; }
|
||||||
|
public get SlotReqRespIsCount(): boolean { return true; }
|
||||||
|
|
||||||
|
//#endregion
|
||||||
|
}
|
11
src/script/Common/Game/Slot50.ts
Normal file
11
src/script/Common/Game/Slot50.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import SlotBase from "./Base/SlotBase";
|
||||||
|
|
||||||
|
|
||||||
|
export default class Slot50 extends SlotBase {
|
||||||
|
//#region public
|
||||||
|
|
||||||
|
public get ID(): number { return 50; }
|
||||||
|
public get HasRetriggerFreeSpin(): boolean { return true; }
|
||||||
|
|
||||||
|
//#endregion
|
||||||
|
}
|
35
src/script/Common/Game/Slot62.ts
Normal file
35
src/script/Common/Game/Slot62.ts
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
import SlotBase from "./Base/SlotBase";
|
||||||
|
|
||||||
|
|
||||||
|
export default class Slot50 extends SlotBase {
|
||||||
|
//#region public
|
||||||
|
|
||||||
|
public get ID(): number { return 62; }
|
||||||
|
public get FreeID(): number { return 3; }
|
||||||
|
public get HasChoiceFreeGame(): boolean { return true; }
|
||||||
|
public ChoiceFreeCount: Object = {
|
||||||
|
"1": 15,
|
||||||
|
"2": 10,
|
||||||
|
"3": 5,
|
||||||
|
"4": 3,
|
||||||
|
"5": 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
//#endregion
|
||||||
|
|
||||||
|
//#region Custom
|
||||||
|
|
||||||
|
protected _getFreeID(): number {
|
||||||
|
let gameRunData: JSON = this.GameRunData;
|
||||||
|
let scatterAmount: number = gameRunData["scatter"][0][0].length;
|
||||||
|
if (scatterAmount > 4) {
|
||||||
|
return 5;
|
||||||
|
} else if (scatterAmount > 3) {
|
||||||
|
return 4;
|
||||||
|
} else {
|
||||||
|
return this.FreeID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//#endregion
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user