Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] rework for enable choosing of a custom datapack name #572

Merged
merged 20 commits into from
Nov 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
39 changes: 23 additions & 16 deletions config.lua.dist
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
-- Core settings
-- Note: If you want to use datapack folder canary (custom), put only "data-canary"
-- If you want to use the global datapack folder, put "data-otservbr-global"
-- If "useAnyDatapackFolder" is set to true then you can choose any datapack folder for your server
useAnyDatapackFolder = false
dataPackDirectory = "data-otservbr-global"
-- Don't change this unless you know what you're doing
coreDirectory = "data"

-- Combat settings
-- NOTE: valid values for worldType are: "pvp", "no-pvp" and "pvp-enforced"
worldType = "pvp"
Expand Down Expand Up @@ -32,10 +41,10 @@ loginProtocolPort = 7171
gameProtocolPort = 7172
statusProtocolPort = 7171
maxPlayers = 0
motd = "Welcome to the Canary!"
serverName = "OTServBR-Global"
motd = "Welcome to the OTServBR-Global!"
onePlayerOnlinePerAccount = true
allowClones = false
serverName = "Canary"
statusTimeout = 5 * 1000
replaceKickOnLogin = true
maxPacketsPerSecond = 25
Expand All @@ -52,9 +61,6 @@ freeDepotLimit = 2000
premiumDepotLimit = 10000
depotBoxes = 20

-- GameStore
gamestoreByModules = true

-- Prey system
-- NOTE: preyRerollPricePerLevel: Price multiplier in gold coin for rerolling prey list.
-- NOTE: preySelectListPrice: Price to manually select creature on list and to lock prey slot.
Expand Down Expand Up @@ -99,8 +105,9 @@ autoLoot = false
-- autoBank = true, the dropped coins from monsters will be automatically
-- deposited to your bank account.
autoBank = false
-- teleporte summon
-- true will never remove the summon

-- Teleport summon
-- Set to true will never remove the summon
teleportSummons = false

-- Stamina in Trainers
Expand Down Expand Up @@ -165,9 +172,9 @@ pushWhenAttacking = false
-- NOTE: set mapName WITHOUT .otbm at the end
-- NOTE: If toggleDownloadMap if false, then the mapDownloadUrl will not be used
-- NOTE: If a map with the name already exists in the world folder, the map will not be downloaded even if the toggleDownloadMap is true
toggleDownloadMap = false
mapName = "canary"
mapDownloadUrl = ""
toggleDownloadMap = true
mapName = "otservbr"
mapDownloadUrl = "https://github.com/opentibiabr/otservbr-global/releases/download/v1.5.0/otservbr.otbm"
mapAuthor = "OpenTibiaBR"

-- Party List limitations
Expand All @@ -176,9 +183,9 @@ mapAuthor = "OpenTibiaBR"
partyListMaxDistance = 30

-- Custom Map
-- NOTE: mapCustomEnabled: true = activate the map, false = disable the map
toggleMapCustom = false
mapCustomName = "canary-custom"
-- NOTE: mapCustomEnabled = activate the map, false = disable the map
toggleMapCustom = true
mapCustomName = "otservbr-custom"
mapCustomAuthor = "OpenTibiaBR"

-- Market
Expand All @@ -190,8 +197,8 @@ maxMarketOffersAtATimePerPlayer = 100
-- MySQL
mysqlHost = "127.0.0.1"
mysqlUser = "root"
mysqlPass = ""
mysqlDatabase = "canary"
mysqlPass = "root"
mysqlDatabase = "otservbr-global"
mysqlPort = 3306
mysqlSock = ""
passwordType = "sha1"
Expand Down Expand Up @@ -230,7 +237,7 @@ globalServerSaveTime = "06:00:00"
sortLootByChance = false

-- Rates
-- NOTE: rateExp, rateSkill and rateMagic are only used when 'rateUseStages = false'
-- NOTE: rateExp, rateSkill and rateMagic is used when 'rateUseStages = false' - or a fallback only
-- To configure rates see file data/stages.lua
rateUseStages = false
rateExp = 1
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions data-canary/lib/core/load.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dofile(DATA_DIRECTORY.. '/lib/core/storages.lua')
dofile(DATA_DIRECTORY.. '/lib/core/constants.lua')
dofile(DATA_DIRECTORY.. '/lib/core/quests.lua')
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions data-canary/lib/lib.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- Core API functions implemented in Lua
dofile(DATA_DIRECTORY.. '/lib/core/load.lua')


