Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit eb51d1bf8f4fe850cda586b2e64b6047f4d170b7
Author: thomas-crane <thomasgcrane@gmail.com>
Date:   Fri May 1 09:36:37 2020 +1000

    fix(client): update char info cache on char create
  • Loading branch information
thomas-crane committed Apr 30, 2020
1 parent d29e4cb commit eb2ca4b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nrelay",
"version": "8.8.4",
"version": "8.8.5",
"description": "A console based modular client for Realm of the Mad God built with Node.js and TypeScript.",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
7 changes: 6 additions & 1 deletion src/core/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ export class Client {
} else {
this.charInfo = { charId: 0, nextCharId: 1, maxNumChars: 1 };
}
this.needsNewCharacter = this.charInfo.charId === 0;
this.needsNewCharacter = this.charInfo.charId < 1;
this.internalServer = Object.assign({}, server);
this.nexusServer = Object.assign({}, server);

Expand Down Expand Up @@ -687,12 +687,17 @@ export class Client {
this.connectionGuid = mapInfoPacket.connectionGuid;
this.safeMap = mapInfoPacket.name === 'Nexus';
if (this.needsNewCharacter) {
// create the character.
const createPacket = new CreatePacket();
createPacket.classType = Classes.Wizard;
createPacket.skinType = 0;
Logger.log(this.alias, 'Creating new character', LogLevel.Info);
this.send(createPacket);
this.needsNewCharacter = false;
// update the char info cache.
this.charInfo.charId = this.charInfo.nextCharId;
this.charInfo.nextCharId += 1;
this.runtime.accountService.updateCharInfoCache(this.guid, this.charInfo);
} else {
const loadPacket = new LoadPacket();
loadPacket.charId = this.charInfo.charId;
Expand Down

0 comments on commit eb2ca4b

Please sign in to comment.