Skip to content

Commit

Permalink
Merge branch 'main' into improve-boss-foreshock
Browse files Browse the repository at this point in the history
  • Loading branch information
Luan Luciano authored Feb 3, 2024
2 parents e5afd73 + f68875c commit cd89fba
Show file tree
Hide file tree
Showing 74 changed files with 747 additions and 616 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/build-windows-solution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ on:
env:
CMAKE_BUILD_PARALLEL_LEVEL: 2
MAKEFLAGS: "-j 2"
GITHUB_WORKSPACE: ${{ github.workspace }}
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
VCPKG_TRIPLET: x64-windows

jobs:
cancel-runs:
Expand Down Expand Up @@ -55,8 +58,16 @@ jobs:
./bootstrap-vcpkg.bat
./vcpkg integrate install
- name: Print useful paths
run: |
Write-Host "Workspace: $env:GITHUB_WORKSPACE"
Write-Host "Vcpkg Path: $env:GITHUB_WORKSPACE\vcpkg"
Write-Host "Triplet: ${{ matrix.triplet }}"
- name: Build project
run: msbuild.exe /p:VcpkgEnableManifest=true /p:Configuration=Debug /p:Platform=x64 /p:VcpkgRoot=$env:GITHUB_WORKSPACE/vcpkg vcproj/canary.sln
env:
GITHUB_WORKSPACE: ${{ github.workspace }}
run: msbuild.exe /p:VcpkgEnableManifest=true /p:Configuration=Debug /p:Platform=x64 /p:GITHUB_WORKSPACE="$env:GITHUB_WORKSPACE" vcproj/canary.sln

- name: Upload artifacts
uses: actions/upload-artifact@main
Expand Down
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ option(RUN_TESTS_AFTER_BUILD "Run tests when building" OFF) # By default, tests
# *****************************************************************************
# Add project
# *****************************************************************************
add_subdirectory(src/protobuf)
add_subdirectory(src)

if(BUILD_TESTS)
Expand Down
3 changes: 3 additions & 0 deletions cmake/modules/BaseConfig.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
cmake_minimum_required(VERSION 3.22 FATAL_ERROR)

# *****************************************************************************
# CMake Features
# *****************************************************************************
Expand Down Expand Up @@ -69,6 +71,7 @@ option(DEBUG_LOG "Enable Debug Log" OFF)
option(ASAN_ENABLED "Build this target with AddressSanitizer" OFF)
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)

# === ASAN ===
if(ASAN_ENABLED)
Expand Down
46 changes: 22 additions & 24 deletions cmake/modules/CanaryLib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,22 @@ add_subdirectory(lib)
add_subdirectory(kv)
add_subdirectory(lua)
add_subdirectory(map)
add_subdirectory(protobuf)
add_subdirectory(security)
add_subdirectory(server)
add_subdirectory(utils)

# Add more global sources - please add preferably in the sub_directory CMakeLists.
set(ProtobufFiles
protobuf/appearances.pb.cc
protobuf/kv.pb.cc
)

# Add more global sources - please add preferably in the sub_directory CMakeLists.
target_sources(${PROJECT_NAME}_lib PRIVATE canary_server.cpp ${ProtobufFiles})

# Skip unity build inclusion for protobuf files
set_source_files_properties(
${ProtobufFiles} PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON
)

target_sources(${PROJECT_NAME}_lib PRIVATE canary_server.cpp)

# Add public pre compiler header to lib, to pass down to related targets
target_precompile_headers(${PROJECT_NAME}_lib PUBLIC pch.hpp)
if (NOT SPEED_UP_BUILD_UNITY)
target_precompile_headers(${PROJECT_NAME}_lib PUBLIC pch.hpp)
endif()

if(NOT SPEED_UP_BUILD_UNITY AND USE_PRECOMPILED_HEADERS)
target_compile_definitions(${PROJECT_NAME}_lib PUBLIC -DUSE_PRECOMPILED_HEADER)
endif()

