Commit graph

39 commits

Author SHA1 Message Date
Eduardo Dantas
b0092a9b87
feat(pvp): add Expert PvP world type and combat rules (#4033)
Add Expert PvP world type and combat rules

This commit adds Expert Open PvP support to Canary as an explicit world type through worldType = expert-pvp.

The implementation introduces a dedicated ExpertPvp component for Expert specific combat, relation, field, movement, collision, and marking rules. Existing combat, spell, tile, player, game, and protocol code remain as thin integration points, while the Expert PvP decisions live under src creatures players components pvp.

This keeps the new behavior isolated from the existing world types and avoids spreading Expert PvP specific rules across unrelated systems.

The existing PvP world type handling was also clarified. retro-pvp is now the explicit Retro Open PvP value, while pvp remains supported as a compatibility alias for retro-pvp. no-pvp and pvp-enforced remain outside the Expert PvP decision path.

Main world type changes

• Adds worldType expert-pvp

• Makes retro-pvp the explicit Retro Open PvP config value

• Keeps pvp as a compatibility alias for retro-pvp

• Changes the default config value from pvp to retro-pvp

• Removes the old toggleServerIsRetroPVP config option

• Updates Lua helpers so IsRetroPVP reads the world type string

• Adds IsExpertPVP for Lua scripts

• Keeps no-pvp and pvp-enforced behavior outside the Expert PvP component

The ExpertPvp component centralizes relation classification and decision making for the new world type. It evaluates PvP mode, actor and target relation, combat action type, field ownership, side effects, player collision, and viewer specific situation marks.

The component covers relations such as self, access players, party allies, guild allies, war enemies, direct attackers, protected ally attackers, direct targets, skulled targets, neutral players, monsters, player summons, and NPCs.

Main Expert PvP rules included

• Dove mode behavior

• White Hand behavior

• Yellow Hand behavior

• Red Fist behavior

• Direct combat decisions

• Rune target decisions

• Area spell decisions

• Summon combat decisions

• Field step decisions

• Field damage decisions

• Player walkthrough decisions

• Pathfinding probe decisions

• Viewer specific field visual decisions

• Viewer relative creature situation marks

Combat integration now asks ExpertPvp before allowing Expert PvP relevant actions. This applies to direct attacks, runes, aggressive area spells, mana and health combat, conditions, dispels, default combat actions, and field damage.

When Expert PvP handles an action, it can allow or block the action and apply the correct side effects. These side effects include fight state, PZ lock behavior, skull actions, square feedback, and unjustified kill tracking where applicable.

Secure mode behavior is handled through the Expert PvP relation rules instead of the older broad secure mode check. This allows secure mode retaliation without applying unjustified protection zone locks in cases where the Expert PvP relation allows the response.

Magic Wall and Wild Growth now carry Expert PvP cast time context. When Expert PvP is enabled, these fields are created as safe field variants and receive owner context so the server can evaluate relation dependent behavior later.

Magic Wall and Wild Growth changes

• Stores the field owner context when the rune is cast

• Stores the owner PvP mode at cast time

• Tracks owner targets and attackers at cast time

• Uses safe visual field items as the base item in Expert PvP

• Resolves viewer specific appearance through protocol serialization

• Evaluates collision and pathfinding from the field context

• Evaluates field stepping side effects through ExpertPvp

• Prevents Expert PvP owned safe fields from being removed like regular no-pvp safe fields

• Keeps normal no-pvp behavior for non Expert PvP worlds

Tile and pathfinding logic now consult ExpertPvp for Expert owned fields. This allows Magic Wall and Wild Growth to appear or behave differently depending on the viewer and the PvP relation, while still using the existing movement and tile query paths as the final authority.

Player walkthrough and body blocking were updated so Expert PvP can decide whether a player can walk through another player outside legacy safe zones. Party, guild, war, attacker, protected ally, and target relations are used to keep collision behavior aligned with Expert PvP hand modes.

PvP situation tracking was added so player relations can affect persistent creature marks. The server can now send viewer relative creature marks for the current client profile and refresh visible marks when relevant state changes.

Situation mark updates happen when needed for events such as party changes, guild changes, attacked player tracking, player removal, and visible relation changes.

Protocol changes

• Adds ExpertPvpModeByte as a protocol feature flag

• Enables Expert PvP mode byte support for the Tibia 11.00 profile

• Keeps Tibia 11.00 on the verified four byte Set Tactics layout

• Keeps current 15.25 on its verified three byte tactics layout

• Defaults unsupported profiles safely to Dove mode

• Avoids appending speculative PvP mode bytes to the current 15.25 profile

• Sends Expert PvP controls only when the protocol profile supports them

• Sends viewer relative creature marks only through supported packet layouts

The current 15.25 profile keeps its verified tactics payload layout and does not receive a speculative extra PvP byte. This prevents client desync or crash risk. Unsupported profiles are forced safely to Dove when Expert PvP is enabled but the protocol cannot represent the mode.

Player state now includes a dedicated PvP component. The selected Expert PvP mode is stored on the player and persisted to the database.

Persistence and database changes

• Adds PlayerPvp component

• Adds player getPvpMode and setPvpMode support

• Saves expert_pvp_mode during player save

• Loads expert_pvp_mode during player load

• Adds players.expert_pvp_mode to schema.sql

• Bumps database version to 59

• Adds migration 59 for the players.expert_pvp_mode column

• Skips the migration safely if the column already exists

Lua API support was expanded so scripts can inspect PvP state and attach field context where needed.

Lua API changes

• Adds Player getPvpMode

• Adds Player hasAttacked

• Adds Item setExpertPvpFieldContext

• Updates generated Lua API documentation

• Updates Magic Wall and Wild Growth scripts to attach Expert PvP field context

The PR also updates blessing and death loss behavior to use the new Retro PvP world type detection instead of the removed toggleServerIsRetroPVP config. This keeps existing Retro PvP behavior while moving the decision to the explicit world type model.

Additional behavior covered

• Party relation handling

• Guild relation handling

• War enemy relation handling

• Skull relation handling

• Aggressor relation handling

• Protected ally relation handling

• Field ownership behavior

• Viewer specific field visuals

• Body blocking and player collision

• Situation marks and persistent creature marks

• Defensive PZ lock behavior

• Secure mode retaliation behavior

• Blessing cost and Twist of Fate behavior under Retro PvP detection

Out of scope

• Frag sharing

• player_kills.weight schema changes

• Debug commands

• Unrelated PvP features

• Broad behavior changes to existing world types

Documentation and tests

• Adds Expert PvP implementation roadmap documentation

• Adds Expert PvP porting plan documentation

• Links the new documentation from the systems overview

• Documents the behavioral contract

• Documents the implementation roadmap

• Documents the in game regression matrix

• Adds Expert PvP unit coverage

• Adds protocol profile coverage for Expert PvP mode support

• Adds regression scenarios for all world types

Validation performed

• Built canary target

• Built canary_ut target

• Built canary_it target

• Expert PvP and protocol profile tests passed with 49 of 49 tests

• Full unit binary passed with 311 of 311 tests

• Integration binary passed with 40 of 40 tests

• Manual scenarios were exercised during implementation

• Tested secure mode retaliation

• Tested defensive PZ lock behavior

• Tested Magic Wall and Wild Growth cast time relations

• Tested viewer specific visuals and collision

• Tested situation marks

Test configuration

• Platform Windows x64

• Compiler Microsoft Visual C plus plus 19.44

• Protocol coverage Tibia 11.00 and current 15.25 profiles

Known validation note

Two isolated CTest invocations terminated during global teardown after their test bodies passed. The same behavior reproduces on the main baseline. Running the unit suite in one process passes all 311 tests.

Overall this commit adds Expert Open PvP as a gated world type with dedicated relation based combat and field rules. It keeps existing world types protected from Expert PvP behavior, persists the selected PvP mode, supports protocol safe PvP mode handling, updates Lua APIs and documentation, and adds regression coverage for the new rules.
2026-08-10 18:42:55 -03:00
Eduardo Dantas
5e357d8a81
feat: add Way of the Monk quest and monk-related content (#3794)
feat: add Way of the Monk quest, monster updates, and core data improvements

This commit introduces the complete implementation of the Way of the Monk quest, along with multiple updates to monsters, bosses, items, and core gameplay data.

Quest:
• Added full quest definition for Way of the Monk, including mission flow, shrine tracking, and storage handling.
• Registered the new quest module in the quest catalog.
• Introduced new storage keys related to monk quest progression and items.
• Added a sample monk player migration (DB version 55) for testing purposes.
• Added Blue Valley to the towns list to support quest locations.

Monsters and Bosses:
• Added new monster Tame Terror Bird with complete stats, behaviors, and loot.
• Reworked Mitmah Vanguard boss with updated events, attributes, attacks, defenses, elemental modifiers, loot, and lifecycle hooks.
• Expanded loot tables for bosses such as The Brainstealer and The Monster, including monk-related items and potions.

Items and Loot:
• Updated frazzlemaw and guzzlemaw loot to drop traditional sai instead of sai.
• Added monk-related item IDs to destruction scripts and Dawnport cleanup logic.

Gameplay:
• Added Monk’s Apparition to the Soul War quest apparition list.
• Introduced a new combat formula for fist fighting skill.
• Removed legacy fist fighting attack speed configuration from server settings.

Workflow:
• Improved GitHub Actions workflow to ensure reusable checks run on the correct branch.
2026-02-12 23:03:25 -03:00
Eduardo Dantas
acdba2cdad
feat: protocol 14.12 (#3524)
feat: add client and server features for gameplay and UI improvements

- Renamed Supply Stash to Stash and removed depot slot limit count
- Added advanced filters for Stash item categories
- Reworked Cyclopedia Combat Stats into Offense, Defense, and Misc Stats
- Added detailed tooltips and integrated stats into Skills widget
- Introduced Magical Archive interface for spells and runes with filters
- Overhauled Quest Log and Tracker with pinning, search, sort, compact display, and notifications
- Enhanced Exaltation Forge with boots tier bonus and Dust management
- Redesigned Charms System with new Major and Minor charms and balance changes
- Added new mounts and outfits for customization
- Improved server and client behavior with advanced stash, spell archive, detailed stats, and enhanced tier systems
- Verified features through manual and in-game testing
2025-06-08 16:12:15 -03:00
roberto furtado
d94e23a959
fix: stamina green delay (#2884) 2024-10-02 20:13:23 -03:00
Marco
414ddc1133
refactor: scroll of ascencion and swimming to core (#2334) 2024-02-29 12:51:48 -03:00
Marco
ea5867afc2
refactor: move potions to core and improvement for npc sandra (#2292) 2024-02-22 17:22:10 +00:00
sebbesiren
1528314384
feat: boss loot event (#2293)
Allows you to setup boss loot event similar to experience, spawnrate and
loot.
See updated examples in events.xml

---------

Co-authored-by: Sebastian Nobbelin <sebastiannobbelin@gmail.com>
Co-authored-by: GitHub Actions <github-actions[bot]@users.noreply.github.com>
2024-02-22 11:57:23 +00:00
Marco
7356b7d37d
chore: remove unused custom script (#2274) 2024-02-20 16:45:27 +00:00
Luan Santos
e737403062
feat: 13.32 protocol and features (#2110)
Client to test: https://github.com/dudantas/tibia-client/pull/10

New features: 
• Wheel Gems
• New forge convergence fusion and transfer
• New forge transcendence (tier for legs)
• New window "Obtain" for manage containers
• Moved forge skills formula to config.lua

Fixes:
• House guest use dummy
• Sales from npc freeze at "Game::addItemBatch"
• Some fixes related to houses
• Fixed float on look from onslaught and momentum
• Fixed to kill process after 5 seconds from "Shutdown done"
• Fixed to "managed containers" set default backpack on "equip" backpack
and "relogin"
• Fixed "getTimeMsNow" and "getTimeUsNow" return to int64_t

---------

Co-authored-by: Eduardo Dantas <eduardo.dantas@hotmail.com.br>
2024-01-21 23:11:37 +00:00
Luan Santos
f0fcd2c39b
improve: datapack cleanup/refactor (#2008)
- Fixes #1840 
- Adds some missing achievements
- Adds some missing mounts
- Adds some missing outfits
2023-12-10 15:11:27 -08:00
Luan Luciano
33d62b4482
fix: NextUseConcoctionTime _G table (#1916) 2023-11-25 17:32:08 -08:00
Eduardo Dantas
2a3a88b2bf
improve: rename global variables to use _G lua table (#1878)
Renamed global variables and removed unused tables.
2023-11-22 04:02:55 -03:00
Eduardo Dantas
fd0602a45d
fix: infinity prey time if stamina system is disabled (#1873)
Resolves #518
2023-11-21 23:41:19 -03:00
Luan Luciano
d0281303eb
improve: revision of codes in data/ (#1374) 2023-09-29 19:37:01 -07:00
Luan Santos
5549d87f9d
improve: switch to Stylua formatter (#1582)
Stylua is easier to configure than what we had before, since it's
already available as a code action. It also parses the code while it
formats which will help catch syntax errors on PRs automatically.
2023-09-10 10:17:19 -07:00
Luan Santos
03f065d689
improve: lua format from EmmyLuaCodeStyle (#1513)
Credits: @elsongabriel

---------

Co-authored-by: Elson Gabriel <elsongabriel@hotmail.com>
2023-08-27 10:49:56 -07:00
Luan Santos
5266110d54
improve: re-write loot rolls to share code and use callbacks (#1323)
Overhaul of the loot roll system. The primary motivation behind these changes is to improve the code's maintainability, readability, and efficiency taking advantage of the new EventCallback system from: f518fdf02b

• Code Reusability: The loot roll system has been rewritten to share code more effectively. This reduces code redundancy, making the system easier to maintain and update in the future. It also improves the readability of the code, making it easier for new contributors to understand the system's workings.

• Use of Callbacks: The new system leverages callbacks, which provide a more efficient and flexible way to handle loot rolls. This change allows for better control flow and can help improve the system's performance.

• Configuration Updates: Several updates have been made to the configuration parameters, including the addition of partyShareLootBoostsDimishingFactor and tibiadromeConcoctionTickType in config.lua.dist, and changing the WealthDuplex parameter from multiplier to an additive rate in concoctions.lua. These changes provide more control and flexibility over the loot roll system's behaviour.
2023-08-02 03:14:52 -03:00
Luan Luciano
9265d9c750
improve: compatibility update for some lua scripts (#1316)
Changed some files from TFS scripts version 0.x to TFS 1.x and above. Improves readability and compatibility/maintainability.
2023-08-02 00:36:45 -03:00
Eduardo Dantas
8e587e93d5
fix: enter on depot by all directions (#1241)
Players will be able to access the depot looking from any direction, not just if you are looking in the direction of the depot.

This is useful for depots that don't have "single entry", for example in houses.
2023-07-18 15:22:36 -03:00
Luan Santos
fc452dd974
feat: concoctions system (#1223)
Implementing a system for handling concoctions (also known as Tibiadrome potions). https://tibia.fandom.com/wiki/Tibiadrome#Rewards

The system introduces a new concoctions_lib.lua file that contains the majority of the logic. This file provides a registry to create concoction configurations and allows for later inspection of the state and duration of the concoctions for a player.

Additionally, a new configuration key called partyShareLootBoosts has been added. This key enables any party member to provide a loot boost to the entire party through either prey or wealth duplex. This functionality deviates from how Tibia normally operates, but it has been included as an option to address the annoyance associated with the default Tibia behaviour.

Please note that this implementation only includes four of the available concoctions. The remaining concoctions can be implemented at a later stage.
2023-07-12 16:46:39 -03:00
Luan Santos
6862984407
feat: authenticate using session id (#1178)
Allows configuration of `authType = "session` in order to use an expiring session instead of a password. This can enable login-server side 2-factor auth as well as greater control over security. SlenderAAC: https://github.com/luan/slenderaac, uses this for security and actually stores the password with bcrypt instead of SHA1 with no other changes to the base.
2023-07-08 10:28:46 -03:00
Eduardo Dantas
6a0bb66ac1
improve: better player group flags management (#942)
This allows us to add or remove flags on specific players, for example, so that a certain player is not visible by a monster, or cannot drop loot at a certain time (for example, in a specific quest). Instead of the flags being determined globally, they can be set differently for each player, depending on our wishes.

New talkactions:
• /hasflag playername, flagname or number
• /setflag playername, flagname or number
• /removeflag playername, flagname or number

New string function:
string.trimSpace(str) or string:trimSpace()

Documented the strings functions and moved from global.lua to string.lua
2023-05-08 18:55:13 -07:00
Elson Costa
abc70c1b94
improve: small improvements and fixes (details in description) (#919)
• Small adjustments in code, as best practices in variables, and indentation;
• Created toggles:
  - Make gold pouch configurable to put items in it other than gold;
  - Set server retro pvp (disabling PARTY_PROTECTION and ADVANCED_SECURE_MODE in globa.lua);
  - Make all travel free;
• Set level 10 to use softboots, were level 180;
• Improved testserver_assistant.lua;
• Some TYPO corrections;
• Improved talkaction online.lua;
• Adjusted containersize of gold pouch to 20;
• Improved recompile.sh;
• Other small fixes;
• Created bestiary and bosstiary multiplies factor in config.lua;
• Created a config to multiplier forge dust received, and created notes of forge system;
2023-03-28 07:45:13 -03:00
Elson Costa
204a3f3b32
fix: server motd from config.lua (#897)
Fixed to pull motd from config.lua and renamed the variable from "MOTD" to "SERVER_MOTD"
2023-03-09 23:45:54 -03:00
ElimarCosta
5c53a39d47
fix: monsters/summons can walk no-walkable items after set unique id (#856)
This fixes an issue where monsters and summons could walk on non-walkable items after their unique ID had been set. The fix ensures that the pathfinding algorithm takes these non-walkable items into account when moving the monsters and summons, preventing them from moving through areas that are designated as non-walkable.
2023-02-17 00:28:05 -03:00
Beats
e7ab37a66d
[Bug] fixes some things and miscellaneous adjusts (#484)
• Added missing magic gold converter id
• Fixed "MESSAGE_INFO_DESCR" not exists to correct enum "MESSAGE_EVENT_ADVANCE"
• Added a function to check if the pack running is the global one and added checks to only run some codes in the global pack
• Fixed to Hireling Lamp so it cannot be moved
• Indented "gamestore.lua" script for tab and removed several whitespace
2022-12-08 01:56:37 -03:00
Breno Zanato Detomini
7479bca438
[Enhancement] only load folder startup if file startup.lua exists (#646) 2022-11-25 15:59:02 -03:00
Eduardo Dantas
6c924ebc9b
[Enhancement] rework for enable choosing of a custom datapack name (#572)
With this modification, we will be able to focus on just one repository (the canary), and archive otservbr-global repository.

The intention is that we can have two datapacks in the same repository, being able to easily switch from one to the other, just change in config.lua the "dataPackDirectory" from "data-otservbr-global" to "data-canary" or vice versa.

The main purpose is to facilitate our development, at the same time that the community will be able to contribute in a single repository, but keeping the choice of using a "clean" datapack.

I made some more modifications, such as removing the unused C++ gamestore, I also removed the "allowPickupable" tag, which was duplicated, and I made some other adjustments.

Folder structure changes
Now we have the following structure:
• data = this will be the "core" folder, it is where the files that are absolutely necessary for the executable to open correctly, such as libs, xmls, etc. Here we will have files that both the global and the canary datapack will share with each other
• data-otservbr-global = here will be the global datapack files, some libs and folders that are only for the global server, such as scripts, monsters, npcs, world.
• data-canary = a "clean" datapack as far as possible, with only the scripts and files necessary for the server to work.

• NOTE: The "data" folder is actually the "core" of the server, we didn't rename it to avoid having to make changes to the sites and login.php, since they read the "data/xml". The other two folders, data-otservbr-global and data-canary can be changed in config.lua, which one you want the executable to read, by default we'll point to the global one, as that's what most use. If you want to start a custom server with "as few files and scripts as possible", then switch to "data-canary".

We also added a boolean in config.lua that allows choosing another name for the datapack, by default we will also keep this disabled, since we will only maintain support for these two datapacks, it is up to each one to know what they are doing in case they want to change it.

So, in the end, we have the reorganization in the folders:
![58855](https://user-images.githubusercontent.com/8551443/202463807-c0902611-4d6e-493d-b72d-8d85d5009d55.jpg)

Note that we made few real changes to the files, the abundance of modified files is due to moving from one folder to another and also adding the global datapack to this repository (with an abundance of files). If you want to migrate your datapack to the global one, you should know what you're doing, if you don't know, just pass your modifications to the "new files" or get in touch on our discord group so we can help you: https://discord.gg/X3mSnMH8jg
2022-11-18 22:32:44 -03:00
Beats
526ef51758
Fix Event Scheduler (#239)
This works directly with: https://github.com/opentibiabr/otservbr-global/pull/471
2022-05-27 15:56:22 -03:00
Marcos
42af88d201
[Feature/Enhancement] - Prey system rework (CPP) + Hunting task system (#172)
Complete rewrite of old prey system from LUA to CPP and implementation of Hunting Tasks system.

Do not test with GOD char or with low amount of creatures registered on bestiary. The PR already include the necessary amount of then.

Addition of hunting task system and entire rework of prey system. All working on CPP with few LUA integration.
2022-04-24 13:36:35 -03:00
Beats
35a175ebc2
[Improvement] - rework on exercise weapons system (#180)
Rework on exercise weapon with tibia global equal behavior

Added config key "maxAllowedOnADummy ", default is "1"
Created table for exercise functions and variables

Start training with someone already training on that dummy and the message will be sent that someone is already training.
If someone is training and connects to the game, that user appears as Exercise Dummy Training .
If someone is training, send request to add this player on vip list, that user appears as Exercise Dummy Training.
When are training and disconnect from the game, on reconnect, the training stopped.cise Dummy Training
When are training and disconnect from the game, on reconnect, the training stopped
2022-01-08 00:08:08 -03:00
Eduardo Dantas
9c12c42c07
Added "if" check to verify if tables are null on reload talkaction (#168)
When reloading, the tables were cleaned, causing some server behavior to bug.
2021-12-01 21:18:33 -03:00
Beats
304efb8ec9
Decouple "ParseItem Attributes" in it own file (#140)
ItemParse has been refactored and decoupled in a own file to allow for better organization and avoid breakage in the compilation
Fixed some bugs, such as fields in items.xml
This commit is necessary for the pull request (12.72 protocol) to work correctly: #143

Co-authored-by @dudantas <eduardo.dantas@hotmail.com.br>
2021-11-23 16:30:45 -03:00
Beats
36f2af9696
[Feature] Save server by interval time (#13)
Added a feature that can be activated in config.lua, so you can save the server from time to time according to the interval you choose automatically.

Set to "true" for enable feature and "false" for disable
Save interval time is configured in hours, in the example below we will have a save every 1 hour

-- Save interval per time
-- NOTE: togleSaveInterval: true = enable the save interval, false = disable the save interval
-- NOTE: saveIntervalType: "minute", "second" or "hour"
-- NOTE: togleSaveIntervalCleanMap: true = enable the clean map, false = disable the clean map
-- NOTE: saveIntervalTime: time based on what was set in "saveIntervalType"

togleSaveInterval = true
saveIntervalType = "hour"
togleSaveIntervalCleanMap = true
saveIntervalTime = 1
2021-10-28 21:07:25 -03:00
Beats
a58f3ce026
Gain stamina from training and pz (#10)
These changes allow to win stamina in Protection Zone and Trainers.
To work, need to be changed in the "staminaTrainer = false" to "staminaTrainer = true", for gain stamina in the trainer and set from "staminaPz = false" to "staminaPz = true", for gain stamina in the protection zone.
2021-08-31 21:12:27 -03:00
pirate
a30eaf1edc
Rope id fix (#6)
* Provide correct item ids for rope spots

* Remove unused RopeSpots table
2021-08-24 06:57:26 -03:00
Eduardo Dantas
ab794ba9f5
Small cleaning in the datapack, rearranging the core folder and removing the compat folder (#9)
* Remove monster spells and folder data/spells

* Remove unused files, reorganize core folder and remove compat folder
2021-04-29 15:48:34 -03:00
Eduardo Dantas
e7acbce5a2
Removed unnecessary files and converted to client id (#1)
Removed several files and other unnecessary things
Converts ids to client id
2021-04-27 18:37:05 -03:00
dudantas
da96e1fe14 Initial commit 2021-04-26 21:04:01 -03:00