Skip to content
This repository was archived by the owner on May 26, 2023. It is now read-only.

Commit fb89ab8

Browse files
authored
Merge pull request #167 from ExpDev07/dev
New features
2 parents 0c980ef + 31cee6d commit fb89ab8

File tree

9 files changed

+99
-10
lines changed

9 files changed

+99
-10
lines changed

app/Http/Controllers/HomeController.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
use App\Ban;
66
use App\Helpers\GeneralHelper;
77
use App\Http\Resources\BanResource;
8+
use App\Http\Resources\PlayerIndexResource;
89
use App\Server;
910
use App\Player;
1011
use Illuminate\Http\Request;
12+
use Illuminate\Support\Facades\DB;
1113
use Inertia\Inertia;
1214
use Inertia\Response;
1315

@@ -38,10 +40,18 @@ public function render(Request $request): Response
3840
->orderByDesc('timestamp')
3941
->limit(8)->get())->toArray($request);
4042

43+
$playerList = Player::getAllOnlinePlayers(true);
44+
$players = array_keys($playerList);
45+
usort($players, function ($a, $b) use ($playerList) {
46+
return $playerList[$a]['id'] <=> $playerList[$b]['id'];
47+
});
48+
$staff = Player::query()->where('is_staff', '=', true)->whereIn('steam_identifier', $players)->get();
49+
4150
return Inertia::render('Home', [
4251
'quote' => $quote,
4352
'bans' => $bans,
4453
'playerMap' => Player::fetchSteamPlayerNameMap($bans, 'identifier'),
54+
'staff' => PlayerIndexResource::collection($staff),
4555
]);
4656
}
4757

package-lock.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"leaflet": "^1.7.1",
4343
"leaflet-gesture-handling": "^1.2.1",
4444
"leaflet-rotatedmarker": "^0.2.0",
45+
"rainbowvis.js": "^1.0.1",
4546
"vue-clipboard2": "^0.3.1",
4647
"vue-linkify": "^1.0.1",
4748
"vue2-circle-progress": "^1.2.3"

public/images/icons/ems_car.png

2.65 KB
Loading

public/images/icons/police_car.png

2.83 KB
Loading

resources/js/Pages/Home.vue

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,17 @@
7474
</table>
7575
</div>
7676

77+
<div class="mt-5">
78+
<h3 class="dark:text-white">
79+
{{ t('home.staff') }}
80+
</h3>
81+
<div class="flex flex-wrap -mx-3">
82+
<inertia-link class="block px-4 py-2 font-semibold text-center text-white bg-green-600 rounded m-3" v-for="player in staff" :key="player.id" :href="'/players/' + player.identifier">
83+
{{ player.playerName }}
84+
</inertia-link>
85+
</div>
86+
</div>
87+
7788
</div>
7889
</template>
7990

