Skip to content

Commit

Permalink
Merge branch 'main' into merge-branches
Browse files Browse the repository at this point in the history
  • Loading branch information
elsongabriel authored May 9, 2024
2 parents 759f41d + 09765f8 commit a1fa6a4
Show file tree
Hide file tree
Showing 48 changed files with 1,081 additions and 286 deletions.
4 changes: 2 additions & 2 deletions config.lua.dist
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,6 @@ resetSessionsOnStartup = false
-- Misc.
-- NOTE: experienceDisplayRates: set to false to ignore exp rate or true to include exp rate
-- NOTE: disableLegacyRaids: set to true to disable legacy XML raids
-- NOTE: combatChainDelay: set to minimum 50 miliseconds
allowChangeOutfit = true
toggleMountInProtectionZone = false
freePremium = false
Expand Down Expand Up @@ -430,7 +429,8 @@ maxElementalResistance = 200
maxDamageReflection = 200

-- Chain system
toggleChainSystem = true
-- NOTE: combatChainDelay: set to minimum 50 miliseconds
toggleChainSystem = false
combatChainDelay = 50
combatChainTargets = 5
combatChainSkillFormulaAxe = 0.9
Expand Down
14 changes: 13 additions & 1 deletion data-otservbr-global/lib/core/quests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5592,7 +5592,7 @@ if not Quests then
},
[41] = {
name = "Adventurers Guild",
startStorageId = Storage.AdventurersGuild.GreatDragonHunt.WarriorSkeleton,
startStorageId = Storage.AdventurersGuild.QuestLine,
startStorageValue = 1,
missions = {
[1] = {
Expand All @@ -5606,6 +5606,18 @@ if not Quests then
But the dragon hoards might justify the risks. You killed %d/50 dragons and dragon lords."):format(math.max(player:getStorageValue(Storage.AdventurersGuild.GreatDragonHunt.DragonCounter), 0))
end,
},
[2] = {
name = "The Lost Brother",
storageId = Storage.AdventurersGuild.TheLostBrother,
missionId = 11000,
startValue = 1,
endValue = 3,
states = {
[1] = "At the Kha'zeel Mountains you met the merchant Tarun. His brother has gone missing and was last seen following a beautiful woman into a palace. Tarun fears this woman might have been a demon.",
[2] = "You found the remains of Tarun's brother containing a message. Go back to Tarun and report his brother's last words.",
[3] = "You told Tarun about his brother's sad fate. He was very downhearted but gave you his sincere thanks. The beautiful asuri have taken a young man's life and the happiness of another one.",
},
},
},
},
[42] = {
Expand Down
3 changes: 2 additions & 1 deletion data-otservbr-global/lib/core/storages.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1570,6 +1570,8 @@ Storage = {
WarriorSkeleton = 52146,
DragonCounter = 52147,
},
QuestLine = 52148,
TheLostBrother = 52149,
},
DreamersChallenge = {
-- Reserved storage from 52160 - 52199
Expand Down Expand Up @@ -2534,7 +2536,6 @@ Storage = {
NightmareTeddy = {},
PoacherCavesMiniWorldChange = {},
TheGreatDragonHunt = {},
TheLostBrother = {},
TheTaintedSouls = {},
},
U10_90 = { -- update 10.90 - Reserved Storages 45201 - 45350
Expand Down
2 changes: 1 addition & 1 deletion data-otservbr-global/migrations/43.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function onUpdateDatabase()
logger.info("Updating database to version 43 (feat frags_limit, payment and duration_days in guild wars)")
logger.info("Updating database to version 44 (feat frags_limit, payment and duration_days in guild wars)")

db.query([[
ALTER TABLE `guild_wars`
Expand Down
10 changes: 9 additions & 1 deletion data-otservbr-global/migrations/44.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
function onUpdateDatabase()
return false -- true = There are others migrations file | false = this is the last migration file
logger.info("Updating database to version 45 (fix: mana shield column size for more than 65k)")

db.query([[
ALTER TABLE `players`
MODIFY COLUMN `manashield` INT UNSIGNED NOT NULL DEFAULT '0',
MODIFY COLUMN `max_manashield` INT UNSIGNED NOT NULL DEFAULT '0';
]])

return true
end
3 changes: 3 additions & 0 deletions data-otservbr-global/migrations/45.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
68 changes: 68 additions & 0 deletions data-otservbr-global/npc/tarun.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,74 @@ npcType.onCloseChannel = function(npc, creature)
npcHandler:onCloseChannel(npc, creature)
end

local function creatureSayCallback(npc, creature, type, message)
local player = Player(creature)
if not player then
return false
end
local playerId = player:getId()

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

local theLostBrotherStorage = player:getStorageValue(Storage.AdventurersGuild.TheLostBrother)
if MsgContains(message, "mission") then
if theLostBrotherStorage < 1 then
npcHandler:say({
"My brother is missing. I fear, he went to this evil palace north of here. A place of great beauty, certainly filled with riches and luxury. But in truth it is a threshold to hell and demonesses are after his blood. ...",
"He is my brother, and I am deeply ashamed to admit but I don't dare to go there. Perhaps your heart is more courageous than mine. Would you go to see this place and search for my brother?",
}, npc, creature)
npcHandler:setTopic(playerId, 1)
elseif theLostBrotherStorage == 1 then
npcHandler:say("I hope you will find my brother.", npc, creature)
npcHandler:setTopic(playerId, 0)
elseif theLostBrotherStorage == 2 then
npcHandler:say({
"So, he is dead as I feared. I warned him not to go with this woman, but he gave in to temptation. My heart darkens and moans. But you have my sincere thanks. ...",
"Without your help I would have stayed in the dark about his fate. Please, take this as a little recompense.",
}, npc, creature)
player:addItem(3039, 1)
player:addExperience(3000, true)
player:setStorageValue(Storage.AdventurersGuild.TheLostBrother, 3)
npcHandler:setTopic(playerId, 0)
end
elseif npcHandler:getTopic(playerId) == 1 then
if MsgContains(message, "yes") then
npcHandler:say("I thank you! This is more than I could hope!", npc, creature)
if theLostBrotherStorage < 1 then
player:setStorageValue(Storage.AdventurersGuild.QuestLine, 1)
end
player:setStorageValue(Storage.AdventurersGuild.TheLostBrother, 1)
elseif MsgContains(message, "no") then
npcHandler:say("As you wish.", npc, creature)
end
npcHandler:setTopic(playerId, 0)
end

return true
end

local function onTradeRequest(npc, creature)
local player = Player(creature)
if not player then
return false
end
local playerId = player:getId()

if player:getStorageValue(Storage.AdventurersGuild.TheLostBrother) ~= 3 then
return false
end

return true
end

npcHandler:setMessage(MESSAGE_GREET, "Greetings!")
npcHandler:setMessage(MESSAGE_FAREWELL, "Farewell.")
npcHandler:setMessage(MESSAGE_SENDTRADE, "Of course, just have a look.")
npcHandler:setCallback(CALLBACK_ON_TRADE_REQUEST, onTradeRequest)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_WALKAWAY, "Farewell.")
npcHandler:addModule(FocusModule:new(), npcConfig.name, true, true, true)

npcConfig.shop = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ function adventurersWarriorSkeleton.onUse(player, item, fromPosition, target, to
if player:getStorageValue(Storage.AdventurersGuild.GreatDragonHunt.WarriorSkeleton) < 1 then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have discovered a deceased warrior's skeleton. It seems he tried to hunt the dragons around here - and failed.")
player:addItem(5882, 1) -- red dragon scale

if player:getStorageValue(Storage.AdventurersGuild.QuestLine) < 1 then
player:setStorageValue(Storage.AdventurersGuild.QuestLine, 1)
end

player:setStorageValue(Storage.AdventurersGuild.GreatDragonHunt.WarriorSkeleton, 1)
player:setStorageValue(Storage.AdventurersGuild.GreatDragonHunt.DragonCounter, 0)
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,26 +103,26 @@ function teleportBoss.onStepIn(creature, item, position, fromPosition)
end
local player = creature
if player:getLevel() < config.requiredLevel then
player:teleportTo(exitPosition, true)
player:teleportTo(config.exitPosition, true)
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need to be level " .. config.requiredLevel .. " or higher.")
return true
end
if locked then
player:teleportTo(exitPosition, true)
player:teleportTo(config.exitPosition, true)
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "There's already someone fighting with " .. config.bossName .. ".")
return false
end
if zone:countPlayers(IgnoredByMonsters) >= 5 then
player:teleportTo(exitPosition, true)
player:teleportTo(config.exitPosition, true)
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The boss room is full.")
return false
end
local timeLeft = player:getBossCooldown(config.bossName) - os.time()
if timeLeft > 0 then
player:teleportTo(exitPosition, true)
player:teleportTo(config.exitPosition, true)
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have to wait " .. getTimeInWords(timeLeft) .. " to face " .. config.bossName .. " again!")
player:getPosition():sendMagicEffect(CONST_ME_POFF)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,10 @@ local questTable = {
{ storage = Storage.Quest.U11_40.ThreatenedDreams.QuestLine, storageValue = 1 },
{ storage = Storage.Quest.U11_40.ThreatenedDreams.Mission01[1], storageValue = 16 },
{ storage = Storage.Quest.U11_40.ThreatenedDreams.Mission02.KroazurAccess, storageValue = 1 },
{ storage = Storage.AdventurersGuild.QuestLine, storageValue = 1 },
{ storage = Storage.AdventurersGuild.GreatDragonHunt.WarriorSkeleton, storageValue = 1 },
{ storage = Storage.AdventurersGuild.GreatDragonHunt.WarriorSkeleton, storageValue = 2 },
{ storage = Storage.AdventurersGuild.TheLostBrother, storageValue = 3 },
{ storage = Storage.Quest.U10_55.Dawnport.Questline, storageValue = 1 },
{ storage = Storage.Quest.U10_55.Dawnport.GoMain, storageValue = 1 },
{ storage = Storage.ForgottenKnowledge.AccessDeath, storageValue = 1 },
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
local findRemains = MoveEvent()

function findRemains.onStepIn(creature, item, position, fromPosition)
local player = creature:getPlayer()
if not player then
return true
end

if player:getStorageValue(Storage.AdventurersGuild.TheLostBrother) == 1 then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You stumble over some old bones. Something is carved into the stone wall here: 'Tarun, my brother, you were right. She's evil.'")
player:setStorageValue(Storage.AdventurersGuild.TheLostBrother, 2)
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
end

return true
end

findRemains:position(Position(32959, 32674, 4))
findRemains:register()
36 changes: 22 additions & 14 deletions data/events/scripts/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ local function useStaminaXpBoost(player)
return false
end

local staminaMinutes = player:getExpBoostStamina() / 60
if staminaMinutes == 0 then
local xpBoostMinutes = player:getXpBoostTime() / 60
if xpBoostMinutes == 0 then
return
end

Expand All @@ -156,18 +156,26 @@ local function useStaminaXpBoost(player)
return
end

local xpBoostLeftMinutesByDailyReward = player:kv():get("daily-reward-xp-boost") or 0
if timePassed > 60 then
if staminaMinutes > 2 then
staminaMinutes = staminaMinutes - 2
if xpBoostMinutes > 2 then
xpBoostMinutes = xpBoostMinutes - 2
if xpBoostLeftMinutesByDailyReward > 2 then
player:kv():set("daily-reward-xp-boost", xpBoostLeftMinutesByDailyReward - 2)
end
else
staminaMinutes = 0
xpBoostMinutes = 0
player:kv():remove("daily-reward-xp-boost")
end
_G.NextUseXpStamina[playerId] = currentTime + 120
else
staminaMinutes = staminaMinutes - 1
xpBoostMinutes = xpBoostMinutes - 1
if xpBoostLeftMinutesByDailyReward > 0 then
player:kv():set("daily-reward-xp-boost", xpBoostLeftMinutesByDailyReward - 1)
end
_G.NextUseXpStamina[playerId] = currentTime + 60
end
player:setExpBoostStamina(staminaMinutes * 60)
player:setXpBoostTime(xpBoostMinutes * 60)
end

local function useConcoctionTime(player)
Expand Down Expand Up @@ -519,14 +527,14 @@ function Player:onGainExperience(target, exp, rawExp)
self:addCondition(soulCondition)
end

-- Store Bonus
useStaminaXpBoost(self) -- Use store boost stamina
-- XP Boost Bonus
useStaminaXpBoost(self) -- Use stamina XP boost (store or daily reward)

local Boost = self:getExpBoostStamina()
local stillHasBoost = Boost > 0
local storeXpBoostAmount = stillHasBoost and self:getStoreXpBoost() or 0
local xpBoostTimeLeft = self:getXpBoostTime()
local stillHasXpBoost = xpBoostTimeLeft > 0
local xpBoostPercent = stillHasXpBoost and self:getXpBoostPercent() or 0

self:setStoreXpBoost(storeXpBoostAmount)
self:setXpBoostPercent(xpBoostPercent)

-- Stamina Bonus
local staminaBonusXp = 1
Expand Down Expand Up @@ -564,7 +572,7 @@ function Player:onGainExperience(target, exp, rawExp)
local lowLevelBonuxExp = self:getFinalLowLevelBonus()
local baseRate = self:getFinalBaseRateExperience()

return (exp + (exp * (storeXpBoostAmount / 100) + (exp * (lowLevelBonuxExp / 100)))) * staminaBonusXp * baseRate
return (exp + (exp * (xpBoostPercent / 100) + (exp * (lowLevelBonuxExp / 100)))) * staminaBonusXp * baseRate
end

function Player:onLoseExperience(exp)
Expand Down
4 changes: 4 additions & 0 deletions data/items/items.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75422,6 +75422,7 @@ Granted by TibiaGoals.com"/>
<attribute key="firemagiclevelpoints" value="1"/>
<attribute key="energymagiclevelpoints" value="1"/>
<attribute key="criticalhitdamage" value="1200"/>
<attribute key="range" value="6"/>
<attribute key="criticalhitchance" value="1000"/>
<attribute key="weight" value="2200"/>
<attribute key="imbuementslot" value="2">
Expand Down Expand Up @@ -75449,6 +75450,7 @@ Granted by TibiaGoals.com"/>
<attribute key="magiclevelpoints" value="5"/>
<attribute key="firemagiclevelpoints" value="1"/>
<attribute key="energymagiclevelpoints" value="1"/>
<attribute key="range" value="6"/>
<attribute key="criticalhitdamage" value="1200"/>
<attribute key="criticalhitchance" value="1000"/>
<attribute key="weight" value="2100"/>
Expand Down Expand Up @@ -75492,6 +75494,7 @@ Granted by TibiaGoals.com"/>
<attribute key="weaponType" value="wand"/>
<attribute key="shootType" value="earth"/>
<attribute key="absorbpercentdeath" value="7"/>
<attribute key="range" value="6"/>
<attribute key="magiclevelpoints" value="5"/>
<attribute key="earthmagiclevelpoints" value="1"/>
<attribute key="icemagiclevelpoints" value="1"/>
Expand Down Expand Up @@ -75522,6 +75525,7 @@ Granted by TibiaGoals.com"/>
<attribute key="absorbpercentdeath" value="7"/>
<attribute key="magiclevelpoints" value="5"/>
<attribute key="earthmagiclevelpoints" value="1"/>
<attribute key="range" value="6"/>
<attribute key="icemagiclevelpoints" value="1"/>
<attribute key="criticalhitdamage" value="500"/>
<attribute key="criticalhitchance" value="1000"/>
Expand Down
11 changes: 9 additions & 2 deletions data/modules/scripts/daily_reward/daily_reward.lua
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,15 @@ function Player.selectDailyReward(self, msg)
end
dailyRewardMessage = "Picked items: " .. description
elseif dailyTable.type == DAILY_REWARD_TYPE_XP_BOOST then
self:setExpBoostStamina(self:getExpBoostStamina() + (rewardCount * 60))
self:setStoreXpBoost(50)
local rewardCountReviewed = rewardCount
local xpBoostLeftMinutes = self:kv():get("daily-reward-xp-boost") or 0
if xpBoostLeftMinutes > 0 then
rewardCountReviewed = rewardCountReviewed - xpBoostLeftMinutes
end

self:setXpBoostTime(self:getXpBoostTime() + (rewardCountReviewed * 60))
self:kv():set("daily-reward-xp-boost", rewardCount)
self:setXpBoostPercent(50)
dailyRewardMessage = "Picked reward: XP Bonus for " .. rewardCount .. " minutes."
elseif dailyTable.type == DAILY_REWARD_TYPE_PREY_REROLL then
self:addPreyCards(rewardCount)
Expand Down
12 changes: 6 additions & 6 deletions data/modules/scripts/gamestore/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ function parseBuyStoreOffer(playerId, msg)
elseif offer.type == GameStore.OfferTypes.OFFER_TYPE_SEXCHANGE then
GameStore.processSexChangePurchase(player)
elseif offer.type == GameStore.OfferTypes.OFFER_TYPE_EXPBOOST then
GameStore.processExpBoostPuchase(player)
GameStore.processExpBoostPurchase(player)
elseif offer.type == GameStore.OfferTypes.OFFER_TYPE_HUNTINGSLOT then
GameStore.processTaskHuntingThirdSlot(player)
elseif offer.type == GameStore.OfferTypes.OFFER_TYPE_PREYSLOT then
Expand Down Expand Up @@ -732,7 +732,7 @@ function Player.canBuyOffer(self, offer)
disabled = 1
disabledReason = "You can't buy XP Boost for today."
end
if self:getExpBoostStamina() > 0 then
if self:getXpBoostTime() > 0 then
disabled = 1
disabledReason = "You already have an active XP boost."
end
Expand Down Expand Up @@ -1742,12 +1742,12 @@ function GameStore.processSexChangePurchase(player)
player:toggleSex()
end

function GameStore.processExpBoostPuchase(player)
local currentExpBoostTime = player:getExpBoostStamina()
function GameStore.processExpBoostPurchase(player)
local currentXpBoostTime = player:getXpBoostTime()
local expBoostCount = player:getStorageValue(GameStore.Storages.expBoostCount)

player:setStoreXpBoost(50)
player:setExpBoostStamina(currentExpBoostTime + 3600)
player:setXpBoostPercent(50)
player:setXpBoostTime(currentXpBoostTime + 3600)

if expBoostCount == -1 or expBoostCount == 6 then
expBoostCount = 1
Expand Down
Loading

0 comments on commit a1fa6a4

Please sign in to comment.