Commit graph

171 commits

Author SHA1 Message Date
Ramon Bernardo
133f91ea16
refactor(player): rework onCreatureAppear to handle initial player world entry packets (#5030)
* refactor(creature): move onCreatureAppear logic to derived classes

* fix(creature): remove unused creature param

* fix(monster): move luacall after update last position

* refactor(protocol): remote duplicated packet, move logni logic to Player::CreatureAppear

* fix(player): missing return after kick

* fx(player): move login lua call only login session

* fix(player): add self-send light method and change comments

* fix(player): code style format
2025-11-29 01:40:51 +01:00
Nathan Heinz
b94b302277
fix(creature): slow reaction speeds (#4948) 2025-11-22 19:23:44 +01:00
Sarah Wesker
3a654a1b26
fix(creature): remove releaseFollowers call from destructor (#5012)
Prevent potential issues with follower management during object destruction, as the release should be handled elsewhere in the lifecycle.
2025-11-11 19:32:11 +01:00
Leilani A.
d50807e4aa
fix onTickCondition missing nullcheck (#5000) 2025-10-05 20:33:11 +02:00
Nathan
30da1554b4
Add Followers Reference Counter (#4968)
Changes Proposed Add reference counter to followers.

Issues addressed: #4961
2025-10-05 19:06:18 +02:00
Nathan Heinz
c5ff87263d
Fix summon keepDistance (#4950)
Don't use clearSight if we need to keep our distance.
2025-07-04 21:26:55 +02:00
Nathan Heinz
8fe2872ca0
Optimize pathfinding (#4637)
* Optimize pathfinding

* Minor fleeing monsters fix

* Fix whitespace and else brackets

* More cleanup

* Cleanup

* Remove uneeded variable name change

* Cleanup

* Move neighbor arrays back to map.cpp to fix unused variable failure

* Fix some compiling warnings

* Fix incorrect method call in game.cpp

* Update to new creature isDead method

* Update to clang format

* Update to clang format

* Fix maxSearchDist=0 searches and delayed reaction to onFollowCreature

* Fix fleeing monster randomly turning

* Reduce memory consumption and update pathmatching algorithm

* Clang formatting

* Clang formatting

* Remove uneeded check on new nodes

* Normalize pathfinding algorithm

* Final Changes: Move pathfinding call to onWalk

* Remove incorrect code

* Move from Euclidean to standard A*

* Fix overlooked typos and uneeded logic

* Remove uneeded nullptr check and change iterations to int8_t

* Revert int8_t

* Fix creature label error and update algorithm

* Remove uneeded resizing

* Revert comment

* Add missing pathmatching call

* Allow force update path to be called more often

* Fix sight blocked monsters path updating

* Additional blocked sight fix

* Allow paths to be drawn a little farther like rl tibia

* Add delay to pathfinding and optimize code

* Fix incorrect conditional

* Move path delay to force update path

* Change uint64_t to int64_t

* Add pathfinding interval and delay to config.lua

* Add viewport check

* Fix memory leak

* Add memory management to follow list and pathmatching

* Replace std::sqrt for std::hypot

* Update to new constexpr position methods

* Revert int declarations in pathmatching

* Change std::hypot for much faster std::sqrtf

* Formatting

* Add math.h

* Revert sqrtf and math.h

* Remove uneeded path call and add speed check

* Fix rainsalt review

* Update configmanager

* Update configmanager

* Fix configmanager after merge

* Update to configermanager namespace methods

* Clang format

* Use getX()/getY() and remove calculateHueristic from AStarNodes

* Replace AStarNodes:calculateHeuristic

* Add a couple code optimizations

* Move logic for better performance

* Replace std::list for vector and modify datatypes

* Replace push_back for emplace_back and revert calculateHeuristic

* Replace followedByCreature for followers and update std::array

* Change addFollowedByCreature to addFollower

* Update method calls

* Add additional checks for redundant pathfinding calls

* Remove redundant check

* Clang Format

* Change updateFollowingCreaturePaths to updateFollowersPaths

* Fix a problem in most recent path conditional

* Fix bug in pre path conditional check

* Fix logic in last commit

* Add required nullptr check to stop crashes on creature death

* Revert crash unrelated

* Add updateCreaturesPath

* Convert calculate heuristic to int

* Convert to new code style

* Fix memory leak in followers

* Additional nodes clear for possible memory leak

* Fix logic for when to remove follower

* Dynamically allocated nodes MUST be deleted.

* Remove nodes.clear()

* Revert

* Fix pathfinding delays.

* Remove delay check in map.cpp and add in correct places.

* Fix typo

* Check for duplicate creatures, add optimization, and remove uneeded

* Modify config values for best performance while maintaining proper following behavior

* Fix datatype typo

* Optimize removeFollower code && update datatypes.

* Update CMake_Lists

* Revert static const

* Modify removefollower O(n2) to O(n)

* Code cleanup, Comments, remove uneeded code
2025-05-11 17:51:45 +02:00
jromap7
1dc14e04d0
Fix issue in creature.cpp adding skull to master on summon AoE attacks (#4889) 2025-03-25 21:05:59 +01:00
Ramon Bernardo
173ab186e0
Improved approach to reasoning about the attacked and followed Creature (#4824) 2024-11-16 21:18:53 -03:00
Ramon Bernardo
d290cf5663
Refactor events: Extracted into tfs::events namespace (#4831) 2024-11-16 21:18:10 -03:00
Ramon Bernardo
88179e4690
Refactoring goToFollowCreature into Npc, Player and Monster (#4811)
* Make the logic of goToFollowCreature more readable: move to inher class

* Rename updateWalkPathToFollowCreature

* Fix summon check
2024-11-08 00:56:40 +01:00
Ramon Bernardo
b5480768e0
Remove creature map cache (#4825) 2024-11-07 19:33:27 -03:00
Marcin Jałocha
73c538d516
Revert "Obtain the master of summons on death (#4551)" (#4803)
This reverts commit a0c02384a1.
2024-10-08 20:07:48 +02:00
diath
3d7c2fe2c7
Fix use-after-free in creature conditions (#4726) 2024-06-04 18:43:57 +02:00
Sarah Wesker
a8afbd439b
Fix inverted positions introduced in #4648 (#4674) 2024-05-07 08:16:03 -06:00
Ranieri Althoff
73032fa7d4
Move config manager singleton to namespace (#4653) 2024-04-27 00:48:25 -03:00
Sarah Wesker
aa7e1fac0e
Creature/Monster Icons (#4493)
* Creature/Monster Icons

Co-Authored-By: KrecikOnDexin <krecikondexin@gmail.com>
Co-Authored-By: Zbizu <Zbizu@users.noreply.github.com>

* remove unused enums

* consistency with constants

* small fix

---------

Co-authored-by: KrecikOnDexin <krecikondexin@gmail.com>
Co-authored-by: Zbizu <Zbizu@users.noreply.github.com>
2024-04-17 14:37:48 -06:00
Ranieri Althoff
45dc6f9c48
Rewrite Position methods in constexpr (#4648)
* Rewrite Position methods in constexpr

- Refactor static functions to member functions
- Drop unnecessary fast integer variants
- Remove redundant template parameter to std::max/min

* Add constexpr abs to workaround MSVC
2024-04-17 11:12:50 -06:00
Sarah Wesker
a0c02384a1
Obtain the master of summons on death (#4551)
* Obtain the master of summons on death

* check directly
2024-03-14 10:58:10 -06:00
Rey Alemán
b98aab84dd
Added Creature:onChangeZone event (#4145)
* Creature.onChangeZone event

* pr comments

* format

---------

Co-authored-by: Rey Alemán <rey.aleman@oulook.com>
2023-12-07 19:24:26 -06:00
Ranieri Althoff
66d079615b
Add storage values to creatures (#4495) 2023-07-09 11:57:31 -03:00
Marco Oliveira
545516299b
Update copyright year (#4331) 2023-02-18 20:10:02 -03:00
Marcin Jałocha
c1f7f4da32
Trigger blockHit for healing (#4284) 2023-02-18 18:50:29 -03:00
Ramon Bernardo
4bd81f3351
Replace unchecked virtual functions with static_cast (#4060) 2022-11-10 21:56:22 +01:00
Ramon Bernardo
7243e9099a
Allow addTask to receive a task function as param (#4184) 2022-10-30 19:28:58 -03:00
Ramon Bernardo
5e3baed254
Add creature isDead function (#4231) 2022-10-30 17:16:15 -03:00
Ranieri Althoff
412950218c
Add code formatting with clang-format (#4029)
- Use base Google style
- Drop column limit override
- Format all files
- Use tabs for indentation
- Move system headers after project headers
- Avoid breaking string literals
- Reflow usage text
- Match breaks before braces and colons to previous style
- Reduce spaces before trailing comments
- Reflow comments and fix macro usage in luascript.cpp
- Fix invalid code
- Don't align newline escapes
- Reflow comment to make more sense
2022-04-13 14:06:08 +00:00
nekiro
5b8d19e965
Simplfy addDamagePoints code (#4038) 2022-03-23 17:47:22 +00:00
Marco Oliveira
56814b611e
Add root condition (#4023)
Co-authored-by: KrecikOnDexin <krecikondexin@gmail.com>
2022-03-19 01:19:55 -03:00
Ranieri Althoff
92b35aa3eb
Replace std::bind with lambdas (#4017) 2022-03-18 16:20:24 -04:00
Ranieri Althoff
c3596491a3
Cleanup & organize includes and PCH (#4019) 2022-03-18 16:20:02 -04:00
Evil Puncker
2f8a2afb3b
Add AUTHORS file and remade source header (#3969) 2022-02-22 19:41:21 +01:00
Ramon Bernardo
f4205e367c
Fix summon memory leak (#3736) 2022-02-18 21:45:09 -03:00
nekiro
c82d3329c7
Fix Creature::blockHit (#3948)
Fix crash issue introduced in #2807
2022-02-16 12:29:59 -05:00
nekiro
a14f1fbd46
Adding new item attributes (#2807)
from #998, for more details, refer to the PR #2807 itself
2022-02-03 14:53:30 -03:00
Evil Puncker
d7c8f08819
[11.80] Added new monster 'ink' race and fluid type (#3795) 2021-12-14 18:38:44 -05:00
Ramon Bernardo
a4c988290a
Use TFS code style on comparison and boolean check (#3725) 2021-10-31 12:28:02 -04:00
Ramon Bernardo
2e3c682905
Remove else after returning branch (#3678) 2021-09-25 14:24:03 +00:00
Marcin Michalski
9ad973ec52
Make monsters walk to spawn by chunked path (#3612)
Issues addressed: #3600
Supersedes PR: #3610
2021-09-17 18:25:50 -04:00
Marcin Michalski
e1feac29b0
Add ghost mode check to Creature.canSeeCreature (#3595) 2021-08-25 08:33:00 -04:00
Sarah Wesker
f0bd2e9fb6
Better Corpse Description (#3241) 2021-06-26 12:34:53 -04:00
Iñaki Amatria Barral
488e37ab86
Add optional configurable drunkenness parameter (#3467) 2021-06-12 10:55:18 +02:00
Evil Puncker
4ade6a0e6b
Fixed a few typos in comments (#3336) 2021-02-21 22:34:23 -05:00
yamaken93
ad6865b79e
Replace forward_list with vector in creature walking (#3310)
* now the structure that holds the creature walk steps is std::vector(faster) and now we are using std::move in few places where std::vector is a temporary

* replace emplace_back with push_back

* fix Creature::addEventWalk call
added Creature::startAutoWalk(Direction direction) for player move requests
use a more simply copy method for listWalkDir inside Creature:startAutoWalk(const std::vector<Direction>& listDir)
Use the creature listWalkDir in Npc::doMoveTo

* change the way to reverse the dir list
2021-02-19 18:59:54 +00:00
nekiro
cc7cebf85b
Add new optional parameters to doTargetCombat/doAreaCombat (#3249)
blockedByArmor, blockedByShield, ignoreResistances
2021-01-19 16:01:07 +01:00
nekiro
b52a2f7995
Monsters shouldn't see floors above 8 (#3250) 2021-01-16 21:30:42 +01:00
kygo
a540e72a10
Fast monsters and players death (#3030) 2020-12-26 14:05:45 +01:00
Michał "Gubihe
3b42c0eefc
Creature:isMovementBlocked and Create:setMovementBlocked (#2553)
Includes compatibility functions:
getCreatureNoMove(cid)
doCreatureSetNoMove(cid, block)
2020-11-30 20:35:36 -05:00
WibbenZ
08231f4239
Remove trailing spaces (#2854)
* Remove trailing spaces

Removed trailing spaces and added spaces to some XML tags
Removed else statment from sweetheart_ring.lua

* Remove variable from sweetheart_ring.lua
2020-03-19 05:27:04 +01:00
Mark Samman
2f802cb23e Use a vector for spectators in getSpectators and filter out duplicates manually where necessary 2019-11-07 00:22:32 -05:00