Skip to content

Commit

Permalink
Merge branch 'main' into golden-outfit-to-kv
Browse files Browse the repository at this point in the history
  • Loading branch information
omarcopires authored Jun 3, 2024
2 parents 35661d8 + 8d74ea6 commit 291fd2c
Show file tree
Hide file tree
Showing 101 changed files with 1,740 additions and 744 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/mysql-schema-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
name: MySQL Schema Check
on:
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- "schema.sql"
merge_group:
push:
paths:
- "schema.sql"
branches:
- main

jobs:
mysql-schema-check:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: canary
MYSQL_USER: canary
MYSQL_PASSWORD: canary
ports:
- 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
fail-fast: false
name: Check
steps:
- name: Checkout repository
uses: actions/checkout@main
- name: 📌 MySQL Start & init & show db
run: |
sudo /etc/init.d/mysql start
mysql -e 'CREATE DATABASE canary;' -uroot -proot
mysql -e "SHOW DATABASES" -uroot -proot
- name: Import Canary Schema
run: |
mysql -uroot -proot canary < schema.sql
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ cmake_minimum_required(VERSION 3.22 FATAL_ERROR)
# VCPKG
# cmake -DCMAKE_TOOLCHAIN_FILE=/opt/workspace/vcpkg/scripts/buildsystems/vcpkg.cmake ..
# Needed libs is in file vcpkg.json
# Windows required libs: .\vcpkg install --triplet x64-windows asio pugixml spdlog curl protobuf parallel-hashmap magic-enum mio luajit libmariadb mpir abseil
# Windows required libs: .\vcpkg install --triplet x64-windows asio pugixml spdlog curl protobuf parallel-hashmap magic-enum mio luajit libmariadb mpir abseil bshoshany-thread-pool
if(DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
CACHE STRING "")
Expand Down Expand Up @@ -124,4 +124,4 @@ add_subdirectory(src)

if(BUILD_TESTS)
add_subdirectory(tests)
endif()
endif()
4 changes: 4 additions & 0 deletions config.lua.dist
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,10 @@ partyListMaxDistance = 30
toggleMapCustom = true

-- Market
-- NOTE: marketRefreshPricesInterval (in minutes, minimum is 1 minute)
-- NOTE: set it to 0 for disable, is the time in which the task will run updating the prices of the items that will be sent to the client
marketOfferDuration = 30 * 24 * 60 * 60
marketRefreshPricesInterval = 30
premiumToCreateMarketOffer = true
checkExpiredMarketOffersEachMinutes = 60
maxMarketOffersAtATimePerPlayer = 100
Expand Down Expand Up @@ -508,6 +511,7 @@ bossDefaultTimeToFightAgain = 20 * 60 * 60 -- 20 hours
bossDefaultTimeToDefeat = 20 * 60 -- 20 minutes

-- Monsters
defaultRespawnTime = 60
deSpawnRange = 2
deSpawnRadius = 50

Expand Down
55 changes: 54 additions & 1 deletion data-otservbr-global/migrations/45.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,56 @@
function onUpdateDatabase()
return false -- true = There are others migrations file | false = this is the last migration file
logger.info("Updating database to version 46 (feat: vip groups)")