# *****************************************************************************
# Build flags - need to be set before the links and sources
Expand All @@ -52,8 +47,8 @@ if(MSVC)
MODULE_LINKER_FLAGS "/LTCG"
EXE_LINKER_FLAGS "/LTCG")
else()
include(CheckIPOSupported)
check_ipo_supported(RESULT result)
include(CheckIPOSupported)
check_ipo_supported(RESULT result)
if(result)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto=auto")
message(STATUS "IPO/LTO enabled with -flto=auto for non-MSVC compiler.")
Expand Down Expand Up @@ -102,14 +97,15 @@ target_link_libraries(${PROJECT_NAME}_lib
unofficial::argon2::libargon2
unofficial::libmariadb
unofficial::mariadbclient
opentelemetry-cpp::common
opentelemetry-cpp::metrics
opentelemetry-cpp::api
opentelemetry-cpp::ext
opentelemetry-cpp::sdk
opentelemetry-cpp::logs
opentelemetry-cpp::ostream_metrics_exporter
opentelemetry-cpp::prometheus_exporter
opentelemetry-cpp::common
opentelemetry-cpp::metrics
opentelemetry-cpp::api
opentelemetry-cpp::ext
opentelemetry-cpp::sdk
opentelemetry-cpp::logs
opentelemetry-cpp::ostream_metrics_exporter
opentelemetry-cpp::prometheus_exporter
protobuf
)

if(CMAKE_BUILD_TYPE MATCHES Debug)
Expand All @@ -121,8 +117,10 @@ endif()
if (MSVC)
if(BUILD_STATIC_LIBRARY)
target_link_libraries(${PROJECT_NAME}_lib PUBLIC jsoncpp_static)
set(VCPKG_TARGET_TRIPLET "x64-windows-static" CACHE STRING "")
else()
target_link_libraries(${PROJECT_NAME}_lib PUBLIC jsoncpp_lib)
set(VCPKG_TARGET_TRIPLET "x64-windows" CACHE STRING "")
endif()

