-
Notifications
You must be signed in to change notification settings - Fork 11
Closed
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers
Description
diepAPI.player.level cannot detect level if tank type name contains a blank character.
[ /diepAPI/src/player.ts ]
CanvasKit.hook('fillText', (target, thisArg, args) => {
const text = args[0];
const match = text.match(/^Lvl (\d+) (\w*)$/); // problem!
if (match == null) {
return;
}
const newLevel = Number(match[1]);
const newTank = match[2];
// make sure to trigger events for all levels in between.
while (newLevel > this.#level + 1) {
super.emit('level', ++this.#level);
}
if (newLevel !== this.#level) super.emit('level', newLevel);
if (newTank !== this.#tank) super.emit('tank', newTank);
this.#level = newLevel;
this.#tank = match[2];
});
the way to fix the bug.
const match = text.match(/^Lvl (\d+) (\w*)$/); ( x )
const match = text.match(/^Lvl (\d+) (\w*\s?\w*)$/); ( o )
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers