Skip to content

Commit

Permalink
fix overwatch bans showing expiration time
Browse files Browse the repository at this point in the history
  • Loading branch information
dumbasPL committed Jun 4, 2021
1 parent d0d8030 commit 6773c26
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 13 additions & 0 deletions helpers/util.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module.exports = {
penalty_reason_string,
penalty_reason_permanent,
protoDecode,
protoEncode
}
Expand Down Expand Up @@ -29,6 +30,18 @@ function penalty_reason_string(id) {
}
}

function penalty_reason_permanent(id) {
switch (id)
{
case 8:
case 14:
case 10:
return true;
default:
return false;
}
}

function protoDecode(proto, obj) {
return proto.toObject(proto.decode(obj), { defaults: true });
}
Expand Down
4 changes: 2 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var User = require('steam-user');
const fs = require('fs');
const util = require('util');
const {EOL} = require('os');
const { penalty_reason_string, protoDecode, protoEncode } = require('./helpers/util.js');
const { penalty_reason_string, protoDecode, protoEncode, penalty_reason_permanent } = require('./helpers/util.js');
const Protos = require('./helpers/protos.js')([{
name: 'csgo',
protos: [
Expand Down Expand Up @@ -361,7 +361,7 @@ function check_account(username, pass) {
currently_checking = currently_checking.filter(x => x !== username);
// console.log(util.inspect(msg, false, null));
data.penalty_reason = steamClient.limitations.communityBanned ? 'Community ban' : msg.penalty_reason > 0 ? penalty_reason_string(msg.penalty_reason) : msg.vac_banned ? 'VAC' : 0;
data.penalty_seconds = msg.vac_banned || steamClient.limitations.communityBanned ? -1 : msg.penalty_seconds > 0 ? (Math.floor(Date.now() / 1000) + msg.penalty_seconds) : 0;
data.penalty_seconds = msg.vac_banned || steamClient.limitations.communityBanned || penalty_reason_permanent(msg.penalty_reason) ? -1 : msg.penalty_seconds > 0 ? (Math.floor(Date.now() / 1000) + msg.penalty_seconds) : 0;
data.wins = msg.vac_banned ? -1 : attempts < 5 ? msg.ranking.wins : 0;
data.rank = msg.vac_banned ? -1 : attempts < 5 ? msg.ranking.rank_id : 0;
data.name = steamClient.accountInfo.name;
Expand Down

0 comments on commit 6773c26

Please sign in to comment.