db.query([[
CREATE TABLE IF NOT EXISTS `account_vipgroups` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`account_id` int(11) UNSIGNED NOT NULL COMMENT 'id of account whose vip group entry it is',
`name` varchar(128) NOT NULL,
`customizable` BOOLEAN NOT NULL DEFAULT '1',
CONSTRAINT `account_vipgroups_pk` PRIMARY KEY (`id`, `account_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
]])

db.query([[
CREATE TRIGGER `oncreate_accounts` AFTER INSERT ON `accounts` FOR EACH ROW BEGIN
INSERT INTO `account_vipgroups` (`account_id`, `name`, `customizable`) VALUES (NEW.`id`, 'Enemies', 0);
INSERT INTO `account_vipgroups` (`account_id`, `name`, `customizable`) VALUES (NEW.`id`, 'Friends', 0);
INSERT INTO `account_vipgroups` (`account_id`, `name`, `customizable`) VALUES (NEW.`id`, 'Trading Partner', 0);
END;
]])

db.query([[
CREATE TABLE IF NOT EXISTS `account_vipgrouplist` (
`account_id` int(11) UNSIGNED NOT NULL COMMENT 'id of account whose viplist entry it is',
`player_id` int(11) NOT NULL COMMENT 'id of target player of viplist entry',
`vipgroup_id` int(11) UNSIGNED NOT NULL COMMENT 'id of vip group that player belongs',
INDEX `account_id` (`account_id`),
INDEX `player_id` (`player_id`),
INDEX `vipgroup_id` (`vipgroup_id`),
CONSTRAINT `account_vipgrouplist_unique` UNIQUE (`account_id`, `player_id`, `vipgroup_id`),
CONSTRAINT `account_vipgrouplist_player_fk`
FOREIGN KEY (`player_id`) REFERENCES `players` (`id`)
ON DELETE CASCADE,
CONSTRAINT `account_vipgrouplist_vipgroup_fk`
FOREIGN KEY (`vipgroup_id`, `account_id`) REFERENCES `account_vipgroups` (`id`, `account_id`)
ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
]])

db.query([[
INSERT INTO `account_vipgroups` (`id`, `account_id`, `name`, `customizable`)
SELECT 1, id, 'Friends', 0 FROM `accounts`;
]])

db.query([[
INSERT INTO `account_vipgroups` (`id`, `account_id`, `name`, `customizable`)
SELECT 2, id, 'Enemies', 0 FROM `accounts`;
]])

db.query([[
INSERT INTO `account_vipgroups` (`id`, `account_id`, `name`, `customizable`)
SELECT 3, id, 'Trading Partners', 0 FROM `accounts`;
]])

return true
end
3 changes: 3 additions & 0 deletions data-otservbr-global/migrations/46.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function onUpdateDatabase()
return false -- true = There are others migrations file | false = this is the last migration file
end
5 changes: 3 additions & 2 deletions data-otservbr-global/npc/alaistar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,14 @@ local itemsTable = {
{ itemName = "strong health potion", clientId = 236, buy = 115 },
{ itemName = "strong mana potion", clientId = 237, buy = 93 },
{ itemName = "supreme health potion", clientId = 23375, buy = 625 },
{ itemName = "ultimate health potion", clientId = 7643, buy = 438 },
{ itemName = "ultimate mana potion", clientId = 23373, buy = 379 },
{ itemName = "ultimate health potion", clientId = 7643, buy = 379 },
{ itemName = "ultimate mana potion", clientId = 23373, buy = 438 },
{ itemName = "ultimate spirit potion", clientId = 23374, buy = 438 },
{ itemName = "vial", clientId = 2874, sell = 5 },
},
["creature products"] = {
{ itemName = "cowbell", clientId = 21204, sell = 210 },
{ itemName = "execowtioner mask", clientId = 21201, sell = 240 },
{ itemName = "giant pacifier", clientId = 21199, sell = 170 },
{ itemName = "glob of glooth", clientId = 21182, sell = 125 },
{ itemName = "glooth injection tube", clientId = 21103, sell = 350 },
Expand Down
22 changes: 22 additions & 0 deletions data-otservbr-global/npc/alexander.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,28 @@ npcConfig.voices = {
}

local itemsTable = {
["exercise weapons"] = {
{ itemName = "durable exercise rod", clientId = 35283, buy = 945000, count = 1800 },
{ itemName = "durable exercise wand", clientId = 35284, buy = 945000, count = 1800 },
{ itemName = "exercise rod", clientId = 28556, buy = 262500, count = 500 },
{ itemName = "exercise wand", clientId = 28557, buy = 262500, count = 500 },
{ itemName = "lasting exercise rod", clientId = 35289, buy = 7560000, count = 14400 },
{ itemName = "lasting exercise wand", clientId = 35290, buy = 7560000, count = 14400 },
},
["creature products"] = {
{ itemName = "crystal ball", clientId = 3076, buy = 530, sell = 190 },
{ itemName = "life crystal", clientId = 3061, sell = 83 },
{ itemName = "mind stone", clientId = 3062, sell = 170 },
},
["shields"] = {
{ itemName = "spellbook of enlightenment", clientId = 8072, sell = 4000 },
{ itemName = "spellbook of warding", clientId = 8073, sell = 8000 },
{ itemName = "spellbook of mind control", clientId = 8074, sell = 13000 },
{ itemName = "spellbook of lost souls", clientId = 8075, sell = 19000 },
},
["others"] = {
{ itemName = "spellwand", clientId = 651, sell = 299 },
},
["runes"] = {
{ itemName = "animate dead rune", clientId = 3203, buy = 375 },
{ itemName = "blank rune", clientId = 3147, buy = 10 },
Expand Down
68 changes: 68 additions & 0 deletions data-otservbr-global/npc/an_idol.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
local internalNpcName = "An Idol"
local npcType = Game.createNpcType(internalNpcName)
local npcConfig = {}

npcConfig.name = internalNpcName
npcConfig.description = internalNpcName

npcConfig.health = 100
npcConfig.maxHealth = npcConfig.health
npcConfig.walkInterval = 0
npcConfig.walkRadius = 2

npcConfig.outfit = {
lookTypeEx = 15894,
}

npcConfig.flags = {
floorchange = false,
}

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)

npcType.onThink = function(npc, interval)
npcHandler:onThink(npc, interval)
end

npcType.onAppear = function(npc, creature)
npcHandler:onAppear(npc, creature)
end

npcType.onDisappear = function(npc, creature)
npcHandler:onDisappear(npc, creature)
end

npcType.onMove = function(npc, creature, fromPosition, toPosition)
npcHandler:onMove(npc, creature, fromPosition, toPosition)
end

npcType.onSay = function(npc, creature, type, message)
npcHandler:onSay(npc, creature, type, message)
end

npcType.onCloseChannel = function(npc, creature)
npcHandler:onCloseChannel(npc, creature)
end

local function creatureSayCallback(npc, creature, type, message)
local player = Player(creature)

if not npcHandler:checkInteraction(npc, creature) then
return false
end

if MsgContains(message, "VBOX") then
npcHandler:say("J-T B^C J^BXT°", npc, creature)
player:teleportTo(Position(32366, 32531, 8), false)
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
end

return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new(), npcConfig.name, true, true, false)

-- npcType registering the npcConfig table
npcType:register(npcConfig)
33 changes: 33 additions & 0 deletions data-otservbr-global/npc/asima.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ npcConfig.flags = {
}

local itemsTable = {
["exercise weapons"] = {
{ itemName = "durable exercise rod", clientId = 35283, buy = 945000, count = 1800 },
{ itemName = "durable exercise wand", clientId = 35284, buy = 945000, count = 1800 },
{ itemName = "exercise rod", clientId = 28556, buy = 262500, count = 500 },
{ itemName = "exercise wand", clientId = 28557, buy = 262500, count = 500 },
{ itemName = "lasting exercise rod", clientId = 35289, buy = 7560000, count = 14400 },
{ itemName = "lasting exercise wand", clientId = 35290, buy = 7560000, count = 14400 },
},
["potions"] = {
{ itemName = "empty potion flask", clientId = 283, sell = 5 },
{ itemName = "empty potion flask", clientId = 284, sell = 5 },
Expand All @@ -41,6 +49,12 @@ local itemsTable = {
{ itemName = "ultimate spirit potion", clientId = 23374, buy = 438 },
{ itemName = "vial", clientId = 2874, sell = 5 },
},
["others"] = {
{ itemName = "spellwand", clientId = 651, sell = 299 },
},
["shields"] = {
{ itemName = "spellbook", clientId = 3059, buy = 150 },
},
["runes"] = {
{ itemName = "avalanche rune", clientId = 3161, buy = 57 },
{ itemName = "blank rune", clientId = 3147, buy = 10 },
Expand All @@ -61,8 +75,27 @@ local itemsTable = {
{ itemName = "poison field rune", clientId = 3172, buy = 21 },
{ itemName = "poison wall rune", clientId = 3176, buy = 52 },
{ itemName = "sudden death rune", clientId = 3155, buy = 135 },
{ itemName = "stalagmite rune", clientId = 3179, buy = 12 },
{ itemName = "ultimate healing rune", clientId = 3160, buy = 175 },
},
["wands"] = {
{ itemName = "hailstorm rod", clientId = 3067, buy = 15000 },
{ itemName = "moonlight rod", clientId = 3070, buy = 1000 },
{ itemName = "necrotic rod", clientId = 3069, buy = 5000 },
{ itemName = "northwind rod", clientId = 8083, buy = 7500 },
{ itemName = "snakebite rod", clientId = 3066, buy = 500 },
{ itemName = "springsprout rod", clientId = 8084, buy = 18000 },
{ itemName = "terra rod", clientId = 3065, buy = 10000 },
{ itemName = "underworld rod", clientId = 8082, buy = 22000 },
{ itemName = "wand of cosmic energy", clientId = 3073, buy = 10000 },
{ itemName = "wand of decay", clientId = 3072, buy = 5000 },
{ itemName = "wand of draconia", clientId = 8093, buy = 7500 },
{ itemName = "wand of dragonbreath", clientId = 3075, buy = 1000 },
{ itemName = "wand of inferno", clientId = 3071, buy = 15000 },
{ itemName = "wand of starstorm", clientId = 8092, buy = 18000 },
{ itemName = "wand of voodoo", clientId = 8094, buy = 22000 },
{ itemName = "wand of vortex", clientId = 3074, buy = 500 },
},
}

npcConfig.shop = {}
Expand Down
2 changes: 1 addition & 1 deletion data-otservbr-global/npc/briasol.lua
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ npcConfig.shop = {
{ itemName = "cyan crystal fragment", clientId = 16125, sell = 800 },
{ itemName = "dragon figurine", clientId = 30053, sell = 45000 },
{ itemName = "gemmed figurine", clientId = 24392, sell = 3500 },
{ itemName = "giant amethyst", clientId = 30061, sell = 60000 },
{ itemName = "giant amethyst", clientId = 32622, sell = 60000 },
{ itemName = "giant emerald", clientId = 30060, sell = 90000 },
{ itemName = "giant ruby", clientId = 30059, sell = 70000 },
{ itemName = "giant sapphire", clientId = 30061, sell = 50000 },
Expand Down
2 changes: 1 addition & 1 deletion data-otservbr-global/npc/chantalle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ npcConfig.shop = {
{ itemName = "diamond", clientId = 32770, sell = 15000 },
{ itemName = "dragon figurine", clientId = 30053, sell = 45000 },
{ itemName = "gemmed figurine", clientId = 24392, sell = 3500 },
{ itemName = "giant amethyst", clientId = 30061, sell = 60000 },
{ itemName = "giant amethyst", clientId = 32622, sell = 60000 },
{ itemName = "giant emerald", clientId = 30060, sell = 90000 },
{ itemName = "giant ruby", clientId = 30059, sell = 70000 },
{ itemName = "giant sapphire", clientId = 30061, sell = 50000 },
Expand Down
32 changes: 32 additions & 0 deletions data-otservbr-global/npc/chuckles.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,38 @@ local itemsTable = {
{ itemName = "sudden death rune", clientId = 3155, buy = 135 },
{ itemName = "ultimate healing rune", clientId = 3160, buy = 175 },
},
["wands"] = {
{ itemName = "hailstorm rod", clientId = 3067, buy = 15000 },
{ itemName = "moonlight rod", clientId = 3070, buy = 1000 },
{ itemName = "necrotic rod", clientId = 3069, buy = 5000 },
{ itemName = "northwind rod", clientId = 8083, buy = 7500 },
{ itemName = "snakebite rod", clientId = 3066, buy = 500 },
{ itemName = "springsprout rod", clientId = 8084, buy = 18000 },
{ itemName = "terra rod", clientId = 3065, buy = 10000 },
{ itemName = "underworld rod", clientId = 8082, buy = 22000 },
{ itemName = "wand of cosmic energy", clientId = 3073, buy = 10000 },
{ itemName = "wand of decay", clientId = 3072, buy = 5000 },
{ itemName = "wand of draconia", clientId = 8093, buy = 7500 },
{ itemName = "wand of dragonbreath", clientId = 3075, buy = 1000 },
{ itemName = "wand of inferno", clientId = 3071, buy = 15000 },
{ itemName = "wand of starstorm", clientId = 8092, buy = 18000 },
{ itemName = "wand of voodoo", clientId = 8094, buy = 22000 },
{ itemName = "wand of vortex", clientId = 3074, buy = 500 },
},
["exercise weapons"] = {
{ itemName = "durable exercise rod", clientId = 35283, buy = 945000, count = 1800 },
{ itemName = "durable exercise wand", clientId = 35284, buy = 945000, count = 1800 },
{ itemName = "exercise rod", clientId = 28556, buy = 262500, count = 500 },
{ itemName = "exercise wand", clientId = 28557, buy = 262500, count = 500 },
{ itemName = "lasting exercise rod", clientId = 35289, buy = 7560000, count = 14400 },
{ itemName = "lasting exercise wand", clientId = 35290, buy = 7560000, count = 14400 },
},
["others"] = {
{ itemName = "spellwand", clientId = 651, sell = 299 },
},
["shields"] = {
{ itemName = "spellbook", clientId = 3059, buy = 150 },
},
}

npcConfig.shop = {}
Expand Down
2 changes: 1 addition & 1 deletion data-otservbr-global/npc/edmund.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ npcConfig.shop = {
{ itemName = "cyan crystal fragment", clientId = 16125, sell = 800 },
{ itemName = "dragon figurine", clientId = 30053, sell = 45000 },
{ itemName = "gemmed figurine", clientId = 24392, sell = 3500 },
{ itemName = "giant amethyst", clientId = 30061, sell = 60000 },
{ itemName = "giant amethyst", clientId = 32622, sell = 60000 },
{ itemName = "giant emerald", clientId = 30060, sell = 90000 },
{ itemName = "giant ruby", clientId = 30059, sell = 70000 },
{ itemName = "giant sapphire", clientId = 30061, sell = 50000 },
Expand Down
14 changes: 14 additions & 0 deletions data-otservbr-global/npc/fenech.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,20 @@ local itemsTable = {
{ itemName = "sudden death rune", clientId = 3155, buy = 135 },
{ itemName = "ultimate healing rune", clientId = 3160, buy = 175 },
},
["exercise weapons"] = {
{ itemName = "durable exercise rod", clientId = 35283, buy = 945000, count = 1800 },
{ itemName = "durable exercise wand", clientId = 35284, buy = 945000, count = 1800 },
{ itemName = "exercise rod", clientId = 28556, buy = 262500, count = 500 },
{ itemName = "exercise wand", clientId = 28557, buy = 262500, count = 500 },
{ itemName = "lasting exercise rod", clientId = 35289, buy = 7560000, count = 14400 },
{ itemName = "lasting exercise wand", clientId = 35290, buy = 7560000, count = 14400 },
},
["others"] = {
{ itemName = "spellwand", clientId = 651, sell = 299 },
},
["shields"] = {
{ itemName = "spellbook", clientId = 3059, buy = 150 },
},
}

npcConfig.shop = {}
Expand Down
Loading

0 comments on commit 291fd2c

Please sign in to comment.