Skip to content

Commit

Permalink
Merge branch 'main' into pathfinder-multithread
Browse files Browse the repository at this point in the history
  • Loading branch information
mehah committed Oct 7, 2023
2 parents 1d24a22 + e133007 commit 1c45b40
Show file tree
Hide file tree
Showing 110 changed files with 1,822 additions and 1,329 deletions.
2 changes: 1 addition & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {
"hostOS": [ "Windows" ]
"hostOS": ["Windows"]
}
},
"condition": {
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ source of the Canary, so that it will be the first repository to use this engine
To connect to the server and to take a stable experience, you can
use [mehah's otclient](https://github.com/mehah/otclient)
or [tibia client](https://github.com/dudantas/tibia-client/releases/latest) and if you want to edit something, check
our [customized tools](https://docs.opentibiabr.com/others/downloads/tools).
our [customized tools](https://docs.opentibiabr.com/opentibiabr/downloads/tools).

If you want edit the map, use the [own remere's map editor](https://github.com/opentibiabr/remeres-map-editor/).

Expand Down
2 changes: 2 additions & 0 deletions config.lua.dist
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ onlyPremiumAccount = false
-- NOTE: buyAolCommandFee will add fee when player buy aol by command (!aol), active changing value more than 0 (fee value. ex: 1 = 1gp aol will be 50001)
-- NOTE: buyBlessCommandFee will add fee when player buy bless by command (!bless), active changing value between 1 and 100 (fee percent. ex: 3 = 3%, 30 = 30%)
-- NOTE: teleportPlayerToVocationRoom will enable oressa to teleport player to his/her room vocation
-- NOTE: toggleReceiveReward = true, will enable players to choose one of reward exercise weapon by command !reward
weatherRain = false
thunderEffect = false
allConsoleLog = false
Expand All @@ -200,6 +201,7 @@ toggleTravelsFree = false
buyAolCommandFee = 0
buyBlessCommandFee = 0
teleportPlayerToVocationRoom = true
toggleReceiveReward = false

-- Teleport summon
-- Set to true will never remove the summon
Expand Down
2 changes: 1 addition & 1 deletion data-otservbr-global/lib/core/storages.lua
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Storage = {
PremiumAccount = 30058,
BattleAxeQuest = 30059,
ShrineEntrance = 30060,

PlayerWeaponReward = 30061,
--[[
Old storages
Over time, this will be dropped and replaced by the table above
Expand Down
110 changes: 110 additions & 0 deletions data-otservbr-global/monster/bosses/doctor_marrow.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
local mType = Game.createMonsterType("Doctor Marrow")
local monster = {}

monster.description = "Doctor Marrow"
monster.experience = 0
monster.outfit = {
lookType = 1611,
lookHead = 57,
lookBody = 0,
lookLegs = 0,
lookFeet = 95,
lookAddons = 0,
lookMount = 0,
}

monster.health = 1800
monster.maxHealth = 1800
monster.race = "blood"
monster.corpse = 18074
monster.speed = 125
monster.manaCost = 0

monster.changeTarget = {
interval = 4000,
chance = 10,
}

monster.strategiesTarget = {
nearest = 80,
health = 10,
damage = 10,
}

monster.flags = {
summonable = false,
attackable = true,
hostile = true,
convinceable = false,
pushable = false,
rewardBoss = true,
illusionable = false,
canPushItems = true,
canPushCreatures = true,
critChance = 10,
staticAttackChance = 90,
targetDistance = 1,
runHealth = 0,
healthHidden = false,
isBlockable = false,
canWalkOnEnergy = true,
canWalkOnFire = true,
canWalkOnPoison = true,
}

monster.light = {
level = 0,
color = 0,
}

monster.voices = {
interval = 5000,
chance = 10,
{ text = "You can't stop the future!", yell = false },
}

monster.attacks = {
{ name = "melee", interval = 2000, chance = 100, minDamage = 0, maxDamage = -2800 },
}

monster.defenses = {
defense = 54,
armor = 59,
mitigation = 3.7,
}

monster.elements = {
{ type = COMBAT_PHYSICALDAMAGE, percent = 0 },
{ type = COMBAT_ENERGYDAMAGE, percent = 0 },
{ type = COMBAT_EARTHDAMAGE, percent = 0 },
{ type = COMBAT_FIREDAMAGE, percent = 0 },
{ type = COMBAT_LIFEDRAIN, percent = 0 },
{ type = COMBAT_MANADRAIN, percent = 0 },
{ type = COMBAT_DROWNDAMAGE, percent = 0 },
{ type = COMBAT_ICEDAMAGE, percent = 0 },
{ type = COMBAT_HOLYDAMAGE, percent = 0 },
{ type = COMBAT_DEATHDAMAGE, percent = 0 },
}

monster.immunities = {
{ type = "paralyze", condition = true },
{ type = "outfit", condition = false },
{ type = "invisible", condition = true },
{ type = "bleed", condition = false },
}

mType.onThink = function(monster, interval) end

mType.onAppear = function(monster, creature)
if monster:getType():isRewardBoss() then
monster:setReward(true)
end
end

mType.onDisappear = function(monster, creature) end

mType.onMove = function(monster, creature, fromPosition, toPosition) end

mType.onSay = function(monster, creature, type, message) end

mType:register(monster)
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
local winReward = CreatureEvent("WinReward")

function winReward.onLogin(player)
if configManager.getBoolean(configKeys.TOGGLE_RECEIVE_REWARD) and player:getTown():getId() >= TOWNS_LIST.AB_DENDRIEL then
-- check user won exercise weapon and send message
if player:getStorageValue(tonumber(Storage.PlayerWeaponReward)) ~= 1 then
player:sendTextMessage(MESSAGE_LOGIN, "You can receive an exercise weapon using command !reward")
end
end
return true
end

winReward:register()
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function theirmastersvoice.onStartup()
if item then
local slimeChance = math.random(100)
if slimeChance <= 30 then
item:transform(math.random(13585, 13589))
item:transform(math.random(12059, 12063))
position:sendMagicEffect(CONST_ME_YELLOW_RINGS)
end
end
Expand Down
3 changes: 3 additions & 0 deletions data-otservbr-global/scripts/lib/register_monster_type.lua
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ registerMonsterType.flags = function(mtype, mask)
if mask.flags.canPushCreatures ~= nil then
mtype:canPushCreatures(mask.flags.canPushCreatures)
end
if mask.flags.critChance ~= nil then
mtype:critChance(mask.flags.critChance)
end
if mask.flags.targetDistance then
mtype:targetDistance(math.max(1, mask.flags.targetDistance))
end
Expand Down
Binary file not shown.
Binary file not shown.
Binary file modified data-otservbr-global/world/world_changes/fury_gates/carlin.otbm
Binary file not shown.
Binary file not shown.
Binary file modified data-otservbr-global/world/world_changes/fury_gates/edron.otbm
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified data-otservbr-global/world/world_changes/fury_gates/thais.otbm
Binary file not shown.
Binary file modified data-otservbr-global/world/world_changes/fury_gates/venore.otbm
Binary file not shown.
24 changes: 8 additions & 16 deletions data/events/scripts/creature.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local function removeCombatProtection(cid)
local player = Player(cid)
local function removeCombatProtection(playerUid)
local player = Player(playerUid)
if not player then
return true
end
Expand All @@ -14,30 +14,22 @@ local function removeCombatProtection(cid)
end

player:setStorageValue(Global.Storage.CombatProtectionStorage, 2)
addEvent(function(cid)
local player = Player(cid)
if not player then
addEvent(function(playerFuncUid)
local playerEvent = Player(playerFuncUid)
if not playerEvent then
return
end

player:setStorageValue(Global.Storage.CombatProtectionStorage, 0)
player:remove()
end, time * 1000, cid)
playerEvent:setStorageValue(Global.Storage.CombatProtectionStorage, 0)
playerEvent:remove()
end, time * 1000, playerUid)
end

picIf = {}
function Creature:onTargetCombat(target)
if not self then
return true
end

if not picIf[target.uid] then
if target:isMonster() then
target:registerEvent("RewardSystemSlogan")
picIf[target.uid] = {}
end
end

if target:isPlayer() then
if self:isMonster() then
local protectionStorage = target:getStorageValue(Global.Storage.CombatProtectionStorage)
Expand Down
36 changes: 18 additions & 18 deletions data/events/scripts/party.lua
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
function Party:onJoin(player)
local playerId = player:getId()
addEvent(function()
player = Player(playerId)
if not player then
local playerUid = player:getGuid()
addEvent(function(playerFuncUid)
local playerEvent = Player(playerFuncUid)
if not playerEvent then
return
end
local party = player:getParty()
local party = playerEvent:getParty()
if not party then
return
end
party:refreshHazard()
end, 100)
end, 100, playerUid)
return true
end

function Party:onLeave(player)
local playerId = player:getId()
local playerUid = player:getGuid()
local members = self:getMembers()
table.insert(members, self:getLeader())
local memberIds = {}
local memberUids = {}
for _, member in ipairs(members) do
if member:getId() ~= playerId then
table.insert(memberIds, member:getId())
if member:getGuid() ~= playerUid then
table.insert(memberUids, member:getGuid())
end
end

addEvent(function()
player = Player(playerId)
if player then
player:updateHazard()
addEvent(function(playerFuncUid, memberUidsTableEvent)
local playerEvent = Player(playerFuncUid)
if playerEvent then
playerEvent:updateHazard()
end

for _, memberId in ipairs(memberIds) do
local member = Player(memberId)
for _, memberUid in ipairs(memberUidsTableEvent) do
local member = Player(memberUid)
if member then
local party = member:getParty()
if party then
Expand All @@ -41,7 +41,7 @@ function Party:onLeave(player)
end
end
end
end, 100)
end, 100, playerUid, memberUids)
return true
end

Expand Down Expand Up @@ -86,5 +86,5 @@ function Party:onShareExperience(exp)
sharedExperienceMultiplier = 1.0 + ((size * (5 * (size - 1) + 10)) / 100)
end

return (exp * sharedExperienceMultiplier) / (#self:getMembers() + 1)
return math.ceil((exp * sharedExperienceMultiplier) / (#self:getMembers() + 1))
end
Loading

0 comments on commit 1c45b40

Please sign in to comment.