How to use the steamid.Instance function in steamid

To help you get started, we’ve selected a few steamid examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DoctorMcKay / node-steam-user / components / logon.js View on Github external
if (this._logOnDetails.login_key) {
				// Steam doesn't send a new loginkey all the time if you're using a persistent one (remember password). Let's manually emit it on a timer to handle any edge cases.
				this._loginKeyTimer = setTimeout(() => {
					this.emit('loginKey', this._logOnDetails.login_key);
				}, 5000);
			}

			this._saveFile('cellid-' + Helpers.getInternalMachineID() + '.txt', body.cell_id);

			let parental = body.parental_settings ? Messages.decodeProto(Schema.ParentalSettings, body.parental_settings) : null;
			if (parental && parental.salt && parental.passwordhash) {
				let sid = new SteamID();
				sid.universe = this.steamID.universe;
				sid.type = SteamID.Type.INDIVIDUAL;
				sid.instance = SteamID.Instance.DESKTOP;
				sid.accountid = parental.steamid.low;
				parental.steamid = sid;
			}

			if (!this.steamID && body.client_supplied_steamid) {
				// This should ordinarily not happen. this.steamID is supposed to be set in messages.js according to
				// the SteamID in the message header. But apparently, sometimes Steam doesn't set that SteamID
				// appropriately in the log on response message. ¯\_(ツ)_/¯
				this.steamID = new SteamID(body.client_supplied_steamid);
			}

			this.emit('loggedOn', body, parental);
			this.emit('contentServersReady');

			this._getChangelistUpdate();
github DoctorMcKay / node-steamcommunity / components / groups.js View on Github external
var users = $item.find('.whiteLink[data-miniprofile]');
			var sid;
			if(users[0]) {
				sid = new SteamID();
				sid.universe = SteamID.Universe.PUBLIC;
				sid.type = SteamID.Type.INDIVIDUAL;
				sid.instance = SteamID.Instance.DESKTOP;
				sid.accountid = $(users[0]).data('miniprofile');
				data.user = sid;
			}

			if(users[1]) {
				sid = new SteamID();
				sid.universe = SteamID.Universe.PUBLIC;
				sid.type = SteamID.Type.INDIVIDUAL;
				sid.instance = SteamID.Instance.DESKTOP;
				sid.accountid = $(users[1]).data('miniprofile');
				data.actor = sid;
			}

			// Figure out the date. Of course there's no year, because Valve
			var dateParts = $item.find('.historyDate').text().split('@');
			var date = dateParts[0].trim().replace(/(st|nd|th)$/, '').trim() + ', ' + currentYear;
			var time = dateParts[1].trim().replace(/(am|pm)/, ' $1');

			date = new Date(date + ' ' + time + ' UTC');

			// If this date is in the future, or it's later than the previous one, decrement the year
			if(date.getTime() > lastDate) {
				date.setFullYear(date.getFullYear() - 1);
			}