@@ -147,6 +158,10 @@ export default {
147158
type: Array,
148159
required: true,
149160
},
161+
staff: {
162+
type: Array,
163+
required: true,
164+
},
150165
playerMap: {
151166
type: Object,
152167
required: true,

resources/js/Pages/Map/Index.vue

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<div class="-mt-12" id="map-wrapper">
3333
<div class="relative">
3434
<div id="map" class="w-map max-w-full relative h-max"></div>
35-
<pre class="bg-opacity-70 bg-white coordinate-attr absolute bottom-0 left-0 cursor-pointer z-1k" @click="copyText($event, clickedCoords)" v-if="clickedCoords">{{ clickedCoords }}</pre>
35+
<pre class="bg-opacity-70 bg-white coordinate-attr absolute bottom-0 left-0 cursor-pointer z-1k" v-if="clickedCoords"><span @click="copyText($event, clickedCoords)">{{ clickedCoords }}</span> / <span @click="copyText($event, coordsCommand)">{{ t('map.command') }}</span></pre>
3636
</div>
3737
<div v-if="afkPeople" class="w-map-right pt-4">
3838
<h3 class="mb-2">{{ t('map.afk_title') }}</h3>
@@ -51,6 +51,7 @@ import L from "leaflet";
5151
import {GestureHandling} from "leaflet-gesture-handling";
5252
import "leaflet-rotatedmarker";
5353
import custom_icons from "../../data/vehicles.json";
54+
const Rainbow = require('rainbowvis.js');
5455
5556
(function(global){
5657
let MarkerMixin = {
@@ -99,6 +100,7 @@ export default {
99100
trackedPlayer: window.location.hash.substr(1),
100101
firstRefresh: true,
101102
clickedCoords: '',
103+
coordsCommand: '',
102104
afkPeople: '',
103105
openPopup: null
104106
};
@@ -194,7 +196,7 @@ export default {
194196
};
195197
196198
$.each(custom_icons, function(type, cfg) {
197-
if (cfg.models.includes(vehicle.model)) {
199+
if (cfg.models.includes(vehicle.model+"")) {
198200
ret.type = type;
199201
ret.size = cfg.size;
200202
}
@@ -367,18 +369,25 @@ export default {
367369
attributes.push('on foot');
368370
markers[id].options.forceZIndex = 101;
369371
}
370-
extra += '<br><i>Is ' + attributes.shift() + (attributes.length > 0 ? ' and ' + attributes.join(', ') : '') + '</i>';
372+
const lastExtra = attributes.pop();
373+
extra += '<br><i>Is ' + (attributes.length > 0 ? attributes.join(', ') + ' and ' : '') + lastExtra + '</i>';
371374
372-
if (player.afk > 300) {
375+
if (player.afk > 15 * 60) {
373376
extra += '<br><i>Hasn\'t moved in ' + _this.formatSeconds(player.afk) + '</i>';
374377
}
375-
if (player.afk > 15 * 60) {
376-
const linkColor = isStaff ? 'text-green-600 dark:text-green-400' : 'text-indigo-600 dark:text-indigo-400';
378+
if (player.afk > 30 * 60) {
379+
const linkColor = isStaff ? 'rgb(16, 185, 129)' : (() => {
380+
let rainbow = new Rainbow();
381+
rainbow.setNumberRange(30 * 60, 3 * 60 * 60);
382+
rainbow.setSpectrum('#d9ff00', '#ffbf00', '#ff6600', '#ff0000');
383+
384+
return '#' + rainbow.colourAt(player.afk);
385+
})();
377386
378387
afkList.push(`<tr title="` + (isStaff ? 'Is a staff member' : '') + `">
379-
<td class="pr-2"><a class="` + linkColor + `" target="_blank" href="/players/` + player.steamIdentifier + `">` + player.character.fullName + `</a></td>
388+
<td class="pr-2"><a style="color: ` + linkColor + `" target="_blank" href="/players/` + player.steamIdentifier + `">` + player.character.fullName + `</a></td>
380389
<td class="pr-2">hasn't moved in ` + _this.formatSeconds(player.afk) + `</td>
381-
<td><a class="` + linkColor + ` track-cid" href="#" data-trackid="` + id + `" data-popup="true">[Track]</a></td>
390+
<td><a class="track-cid" style="color: ` + linkColor + `" href="#" data-trackid="` + id + `" data-popup="true">[Track]</a></td>
382391
</tr>`.replace(/\r?\n(\s{4})?/gm, ''));
383392
}
384393
@@ -506,6 +515,7 @@ export default {
506515
};
507516
508517
_this.clickedCoords = "[X=" + Math.round(game.x) + ",Y=" + Math.round(game.y) + "] / [X=" + map.x + ",Y=" + map.y + "]";
518+
_this.coordsCommand = "/tp_coords " + Math.round(game.x) + " " + Math.round(game.y);
509519
510520
console.info('Clicked coordinates', map);
511521
});

resources/js/data/vehicles.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@
154154
"mixer",
155155
"dump",
156156
"riot",
157+
"riot2",
157158
"firetruk",
158159
"terbyte",
159160
"stockade3",
@@ -189,6 +190,51 @@
189190
"towtruck2"
190191
]
191192
},
193+
"ems_car": {
194+
"size": 23,
195+
"models": [
196+
"ambulance",
197+
"firetruk",
198+
"lguard",
199+
"romero",
200+
"258787652",
201+
"-525474865",
202+
"-583006956"
203+
]
204+
},
205+
"police_car": {
206+
"size": 23,
207+
"models": [
208+
"751500040",
209+
"1014502499",
210+
"1282700433",
211+
"-1131225672",
212+
"-883171617",
213+
"-798860497",
214+
"-892415012",
215+
"545613214",
216+
"588213414",
217+
"-1572984573",
218+
"-1311812071",
219+
"658490459",
220+
"-1992613535",
221+
"941471002",
222+
"235768976",
223+
"fbi",
224+
"fbi2",
225+
"police",
226+
"police2",
227+
"police3",
228+
"police4",
229+
"policeb",
230+
"policeold1",
231+
"policeold2",
232+
"policet",
233+
"pranger",
234+
"sheriff",
235+
"sheriff2"
236+
]
237+
},
192238
"bus": {
193239
"size": 28,
194240
"models": [

resources/js/locales/en-us.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
4949
"length": "Length",
5050
"time": "Created at"
5151
},
52-
"no_bans": "No recent bans by you"
52+
"no_bans": "No recent bans by you",
53+
"staff": "Active Staff members"
5354
},
5455
"map": {
5556
"title": "Live-Map",
@@ -61,7 +62,8 @@
6162
"pause": "Pause update",
6263
"track": "Track character",
6364
"stop_track": "Stop tracking character",
64-
"afk_title": "AFK Players"
65+
"afk_title": "AFK Players",
66+
"command": "tp"
6567
},
6668
"nav": {
6769
"dark": "Dark",

0 commit comments

Comments
 (0)