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

Commit 778f17e

Browse files
authored
Merge pull request #168 from ExpDev07/dev
New Features and bugfixes
2 parents fb89ab8 + 107a6b9 commit 778f17e

36 files changed

+507
-87
lines changed

app/Helpers/GeneralHelper.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,45 @@ public static function updateSocketSession()
8787
file_put_contents($dir . '/' . $key . '.session', json_encode($session->get('user')));
8888
}
8989
}
90+
91+
/**
92+
* Parses a .map file
93+
*
94+
* @param string $file
95+
* @return array|null
96+
*/
97+
public static function parseMapFile(string $file): ?array
98+
{
99+
if (!file_exists($file)) {
100+
return null;
101+
}
102+
103+
$contents = str_replace("\r\n", "\n", file_get_contents($file));
104+
if (!$contents) {
105+
return null;
106+
}
107+
108+
$lines = explode("\n", $contents);
109+
$result = [];
110+
foreach ($lines as $line) {
111+
$re = '/^({.+?}) (.+?) (.+)$/m';
112+
preg_match($re, $line, $matches);
113+
114+
if (sizeof($matches) < 4) {
115+
continue;
116+
}
117+
118+
$icon = $matches[2];
119+
$obj = $matches[1];
120+
$label = $matches[3];
121+
122+
$result[] = [
123+
'icon' => $icon,
124+
'label' => $label,
125+
'coords' => $obj,
126+
];
127+
}
128+
129+
return $result;
130+
}
90131
}

app/Helpers/OPFWHelper.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,42 @@ public static function updateJob(Player $player, string $character_id): OPFWResp
132132
return $response;
133133
}
134134

135+
/**
136+
* Unloads someones character
137+
*
138+
* @param Player $player
139+
* @param string $character_id
140+
* @return OPFWResponse
141+
*/
142+
public static function unloadCharacter(string $staffSteamIdentifier, Player $player, string $character_id): OPFWResponse
143+
{
144+
$steam = $player->steam_identifier;
145+
146+
$status = Player::getOnlineStatus($player->steam_identifier, false);
147+
if (!$status->isOnline()) {
148+
return new OPFWResponse(true, 'Player is offline, no unload needede.');
149+
}
150+
151+
$response = self::executeRoute($status->serverIp . 'execute/unloadCharacter', [
152+
'steamIdentifier' => $steam,
153+
'characterId' => $character_id,
154+
]);
155+
156+
if ($response->status) {
157+
$response->message = 'Unloaded players character.';
158+
159+
PanelLog::logUnload($staffSteamIdentifier, $player->steam_identifier, $character_id);
160+
}
161+
162+
return $response;
163+
}
164+
135165
/**
136166
* Gets the world.json
137167
*
138168
* @param string $serverIp
139169
* @return array|null
170+
* @deprecated No longer used
140171
*/
141172
public static function getWorldJSON(string $serverIp): ?array
142173
{

app/Http/Controllers/MapController.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace App\Http\Controllers;
44

5+
use App\Helpers\GeneralHelper;
56
use App\Player;
67
use App\Server;
78
use Illuminate\Http\Request;
@@ -31,9 +32,10 @@ public function index(Request $request): Response
3132

3233
return Inertia::render('Map/Index', [
3334
'servers' => $serverIps,
34-
'staff' => $staff ? array_map(function($player) {
35+
'staff' => $staff ? array_map(function ($player) {
3536
return $player['steam_identifier'];
36-
}, $staff) : []
37+
}, $staff) : [],
38+
'blips' => GeneralHelper::parseMapFile(__DIR__ . '/../../../helpers/markers.map') ?? [],
3739
]);
3840
}
3941

app/Http/Controllers/PlayerRouteController.php

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
namespace App\Http\Controllers;
44

55
use App\Helpers\OPFWHelper;
6-
use App\Http\Requests\KickStoreRequest;
76
use App\Player;
87
use Illuminate\Http\RedirectResponse;
8+
use Illuminate\Http\Request;
99

