2021-06-03 11:51:03 -04:00
|
|
|
|
let rconParser;
|
|
|
|
|
let eventParser;
|
|
|
|
|
|
|
|
|
|
const plugin = {
|
|
|
|
|
author: 'RaidMax',
|
2022-03-28 19:05:18 -04:00
|
|
|
|
version: 0.5,
|
2021-06-03 11:51:03 -04:00
|
|
|
|
name: 'CS:GO Parser',
|
|
|
|
|
engine: 'Source',
|
|
|
|
|
isParser: true,
|
|
|
|
|
|
|
|
|
|
onEventAsync: function (gameEvent, server) {
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onLoadAsync: function (manager) {
|
2021-06-11 12:52:30 -04:00
|
|
|
|
rconParser = manager.GenerateDynamicRConParser(this.name);
|
|
|
|
|
eventParser = manager.GenerateDynamicEventParser(this.name);
|
2021-06-03 11:51:03 -04:00
|
|
|
|
rconParser.RConEngine = this.engine;
|
|
|
|
|
|
|
|
|
|
rconParser.Configuration.StatusHeader.Pattern = 'userid +name +uniqueid +connected +ping +loss +state +rate +adr';
|
|
|
|
|
|
|
|
|
|
rconParser.Configuration.MapStatus.Pattern = '^map *: +(.+)$';
|
|
|
|
|
rconParser.Configuration.MapStatus.AddMapping(111, 1);
|
|
|
|
|
|
|
|
|
|
rconParser.Configuration.HostnameStatus.Pattern = '^hostname: +(.+)$';
|
2023-09-02 16:37:10 -04:00
|
|
|
|
rconParser.Configuration.HostnameStatus.AddMapping(113, 1);
|
2021-06-03 11:51:03 -04:00
|
|
|
|
|
2021-06-11 12:52:30 -04:00
|
|
|
|
rconParser.Configuration.MaxPlayersStatus.Pattern = '^players *: +\\d+ humans, \\d+ bots \\((\\d+).+';
|
2023-09-02 16:37:10 -04:00
|
|
|
|
rconParser.Configuration.MaxPlayersStatus.AddMapping(114, 1);
|
2021-06-03 11:51:03 -04:00
|
|
|
|
|
2021-06-11 12:52:30 -04:00
|
|
|
|
rconParser.Configuration.Dvar.Pattern = '^"(.+)" = "(.+)" (?:\\( def. "(.*)" \\))?(?: |\\w)+- (.+)$';
|
2021-06-03 11:51:03 -04:00
|
|
|
|
rconParser.Configuration.Dvar.AddMapping(106, 1);
|
|
|
|
|
rconParser.Configuration.Dvar.AddMapping(107, 2);
|
|
|
|
|
rconParser.Configuration.Dvar.AddMapping(108, 3);
|
|
|
|
|
rconParser.Configuration.Dvar.AddMapping(109, 3);
|
|
|
|
|
|
2021-06-11 12:52:30 -04:00
|
|
|
|
rconParser.Configuration.Status.Pattern = '^#\\s*(\\d+) (\\d+) "(.+)" (\\S+) +(\\d+:\\d+(?::\\d+)?) (\\d+) (\\S+) (\\S+) (\\d+) (\\d+\\.\\d+\\.\\d+\\.\\d+:\\d+)$';
|
2021-06-03 11:51:03 -04:00
|
|
|
|
rconParser.Configuration.Status.AddMapping(100, 2);
|
2021-06-16 09:53:50 -04:00
|
|
|
|
rconParser.Configuration.Status.AddMapping(101, -1);
|
2021-06-03 11:51:03 -04:00
|
|
|
|
rconParser.Configuration.Status.AddMapping(102, 6);
|
|
|
|
|
rconParser.Configuration.Status.AddMapping(103, 4)
|
|
|
|
|
rconParser.Configuration.Status.AddMapping(104, 3);
|
|
|
|
|
rconParser.Configuration.Status.AddMapping(105, 10);
|
|
|
|
|
rconParser.Configuration.Status.AddMapping(200, 1);
|
|
|
|
|
|
|
|
|
|
rconParser.Configuration.DefaultDvarValues.Add('sv_running', '1');
|
|
|
|
|
rconParser.Configuration.DefaultDvarValues.Add('version', this.engine);
|
|
|
|
|
rconParser.Configuration.DefaultDvarValues.Add('fs_basepath', '');
|
|
|
|
|
rconParser.Configuration.DefaultDvarValues.Add('fs_basegame', '');
|
2021-08-27 21:47:06 -04:00
|
|
|
|
rconParser.Configuration.DefaultDvarValues.Add('fs_homepath', '');
|
2021-06-03 11:51:03 -04:00
|
|
|
|
rconParser.Configuration.DefaultDvarValues.Add('g_log', '');
|
|
|
|
|
rconParser.Configuration.DefaultDvarValues.Add('net_ip', 'localhost');
|
|
|
|
|
|
|
|
|
|
rconParser.Configuration.OverrideDvarNameMapping.Add('sv_hostname', 'hostname');
|
|
|
|
|
rconParser.Configuration.OverrideDvarNameMapping.Add('mapname', 'host_map');
|
|
|
|
|
rconParser.Configuration.OverrideDvarNameMapping.Add('sv_maxclients', 'maxplayers');
|
|
|
|
|
rconParser.Configuration.OverrideDvarNameMapping.Add('g_gametype', 'game_type'); // todo: will need gamemode too
|
|
|
|
|
rconParser.Configuration.OverrideDvarNameMapping.Add('fs_game', 'game_mode');
|
|
|
|
|
rconParser.Configuration.OverrideDvarNameMapping.Add('g_password', 'sv_password');
|
|
|
|
|
|
2021-11-26 21:49:58 -05:00
|
|
|
|
rconParser.Configuration.ColorCodeMapping.Clear();
|
|
|
|
|
rconParser.Configuration.ColorCodeMapping.Add('White', '\x01');
|
|
|
|
|
rconParser.Configuration.ColorCodeMapping.Add('Red', '\x07');
|
|
|
|
|
rconParser.Configuration.ColorCodeMapping.Add('LightRed', '\x0F');
|
|
|
|
|
rconParser.Configuration.ColorCodeMapping.Add('DarkRed', '\x02');
|
|
|
|
|
rconParser.Configuration.ColorCodeMapping.Add('Blue', '\x0B');
|
|
|
|
|
rconParser.Configuration.ColorCodeMapping.Add('DarkBlue', '\x0C');
|
|
|
|
|
rconParser.Configuration.ColorCodeMapping.Add('Purple', '\x03');
|
|
|
|
|
rconParser.Configuration.ColorCodeMapping.Add('Orchid', '\x0E');
|
|
|
|
|
rconParser.Configuration.ColorCodeMapping.Add('Yellow', '\x09');
|
|
|
|
|
rconParser.Configuration.ColorCodeMapping.Add('Gold', '\x10');
|
|
|
|
|
rconParser.Configuration.ColorCodeMapping.Add('LightGreen', '\x05');
|
|
|
|
|
rconParser.Configuration.ColorCodeMapping.Add('Green', '\x04');
|
|
|
|
|
rconParser.Configuration.ColorCodeMapping.Add('Lime', '\x06');
|
|
|
|
|
rconParser.Configuration.ColorCodeMapping.Add('Grey', '\x08');
|
|
|
|
|
rconParser.Configuration.ColorCodeMapping.Add('Grey2', '\x0D');
|
|
|
|
|
// only adding there here for the default accent color
|
|
|
|
|
rconParser.Configuration.ColorCodeMapping.Add('Cyan', '\x0B');
|
|
|
|
|
|
2021-06-03 11:51:03 -04:00
|
|
|
|
rconParser.Configuration.NoticeLineSeparator = '. ';
|
2021-11-14 22:38:00 -05:00
|
|
|
|
rconParser.Configuration.DefaultRConPort = 27015;
|
2021-06-03 11:51:03 -04:00
|
|
|
|
rconParser.CanGenerateLogPath = false;
|
|
|
|
|
|
|
|
|
|
rconParser.Configuration.CommandPrefixes.RConGetInfo = undefined;
|
|
|
|
|
rconParser.Configuration.CommandPrefixes.Kick = 'kickid {0} "{1}"';
|
|
|
|
|
rconParser.Configuration.CommandPrefixes.Ban = 'kickid {0} "{1}"';
|
|
|
|
|
rconParser.Configuration.CommandPrefixes.TempBan = 'kickid {0} "{1}"';
|
|
|
|
|
rconParser.Configuration.CommandPrefixes.Say = 'say {0}';
|
|
|
|
|
rconParser.Configuration.CommandPrefixes.Tell = 'say [{0}] {1}'; // no tell exists in vanilla
|
|
|
|
|
|
2021-07-10 22:37:51 -04:00
|
|
|
|
eventParser.Configuration.Say.Pattern = '^"(.+)<(\\d+)><(.+)><(.*?)>" (?:say|say_team) "(.*)"$';
|
2021-06-03 11:51:03 -04:00
|
|
|
|
eventParser.Configuration.Say.AddMapping(5, 1);
|
|
|
|
|
eventParser.Configuration.Say.AddMapping(3, 2);
|
|
|
|
|
eventParser.Configuration.Say.AddMapping(1, 3);
|
|
|
|
|
eventParser.Configuration.Say.AddMapping(7, 4);
|
|
|
|
|
eventParser.Configuration.Say.AddMapping(13, 5);
|
|
|
|
|
|
2021-07-10 22:37:51 -04:00
|
|
|
|
eventParser.Configuration.Kill.Pattern = '^"(.+)<(\\d+)><(.+)><(.*)>" \\[-?\\d+ -?\\d+ -?\\d+\\] killed "(.+)<(\\d+)><(.+)><(.*)>" \\[-?\\d+ -?\\d+ -?\\d+\\] with "(\\S*)" *(?:\\((\\w+)((?: ).+)?\\))?$';
|
2021-06-03 11:51:03 -04:00
|
|
|
|
eventParser.Configuration.Kill.AddMapping(5, 1);
|
|
|
|
|
eventParser.Configuration.Kill.AddMapping(3, 2);
|
|
|
|
|
eventParser.Configuration.Kill.AddMapping(1, 3);
|
|
|
|
|
eventParser.Configuration.Kill.AddMapping(7, 4);
|
|
|
|
|
eventParser.Configuration.Kill.AddMapping(6, 5);
|
|
|
|
|
eventParser.Configuration.Kill.AddMapping(4, 6);
|
|
|
|
|
eventParser.Configuration.Kill.AddMapping(2, 7);
|
|
|
|
|
eventParser.Configuration.Kill.AddMapping(8, 8);
|
|
|
|
|
eventParser.Configuration.Kill.AddMapping(9, 9);
|
2021-07-11 10:58:02 -04:00
|
|
|
|
eventParser.Configuration.Kill.AddMapping(12, 10);
|
2022-03-28 19:05:18 -04:00
|
|
|
|
|
|
|
|
|
eventParser.Configuration.MapEnd.Pattern = '^World triggered "Match_Start" on "(.+)"$';
|
|
|
|
|
|
|
|
|
|
eventParser.Configuration.JoinTeam.Pattern = '^"(.+)<(\\d+)><(.*)>" switched from team <(.+)> to <(.+)>$';
|
|
|
|
|
eventParser.Configuration.JoinTeam.AddMapping(5, 1);
|
|
|
|
|
eventParser.Configuration.JoinTeam.AddMapping(3, 2);
|
|
|
|
|
eventParser.Configuration.JoinTeam.AddMapping(1, 3);
|
|
|
|
|
eventParser.Configuration.JoinTeam.AddMapping(7, 5);
|
|
|
|
|
|
|
|
|
|
eventParser.Configuration.TeamMapping.Add('CT', 2);
|
|
|
|
|
eventParser.Configuration.TeamMapping.Add('TERRORIST', 3);
|
2021-06-03 11:51:03 -04:00
|
|
|
|
|
|
|
|
|
eventParser.Configuration.Time.Pattern = '^L [01]\\d/[0-3]\\d/\\d+ - [0-2]\\d:[0-5]\\d:[0-5]\\d:';
|
|
|
|
|
|
|
|
|
|
rconParser.Version = 'CSGO';
|
|
|
|
|
rconParser.GameName = 10; // CSGO
|
|
|
|
|
eventParser.Version = 'CSGO';
|
|
|
|
|
eventParser.GameName = 10; // CSGO
|
2021-06-16 09:53:50 -04:00
|
|
|
|
eventParser.URLProtocolFormat = 'steam://connect/{{ip}}:{{port}}';
|
2021-06-03 11:51:03 -04:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onUnloadAsync: function () {
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onTickAsync: function (server) {
|
|
|
|
|
}
|
2022-03-28 19:05:18 -04:00
|
|
|
|
};
|