From 498228ced49c4b9009788457f821f9b9bf04bfa3 Mon Sep 17 00:00:00 2001 From: LeoTK <41605307+LeoTKBR@users.noreply.github.com> Date: Wed, 4 Oct 2023 14:58:11 -0300 Subject: [PATCH 01/18] Update login.lua --- data-canary/scripts/creaturescripts/login.lua | 28 +++++++++---------- data/npclib/npc_system/modules.lua | 4 +-- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/data-canary/scripts/creaturescripts/login.lua b/data-canary/scripts/creaturescripts/login.lua index def03ceb3ec..a97452c0a01 100644 --- a/data-canary/scripts/creaturescripts/login.lua +++ b/data-canary/scripts/creaturescripts/login.lua @@ -16,20 +16,6 @@ function login.onLogin(player) -- Stamina nextUseStaminaTime[player.uid] = 0 - -- Promotion - local vocation = player:getVocation() - local promotion = vocation:getPromotion() - if player:isPremium() then - local value = player:getStorageValue(Storage.Promotion) - if not promotion and value ~= 1 then - player:setStorageValue(STORAGEVALUE_PROMOTION, 1) - elseif value == 1 then - player:setVocation(promotion) - end - elseif not promotion then - player:setVocation(vocation:getDemotion()) - end - -- Events player:registerEvent("PlayerDeath") player:registerEvent("DropLoot") @@ -101,6 +87,20 @@ function login.onLogin(player) -- Stamina nextUseStaminaTime[playerId] = 1 + + -- Promotion + local vocation = player:getVocation() + local promotion = vocation:getPromotion() + if player:isPremium() then + local value = player:getStorageValue(Storage.Promotion) + if not promotion and value ~= 1 then + player:setStorageValue(STORAGEVALUE_PROMOTION, 1) + elseif value == 1 then + player:setVocation(promotion) + end + elseif not promotion then + player:setVocation(vocation:getDemotion()) + end -- EXP Stamina nextUseXpStamina[playerId] = 1 diff --git a/data/npclib/npc_system/modules.lua b/data/npclib/npc_system/modules.lua index 523c332b499..77aac80a638 100644 --- a/data/npclib/npc_system/modules.lua +++ b/data/npclib/npc_system/modules.lua @@ -96,9 +96,7 @@ if Modules == nil then if player:isPremium() or not parameters.premium then local promotion = player:getVocation():getPromotion() - if player:getStorageValue(STORAGEVALUE_PROMOTION) == 1 then - npcHandler:say("You are already promoted!", npc, player) - elseif player:getLevel() < parameters.level then + if player:getLevel() < parameters.level then npcHandler:say(string.format("I am sorry, but I can only promote you once you have reached level %d.", parameters.level), npc, player) elseif not player:removeMoneyBank(parameters.cost) then npcHandler:say("You do not have enough money!", npc, player) From e492edfd0f5618356d758332c6a79e05a440f248 Mon Sep 17 00:00:00 2001 From: LeoTK <41605307+LeoTKBR@users.noreply.github.com> Date: Wed, 1 Nov 2023 14:27:36 -0300 Subject: [PATCH 02/18] Create autosync.yml Auto Sync Fork --- .github/workflows/autosync.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/autosync.yml diff --git a/.github/workflows/autosync.yml b/.github/workflows/autosync.yml new file mode 100644 index 00000000000..e7974a97e5f --- /dev/null +++ b/.github/workflows/autosync.yml @@ -0,0 +1,24 @@ +# .github/workflows/autosync.yml + +name: Merge upstream to main +on: + schedule: + - cron: '0 */12 * * *' # A cada 12 horas + +jobs: + merge: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Merge upstream + run: | + git config --global user.name 'LeoTKBR' + git config --global user.email '41605307+LeoTKBR@users.noreply.github.com' + + git pull --unshallow + git remote add upstream https://github.com/opentibiabr/canary + git fetch upstream + + git checkout main + git merge --no-edit upstream/main + git push origin main From b312e753e69dade2fc2c280d1bae21a699e364d4 Mon Sep 17 00:00:00 2001 From: LeoTK <41605307+LeoTKBR@users.noreply.github.com> Date: Wed, 1 Nov 2023 14:35:47 -0300 Subject: [PATCH 03/18] Update autosync.yml --- .github/workflows/autosync.yml | 48 ++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/.github/workflows/autosync.yml b/.github/workflows/autosync.yml index e7974a97e5f..e3029367a41 100644 --- a/.github/workflows/autosync.yml +++ b/.github/workflows/autosync.yml @@ -1,24 +1,40 @@ -# .github/workflows/autosync.yml - -name: Merge upstream to main on: schedule: - - cron: '0 */12 * * *' # A cada 12 horas + - cron: '0 */12 * * *' + # scheduled at 07:00 every Monday and Thursday + + workflow_dispatch: # click the button on Github repo! + jobs: - merge: + sync_with_upstream: runs-on: ubuntu-latest + name: Sync main with upstream latest + steps: - - uses: actions/checkout@v2 - - name: Merge upstream - run: | - git config --global user.name 'LeoTKBR' - git config --global user.email '41605307+LeoTKBR@users.noreply.github.com' + # Step 1: run a standard checkout action, provided by github + - name: Checkout main + uses: actions/checkout@v2 + with: + ref: main + # submodules: 'recursive' ### may be needed in your situation + + # Step 2: run this sync action - specify the upstream repo, upstream branch to sync with, and target sync branch + - name: Pull (Fast-Forward) upstream changes + id: sync + uses: aormsby/Fork-Sync-With-Upstream-action@v2.1 + with: + upstream_repository: opentibiabr/canary + upstream_branch: main + target_branch: main + git_pull_args: --ff-only # optional arg use, defaults to simple 'pull' + github_token: ${{ secrets.GITHUB_TOKEN }} # optional, for accessing repos that require authentication - git pull --unshallow - git remote add upstream https://github.com/opentibiabr/canary - git fetch upstream + # Step 3: Display a message if 'sync' step had new commits (simple test) + - name: Check for new commits + if: steps.sync.outputs.has_new_commits + run: echo "There were new commits." - git checkout main - git merge --no-edit upstream/main - git push origin main + # Step 4: Print a helpful timestamp for your records (not required, just nice) + - name: Timestamp + run: date From 13c7799c5aa167f791596f410841b00d6af3e5fc Mon Sep 17 00:00:00 2001 From: LeoTK <41605307+LeoTKBR@users.noreply.github.com> Date: Wed, 1 Nov 2023 14:37:15 -0300 Subject: [PATCH 04/18] Update autosync.yml --- .github/workflows/autosync.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/autosync.yml b/.github/workflows/autosync.yml index e3029367a41..ab6c480cfd4 100644 --- a/.github/workflows/autosync.yml +++ b/.github/workflows/autosync.yml @@ -1,3 +1,5 @@ +name: Auto - Sync Fork + on: schedule: - cron: '0 */12 * * *' From abcc3a2962012a045919444ab427fd3261b3bd9b Mon Sep 17 00:00:00 2001 From: LeoTK <41605307+LeoTKBR@users.noreply.github.com> Date: Wed, 1 Nov 2023 14:44:48 -0300 Subject: [PATCH 05/18] Update autosync.yml --- .github/workflows/autosync.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/autosync.yml b/.github/workflows/autosync.yml index ab6c480cfd4..09eef45f3db 100644 --- a/.github/workflows/autosync.yml +++ b/.github/workflows/autosync.yml @@ -24,7 +24,7 @@ jobs: # Step 2: run this sync action - specify the upstream repo, upstream branch to sync with, and target sync branch - name: Pull (Fast-Forward) upstream changes id: sync - uses: aormsby/Fork-Sync-With-Upstream-action@v2.1 + uses: LeoTKBR/Fork-Sync-With-Upstream-action@v2.1 with: upstream_repository: opentibiabr/canary upstream_branch: main From a383e95ba7d7eafc5fa0ce8010debe18406a0b8a Mon Sep 17 00:00:00 2001 From: LeoTK <41605307+LeoTKBR@users.noreply.github.com> Date: Wed, 1 Nov 2023 14:46:00 -0300 Subject: [PATCH 06/18] Update autosync.yml --- .github/workflows/autosync.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/autosync.yml b/.github/workflows/autosync.yml index 09eef45f3db..ab6c480cfd4 100644 --- a/.github/workflows/autosync.yml +++ b/.github/workflows/autosync.yml @@ -24,7 +24,7 @@ jobs: # Step 2: run this sync action - specify the upstream repo, upstream branch to sync with, and target sync branch - name: Pull (Fast-Forward) upstream changes id: sync - uses: LeoTKBR/Fork-Sync-With-Upstream-action@v2.1 + uses: aormsby/Fork-Sync-With-Upstream-action@v2.1 with: upstream_repository: opentibiabr/canary upstream_branch: main From e0b9d703d8dc98dade2e053b50d6fa4f3558e1a1 Mon Sep 17 00:00:00 2001 From: LeoTK <41605307+LeoTKBR@users.noreply.github.com> Date: Wed, 1 Nov 2023 14:54:25 -0300 Subject: [PATCH 07/18] Update autosync.yml --- .github/workflows/autosync.yml | 75 ++++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 30 deletions(-) diff --git a/.github/workflows/autosync.yml b/.github/workflows/autosync.yml index ab6c480cfd4..71007c24fac 100644 --- a/.github/workflows/autosync.yml +++ b/.github/workflows/autosync.yml @@ -2,11 +2,10 @@ name: Auto - Sync Fork on: schedule: - - cron: '0 */12 * * *' - # scheduled at 07:00 every Monday and Thursday - - workflow_dispatch: # click the button on Github repo! + - cron: '0 */12 * * *' # Agendado a cada 12 horas + # Agendado às 07:00 toda segunda e quinta-feira + workflow_dispatch: # Clique no botão no repositório do GitHub jobs: sync_with_upstream: @@ -14,29 +13,45 @@ jobs: name: Sync main with upstream latest steps: - # Step 1: run a standard checkout action, provided by github - - name: Checkout main - uses: actions/checkout@v2 - with: - ref: main - # submodules: 'recursive' ### may be needed in your situation - - # Step 2: run this sync action - specify the upstream repo, upstream branch to sync with, and target sync branch - - name: Pull (Fast-Forward) upstream changes - id: sync - uses: aormsby/Fork-Sync-With-Upstream-action@v2.1 - with: - upstream_repository: opentibiabr/canary - upstream_branch: main - target_branch: main - git_pull_args: --ff-only # optional arg use, defaults to simple 'pull' - github_token: ${{ secrets.GITHUB_TOKEN }} # optional, for accessing repos that require authentication - - # Step 3: Display a message if 'sync' step had new commits (simple test) - - name: Check for new commits - if: steps.sync.outputs.has_new_commits - run: echo "There were new commits." - - # Step 4: Print a helpful timestamp for your records (not required, just nice) - - name: Timestamp - run: date + # Passo 1: Executa uma ação de checkout padrão, fornecida pelo GitHub + - name: Checkout main + uses: actions/checkout@v2 + with: + ref: main + # submodules: 'recursive' ### pode ser necessário na sua situação + + # Passo 2: Executa a ação de sincronização - especifica o repositório upstream, branch upstream para sincronizar e branch de destino da sincronização + - name: Pull (Fast-Forward) upstream changes + id: sync + uses: aormsby/Fork-Sync-With-Upstream-action@v2.1 + with: + upstream_repository: opentibiabr/canary + upstream_branch: main + target_branch: main + git_pull_args: --ff-only # argumento opcional, padrão para 'pull' simples + github_token: ${{ secrets.GITHUB_TOKEN }} # opcional, para acessar repositórios que requerem autenticação + + # Passo 3: Exibe uma mensagem se o passo 'sync' tiver novos commits (teste simples) + - name: Check for new commits + if: steps.sync.outputs.has_new_commits + run: echo "There were new commits." + + # Passo 4: Realiza o merge das alterações do repositório upstream na branch 'main' + - name: Merge upstream changes into main + run: | + git config user.name "LeoTKBR" + git config user.email "41605307+LeoTKBR@users.noreply.github.com" + + git pull --unshallow + git remote add upstream https://github.com/opentibiabr/canary.git + git fetch upstream + + git checkout main + git merge upstream/main --no-edit + git push origin main + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # Passo 5: Exibe um carimbo de data e hora útil (não é necessário, apenas agradável) + - name: Timestamp + run: date From 467fe4e65a1174683f142423426f9725661efac8 Mon Sep 17 00:00:00 2001 From: LeoTK <41605307+LeoTKBR@users.noreply.github.com> Date: Wed, 1 Nov 2023 15:01:39 -0300 Subject: [PATCH 08/18] Update autosync.yml --- .github/workflows/autosync.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/autosync.yml b/.github/workflows/autosync.yml index 71007c24fac..ef1d876410b 100644 --- a/.github/workflows/autosync.yml +++ b/.github/workflows/autosync.yml @@ -31,7 +31,7 @@ jobs: git_pull_args: --ff-only # argumento opcional, padrão para 'pull' simples github_token: ${{ secrets.GITHUB_TOKEN }} # opcional, para acessar repositórios que requerem autenticação - # Passo 3: Exibe uma mensagem se o passo 'sync' tiver novos commits (teste simples) + # Passo 3: Display a message if 'sync' step had new commits (simple test) - name: Check for new commits if: steps.sync.outputs.has_new_commits run: echo "There were new commits." @@ -43,11 +43,10 @@ jobs: git config user.email "41605307+LeoTKBR@users.noreply.github.com" git pull --unshallow - git remote add upstream https://github.com/opentibiabr/canary.git git fetch upstream git checkout main - git merge upstream/main --no-edit + git merge upstream/main --no-ff --no-edit git push origin main env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From ae7e3ecc0f3f1170e7d6ae0666d6a2d9e68bae82 Mon Sep 17 00:00:00 2001 From: LeoTK <41605307+LeoTKBR@users.noreply.github.com> Date: Wed, 1 Nov 2023 15:06:09 -0300 Subject: [PATCH 09/18] Update autosync.yml --- .github/workflows/autosync.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/autosync.yml b/.github/workflows/autosync.yml index ef1d876410b..2905d2d2deb 100644 --- a/.github/workflows/autosync.yml +++ b/.github/workflows/autosync.yml @@ -36,21 +36,17 @@ jobs: if: steps.sync.outputs.has_new_commits run: echo "There were new commits." - # Passo 4: Realiza o merge das alterações do repositório upstream na branch 'main' - - name: Merge upstream changes into main +# Passo 4: Reorganiza seus commits locais sobre os commits do upstream + - name: Rebase local changes on top of upstream run: | git config user.name "LeoTKBR" git config user.email "41605307+LeoTKBR@users.noreply.github.com" - git pull --unshallow - git fetch upstream - - git checkout main - git merge upstream/main --no-ff --no-edit + git pull --rebase upstream main git push origin main env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # Passo 5: Exibe um carimbo de data e hora útil (não é necessário, apenas agradável) +# Passo 5: Exibe um carimbo de data e hora útil (não é necessário, apenas agradável) - name: Timestamp run: date From 40f9d9ea593920b8a836e670c946d719254d8804 Mon Sep 17 00:00:00 2001 From: LeoTK <41605307+LeoTKBR@users.noreply.github.com> Date: Wed, 1 Nov 2023 15:07:23 -0300 Subject: [PATCH 10/18] Update autosync.yml --- .github/workflows/autosync.yml | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/autosync.yml b/.github/workflows/autosync.yml index 2905d2d2deb..76e6b37adab 100644 --- a/.github/workflows/autosync.yml +++ b/.github/workflows/autosync.yml @@ -19,7 +19,16 @@ jobs: with: ref: main # submodules: 'recursive' ### pode ser necessário na sua situação +# Passo 4: Reorganiza seus commits locais sobre os commits do upstream + - name: Rebase local changes on top of upstream + run: | + git config user.name "LeoTKBR" + git config user.email "41605307+LeoTKBR@users.noreply.github.com" + git pull --rebase upstream main + git push origin main + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Passo 2: Executa a ação de sincronização - especifica o repositório upstream, branch upstream para sincronizar e branch de destino da sincronização - name: Pull (Fast-Forward) upstream changes id: sync @@ -36,17 +45,6 @@ jobs: if: steps.sync.outputs.has_new_commits run: echo "There were new commits." -# Passo 4: Reorganiza seus commits locais sobre os commits do upstream - - name: Rebase local changes on top of upstream - run: | - git config user.name "LeoTKBR" - git config user.email "41605307+LeoTKBR@users.noreply.github.com" - - git pull --rebase upstream main - git push origin main - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # Passo 5: Exibe um carimbo de data e hora útil (não é necessário, apenas agradável) - name: Timestamp run: date From 430c48967e97a3ca04f3779fc653c118468c3e13 Mon Sep 17 00:00:00 2001 From: LeoTK <41605307+LeoTKBR@users.noreply.github.com> Date: Wed, 1 Nov 2023 15:24:49 -0300 Subject: [PATCH 11/18] Update autosync.yml --- .github/workflows/autosync.yml | 77 ++++++++++++++++------------------ 1 file changed, 35 insertions(+), 42 deletions(-) diff --git a/.github/workflows/autosync.yml b/.github/workflows/autosync.yml index 76e6b37adab..0ec9034711f 100644 --- a/.github/workflows/autosync.yml +++ b/.github/workflows/autosync.yml @@ -1,50 +1,43 @@ name: Auto - Sync Fork +env: + # Required, URL to upstream (fork base) + UPSTREAM_URL: "https://github.com/opentibiabr/canary.git" + # Required, token to authenticate bot, could use ${{ secrets.GITHUB_TOKEN }} + # Over here, we use a PAT instead to authenticate workflow file changes. + WORKFLOW_TOKEN: ${{ secrets.WORKFLOW_TOKEN }} + # Optional, defaults to main + UPSTREAM_BRANCH: "main" + # Optional, defaults to UPSTREAM_BRANCH + DOWNSTREAM_BRANCH: "" + # Optional fetch arguments + FETCH_ARGS: "" + # Optional merge arguments + MERGE_ARGS: "" + # Optional push arguments + PUSH_ARGS: "" + # Optional toggle to spawn time logs (keeps action active) + SPAWN_LOGS: "false" # "true" or "false" + +# This runs every day on 1801 UTC on: schedule: - - cron: '0 */12 * * *' # Agendado a cada 12 horas - # Agendado às 07:00 toda segunda e quinta-feira - - workflow_dispatch: # Clique no botão no repositório do GitHub + - cron: '0 */12 * * *' + # Allows manual workflow run (must in default branch to work) + workflow_dispatch: jobs: - sync_with_upstream: + build: runs-on: ubuntu-latest - name: Sync main with upstream latest - steps: - # Passo 1: Executa uma ação de checkout padrão, fornecida pelo GitHub - - name: Checkout main - uses: actions/checkout@v2 - with: - ref: main - # submodules: 'recursive' ### pode ser necessário na sua situação -# Passo 4: Reorganiza seus commits locais sobre os commits do upstream - - name: Rebase local changes on top of upstream - run: | - git config user.name "LeoTKBR" - git config user.email "41605307+LeoTKBR@users.noreply.github.com" - - git pull --rebase upstream main - git push origin main - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # Passo 2: Executa a ação de sincronização - especifica o repositório upstream, branch upstream para sincronizar e branch de destino da sincronização - - name: Pull (Fast-Forward) upstream changes - id: sync - uses: aormsby/Fork-Sync-With-Upstream-action@v2.1 - with: - upstream_repository: opentibiabr/canary - upstream_branch: main - target_branch: main - git_pull_args: --ff-only # argumento opcional, padrão para 'pull' simples - github_token: ${{ secrets.GITHUB_TOKEN }} # opcional, para acessar repositórios que requerem autenticação - - # Passo 3: Display a message if 'sync' step had new commits (simple test) - - name: Check for new commits - if: steps.sync.outputs.has_new_commits - run: echo "There were new commits." - -# Passo 5: Exibe um carimbo de data e hora útil (não é necessário, apenas agradável) - - name: Timestamp - run: date + - name: GitHub Sync to Upstream Repository + uses: dabreadman/sync-upstream-repo@v1.3.0 + with: + upstream_repo: ${{ env.UPSTREAM_URL }} + upstream_branch: ${{ env.UPSTREAM_BRANCH }} + downstream_branch: ${{ env.DOWNSTREAM_BRANCH }} + token: ${{ env.WORKFLOW_TOKEN }} + fetch_args: ${{ env.FETCH_ARGS }} + merge_args: ${{ env.MERGE_ARGS }} + push_args: ${{ env.PUSH_ARGS }} + spawn_logs: ${{ env.SPAWN_LOGS }} From 708239f5d48a4251dbb8511a92e7f0152aeacf0e Mon Sep 17 00:00:00 2001 From: LeoTK <41605307+LeoTKBR@users.noreply.github.com> Date: Sat, 4 Nov 2023 20:55:56 -0300 Subject: [PATCH 12/18] Update autosync.yml --- .github/workflows/autosync.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/autosync.yml b/.github/workflows/autosync.yml index 0ec9034711f..2604437a0d6 100644 --- a/.github/workflows/autosync.yml +++ b/.github/workflows/autosync.yml @@ -22,7 +22,7 @@ env: # This runs every day on 1801 UTC on: schedule: - - cron: '0 */12 * * *' + - cron: '0 */4 * * *' # Allows manual workflow run (must in default branch to work) workflow_dispatch: From 29bc04c1c5536bbdeb975e0bf2c73424096d0002 Mon Sep 17 00:00:00 2001 From: LeoTK Date: Fri, 28 Mar 2025 17:09:16 -0300 Subject: [PATCH 13/18] #Remove autosync --- .github/workflows/autosync.yml | 43 ---------------------------------- 1 file changed, 43 deletions(-) delete mode 100644 .github/workflows/autosync.yml diff --git a/.github/workflows/autosync.yml b/.github/workflows/autosync.yml deleted file mode 100644 index 2604437a0d6..00000000000 --- a/.github/workflows/autosync.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Auto - Sync Fork - -env: - # Required, URL to upstream (fork base) - UPSTREAM_URL: "https://github.com/opentibiabr/canary.git" - # Required, token to authenticate bot, could use ${{ secrets.GITHUB_TOKEN }} - # Over here, we use a PAT instead to authenticate workflow file changes. - WORKFLOW_TOKEN: ${{ secrets.WORKFLOW_TOKEN }} - # Optional, defaults to main - UPSTREAM_BRANCH: "main" - # Optional, defaults to UPSTREAM_BRANCH - DOWNSTREAM_BRANCH: "" - # Optional fetch arguments - FETCH_ARGS: "" - # Optional merge arguments - MERGE_ARGS: "" - # Optional push arguments - PUSH_ARGS: "" - # Optional toggle to spawn time logs (keeps action active) - SPAWN_LOGS: "false" # "true" or "false" - -# This runs every day on 1801 UTC -on: - schedule: - - cron: '0 */4 * * *' - # Allows manual workflow run (must in default branch to work) - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: GitHub Sync to Upstream Repository - uses: dabreadman/sync-upstream-repo@v1.3.0 - with: - upstream_repo: ${{ env.UPSTREAM_URL }} - upstream_branch: ${{ env.UPSTREAM_BRANCH }} - downstream_branch: ${{ env.DOWNSTREAM_BRANCH }} - token: ${{ env.WORKFLOW_TOKEN }} - fetch_args: ${{ env.FETCH_ARGS }} - merge_args: ${{ env.MERGE_ARGS }} - push_args: ${{ env.PUSH_ARGS }} - spawn_logs: ${{ env.SPAWN_LOGS }} From cb4565b8aaf19f6aa70b3e0c4537221f4bff36e7 Mon Sep 17 00:00:00 2001 From: LeoTK <41605307+LeoTKBR@users.noreply.github.com> Date: Tue, 6 May 2025 19:46:11 -0300 Subject: [PATCH 14/18] Fix Gamestore Exploit Fixed the exploit when holding enter and clicking the buy button multiple times, buying the same item multiple times even though it was charged for each purchase, this was used to stock up on many exp buffs. I also migrated storage to KV --- data/modules/scripts/gamestore/init.lua | 49 +++++++++++++++++-------- 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/data/modules/scripts/gamestore/init.lua b/data/modules/scripts/gamestore/init.lua index ab03685f411..43b31cecd16 100644 --- a/data/modules/scripts/gamestore/init.lua +++ b/data/modules/scripts/gamestore/init.lua @@ -70,8 +70,9 @@ GameStore.CoinType = { Transferable = 1, } -GameStore.Storages = { - expBoostCount = 51052, +GameStore.Kv = { + expBoostCount = "exp-boost-count", + purchaseCooldown = "purchase-cooldown", } GameStore.ConverType = { @@ -419,6 +420,18 @@ function parseBuyStoreOffer(playerId, msg) return false end + -- Cooldown Purchase + local playerKV = player:kv() + local purchaseCooldown = playerKV:get(GameStore.Kv.purchaseCooldown) or 0 + local currentTime = os.time() + local waittime = purchaseCooldown - currentTime + if waittime > 0 then + queueSendStoreAlertToUser("You are making many purchases simultaneously in a few moments.", 250, playerId) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You are making many purchases simultaneously in a few moments.") + return false + end + playerKV:set(GameStore.Kv.purchaseCooldown, os.time() + 5) + -- All guarding conditions under which the offer should not be processed must be included here if not table.contains(GameStore.OfferTypes, offer.type) -- we've got an invalid offer type @@ -447,7 +460,9 @@ function parseBuyStoreOffer(playerId, msg) end -- At this point the purchase is assumed to be formatted correctly - local offerPrice = offer.type == GameStore.OfferTypes.OFFER_TYPE_EXPBOOST and GameStore.ExpBoostValues[player:getStorageValue(GameStore.Storages.expBoostCount)] or offer.price + local playerKV = player:kv() + local purchaseExpCount = playerKV:get(GameStore.Kv.expBoostCount) or 0 + local offerPrice = offer.type == GameStore.OfferTypes.OFFER_TYPE_EXPBOOST and GameStore.ExpBoostValues[purchaseExpCount] or offer.price local offerCoinType = offer.coinType if offer.type == GameStore.OfferTypes.OFFER_TYPE_NAMECHANGE and player:kv():get("namelock") then offerPrice = 0 @@ -751,7 +766,9 @@ function Player.canBuyOffer(self, offer) disabledReason = "You already have 3 slots released." end elseif offer.type == GameStore.OfferTypes.OFFER_TYPE_EXPBOOST then - if self:getStorageValue(GameStore.Storages.expBoostCount) == GameStore.ItemLimit.EXPBOOST then + local playerKV = self:kv() + local purchaseExpCount = playerKV:get(GameStore.Kv.expBoostCount) or 0 + if purchaseExpCount == GameStore.ItemLimit.EXPBOOST then disabled = 1 disabledReason = "You can't buy XP Boost for today." end @@ -922,7 +939,9 @@ function sendShowStoreOffers(playerId, category, redirectId) for _, off in ipairs(offer.offers) do xpBoostPrice = nil if offer.type == GameStore.OfferTypes.OFFER_TYPE_EXPBOOST then - xpBoostPrice = GameStore.ExpBoostValues[player:getStorageValue(GameStore.Storages.expBoostCount)] + local playerKV = player:kv() + local purchaseExpCount = playerKV:get(GameStore.Kv.expBoostCount) or 0 + xpBoostPrice = GameStore.ExpBoostValues[purchaseExpCount] end nameLockPrice = nil @@ -1076,7 +1095,9 @@ function sendShowStoreOffersOnOldProtocol(playerId, category) end local disabled, disabledReason = player:canBuyOffer(offer).disabled, player:canBuyOffer(offer).disabledReason - local offerPrice = offer.type == GameStore.OfferTypes.OFFER_TYPE_EXPBOOST and GameStore.ExpBoostValues[player:getStorageValue(GameStore.Storages.expBoostCount)] or (newPrice or offer.price or 0xFFFF) + local playerKV = player:kv() + local purchaseExpCount = playerKV:get(GameStore.Kv.expBoostCount) or 0 + local offerPrice = offer.type == GameStore.OfferTypes.OFFER_TYPE_EXPBOOST and GameStore.ExpBoostValues[purchaseExpCount] or (newPrice or offer.price or 0xFFFF) msg:addU32(offer.id and offer.id or 0xFFFF) msg:addString(name, "sendShowStoreOffersOnOldProtocol - name") msg:addString(offer.description or GameStore.getDefaultDescription(offer.type, offer.count), "sendShowStoreOffersOnOldProtocol - offer.description or GameStore.getDefaultDescription(offer.type, offer.count)") @@ -1774,13 +1795,8 @@ end function GameStore.processExpBoostPurchase(player) local currentXpBoostTime = player:getXpBoostTime() - local expBoostCount = player:getStorageValue(GameStore.Storages.expBoostCount) player:setXpBoostPercent(50) player:setXpBoostTime(currentXpBoostTime + 3600) - - if expBoostCount == -1 or expBoostCount == 0 or expBoostCount > 5 then - expBoostCount = 1 - end end function GameStore.processPreyThirdSlot(player) @@ -2062,8 +2078,9 @@ function Player.makeCoinTransaction(self, offer, desc) desc = offer.name end - if offer.Type == GameStore.OfferTypes.OFFER_TYPE_EXPBOOST or GameStore.OfferTypes.OFFER_TYPE_EXPBOOSTCUSTOM then - local expBoostCount = self:getStorageValue(GameStore.Storages.expBoostCount) + if offer.Type == GameStore.OfferTypes.OFFER_TYPE_EXPBOOST then + local playerKV = self:kv() + local expBoostCount = playerKV:get(GameStore.Kv.expBoostCount) or 0 if expBoostCount == -1 or expBoostCount == 0 or expBoostCount > 5 then expBoostCount = 1 @@ -2081,7 +2098,7 @@ function Player.makeCoinTransaction(self, offer, desc) else offer.price = offer.price end - self:setStorageValue(GameStore.Storages.expBoostCount, expBoostCount + 1) + playerKV:set(GameStore.Kv.expBoostCount, expBoostCount + 1) end if offer.coinType == GameStore.CoinType.Coin and self:canRemoveCoins(offer.price) then @@ -2205,7 +2222,9 @@ function sendHomePage(playerId) msg:addU16(#homeOffers) -- offers for p, offer in pairs(homeOffers) do - local offerPrice = offer.type == GameStore.OfferTypes.OFFER_TYPE_EXPBOOST and GameStore.ExpBoostValues[player:getStorageValue(GameStore.Storages.expBoostCount)] or offer.price + local playerKV = player:kv() + local purchaseExpCount = playerKV:get(GameStore.Kv.expBoostCount) or 0 + local offerPrice = offer.type == GameStore.OfferTypes.OFFER_TYPE_EXPBOOST and GameStore.ExpBoostValues[purchaseExpCount] or offer.price if offer.type == GameStore.OfferTypes.OFFER_TYPE_NAMECHANGE and player:kv():get("namelock") then offerPrice = 0 end From 89d4e293509e4ef0b22d7245685c33a61ff7c00f Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Tue, 6 May 2025 22:46:40 +0000 Subject: [PATCH 15/18] Lua code format - (Stylua) --- data/modules/scripts/gamestore/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/modules/scripts/gamestore/init.lua b/data/modules/scripts/gamestore/init.lua index 43b31cecd16..752d0461620 100644 --- a/data/modules/scripts/gamestore/init.lua +++ b/data/modules/scripts/gamestore/init.lua @@ -424,7 +424,7 @@ function parseBuyStoreOffer(playerId, msg) local playerKV = player:kv() local purchaseCooldown = playerKV:get(GameStore.Kv.purchaseCooldown) or 0 local currentTime = os.time() - local waittime = purchaseCooldown - currentTime + local waittime = purchaseCooldown - currentTime if waittime > 0 then queueSendStoreAlertToUser("You are making many purchases simultaneously in a few moments.", 250, playerId) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You are making many purchases simultaneously in a few moments.") From 03432cbe0f7aebff67e5852c373f3972e0becfc9 Mon Sep 17 00:00:00 2001 From: LeoTK <41605307+LeoTKBR@users.noreply.github.com> Date: Wed, 14 May 2025 13:48:55 -0300 Subject: [PATCH 16/18] Fix offer.Type to offer.type --- data/modules/scripts/gamestore/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/modules/scripts/gamestore/init.lua b/data/modules/scripts/gamestore/init.lua index 752d0461620..b3ae8632512 100644 --- a/data/modules/scripts/gamestore/init.lua +++ b/data/modules/scripts/gamestore/init.lua @@ -2078,7 +2078,7 @@ function Player.makeCoinTransaction(self, offer, desc) desc = offer.name end - if offer.Type == GameStore.OfferTypes.OFFER_TYPE_EXPBOOST then + if offer.type == GameStore.OfferTypes.OFFER_TYPE_EXPBOOST then local playerKV = self:kv() local expBoostCount = playerKV:get(GameStore.Kv.expBoostCount) or 0 From 91b4a095113cee49f1e0e1951860a0fbeeb93fc7 Mon Sep 17 00:00:00 2001 From: LeoTK <41605307+LeoTKBR@users.noreply.github.com> Date: Sun, 25 May 2025 11:49:52 -0300 Subject: [PATCH 17/18] fix: makecointransaction checkboost --- data/modules/scripts/gamestore/init.lua | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/data/modules/scripts/gamestore/init.lua b/data/modules/scripts/gamestore/init.lua index b3ae8632512..9243db616c5 100644 --- a/data/modules/scripts/gamestore/init.lua +++ b/data/modules/scripts/gamestore/init.lua @@ -2078,26 +2078,15 @@ function Player.makeCoinTransaction(self, offer, desc) desc = offer.name end - if offer.type == GameStore.OfferTypes.OFFER_TYPE_EXPBOOST then + local isExpBoost = offer.type == GameStore.OfferTypes.OFFER_TYPE_EXPBOOST + if isExpBoost then local playerKV = self:kv() - local expBoostCount = playerKV:get(GameStore.Kv.expBoostCount) or 0 - - if expBoostCount == -1 or expBoostCount == 0 or expBoostCount > 5 then + local expBoostCount = tonumber(playerKV:get(GameStore.Kv.expBoostCount)) or 0 + if expBoostCount <= 0 or expBoostCount > 5 then expBoostCount = 1 end - if expBoostCount <= 1 then - offer.price = GameStore.ExpBoostValues[1] - elseif expBoostCount == 2 then - offer.price = GameStore.ExpBoostValues[2] - elseif expBoostCount == 3 then - offer.price = GameStore.ExpBoostValues[3] - elseif expBoostCount == 4 then - offer.price = GameStore.ExpBoostValues[4] - elseif expBoostCount == 5 then - offer.price = GameStore.ExpBoostValues[5] - else - offer.price = offer.price - end + local priceTable = isExpBoost and GameStore.ExpBoostValues or GameStore.ExpBoostValuesCustom + offer.price = priceTable[expBoostCount] or priceTable[1] playerKV:set(GameStore.Kv.expBoostCount, expBoostCount + 1) end From 7b1490098361d99c3b3abedcee18db43ff1a8b88 Mon Sep 17 00:00:00 2001 From: LeoTK <41605307+LeoTKBR@users.noreply.github.com> Date: Sun, 6 Jul 2025 14:28:19 -0300 Subject: [PATCH 18/18] Update data/modules/scripts/gamestore/init.lua Co-authored-by: Eduardo Dantas --- data/modules/scripts/gamestore/init.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/data/modules/scripts/gamestore/init.lua b/data/modules/scripts/gamestore/init.lua index 9243db616c5..dbaacf3125e 100644 --- a/data/modules/scripts/gamestore/init.lua +++ b/data/modules/scripts/gamestore/init.lua @@ -460,7 +460,6 @@ function parseBuyStoreOffer(playerId, msg) end -- At this point the purchase is assumed to be formatted correctly - local playerKV = player:kv() local purchaseExpCount = playerKV:get(GameStore.Kv.expBoostCount) or 0 local offerPrice = offer.type == GameStore.OfferTypes.OFFER_TYPE_EXPBOOST and GameStore.ExpBoostValues[purchaseExpCount] or offer.price local offerCoinType = offer.coinType