Skip to content

Commit

Permalink
Hotfix
Browse files Browse the repository at this point in the history
- Fix can't reopen boosting app after joining / receive contract

-Fix when you at S+ class and the next rep is shown as C

-Date / time format issue for windows based server
  • Loading branch information
JustLazzy committed Oct 8, 2022
1 parent 4c6a8ba commit 2fec2fd
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 53 deletions.
18 changes: 12 additions & 6 deletions server/boosting.lua
Original file line number Diff line number Diff line change
Expand Up @@ -651,14 +651,20 @@ local function missionType(Player, tier)
end

function GetHoursFromNow(hours)
local time = os.date("!%Y-%m-%dT%TZ", os.time() + hours * 60 * 60)
return time
if Config.Linux then
return os.date("!%Y-%m-%dT%TZ", os.time() + hours * 60 * 60)
else
return os.date("!%Y-%m-%dT%SZ", os.time() + hours * 60 * 60)
end
end

-- Get the fucking server time
function GetCurrentTime()
local time = os.date("!%Y-%m-%dT%TZ", os.time())
return time
if Config.Linux then
return os.date("!%Y-%m-%dT%TZ", os.time())
else
return os.date("!%Y-%m-%dT%SZ", os.time())
end

end

QBCore.Functions.CreateCallback("jl-laptop:server:getCurrentTime", function (cb)
Expand Down Expand Up @@ -791,7 +797,7 @@ end, "god")

QBCore.Commands.Add('settier', Lang:t('boosting.command.command_tier_desc'), {{ name = Lang:t('boosting.command.command_name_ID'), help = Lang:t('boosting.command.command_help_ID')}, { name = Lang:t('boosting.command.command_name_tier'), help = Lang:t('boosting.command.command_help_tier')} }, false, function(source, args)
if args and type(tonumber(args[1])) == "number" then
if args[2] and type(tonumber(args[2])) == "string" then
if args[2] and type(args[2]) == "string" then
local Player = QBCore.Functions.GetPlayer(tonumber(args[1]))
if Player then
local rep = Player.PlayerData.metadata["carboostrep"] or 0
Expand Down
2 changes: 2 additions & 0 deletions shared/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Config.LaptopDevice = "laptop"

Config.RenewedPhone = false

Config.Linux = false

Config.PoliceJobs = {
"police",
"bcso"
Expand Down
73 changes: 27 additions & 46 deletions svelte-source/src/components/apps/Boosting.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@
import moment from "moment";
import { modals } from "@store/modals";
import { flip } from "svelte/animate";
import { contracts, queue, started, startedContracts } from "@store/boosting";
import { contracts, queue, startedContracts } from "@store/boosting";
import { notifications } from "@store/notifications";
import { fetchNui } from "@utils/eventHandler";
import Apps from "@shared/Apps.svelte";
import Progressbar from "@shared/Progressbar.svelte";
import { quadInOut, quadOut } from "svelte/easing";
import { DumyBoostingData } from "@utils/initDumyData";
import { onMount } from "svelte";
import { debugData } from "@utils/debugData";
import { currentDate } from "@utils/misc";
import { fade, fly, scale } from "svelte/transition";
import { fade, scale } from "svelte/transition";
let tierRing = {
D: "rgb(77, 141, 77)",
Expand All @@ -25,7 +23,7 @@
"S+": "rgb(255, 208, 0)",
};
let iswaiting;
let iswaiting: boolean;
let currentPage = "My Contracts";
let topdata = {
Expand Down Expand Up @@ -54,8 +52,11 @@
for (let i = 0; i < sorted.length; i++) {
if (repPoint >= sorted[i][1]) {
currentRep = sorted[i][0];
nextRep = sorted[i - 1][0];
progressPercentage = getGapPercentage(sorted[i - 1][1], sorted[i][1]);
nextRep = sorted[i - 1] ? sorted[i - 1][0] : "MAX";
progressPercentage = getGapPercentage(
sorted[i - 1] ? sorted[i - 1][1] : sorted[i][1] + 100,
sorted[i][1]
);
break;
}
}
Expand Down Expand Up @@ -89,41 +90,6 @@
}, 2000);
}
fetchNui("boosting/getcontract")
.then((r) => {
contracts.set(r.contracts);
})
.catch((e) => {});
fetchNui("boosting/getqueue").then((data) => {
queue.set(data);
});
fetchNui("boosting/getrep")
.then((r) => {
let toarray: any = [];
for (let i in r.repconfig) {
toarray.push([i, r.repconfig[i]]);
}
repConfig = toarray;
repPoint = r.rep;
getRep();
})
.catch(() => {
repConfig = {
rep: 30,
repConfig: [
["D", 0],
["C", 50],
["B", 100],
["A", 150],
["A+", 200],
["S", 250],
["S+", 300],
],
};
});
function startContract(id: number) {
if ($startedContracts) return;
const contract = $contracts.find((c) => c.id === id);
Expand Down Expand Up @@ -200,7 +166,22 @@
}
onMount(() => {
DumyBoostingData();
fetchNui("boosting/getcontract").then((r) => {
contracts.set(r.contracts);
});
fetchNui("boosting/getqueue").then((data) => {
queue.set(data);
});
fetchNui("boosting/getrep").then((r) => {
let toarray: any = [];
for (let i in r.repconfig) {
toarray.push([i, r.repconfig[i]]);
}
repConfig = toarray;
repPoint = r.rep;
getRep();
});
});
</script>

Expand Down Expand Up @@ -287,9 +268,9 @@
{#each $contracts as contract (contract.id)}
<div
class="boosting-card"
animate:flip={{ easing: quadInOut, duration: 300 }}
in:scale={{ duration: 300, easing: quadOut }}
out:fade={{ duration: 200 }}
animate:flip={{ easing: quadInOut, duration: 240 }}
in:scale|local={{ duration: 300, easing: quadOut }}
out:fade|local={{ duration: 200 }}
>
<div class="typeshit" class:vin={contract.type === "vinscratch"}>
{contract.type === "boosting"
Expand Down
1 change: 0 additions & 1 deletion svelte-source/src/store/desktop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export function openApp(data: IOpenedApp) {
}

export function closeApp(name: string) {
console.log(name);
openedApps.update((v) => {
const filter = v.filter((v) => v.name !== name);
return [...filter];
Expand Down

0 comments on commit 2fec2fd

Please sign in to comment.