Skip to content

Commit

Permalink
Merge branch 'main' into dudantas/fix-forge-checks
Browse files Browse the repository at this point in the history
  • Loading branch information
majestyotbr authored Jan 5, 2025
2 parents 0176117 + 8aac2a0 commit f70f50d
Show file tree
Hide file tree
Showing 294 changed files with 11,616 additions and 2,909 deletions.
16 changes: 0 additions & 16 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,6 @@ jobs:
with:
install: true

- name: Cache Docker layers
uses: actions/cache@main
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-x86-${{ github.sha }}
restore-keys: |
${{ runner.os }}-x86-
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
Expand Down Expand Up @@ -109,14 +101,6 @@ jobs:
with:
install: true

- name: Cache Docker layers
uses: actions/cache@main
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-arm-${{ github.sha }}
restore-keys: |
${{ runner.os }}-arm-
- name: Build
uses: docker/[email protected]
with:
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/build-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,14 @@ jobs:
run: >
sudo apt-get update && sudo apt-get install ccache linux-headers-"$(uname -r)"
- name: Switch to gcc-12 on Ubuntu 22.04
- name: Switch to gcc-13 on Ubuntu 22.04
if: matrix.os == 'ubuntu-22.04'
run: |
sudo apt install gcc-12 g++-12
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100 --slave /usr/bin/g++ g++ /usr/bin/g++-12 --slave /usr/bin/gcov gcov /usr/bin/gcov-12
sudo update-alternatives --set gcc /usr/bin/gcc-12
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update
sudo apt install gcc-13 g++-13 -y
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 100 --slave /usr/bin/g++ g++ /usr/bin/g++-13 --slave /usr/bin/gcov gcov /usr/bin/gcov-12
sudo update-alternatives --set gcc /usr/bin/gcc-13
- name: Switch to gcc-14 on Ubuntu 24.04
if: matrix.os == 'ubuntu-24.04'
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -395,5 +395,8 @@ canary.old
# VCPKG
vcpkg_installed

# DB Backups
database_backup

# CLION
cmake-build-*
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ endif()
# *****************************************************************************
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)

# Configure build options for compatibility with commodity CPUs
if(NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=x86-64 -mtune=generic -mno-avx -mno-sse4")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=x86-64 -mtune=generic -mno-avx -mno-sse4")
endif()

# *****************************************************************************
# Include cmake tools
# *****************************************************************************
Expand Down
5 changes: 4 additions & 1 deletion config.lua.dist
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,11 @@ Setting this to false may pose risks; if a house is abandoned and contains a lar
]]
-- Periods: daily/weekly/monthly/yearly/never
-- Base: sqm,rent,sqm+rent
toggleCyclopediaHouseAuction = true
daysToCloseBid = 7
housePriceRentMultiplier = 0.0
housePriceEachSQM = 1000
houseRentPeriod = "never"
houseRentPeriod = "monthly"
houseRentRate = 1.0
houseOwnedByAccount = false
houseBuyLevel = 100
Expand Down Expand Up @@ -399,6 +401,7 @@ mysqlHost = "127.0.0.1"
mysqlUser = "root"
mysqlPass = "root"
mysqlDatabase = "otservbr-global"
mysqlDatabaseBackup = false
mysqlPort = 3306
mysqlSock = ""
passwordType = "sha1"
Expand Down
3 changes: 0 additions & 3 deletions data-canary/migrations/0.lua

This file was deleted.

5 changes: 0 additions & 5 deletions data-canary/migrations/1.lua

This file was deleted.

45 changes: 45 additions & 0 deletions data-canary/migrations/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Database Migration System

This document provides an overview of the current database migration system for the project. The migration process has been streamlined to ensure that all migration scripts are automatically applied in order, making it easier to maintain database updates.

## How It Works

The migration system is designed to apply updates to the database schema or data whenever a new server version is started. Migration scripts are stored in the `migrations` directory, and the system will automatically apply any scripts that have not yet been executed.

### Steps Involved

1. **Retrieve Current Database Version**:
- The system first retrieves the current version of the database using `getDatabaseVersion()`.
- This version is used to determine which migration scripts need to be executed.

2. **Migration Files Directory**:
- All migration scripts are stored in the `migrations` directory.
- Each migration script is named using a numerical pattern, such as `1.lua`, `2.lua`, etc.
- The naming convention helps determine the order in which scripts should be applied.

3. **Execute Migration Scripts**:
- The migration system iterates through the migration directory and applies each migration script that has a version greater than the current database version.
- Only scripts that have not been applied are executed.
- The Lua state (`lua_State* L`) is initialized to run each script.

4. **Update Database Version**:
- After each migration script is successfully applied, the system updates the database version to reflect the applied change.
- This ensures that the script is not re-applied on subsequent server startups.

## Example Migration Script

Below is an example of what a migration script might look like. Note that no return value is required, as all migration files are applied based on the current database version.

