Comparing version 2.11.0 to 2.12.0
@@ -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,3 +5,3 @@ 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 }: { | ||
@@ -8,0 +8,0 @@ id: number; |
@@ -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 | Kill | Assist | BombDefused | BombPlanted | PlayerJoin | PlayerQuit; | ||
export interface RoundStart { | ||
@@ -38,4 +38,16 @@ RoundStart: {}; | ||
headShot: boolean; | ||
eventId: number; | ||
}; | ||
} | ||
export interface Assist { | ||
Assist: { | ||
asissterName: string; | ||
assisterNick: string; | ||
assisterSide: Side; | ||
victimNick: string; | ||
victimName: string; | ||
victimSide: Side; | ||
killEventId: number; | ||
}; | ||
} | ||
export interface BombDefused { | ||
@@ -50,2 +62,3 @@ BombDefused: { | ||
playerName: string; | ||
playerNick: string; | ||
ctPlayers: number; | ||
@@ -52,0 +65,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.12.0", | ||
"description": "The unofficial HLTV Node.js API", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
324658
2853
365