-- Tables library
dofile(DATA_DIRECTORY.. '/lib/tables/load.lua')
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions data-canary/lib/tables/load.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dofile(DATA_DIRECTORY.. '/lib/tables/vocation.lua')
dofile(DATA_DIRECTORY.. '/lib/tables/door.lua')
dofile(DATA_DIRECTORY.. '/lib/tables/exercise_training.lua')
dofile(DATA_DIRECTORY.. '/lib/tables/familiar.lua')
dofile(DATA_DIRECTORY.. '/lib/tables/npc_spells.lua')
dofile(DATA_DIRECTORY.. '/lib/tables/window.lua')
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions data-canary/migrations/1.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- return true = There are others migrations file
-- return false = This is the last migration file
function onUpdateDatabase()
return false
end
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions data-canary/npclib/load.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dofile(DATA_DIRECTORY .. "/npclib/npc.lua")
dofile(DATA_DIRECTORY .. "/npclib/npc_system/npc_handler.lua")
dofile(DATA_DIRECTORY .. "/npclib/npc_system/keyword_handler.lua")
dofile(DATA_DIRECTORY .. "/npclib/npc_system/modules.lua")
dofile(DATA_DIRECTORY .. "/npclib/npc_system/custom_modules.lua")
dofile(DATA_DIRECTORY .. "/npclib/npc_system/bank_system.lua")
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions data-canary/scripts/actions/other/blessing_charms.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
dofile(CORE_DIRECTORY .. "/modules/scripts/blessings/blessings.lua")

local blessingCharms = Action()

function blessingCharms.onUse(player, item, fromPosition, target, toPosition, isHotkey)
return Blessings.useCharm(player, item)
end

for blessingId = 10341, 10345 do
blessingCharms:id(blessingId)
end

blessingCharms:register()
10 changes: 10 additions & 0 deletions data-canary/scripts/actions/other/check_bless.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
dofile(CORE_DIRECTORY .. "/modules/scripts/blessings/blessings.lua")

local checkBless = Action()

function checkBless.onUse(player, item, fromPosition, target, toPosition, isHotkey)
return Blessings.checkBless(player)
end

checkBless:id(6561, 11468)
checkBless:register()
File renamed without changes.
107 changes: 107 additions & 0 deletions data-canary/scripts/creaturescripts/login.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
local login = CreatureEvent("PlayerLogin")

function login.onLogin(player)
local loginStr = "Welcome to " .. configManager.getString(configKeys.SERVER_NAME) .. "!"
if player:getLastLoginSaved() <= 0 then
loginStr = loginStr .. " Please choose your outfit."
player:sendOutfitWindow()
else
if loginStr ~= "" then
player:sendTextMessage(MESSAGE_LOGIN, loginStr)
end

player:sendTextMessage(MESSAGE_LOGIN, string.format("Your last visit in ".. SERVER_NAME ..": %s.", os.date("%d. %b %Y %X", player:getLastLoginSaved())))
end

-- 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")
player:registerEvent("BossParticipation")


if onExerciseTraining[player:getId()] then -- onLogin & onLogout
stopEvent(onExerciseTraining[player:getId()].event)
onExerciseTraining[player:getId()] = nil
player:setTraining(false)
end

-- Boosted creature
player:sendTextMessage(MESSAGE_BOOSTED_CREATURE, "Today's boosted creature: " .. Game.getBoostedCreature() .. " \
Boosted creatures yield more experience points, carry more loot than usual and respawn at a faster rate.")

if SCHEDULE_EXP_RATE ~= 100 then
if SCHEDULE_EXP_RATE > 100 then
player:sendTextMessage(MESSAGE_BOOSTED_CREATURE, "Exp Rate Event! Monsters yield more experience points than usual \
Happy Hunting!")
else
player:sendTextMessage(MESSAGE_BOOSTED_CREATURE, "Exp Rate Decreased! Monsters yield less experience points than usual.")
end
end

if SCHEDULE_SPAWN_RATE ~= 100 then
if SCHEDULE_SPAWN_RATE > 100 then
player:sendTextMessage(MESSAGE_BOOSTED_CREATURE, "Spawn Rate Event! Monsters respawn at a faster rate \
Happy Hunting!")
else
player:sendTextMessage(MESSAGE_BOOSTED_CREATURE, "Spawn Rate Decreased! Monsters respawn at a slower rate.")
end
end

if SCHEDULE_LOOT_RATE ~= 100 then
if SCHEDULE_LOOT_RATE > 100 then
player:sendTextMessage(MESSAGE_BOOSTED_CREATURE, "Loot Rate Event! Monsters carry more loot than usual \
Happy Hunting!")
else
player:sendTextMessage(MESSAGE_BOOSTED_CREATURE, "Loot Rate Decreased! Monsters carry less loot than usual.")
end
end

if SCHEDULE_SKILL_RATE ~= 100 then
if SCHEDULE_SKILL_RATE > 100 then
player:sendTextMessage(MESSAGE_BOOSTED_CREATURE, "Skill Rate Event! Your skills progresses at a higher rate \
Happy Hunting!")
else
player:sendTextMessage(MESSAGE_BOOSTED_CREATURE, "Skill Rate Decreased! Your skills progresses at a lower rate.")
end
end

local playerId = player:getId()

-- Stamina
nextUseStaminaTime[playerId] = 1

-- EXP Stamina
nextUseXpStamina[playerId] = 1

-- Set Client XP Gain Rate --
local rateExp = 1
if Game.getStorageValue(GlobalStorage.XpDisplayMode) > 0 then
rateExp = getRateFromTable(experienceStages, player:getLevel(), configManager.getNumber(configKeys.RATE_EXPERIENCE))
if SCHEDULE_EXP_RATE ~= 100 then
rateExp = math.max(0, (rateExp * SCHEDULE_EXP_RATE)/100)
end
end

player:setBaseXpGain(rateExp * 100)

return true
end

login:register()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading