- Added `onSight` event, this has to be enabled with `NpcType:sight(x, y)` unless that is not set the event wont fire. This event triggers whenever a creature (monsters/npcs/players) steps into the sight range, will only re trigger once you walk out of idle range and back in again.
- fixed event callbacks, they're now moved into `NpcCallbacks` they can be set like: `NpcType:callbacks().onSay/onSight/etc.`
- fixed a crash which could occur if you had a npc disabled then enabled him and /reload npcs, this is now fixed
- fixed a crash that if a xml npc is invalid on server startup that it throws an error instead of crashing
- made all the functions in the lib overloadable, only the table data is protected, you can now change functions and they will be correctly changed on /reload npcs
- changed everything related to focus from seconds into ms
- changed focus so it works for all creatures not only players
- changed NpcTalkQueue it now works for creatures not only for players
- changed the onCreatureSay event, it now triggers for all creatures not only for players
- selfSay has a new parameter now called talkType which is optional and falls back to TALKTYPE_SAY
- added `onSpeechBubble` event, with this we can set the speech bubble for each player individual.
example:
Npc has a quest for the player he only shows for this player the quest speech bubble, once the quest is finished the npc wont have a quest speech bubble anymore
---------
Co-authored-by: Evil Puncker <EPuncker@users.noreply.github.com>
Co-authored-by: KrecikOnDexin <krecikondexin@gmail.com>
* Fix some warnings and improve type annotations
* Fix `item:transform` type annotation
* Remove `dump` function from compat.lua
* Fix `configKeys` type annotations
* Refactor all enums/constants of `cpplinter.lua` and fix ident style to tabs
Some were missing and others were wrong, I got them all directly from the source.
* Refactor the PlayerFlag constants in cpplinter.lua to use bitwise shift operators instead of exponentiation
- npc now correctly clears all npc id data when he is removed
- farewell and greet messages can be individually set per talk state if not they fall back to default
- fixed a bug if the npc disappeared while the player was talking to him, then the npc would not respond to the player again once he was spawned
- better warning/error messages which show which npc it occured and which file it originates from
- added shop callback function callback(npc, player, handler, items, afterDiscount) order:
- discount (if there is any) -> callback
- added NpcsHandler:player() this is basicly the equivalent to requirements but instead of requireing you can add/set stuff to the player (modules.lua)
- implemented modules they're load after callbacks order:
requirements (if returns true) -> callback (if returns true) -> modules
- moved teleport/addItems/setStorageValue to modules
- added new requirements
- changed the requirements functions
- I've included the error message directly inside the functions
- removed :failureRespond & :getFailureRespond as they're redundant with requirement re work
- changed modules outfit function it requires to insert 2 different outfits now because of 2 different player sexes
ex: :outfit(id1, id2, addon)
- a few linter/annotation fixes
- if the player changed the talk state but still had the shop open and then tried to purchase something it thrown errors, this is now fixed