Commit 87ab7f57 authored by Big Bad Waffle's avatar Big Bad Waffle

can now hook into existing player kind of

parent 00fa0c4c
......@@ -42,9 +42,14 @@ module.exports = {
character.stash = this.stash;
character.account = this.username;
let relog = (this.charname === character.name);
this.charname = character.name;
this.checkLoginReward(data, character);
if (relog) {
data.callback();
atlas.relog(this.obj);
} else
this.checkLoginReward(data, character);
},
checkLoginReward: function (data, character) {
......@@ -278,10 +283,9 @@ module.exports = {
}
this.username = msg.data.username;
let existingId = connections.logOut(this.obj);
console.log(existingId);
if (existingId)
this.obj.id = existingId;
let relogged = connections.logOut(this.obj);
if (relogged)
cons.players.spliceWhere(p => p === this.obj);
await this.getSkins();
......
......@@ -217,6 +217,13 @@ module.exports = {
}, [obj.serverId]);
},
relog: function () {
this.seen = [];
let instance = this.obj.instance;
instance.syncer.queue('onGetMap', instance.map.clientMap, [this.obj.serverId]);
},
move: function (msg) {
atlas.queueAction(this.obj, {
action: 'move',
......
......@@ -136,9 +136,8 @@ module.exports = {
if (p.auth.username === exclude.auth.username) {
p.socket.emit('dc', {});
console.log(p.name, exclude.name);
if (p.name === exclude.name)
return p.id;
p.socket = exclude.socket;
return true;
}
}
},
......
......@@ -90,6 +90,20 @@ module.exports = {
});
},
relog: function (obj) {
this.send(obj.zone, {
method: 'performAction',
args: {
id: obj.id,
instanceId: obj.instanceId,
action: {
cpn: 'player',
method: 'relog'
}
}
});
},
registerCallback: function (callback) {
this.callbacks.push({
id: ++this.lastCallbackId,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment