[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] Auto Checkpoint Claiming
|
||||
- [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
|
||||
|
||||
|
||||
@@ -80,10 +80,10 @@
|
||||
]
|
||||
},
|
||||
"mongo": {
|
||||
"dbName": "weights",
|
||||
"user": "mongoadmin",
|
||||
"pass": "torchard#",
|
||||
"host": "skysilk.vilp1l.dev"
|
||||
"host": "skysilk.vilp1l.dev",
|
||||
"dbName": "weights"
|
||||
},
|
||||
"proxy": {
|
||||
"user": "grbyzyjh",
|
||||
@@ -98,6 +98,8 @@
|
||||
},
|
||||
"hq": {
|
||||
"autoSplit": true,
|
||||
"autoSplitOnPrizeQuestions": true,
|
||||
"autoSplitOnLastQuestion": true,
|
||||
"splitThreshold": 0.65,
|
||||
"autoCheckpoints": true,
|
||||
"checkpointThreshold": 1
|
||||
|
||||
@@ -78,7 +78,16 @@ export default async (client, prize) => {
|
||||
const bestAnswerPercentage = client.weights.hq[bestAnswer] / total;
|
||||
const canAnswer = client.hqClients.filter(c => c.inTheGame);
|
||||
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) => {
|
||||
const percentage = w / total;
|
||||
const num = Math.round(canAnswer.length * percentage);
|
||||
|
||||
Reference in New Issue
Block a user