Closed gurumnyang closed 2 years ago
[ /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]; });
const match = text.match(/^Lvl (\d+) (\w*)$/); ( x ) const match = text.match(/^Lvl (\d+) (\w*\s?\w*)$/); ( o )
const match = text.match(/^Lvl (\d+) (\w*)$/);
const match = text.match(/^Lvl (\d+) (\w*\s?\w*)$/);
Closed by #44
diepAPI.player.level cannot detect level if tank type name contains a blank character.
[ /diepAPI/src/player.ts ]
the way to fix the bug.
const match = text.match(/^Lvl (\d+) (\w*)$/);
( x )const match = text.match(/^Lvl (\d+) (\w*\s?\w*)$/);
( o )