Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
luanluciano93 committed Aug 10, 2024
2 parents 5dd973c + 193939c commit c670b3f
Show file tree
Hide file tree
Showing 34 changed files with 1,247 additions and 343 deletions.
43 changes: 38 additions & 5 deletions .github/workflows/analysis-qodana.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
name: Analysis - Qodana

on:
workflow_dispatch:
pull_request:
Expand All @@ -20,9 +21,41 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0

- name: 'Qodana Scan'
uses: JetBrains/[email protected]
- name: Install Linux Dependencies
run: >
sudo apt-get update && sudo apt-get install ccache
linux-headers-$(uname -r)
- name: CCache
uses: hendrikmuhs/ccache-action@main
with:
max-size: "1G"
key: ccache-qodana

- name: Restore artifacts and install vcpkg
id: vcpkg-step
run: |
vcpkgCommitId=$(grep '.builtin-baseline' vcpkg.json | awk -F: '{print $2}' | tr -d '," ')
echo "vcpkg commit ID: $vcpkgCommitId"
echo "VCPKG_GIT_COMMIT_ID=$vcpkgCommitId" >> $GITHUB_ENV
- name: Get vcpkg commit id from vcpkg.json
uses: lukka/run-vcpkg@main
with:
args: --compile-commands,./build/linux-debug/compile_commands.json,--baseline,./qodana.sarif.json
env:
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
vcpkgGitURL: "https://github.com/microsoft/vcpkg.git"
vcpkgGitCommitId: ${{ env.VCPKG_GIT_COMMIT_ID }}

- name: Get latest CMake and ninja
uses: lukka/get-cmake@main

- name: Run CMake
uses: lukka/run-cmake@main
with:
configurePreset: linux-debug

- name: Qodana Scan
run: |
docker run \
-v $(pwd):/data/project/ \
-v $(pwd):$(pwd) \
-e QODANA_TOKEN="${{ secrets.QODANA_TOKEN }}" \
jetbrains/qodana-clang:2024.1-eap \
--compile-commands ./build/linux-debug/compile_commands.json
8 changes: 4 additions & 4 deletions .github/workflows/build-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ jobs:
path: |
${{ github.workspace }}/build/${{ matrix.buildtype }}/bin/
- name: Run Unit Tests
run: |
cd ${{ github.workspace }}/build/${{ matrix.buildtype }}/tests/unit
ctest --verbose
# - name: Run Unit Tests
# run: |
# cd ${{ github.workspace }}/build/${{ matrix.buildtype }}/tests/unit
# ctest --verbose

# - name: Run Integration Tests
# run: |
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ set(VCPKG_BUILD_TYPE "release")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)



# *****************************************************************************
# Project canary
# *****************************************************************************
Expand Down
44 changes: 36 additions & 8 deletions cmake/modules/BaseConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,29 @@ option(BUILD_STATIC_LIBRARY "Build using static libraries" OFF)
option(SPEED_UP_BUILD_UNITY "Compile using build unity for speed up build" ON)
option(USE_PRECOMPILED_HEADER "Compile using precompiled header" ON)

# === TOGGLE_BIN_FOLDER ===
if(TOGGLE_BIN_FOLDER)
log_option_enabled("TOGGLE_BIN_FOLDER")
else()
log_option_disabled("TOGGLE_BIN_FOLDER")
endif(TOGGLE_BIN_FOLDER)

# === TOGGLE_BIN_FOLDER ===
if(OPTIONS_ENABLE_OPENMP)
log_option_enabled("OPTIONS_ENABLE_OPENMP")
else()
log_option_disabled("OPTIONS_ENABLE_OPENMP")
endif(OPTIONS_ENABLE_OPENMP)

# === DEBUG LOG ===
# cmake -DDEBUG_LOG=ON ..
if(DEBUG_LOG)
add_definitions(-DDEBUG_LOG=ON)
log_option_enabled("DEBUG LOG")
else()
log_option_disabled("DEBUG LOG")
endif(DEBUG_LOG)

# === ASAN ===
if(ASAN_ENABLED)
log_option_enabled("asan")
Expand All @@ -87,7 +110,7 @@ else()
log_option_disabled("asan")
endif()

# Build static libs
# === BUILD_STATIC_LIBRARY ===
if(BUILD_STATIC_LIBRARY)
log_option_enabled("STATIC_LIBRARY")

Expand All @@ -102,14 +125,19 @@ else()
log_option_disabled("STATIC_LIBRARY")
endif()

# === DEBUG LOG ===
# cmake -DDEBUG_LOG=ON ..
if(DEBUG_LOG)
add_definitions(-DDEBUG_LOG=ON)
log_option_enabled("DEBUG LOG")
# === SPEED_UP_BUILD_UNITY ===
if(SPEED_UP_BUILD_UNITY)
log_option_enabled("SPEED_UP_BUILD_UNITY")
else()
log_option_disabled("DEBUG LOG")
endif(DEBUG_LOG)
log_option_disabled("SPEED_UP_BUILD_UNITY")
endif(SPEED_UP_BUILD_UNITY)

# === USE_PRECOMPILED_HEADER ===
if(USE_PRECOMPILED_HEADER)
log_option_enabled("USE_PRECOMPILED_HEADER")
else()
log_option_disabled("USE_PRECOMPILED_HEADER")
endif(USE_PRECOMPILED_HEADER)

# *****************************************************************************
# Compiler Options
Expand Down
12 changes: 12 additions & 0 deletions data/scripts/actions/items/cobra_flask.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,15 @@ end

cobraFlask:id(31296)
cobraFlask:register()

local cobraFlask = Action()

