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/14] 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/14] 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/14] 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/14] 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/14] 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/14] 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/14] 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/14] 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/14] 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/14] 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/14] 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/14] 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 cb2d327e069d831cfed309f53dcca3b62a19a343 Mon Sep 17 00:00:00 2001 From: LeoTK Date: Fri, 22 Nov 2024 02:05:47 -0300 Subject: [PATCH 13/14] attr element + lua function --- data/scripts/talkactions/god/attributes.lua | 6 +++++ src/enums/item_attribute.hpp | 1 + src/items/functions/item/attribute.hpp | 1 + src/items/item.cpp | 29 +++++++++++++++++---- src/items/item.hpp | 6 +++++ src/items/items.hpp | 1 + src/items/items_definitions.hpp | 1 + src/items/weapons/weapons.cpp | 8 +++--- src/utils/tools.cpp | 3 +++ 9 files changed, 47 insertions(+), 9 deletions(-) diff --git a/data/scripts/talkactions/god/attributes.lua b/data/scripts/talkactions/god/attributes.lua index 1c1ed8a9bf1..6faed0ea041 100644 --- a/data/scripts/talkactions/god/attributes.lua +++ b/data/scripts/talkactions/god/attributes.lua @@ -95,6 +95,12 @@ local itemFunctions = { return item:setAttribute(ITEM_ATTRIBUTE_EXTRADEFENSE, target) end, }, + ["element"] = { + isActive = true, + targetFunction = function(item, target) + return item:setAttribute(ITEM_ATTRIBUTE_ELEMENT, target) + end, + }, ["charge"] = { isActive = true, targetFunction = function(item, target) diff --git a/src/enums/item_attribute.hpp b/src/enums/item_attribute.hpp index a3d76fde70f..e31693f5123 100644 --- a/src/enums/item_attribute.hpp +++ b/src/enums/item_attribute.hpp @@ -47,6 +47,7 @@ enum class ItemAttribute_t : uint64_t { STORE_INBOX_CATEGORY = 34, OBTAINCONTAINER = 35, AUGMENTS = 36, + ELEMENT = 37, }; enum ItemDecayState_t : uint8_t { diff --git a/src/items/functions/item/attribute.hpp b/src/items/functions/item/attribute.hpp index 3d99187d93a..3e3a66f73b3 100644 --- a/src/items/functions/item/attribute.hpp +++ b/src/items/functions/item/attribute.hpp @@ -24,6 +24,7 @@ class ItemAttributeHelper { case ItemAttribute_t::ATTACK: case ItemAttribute_t::DEFENSE: case ItemAttribute_t::EXTRADEFENSE: + case ItemAttribute_t::ELEMENT: case ItemAttribute_t::ARMOR: case ItemAttribute_t::HITCHANCE: case ItemAttribute_t::SHOOTRANGE: diff --git a/src/items/item.cpp b/src/items/item.cpp index 14af2cfb47f..180d6227e68 100644 --- a/src/items/item.cpp +++ b/src/items/item.cpp @@ -684,6 +684,16 @@ Attr_ReadValue Item::readAttr(AttrTypes_t attr, PropStream &propStream) { break; } + case ATTR_ELEMENT: { + int32_t element; + if (!propStream.read(element)) { + return ATTR_READ_ERROR; + } + + setAttribute(ItemAttribute_t::ELEMENT, element); + break; + } + case ATTR_IMBUEMENT_SLOT: { int32_t imbuementSlot; if (!propStream.read(imbuementSlot)) { @@ -1038,6 +1048,11 @@ void Item::serializeAttr(PropWriteStream &propWriteStream) const { propWriteStream.write(getAttribute(ItemAttribute_t::EXTRADEFENSE)); } + if (hasAttribute(ItemAttribute_t::ELEMENT)) { + propWriteStream.write(ATTR_ELEMENT); + propWriteStream.write(getAttribute(ItemAttribute_t::ELEMENT)); + } + if (hasAttribute(ItemAttribute_t::IMBUEMENT_SLOT)) { propWriteStream.write(ATTR_IMBUEMENT_SLOT); propWriteStream.write(getAttribute(ItemAttribute_t::IMBUEMENT_SLOT)); @@ -1258,6 +1273,7 @@ Item::getDescriptions(const ItemType &it, const std::shared_ptr &item /*= } int32_t attack = item->getAttack(); + int32_t element = item->getElementDamage(); if (it.isRanged()) { bool separator = false; if (attack != 0) { @@ -1283,7 +1299,7 @@ Item::getDescriptions(const ItemType &it, const std::shared_ptr &item /*= } else { std::string attackDescription; if (it.abilities && it.abilities->elementType != COMBAT_NONE && it.abilities->elementDamage != 0) { - attackDescription = fmt::format("{} {}", it.abilities->elementDamage, getCombatName(it.abilities->elementType)); + attackDescription = fmt::format("{} {}", ((element > 0) ? element : it.abilities->elementDamage), getCombatName(it.abilities->elementType)); } if (attack != 0 && !attackDescription.empty()) { @@ -1682,6 +1698,7 @@ Item::getDescriptions(const ItemType &it, const std::shared_ptr &item /*= } int32_t attack = it.attack; + int32_t element = it.element; if (it.isRanged()) { bool separator = false; if (attack != 0) { @@ -1707,7 +1724,7 @@ Item::getDescriptions(const ItemType &it, const std::shared_ptr &item /*= } else { std::string attackDescription; if (it.abilities && it.abilities->elementType != COMBAT_NONE && it.abilities->elementDamage != 0) { - attackDescription = fmt::format("{} {}", it.abilities->elementDamage, getCombatName(it.abilities->elementType)); + attackDescription = fmt::format("{} {}", ((element > 0) ? element : it.abilities->elementDamage), getCombatName(it.abilities->elementType)); } if (attack != 0 && !attackDescription.empty()) { @@ -2726,15 +2743,17 @@ std::string Item::getDescription(const ItemType &it, int32_t lookDistance, const } else if (it.weaponType != WEAPON_AMMO) { bool begin = true; - int32_t attack, defense, extraDefense; + int32_t attack, defense, extraDefense, element; if (item) { attack = item->getAttack(); defense = item->getDefense(); extraDefense = item->getExtraDefense(); + element = item->getElementDamage(); } else { attack = it.attack; defense = it.defense; extraDefense = it.extraDefense; + element = it.element; } if (it.isContainer() || (item && item->getContainer())) { @@ -2766,10 +2785,10 @@ std::string Item::getDescription(const ItemType &it, int32_t lookDistance, const } if (it.abilities && it.abilities->elementType != COMBAT_NONE && it.abilities->elementDamage != 0 && !begin) { - s << " physical + " << it.abilities->elementDamage << ' ' << getCombatName(it.abilities->elementType); + s << " physical + " << ((element > 0) ? element : it.abilities->elementDamage) << ' ' << getCombatName(it.abilities->elementType); } else if (it.abilities && it.abilities->elementType != COMBAT_NONE && it.abilities->elementDamage != 0 && begin) { begin = false; - s << " (" << it.abilities->elementDamage << ' ' << getCombatName(it.abilities->elementType); + s << " (" << ((element > 0) ? element : it.abilities->elementDamage) << ' ' << getCombatName(it.abilities->elementType); } if (defense != 0 || extraDefense != 0 || it.isMissile()) { diff --git a/src/items/item.hpp b/src/items/item.hpp index d199fab15cf..5bb00ce0604 100644 --- a/src/items/item.hpp +++ b/src/items/item.hpp @@ -404,6 +404,12 @@ class Item : virtual public Thing, public ItemProperties, public SharedObject { } return items[id].extraDefense; } + int32_t getElementDamage() const { + if (hasAttribute(ItemAttribute_t::ELEMENT)) { + return getAttribute(ItemAttribute_t::ELEMENT); + } + return items[id].element; + } std::vector> getAugments() const { return items[id].augments; } diff --git a/src/items/items.hpp b/src/items/items.hpp index b977f0bf7a9..a68118342c8 100644 --- a/src/items/items.hpp +++ b/src/items/items.hpp @@ -280,6 +280,7 @@ class ItemType { int32_t attack = 0; int32_t defense = 0; int32_t extraDefense = 0; + int32_t element = 0; int32_t armor = 0; int32_t rotateTo = 0; int32_t runeMagLevel = 0; diff --git a/src/items/items_definitions.hpp b/src/items/items_definitions.hpp index 9b6990c0cb7..d7b54c834ef 100644 --- a/src/items/items_definitions.hpp +++ b/src/items/items_definitions.hpp @@ -244,6 +244,7 @@ enum AttrTypes_t { ATTR_STORE_INBOX_CATEGORY = 42, ATTR_OWNER = 43, ATTR_OBTAINCONTAINER = 44, + ATTR_ELEMENT = 45, // Always the last ATTR_NONE = 0 diff --git a/src/items/weapons/weapons.cpp b/src/items/weapons/weapons.cpp index 2ec09945f36..2e38a6ae298 100644 --- a/src/items/weapons/weapons.cpp +++ b/src/items/weapons/weapons.cpp @@ -598,9 +598,9 @@ int32_t WeaponMelee::getElementDamage(const std::shared_ptr &player, con if (elementType == COMBAT_NONE) { return 0; } - + const int32_t element = item->getElementDamage(); const int32_t attackSkill = player->getWeaponSkill(item); - const int32_t attackValue = elementDamage; + const int32_t attackValue = (element > 0) ? element : elementDamage; const float attackFactor = player->getAttackFactor(); const uint32_t level = player->getLevel(); @@ -833,8 +833,8 @@ int32_t WeaponDistance::getElementDamage(const std::shared_ptr &player, if (elementType == COMBAT_NONE) { return 0; } - - int32_t attackValue = elementDamage; + int32_t element = item->getElementDamage(); + int32_t attackValue = (element > 0) ? element : elementDamage; if (item && player && item->getWeaponType() == WEAPON_AMMO) { const auto &weapon = player->getWeapon(true); if (weapon) { diff --git a/src/utils/tools.cpp b/src/utils/tools.cpp index 57c9c873282..ecc2594914f 100644 --- a/src/utils/tools.cpp +++ b/src/utils/tools.cpp @@ -1218,6 +1218,9 @@ ItemAttribute_t stringToItemAttribute(const std::string &str) { if (str == "extradefense") { return ItemAttribute_t::EXTRADEFENSE; } + if (str == "element") { + return ItemAttribute_t::ELEMENT; + } if (str == "armor") { return ItemAttribute_t::ARMOR; } From 869a503d708f1e8eee2f2414047a92da1817cf2c Mon Sep 17 00:00:00 2001 From: LeoTK <41605307+LeoTKBR@users.noreply.github.com> Date: Sat, 23 Nov 2024 19:50:16 -0300 Subject: [PATCH 14/14] Delete .github/workflows/autosync.yml --- .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 }}