Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hltv

Package Overview
Dependencies
Maintainers
1
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hltv - npm Package Compare versions

Comparing version 2.11.0 to 2.11.1

3

lib/endpoints/connectToScorebot.d.ts

@@ -8,6 +8,7 @@ import ScoreboardUpdate from '../models/ScoreboardUpdate';

onLogUpdate?: (data: LogUpdate) => any;
onFullLogUpdate?: (data: unknown) => any;
onConnect?: () => any;
onDisconnect?: () => any;
};
declare const connectToScorebot: (config: HLTVConfig) => ({ id, onScoreboardUpdate, onLogUpdate, onConnect, onDisconnect }: ConnectToScorebotParams) => Promise<void>;
declare const connectToScorebot: (config: HLTVConfig) => ({ id, onScoreboardUpdate, onLogUpdate, onFullLogUpdate, onConnect, onDisconnect }: ConnectToScorebotParams) => Promise<void>;
export default connectToScorebot;

@@ -42,5 +42,5 @@ "use strict";

var connectToScorebot = function (config) { return function (_a) {
var id = _a.id, onScoreboardUpdate = _a.onScoreboardUpdate, onLogUpdate = _a.onLogUpdate, onConnect = _a.onConnect, onDisconnect = _a.onDisconnect;
var id = _a.id, onScoreboardUpdate = _a.onScoreboardUpdate, onLogUpdate = _a.onLogUpdate, onFullLogUpdate = _a.onFullLogUpdate, onConnect = _a.onConnect, onDisconnect = _a.onDisconnect;
return __awaiter(_this, void 0, void 0, function () {
var $, url, matchId, socket;
var $, url, matchId, socket, initObject;
return __generator(this, function (_b) {

@@ -51,5 +51,9 @@ switch (_b.label) {

$ = _b.sent();
url = $('#scoreboardElement').attr('data-scorebot-url');
url = $('#scoreboardElement').attr('data-scorebot-url').split(',').pop();
matchId = $('#scoreboardElement').attr('data-scorebot-id');
socket = io.connect(url);
initObject = JSON.stringify({
token: '',
listId: matchId
});
socket.on('connect', function () {

@@ -59,3 +63,3 @@ if (onConnect) {

}
socket.emit('readyForMatch', "{\"token\":\"\",\"listId\":\"" + matchId + "\"}");
socket.emit('readyForMatch', initObject);
socket.on('scoreboard', function (data) {

@@ -71,5 +75,10 @@ if (onScoreboardUpdate) {

});
socket.on('fullLog', function (data) {
if (onFullLogUpdate) {
onFullLogUpdate(JSON.parse(data));
}
});
});
socket.on('reconnect', function () {
socket.emit('readyForMatch', matchId);
socket.emit('readyForMatch', initObject);
});

@@ -76,0 +85,0 @@ socket.on('disconnect', function () {

@@ -55,3 +55,3 @@ "use strict";

return __awaiter(_this, void 0, void 0, function () {
var getMatchInfoRowValues, getPlayerTopStat, _b, m$, p$, matchPageID, map, date, team1, team2, event, teamStatProperties, teamStats, mostXProperties, mostX, overview, fullRoundHistory, _c, rh1, rh2, roundHistory, playerPerformanceStats, playerOverviewStats, playerStats, performanceOverview;
var getMatchInfoRowValues, getPlayerTopStat, _b, m$, p$, matchPageID, matchScore, map, date, team1, team2, event, teamStatProperties, teamStats, mostXProperties, mostX, overview, fullRoundHistory, _c, rh1, rh2, roundHistory, playerPerformanceStats, playerOverviewStats, playerStats, performanceOverview;
return __generator(this, function (_d) {

@@ -81,2 +81,3 @@ switch (_d.label) {

matchPageID = Number(m$('.match-page-link').attr('href').split('/')[2]);
matchScore = [Number(m$('.team-left .bold').text()), Number(m$('.team-right .bold').text())];
map = mappers_1.getMapSlug(m$(m$('.match-info-box').contents().get(3)).text().replace(/\n| /g, ''));

@@ -86,7 +87,9 @@ date = Number(m$('.match-info-box .small-text span').first().attr('data-unix'));

id: Number(E.popSlashSource(m$('.team-left .team-logo'))),
name: m$('.team-left .team-logo').attr('title')
name: m$('.team-left .team-logo').attr('title'),
score: matchScore[0],
};
team2 = {
id: Number(E.popSlashSource(m$('.team-right .team-logo'))),
name: m$('.team-right .team-logo').attr('title')
name: m$('.team-right .team-logo').attr('title'),
score: matchScore[1],
};

@@ -126,3 +129,3 @@ event = {

var performanceStats = playerPerformanceStats[id];
return __assign({ id: id, name: rowEl.find('.st-player a').text(), kills: Number(rowEl.find('.st-kills').contents().first().text()), hsKills: Number(rowEl.find('.st-kills .gtSmartphone-only').text().replace(/\(|\)/g, '')), deaths: Number(rowEl.find('.st-deaths').text()), KAST: Number(rowEl.find('.st-kdratio').text().replace('%', '')), killDeathsDifference: Number(rowEl.find('.st-kddiff').text()), ADR: Number(rowEl.find('.st-adr').text()), firstKillsDifference: Number(rowEl.find('.st-fkdiff').text()), rating: Number(rowEl.find('.st-rating').text()) }, performanceStats);
return __assign({ id: id, name: rowEl.find('.st-player a').text(), kills: Number(rowEl.find('.st-kills').contents().first().text()), hsKills: Number(rowEl.find('.st-kills .gtSmartphone-only').text().replace(/\(|\)/g, '')), assists: Number(rowEl.find('.st-assists').contents().first().text()), flashAssists: Number(rowEl.find('.st-assists .gtSmartphone-only').text().replace(/\(|\)/g, '')), deaths: Number(rowEl.find('.st-deaths').text()), KAST: Number(rowEl.find('.st-kdratio').text().replace('%', '')), killDeathsDifference: Number(rowEl.find('.st-kddiff').text()), ADR: Number(rowEl.find('.st-adr').text()), firstKillsDifference: Number(rowEl.find('.st-fkdiff').text()), rating: Number(rowEl.find('.st-rating').text()) }, performanceStats);
});

@@ -129,0 +132,0 @@ playerStats = {

@@ -55,3 +55,3 @@ "use strict";

return __awaiter(_this, void 0, void 0, function () {
var getMatchInfoRowValues, getPlayerTopStat, m$, matchPageID, date, team1, team2, event, teamStatProperties, teamStats, mostXProperties, mostX, overview, playerOverviewStats, playerStats;
var getMatchInfoRowValues, getPlayerTopStat, m$, matchPageID, matchScore, date, team1, team2, event, teamStatProperties, teamStats, mostXProperties, mostX, overview, playerOverviewStats, playerStats;
return __generator(this, function (_b) {

@@ -78,10 +78,13 @@ switch (_b.label) {

matchPageID = Number(m$('.match-page-link').attr('href').split('/')[2]);
matchScore = [Number(m$('.team-left .bold').text()), Number(m$('.team-right .bold').text())];
date = Number(m$('.match-info-box .small-text span').first().attr('data-unix'));
team1 = {
id: Number(E.popSlashSource(m$('.team-left .team-logo'))),
name: m$('.team-left .team-logo').attr('title')
name: m$('.team-left .team-logo').attr('title'),
score: matchScore[0]
};
team2 = {
id: Number(E.popSlashSource(m$('.team-right .team-logo'))),
name: m$('.team-right .team-logo').attr('title')
name: m$('.team-right .team-logo').attr('title'),
score: matchScore[1]
};

@@ -88,0 +91,0 @@ event = {

@@ -5,21 +5,21 @@ import HLTVConfig from './models/HLTVConfig';

constructor(config: HLTVConfig);
connectToScorebot: ({ id, onScoreboardUpdate, onLogUpdate, onConnect, onDisconnect }: import("./endpoints/connectToScorebot").ConnectToScorebotParams) => Promise<void>;
connectToScorebot: ({ id, onScoreboardUpdate, onLogUpdate, onFullLogUpdate, onConnect, onDisconnect }: import("endpoints/connectToScorebot").ConnectToScorebotParams) => Promise<void>;
getMatch: ({ id }: {
id: number;
}) => Promise<import("./models/FullMatch").default>;
getMatches: () => Promise<(import("./models/UpcomingMatch").default | import("./models/LiveMatch").default)[]>;
getMatchesStats: ({ startDate, endDate, matchType, maps }?: import("./endpoints/getMatchesStats").GetMatchesStatsParams) => Promise<import("./models/MatchStats").default[]>;
}) => Promise<import("models/FullMatch").default>;
getMatches: () => Promise<(import("models/UpcomingMatch").default | import("models/LiveMatch").default)[]>;
getMatchesStats: ({ startDate, endDate, matchType, maps }?: import("endpoints/getMatchesStats").GetMatchesStatsParams) => Promise<import("models/MatchStats").default[]>;
getMatchStats: ({ id }: {
id: number;
}) => Promise<import("./models/FullMatchStats").default>;
}) => Promise<import("models/FullMatchStats").default>;
getMatchMapStats: ({ id }: {
id: number;
}) => Promise<import("./models/FullMatchMapStats").default>;
getRecentThreads: () => Promise<import("./models/Thread").default[]>;
}) => Promise<import("models/FullMatchMapStats").default>;
getRecentThreads: () => Promise<import("models/Thread").default[]>;
getResults: ({ pages }?: {
pages?: number | undefined;
}) => Promise<import("./models/MatchResult").default[]>;
}) => Promise<import("models/MatchResult").default[]>;
getStreams: ({ loadLinks }?: {
loadLinks?: boolean | undefined;
}) => Promise<import("./models/FullStream").default[]>;
}) => Promise<import("models/FullStream").default[]>;
getTeamRanking: ({ year, month, day, country }?: {

@@ -30,15 +30,15 @@ year?: string | undefined;

country?: string | undefined;
}) => Promise<import("./models/TeamRanking").default[]>;
}) => Promise<import("models/TeamRanking").default[]>;
getTeam: ({ id }: {
id: number;
}) => Promise<import("./models/FullTeam").default>;
}) => Promise<import("models/FullTeam").default>;
getTeamStats: ({ id }: {
id: number;
}) => Promise<import("./models/FullTeamStats").default>;
}) => Promise<import("models/FullTeamStats").default>;
getPlayer: ({ id }: {
id: number;
}) => Promise<import("./models/FullPlayer").default>;
}) => Promise<import("models/FullPlayer").default>;
getEvent: ({ id }: {
id: number;
}) => Promise<import("./models/FullEvent").default>;
}) => Promise<import("models/FullEvent").default>;
getPlayerStats: ({ id, startDate, endDate }: {

@@ -48,7 +48,7 @@ id: number;

endDate: string;
}) => Promise<import("./models/FullPlayerStats").default>;
}) => Promise<import("models/FullPlayerStats").default>;
getPlayerRanking: ({ startDate, endDate }: {
startDate: string;
endDate: string;
}) => Promise<import("./models/PlayerRanking").default[]>;
}) => Promise<import("models/PlayerRanking").default[]>;
createInstance(config: HLTVConfig): HLTVFactory;