1010
class PlayerRouteController extends Controller
1111
{
@@ -14,11 +14,15 @@ class PlayerRouteController extends Controller
1414
* Kick a player from the game
1515
*
1616
* @param Player $player
17-
* @param KickStoreRequest $request
17+
* @param Request $request
1818
* @return RedirectResponse
1919
*/
20-
public function kick(Player $player, KickStoreRequest $request): RedirectResponse
20+
public function kick(Player $player, Request $request): RedirectResponse
2121
{
22+
if (empty(trim($request->input('reason')))) {
23+
return back()->with('error', 'Reason cannot be empty');
24+
}
25+
2226
$user = $request->user();
2327
$reason = $request->input('reason') ?: 'You were kicked by ' . $user->player->player_name;
2428

@@ -29,15 +33,38 @@ public function kick(Player $player, KickStoreRequest $request): RedirectRespons
2933
* Send a staffPM to a player
3034
*
3135
* @param Player $player
32-
* @param KickStoreRequest $request
36+
* @param Request $request
3337
* @return RedirectResponse
3438
*/
35-
public function staffPM(Player $player, KickStoreRequest $request): RedirectResponse
39+
public function staffPM(Player $player, Request $request): RedirectResponse
3640
{
3741
$user = $request->user();
3842
$message = trim($request->input('message'));
3943

44+
if (empty($message)) {
45+
return back()->with('error', 'Message cannot be empty');
46+
}
47+
4048
return OPFWHelper::staffPM($user->player->steam_identifier, $player, $message)->redirect();
4149
}
4250

51+
/**
52+
* Unload someones character
53+
*
54+
* @param Player $player
55+
* @param Request $request
56+
* @return RedirectResponse
57+
*/
58+
public function unloadCharacter(Player $player, Request $request): RedirectResponse
59+
{
60+
$user = $request->user();
61+
$character = trim($request->input('character'));
62+
63+
if (empty($character)) {
64+
return back()->with('error', 'Character ID cannot be empty');
65+
}
66+
67+
return OPFWHelper::unloadCharacter($user->player->steam_identifier, $player, $character)->redirect();
68+
}
69+
4370
}

app/Http/Requests/KickStoreRequest.php

Lines changed: 0 additions & 22 deletions
This file was deleted.

app/PanelLog.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,22 @@ public static function logKick(string $fromIdentifier, string $toIdentifier, str
134134
self::createLog($fromIdentifier, $toIdentifier, $log, 'Kicked Player');
135135
}
136136

137+
/**
138+
* Logs a character unload from the panel
139+
*
140+
* @param string $fromIdentifier
141+
* @param string $toIdentifier
142+
* @param string $character
143+
*/
144+
public static function logUnload(string $fromIdentifier, string $toIdentifier, string $character)
145+
{
146+
$from = self::resolvePlayerLogName($fromIdentifier);
147+
$to = self::resolvePlayerLogName($toIdentifier);
148+
149+
$log = $from . ' unloaded ' . $to . '\'s character (#' . $character . ')';
150+
self::createLog($fromIdentifier, $toIdentifier, $log, 'Unloaded Character');
151+
}
152+
137153
private static function resolvePlayerLogName(string $identifier): string
138154
{
139155
$player = Player::query()->where('steam_identifier', $identifier)->first();

helpers/markers.map

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
// Garages
2+
{x: 274.167, y: -344.255} blips/garage.png Garage A
3+
{x: 66.501, y: 13.464} blips/garage.png Garage B
4+
{x: -282.145, y: -774.224} blips/garage.png Garage C
5+
{x: -75.020, y: -2004.079} blips/garage.png Garage D
6+
{x: 1037.723, y: -764.004} blips/garage.png Garage E
7+
{x: 363.877, y: 298.088} blips/garage.png Garage F
8+
{x: -2029.582, y: -464.123} blips/garage.png Garage G
9+
{x: 1737.600, y: 3710.031} blips/garage.png Garage H
10+
{x: -150.949, y: 6350.954} blips/garage.png Garage I
11+
12+
// Ammu Nation
13+
{x: 843.402, y: -1034.044} blips/ammu_nation.png Ammu Nation 1
14+
{x: -663.284, y: -934.919} blips/ammu_nation.png Ammu Nation 2
15+
{x: -1305.112, y: -393.402} blips/ammu_nation.png Ammu Nation 3
16+
{x: 252.963, y: -49.200} blips/ammu_nation.png Ammu Nation 4
17+
{x: -1118.901, y: 2698.141} blips/ammu_nation.png Ammu Nation 5
18+
{x: 1692.514, y: 3759.349} blips/ammu_nation.png Ammu Nation 6
19+
{x: -331.451, y: 6083.354} blips/ammu_nation.png Ammu Nation 7
20+
{x: 811.213, y: -2157.771} blips/ammu_nation_range.png Ammu Nation with Range 1
21+
{x: 21.204, y: -1106.360} blips/ammu_nation_range.png Ammu Nation with Range 2
22+
23+
// Clothing Stores
24+
{x: 75.851, y: -1392.936} blips/clothing.png Clothing Store 1
25+
{x: -822.198, y: -1074.092} blips/clothing.png Clothing Store 2
26+
{x: 424.932, y: -806.281} blips/clothing.png Clothing Store 3
27+
{x: -1193.459, y: -768.831} blips/clothing.png Clothing Store 4
28+
{x: -162.936, y: -303.125} blips/clothing.png Clothing Store 5
29+
{x: -1450.589, y: -237.468} blips/clothing.png Clothing Store 6/7
30+
{x: 125.684, y: -222.910} blips/clothing.png Clothing Store 8
31+
{x: -3170.453, y: 1044.633} blips/clothing.png Clothing Store 9
32+
{x: -1101.231, y: 2710.431} blips/clothing.png Clothing Store 10
33+
{x: 614.730, y: 2762.018} blips/clothing.png Clothing Store 11
34+
{x: 1196.677, y: 2709.534} blips/clothing.png Clothing Store 12
35+
{x: 1693.569, y: 4822.879} blips/clothing.png Clothing Store 13
36+
{x: 4.549, y: 6512.729} blips/clothing.png Clothing Store 14
37+
{x: -710.360, y: -153.363} blips/clothing.png Clothing Store 15
38+
39+
// Banks
40+
{x: 149.736, y: -1040.730} blips/bank.png Bank 1
41+
{x: -1212.752, y: -330.884} blips/bank.png Bank 2
42+
{x: 314.110, y: -278.901} blips/bank.png Bank 3
43+
{x: 1175.037, y: 2706.804} blips/bank.png Bank 4
44+
{x: -2962.576, y: 482.954} blips/bank.png Bank 5
45+
{x: -113.077, y: 6470.189} blips/bank.png Bank 6
46+
{x: -351.033, y: -49.978} blips/bank.png Bank 7
47+
48+
// Barbershops
49+
{x: 137.037, y: -1707.956} blips/barbershop.png Barbershop 1
50+
{x: -1282.892, y: -1117.200} blips/barbershop.png Barbershop 2
51+
{x: 1212.224, y: -472.840} blips/barbershop.png Barbershop 3
52+
{x: -813.455, y: -183.811} blips/barbershop.png Barbershop 4
53+
{x: -33.099, y: -152.347} blips/barbershop.png Barbershop 5
54+
{x: 1931.987, y: 3730.338} blips/barbershop.png Barbershop 6
55+
{x: -278.242, y: 6228.053} blips/barbershop.png Barbershop 7
56+
57+
// Grocery Stores
58+
{x: -48.330, y: -1757.960} blips/grocery.png Grocery Store 1
59+
{x: 25.635, y: -1347.745} blips/grocery.png Grocery Store 2
60+
{x: 1135.635, y: -982.853} blips/grocery.png Grocery Store 3
61+
{x: -707.327, y: -914.598} blips/grocery.png Grocery Store 4
62+
{x: -1222.246, y: -906.857} blips/grocery.png Grocery Store 5
63+
{x: -1487.565, y: -378.791} blips/grocery.png Grocery Store 6
64+
{x: 1163.697, y: -323.934} blips/grocery.png Grocery Store 7
65+
{x: 373.516, y: 325.424} blips/grocery.png Grocery Store 8
66+
{x: 2557.965, y: 381.956} blips/grocery.png Grocery Store 9
67+
{x: -2967.745, y: 391.596} blips/grocery.png Grocery Store 10
68+
{x: -3038.677, y: 585.864} blips/grocery.png Grocery Store 11
69+
{x: -1820.334, y: 792.673} blips/grocery.png Grocery Store 12
70+
{x: -3241.437, y: 1001.090} blips/grocery.png Grocery Store 13
71+
{x: 547.780, y: 2671.899} blips/grocery.png Grocery Store 14
72+
{x: 1165.345, y: 2709.428} blips/grocery.png Grocery Store 15
73+
{x: 2679.257, y: 3280.062} blips/grocery.png Grocery Store 16
74+
{x: 1393.754, y: 3605.459} blips/grocery.png Grocery Store 17
75+
{x: 1961.459, y: 3739.965} blips/grocery.png Grocery Store 18
76+
{x: 1697.908, y: 4924.457} blips/grocery.png Grocery Store 19
77+
{x: 1728.593, y: 6414.066} blips/grocery.png Grocery Store 20
78+
79+
// Impound lot
80+
{x: 398.637, y: -1641.297} blips/impound.png Impound lot 1
81+
{x: 1613.657, y: 3782.110} blips/impound.png Impound lot 2
82+
{x: -279.653, y: 6130.602} blips/impound.png Impound lot 3
83+
84+
// Medical
85+
{x: -247.358, y: 6331.569} blips/medical.png Paleto Bay Clinic
86+
{x: 299.196, y: -584.769} blips/medical.png Pillbox Hill Medical Center
87+
{x: 1150.602, y: -1530.250} blips/medical.png St. Fiacre Hospital
88+
89+
// Police
90+
{x: 434.387, y: -981.917} blips/police.png Police Department 1
91+
{x: 638.176, y: 1.899} blips/police.png Police Department 2
92+
{x: 1855.398, y: 3683.248} blips/police.png Police Department 3
93+
{x: -443.182, y: 6016.523} blips/police.png Police Department 4
94+
{x: 360.804, y: -1584.620} blips/police.png Police Department 5
95+
{x: -561.930, y: -130.840} blips/police.png Police Department 6
96+
{x: 827.433, y: -1290.013} blips/police.png Police Department 7
97+
{x: 379.160, y: 792.422} blips/police.png Police Department 8
98+
{x: -1632.290, y: -1015.622} blips/police.png Police Department 9
99+
{x: 2534.334, y: -384.501} blips/police.png Police Department 10
100+
101+
// Police Sea HQ
102+
{x: -800.281, y: -1512.382} blips/sea_hq.png Police Sea HQ
103+
104+
// Sunken Ship
105+
{x: 3173.842, y: -357.798} blips/sunken_ship.png Sunken Ship
106+
107+
// Bolingbroke Penitentiary
108+
{x: 1689.152, y: 2605.411} blips/prison.png Bolingbroke Penitentiary
109+
110+
// Repair Shop
111+
{x: -26.413, y: -1672.127} blips/repair.png Repair Shop 1
112+
{x: 1233.402, y: -3235.583} blips/repair.png Repair Shop 2
113+
{x: 1769.710, y: 3330.343} blips/repair.png Repair Shop 3
114+
{x: 961.477, y: -106.233} blips/repair.png Repair Shop 4
115+
{x: -84.356, y: 6497.974} blips/repair.png Repair Shop 5
116+
{x: -1421.209, y: -439.978} blips/repair.png Repair Shop 6
117+
{x: -1145.710, y: -1990.906} blips/repair.png Repair Shop 7
118+
{x: 1178.624, y: 2644.365} blips/repair.png Repair Shop 8
119+
{x: 37.042, y: 6463.886} blips/repair.png Repair Shop 9
120+
121+
// Los Santos Customs
122+
{x: -337.398, y: -136.932} blips/customs.png Los Santos Customs 1
123+
{x: 733.688, y: -1088.743} blips/customs.png Los Santos Customs 2
124+
{x: -1155.086, y: -2006.611} blips/customs.png Los Santos Customs 3
125+
{x: 1174.813, y: 2637.798} blips/customs.png Los Santos Customs 4
126+
{x: 108.831, y: 6628.444} blips/customs.png Los Santos Customs 5
127+
{x: -212.374, y: -1325.499} blips/customs.png Los Santos Customs 6
128+
{x: 933.310, y: -971.380} blips/customs.png Los Santos Customs 7
129+
{x: -34.549, y: -1053.152} blips/customs.png Los Santos Customs 8
130+
131+
// Premium Deluxe Motorsport
132+
{x: -32.374, y: -1114.879} blips/dealership.png Premium Deluxe Motorsport
133+
134+
// Exclusive Dealership
135+
{x: -69.099, y: 63.481} blips/dealership.png Exclusive Dealership
136+
137+
// Jewelry Store
138+
{x: -630.501, y: -237.138} blips/jewelry.png Jewelry Store
139+
140+
// Yoga
141+
{x: -1494.119, y: 829.398} blips/yoga.png Yoga

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
"leaflet-gesture-handling": "^1.2.1",
4444
"leaflet-rotatedmarker": "^0.2.0",
4545
"rainbowvis.js": "^1.0.1",
46-
"vue-clipboard2": "^0.3.1",
4746
"vue-linkify": "^1.0.1",
4847
"vue2-circle-progress": "^1.2.3"
4948
}
1.21 KB
Loading
1.72 KB
Loading

0 commit comments

Comments
 (0)