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.
Bug Fixes:
- Fixed monster name change updates so clients reliably refresh the displayed monster for all visible spectators.
- Improved /setmonstername behavior with stricter name parsing/validation, accurate counting of renamed monsters, and clearer player feedback (including cases where no monsters are found or all already match).
Optimize monster hot paths and deferred gameplay scheduling
This commit implements the next slice of the performance and lifetime roadmap for the Canary creature and monster hot paths.
The focus is to reduce dispatcher pressure, async task fanout, spectator churn, pathfinding churn, and target list lifetime risk under monster-heavy workloads while keeping player visible gameplay behavior intact.
The change keeps combat and condition handling on the serial dispatcher path, but moves delayed monster post think work into a budgeted DeferredGameplay lane. This allows monster follow-up work to make progress without competing directly with the most sensitive gameplay operations on the main dispatcher.
Creature async work is now sliced through bounded buckets. This limits how much async creature work can be emitted at once and helps avoid large bursts of scheduled tasks. The deferred async flag clearing behavior is preserved, so creatures are not incorrectly considered ready for another async pass before the deferred work has actually completed.
Monster movement AI refreshes are now coalesced. Instead of scheduling repeated movement refreshes for the same monster in a burst, the system can merge pending refresh intents and execute them more controllably. This reduces redundant dispatcher work and helps monster-heavy scenarios avoid excessive task fanout.
Target lifetime handling was also improved. Monster target tracking now keeps player count bookkeeping balanced even when weak target references expire. This reduces the risk of monsters staying active because an expired player target was removed from the target list without updating the related active player count.
Pathfinding and tile lookup hot paths now reuse scoped floor cursors. This avoids repeated cursor setup work during repeated spectator and pathfinding operations while keeping the safe lifetime boundaries documented. The reuse is scoped so temporary lookup state does not escape beyond the valid operation window.
Benchmark-only monster stress options were added to make heavy monster workloads easier to test. These settings are intended for profiling and stress validation only, not normal production gameplay. A startup warning appears when stress settings are enabled, so operators do not accidentally run production servers with benchmark behavior active.
The change also preserves current client protocol compatibility details unrelated to the monster performance work, but necessary to keep behavior stable. The current 15 13 screenshot event payload encoding and level percent protocol gates remain preserved.
Main changes included in this commit
• Adds benchmark-only monster stress configuration flags
• Adds a startup warning when benchmark monster stress flags are enabled
• Allows stress scenarios such as keeping monsters active for benchmark purposes
• Allows monster versus monster target selection only through the benchmark stress configuration
• Slices creature async work through bounded buckets
• Preserves deferred async flag clearing behavior
• Routes delayed monster post think work through the budgeted DeferredGameplay lane
• Keeps combat and condition execution serial on the dispatcher
• Coalesces monster movement AI refreshes to reduce redundant scheduling
• Improves monster target tracking and target list lifetime safety
• Keeps target player count bookkeeping balanced when weak target references expire
• Improves monster idle behavior under expired target cleanup cases
• Reuses scoped floor cursors for pathfinding and tile lookup hot paths
• Documents the safe lifetime boundaries for cursor reuse
• Reduces spectator and pathfinding churn in monster-heavy workloads
• Preserves the current 15 13 screenshot event payload encoding
• Preserves level percent protocol gates
• Fixes the special Starving Wolf trap interaction
• Adds dispatcher queue latency logging to help monitor responsiveness
• Documents performance and lifetime roadmap evidence
• Documents validation assumptions for production-like scenarios and stress test scenarios
Runtime behavior
Monster AI and creature scheduling should now produce less dispatcher pressure during dense monster activity. Delayed monster post-think work is handled through the deferred gameplay lane with a budget, rather than being allowed to fan out into unbounded dispatcher pressure.
Player visible gameplay contracts remain intact. Combat and conditions continue to run through the serial dispatcher path, so the change does not intentionally reorder sensitive gameplay effects.
Movement and auto-walk behavior should be more predictable under load because repeated monster movement AI refreshes can be coalesced rather than stacking redundant work. Monsters should still move and react, but the refresh work is scheduled with less unnecessary churn.
Target tracking is safer when targets disappear. If a player target expires through a weak reference cleanup path, the monster target side bookkeeping is also updated, so idle and active state decisions are not based on stale player counts.
Stress testing behavior
The new monster stress flags are benchmark-only controls. They make it easier to reproduce monster-heavy workloads for profiling and validation, but they are not intended as normal server behavior.
When these flags are enabled, the server emits a startup warning to make the configuration's non-production nature clear.
Validation performed
• Static validation with git diff check HEAD 5 HEAD
• Reviewed production-like behavior assumptions for dispatcher and monster scheduling
• Reviewed stress test behavior assumptions for monster heavy workloads
• Follow up commits addressed validated comments around target count cleanup
• Follow-up commits addressed trap handling comments
• Follow-up commits addressed async scheduling comments
• Follow up commits addressed documentation comments
Overall, this commit improves the performance and lifetime safety of the Canary monster and creature hot paths. It reduces unnecessary async fanout dispatcher pressure, movement refresh churn, and pathfinding lookup overhead while preserving the serial gameplay contracts that matter for players.
Update current client protocol compatibility to 15.25 byte contract
This commit updates the current client runtime profile to match the Tibia 15.25 byte contract and keeps the changes behind explicit runtime protocol feature flags.
The goal is to make the current client able to log in and keep running without message boundary debug errors while preserving the existing multiprotocol structure. This is a compatibility update focused on sending and consuming the bytes expected by the current client. It does not implement the full gameplay systems behind the new official windows dialogs rewards shops progression or balance features.
The current profile now enables versioned payload flags for the confirmed 15.25 differences. These flags gate the new packet shapes so the modern client can receive the expected payloads while older profiles do not automatically inherit incompatible message layouts.
The update also adds minimal byte compatible shims for new current client module windows and side dialogs. Taskboard and Soul Seals now have official client packet shims that respond with structurally valid empty windows where the gameplay system is not fully implemented yet. This keeps the client protocol stable without pretending that the complete feature set exists server side.
Several current client payloads were aligned with the 15.25 format. This includes resource balances graphical effects vocation specific data skill wheel weapon proficiency game events quest related payloads store summary parsing and related request parsers.
Main changes included in this commit
• Updates the current client runtime profile to the 15.25 byte contract
• Adds runtime feature flags for confirmed current client payload differences
• Gates 15.25 specific packet layouts behind explicit ProtocolFeature flags
• Adds support for official skill wheel payload differences
• Adds support for official weapon proficiency payload differences
• Adds support for graphical effect source byte differences
• Adds support for official vocation specific player data
• Adds support for official Taskboard packet family handling
• Adds support for official Soul Seals packet family handling
• Adds minimal byte compatible Taskboard shims for the current client
• Adds minimal byte compatible Soul Seals shims for the current client
• Adds explicit parsers for several previously unhandled current client opcodes
• Aligns resource balance request parsing with the current client payload
• Aligns graphical effect payloads with the current client format
• Aligns vocation specific data payloads with the current client format
• Aligns skill wheel payloads including quest bonus and gem list layout
• Aligns weapon proficiency payloads including detail list support
• Aligns game event payloads and related request handling
• Expands GameStore parsing for offer descriptions and events
• Adds stricter packet parsing and trailing byte handling where needed
• Improves protocol aware login logging with richer asset signature details
• Adds a god level protocol probe command for live protocol and message testing
• Documents the 15.25 compatibility scope and versioned payload flags
Protocol profile changes
The current profile mask now includes the new protocol feature flags required by the 15.25 byte contract. These flags allow the server to describe exactly which current client payloads are active instead of tying every behavior only to a raw client version number.
This keeps the compatibility layer safer for multiprotocol support because older profiles can continue using their own packet shapes while the current profile enables the official 15.25 payload differences.
Module shim changes
Taskboard support was added as a minimal official client shim. The server consumes the expected current client packet shape and returns structurally valid empty Taskboard windows. This keeps the client UI protocol satisfied while leaving the full Taskboard gameplay implementation for future work.
Soul Seals support was also added as a minimal official client shim. The server reads the expected request data validates the packet shape and responds with a structurally valid empty placeholder response. This prevents message boundary issues for the current client without implementing the complete Soul Seals system yet.
Payload compatibility changes
The current client expects several packet layouts that differ from older protocol profiles. This commit updates the server to match those confirmed layouts for the active current profile.
The affected areas include skill wheel payloads weapon proficiency details vocation specific player data resource balance requests graphical effects game events store parsing quest related payloads and related packet parsers.
These changes are focused on byte compatibility. They make the packet boundaries and payload shapes stable so the current client can operate without protocol debug breaks.
Bug fixes and robustness improvements
This commit also includes several protocol adjacent fixes found during the compatibility work. Packet parsing was made stricter in selected paths. Quest tracker validation and logging were updated. Store parser state handling was improved by avoiding shared global mutation for the default entries per page value.
The update also fixes precision and argument handling issues in related current client payload paths including level percent casting and forge skill stat argument placement.
Protocol probe tooling
A god only protocol probe command was added for live protocol testing. This gives maintainers a way to test selected protocol and message flows in game while keeping the command restricted to god group access.
The probe tool includes built in probes and file driven local probes, making it useful for reproducing current client packet behavior without exposing the tool to normal players.
Documentation changes
The systems documentation was updated with the 15.25 compatibility scope and multiprotocol feature notes. The documentation explains that this PR is a byte compatibility update and not a full gameplay implementation for every new current client window or system.
It also documents the versioned payload flags so future protocol updates can continue using explicit feature gated packet differences instead of mixing incompatible layouts into shared paths.
Validation performed
• Tested current client login locally
• Tested key current client UI surfaces locally while fixing reported client debug cases
• Confirmed fixes for skill wheel payload boundaries
• Confirmed fixes for character stats payload boundaries
• Confirmed fixes for store summary payload boundaries
• Confirmed fixes for defense stats payload boundaries
• Confirmed fixes for game event payload boundaries
• Confirmed fixes for graphical effect payload boundaries
• Confirmed fixes for related current client request parsers
• Full compile and build validation was not run
Known scope limitation
This commit intentionally does not implement the full gameplay systems behind the new current client windows dialogs rewards shops progression systems or balance features.
The purpose is to stabilize the message shape first. Full gameplay behavior can be implemented later on top of the now compatible packet structure.
Overall this commit brings the current client protocol path in line with the Tibia 15.25 byte contract. It adds explicit feature gated compatibility for confirmed payload differences introduces minimal shims for new official client windows improves parser coverage and documents the compatibility boundary while preserving the existing multiprotocol architecture.
Add runtime multiprotocol support to Canary
This commit adds runtime multiprotocol support to Canary without changing the compiled CLIENT VERSION target and without requiring separate ports for each supported client version.
The server can now resolve and apply protocol behavior at runtime through explicit protocol profiles. This allows modern clients legacy old protocol clients and extended legacy client variants to be supported through the same server entry point while keeping each protocol family isolated behind its own transport login and asset compatibility rules.
The implementation separates the protocol stack into smaller contracts instead of relying on one shared hardcoded flow. Transport behavior connection startup behavior profile metadata login parsing and session hints are now handled by dedicated components. This makes the multiprotocol path easier to reason about and safer to extend when adding more client families later.
Transport handling is now described through TransportCodec and TransportProfile. These components define TCP framing checksum behavior XTEA payload layout and compression behavior for each protocol family. Legacy clients no longer inherit the modern post 14 05 framing rules by accident and can use their own packet layout where required.
The first game socket decision is now handled through InitialConnectionBehavior. This controls the expected transport the handshake flow the challenge layout and the profile expected for the connection. This is important because old protocol clients and modern clients do not share the same login handshake assumptions.
ProtocolProfile now describes the client version wire family RSA family feature flags item mapper policy and asset signatures for each supported profile. This gives the server an explicit model for the client family being served instead of relying only on the compiled CLIENT VERSION or manual server side assumptions.
The login flow was also split into separate account login and game login layouts. This avoids forcing old protocol and modern webservice flows to share fragile hardcoded parsing logic. Each login family can now use the layout expected by that protocol path.
ProtocolSessionHintStore was added so the account login flow can hint the later game connection automatically. This avoids requiring administrators to manually choose a profile or run separate ports for different supported client versions. When a safe hint exists the game connection can reuse it to select the correct protocol behavior.
Supported profiles covered by this commit
• Current modern Canary client profile
• Tibia 11 00 old protocol profile
• CipSoft 8 60 compatible profiles
• Canary extended 8 60 asset profile
The current modern Canary profile remains the default when no safe legacy hint exists. Policy can block a detected profile but policy does not choose legacy framing by itself. This keeps profile selection explicit and prevents configuration policy from silently forcing the wrong transport behavior.
For the extended 8 60 client path the server resolves the profile from protocol version and asset signatures instead of requiring a separate port or manual profile selection. This allows a single runtime server path to distinguish between compatible legacy variants when the client package and assets provide enough information.
The related client packages are available in the latest dudantas tibia client release 15 11 c9d1cf. Prepared clients support the matching extended dat and spr workflow as well as config ini based local profile configuration.
The intended outdated client asset workflow is also documented. Compatible dat and spr files can be exported from a modern asset source using the Assets Editor changes. Original CipSoft clients can be extended or edited using the Tibia Extended Client Library workflow. This allows the project to keep a single asset source of truth and export compatible packages for the extended 8 60 and 11 00 client paths.
Main changes included in this commit
• Adds runtime multiprotocol profile support
• Keeps the compiled CLIENT VERSION target unchanged
• Avoids separate ports per client version
• Adds TransportCodec and TransportProfile for framing checksum XTEA payload layout and compression behavior
• Adds InitialConnectionBehavior for game socket startup handshake challenge layout and expected profile selection
• Adds ProtocolProfile for client version wire family RSA family feature flags item mapper policy and asset signatures
• Splits account login and game login parsing into separate protocol aware layouts
• Adds ProtocolSessionHintStore so login can hint the game connection automatically
• Keeps the modern Canary profile as the default fallback
• Supports Tibia 11 00 through the old protocol path
• Supports CipSoft 8 60 compatible profiles
• Supports the Canary extended 8 60 asset profile
• Resolves the extended 8 60 profile from protocol version and asset signatures
• Keeps legacy clients on their own framing challenge and payload layouts
• Prevents policy configuration from silently choosing legacy framing by itself
• Enables legacy protocol support by default in the distributed config
• Improves protocol aware login logging with richer asset signature details when available
• Adds documentation for adding and maintaining runtime protocol profiles
• Links the multiprotocol documentation from the systems overview
• Expands build policy guidance so build entry points stay in sync
Validation covered by this commit
• Extended 8 60 client can log in and play with exported extended assets
• Tibia 11 00 old protocol client can log in through the old protocol path
• Modern 15 x client remains supported
• Local Windows release build completed with the Canary target
• Unit tests were added for protocol and profile resolution
• Unit tests were added for transport sizing and header behavior
• Unit tests were added for protocol session hint flows
Overall this commit introduces a runtime multiprotocol architecture for Canary while keeping the existing modern client path as the default. It adds explicit protocol profiles dedicated transport and login contracts automatic session hinting and documentation so multiple client families can be supported safely through one server runtime without changing the compiled client target or splitting traffic across separate ports.
This commit standardizes NPC configuration across multiple Lua files by adding explicit profession and speechBubble properties to each affected NPC config.
The goal is to make each NPC role clear in the script itself and keep speech bubble behavior consistent between the server NPC configuration and the client presentation layer. NPCs now explicitly declare whether they are normal NPCs or trader NPCs, instead of relying on implicit or inconsistent defaults.
The profession value was added under npcConfig flags for all affected NPCs. Each NPC now uses either normal or trader depending on its expected role. This makes the NPC intent easier to read and helps avoid ambiguity when future scripts or client side behavior depend on the configured profession.
The speechBubble value was also added to each NPC config. Normal NPCs use SPEECHBUBBLE_NORMAL and trader NPCs use SPEECHBUBBLE_TRADE. This keeps the in game dialogue bubble aligned with the NPC role and improves consistency in how NPCs are displayed to players.
Main changes included in this commit
• Adds explicit profession configuration to affected NPC Lua files
• Uses normal for regular NPCs
• Uses trader for shop and trade related NPCs
• Adds explicit speechBubble configuration to affected NPC Lua files
• Uses SPEECHBUBBLE_NORMAL for normal NPC dialogue presentation
• Uses SPEECHBUBBLE_TRADE for trader NPC dialogue presentation
• Keeps NPC role information visible directly in each NPC config
• Reduces reliance on implicit default behavior
• Improves consistency between NPC server configuration and client side speech bubble rendering
• Aligns server NPC configs with the related client support added in tibia client PR 18
• Preserves existing NPC behavior while making the configuration more explicit
This is a configuration standardization change. It does not rework NPC logic or change the data access flow. The intended behavior remains the same, but the role and speech bubble metadata are now declared consistently so both server and client can interpret NPC presentation more reliably.
Add a config boolean to enable the retro spell learning system.
Main changes:
- Add retro spell learning support behind a configuration option.
- Update all spells to respect the new config.
- Update spell-related NPCs to handle the learning system according to TibiaWiki behavior.
- Update Dawnport NPCs for the retro spell learning flow.
- Update the Rookgaard Oracle to handle Monk vocation selection.
Validation:
- Debugged and tested on tibiatales.com using the Canary/TFS Crystal server distribution.
This allows servers to enable classic spell-learning behavior via config while keeping the existing spell behavior configurable.
Add a Test Server NPC designed for development and test environments, with a shop list that can be automatically updated from items.xml.
Main changes:
- Add a dedicated Test Server NPC.
- Populate the NPC shop from items.xml instead of relying only on a manually maintained item list.
- Provide visible inventory with buy and sell interactions.
- Keep the NPC useful for test servers where items, prices, and equipment lists change often.
Test server commands:
- Add promotion support.
- Add and remove coins.
- Grant money.
- Adjust skills.
- Change vocation.
- Change level and experience.
- Reset the character.
- Grant outfits with addons.
- Grant mounts.
- Apply missing blessings.
Shop validation:
- Update shop price warning logic to exclude the Test Server NPC.
- Avoid false warnings when this NPC exposes items with special test-server pricing.
- Adjust the cheaper-item warning check so test-server shop behavior does not affect normal shop validation.
This makes test server setup easier by providing one NPC for equipment testing, character setup, currency adjustments, cosmetics, mounts, blessings, and dynamic shop updates without affecting normal NPC price validation.
Works with: https://github.com/opentibiabr/login-server/pull/31 (467af8d72f)
Add the game server side of the livestream system, allowing players to broadcast gameplay to read-only viewers and exposing active casters for external login services.
Livestream system:
- Add LivestreamManager to manage caster sessions, viewers, passwords, bans, mutes, kicks, and livestream chat.
- Add player-facing livestream talkactions through data/scripts/talkactions/player/livestream_system.lua.
- Support commands such as !livestream on, !livestream off, !livestream password, !livestream ban, and !livestream status.
- Add read-only viewer login through the normal protocol bootstrap while preserving client 15 compatibility.
- Integrate livestream state into Player and ProtocolGame.
Viewer restrictions:
- Keep livestream viewers read-only.
- Block viewer input that would move, fight, use items, send gameplay actions, or mutate the caster state.
- Preserve the normal player flow for non-livestream sessions.
Configuration:
- Add livestream configuration options to config.lua.dist.
- Wire livestream settings into the config loader.
- Add startup/runtime integration needed by the game server.
Database:
- Add active_livestream_casters so external login services can list active casters.
- Add migration data-otservbr-global/migrations/58.lua.
- Update schema.sql.
- Bump the database version to 58.
Login contract:
- External login services must use the descriptor @livestream.
- The livestream session key format is:
@livestream
<password>
Client 15 integration:
- Document the login.php flow for @livestream.
- List active casters from active_livestream_casters.
- Return a character list built from active casters.
- Return a clear login error when no casters are active or livestream is disabled.
- Return the expected livestream session key format for viewer login.
Compatibility:
- Keeps normal login, protocol bootstrap, and player gameplay behavior unchanged outside livestream mode.
Add the WeaponProficiency component with persistent per-weapon
progression, perk selection, experience tracking, and combat bonus
handling.
Implement serialization and deserialization for proficiency data, perk
management, active augments, stat bonuses, critical damage modifiers,
bestiary/boss/powerful foe bonuses, skill/spell percentage bonuses, and
perfect shot handling.
Also add related client support, imbuement scroll/tool flows, new items,
mounts, outfits, achievements, NPC shop updates, scheduled-save
notifications, and loot table adjustments.
Thanks to @phacUFPE and @FelipePaluco for the development base.
Client PR: https://github.com/dudantas/tibia-client/pull/17
---------
Co-authored-by: Felipe <87909998+FelipePaluco@users.noreply.github.com>
Co-authored-by: Pedro Cruz <pedro.ha.cruz2022@gmail.com>
Co-authored-by: Eduardo Dantas<eduardo.dantas@hotmail.com.br>
Introduce centralized BatchUpdate handling for player-owned containers so bulk item mutations can suppress intermediate container refreshes and send one final update when the outermost batch finishes.
Batch affected containers across bulk add, remove, move, stack, stash retrieve, reward/managed loot collection, store inbox delivery, forge/wheel item consumption, paginated container insertion, NPC buy/sell, and loot pouch selling paths.
Also harden related transaction flows by validating purchase constraints before mutation, skipping invalid/protected sell items, and aborting custom currency failures before removing player items.
Add Lua batch helpers and automated coverage for batch lifecycle, deduplication, nested scopes, loot sale batching, and paginated container insertion.
Reward-bag drops are now controlled with per-item weights, allowing finer
difficulty tuning per reward entry while preserving legacy chance fields.
What changed:
- Implement weighted selection per item inside reward bags.
- Keep backward compatibility with legacy `chance` definitions and emit a
one-time warning when legacy format is used.
- Add admin test mode to simulate multiple openings from a single bag open,
with aggregated console output for drop distribution validation.
- Improve item delivery flow:
- try backpack first;
- fallback to store inbox when inventory cannot receive the reward;
- improve logs and player-facing messages for no-room/inbox delivery cases.
Why:
- Gives better control over real drop difficulty for each individual item.
- Enables fast balancing/verification of target rates through repeatable
simulations without manual open spam.
Bug Fixes:
• More reliable mount handling during outfit changes: randomized mounts
now resolve to no mount when invalid/unavailable and incompatible mounts
are cleared.
• Login outfit replacement now only applies for specific looks when the
player lacks group access.
• Outfit mount compatibility is pre-evaluated to ensure accurate
validation.
Tests:
• Added unit tests for randomized-mount resolution and
mount-compatibility checks.
Chores:
• Test target updated to include the new tests.
Fixes#3855.
When a player carries multiple exercise weapons of the same type, using
the second (or any non-first) weapon on a training dummy was draining
charges from the first weapon in the inventory instead of the one the
player actually clicked.
Bug Fixes
• Improved training weapon tracking during exercise events to ensure the
weapon remains valid and properly positioned throughout the training
session.
• Training will now correctly stop if the weapon is removed or moved
during active training.
feat(quests): refactor HoD teleports and add Augustin NPC
- Refactor Heart of Destruction teleport logic into a unified vortexTeleports structure
- Consolidate boss access, exits, cooldown checks, and teleport handling
- Add Augustin jeweler NPC with shop inventory, dialogue, and world spawn
- Improve Rotten Blood entrance checks and remove forced teleport-back on denial
- Adjust Candia teleport effects and behavior
- Standardize quest failure and access messages
- Increase special item transformation success rate from 10% to 50%
- Set phantasm_summon earth resistance to 100%
- Make yawno NPC stationary
- Apply minor quest, NPC, and configuration consistency fixes
New Features:
• Teleport command now cycles per-player through fiendish/influenced
forge monsters and creatures by name, with clear status messages.
Bug Fixes
• Forge population reliably clears, repopulates, and removes stale
entries each update.
• Fiendish and influenced creation respect configured limits and stop
early when full.
• Creation logic decoupled so influenced and fiendish counts update
independently and avoid improper gating.
New Features:
• Food effect duration tracking added — consumable foods now create
visible active food buffs with remaining time.
• Many consumables now grant timed food effects (commonly 1 hour; select
items extend up to 24 hours).
• Character summary now lists active foods and remaining durations for
easier management.
• Various dishes updated to set or refresh their food timers when
consumed.
New Features:
• Added MONK vocation: Players can now create characters of the new MONK
class with specialized starting equipment, including a jo staff, brass
armor set, boots, scarf, and a starter container filled with essentials
like a shield, rope, shovel, and health potions.
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.
Add a zone-based ambient and music sound system with day/night support
Introduces a Lua-driven ambient and music sound system with zone triggers
and day/night variants. Adds engine and Lua APIs for ambient/music effects,
new sound enums, player methods, and protocol support. Includes admin
commands to force periods and manually trigger sounds for testing.
Refactor event callback dispatch and Lua invocation
Simplify Lua callback execution by removing explicit function-pointer parameters from C++ callback invocations and centralizing dispatch through the callback manager, with short-circuit behavior. Update combat callbacks to use dispatchReturnValue and change creatureOnCombat to mutate CombatDamage instead of returning tuples. Fix callback registration to be stably sorted by descending priority, enforce duplicate blocking only when skipDuplicationCheck is false, and ignore disabled callbacks or invalid script IDs. Align EventCallback construction with current usage and clean up redundant includes. Update documentation and Lua scripts to match the new callback types and argument conventions, and add unit tests covering ordering duplication rules, short-circuiting, and the damage mutation roundtrip.
Add JSON JSON-based event scheduler system
Introduce a new JSON-driven event scheduler to manage in-game events more easily and flexibly. Add initial events.json data, documentation, and example scripts. Integrate event-driven effects into server gameplay logic, including login notifications, bestiary and bosstiary bonuses, forge success rate adjustments, and fast exercise handling. Ensure backward compatibility by supporting both XML and JSON schedules, with JSON loaded after scripts. Update the build configuration to require and link the nlohmann_json library, and include scheduler access in the player logic.
This update introduces several enhancements to the loot system, allowing
for more flexible loot management across different monsters without the
need to modify each monster's individual script. A global loot option
has been added, which is disabled by default, to assign items that any
monster can drop. This feature simplifies the addition of common loot
across multiple monsters, enhancing the modularity of loot management.
The "registerLoot" function has been improved to eliminate code
duplication and enhance efficiency. The "closeContainer" function has
been updated to remove problematic code that could cause crashes when
"container" used before "erase". Additionally, a new Lua function,
"getMonsterTypeByName", has been introduced to facilitate getting
monster types.
These changes make a small but significant fix to the familiar system
on player login. It ensures that the remaining familiar summon time is
never negative by clamping the value to zero. This prevents potential
issues if the stored summon time is in the past.
- Clamp `familiarTimeLeft` to zero to prevent negative values by using
`math.max(0, familiarSummonTime - os.time())` in
`familiarOnLogin.onLogin`
(`data/scripts/creaturescripts/familiar/on_login.lua`).
Resolves#3710
Ensure the database state is initialized to avoid RAID check exceptions.
Otherwise, errors like the following can occur:
[2025-31-08 09:34:43.520] [thread 140345198] [error] Lua Script Error Detected
---------------------------------------
Interface: Scripts Interface
Script ID: data/scripts/globalevents/raids.lua:callback
Error Description: data/libs/systems/raids.lua:87: attempt to perform arithmetic on local 'checksToday' (a nil value)
stack traceback:
[C]: in function '__add'
data/libs/systems/raids.lua:87: in function 'canStart'
data/libs/systems/raids.lua:51: in function 'tryStart'
data/scripts/globalevents/raids.lua:11: in function <data/scripts/globalevents/raids.lua:5>
---------------------------------------
The Player has previously managed the storage system through a raw
storageMap, with direct insertions, deletions, and range generation
(genReservedStorageRange). This change caused unnecessary complete
rewrites on save and spreads logic across Player, IOLoginData, and
related components.
Changes
- Introduced a new PlayerStorage component to encapsulate all
storage-related logic
- Removed the legacy storageMap from Player, centralizing load/save and
manipulation in the new component
- Implemented incremental persistence: only modified or removed keys are
saved to the database, avoiding complete rewrites
- Added support for reserved key ranges (outfits, familiars) within
PlayerStorage::getReservedRange
- Updated IOLoginDataLoad and IOLoginDataSave to delegate load/save to
PlayerStorage
- Added missing benchmark.cpp implementation and updated build files
accordingly
- Removed storage name in favor of KV.
This change refactor improves code organization, maintainability, and
performance. By persisting only modified keys instead of the full
storage set, save operations are faster and reduce unnecessary database
load.
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
This way the killer list will show who gave the final hit, who did the
most damage and all other participants, whether monsters or players.
PR Complement: https://github.com/opentibiabr/myaac/pull/134
This new command is to add an icon to the player, it also has a counter
function to use the command, follow the examples:
/playericon 1, 10 -- this way it will apply icon 1 with the counter at
10 and it will decrease every second after reaching 0, it will be
removed after 10 seconds.
/playericon 1, 10, up -- this way the counter will start at 0 and will
go up to 10 after 10 seconds, it will remove the icon.
This change fixes an issue in the `Combat::applyExtensions` function
where the "Low Blow" charm critical hit was incorrectly triggering the
global critical hit as well, resulting in unexpected behavior. The bug
was caused by the independent calculation of `lowBlowChance` using
`charm->percent` alone, which led to a downstream misinterpretation of
critical hits. The fix adjusts the "Low Blow" chance calculation to
`baseChance + charm->percent`, aligning it with the Tibia Global
mechanics where "Low Blow" acts as an extension of the base critical
chance, only triggering when the global critical does not occur.
Additionally, this PR adapts `applyExtensions` to handle multiple
targets instead of a single target, improving compatibility with
area-based combat effects.
Co-authored-by: valdzera <146901121+valdzera@users.noreply.github.com>
• Dummy Movement Restriction:
Before: The dummy could be moved or rotated without strict ownership
verification.
Now: Only the house owner is allowed to move or rotate the dummy.
Additionally, the system checks if someone is training on the dummy
before allowing the action. This prevents unauthorized modifications and
ensures that the dummy is only used as intended.
• Enhanced Account-Level Checks:
New Feature: A "buy house" talk action has been added specifically for
god-level accounts.
Improvement: The system now verifies the player's account type when
processing talk actions. This means that if a talk action requires a
certain account privilege (for example, only GM-level or lower actions),
the system will enforce that check. In short, even if a character
appears eligible based on their group, the underlying account type must
also have the necessary permissions.
This fixes multiple issues regarding house door list handling and
door usage via the "aleta grav" spell. The changes ensure that:
• The "House Door List" spell now works correctly when the player is
both in front of and inside the door.
• Both door lists are properly loaded from the database, and cached
entries are cleared once applied.
• The door usage check now validates that the player's current tile
belongs to the same house as the door, preventing usage when the player
is outside the house.