Fix styling, docs, and a possible bug (#762)

* 🎨 Fix spacing and indentation

* 🎨 Use single quotes over backticks

* 📝 Fix docs

* 🐛 Make replace function clear and extend locales correctly

* Revert "🎨 Use single quotes over backticks"

* Update config.lua
This commit is contained in:
David Malchin
2022-07-22 12:14:02 +03:00
committed by GitHub
parent 42f39ea651
commit 8b5f5b2b37
5 changed files with 28 additions and 30 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ QBConfig.UpdateInterval = 5 -- how often to update player data in minutes
QBConfig.StatusInterval = 5000 -- how often to check hunger/thirst status in milliseconds
QBConfig.Money = {}
QBConfig.Money.MoneyTypes = { ['cash'] = 500, ['bank'] = 5000, ['crypto'] = 0 } -- ['type'] = startamount - Add or remove money types for your server (for ex. ['blackmoney'] = 0), remember once added it will not be removed from the database!
QBConfig.Money.MoneyTypes = { cash = 500, bank = 5000, crypto = 0 } -- type = startamount - Add or remove money types for your server (for ex. blackmoney = 0), remember once added it will not be removed from the database!
QBConfig.Money.DontAllowMinus = { 'cash', 'crypto' } -- Money that is not allowed going in minus
QBConfig.Money.PayCheckTimeOut = 10 -- The time in minutes that it will give the paycheck
QBConfig.Money.PayCheckSociety = false -- If true paycheck will come from the society account that the player is employed at, requires qb-management
-1
View File
@@ -8,7 +8,6 @@ import {
} from "./config.js";
const { useQuasar } = Quasar;
const { onMounted, onUnmounted } = Vue;
const app = Vue.createApp({
+2 -2
View File
@@ -13,13 +13,13 @@ export const DEV_MODE = false;
* Will hold config statically outside of Vue state
* @property {Record<string, NotiVariantData>} VariantDefinitions
* @property {Record<string, any>} NotificationStyling
* */
**/
export let NOTIFY_CONFIG = null;
/**
* Pure function taking a notification type and returning an object
* with style details
* @param variant {string}
* @param {string} variant
* @returns NotiVariantData
**/
export const determineStyleFromVariant = (variant) => {
+5 -6
View File
@@ -44,7 +44,7 @@ end
--- internally for initial population of phrases field.
--- @param phrases table<string, string> - Table of phrase definitions
--- @param prefix string | nil - Optional prefix used for recursive calls
--- @return void
--- @return nil
function Locale:extend(phrases, prefix)
for key, phrase in pairs(phrases) do
local prefixKey = prefix and ('%s.%s'):format(prefix, key) or key
@@ -57,10 +57,9 @@ function Locale:extend(phrases, prefix)
end
end
--- Clear locale instance phrases
--- Might be useful for memory management of large phrase maps.
--- @return void
--- @return nil
function Locale:clear()
self.phrases = {}
end
@@ -69,8 +68,8 @@ end
--- @param phrases table<string, any>
function Locale:replace(phrases)
phrases = phrases or {}
self.clear()
self.extend(phrases)
self:clear()
self:extend(phrases)
end
--- Gets & Sets a locale depending on if an argument is passed
@@ -85,7 +84,7 @@ end
--- Primary translation method for a phrase of given key
--- @param key string - The phrase key to target
--- @param subs table<string, string>
--- @param subs table<string, any> | nil
--- @return string
function Locale:t(key, subs)
local phrase, result
+20 -20
View File
@@ -3,9 +3,9 @@ QBShared = QBShared or {}
local StringCharset = {}
local NumberCharset = {}
for i = 48, 57 do NumberCharset[#NumberCharset+1] = string.char(i) end
for i = 65, 90 do StringCharset[#StringCharset+1] = string.char(i) end
for i = 97, 122 do StringCharset[#StringCharset+1] = string.char(i) end
for i = 48, 57 do NumberCharset[#NumberCharset + 1] = string.char(i) end
for i = 65, 90 do StringCharset[#StringCharset + 1] = string.char(i) end
for i = 97, 122 do StringCharset[#StringCharset + 1] = string.char(i) end
function QBShared.RandomStr(length)
if length <= 0 then return '' end
@@ -22,16 +22,16 @@ function QBShared.SplitStr(str, delimiter)
local from = 1
local delim_from, delim_to = string.find(str, delimiter, from)
while delim_from do
result[#result+1] = string.sub(str, from, delim_from - 1)
result[#result + 1] = string.sub(str, from, delim_from - 1)
from = delim_to + 1
delim_from, delim_to = string.find(str, delimiter, from)
end
result[#result+1] = string.sub(str, from)
result[#result + 1] = string.sub(str, from)
return result
end
function QBShared.Trim(value)
if not value then return nil end
if not value then return nil end
return (string.gsub(value, '^%s*(.-)%s*$', '%1'))
end
@@ -42,24 +42,24 @@ function QBShared.Round(value, numDecimalPlaces)
end
function QBShared.ChangeVehicleExtra(vehicle, extra, enable)
if DoesExtraExist(vehicle, extra) then
if enable then
SetVehicleExtra(vehicle, extra, false)
if not IsVehicleExtraTurnedOn(vehicle, extra) then
QBShared.ChangeVehicleExtra(vehicle, extra, enable)
end
else
SetVehicleExtra(vehicle, extra, true)
if IsVehicleExtraTurnedOn(vehicle, extra) then
QBShared.ChangeVehicleExtra(vehicle, extra, enable)
end
end
end
if DoesExtraExist(vehicle, extra) then
if enable then
SetVehicleExtra(vehicle, extra, false)
if not IsVehicleExtraTurnedOn(vehicle, extra) then
QBShared.ChangeVehicleExtra(vehicle, extra, enable)
end
else
SetVehicleExtra(vehicle, extra, true)
if IsVehicleExtraTurnedOn(vehicle, extra) then
QBShared.ChangeVehicleExtra(vehicle, extra, enable)
end
end
end
end
function QBShared.SetDefaultVehicleExtras(vehicle, config)
-- Clear Extras
for i = 1,20 do
for i = 1, 20 do
if DoesExtraExist(vehicle, i) then
SetVehicleExtra(vehicle, i, 1)
end