81 lines
3.1 KiB
TypeScript
81 lines
3.1 KiB
TypeScript
import {Injectable} from '@angular/core';
|
|
import {AppConfig} from '../../app.config';
|
|
import {HttpClient} from '../http-client';
|
|
import {URLSearchParams} from '@angular/http';
|
|
|
|
@Injectable()
|
|
export class LogsService {
|
|
|
|
constructor(private http: HttpClient,
|
|
private config: AppConfig) {
|
|
}
|
|
|
|
getFullLog(warId: string) {
|
|
return this.http.get(this.config.apiLogsPath + '/' + warId)
|
|
.map(res => res.json());
|
|
}
|
|
|
|
getBudgetLogs(warId: string, fraction = '') {
|
|
const params = new URLSearchParams();
|
|
params.append('fraction', fraction);
|
|
return this.http.get(this.config.apiLogsPath + '/' + warId + '/budget', params)
|
|
.map(res => res.json());
|
|
}
|
|
|
|
getRespawnLogs(warId: string, playerName = '') {
|
|
const params = new URLSearchParams();
|
|
params.append('player', playerName);
|
|
return this.http.get(this.config.apiLogsPath + '/' + warId + '/respawn', params)
|
|
.map(res => res.json());
|
|
}
|
|
|
|
getPointsLogs(warId: string, fraction = '') {
|
|
const params = new URLSearchParams();
|
|
params.append('fraction', fraction);
|
|
return this.http.get(this.config.apiLogsPath + '/' + warId + '/points', params)
|
|
.map(res => res.json());
|
|
}
|
|
|
|
getReviveLogs(warId: string, medicName = '', patientName = '', fraction = '', stabilizedOnly = false, reviveOnly = false) {
|
|
const params = new URLSearchParams();
|
|
params.append('medic', medicName);
|
|
params.append('patient', patientName);
|
|
params.append('fraction', fraction);
|
|
params.append('stabilized', stabilizedOnly ? 'true' : '');
|
|
params.append('revive', reviveOnly ? 'true' : '');
|
|
return this.http.get(this.config.apiLogsPath + '/' + warId + '/revive', params)
|
|
.map(res => res.json());
|
|
}
|
|
|
|
getKillLogs(warId: string, shooterName = '', targetName = '', fraction = '', friendlyFireOnly = false, notFriendlyFireOnly = false) {
|
|
const params = new URLSearchParams();
|
|
params.append('shooter', shooterName);
|
|
params.append('target', targetName);
|
|
params.append('fraction', fraction);
|
|
params.append('friendlyFire', friendlyFireOnly ? 'true' : '');
|
|
params.append('noFriendlyFire', notFriendlyFireOnly ? 'true' : '');
|
|
return this.http.get(this.config.apiLogsPath + '/' + warId + '/kills', params)
|
|
.map(res => res.json());
|
|
}
|
|
|
|
getTransportLogs(warId: string, driverName = '', passengerName = '', fraction = '') {
|
|
const params = new URLSearchParams();
|
|
params.append('driver', driverName);
|
|
params.append('passenger', passengerName);
|
|
params.append('fraction', fraction);
|
|
return this.http.get(this.config.apiLogsPath + '/' + warId + '/transport', params)
|
|
.map(res => res.json());
|
|
}
|
|
|
|
getFlagLogs(warId: string, playerName = '', fraction = '', captureOnly = false, defendOnly = false) {
|
|
const params = new URLSearchParams();
|
|
params.append('player', playerName);
|
|
params.append('fraction', fraction);
|
|
params.append('capture', captureOnly ? 'true' : '');
|
|
params.append('defend', defendOnly ? 'true' : '');
|
|
return this.http.get(this.config.apiLogsPath + '/' + warId + '/flag', params)
|
|
.map(res => res.json());
|
|
}
|
|
|
|
}
|