```lua
-- Migration script example (for documentation purposes only)
-- This migration script should include all necessary SQL commands or operations to apply a specific update to the database.

-- Example: Adding a new column to the "players" table
local query = [[
ALTER TABLE players ADD COLUMN new_feature_flag TINYINT(1) NOT NULL DEFAULT 0;
]]

-- Execute the query
db.execute(query) -- This function executes the given SQL query on the database.

-- Note: Ensure that queries are validated to avoid errors during the migration process.
2 changes: 1 addition & 1 deletion data-canary/scripts/actions/objects/imbuement_shrine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function imbuement.onUse(player, item, fromPosition, target, toPosition, isHotke
return player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You did not collect enough knowledge from the ancient Shapers. Visit the Shaper temple in Montag for help.")
end

if not target or not (target:isItem()) then
if not target or type(target) ~= "userdata" or not target:isItem() then
return player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can only use the shrine on an valid item.")
end

Expand Down
114 changes: 0 additions & 114 deletions data-canary/scripts/creaturescripts/player_death.lua

This file was deleted.

6 changes: 6 additions & 0 deletions data-otservbr-global/lib/core/storages.lua
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,7 @@ Storage = {
NoblemanSecondAddon = 41308,
FormorgarMinesHoistSkeleton = 41309,
FormorgarMinesHoistChest = 41310,
PickAmount = 41311,
},
},
U8_1 = { -- update 8.1 - Reserved Storages 41351 - 41650
Expand Down Expand Up @@ -2843,6 +2844,11 @@ Storage = {
},
},
},
U13_20 = { -- update 13.20 - Reserved Storages 47952 - 47970
RottenBlood = {
AccessDoor = 47952,
},
},
},
-- Reserved storage from 63951 - 63999
ThaisExhibition = {
Expand Down
1 change: 1 addition & 0 deletions data-otservbr-global/lib/functions/load.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dofile(DATA_DIRECTORY .. "/lib/functions/players.lua")
76 changes: 76 additions & 0 deletions data-otservbr-global/lib/functions/players.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
function Player.getCookiesDelivered(self)
local storage, amount =
{
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.SimonTheBeggar,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.Markwin,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.Ariella,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.Hairycles,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.Djinn,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.AvarTar,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.OrcKing,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.Lorbas,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.Wyda,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.Hjaern,
}, 0
for i = 1, #storage do
if self:getStorageValue(storage[i]) == 1 then
amount = amount + 1
end
end
return amount
end

function Player.checkGnomeRank(self)
local points = self:getStorageValue(Storage.Quest.U9_60.BigfootsBurden.Rank)
local questProgress = self:getStorageValue(Storage.Quest.U9_60.BigfootsBurden.QuestLine)
if points >= 30 and points < 120 then
if questProgress <= 25 then
self:setStorageValue(Storage.Quest.U9_60.BigfootsBurden.QuestLine, 26)
self:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
self:addAchievement("Gnome Little Helper")
end
elseif points >= 120 and points < 480 then
if questProgress <= 26 then
self:setStorageValue(Storage.Quest.U9_60.BigfootsBurden.QuestLine, 27)
self:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
self:addAchievement("Gnome Little Helper")
self:addAchievement("Gnome Friend")
end
elseif points >= 480 and points < 1440 then
if questProgress <= 27 then
self:setStorageValue(Storage.Quest.U9_60.BigfootsBurden.QuestLine, 28)
self:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
self:addAchievement("Gnome Little Helper")
self:addAchievement("Gnome Friend")
self:addAchievement("Gnomelike")
end
elseif points >= 1440 then
if questProgress <= 29 then
self:setStorageValue(Storage.Quest.U9_60.BigfootsBurden.QuestLine, 30)
self:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
self:addAchievement("Gnome Little Helper")
self:addAchievement("Gnome Friend")
self:addAchievement("Gnomelike")
self:addAchievement("Honorary Gnome")
end
end
return true
end

function Player.addFamePoint(self)
local points = self:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Fame_Points)
local current = math.max(0, points)
self:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Fame_Points, current + 1)
self:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have received a fame point.")
end

function Player.getFamePoints(self)
local points = self:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Fame_Points)
return math.max(0, points)
end

function Player.removeFamePoints(self, amount)
local points = self:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Fame_Points)
local current = math.max(0, points)
self:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Fame_Points, current - amount)
end
3 changes: 3 additions & 0 deletions data-otservbr-global/lib/lib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ dofile(DATA_DIRECTORY .. "/lib/quests/quest.lua")

-- Tables library
dofile(DATA_DIRECTORY .. "/lib/tables/load.lua")

-- Functions library
dofile(DATA_DIRECTORY .. "/lib/functions/load.lua")
14 changes: 0 additions & 14 deletions data-otservbr-global/migrations/0.lua

This file was deleted.

Loading

0 comments on commit f70f50d

Please sign in to comment.