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