Reorganize some utils, change dividing lines

This commit is contained in:
Vortrex
2021-03-16 00:34:45 -05:00
parent dc145f92b9
commit deaf0b34a5
98 changed files with 1765 additions and 1849 deletions

View File

@@ -2,7 +2,7 @@
// Asshat-Gaming Roleplay
// https://github.com/VortrexFTW/gtac_asshat_rp
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
// ---------------------------------------------------------------------------
// ===========================================================================
// FILE: bus.js
// DESC: Provides bus driver job functions and usage
// TYPE: Job (JavaScript)
@@ -360,7 +360,7 @@ let busRoutes = [
],
];
// ---------------------------------------------------------------------------
// ===========================================================================
function getRandomBusRoute(island) {
if(busRoutes[getServerGame()][island].length == 1) {
@@ -369,7 +369,7 @@ function getRandomBusRoute(island) {
return getRandom(0, busRoutes[getServerGame()][island].length-1);
}
// ---------------------------------------------------------------------------
// ===========================================================================
function getNextStopOnBusRoute(island, busRoute, busRouteStop) {
if(!isLastStopOnBusRoute(island, busRoute, busRouteStop)) {
@@ -379,7 +379,7 @@ function getNextStopOnBusRoute(island, busRoute, busRouteStop) {
}
}
// ---------------------------------------------------------------------------
// ===========================================================================
function isLastStopOnBusRoute(island, busRoute, busRouteStop) {
if(busRouteStop == busRoutes[getServerGame()][island][busRoute].positions.length-1) {
@@ -388,20 +388,20 @@ function isLastStopOnBusRoute(island, busRoute, busRouteStop) {
return false;
}
// ---------------------------------------------------------------------------
// ===========================================================================
function showNextBusStop(client) {
getPlayerData(client).jobRouteStop = getNextStopOnBusRoute(getPlayerData(client).jobRouteStop, getPlayerData(client).jobRoute, getPlayerData(client).jobRouteStop);
showCurrentBusStop(client);
}
// ---------------------------------------------------------------------------
// ===========================================================================
function showCurrentBusStop(client) {
sendJobRouteStopToPlayer(client, getBusRouteStopPosition(getPlayerIsland(client), getPlayerData(client).jobRoute, getPlayerData(client).jobRouteStop), getColourByName("busDriverGreen"))
}
// ---------------------------------------------------------------------------
// ===========================================================================
function playerArrivedAtBusStop(client) {
if(isLastStopOnBusRoute(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute, getPlayerData(client).jobRouteStop)) {
@@ -426,16 +426,16 @@ function playerArrivedAtBusStop(client) {
}, 5000);
}
// ---------------------------------------------------------------------------
// ===========================================================================
function getBusRouteStopPosition(island, busRoute, busRouteStop) {
return busRoutes[getServerGame()][island][busRoute].positions[busRouteStop];
}
// ---------------------------------------------------------------------------
// ===========================================================================
function getBusRouteData(island, busRoute) {
return busRoutes[getServerGame()][island][busRoute];
}
// ---------------------------------------------------------------------------
// ===========================================================================

View File

@@ -2,7 +2,7 @@
// Asshat-Gaming Roleplay
// https://github.com/VortrexFTW/gtac_asshat_rp
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
// ---------------------------------------------------------------------------
// ===========================================================================
// FILE: drug.js
// DESC: Provides drug runner/dealer job functions and usage
// TYPE: Job (JavaScript)

View File

@@ -2,7 +2,7 @@
// Asshat-Gaming Roleplay
// https://github.com/VortrexFTW/gtac_asshat_rp
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
// ---------------------------------------------------------------------------
// ===========================================================================
// FILE: fire.js
// DESC: Provides firefighter job functions and usage
// TYPE: Job (JavaScript)

View File

@@ -2,7 +2,7 @@
// Asshat-Gaming Roleplay
// https://github.com/VortrexFTW/gtac_asshat_rp
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
// ---------------------------------------------------------------------------
// ===========================================================================
// FILE: garbage.js
// DESC: Provides garbage collector job functions and usage
// TYPE: Job (JavaScript)
@@ -72,7 +72,7 @@ let garbageRoutes = [
],
];
// ---------------------------------------------------------------------------
// ===========================================================================
function getRandomGarbageRoute(island) {
if(garbageRoutes[getServerGame()][island].length == 1) {
@@ -81,7 +81,7 @@ function getRandomGarbageRoute(island) {
return getRandom(0, garbageRoutes[getServerGame()][island].length-1);
}
// ---------------------------------------------------------------------------
// ===========================================================================
function getNextStopOnGarbageRoute(island, garbageRoute, garbageRouteStop) {
if(!isLastStopOnGarbageRoute(island, garbageRoute, garbageRouteStop)) {
@@ -91,7 +91,7 @@ function getNextStopOnGarbageRoute(island, garbageRoute, garbageRouteStop) {
}
}
// ---------------------------------------------------------------------------
// ===========================================================================
function isLastStopOnGarbageRoute(island, garbageRoute, garbageRouteStop) {
if(garbageRouteStop == garbageRoutes[getServerGame()][island][garbageRoute].positions.length-1) {
@@ -100,20 +100,20 @@ function isLastStopOnGarbageRoute(island, garbageRoute, garbageRouteStop) {
return false;
}
// ---------------------------------------------------------------------------
// ===========================================================================
function showNextGarbageStop(client) {
getPlayerData(client).jobRouteStop = getNextStopOnGarbageRoute(getPlayerData(client).jobRouteStop, getPlayerData(client).jobRoute, getPlayerData(client).jobRouteStop);
showCurrentGarbageStop(client);
}
// ---------------------------------------------------------------------------
// ===========================================================================
function showCurrentGarbageStop(client) {
triggerNetworkEvent("ag.showGarbageStop", client, getGarbageRouteStopPosition(getPlayerIsland(client), getPlayerData(client).jobRoute, getPlayerData(client).jobRouteStop), getColourByName("garbageDriverGreen"));
}
// ---------------------------------------------------------------------------
// ===========================================================================
function playerArrivedAtGarbageStop(client) {
if(isLastStopOnGarbageRoute(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute, getPlayerData(client).jobRouteStop)) {
@@ -137,16 +137,16 @@ function playerArrivedAtGarbageStop(client) {
}, 5000);
}
// ---------------------------------------------------------------------------
// ===========================================================================
function getGarbageRouteStopPosition(island, garbageRoute, garbageRouteStop) {
return garbageRoutes[getServerGame()][island][garbageRoute].positions[garbageRouteStop];
}
// ---------------------------------------------------------------------------
// ===========================================================================
function getGarbageRouteData(island, garbageRoute) {
return garbageRoutes[getServerGame()][island][garbageRoute];
}
// ---------------------------------------------------------------------------
// ===========================================================================

View File

@@ -2,7 +2,7 @@
// Asshat-Gaming Roleplay
// https://github.com/VortrexFTW/gtac_asshat_rp
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
// ---------------------------------------------------------------------------
// ===========================================================================
// FILE: medic.js
// DESC: Provides paramedic job functions and usage
// TYPE: Job (JavaScript)

View File

@@ -2,7 +2,7 @@
// Asshat-Gaming Roleplay
// https://github.com/VortrexFTW/gtac_asshat_rp
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
// ---------------------------------------------------------------------------
// ===========================================================================
// FILE: pizza-delivery.js
// DESC: Provides pizza delivery driver job functions and usage
// TYPE: Job (JavaScript)
@@ -224,57 +224,38 @@ let pizzaDeliveryStops = [
],
];
// ---------------------------------------------------------------------------
// ===========================================================================
function getRandomPizzaDeliveryStops(island) {
function getRandomPizzaDeliveryStop(island) {
if(pizzaDeliveryStops[getServerGame()][island].length == 1) {
return 0;
}
return getRandom(0, pizzaDeliveryStops[getServerGame()][island].length-1);
}
// ---------------------------------------------------------------------------
// ===========================================================================
function showCurrentPizzaDeliveryStop(client) {
sendJobDeliveryPointToPlayer(client, getPizzaDeliveryStopPosition(getPlayerIsland(client), getPlayerData(client).jobRoute), getColourByName("deliveryPurple"))
}
// ---------------------------------------------------------------------------
// ===========================================================================
function playerArrivedAtBusStop(client) {
if(isLastStopOnBusRoute(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute, getPlayerData(client).jobRouteStop)) {
respawnVehicle(getPlayerData(client).jobRouteVehicle);
let payout = getPizzaDeliveryPay(getPlayerData(client).jobDeliveryStart, getPlayerData(client).jobDeliveryStop)*getServerData().inflationMultiplier;
getPlayerData(client).payDayAmount += payout;
messagePlayerNormal(client, `You delivered the pizza! Return to the pizza restaurant if you want to deliver another pizza.`, getColourByName("yellow"));
messagePlayerNormal(client, `You earned $${payout}. Your total paycheck of [#AAAAAA]${getPlayerData(client).payDayAmount} will be received in [#AAAAAA]${getTimeDisplayUntilPlayerPayDay(client)}`);
getPlayerData(client).jobRouteVehicle = false;
getPlayerData(client).jobRoute = 0;
getPlayerData(client).jobRouteStop = 0;
getPlayerData(client).jobRouteIsland = 0;
return false;
}
showGameMessage(client, "⌛ Please wait a moment for passengers to get on and off the bus.", getColourByName("busDriverGreen"), 3500);
freezeJobVehicleForRouteStop(client);
getPlayerData(client).jobRouteStop = getNextStopOnBusRoute(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute, getPlayerData(client).jobRouteStop);
setTimeout(function() {
unFreezeJobVehicleForRouteStop(client);
showCurrentBusStop(client);
showGameMessage(client, "Proceed to the next stop (green checkpoint)", getColourByName("busDriverGreen"), 3500);
}, 5000);
function playerArrivedAtPizzaDeliveryDestination(client) {
respawnVehicle(getPlayerData(client).jobDeliveryVehicle);
let payout = applyServerInflationMultiplier(getPizzaDeliveryPay(getPlayerData(client).jobDeliveryStart, getPlayerData(client).jobDeliveryStop));
getPlayerData(client).payDayAmount += payout;
messagePlayerNormal(client, `You delivered the pizza! Return to the pizza restaurant if you want to deliver another pizza.`, getColourByName("yellow"));
messagePlayerNormal(client, `You earned $${payout}. Your total paycheck of [#AAAAAA]${getPlayerData(client).payDayAmount} will be received in [#AAAAAA]${getTimeDisplayUntilPlayerPayDay(client)}`);
getPlayerData(client).jobDeliveryVehicle = false;
getPlayerData(client).jobDeliveryStart = 0;
getPlayerData(client).jobDeliveryStop = 0;
}
// ---------------------------------------------------------------------------
// ===========================================================================
function getBusRouteStopPosition(island, busRoute, busRouteStop) {
return busRoutes[getServerGame()][island][busRoute].positions[busRouteStop];
function getPizzaDeliveryPay(startPoint, stopPoint) {
return Math.floor(getDistance(startPoint, stopPoint));
}
// ---------------------------------------------------------------------------
function getBusRouteData(island, busRoute) {
return busRoutes[getServerGame()][island][busRoute];
}
// ---------------------------------------------------------------------------
// ===========================================================================

View File

@@ -2,7 +2,7 @@
// Asshat-Gaming Roleplay
// https://github.com/VortrexFTW/gtac_asshat_rp
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
// ---------------------------------------------------------------------------
// ===========================================================================
// FILE: police.js
// DESC: Provides police officer job functions and usage
// TYPE: Job (JavaScript)
@@ -73,7 +73,7 @@ let patrolRoutes = [
],
];
// ---------------------------------------------------------------------------
// ===========================================================================
function policeTazerCommand(command, params, client) {
if(!canPlayerUseJobs(client)) {
@@ -99,7 +99,7 @@ function policeTazerCommand(command, params, client) {
return true;
}
// ---------------------------------------------------------------------------
// ===========================================================================
function policeCuffCommand(command, params, client) {
if(!canPlayerUseJobs(client)) {
@@ -125,7 +125,7 @@ function policeCuffCommand(command, params, client) {
return true;
}
// ---------------------------------------------------------------------------
// ===========================================================================
function policeArrestCommand(command, params, client) {
if(!canPlayerUseJobs(client)) {
@@ -151,7 +151,7 @@ function policeArrestCommand(command, params, client) {
return true;
}
// ---------------------------------------------------------------------------
// ===========================================================================
function policeSearchCommand(command, params, client) {
if(!canPlayerUseJobs(client)) {
@@ -177,7 +177,7 @@ function policeSearchCommand(command, params, client) {
return true;
}
// ---------------------------------------------------------------------------
// ===========================================================================
function policeDragCommand(command, params, client) {
if(!canPlayerUseJobs(client)) {
@@ -203,7 +203,7 @@ function policeDragCommand(command, params, client) {
return true;
}
// ---------------------------------------------------------------------------
// ===========================================================================
function policeDetainCommand(command, params, client) {
if(!canPlayerUseJobs(client)) {
@@ -229,7 +229,7 @@ function policeDetainCommand(command, params, client) {
return true;
}
// ---------------------------------------------------------------------------
// ===========================================================================
function playerArivedAtPolicePatrolPoint(client) {
if(isLastStopOnPolicePatrolRoute(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute, getPlayerData(client).jobRouteStop)) {
@@ -250,4 +250,4 @@ function playerArivedAtPolicePatrolPoint(client) {
showCurrentPolicePatrolPoint(client);
}
// ---------------------------------------------------------------------------
// ===========================================================================

View File

@@ -2,7 +2,7 @@
// Asshat-Gaming Roleplay
// https://github.com/VortrexFTW/gtac_asshat_rp
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
// ---------------------------------------------------------------------------
// ===========================================================================
// FILE: taxi.js
// DESC: Provides taxi driver job functions and usage
// TYPE: Job (JavaScript)

View File

@@ -2,7 +2,7 @@
// Asshat-Gaming Roleplay
// https://github.com/VortrexFTW/gtac_asshat_rp
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
// ---------------------------------------------------------------------------
// ===========================================================================
// FILE: weapon.js
// DESC: Provides weapons dealer job functions and usage
// TYPE: Job (JavaScript)