@@ -55,0 +55,0 @@ }

@@ -9,2 +9,5 @@ import Team from './Team';

}
export interface TeamStat extends Team {
readonly score: number;
}
export interface PlayerStat extends Player {

@@ -32,2 +35,3 @@ readonly value: number;

assists: number;
flashAssists: number;
deaths: number;

@@ -34,0 +38,0 @@ KAST: number;

import Team from './Team';
import Event from './Event';
import Player from './Player';
export interface TeamStat extends Team {
readonly score: number;
}
export interface PlayerStat extends Player {

@@ -5,0 +8,0 @@ readonly value: number;

import WinType from '../enums/WinType';
export declare type Side = 'CT' | 'TERRORIST' | 'SPECTATOR';
export declare type LogEvent = RoundStart | RoundEnd | Kill | BombDefused | BombPlanted | PlayerJoin | PlayerQuit;
export declare type LogEvent = RoundStart | RoundEnd | Restart | MatchStarted | Kill | Assist | Suicide | BombDefused | BombPlanted | PlayerJoin | PlayerQuit;
export interface RoundStart {
RoundStart: {};
}
export interface MatchStarted {
MatchStarted: {
map: string;
};
}
export interface Restart {
Restart: {};
}
export interface PlayerJoin {

@@ -38,4 +46,24 @@ PlayerJoin: {

headShot: boolean;
eventId: number;
};
}
export interface Assist {
Assist: {
assisterName: string;
assisterNick: string;
assisterSide: Side;
victimNick: string;
victimName: string;
victimSide: Side;
killEventId: number;
};
}
export interface Suicide {
Suicide: {
playerName: string;
playerNick: string;
side: Side;
weapon: string;
};
}
export interface BombDefused {

@@ -50,2 +78,3 @@ BombDefused: {

playerName: string;
playerNick: string;
ctPlayers: number;

@@ -52,0 +81,0 @@ tPlayers: number;

@@ -13,5 +13,15 @@ import WinType from '../enums/WinType';

hp: number;
primaryWeapon: string;
kevlar: boolean;
helmet: boolean;
nick: string;
hasDefuseKit: boolean;
advancedStats: {
kast: number;
entryKills: number;
entryDeaths: number;
multiKillRounds: number;
oneOnXWins: number;
flashAssists: number;
};
}

@@ -44,3 +54,8 @@ export interface ScoreboardRound {

frozen: boolean;
live: boolean;
ctTeamScore: number;
tTeamScore: number;
startingCt: number;
startingT: number;
}
export default ScoreboardUpdate;
{
"name": "hltv",
"version": "2.11.0",
"version": "2.11.1",
"description": "The unofficial HLTV Node.js API",

@@ -48,3 +48,3 @@ "main": "lib/index.js",

"ts-jest": "^23.1.4",
"ts-node": "^7.0.0",
"ts-node": "^8.0.2",
"typescript": "^3.0.1"

@@ -51,0 +51,0 @@ },

@@ -349,2 +349,3 @@ [![Dependency Status](https://david-dm.org/gigobyte/hltv.svg)](https://david-dm.org/gigobyte/hltv)

| onLogUpdate | function? | - | Callback that is called when there is new game log data |
| onFullLogUpdate | function? | - | It's still unclear when this is called and with what data, if you find out please let me know!
| onConnect | function? | - | Callback that is called when a connection with the scorebot is established |

@@ -351,0 +352,0 @@ | onDisconnect | function? | - | Callback that is called when the scorebot disconnects |

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc