gambling-bot-shared 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants/defaultConfig.d.ts +76 -0
- package/dist/constants/defaultConfig.js +84 -0
- package/dist/constants/index.d.ts +4 -0
- package/dist/constants/index.js +20 -0
- package/dist/constants/lotteryConfig.d.ts +2 -0
- package/dist/constants/lotteryConfig.js +5 -0
- package/dist/constants/maxSimulations.d.ts +5 -0
- package/dist/constants/maxSimulations.js +8 -0
- package/dist/constants/rouletteConfig.d.ts +1 -0
- package/dist/constants/rouletteConfig.js +24 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +20 -0
- package/dist/mongoose/guildConfiguration.schema.d.ts +11 -0
- package/dist/mongoose/guildConfiguration.schema.js +79 -0
- package/dist/mongoose/index.d.ts +5 -0
- package/dist/mongoose/index.js +21 -0
- package/dist/mongoose/prediction.schema.d.ts +11 -0
- package/dist/mongoose/prediction.schema.js +49 -0
- package/dist/mongoose/transaction.schema.d.ts +11 -0
- package/dist/mongoose/transaction.schema.js +34 -0
- package/dist/mongoose/user.schema.d.ts +11 -0
- package/dist/mongoose/user.schema.js +13 -0
- package/dist/mongoose/vipRoom.schema.d.ts +11 -0
- package/dist/mongoose/vipRoom.schema.js +14 -0
- package/dist/types/guildConfiguration.d.ts +34 -0
- package/dist/types/guildConfiguration.js +2 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.js +21 -0
- package/dist/types/prediction.d.ts +20 -0
- package/dist/types/prediction.js +2 -0
- package/dist/types/transaction.d.ts +11 -0
- package/dist/types/transaction.js +2 -0
- package/dist/types/user.d.ts +10 -0
- package/dist/types/user.js +2 -0
- package/dist/types/vipRoom.d.ts +8 -0
- package/dist/types/vipRoom.js +2 -0
- package/dist/utils/calculateRTP.d.ts +2 -0
- package/dist/utils/calculateRTP.js +109 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +17 -0
- package/package.json +30 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export declare const readableGameValueNames: {
|
|
2
|
+
name: string;
|
|
3
|
+
value: string;
|
|
4
|
+
}[];
|
|
5
|
+
export declare const defaultCasinoSettings: {
|
|
6
|
+
dice: {
|
|
7
|
+
winMultiplier: number;
|
|
8
|
+
maxBet: number;
|
|
9
|
+
minBet: number;
|
|
10
|
+
};
|
|
11
|
+
coinflip: {
|
|
12
|
+
winMultiplier: number;
|
|
13
|
+
maxBet: number;
|
|
14
|
+
minBet: number;
|
|
15
|
+
};
|
|
16
|
+
slots: {
|
|
17
|
+
winMultipliers: {
|
|
18
|
+
'\uD83C\uDF52\uD83C\uDF52\uD83C\uDF52': number;
|
|
19
|
+
'\uD83E\uDED0\uD83E\uDED0\uD83E\uDED0': number;
|
|
20
|
+
'\uD83C\uDF49\uD83C\uDF49\uD83C\uDF49': number;
|
|
21
|
+
'\uD83D\uDD14\uD83D\uDD14\uD83D\uDD14': number;
|
|
22
|
+
'7\uFE0F\u20E37\uFE0F\u20E37\uFE0F\u20E3': number;
|
|
23
|
+
};
|
|
24
|
+
symbolWeights: {
|
|
25
|
+
'\uD83C\uDF52': number;
|
|
26
|
+
'\uD83E\uDED0': number;
|
|
27
|
+
'\uD83C\uDF49': number;
|
|
28
|
+
'\uD83D\uDD14': number;
|
|
29
|
+
'7\uFE0F\u20E3': number;
|
|
30
|
+
};
|
|
31
|
+
maxBet: number;
|
|
32
|
+
minBet: number;
|
|
33
|
+
};
|
|
34
|
+
lottery: {
|
|
35
|
+
winMultipliers: {
|
|
36
|
+
4: number;
|
|
37
|
+
3: number;
|
|
38
|
+
2: number;
|
|
39
|
+
1: number;
|
|
40
|
+
0: number;
|
|
41
|
+
};
|
|
42
|
+
maxBet: number;
|
|
43
|
+
minBet: number;
|
|
44
|
+
};
|
|
45
|
+
roulette: {
|
|
46
|
+
winMultipliers: {
|
|
47
|
+
number: number;
|
|
48
|
+
color: number;
|
|
49
|
+
parity: number;
|
|
50
|
+
range: number;
|
|
51
|
+
dozen: number;
|
|
52
|
+
column: number;
|
|
53
|
+
};
|
|
54
|
+
maxBet: number;
|
|
55
|
+
minBet: number;
|
|
56
|
+
};
|
|
57
|
+
rps: {
|
|
58
|
+
casinoCut: number;
|
|
59
|
+
maxBet: number;
|
|
60
|
+
minBet: number;
|
|
61
|
+
};
|
|
62
|
+
goldenJackpot: {
|
|
63
|
+
winMultiplier: number;
|
|
64
|
+
oneInChance: number;
|
|
65
|
+
maxBet: number;
|
|
66
|
+
minBet: number;
|
|
67
|
+
};
|
|
68
|
+
blackjack: {
|
|
69
|
+
maxBet: number;
|
|
70
|
+
minBet: number;
|
|
71
|
+
};
|
|
72
|
+
prediction: {
|
|
73
|
+
maxBet: number;
|
|
74
|
+
minBet: number;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defaultCasinoSettings = exports.readableGameValueNames = void 0;
|
|
4
|
+
exports.readableGameValueNames = [
|
|
5
|
+
{ name: 'Maximum Bet Amount', value: 'maxBet' },
|
|
6
|
+
{ name: 'Minimum Bet Amount', value: 'minBet' },
|
|
7
|
+
{ name: 'Win Multiplier (x)', value: 'winMultiplier' },
|
|
8
|
+
{ name: 'Win Multipliers (x)', value: 'winMultipliers' },
|
|
9
|
+
{ name: 'Casino House Cut (%)', value: 'casinoCut' },
|
|
10
|
+
{ name: 'One-In Chance (e.g. 1 in 10,000)', value: 'oneInChance' },
|
|
11
|
+
{ name: 'Symbol Weights', value: 'symbolWeights' },
|
|
12
|
+
];
|
|
13
|
+
exports.defaultCasinoSettings = {
|
|
14
|
+
dice: {
|
|
15
|
+
winMultiplier: 5,
|
|
16
|
+
maxBet: 0,
|
|
17
|
+
minBet: 0,
|
|
18
|
+
},
|
|
19
|
+
coinflip: {
|
|
20
|
+
winMultiplier: 1.9,
|
|
21
|
+
maxBet: 0,
|
|
22
|
+
minBet: 0,
|
|
23
|
+
},
|
|
24
|
+
slots: {
|
|
25
|
+
winMultipliers: {
|
|
26
|
+
'🍒🍒🍒': 5,
|
|
27
|
+
'🫐🫐🫐': 10,
|
|
28
|
+
'🍉🍉🍉': 20,
|
|
29
|
+
'🔔🔔🔔': 50,
|
|
30
|
+
'7️⃣7️⃣7️⃣': 100,
|
|
31
|
+
},
|
|
32
|
+
symbolWeights: {
|
|
33
|
+
'🍒': 35,
|
|
34
|
+
'🫐': 25,
|
|
35
|
+
'🍉': 10,
|
|
36
|
+
'🔔': 4,
|
|
37
|
+
'7️⃣': 2,
|
|
38
|
+
},
|
|
39
|
+
maxBet: 0,
|
|
40
|
+
minBet: 0,
|
|
41
|
+
},
|
|
42
|
+
lottery: {
|
|
43
|
+
winMultipliers: {
|
|
44
|
+
4: 100,
|
|
45
|
+
3: 40,
|
|
46
|
+
2: 10,
|
|
47
|
+
1: 1,
|
|
48
|
+
0: 0,
|
|
49
|
+
},
|
|
50
|
+
maxBet: 0,
|
|
51
|
+
minBet: 0,
|
|
52
|
+
},
|
|
53
|
+
roulette: {
|
|
54
|
+
winMultipliers: {
|
|
55
|
+
number: 18,
|
|
56
|
+
color: 2,
|
|
57
|
+
parity: 1.95,
|
|
58
|
+
range: 1.95,
|
|
59
|
+
dozen: 2.85,
|
|
60
|
+
column: 2.85,
|
|
61
|
+
},
|
|
62
|
+
maxBet: 0,
|
|
63
|
+
minBet: 0,
|
|
64
|
+
},
|
|
65
|
+
rps: {
|
|
66
|
+
casinoCut: 0.025,
|
|
67
|
+
maxBet: 0,
|
|
68
|
+
minBet: 0,
|
|
69
|
+
},
|
|
70
|
+
goldenJackpot: {
|
|
71
|
+
winMultiplier: 10000,
|
|
72
|
+
oneInChance: 12000,
|
|
73
|
+
maxBet: 0,
|
|
74
|
+
minBet: 0,
|
|
75
|
+
},
|
|
76
|
+
blackjack: {
|
|
77
|
+
maxBet: 0,
|
|
78
|
+
minBet: 0,
|
|
79
|
+
},
|
|
80
|
+
prediction: {
|
|
81
|
+
maxBet: 0,
|
|
82
|
+
minBet: 0,
|
|
83
|
+
},
|
|
84
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./defaultConfig"), exports);
|
|
18
|
+
__exportStar(require("./maxSimulations"), exports);
|
|
19
|
+
__exportStar(require("./lotteryConfig"), exports);
|
|
20
|
+
__exportStar(require("./rouletteConfig"), exports);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const DICE_MAX_SIMULATE_ROLLS = 100000000;
|
|
2
|
+
export declare const COINFLIP_MAX_SIMULATE_FLIPS = 200000000;
|
|
3
|
+
export declare const SLOT_MAX_SIMULATE_SPINS = 50000000;
|
|
4
|
+
export declare const LOTTERY_MAX_SIMULATE_ENTRIES = 999999500000;
|
|
5
|
+
export declare const GOLDEN_JACKPOT_MAX_SIMULATE_ENTRIES = 100000000;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GOLDEN_JACKPOT_MAX_SIMULATE_ENTRIES = exports.LOTTERY_MAX_SIMULATE_ENTRIES = exports.SLOT_MAX_SIMULATE_SPINS = exports.COINFLIP_MAX_SIMULATE_FLIPS = exports.DICE_MAX_SIMULATE_ROLLS = void 0;
|
|
4
|
+
exports.DICE_MAX_SIMULATE_ROLLS = 100000000;
|
|
5
|
+
exports.COINFLIP_MAX_SIMULATE_FLIPS = 200000000;
|
|
6
|
+
exports.SLOT_MAX_SIMULATE_SPINS = 50000000;
|
|
7
|
+
exports.LOTTERY_MAX_SIMULATE_ENTRIES = 999999500000;
|
|
8
|
+
exports.GOLDEN_JACKPOT_MAX_SIMULATE_ENTRIES = 100000000;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MINI_NUMBERS: Record<string, 'red' | 'black' | 'green'>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MINI_NUMBERS = void 0;
|
|
4
|
+
exports.MINI_NUMBERS = {
|
|
5
|
+
'0': 'green',
|
|
6
|
+
'1': 'red',
|
|
7
|
+
'3': 'red',
|
|
8
|
+
'5': 'red',
|
|
9
|
+
'7': 'red',
|
|
10
|
+
'9': 'red',
|
|
11
|
+
'12': 'red',
|
|
12
|
+
'14': 'red',
|
|
13
|
+
'16': 'red',
|
|
14
|
+
'18': 'red',
|
|
15
|
+
'2': 'black',
|
|
16
|
+
'4': 'black',
|
|
17
|
+
'6': 'black',
|
|
18
|
+
'8': 'black',
|
|
19
|
+
'10': 'black',
|
|
20
|
+
'11': 'black',
|
|
21
|
+
'13': 'black',
|
|
22
|
+
'15': 'black',
|
|
23
|
+
'17': 'black',
|
|
24
|
+
};
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./constants"), exports);
|
|
18
|
+
__exportStar(require("./mongoose"), exports);
|
|
19
|
+
__exportStar(require("./types"), exports);
|
|
20
|
+
__exportStar(require("./utils"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Schema } from 'mongoose';
|
|
2
|
+
import { TGuildConfiguration } from '../types';
|
|
3
|
+
export declare const GuildConfigurationSchema: Schema<TGuildConfiguration, import("mongoose").Model<TGuildConfiguration, any, any, any, import("mongoose").Document<unknown, any, TGuildConfiguration, any, {}> & TGuildConfiguration & {
|
|
4
|
+
_id: import("mongoose").Types.ObjectId;
|
|
5
|
+
} & {
|
|
6
|
+
__v: number;
|
|
7
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, TGuildConfiguration, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<TGuildConfiguration>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<TGuildConfiguration> & {
|
|
8
|
+
_id: import("mongoose").Types.ObjectId;
|
|
9
|
+
} & {
|
|
10
|
+
__v: number;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GuildConfigurationSchema = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
const constants_1 = require("../constants");
|
|
6
|
+
exports.GuildConfigurationSchema = new mongoose_1.Schema({
|
|
7
|
+
guildId: {
|
|
8
|
+
type: String,
|
|
9
|
+
required: true,
|
|
10
|
+
unique: true,
|
|
11
|
+
index: true,
|
|
12
|
+
},
|
|
13
|
+
atmChannelIds: {
|
|
14
|
+
actions: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: '',
|
|
17
|
+
},
|
|
18
|
+
logs: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: '',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
casinoChannelIds: {
|
|
24
|
+
type: [String],
|
|
25
|
+
default: [],
|
|
26
|
+
},
|
|
27
|
+
predictionChannelIds: {
|
|
28
|
+
actions: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: '',
|
|
31
|
+
},
|
|
32
|
+
logs: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: '',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
managerRoleId: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: '',
|
|
40
|
+
},
|
|
41
|
+
casinoSettings: {
|
|
42
|
+
type: mongoose_1.Schema.Types.Mixed,
|
|
43
|
+
default: constants_1.defaultCasinoSettings,
|
|
44
|
+
},
|
|
45
|
+
vipSettings: {
|
|
46
|
+
roleId: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: '',
|
|
49
|
+
},
|
|
50
|
+
categoryId: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: '',
|
|
53
|
+
},
|
|
54
|
+
pricePerDay: {
|
|
55
|
+
type: Number,
|
|
56
|
+
default: 0,
|
|
57
|
+
},
|
|
58
|
+
pricePerCreate: {
|
|
59
|
+
type: Number,
|
|
60
|
+
default: 0,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
bonusSettings: {
|
|
64
|
+
rewardMode: {
|
|
65
|
+
type: String,
|
|
66
|
+
enum: ['linear', 'exponential'],
|
|
67
|
+
default: 'linear',
|
|
68
|
+
},
|
|
69
|
+
baseReward: { type: Number, default: 0 },
|
|
70
|
+
streakIncrement: { type: Number, default: 0 },
|
|
71
|
+
streakMultiplier: { type: Number, default: 0 },
|
|
72
|
+
maxReward: { type: Number, default: 0 },
|
|
73
|
+
resetOnMax: { type: Boolean, default: false },
|
|
74
|
+
milestoneBonus: {
|
|
75
|
+
weekly: { type: Number, default: 0 },
|
|
76
|
+
monthly: { type: Number, default: 0 },
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./user.schema"), exports);
|
|
18
|
+
__exportStar(require("./vipRoom.schema"), exports);
|
|
19
|
+
__exportStar(require("./prediction.schema"), exports);
|
|
20
|
+
__exportStar(require("./transaction.schema"), exports);
|
|
21
|
+
__exportStar(require("./guildConfiguration.schema"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Schema } from 'mongoose';
|
|
2
|
+
import { TPrediction } from '../types';
|
|
3
|
+
export declare const PredictionSchema: Schema<TPrediction, import("mongoose").Model<TPrediction, any, any, any, import("mongoose").Document<unknown, any, TPrediction, any, {}> & TPrediction & {
|
|
4
|
+
_id: import("mongoose").Types.ObjectId;
|
|
5
|
+
} & {
|
|
6
|
+
__v: number;
|
|
7
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, TPrediction, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<TPrediction>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<TPrediction> & {
|
|
8
|
+
_id: import("mongoose").Types.ObjectId;
|
|
9
|
+
} & {
|
|
10
|
+
__v: number;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PredictionSchema = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
exports.PredictionSchema = new mongoose_1.Schema({
|
|
6
|
+
predictionId: {
|
|
7
|
+
type: String,
|
|
8
|
+
required: true,
|
|
9
|
+
},
|
|
10
|
+
guildId: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
channelId: {
|
|
15
|
+
type: String,
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
creatorId: {
|
|
19
|
+
type: String,
|
|
20
|
+
required: true,
|
|
21
|
+
},
|
|
22
|
+
title: {
|
|
23
|
+
type: String,
|
|
24
|
+
required: true,
|
|
25
|
+
},
|
|
26
|
+
choices: [
|
|
27
|
+
{
|
|
28
|
+
choiceName: { type: String, required: true },
|
|
29
|
+
odds: { type: Number, required: true },
|
|
30
|
+
bets: [
|
|
31
|
+
{
|
|
32
|
+
userId: { type: String, required: true },
|
|
33
|
+
amount: { type: Number, required: true },
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
status: {
|
|
39
|
+
type: String,
|
|
40
|
+
enum: ['active', 'ended', 'paid', 'canceled'],
|
|
41
|
+
default: 'active',
|
|
42
|
+
},
|
|
43
|
+
autolock: {
|
|
44
|
+
type: Date,
|
|
45
|
+
required: false,
|
|
46
|
+
default: null,
|
|
47
|
+
},
|
|
48
|
+
}, { timestamps: true });
|
|
49
|
+
exports.PredictionSchema.index({ predictionId: 1, guildId: 1 }, { unique: true });
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Schema } from 'mongoose';
|
|
2
|
+
import { TTransaction } from '../types';
|
|
3
|
+
export declare const TransactionSchema: Schema<TTransaction, import("mongoose").Model<TTransaction, any, any, any, import("mongoose").Document<unknown, any, TTransaction, any, {}> & TTransaction & {
|
|
4
|
+
_id: import("mongoose").Types.ObjectId;
|
|
5
|
+
} & {
|
|
6
|
+
__v: number;
|
|
7
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, TTransaction, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<TTransaction>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<TTransaction> & {
|
|
8
|
+
_id: import("mongoose").Types.ObjectId;
|
|
9
|
+
} & {
|
|
10
|
+
__v: number;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransactionSchema = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
exports.TransactionSchema = new mongoose_1.Schema({
|
|
6
|
+
userId: { type: String, required: true },
|
|
7
|
+
guildId: { type: String, required: true },
|
|
8
|
+
amount: { type: Number, required: true },
|
|
9
|
+
type: {
|
|
10
|
+
type: String,
|
|
11
|
+
required: true,
|
|
12
|
+
enum: ['deposit', 'withdraw', 'bet', 'win', 'refund', 'bonus', 'vip'],
|
|
13
|
+
},
|
|
14
|
+
source: {
|
|
15
|
+
type: String,
|
|
16
|
+
required: true,
|
|
17
|
+
enum: ['command', 'manual', 'web', 'system', 'casino'],
|
|
18
|
+
},
|
|
19
|
+
meta: { type: mongoose_1.Schema.Types.Mixed, default: {} },
|
|
20
|
+
betId: { type: String, default: null },
|
|
21
|
+
handledBy: { type: String, default: null },
|
|
22
|
+
}, { timestamps: { createdAt: true, updatedAt: false } });
|
|
23
|
+
// for pagination / sorting
|
|
24
|
+
exports.TransactionSchema.index({ guildId: 1, createdAt: -1 });
|
|
25
|
+
// filter + sort
|
|
26
|
+
exports.TransactionSchema.index({ guildId: 1, type: 1, createdAt: -1 });
|
|
27
|
+
// filter + sort
|
|
28
|
+
exports.TransactionSchema.index({ guildId: 1, source: 1, createdAt: -1 });
|
|
29
|
+
// user search
|
|
30
|
+
exports.TransactionSchema.index({ guildId: 1, userId: 1, createdAt: -1 });
|
|
31
|
+
// admin search
|
|
32
|
+
exports.TransactionSchema.index({ guildId: 1, handledBy: 1, createdAt: -1 });
|
|
33
|
+
// for bet lookups
|
|
34
|
+
exports.TransactionSchema.index({ guildId: 1, betId: 1 });
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Schema } from 'mongoose';
|
|
2
|
+
import { TUser } from '../types';
|
|
3
|
+
export declare const UserSchema: Schema<TUser, import("mongoose").Model<TUser, any, any, any, import("mongoose").Document<unknown, any, TUser, any, {}> & TUser & {
|
|
4
|
+
_id: import("mongoose").Types.ObjectId;
|
|
5
|
+
} & {
|
|
6
|
+
__v: number;
|
|
7
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, TUser, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<TUser>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<TUser> & {
|
|
8
|
+
_id: import("mongoose").Types.ObjectId;
|
|
9
|
+
} & {
|
|
10
|
+
__v: number;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserSchema = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
exports.UserSchema = new mongoose_1.Schema({
|
|
6
|
+
userId: { type: String, required: true },
|
|
7
|
+
guildId: { type: String, required: true },
|
|
8
|
+
balance: { type: Number, default: 0 },
|
|
9
|
+
lockedBalance: { type: Number, default: 0 },
|
|
10
|
+
lastDailyClaim: { type: Date, default: null },
|
|
11
|
+
dailyStreak: { type: Number, default: 0 },
|
|
12
|
+
}, { timestamps: true });
|
|
13
|
+
exports.UserSchema.index({ userId: 1, guildId: 1 }, { unique: true });
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Schema } from 'mongoose';
|
|
2
|
+
import { TVipRoom } from '../types';
|
|
3
|
+
export declare const VipRoomSchema: Schema<TVipRoom, import("mongoose").Model<TVipRoom, any, any, any, import("mongoose").Document<unknown, any, TVipRoom, any, {}> & TVipRoom & {
|
|
4
|
+
_id: import("mongoose").Types.ObjectId;
|
|
5
|
+
} & {
|
|
6
|
+
__v: number;
|
|
7
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, TVipRoom, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<TVipRoom>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<TVipRoom> & {
|
|
8
|
+
_id: import("mongoose").Types.ObjectId;
|
|
9
|
+
} & {
|
|
10
|
+
__v: number;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VipRoomSchema = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
exports.VipRoomSchema = new mongoose_1.Schema({
|
|
6
|
+
userId: { type: String, required: true },
|
|
7
|
+
guildId: { type: String, required: true },
|
|
8
|
+
channelId: { type: String, required: true },
|
|
9
|
+
expiresAt: { type: Date, required: true },
|
|
10
|
+
}, {
|
|
11
|
+
timestamps: true,
|
|
12
|
+
});
|
|
13
|
+
exports.VipRoomSchema.index({ expiresAt: 1 });
|
|
14
|
+
exports.VipRoomSchema.index({ userId: 1, guildId: 1 }, { unique: true });
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { defaultCasinoSettings } from '../constants';
|
|
2
|
+
export type RewardMode = 'linear' | 'exponential';
|
|
3
|
+
export type TGuildConfiguration = {
|
|
4
|
+
guildId: string;
|
|
5
|
+
atmChannelIds: {
|
|
6
|
+
actions: string;
|
|
7
|
+
logs: string;
|
|
8
|
+
};
|
|
9
|
+
casinoChannelIds: string[];
|
|
10
|
+
predictionChannelIds: {
|
|
11
|
+
actions: string;
|
|
12
|
+
logs: string;
|
|
13
|
+
};
|
|
14
|
+
managerRoleId: string;
|
|
15
|
+
casinoSettings: typeof defaultCasinoSettings;
|
|
16
|
+
vipSettings: {
|
|
17
|
+
roleId: string;
|
|
18
|
+
categoryId: string;
|
|
19
|
+
pricePerDay: number;
|
|
20
|
+
pricePerCreate: number;
|
|
21
|
+
};
|
|
22
|
+
bonusSettings: {
|
|
23
|
+
rewardMode: RewardMode;
|
|
24
|
+
baseReward: number;
|
|
25
|
+
streakIncrement?: number;
|
|
26
|
+
streakMultiplier?: number;
|
|
27
|
+
maxReward: number;
|
|
28
|
+
resetOnMax: boolean;
|
|
29
|
+
milestoneBonus: {
|
|
30
|
+
weekly: number;
|
|
31
|
+
monthly: number;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { defaultCasinoSettings } from '../constants';
|
|
2
|
+
export type TCasinoSettings = typeof defaultCasinoSettings;
|
|
3
|
+
export * from './user';
|
|
4
|
+
export * from './vipRoom';
|
|
5
|
+
export * from './prediction';
|
|
6
|
+
export * from './transaction';
|
|
7
|
+
export * from './guildConfiguration';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./user"), exports);
|
|
18
|
+
__exportStar(require("./vipRoom"), exports);
|
|
19
|
+
__exportStar(require("./prediction"), exports);
|
|
20
|
+
__exportStar(require("./transaction"), exports);
|
|
21
|
+
__exportStar(require("./guildConfiguration"), exports);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type TPredictionOption = {
|
|
2
|
+
choiceName: string;
|
|
3
|
+
odds: number;
|
|
4
|
+
bets: {
|
|
5
|
+
userId: string;
|
|
6
|
+
amount: number;
|
|
7
|
+
}[];
|
|
8
|
+
};
|
|
9
|
+
export type TPrediction = {
|
|
10
|
+
predictionId: string;
|
|
11
|
+
guildId: string;
|
|
12
|
+
channelId: string;
|
|
13
|
+
creatorId: string;
|
|
14
|
+
title: string;
|
|
15
|
+
choices: TPredictionOption[];
|
|
16
|
+
status: 'active' | 'ended' | 'paid' | 'canceled';
|
|
17
|
+
autolock?: Date | null;
|
|
18
|
+
createdAt: Date;
|
|
19
|
+
updatedAt: Date;
|
|
20
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type TTransaction = {
|
|
2
|
+
userId: string;
|
|
3
|
+
guildId: string;
|
|
4
|
+
amount: number;
|
|
5
|
+
type: 'deposit' | 'withdraw' | 'bet' | 'win' | 'refund' | 'bonus' | 'vip';
|
|
6
|
+
source: 'command' | 'manual' | 'web' | 'system' | 'casino';
|
|
7
|
+
meta?: Record<string, any>;
|
|
8
|
+
betId?: string;
|
|
9
|
+
handledBy?: string;
|
|
10
|
+
createdAt: Date;
|
|
11
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.calculateRTP = void 0;
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
const combination = (n, k) => {
|
|
6
|
+
if (k > n)
|
|
7
|
+
return 0;
|
|
8
|
+
let result = 1;
|
|
9
|
+
for (let i = 1; i <= k; i++) {
|
|
10
|
+
result = (result * (n - i + 1)) / i;
|
|
11
|
+
}
|
|
12
|
+
return result;
|
|
13
|
+
};
|
|
14
|
+
const calculateRTP = (game, settings) => {
|
|
15
|
+
const toNumber = (val) => {
|
|
16
|
+
if (typeof val === 'string')
|
|
17
|
+
return parseFloat(val) || 0;
|
|
18
|
+
if (typeof val === 'number')
|
|
19
|
+
return val;
|
|
20
|
+
return 0;
|
|
21
|
+
};
|
|
22
|
+
switch (game) {
|
|
23
|
+
case 'dice': {
|
|
24
|
+
const { winMultiplier } = settings;
|
|
25
|
+
return (1 / 6) * toNumber(winMultiplier) * 100;
|
|
26
|
+
}
|
|
27
|
+
case 'coinflip': {
|
|
28
|
+
const { winMultiplier } = settings;
|
|
29
|
+
return 0.5 * toNumber(winMultiplier) * 100;
|
|
30
|
+
}
|
|
31
|
+
case 'slots': {
|
|
32
|
+
const { symbolWeights, winMultipliers } = settings;
|
|
33
|
+
const multipliers = winMultipliers;
|
|
34
|
+
const totalWeight = Object.values(symbolWeights).reduce((a, b) => a + toNumber(b), 0);
|
|
35
|
+
let rtp = 0;
|
|
36
|
+
for (const [symbol, weight] of Object.entries(symbolWeights)) {
|
|
37
|
+
const probability = Math.pow(toNumber(weight) / totalWeight, 3);
|
|
38
|
+
const combo = symbol + symbol + symbol;
|
|
39
|
+
const multiplier = toNumber(multipliers[combo] ?? 0); // ← FIX
|
|
40
|
+
rtp += probability * multiplier;
|
|
41
|
+
}
|
|
42
|
+
return rtp * 100;
|
|
43
|
+
}
|
|
44
|
+
case 'lottery': {
|
|
45
|
+
const { winMultipliers } = settings;
|
|
46
|
+
const multipliers = winMultipliers;
|
|
47
|
+
const userPicks = constants_1.LOTTERY_NUM_TO_DRAW;
|
|
48
|
+
const drawnNumbers = constants_1.LOTTERY_NUM_TO_DRAW;
|
|
49
|
+
let rtp = 0;
|
|
50
|
+
for (let k = 0; k <= userPicks; k++) {
|
|
51
|
+
const favorable = combination(userPicks, k) *
|
|
52
|
+
combination(constants_1.LOTTERY_TOTAL_NUMBERS - userPicks, drawnNumbers - k);
|
|
53
|
+
const probability = favorable / combination(constants_1.LOTTERY_TOTAL_NUMBERS, drawnNumbers);
|
|
54
|
+
const multiplier = toNumber(multipliers[k] ?? 0);
|
|
55
|
+
rtp += probability * multiplier;
|
|
56
|
+
}
|
|
57
|
+
return rtp * 100;
|
|
58
|
+
}
|
|
59
|
+
case 'roulette': {
|
|
60
|
+
const { winMultipliers } = settings;
|
|
61
|
+
const numbers = Object.keys(constants_1.MINI_NUMBERS);
|
|
62
|
+
const totalNumbers = numbers.length;
|
|
63
|
+
const greenCount = numbers.filter((n) => constants_1.MINI_NUMBERS[n] === 'green').length;
|
|
64
|
+
const numberRTP = (1 / totalNumbers) * toNumber(winMultipliers.number) * 100;
|
|
65
|
+
const redCount = numbers.filter((n) => constants_1.MINI_NUMBERS[n] === 'red').length;
|
|
66
|
+
const colorRTP = (redCount / totalNumbers) * toNumber(winMultipliers.color) * 100;
|
|
67
|
+
const evenCount = numbers.filter((n) => parseInt(n) % 2 === 0 && constants_1.MINI_NUMBERS[n] !== 'green').length;
|
|
68
|
+
const parityRTP = (evenCount / (totalNumbers - greenCount)) *
|
|
69
|
+
toNumber(winMultipliers.parity) *
|
|
70
|
+
100;
|
|
71
|
+
const rangeCount = numbers.filter((n) => parseInt(n) >= 1 && parseInt(n) <= 9).length;
|
|
72
|
+
const rangeRTP = (rangeCount / (totalNumbers - greenCount)) *
|
|
73
|
+
toNumber(winMultipliers.range) *
|
|
74
|
+
100;
|
|
75
|
+
const dozenCount = numbers.filter((n) => parseInt(n) >= 1 && parseInt(n) <= 6).length;
|
|
76
|
+
const dozenRTP = (dozenCount / (totalNumbers - greenCount)) *
|
|
77
|
+
toNumber(winMultipliers.dozen) *
|
|
78
|
+
100;
|
|
79
|
+
const columnCount = numbers.filter((n) => parseInt(n) % 3 === 1 && constants_1.MINI_NUMBERS[n] !== 'green').length;
|
|
80
|
+
const columnRTP = (columnCount / (totalNumbers - greenCount)) *
|
|
81
|
+
toNumber(winMultipliers.column) *
|
|
82
|
+
100;
|
|
83
|
+
return {
|
|
84
|
+
number: numberRTP,
|
|
85
|
+
color: colorRTP,
|
|
86
|
+
parity: parityRTP,
|
|
87
|
+
range: rangeRTP,
|
|
88
|
+
dozen: dozenRTP,
|
|
89
|
+
column: columnRTP,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
case 'rps': {
|
|
93
|
+
const { casinoCut } = settings;
|
|
94
|
+
return (1 - toNumber(casinoCut)) * 100;
|
|
95
|
+
}
|
|
96
|
+
case 'goldenJackpot': {
|
|
97
|
+
const { winMultiplier, oneInChance } = settings;
|
|
98
|
+
return (toNumber(winMultiplier) / toNumber(oneInChance)) * 100;
|
|
99
|
+
}
|
|
100
|
+
case 'blackjack':
|
|
101
|
+
return 99.4;
|
|
102
|
+
case 'prediction':
|
|
103
|
+
return 0;
|
|
104
|
+
default:
|
|
105
|
+
console.warn(`RTP for ${game} not implemented`);
|
|
106
|
+
return 0;
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
exports.calculateRTP = calculateRTP;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './calculateRTP';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./calculateRTP"), exports);
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "gambling-bot-shared",
|
|
3
|
+
"version": "0.1.8",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"import": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc -p tsconfig.json",
|
|
21
|
+
"release": "pnpm build && npm version patch && npm publish"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"mongoose": "^8.0.0",
|
|
25
|
+
"zod": "^3.23.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"typescript": "^5.7.0"
|
|
29
|
+
}
|
|
30
|
+
}
|