diff --git a/fxmanifest.lua b/fxmanifest.lua index bacad92..83aa11b 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -4,7 +4,7 @@ lua54 'yes' use_experimental_fxv2_oal 'yes' author 'The Order of the Sacred Framework' description 'A bridge made for the community to use as a base for their own projects. This bridge will allow a single format to work with nearly all commonly used systems while still offering expandability.' -version '0.2.5' +version '0.2.6' shared_scripts { '@ox_lib/init.lua', @@ -23,12 +23,12 @@ server_scripts { 'modules/inventory/**/server.lua', 'modules/doorlock/**/server.lua', 'modules/phone/**/server.lua', - 'modules/notify/server.lua', 'modules/managment/**/server.lua', 'modules/dispatch/**/server.lua', 'modules/clothing/**/server.lua', 'modules/weather/**/server.lua', 'modules/vehicleKey/**/server.lua', + 'modules/notify/**/server.lua', 'init.lua', } @@ -39,7 +39,6 @@ client_scripts { 'modules/inventory/**/client.lua', 'modules/doorlock/**/client.lua', 'modules/phone/**/client.lua', - 'modules/notify/client.lua', 'modules/weather/**/client.lua', 'modules/vehicleKey/**/client.lua', 'modules/fuel/**/client.lua', @@ -49,6 +48,7 @@ client_scripts { 'modules/clothing/**/client.lua', 'modules/input/*.lua', 'modules/menu/*.lua', + 'modules/notify/**/client.lua', 'init.lua', } diff --git a/init.lua b/init.lua index 2c9ab63..6dfaba9 100644 --- a/init.lua +++ b/init.lua @@ -2,11 +2,15 @@ Bridge = {} function Bridge.RegisterModule(moduleName, moduleTable) if not moduleTable then - print("No moduleTable provided for module and no defaultsTable found: ", moduleName) + if BridgeSharedConfig.DebugLevel ~= 0 then + print("^6 No moduleTable provided for module: ", moduleName, "^0") + end return end if Bridge[moduleName] then - print("Module already registered:", moduleName) + if BridgeSharedConfig.DebugLevel ~= 0 then + print("^6Module already registered:", moduleName, "^0") + end return end @@ -18,7 +22,9 @@ function Bridge.RegisterModule(moduleName, moduleTable) for functionName, func in pairs(moduleTable) do wrappedModule[functionName] = func end - print("Registering module:", moduleName) + if BridgeSharedConfig.DebugLevel ~= 0 then + print("^2 Registering module:", moduleName, "^0") + end Bridge[moduleName] = wrappedModule --trigger update object event TriggerEvent("Bridge:Refresh", moduleName, wrappedModule) diff --git a/lib/init.lua b/lib/init.lua index ebe0489..fd76d30 100644 --- a/lib/init.lua +++ b/lib/init.lua @@ -11,7 +11,9 @@ function Require(modulePath, resourceName) local id = resourceName .. ":" .. modulePath if loadedModules[id] then - print("Returning cached module [" .. id .. "]") + if BridgeSharedConfig.DebugLevel ~= 0 then + print("Returning cached module [" .. id .. "]") + end return loadedModules[id] end diff --git a/modules/clothing/esx_skin/client.lua b/modules/clothing/esx_skin/client.lua index da941c3..8cf5681 100644 --- a/modules/clothing/esx_skin/client.lua +++ b/modules/clothing/esx_skin/client.lua @@ -1,6 +1,6 @@ if GetResourceState('esx_skin') ~= 'started' then return end -Clothing = {} +Clothing = Clothing or {} StoredOldClothing = {} diff --git a/modules/clothing/esx_skin/server.lua b/modules/clothing/esx_skin/server.lua index d0330af..b4fad63 100644 --- a/modules/clothing/esx_skin/server.lua +++ b/modules/clothing/esx_skin/server.lua @@ -3,4 +3,22 @@ if GetResourceState('esx_skin') ~= 'started' then return end RegisterNetEvent("esx_skin:save", function(skin) local src = source TriggerClientEvent('community_bridge:client:updateStoredClothing', src, skin) -end) \ No newline at end of file +end) + +Clothing = Clothing or {} + +Clothing.SetAppearance = function(src, data) + --wip +end + +Clothing.GetAppearance = function(src) + --wip +end + +Clothing.RestoreAppearance = function(src) + --wip +end + +Clothing.ReloadSkin = function(src) + --wip +end \ No newline at end of file diff --git a/modules/clothing/fivem-appearance/client.lua b/modules/clothing/fivem-appearance/client.lua index 5c998e7..cb271c5 100644 --- a/modules/clothing/fivem-appearance/client.lua +++ b/modules/clothing/fivem-appearance/client.lua @@ -1,6 +1,6 @@ if GetResourceState('fivem-appearance') ~= 'started' then return end -Clothing = {} +Clothing = Clothing or {} StoredOldClothing = {} diff --git a/modules/clothing/fivem-appearance/server.lua b/modules/clothing/fivem-appearance/server.lua new file mode 100644 index 0000000..cf1fc19 --- /dev/null +++ b/modules/clothing/fivem-appearance/server.lua @@ -0,0 +1,19 @@ +if GetResourceState('fivem-appearance') ~= 'started' then return end + +Clothing = Clothing or {} + +Clothing.SetAppearance = function(src, data) + --wip +end + +Clothing.GetAppearance = function(src) + --wip +end + +Clothing.RestoreAppearance = function(src) + --wip +end + +Clothing.ReloadSkin = function(src) + --wip +end \ No newline at end of file diff --git a/modules/clothing/illenium-appearance/client.lua b/modules/clothing/illenium-appearance/client.lua index ee3c32e..5c27b46 100644 --- a/modules/clothing/illenium-appearance/client.lua +++ b/modules/clothing/illenium-appearance/client.lua @@ -1,6 +1,6 @@ if GetResourceState('illenium-appearance') ~= 'started' then return end -Clothing = {} +Clothing = Clothing or {} StoredOldClothing = {} diff --git a/modules/clothing/illenium-appearance/server.lua b/modules/clothing/illenium-appearance/server.lua new file mode 100644 index 0000000..8325041 --- /dev/null +++ b/modules/clothing/illenium-appearance/server.lua @@ -0,0 +1,19 @@ +if GetResourceState('illenium-appearance') ~= 'started' then return end + +Clothing = Clothing or {} + +Clothing.SetAppearance = function(src, data) + --wip +end + +Clothing.GetAppearance = function(src) + --wip +end + +Clothing.RestoreAppearance = function(src) + --wip +end + +Clothing.ReloadSkin = function(src) + --wip +end \ No newline at end of file diff --git a/modules/clothing/qb-clothing/client.lua b/modules/clothing/qb-clothing/client.lua index 0245f28..12a9cbb 100644 --- a/modules/clothing/qb-clothing/client.lua +++ b/modules/clothing/qb-clothing/client.lua @@ -1,6 +1,6 @@ if GetResourceState('qb-clothing') ~= 'started' then return end -Clothing = {} +Clothing = Clothing or {} StoredOldClothing = {} diff --git a/modules/clothing/qb-clothing/server.lua b/modules/clothing/qb-clothing/server.lua index 5083d20..63e73e1 100644 --- a/modules/clothing/qb-clothing/server.lua +++ b/modules/clothing/qb-clothing/server.lua @@ -5,4 +5,22 @@ RegisterNetEvent('qb-clothing:saveSkin', function(model, skin) if model ~= nil and skin ~= nil then TriggerClientEvent('community_bridge:client:updateStoredClothing', src, skin) end -end) \ No newline at end of file +end) + +Clothing = Clothing or {} + +Clothing.SetAppearance = function(src, data) + --wip +end + +Clothing.GetAppearance = function(src) + --wip +end + +Clothing.RestoreAppearance = function(src) + --wip +end + +Clothing.ReloadSkin = function(src) + --wip +end \ No newline at end of file diff --git a/modules/notify/.ox/client.lua b/modules/notify/.ox/client.lua deleted file mode 100644 index 7bd0083..0000000 --- a/modules/notify/.ox/client.lua +++ /dev/null @@ -1,43 +0,0 @@ -if GetResourceState('ox_lib') ~= 'started' then return end - -Notify = Notify or {} - -local isNotifySystem = (not BridgeClientConfig.NotifySystem) or BridgeClientConfig.NotifySystem == 'auto' or BridgeClientConfig.NotifySystem == 'ox' -local isHelpTextSystem = (not BridgeClientConfig.HelpTextSystem) or BridgeClientConfig.HelpTextSystem == 'auto' or BridgeClientConfig.HelpTextSystem == 'ox' - - - --- █▄ █ ▄▀▄ ▀█▀ █ █▀ ▀▄▀ ▄▀▀ ▀▄▀ ▄▀▀ ▀█▀ ██▀ █▄ ▄█ --- █ ▀█ ▀▄▀ █ █ █▀ █ ▄█▀ █ ▄█▀ █ █▄▄ █ ▀ █ -if isHelpTextSystem and not isNotifySystem then goto HELP_TEXT_SYSTEM end -Notify.SendNotify = function(message, type, time) - return exports.ox_lib:notify({ description = message, type = type, position = 'center-left' }) -end - - --- █▄█ ██▀ █ █▀▄ ▀█▀ ██▀ ▀▄▀ ▀█▀ ▄▀▀ ▀▄▀ ▄▀▀ ▀█▀ ██▀ █▄ ▄█ --- █ █ █▄▄ █▄▄ █▀ █ █▄▄ █ █ █ ▄█▀ █ ▄█▀ █ █▄▄ █ ▀ █ -if not isHelpTextSystem then return end - ::HELP_TEXT_SYSTEM:: -Notify.ShowHelpText = function(message, _position) - if _position == nil then _position = 'left-center' end - return exports.ox_lib:showTextUI(message, { position = _position }) -end - -Notify.HideHelpText = function() - return exports.ox_lib:hideTextUI() -end - --- .--------. --- | taktak | --- |/-------' --- .-. ,-. --- ;oo oo; --- / \| |/ \ --- |. `. .' .| --- `;.;' `;.;' --- .-^-. .-^-. --- | | | | | | - - - diff --git a/modules/notify/_default/client.lua b/modules/notify/_default/client.lua index 65585f8..a796cb9 100644 --- a/modules/notify/_default/client.lua +++ b/modules/notify/_default/client.lua @@ -1,19 +1,75 @@ Notify = Notify or {} +local notifyType = BridgeClientConfig.NotifySystem +local helptextType = BridgeClientConfig.ShowHelpText -Notify.SendNotify = function(message, type, time) - Utility.NotifyText(message) +Notify.SendNotify = function(message, _type, time) + time = time or 3000 + if notifyType == 'qb' then + return Framework.Notify(message, nil, time) + elseif notifyType == 'mythic' then + return exports['mythic_notify']:SendAlert('inform', message, time) + elseif notifyType == 'pNotify' then + return exports['pNotify']:SendNotification({ text = message, type = _type, timeout = time, layout = 'centerRight' }) + elseif notifyType == 'esx' then + return Framework.Notify(message, _type, time) + elseif notifyType == 'ox' then + return exports.ox_lib:notify({ description = message, type = _type, position = 'center-left' }) + elseif notifyType == 'okok' then + return exports['okokNotify']:Alert('Notification', message, time, _type, false) + elseif notifyType == 't-notify' then + return exports['t-notify']:Alert({ style = 'info', message = message, duration = time, }) + elseif notifyType == 'wasabi' then + return exports.wasabi_notify:notify(_type, message, time, _type) + elseif notifyType == 'custom' then + return Prints.Error("You have not set up a custom notify in community_bridge") + else + return Prints.Error("You have not configured a notify in community_bridge") + end end - Notify.ShowHelpText = function(message, _position) - Utility.HelpText(message, 7000) + if helptextType == 'ox' then + if _position == nil then _position = 'left-center' end + return exports.ox_lib:showTextUI(message, { position = _position }) + elseif helptextType == 'jg' then + return exports['jg-textui']:DrawText(message) + elseif helptextType == 'qb' then + if _position == nil then _position = 'left' end + return Framework.ShowHelpText(message, _position) + elseif helptextType == 'okok' then + if _position == nil then _position = 'left' end + return exports['okokTextUI']:Open(message, 'darkblue', _position, false) + elseif helptextType == 'cd' then + return TriggerEvent('cd_drawtextui:ShowUI', 'show', message) + elseif helptextType == 'lab' then + return exports['lab-HintUI']:Show(message, "Hint Text") + elseif helptextType == 'custom' then + return Prints.Error("You have not set up a custom ShowHelpText in community_bridge") + else + return Prints.Error("You have not configured a ShowHelpText in community_bridge") + end end -Notify.HideHelpText = function() - +Notify.HideHelpText = function() + if helptextType == 'ox' then + return exports.ox_lib:hideTextUI() + elseif helptextType == 'jg' then + return exports['jg-textui']:HideText() + elseif helptextType == 'qb' then + return Framework.HideHelpText() + elseif helptextType == 'okok' then + return exports['okokTextUI']:Close() + elseif helptextType == 'cd' then + return TriggerEvent('cd_drawtextui:HideUI') + elseif helptextType == 'lab' then + return exports['lab-HintUI']:Hide() + elseif helptextType == 'custom' then + return Prints.Error("You have not set up a custom HideHelpText in community_bridge") + else + return Prints.Error("You have not configured a HideHelpText in community_bridge") + end end - RegisterNetEvent('community_bridge:Client:Notify', function(message, _type, time) Notify.SendNotify(message, _type, time) end) diff --git a/modules/notify/_esx/client.lua b/modules/notify/_esx/client.lua deleted file mode 100644 index 5e44def..0000000 --- a/modules/notify/_esx/client.lua +++ /dev/null @@ -1,8 +0,0 @@ -if GetResourceState('esx') ~= 'started' then return end -if BridgeClientConfig.NotifySystem and (BridgeClientConfig.NotifySystem ~= 'auto' and BridgeClientConfig.NotifySystem ~= 'esx') then return end - -Notify = Notify or {} - -Notify.SendNotify = function(message, type, time) - return ESX.ShowNotification(message, type, time) -end diff --git a/modules/notify/_qb/client.lua b/modules/notify/_qb/client.lua deleted file mode 100644 index 7f09295..0000000 --- a/modules/notify/_qb/client.lua +++ /dev/null @@ -1,8 +0,0 @@ -if GetResourceState('qb-core') ~= 'started' then return end -if BridgeClientConfig.NotifySystem and (BridgeClientConfig.NotifySystem ~= 'auto' and BridgeClientConfig.NotifySystem ~= 'qb') then return end -Notify = Notify or {} - - -Notify.SendNotify = function(message, type, time) - return TriggerEvent('QBCore:Notify', message, 'primary', time) -end \ No newline at end of file diff --git a/modules/notify/jg/client.lua b/modules/notify/jg/client.lua deleted file mode 100644 index 6d00748..0000000 --- a/modules/notify/jg/client.lua +++ /dev/null @@ -1,11 +0,0 @@ -if GetResourceState('jg-textui') ~= 'started' then return end -if BridgeClientConfig.HelpTextSystem and (BridgeClientConfig.HelpTextSystem ~= 'auto' and BridgeClientConfig.HelpTextSystem ~= 'jg') then return end -Notify = Notify or {} - -Notify.ShowHelpText = function(message, _position) - return exports['jg-textui']:DrawText(message) -end - -Notify.HideHelpText = function() - return exports['jg-textui']:HideText() -end diff --git a/modules/notify/lab/client.lua b/modules/notify/lab/client.lua deleted file mode 100644 index 0e19074..0000000 --- a/modules/notify/lab/client.lua +++ /dev/null @@ -1,12 +0,0 @@ -if GetResourceState('lab-HintUI') ~= 'started' then return end -if BridgeClientConfig.HelpTextSystem and (BridgeClientConfig.HelpTextSystem ~= 'auto' and BridgeClientConfig.HelpTextSystem ~= 'lab') then return end - -Notify = Notify or {} - -Notify.ShowHelpText = function(message, _position) - return exports['lab-HintUI']:Show(message, "Hint Text") -end - -Notify.HideHelpText = function() - return exports['lab-HintUI']:Hide() -end diff --git a/modules/notify/mythic/client.lua b/modules/notify/mythic/client.lua deleted file mode 100644 index 8c65f7b..0000000 --- a/modules/notify/mythic/client.lua +++ /dev/null @@ -1,8 +0,0 @@ -if GetResourceState('mythic_notify') ~= 'started' then return end -if BridgeClientConfig.NotifySystem and (BridgeClientConfig.NotifySystem ~= 'auto' and BridgeClientConfig.NotifySystem ~= 'mythic') then return end - -Notify = Notify or {} - -Notify.SendNotify = function(message, type, time) - return exports['mythic_notify']:SendAlert('inform', message, time) -end diff --git a/modules/notify/p-notify/client.lua b/modules/notify/p-notify/client.lua deleted file mode 100644 index a69c06d..0000000 --- a/modules/notify/p-notify/client.lua +++ /dev/null @@ -1,9 +0,0 @@ -if GetResourceState('pNotify') ~= 'started' then return end -if BridgeClientConfig.NotifySystem and (BridgeClientConfig.NotifySystem ~= 'auto' and BridgeClientConfig.NotifySystem ~= 'pNotify') then return end - -Notify = Notify or {} - - -Notify.SendNotify = function(message, type, time) - return exports['pNotify']:SendNotification({ text = message, type = type, timeout = time, layout = 'centerRight' }) -end diff --git a/modules/notify/t-notify/client.lua b/modules/notify/t-notify/client.lua deleted file mode 100644 index 14d097c..0000000 --- a/modules/notify/t-notify/client.lua +++ /dev/null @@ -1,8 +0,0 @@ -if GetResourceState('t-notify') ~= 'started' then return end -if BridgeClientConfig.NotifySystem and (BridgeClientConfig.NotifySystem ~= 'auto' and BridgeClientConfig.NotifySystem ~= 't-notify') then return end - -Notify = Notify or {} -Notify.SendNotify = function(message, type, time) - return exports['t-SendNotify']:Alert({ style = 'info', message = message, duration = time }) -end - diff --git a/modules/notify/wasabi/client.lua b/modules/notify/wasabi/client.lua deleted file mode 100644 index df9dc40..0000000 --- a/modules/notify/wasabi/client.lua +++ /dev/null @@ -1,9 +0,0 @@ -if GetResourceState('wasabi_notify') ~= 'started' then return end -if BridgeClientConfig.NotifySystem and (BridgeClientConfig.NotifySystem ~= 'auto' and BridgeClientConfig.NotifySystem ~= 'wasabi') then return end - -Notify = Notify or {} -Notify.SendNotify = function(message, type, time) - return exports.wasabi_notify:notify(type, message, time, type) -end - - \ No newline at end of file diff --git a/modules/vehicleKey/_default/client/client.lua b/modules/vehicleKey/_default/client/client.lua new file mode 100644 index 0000000..8e2d8cd --- /dev/null +++ b/modules/vehicleKey/_default/client/client.lua @@ -0,0 +1,9 @@ +VehicleKey = {} + +VehicleKey.GiveKeys = function(vehicle, plate) + +end + +VehicleKey.RemoveKeys = function(vehicle, plate) + +end \ No newline at end of file diff --git a/modules/vehicleKey/_default/server/server.lua b/modules/vehicleKey/_default/server/server.lua new file mode 100644 index 0000000..95dc21f --- /dev/null +++ b/modules/vehicleKey/_default/server/server.lua @@ -0,0 +1,9 @@ +VehicleKey = {} + +VehicleKey.GiveKeys = function(src, vehicle, plate) + --wip +end + +VehicleKey.RemoveKeys = function(src, vehicle, plate) + -- wip +end \ No newline at end of file