Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Urek00Bg committed Dec 9, 2024
2 parents 4b2ac42 + d942d5d commit 1ed2907
Show file tree
Hide file tree
Showing 27 changed files with 350 additions and 85 deletions.
50 changes: 32 additions & 18 deletions .github/actions/update-manifest-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const fs = require("fs");
const { execSync, exec } = require("child_process");

(async () => {
const ReleaseType = process.env.RELEASE_TYPE;
const ReleaseType = process.env.RELEASE_TYPE || 'Release';
let ManifestFile = fs.readFileSync("fxmanifest.lua", { encoding: "utf8" });

// Patch Version
Expand All @@ -20,7 +20,7 @@ const { execSync, exec } = require("child_process");

// Version
const Version = ManifestFile.match(/\bversion\s+["']?([\d.]+)["']?/)[1] || "1.0.0";
const NewVersion = NextVersionNo(Version);
const NewVersion = NextVersionNo(Version, ReleaseType);

execSync(`RELEASE_VERSION=${NewVersion}\necho "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV`);

Expand Down Expand Up @@ -53,23 +53,37 @@ const { execSync, exec } = require("child_process");
})();

/**
* Increments the given version number by one patch version.
* If the patch version exceeds 9, it resets to 0 and increments the minor version.
* If the minor version exceeds 9, it resets to 0 and increments the major version.
* Increments the given version number based on the update type.
* - "Release" updates follow the schema X.X.X.
* - "Hotfix" updates follow the schema X.X.X.X.
*
* @param {string} version - The current version number in the format "major.minor.patch".
* @returns {string} - The next version number in the format "major.minor.patch".
* @param {string} version - The current version number.
* @param {string} updateType - The type of update ("Release" or "Hotfix").
* @returns {string} - The next version number.
*/
function NextVersionNo(version) {
let [major, minor, patch] = version.split(".").map(Number);
patch++;
if (patch > 9) {
patch = 0;
minor++;
}
if (minor > 9) {
minor = 0;
major++;
function NextVersionNo(version, updateType) {
let parts = version.split(".").map(Number);

if (updateType.toLowerCase() === "release") {
// Ensure the version has 3 parts for release schema
while (parts.length < 3) parts.push(0);
let [major, minor, patch] = parts;
patch++;
if (patch > 9) {
patch = 0;
minor++;
}
if (minor > 9) {
minor = 0;
major++;
}
return `${major}.${minor}.${patch}`;
} else if (updateType.toLowerCase() === "hotfix") {
while (parts.length < 4) parts.push(0);
let [major, minor, patch, hotfix] = parts;
hotfix++;
return `${major}.${minor}.${patch}.${hotfix}`;
} else {
throw new Error("Invalid update type. Use 'Release' or 'Hotfix'.");
}
return `${major}.${minor}.${patch}`;
}
11 changes: 9 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,17 @@ jobs:
if: github.event.head_commit.author.email != '41898282+github-actions[bot]@users.noreply.github.com'

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Lint
uses: iLLeniumStudios/fivem-lua-lint-action@v2
with:
capture: "junit.xml"
args: "-t --formatter JUnit"
extra_libs: mysql
extra_libs: mysql
- name: Generate Lint Report
if: always()
uses: mikepenz/action-junit-report@v3
with:
report_paths: "**/junit.xml"
check_name: Linting Report
fail_on_failure: false
17 changes: 10 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ on:
branches:
- main
workflow_dispatch:

inputs:
update_type:
description: "Select the type of update"
required: true
type: choice
options:
- Hotfix
- Release
env:
REPOSITORY_NAME: ${{ github.event.repository.name }}

Expand Down Expand Up @@ -52,15 +59,10 @@ jobs:
- name: Update Manifest Data
run: node .github/actions/update-manifest-data.js
env:
RELEASE_TYPE: release
RELEASE_TYPE: ${{ github.event.inputs.update_type }}
RELEASE_USER: ${{ github.actor }}
RELEASE_PATCH: ${{ env.COMMIT_COUNT }}

- name: Create Tag
run: |
git tag -a v${{ env.RELEASE_VERSION }} -m "Release v${{ env.RELEASE_VERSION }}"
git push origin v${{ env.RELEASE_VERSION }}
- name: Push Manifest Change
uses: EndBug/add-and-commit@v8
with:
Expand All @@ -84,6 +86,7 @@ jobs:
id: auto_release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
automatic_release_tag: v${{ env.RELEASE_VERSION }}
title: 🎅 v${{ env.RELEASE_VERSION }}
prerelease: false
files: |
Expand Down
4 changes: 3 additions & 1 deletion ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,15 @@ All settings are customizable in the script. Here are a few examples:
- [ ] Christmas Music / Soundeffect
- [x] Prevent Snowballs pickup indoors
- [x] Unarm Player when decorating tree, open gift etc.
- [ ] Small HUD Overlay UI for Gifts etc.
- [x] Small HUD Overlay UI for Gifts etc.
- [ ] Setuper/Placer for PropSystem and Christmas Trees and Presents (To place them easily on the map)
- [ ] Christmas Quests
- [ ] PropSystem add more props
- [ ] Christmas Present remove when cooldown (open)
- [ ] Smoother Teleport to the prop
- [x] Snow Overlay when outside
- [ ] Build Snowman
- [ ] Own timesync or something to fix the problem with multiple weather scripts

## Support
For assistance, reporting bugs, or sharing suggestions, you can:
Expand Down
60 changes: 40 additions & 20 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ if string.find(GetCurrentResourceName(), 'dream') then
end

-- Global Variables

-- Ready UI
RegisterNUICallback("readyUI", function(data, cb)
SendNUIMessage({ type = 'startup', locales = Locales })
cb()
end)

-- Snow System
if DreamCore.XmasSnow then
print("^6[Dream-Services]^7 Snow is enabled!")
Citizen.CreateThread(function()
Expand Down Expand Up @@ -111,25 +119,25 @@ if DreamCore.XmasSnow then
end
end)
end
end

-- Snow Overlay
if DreamCore.SnowOverlay then
Citizen.CreateThread(function()
while true do
if
GetInteriorFromEntity(cache.ped) ~= 0 -- Check if player is in interior
or IsPedInAnyVehicle(cache.ped) -- Check if player is in vehicle
then
SendNUIMessage({ type = 'snow_overlay:hide' })
else
SendNUIMessage({ type = 'snow_overlay:show' })
if DreamCore.SnowOverlay then
Citizen.CreateThread(function()
while true do
if
GetInteriorFromEntity(cache.ped) ~= 0 -- Check if player is in interior
or IsPedInAnyVehicle(cache.ped) -- Check if player is in vehicle
then
SendNUIMessage({ type = 'snow_overlay:hide' })
else
SendNUIMessage({ type = 'snow_overlay:show' })
end
Citizen.Wait(1000)
end
Citizen.Wait(1000)
end
end)
end)
end
end


-- Load Models
Citizen.CreateThread(function()
for k, v in pairs(DreamCore.PropSystem) do
Expand Down Expand Up @@ -158,9 +166,11 @@ AddEventHandler("dream_christmas:client:createPropSystem", function(AllObjects)
for k, v in pairs(AllObjects) do
-- Check Coords
if DreamCore.CheckPropCoords(v.coords) and not v.claimed then
local SpawnedProp = CreateObject(GetHashKey(v.prop.model), v.coords, true, true, true)
FreezeEntityPosition(SpawnedProp, true)
local SpawnedProp = CreateObject(GetHashKey(v.prop.model), v.coords, false, true, true)
SetEntityHeading(SpawnedProp, v.heading)
FreezeEntityPosition(SpawnedProp, true)
SetEntityInvincible(SpawnedProp, true)
SetBlockingOfNonTemporaryEvents(SpawnedProp, true)

-- Add Target
local TargetId = nil
Expand All @@ -172,7 +182,7 @@ AddEventHandler("dream_christmas:client:createPropSystem", function(AllObjects)
end
FreezeEntityPosition(cache.ped, true)
SetCurrentPedWeapon(cache.ped, GetHashKey('WEAPON_UNARMED'), true) -- Unarm Player

SendNUIMessage({ type = 'activity_popup:start', variant = 'randomprop_snowman' })
if lib.progressBar({
duration = DreamCore.PropSystemProgressBar,
label = Locales['PropSystem']['ProgressBar'],
Expand All @@ -191,6 +201,7 @@ AddEventHandler("dream_christmas:client:createPropSystem", function(AllObjects)
})
then
FreezeEntityPosition(cache.ped, false)
SendNUIMessage({ type = 'activity_popup:stop' })
local result = lib.callback.await('dream_christmas:server:rewardPropSystem', false, v.id)

if result.success then
Expand Down Expand Up @@ -283,9 +294,11 @@ local ChristmasTreeData = {}
Citizen.CreateThread(function()
for k, v in pairs(DreamCore.ChristmasTree) do
lib.requestModel(GetHashKey(v.model))
local SpawnedProp = CreateObject(GetHashKey(v.model), v.coords, true, true, true)
local SpawnedProp = CreateObject(GetHashKey(v.model), v.coords, false, true, true)
SetEntityHeading(SpawnedProp, v.heading)
FreezeEntityPosition(SpawnedProp, true)
SetEntityInvincible(SpawnedProp, true)
SetBlockingOfNonTemporaryEvents(SpawnedProp, true)

-- Add Target
local TargetId = nil
Expand All @@ -297,6 +310,7 @@ Citizen.CreateThread(function()
end

SetCurrentPedWeapon(cache.ped, GetHashKey('WEAPON_UNARMED'), true) -- Unarm Player
SendNUIMessage({ type = 'activity_popup:start', variant = 'tree' })
if lib.progressBar({
duration = DreamCore.ChristmasTreeProgressBar.decorate,
label = Locales['ChristmasTree']['Decorate']['ProgressBar'],
Expand All @@ -314,6 +328,7 @@ Citizen.CreateThread(function()
}
})
then
SendNUIMessage({ type = 'activity_popup:stop' })
local result = lib.callback.await('dream_christmas:server:decorateChristmasTree', false, v.id)
if result.success then
TriggerEvent("dream_christmas:client:notify", result.message, "success", 5000)
Expand Down Expand Up @@ -360,9 +375,12 @@ local ChristmasPresentData = {}
Citizen.CreateThread(function()
for k, v in pairs(DreamCore.ChristmasPresents) do
lib.requestModel(GetHashKey(v.model))
local SpawnedProp = CreateObject(GetHashKey(v.model), v.coords, true, true, true)
local SpawnedProp = CreateObject(GetHashKey(v.model), v.coords, false, true, true)
SetEntityHeading(SpawnedProp, v.heading)
FreezeEntityPosition(SpawnedProp, true)
FreezeEntityPosition(SpawnedProp, true)
SetEntityInvincible(SpawnedProp, true)
SetBlockingOfNonTemporaryEvents(SpawnedProp, true)

-- Add Target
local TargetId = nil
Expand All @@ -374,6 +392,7 @@ Citizen.CreateThread(function()
end

SetCurrentPedWeapon(cache.ped, GetHashKey('WEAPON_UNARMED'), true) -- Unarm Player
SendNUIMessage({ type = 'activity_popup:start', variant = 'present' })
if lib.progressBar({
duration = DreamCore.ChristmasPresentProgressBar.open,
label = Locales['ChristmasPresent']['Claim']['ProgressBar'],
Expand All @@ -391,6 +410,7 @@ Citizen.CreateThread(function()
}
})
then
SendNUIMessage({ type = 'activity_popup:stop' })
local result = lib.callback.await('dream_christmas:server:claimChristmasPresent', false, v.id)
if result.success then
TriggerEvent("dream_christmas:client:notify", result.message, "success", 5000)
Expand Down
6 changes: 3 additions & 3 deletions fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ lua54 'yes'

author 'Dream Services | Tuncion'
description 'https://discord.gg/zppUXj4JRm'
version '1.0.5'
patch '#28'
released '01.12.2024, 16:36 by Tuncion'
version '1.0.6.2'
patch '#53'
released '08.12.2024, 17:10 by Tuncion'

ui_page 'web/index.html'

Expand Down
Loading

0 comments on commit 1ed2907

Please sign in to comment.