2020-08-27 13:09:35 +01:00
|
|
|
const osu = require("osu-packet"),
|
|
|
|
getUserById = require("../util/getUserById.js");
|
|
|
|
|
2021-01-26 12:26:46 +00:00
|
|
|
module.exports = function(currentUser, id = 0, sendImmidiate = true) {
|
2020-08-27 13:09:35 +01:00
|
|
|
const osuPacketWriter = new osu.Bancho.Writer;
|
|
|
|
|
|
|
|
const User = getUserById(id);
|
|
|
|
|
|
|
|
if (User == null) return;
|
|
|
|
|
2021-01-26 12:26:46 +00:00
|
|
|
osuPacketWriter.UserPresence({
|
2020-08-27 13:09:35 +01:00
|
|
|
userId: id,
|
|
|
|
username: User.username,
|
|
|
|
timezone: 0,
|
|
|
|
countryId: User.countryID,
|
|
|
|
permissions: 4,
|
|
|
|
longitude: User.location[1],
|
|
|
|
latitude: User.location[0],
|
|
|
|
rank: User.rank
|
2021-01-26 12:26:46 +00:00
|
|
|
});
|
2020-08-27 13:09:35 +01:00
|
|
|
|
2021-01-26 12:26:46 +00:00
|
|
|
if (sendImmidiate) currentUser.addActionToQueue(osuPacketWriter.toBuffer);
|
|
|
|
else return osuPacketWriter.toBuffer;
|
2020-08-27 13:09:35 +01:00
|
|
|
}
|