target_link_libraries(${PROJECT_NAME}_lib PUBLIC ${CMAKE_THREAD_LIBS_INIT} ${MYSQL_CLIENT_LIBS})
Expand Down
4 changes: 4 additions & 0 deletions data-otservbr-global/lib/core/storages.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3071,6 +3071,10 @@ GlobalStorage = {
AftershockHealth = 60174,
ForeshockStage = 60175,
AftershockStage = 60176,
RuptureResonanceStage = 60177,
RuptureResonanceActive = 60178,
EradicatorWeak = 60178,
EradicatorReleaseT = 60179,
OutburstStage = 60180,
OutburstHealth = 60181,
OutburstChargingKilled = 60182,
Expand Down
11 changes: 5 additions & 6 deletions data-otservbr-global/scripts/actions/other/potions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -268,13 +268,12 @@ function flaskPotion.onUse(player, item, fromPosition, target, toPosition, isHot

player:addAchievementProgress("Potion Addict", 100000)
target:say("Aaaah...", MESSAGE_POTION)
if fromPosition.x == CONTAINER_POSITION and not container == store_inbox then
local container = Container(item:getParent().uid)
if player:getStorageValueByName("talkaction.potions.flask") ~= 1 then
local deactivatedFlasks = player:kv():get("talkaction.potions.flask") or false
if not deactivatedFlasks then
if fromPosition.x == CONTAINER_POSITION then
local container = Container(item:getParent().uid)
container:addItem(potion.flask, 1)
end
else
if player:getStorageValueByName("talkaction.potions.flask") ~= 1 then
else
player:addItem(potion.flask, 1)
end
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,130 +1,41 @@
-- FUNCTIONS
local function doCheckArea()
local upConer = { x = 32324, y = 31239, z = 14 } -- upLeftCorner
local downConer = { x = 32347, y = 31263, z = 14 } -- downRightCorner

for i = upConer.x, downConer.x do
for j = upConer.y, downConer.y do
for k = upConer.z, downConer.z do
local room = { x = i, y = j, z = k }
local tile = Tile(room)
if tile then
local creatures = tile:getCreatures()
if creatures and #creatures > 0 then
for _, creature in pairs(creatures) do
local player = Player(creature)
if player then
return true
end
end
end
end
end
end
end
return false
end

local function clearArea()
local upConer = { x = 32324, y = 31239, z = 14 } -- upLeftCorner
local downConer = { x = 32347, y = 31263, z = 14 } -- downRightCorner

for i = upConer.x, downConer.x do
for j = upConer.y, downConer.y do
for k = upConer.z, downConer.z do
local room = { x = i, y = j, z = k }
local tile = Tile(room)
if tile then
local creatures = tile:getCreatures()
if creatures and #creatures > 0 then
for _, creatureUid in pairs(creatures) do
local creature = Creature(creatureUid)
if creature then
if creature:isPlayer() then
creature:teleportTo({ x = 32088, y = 31321, z = 13 })
elseif creature:isMonster() then
creature:remove()
end
end
end
end
end
end
end
end
end
-- FUNCTIONS END

local heartDestructionRupture = Action()
function heartDestructionRupture.onUse(player, item, fromPosition, itemEx, toPosition)
local config = {
playerPositions = {
Position(32309, 31248, 14),
Position(32309, 31249, 14),
Position(32309, 31250, 14),
Position(32309, 31251, 14),
Position(32309, 31252, 14),
},

newPos = { x = 32335, y = 31257, z = 14 },
}

local pushPos = { x = 32309, y = 31248, z = 14 }

if item.actionid == 14327 then
if item.itemid == 8911 then
if player:getPosition().x == pushPos.x and player:getPosition().y == pushPos.y and player:getPosition().z == pushPos.z then
local storePlayers = {}
for i = 1, #config.playerPositions do
local tile = Tile(Position(config.playerPositions[i]))
if tile then
local playerTile = tile:getTopCreature()
if playerTile and playerTile:isPlayer() then
storePlayers[#storePlayers + 1] = playerTile
end
end
end

if doCheckArea() == false then
clearArea()

local players

for i = 1, #storePlayers do
players = storePlayers[i]
config.playerPositions[i]:sendMagicEffect(CONST_ME_POFF)
players:teleportTo(config.newPos)
players:setBossCooldown("Rupture", os.time() + configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN))
end
Position(config.newPos):sendMagicEffect(11)

areaRupture1 = addEvent(clearArea, 15 * 60000)

ruptureResonanceStage = 0
resonanceActive = false

Game.createMonster("Spark of Destruction", { x = 32331, y = 31254, z = 14 }, false, true)
Game.createMonster("Spark of Destruction", { x = 32338, y = 31254, z = 14 }, false, true)
Game.createMonster("Spark of Destruction", { x = 32330, y = 31250, z = 14 }, false, true)
Game.createMonster("Spark of Destruction", { x = 32338, y = 31250, z = 14 }, false, true)
Game.createMonster("Rupture", { x = 32332, y = 31250, z = 14 }, false, true)

local vortex = Tile({ x = 32326, y = 31250, z = 14 }):getItemById(23482)
if vortex then
vortex:transform(23483)
vortex:setActionId(14343)
end
else
player:sendTextMessage(19, "Someone is in the area.")
end
else
return true
local config = {
boss = {
name = "Rupture",
position = Position(32332, 31250, 14),
},
playerPositions = {
{ pos = Position(32309, 31248, 14), teleport = Position(32335, 31257, 14), effect = CONST_ME_TELEPORT },
{ pos = Position(32309, 31249, 14), teleport = Position(32335, 31257, 14), effect = CONST_ME_TELEPORT },
{ pos = Position(32309, 31250, 14), teleport = Position(32335, 31257, 14), effect = CONST_ME_TELEPORT },
{ pos = Position(32309, 31251, 14), teleport = Position(32335, 31257, 14), effect = CONST_ME_TELEPORT },
{ pos = Position(32309, 31252, 14), teleport = Position(32335, 31257, 14), effect = CONST_ME_TELEPORT },
},
specPos = {
from = Position(32324, 31239, 14),
to = Position(32347, 31263, 14),
},
monsters = {
{ name = "Spark of Destruction", pos = Position(32331, 31254, 14) },
{ name = "Spark of Destruction", pos = Position(32338, 31254, 14) },
{ name = "Spark of Destruction", pos = Position(32330, 31250, 14) },
{ name = "Spark of Destruction", pos = Position(32338, 31250, 14) },
},
onUseExtra = function()
Game.setStorageValue(GlobalStorage.HeartOfDestruction.RuptureResonanceStage, -1)
Game.setStorageValue(GlobalStorage.HeartOfDestruction.RuptureResonanceActive, -1)

local tile = Tile(Position(32326, 31250, 14))
if tile then
local vortex = tile:getItemById(23482)
if vortex then
vortex:transform(23483)
vortex:setActionId(14343)
end
end
item:transform(item.itemid == 8911 and 8912 or 8911)
end
return true
end
end,
exit = Position(32088, 31321, 13),
}

heartDestructionRupture:aid(14327)
heartDestructionRupture:register()
local lever = BossLever(config)
lever:aid(14327)
lever:register()
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
local ruptureHeal = CreatureEvent("RuptureHeal")

function ruptureHeal.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
local healthGain = math.random(5000, 10000)
if attacker and attacker:isPlayer() and resonanceActive == true then
local resonanceActive = Game.getStorageValue(GlobalStorage.HeartOfDestruction.RuptureResonanceActive)
if attacker and attacker:isPlayer() and resonanceActive == 1 then
local healthGain = math.random(5000, 10000)
creature:addHealth(healthGain)
creature:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
end
Expand Down
Loading

0 comments on commit cd89fba

Please sign in to comment.