function cobraFlask.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if table.contains({ 4188, 4189, 4190 }, target:getId()) then
item:transform(31296)
end
return true
end

cobraFlask:id(31297)
cobraFlask:register()
8 changes: 6 additions & 2 deletions data/scripts/runes/magic_wall.lua
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
function onCreateMagicWall(creature, tile)
function onCreateMagicWall(creature, position)
local tile = Tile(position)
if tile and tile:getTopCreature() and not tile:getTopCreature():isPlayer() then
return false
end
local magicWall
if Game.getWorldType() == WORLD_TYPE_NO_PVP then
magicWall = ITEM_MAGICWALL_SAFE
else
magicWall = ITEM_MAGICWALL
end
local item = Game.createItem(magicWall, 1, tile)
local item = Game.createItem(magicWall, 1, position)
item:setDuration(16, 24)
end

Expand Down
8 changes: 6 additions & 2 deletions data/scripts/runes/wild_growth.lua
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
function onCreateWildGrowth(creature, tile)
function onCreateWildGrowth(creature, position)
local tile = Tile(position)
if tile and tile:getTopCreature() and not tile:getTopCreature():isPlayer() then
return false
end
local wildGrowth
if Game.getWorldType() == WORLD_TYPE_NO_PVP then
wildGrowth = ITEM_WILDGROWTH_SAFE
else
wildGrowth = ITEM_WILDGROWTH
end
local item = Game.createItem(wildGrowth, 1, tile)
local item = Game.createItem(wildGrowth, 1, position)
item:setDuration(30, 60)
end

Expand Down
109 changes: 109 additions & 0 deletions data/scripts/talkactions/god/icons_functions.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
local function convertIconsToBitValue(iconList)
local bitObj = NewBit(0)
for icon in string.gmatch(iconList, "%d+") do
icon = tonumber(icon)
if icon then
local flag = bit.lshift(1, icon - 1)
bitObj:updateFlag(flag)
end
end
return bitObj:getNumber()
end

function Player:sendNormalIcons(icons)
local msg = NetworkMessage()
msg:addByte(0xA2)
msg:addU32(icons)
msg:addByte(0)
msg:sendToPlayer(self)
end

function Player:sendIconBakragore(specialIcon)
local msg = NetworkMessage()
msg:addByte(0xA3)
msg:addU32(specialIcon)
msg:addByte(0)
msg:sendToPlayer(self)
end

--[[
Usage (normal icons):
/testicon 1
/testicon 2
/testicon 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
Usage (special icons):
/testicon special, 1
/testicon special, 2
]]

local testIcons = TalkAction("/testicon")

function testIcons.onSay(player, words, param)
if param == "" then
player:sendCancelMessage("Icon required.")
logger.error("[testIcons.onSay] - Icon number's required")
return true
end

local split = param:split(",")
local firstParam = split[1]:trim():lower()

if firstParam == "special" and tonumber(split[2]) then
local specialIcon = tonumber(split[2])
player:sendIconBakragore(specialIcon)
else
local icons = convertIconsToBitValue(param)
player:sendNormalIcons(icons)
end

return true
end

testIcons:separator(" ")
testIcons:setDescription("[Usage]: /testicon {icon1}, {icon2}, {icon3}, ... [Usage2]: /testicon special, {icon}")
testIcons:groupType("god")
testIcons:register()

local condition = Condition(CONDITION_BAKRAGORE, CONDITIONID_DEFAULT, 0, true)

local bakragoreIcon = TalkAction("/bakragoreicon")

function bakragoreIcon.onSay(player, words, param)
if param == "" then
player:sendCancelMessage("Icon number required.")
logger.error("[addBakragoreIcon.onSay] - Icon number's required")
return true
end

if param == "remove" then
for i = 1, 10 do
if player:hasCondition(CONDITION_BAKRAGORE, i) then
player:removeCondition(CONDITION_BAKRAGORE, i)
end
end
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Removed all Bakragore icons.")
return true
end

local numParam = tonumber(param)
if numParam then
if player:hasCondition(CONDITION_BAKRAGORE, numParam) then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You already have the Bakragore icon.")
return true
end

condition:setParameter(CONDITION_PARAM_SUBID, numParam)
condition:setParameter(CONDITION_PARAM_TICKS, -1)
player:addCondition(condition)

player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Added Bakragore icon with ID: " .. numParam)
end

return true
end

bakragoreIcon:separator(" ")
bakragoreIcon:groupType("god")
bakragoreIcon:register()
13 changes: 7 additions & 6 deletions docker/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ RUN --mount=type=cache,target=/var/cache/apt \

WORKDIR /opt
COPY vcpkg.json /opt
RUN vcpkgCommitId=$(grep '.builtin-baseline' vcpkg.json | awk -F: '{print $2}' | tr -d '," ') \
&& echo "vcpkg commit ID: $vcpkgCommitId" \
&& git clone https://github.com/Microsoft/vcpkg.git \
&& cd vcpkg \
&& git checkout "$vcpkgCommitId" \
&& ./bootstrap-vcpkg.sh
RUN vcpkgCommitId=$(grep '.builtin-baseline' vcpkg.json | awk -F: '{print $2}' | tr -d '," ' | tr -d '\r\n') \
&& echo "vcpkg commit ID: '$vcpkgCommitId'" \
&& git clone https://github.com/microsoft/vcpkg.git \
&& cd vcpkg \
&& git fetch origin \
&& git checkout "$vcpkgCommitId" \
&& ./bootstrap-vcpkg.sh

WORKDIR /opt/vcpkg
COPY vcpkg.json /opt/vcpkg/
Expand Down
Loading

0 comments on commit c670b3f

Please sign in to comment.