-
-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(client): Move logic to separate lua files (#300)
- Loading branch information
1 parent
def920a
commit cf1f7a6
Showing
10 changed files
with
490 additions
and
478 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
function CheckDuty() | ||
return not Config.OnDutyOnlyClothingRooms or (Config.OnDutyOnlyClothingRooms and client.job.onduty) | ||
end | ||
|
||
function IsPlayerAllowedForOutfitRoom(outfitRoom) | ||
local isAllowed = false | ||
local count = #outfitRoom.citizenIDs | ||
for i = 1, count, 1 do | ||
if Framework.IsPlayerAllowed(outfitRoom.citizenIDs[i]) then | ||
isAllowed = true | ||
break | ||
end | ||
end | ||
return isAllowed or not outfitRoom.citizenIDs or count == 0 | ||
end | ||
|
||
function GetPlayerJobOutfits(clothingRoom) | ||
local outfits = {} | ||
local gender = Framework.GetGender() | ||
local gradeLevel = clothingRoom.job and Framework.GetJobGrade() or Framework.GetGangGrade() | ||
local jobName = clothingRoom.job and client.job.name or client.gang.name | ||
|
||
if Config.BossManagedOutfits then | ||
local mType = clothingRoom.job and "Job" or "Gang" | ||
local result = lib.callback.await("illenium-appearance:server:getManagementOutfits", false, mType, gender) | ||
for i = 1, #result, 1 do | ||
outfits[#outfits + 1] = { | ||
type = mType, | ||
model = result[i].model, | ||
components = result[i].components, | ||
props = result[i].props, | ||
disableSave = true, | ||
name = result[i].name | ||
} | ||
end | ||
else | ||
for i = 1, #Config.Outfits[jobName][gender], 1 do | ||
for _, v in pairs(Config.Outfits[jobName][gender][i].grades) do | ||
if v == gradeLevel then | ||
outfits[#outfits + 1] = Config.Outfits[jobName][gender][i] | ||
outfits[#outfits].gender = gender | ||
outfits[#outfits].jobName = jobName | ||
end | ||
end | ||
end | ||
end | ||
|
||
return outfits | ||
end | ||
|
||
function OpenOutfitRoom(outfitRoom) | ||
local isAllowed = IsPlayerAllowedForOutfitRoom(outfitRoom) | ||
if isAllowed then | ||
OpenMenu(nil, "outfit") | ||
end | ||
end | ||
|
||
function OpenBarberShop() | ||
local config = GetDefaultConfig() | ||
config.headOverlays = true | ||
OpenShop(config, false, "barber") | ||
end | ||
|
||
function OpenTattooShop() | ||
local config = GetDefaultConfig() | ||
config.tattoos = true | ||
OpenShop(config, false, "tattoo") | ||
end | ||
|
||
function OpenSurgeonShop() | ||
local config = GetDefaultConfig() | ||
config.headBlend = true | ||
config.faceFeatures = true | ||
OpenShop(config, false, "surgeon") | ||
end | ||
|
||
AddEventHandler("onResourceStop", function(resource) | ||
if resource == GetCurrentResourceName() then | ||
if Config.BossManagedOutfits then | ||
Management.RemoveItems() | ||
end | ||
end | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
if not Config.UseTarget then return end | ||
|
||
if not Target.IsOX() then return end | ||
|
||
local ZoneIDMap = {} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
if not Config.UseTarget then return end | ||
|
||
if not Target.IsQB() then return end | ||
|
||
function Target.RemoveZone(zone) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.