github DoctorMcKay / node-steam-user / components / logon.js View on Github external
this._logOnDetails.machine_id = this._getMachineID(machineID);
		}

		// Do the login
		if (this._logOnDetails._steamid) {
			let sid = this._logOnDetails._steamid;
			if (typeof sid == 'string') {
				sid = new SteamID(sid);
			}

			this._tempSteamID = sid;
		} else {
			let sid = new SteamID();
			sid.universe = SteamID.Universe.PUBLIC;
			sid.type = anonLogin ? SteamID.Type.ANON_USER : SteamID.Type.INDIVIDUAL;
			sid.instance = anonLogin ? SteamID.Instance.ALL : SteamID.Instance.DESKTOP;
			sid.accountid = 0;
			this._tempSteamID = sid;
		}

		if (anonLogin && this._logOnDetails.password) {
			process.stderr.write("[steam-user] Warning: Logging into anonymous Steam account but a password was specified... did you specify your accountName improperly?\n");
		}

		this._doConnection();
	});
};
github DoctorMcKay / node-steam-user / components / chatroom.js View on Github external
return StdLib.Promises.callbackPromise(null, callback, (resolve, reject) => {
		clanSteamID = Helpers.steamID(clanSteamID);
		if (clanSteamID.type != SteamID.Type.CLAN) {
			return reject(new Error("SteamID is not for a clan"));
		}

		// just set these to what they should be
		clanSteamID.universe = SteamID.Universe.PUBLIC;
		clanSteamID.instance = SteamID.Instance.ALL;

		this.user._sendUnified("ClanChatRooms.GetClanChatRoomInfo#1", {
			"steamid": clanSteamID.toString(),
			"autocreate": true
		}, (body, hdr) => {
			if (hdr.proto.eresult == EResult.Busy) {
				// Why "Busy"? Because Valve.
				let err = new Error("Invalid clan ID");
				err.eresult = hdr.proto.eresult;
				return reject(err);
			}

			let err = Helpers.eresultError(hdr.proto);
			if (err) {
				return reject(err);
			}
github DoctorMcKay / node-steam-user / components / notifications.js View on Github external
this.emit('offlineMessages', body.offline_messages, (body.friends_with_offline_messages || []).map(function(accountid) {
		var sid = new SteamID();
		sid.universe = self.steamID.universe;
		sid.type = SteamID.Type.INDIVIDUAL;
		sid.instance = SteamID.Instance.DESKTOP;
		sid.accountid = accountid;
		return sid.toString();
	}));
};
github DoctorMcKay / node-steamcommunity / components / chat.js View on Github external
(body.messages || []).forEach(function(message) {
			var sender = new SteamID();
			sender.universe = SteamID.Universe.PUBLIC;
			sender.type = SteamID.Type.INDIVIDUAL;
			sender.instance = SteamID.Instance.DESKTOP;
			sender.accountid = message.accountid_from;

			switch(message.type) {
				case 'personastate':
					self._chatUpdatePersona(sender);
					break;

				case 'saytext':
					self.emit('chatMessage', sender, message.text);
					break;

				case 'typing':
					self.emit('chatTyping', sender);
					break;

				default:
github DoctorMcKay / node-globaloffensive / index.js View on Github external
GlobalOffensive.prototype.requestPlayersProfile = function(steamid, callback) {
	if (typeof steamid == 'string') {
		steamid = new SteamID(steamid);
	}

	if (!steamid.isValid() || steamid.universe != SteamID.Universe.PUBLIC || steamid.type != SteamID.Type.INDIVIDUAL || steamid.instance != SteamID.Instance.DESKTOP) {
		return false;
	}

	this._send(Language.ClientRequestPlayersProfile, Protos.CMsgGCCStrike15_v2_ClientRequestPlayersProfile, {
		account_id: steamid.accountid,
		request_level: 32
	});

	if (callback) {
		this.once('playersProfile#' + steamid.getSteamID64(), callback);
	}
};
github DoctorMcKay / node-steam-user / components / appauth.js View on Github external
if (ticket.authTicket) {
				authTicket = ticket.authTicket;
			} else {
				ticket = SteamUser.parseAppTicket(ticket);
				if (!ticket) {
					return reject(new Error("Ticket " + idx + " is invalid"));
				}

				authTicket = ticket.authTicket;
			}

			let sid = new SteamID();
			sid.universe = this.steamID.universe;
			sid.type = SteamID.Type.INDIVIDUAL;
			sid.instance = SteamID.Instance.DESKTOP;
			sid.accountid = authTicket.readUInt32LE(12);
			sid = sid.getSteamID64();

			let isOurTicket = (sid == this.steamID.getSteamID64());

			obj.tickets.push({
				"estate": isOurTicket ? 0 : 1,
				"steamid": isOurTicket ? 0 : sid,
				"gameid": appid,
				"h_steam_pipe": this._hSteamPipe,
				"ticket_crc": CRC32.unsigned(authTicket),
				"ticket": authTicket
			});

			obj.app_ids.push(appid);
		});
github DoctorMcKay / node-steam-user / components / friends.js View on Github external
this._send(SteamUser.EMsg.ClientFSGetFriendsSteamLevels, {"accountids": accountids}, (body) => {
			let output = {};

			let sid = new SteamID();
			sid.universe = SteamID.Universe.PUBLIC;
			sid.type = SteamID.Type.INDIVIDUAL;
			sid.instance = SteamID.Instance.DESKTOP;

			(body.friends || []).forEach((user) => {
				sid.accountid = user.accountid;
				output[sid.getSteamID64()] = user.level;
			});

			accept({"users": output});
		});
	});

steamid

Exposes a SteamID object class for easy SteamID management

MIT
Latest version published 3 months ago

Package Health Score

71 / 100
Full package analysis