From 71fc9efce9c1afb09353bdf05161bc986cf49622 Mon Sep 17 00:00:00 2001 From: sD Date: Wed, 18 Dec 2019 20:01:49 +0100 Subject: some defaults for fucked inis --- webAO/client.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/webAO/client.js b/webAO/client.js index 0865f68..9a663f2 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -550,8 +550,17 @@ class Client extends EventEmitter { const cinidata = await request(AO_HOST + "characters/" + escape(chargs[0].toLowerCase()) + "/char.ini"); cini = INI.parse(cinidata.toLowerCase()); } catch(err) { - cini = {options: {name: chargs[0].toLowerCase(),showname: chargs[0],side: "def", gender: "male"}}; + cini = {}; } + if (cini.options.name === undefined) + cini.options.name = chargs[0].toLowerCase(); + if (cini.options.showname === undefined) + cini.options.showname = chargs[0]; + if (cini.options.side === undefined) + cini.options.side = "def"; + if (cini.options.gender === undefined) + cini.options.gender = "male"; + console.log(cini); this.chars[charid] = { name: chargs[0], -- cgit