wp_auth.getUserMeta( user_id, 'pubcomp_steam_id', function( data ) { if ( typeof data == 'string' ) { var id64 = new bignumber( data ); data = 'STEAM_0:' + id64.mod( new bignumber( '2' ) ).toString() + ':' + id64.subtract( new bignumber( '76561197960265728' ) ).shiftRight( 1 ).toString(); rcon.send( 'pubcomp_add_steamid ' + data ); client.send({ 'joinserver': config.SERVERIP + ':27015' }); return; } } );
Parser.prototype.writeDate = function(value) { var bigInt, i = 0, numBytes = 8; if (value instanceof Date) value = Date.getTime(); else if (typeof value !== 'number') throw new Error('Date type must be a Date or number'); bigInt = new BigInteger(value.toString()); this.writeLong(bigInt.multiply(thousand)); };
NTLMAuth.prototype.createTimestamp = function(time) { var bigTime = new BigInteger(""+time); var timestamp = bigTime.add(new BigInteger(""+11644473600000)).multiply(new BigInteger(""+10000)).toString(16); var padded = "00000000" + timestamp; timestamp = padded.substr(padded-16); var result = new Buffer(8); for ( var idx = 8; idx>0 ; idx--) { result[idx-1] = parseInt(timestamp.substr(timestamp.length-(2*idx), 2), 16); } if ( this.debug ) { console.log("Timestamp: " + time); console.log("Timestamp Array"); this.hexDump(result); } return result; };
Parser.prototype.writeDecimal = function(value) { var bytes, bigInt, numBytes = 16, decimalPlaces = 12; if (value == null) value = '-170141183460469231731687303715884105728'; if (typeof value === 'number') value = value.toString(); if (typeof value != 'string' || !/^-?\d*\.?\d*$/.test(value)) throw new Error('Decimal type must be a numerical string or Number:' + value); // add decimal and missing zeros var parts = value.split('.'); if (parts.length == 1) parts.push('000000000000'); else parts[1] += zeros(12 - parts[1].length).join(''); bigInt = new BigInteger(parts.join('')); bytes = bigInt.toByteArray(); bytes = bytes[0] > 0 ? zeros(numBytes - bytes.length).concat(bytes) : ones(numBytes - bytes.length).concat(bytes); for (var i = 0; i < numBytes; i++) ctype.wsint8(bytes[i], endian, this.buffer, this.position + i); this.position += numBytes; };
Parser.prototype.readDecimal = function() { var bytes = [], bigInt, numBytes = 16, decimalPlaces = 12; for (var i = 0; i < numBytes; i++) bytes.push(ctype.ruint8(this.buffer, endian, this.position + i)); this.position += numBytes; bigInt = new BigInteger(bytes); var val = bigInt.toString(); // handle the null value case if (val === '-170141183460469231731687303715884105728') { val = null; } else if (val.length <= 12) { // add leading zeros (e.g. 123 to 0.000000000123) val = zeros(decimalPlaces - val.length).join('') + val; val = '0.' + val; } else { // put the decimal in the right place val = val.slice(0, -decimalPlaces) + '.' + val.slice(-decimalPlaces); val = val.replace(/0+$/, ''); // trim the trailing zeros } return val; };