1: <?php
2: /**
3: * This file is part of GameQ.
4: *
5: * GameQ is free software; you can redistribute it and/or modify
6: * it under the terms of the GNU Lesser General Public License as published by
7: * the Free Software Foundation; either version 3 of the License, or
8: * (at your option) any later version.
9: *
10: * GameQ is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13: * GNU Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public License
16: * along with this program. If not, see <http://www.gnu.org/licenses/>.
17: */
18:
19: namespace GameQ\Protocols;
20:
21: use GameQ\Buffer;
22:
23: /**
24: * Class Rust
25: *
26: * @package GameQ\Protocols
27: * @author Austin Bischoff <austin@codebeard.com>
28: */
29: class Rust extends Source
30: {
31:
32: /**
33: * String name of this protocol class
34: *
35: * @type string
36: */
37: protected $name = 'rust';
38:
39: /**
40: * Longer string name of this protocol class
41: *
42: * @type string
43: */
44: protected $name_long = "Rust";
45:
46: /**
47: * Overload so we can get max players from mp of keywords and num players from cp keyword
48: *
49: * @param Buffer $buffer
50: */
51: protected function processDetails(Buffer $buffer)
52: {
53: $results = parent::processDetails($buffer);
54:
55: if ($results['keywords']) {
56: //get max players from mp of keywords and num players from cp keyword
57: preg_match_all('/(mp|cp)([\d]+)/', $results['keywords'], $matches);
58: $results['max_players'] = intval($matches[2][0]);
59: $results['num_players'] = intval($matches[2][1]);
60: }
61:
62: return $results;
63: }
64: }
65: