Skip to content

Conversation

un000000
Copy link
Collaborator

No description provided.

kaleohanopahala and others added 30 commits October 30, 2024 23:13
Crash fix introduced in opentibiabr#2913 

This crash occurs when the iterator attempts to access a container that
was modified during the creature removal process, while
spawnedMonsterMap and/or erase_if is being executed.
…iabr#2900)

This updates the augments to be able to handle the substitution of
the Increase Damage, Strong Impact and Powerful Impact into Base Damage
and Base Healing. It also adds the new item description to handle the
new Amber Items with elemental attack greater than 0 and physical attack
value equal 0.
…iabr#3036)

Removed unused variable and added pointer to const ref.
Added a function to Database::getNumber to call enums directly, making maintainability easier.
…3041)

This PR introduces a comprehensive CONTRIBUTING.md file to guide new and
existing contributors to the Canary project. The document includes
sections covering our Code of Conduct, development standards, issue and
pull request guidelines, and usage of the KV System for data
persistence. It also sets expectations for code formatting, quality, and
contribution best practices, helping ensure that contributions align
with project standards and goals.
…br#3031)

This refactors the `Container::create` function and rename to
`createBrowseField` for improved readability and maintainability. The
refactor includes using `continue` to skip iterations early when items
do not meet specific conditions, reducing nesting and making the code
clearer. Additionally, it resolves a critical issue where two different
`container` variables were confused within the same loop, which could
lead to bugs.

These changes ensure the function is cleaner and less prone to errors,
making the logic behind item addition more transparent.
When using mystery box after getting from the NPC (which is only
possible after defeating final boss of cults of tibia), not is happening.
Fixed some issues caused by git conflicts.
…iabr#3055)

Simplified the town assignment logic when loading player data:
- If the town ID associated with the player is invalid, the system will
first attempt to assign the town "Thais". If "Thais" is unavailable, the
player is assigned the first valid town from the list.
- This change reduces the chain of conditional checks, making the logic
more readable and efficient, while ensuring a player is assigned to a
valid town whenever possible.

Fix for Escaping Strings in PlayerBadge:
- Added proper string escaping using `g_database().escapeString()` in
`PlayerBadge::getPlayersInfoByAccount()` to prevent SQL syntax errors
when player names contain special characters.
- This fix addresses issues with malformed queries that previously
resulted in SQL syntax errors.
Fix opentibiabr#3047 

Now min light level is always 1, prevent division by zero.
…2905)

Optimized the experience gain and loss calculations in the
`onGainExperience` and `onLoseExperience` functions, adjusting the
application of bonuses like stamina, VIP, and boosted creatures. This
ensures more efficient performance and more accurate handling of player
experience management.
This fixes the icons from the character item imbuements inspection cyclopedia.
safeCall basically keeps calls safe when they are being executed
asynchronously, that is, if the calls inside safeCall are being executed
in a thread other than the dispatcher, they will simply be sent to that
thread, thus avoiding concurrency.

What I just wrote is already being done with tryAddEvent, but it is not
a very intuitive name, and it is visually polluted. In the safeCall
method, besides being short, you can simply send 'this' as a parameter
to the lambda, without having to fear that its execution will be done
when the reference no longer exists, because inside safeCall, there is a
reference check, if it has already been destroyed, it will simply not be
executed.
Added check if creature was removed.
Apparently the creature can be destroyed while it is running in
checkCreatures, so let's increase the counter to ensure it still exists.

Note: It's had a rare crash while doing some testing.
Removed Lua callbacks from `MonsterType` of various monsters. These
callbacks were empty, which meant the functions were still being
"called" by the monsters without performing any action, creating a
significant performance bottleneck.

Removed the `onHear` event callback, which had a significant impact on
the server and was not used anywhere. It executed the `onHear` callback
for each spectator, causing an unnecessary overload without any real
benefit, especially as we have other methods to check for these events.

Additionally, the `monsterOnSpawn` event callback was removed and
replaced with `MonsterType::onSpawn`, which is much more efficient since
it only needs to be declared in the script for each monster that
actually uses it.

Finally, the way `setRewardBoss` was handled was improved. Previously,
it was executed in an `onSpawn` event callback, but now it is done
directly during the parsing of each monster script, marking them as
reward bosses at the time of script loading, improving efficiency.
This ensures the integrity of the name during searches. If a name is
added with a different capitalization than the monster's actual name, it
can lead to conflicts, preventing the onDeath code from executing
properly.
Fixing the PR opentibiabr#2938 levers and related parts. Since the original code
was quite extensive, perhaps some mechanics that should have been done
when pulling the lever were removed.
fixed the cobras console error, the problem was being caused because of
the object name handleCobraOnSpawn
This fixes the high speed bug that overflow the uint16_t because the
lack of checks and also fixes the conditions mysql issue when saving
conditions greater than 64KB.


Fixes opentibiabr#2712 
Fixes opentibiabr#2456
Missing lookFeet.
Default colours.
Fix typos.
Improves the spectators to find monsters and npcs, adds excludeMaster
and excludePlayerMaster to filter monsters without masters. Added
vectors to cache the monsters and npcs in spectators and map sectors as
well.
Fixes the houses mailbox that were not sending parcels and consuming
them.

Fixes opentibiabr#2891
…pentibiabr#3046)

Fixed circular dependencies
Removed various unnecessary inheritance from lua interface
Removed legacy unused codes
dudantas and others added 28 commits March 13, 2025 19:21
…ibiabr#3421)

Optimized `onUpdateContainerItem` and `onRemoveContainerItem` to avoid
iterating over spectators when the container has a holding player. If a
holding player is present, updates are sent directly to them, preventing
unnecessary performance overhead. This change reduces unnecessary
iterations and improves efficiency when handling item updates inside
player containers.
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 <[email protected]>
…abr#3435)

Refactored getUserdataShared<T> to validate userdata before
dereferencing, preventing crashes caused by invalid or outdated Lua
bindings. This fix ensures that instead of a crash, an error message is
logged in the console.

Applied this change across multiple occurrences, potentially fixing
other crashes beyond the openImbuementWindow function. Also included a
regex pattern to help others update their codebase easily.

Regular expression:
(?:Lua::)?getUserdataShared<\s*(?:const\s+)?([\w\d_]+)\s*>\(\s*([\w\d_]+)\s*,\s*([\w\d_]+)\s*\)

Replace:
Lua::getUserdataShared<$1>($2, $3, "$1")

Fixes opentibiabr#3418
…pentibiabr#3436)

This update includes several fixes and improvements to item management
in the game, ensuring a more intuitive and consistent experience.

- Item swaps via hotkey should respect the container settings in Manage
Containers.
- Guests in houses should be able to use potions via hotkey.
- Equipping an item from the Loot Pouch should correctly place the
swapped item in the designated container.
Refactored Player interfaces to use scoped objects instead of unique_ptr

• Replaced std::unique_ptr with scoped objects for Player interfaces (Wheel, Achievement, Badge, Title, Cyclopedia, VIP, etc.).
• Improved performance by avoiding unnecessary allocations/deallocations (from unique ptr) when players log in and out.
• Simplified code by removing redundant make_unique calls.
• Centralized includes in player.hpp to streamline dependencies.
This fixes the excessive damage output from skill wheel such as enhanced
ethereal spear, the damage output still too high in comparison to real
tibia. (The high output is on all the spells boosted by skill wheel )

Resolves opentibiabr#3313
Disable spectators cache for async functions.
Resolves opentibiabr#3423

This sent update for the "stats skills" player when add/end.
…#3187)

This fixes an issue with the calculation of elemental weapon damage.
Previously, the damage calculation for elemental weapons duplicated the
damage instead of distributing it as 60% elemental and 40% physical.
This resulted in incorrect damage values and an overpowered effect for
certain weapons.

The corrected logic ensures that the total damage remains consistent,
splitting appropriately based on the elemental and physical proportions
while applying target resistances/weaknesses correctly.

Co-authored-by: valdzera <[email protected]>
Client modification: Feature improvements per mehah/otclient#962

• Added opcode 0x43 handler in ProtocolGame to process feature enablement from the server.
• Implemented a loop to read a count of features and enable each one when its flag is set.
• Supported features include: • Creature AE + Shader (compatible with both cipsoft and v8 clients)
• send disableFeature/enableFeature (making it easy to modify via config.lua)
• Outfit enhancements (wings, aura, shader)
• TypingIcon support
• Map shader support
• Item shader support
---------

Co-authored-by: Eduardo Dantas <[email protected]>
# Description

This PR introduces a fix and enhancement for the experience boost system
related to the Soul War quest. Specifically, it ensures that the taint
level of the player is correctly factored into the experience
calculation when defeating monsters listed in the
SoulWarQuest.bagYouDesireMonsters.

## Behaviour
### **Actual**
The taint level boost was not applied correctly in some cases.
Experience calculation did not account for edge cases where the taint
level or boost map might be undefined.

### **Expected**

The taint level boost is applied consistently and correctly.
Experience calculation handles edge cases gracefully.

## Type of change

  - [x] New feature (non-breaking change which adds functionality)

## How Has This Been Tested

- [x] Hunt any SoulWar monster and see the EXP increasing with different
taint levels.

## Checklist

  - [x] My code follows the style guidelines of this project
  - [x] I have performed a self-review of my own code
  - [x] I checked the PR checks reports
- [x] I have commented my code, particularly in hard-to-understand areas
  - [x] I have made corresponding changes to the documentation
  - [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
@un000000 un000000 merged commit f9ad44c into dev Apr 23, 2025
21 of 35 checks passed
@un000000 un000000 deleted the opentibiabr-main branch April 23, 2025 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.