[HQ, Config] Auto split enhancements + more hq config
This commit is contained in:
@@ -21,7 +21,7 @@ Wilder Emu Bot + Trivia Emulator
|
|||||||
- [X] Checkpoint Support (HQ)
|
- [X] Checkpoint Support (HQ)
|
||||||
- [X] Auto Checkpoint Claiming
|
- [X] Auto Checkpoint Claiming
|
||||||
- [X] Auto Splitting
|
- [X] Auto Splitting
|
||||||
- [ ] Auto Split Enhancements (split on last q, prize qs, etc)
|
- [X] Auto Split Enhancements (split on last q, prize qs, etc)
|
||||||
|
|
||||||
### Discord Bot Commands
|
### Discord Bot Commands
|
||||||
|
|
||||||
|
|||||||
@@ -80,10 +80,10 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"mongo": {
|
"mongo": {
|
||||||
"dbName": "weights",
|
|
||||||
"user": "mongoadmin",
|
"user": "mongoadmin",
|
||||||
"pass": "torchard#",
|
"pass": "torchard#",
|
||||||
"host": "skysilk.vilp1l.dev"
|
"host": "skysilk.vilp1l.dev",
|
||||||
|
"dbName": "weights"
|
||||||
},
|
},
|
||||||
"proxy": {
|
"proxy": {
|
||||||
"user": "grbyzyjh",
|
"user": "grbyzyjh",
|
||||||
@@ -98,6 +98,8 @@
|
|||||||
},
|
},
|
||||||
"hq": {
|
"hq": {
|
||||||
"autoSplit": true,
|
"autoSplit": true,
|
||||||
|
"autoSplitOnPrizeQuestions": true,
|
||||||
|
"autoSplitOnLastQuestion": true,
|
||||||
"splitThreshold": 0.65,
|
"splitThreshold": 0.65,
|
||||||
"autoCheckpoints": true,
|
"autoCheckpoints": true,
|
||||||
"checkpointThreshold": 1
|
"checkpointThreshold": 1
|
||||||
|
|||||||
@@ -78,7 +78,16 @@ export default async (client, prize) => {
|
|||||||
const bestAnswerPercentage = client.weights.hq[bestAnswer] / total;
|
const bestAnswerPercentage = client.weights.hq[bestAnswer] / total;
|
||||||
const canAnswer = client.hqClients.filter(c => c.inTheGame);
|
const canAnswer = client.hqClients.filter(c => c.inTheGame);
|
||||||
const splitArr = [...canAnswer];
|
const splitArr = [...canAnswer];
|
||||||
if ((bestAnswerPercentage < hq.splitThreshold) && hq.autoSplit) {
|
// eslint-disable-next-line max-len
|
||||||
|
const splitLastQ = hq.autoSplitOnLastQuestion && json.questionNumber === json.questionCount;
|
||||||
|
const splitOnPrizeQ = hq.autoSplitOnPrizeQuestions && !json.nextCheckpointIn;
|
||||||
|
if (splitOnPrizeQ || splitLastQ) {
|
||||||
|
for (let i = 0; i < 3; i += 1) {
|
||||||
|
const num = Math.round(canAnswer / 3);
|
||||||
|
const clients = splitArr.slice(0, num <= splitArr.length ? num : splitArr.length);
|
||||||
|
clients.forEach(c => c.submitAnswer(i));
|
||||||
|
}
|
||||||
|
} else if ((bestAnswerPercentage < hq.splitThreshold) && hq.autoSplit) {
|
||||||
client.weights.hq.forEach((w, i) => {
|
client.weights.hq.forEach((w, i) => {
|
||||||
const percentage = w / total;
|
const percentage = w / total;
|
||||||
const num = Math.round(canAnswer.length * percentage);
|
const num = Math.round(canAnswer.length * percentage);
|
||||||
|
|||||||
Reference in New Issue
Block a user