Commit graph

119 commits

Author SHA1 Message Date
Ramon Bernardo
4026157e84
refactor(protocol): remove legacy ProtocolLogin impl (#5038)
* refactor(protocol): remove legacy ProtocolOld impl

* refactor(protocol): remove legacy ProtocolLogin impl

* fix(data): cpplinter enum values

---------

Co-authored-by: Ranieri Althoff <1993083+ranisalt@users.noreply.github.com>
2025-11-22 18:20:38 +01:00
Ramon Bernardo
720190d3a8
refactor(protocol): remove legacy ProtocolOld impl (#5037) 2025-11-19 08:54:53 +01:00
ALS
fd991a9291
Refactor IOMarket Extracted into tfs::IOMarket namespace (#4976)
* Refactor IOMarket Extracted into tfs::IOMarket namespace

All credits to @ramon-bernardo, I just used his PR that had been forcibly closed and created this new PR

* Add trailing newline

---------

Co-authored-by: Ranieri Althoff <1993083+ranisalt@users.noreply.github.com>
2025-10-05 19:16:32 +02:00
Jerzy Skalski
1e040a334a
feat: make HTTP listen on the same IP as OTS (#4958) 2025-07-10 10:14:06 +02:00
KrecikOnDexin
81884672f6
fix build without HTTP module (#4876) 2025-06-28 18:47:00 +02:00
Artur Knopik Linux
5bfda8f613 Revert "[Revscriptsys] RevNpcSys version 1.0 (lua npcs / NpcType / new npc system) (#4671)"
This reverts commit 4a89502f46.
2024-12-05 23:56:16 +01:00
Artur Knopik Linux
1be0e40fb2 Revert "[Revnpcsys] Revisioned Npc System v1.2 (#4741)"
This reverts commit c5426f0025.
2024-12-05 23:56:16 +01:00
Mario
c5426f0025
[Revnpcsys] Revisioned Npc System v1.2 (#4741)
* Moved everything to NpcScriptInterface

There was an issue with the Revisioned Npc System.
Because it was included in 2 different lua environments it would not correctly work on any of the cmake builds only the msvc builds worked fine (they somehow have shared lua envs)
Now the npcs should correctly work as it's expected
2024-06-07 02:49:18 +02:00
Ranieri Althoff
ceb2a07f1d
Minimal HTTP login server (#4706)
Adds a login http server which is build on boost-beast

Co-authored-by: Mario <Shadow280690@hotmail.de>
2024-06-01 01:05:43 +02:00
Mario
4a89502f46
[Revscriptsys] RevNpcSys version 1.0 (lua npcs / NpcType / new npc system) (#4671)
Co-authored-by: Sarah Wesker <sarahelizabetwesker@gmail.com>
2024-05-30 02:55:42 +02:00
Ranieri Althoff
f4dfabb070
Use OpenSSL instead of crypto++ (#4655)
* Use OpenSSL instead of crypto++

Use OpenSSL for SHA1 hashing and RSA encryption, which is more readily
available in all systems than crypto++

* Replace singleton with namespace, add unit tests for load key and decrypt

* Cleanup includes

* Pass PEM bytes instead of filename

* Use private key included in repo for tests
2024-04-29 10:56:44 +02:00
Ranieri Althoff
73032fa7d4
Move config manager singleton to namespace (#4653) 2024-04-27 00:48:25 -03:00
Ranieri Althoff
fee42e4fb1
Enable unity build to speed up compilation (#4545) 2023-12-12 21:56:46 -03:00
Evil Puncker
469a4b7014
remove Happy 15th anniversary message (#4369) 2023-04-04 18:43:50 -03:00
Ranieri Althoff
a295ea7b88
Use string views to avoid copying strings (#4079) 2023-03-08 21:49:18 -03:00
Marco Oliveira
545516299b
Update copyright year (#4331) 2023-02-18 20:10:02 -03:00
Ramon Bernardo
7243e9099a
Allow addTask to receive a task function as param (#4184) 2022-10-30 19:28:58 -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
Łukasz Zbiżek
7a98ca26b9
Happy 15th anniversary! (#4050) 2022-04-02 12:25:23 -04:00
Łukasz Zbiżek
73bdc1200a
bugfix: text color in windows consoles (#4044)
#3940 introduced a colored message
colored messages sometimes fail to process in command prompt/powershell
this code fixes that issue
2022-03-27 17:29:32 -04:00
Ranieri Althoff
2f26b7db6c
Use existing boost algorithms where available (#4032) 2022-03-21 21:54:08 -04: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
Ranieri Althoff
336ea6315c
Replace usages of str*cmp with C++ functions (#4018) 2022-03-17 16:15:08 -03:00
Evil Puncker
2f8a2afb3b
Add AUTHORS file and remade source header (#3969) 2022-02-22 19:41:21 +01:00
Daniel Speichert
474b959f8b
rsa: tolerate whitespaces better (#3940) 2022-02-16 23:11:15 -03:00
Evil Puncker
42a0731997
Show OTB version on loading (#3808) 2021-11-28 13:11:30 -05:00
Evil Puncker
84337dfc9a
Added/Removed spaces where needed (#3796) 2021-11-18 16:06:46 -03:00
Ramon Bernardo
cbd905812d
Fix white and double spaces (#3711) 2021-10-03 01:14:22 -03:00
Ranieri Althoff
f2d74c6795
Use fmt to format messages (#3351) 2021-03-03 22:17:16 -05:00
Michał "Gubihe
90f1e3ba76
CLI Arguments handler (#2756) 2020-11-27 23:43:10 -05:00
Daniel Speichert
adb68aa031
cmake: git_watcher may put unquoted commit messages (#3022)
They cause malformed definition and break build.
2020-05-04 23:55:55 -04:00
Daniel Speichert
1e96813257
Include git-based version at compile time (#3007) 2020-05-03 16:52:32 -04:00
Daniel Speichert
4233f740f2
Build (cmake) and CI/CD updates (#2973)
* cmake is upgraded and related configs modified
* build using cmake on Windows (with vcpkg) is now possible
* cotire is not used when redundant (cmake >= 3.16)
* Lua version shown on startup
* Github Actions
2020-05-02 21:08:10 -04:00
Mario Tettei
11120043d8 Revscriptsys Monstertype event callbacks (#2594)
* Monster Type Event Callbacks

- now you can set the callbacks in the same file as you create the monster type in.

* removed unnecessary checks
2019-08-07 17:37:29 +02:00
Lucas CP
b7ef46dfc7 Update copyright for 2019 (#2590) 2019-05-13 14:22:45 +02:00
Mario Tettei
af649d0611 rework on /reload (#2566)
* rework on /reload

- reworked the /reload command, from now on it does reload everything regardless of what you want to reload, because if we don't reload the entire scripts folder alongside it might bug/crash.
You can however still use '/reload global' which will reload global.lua and scripts/lib/
- added 'showScriptsLogInConsole = true' to config.lua.dist. If that option is enabled it also shows on /reload that the scripts are reloaded aswell
- removed all deconstructor (__gc) functions for the events as they where the cause of the crash on reload.
- made raw 'event' pointers to std::unique pointers, so on release it doesn't crash the server.
- fixed a bug which stacked attacks/defenses/loot on reload which could lead to a crash aswell.

* updated reload.lua

- removed all the deprecated reload types.

* trailing line space

- remove a trailing line space

* removed stuff

- removed the unnecessary pointers and pushed them directly into the event type list

* rework on /reload

- reworked the /reload command, from now on it does reload everything regardless of what you want to reload, because if we don't reload the entire scripts folder alongside it might bug/crash.
You can however still use '/reload global' which will reload global.lua and scripts/lib/
- added 'showScriptsLogInConsole = true' to config.lua.dist. If that option is enabled it also shows on /reload that the scripts are reloaded aswell
- removed all deconstructor (__gc) functions for the events as they where the cause of the crash on reload.
- made raw 'event' pointers to std::unique pointers, so on release it doesn't crash the server.
- fixed a bug which stacked attacks/defenses/loot on reload which could lead to a crash aswell.

* another rework

- You can now again reload different types again like usual (/reload actions) etc.
- You can also use /reload scripts and /reload libs now

* forgot to include globalevent.cpp

* another rework

- You can now again reload different types again like usual (/reload actions) etc.
- You can also use /reload scripts and /reload libs now

* another addition

- added removing lua stuff before reloading for /reload all

* ranisalt's change request

- clear() functions are now all override final
- removed get/set for fromLua
- added reInitState function to BaseEvents
- made oldEvent a std::unique_ptr

* another rework

- You can now again reload different types again like usual (/reload actions) etc.
- You can also use /reload scripts and /reload libs now

another addition

- added removing lua stuff before reloading for /reload all

ranisalt's change request

- clear() functions are now all override final
- removed get/set for fromLua
- added reInitState function to BaseEvents
- made oldEvent a std::unique_ptr
2019-04-26 14:22:33 +02:00
Mario Tettei
62dac47c01 revscriptsys (#2558)
* initial revscriptsys

creates a new folder called 'scripts' in the data folder.

lua files placed in the 'scripts' or sub folders will automaticly get registered on load with the right setup ofcourse.

Registering happens in the lua file itself, doesn't require xml settings.

lua files can be deactivated by placing a '#' infront of the filename ex: '#positions.lua' it wont get loaded then.

Currently it supports:
-Actions
-TalkActions
-CreatureEvents
-GlobalEvents
-MoveEvents

There is still stuff on the todo list but they'll get added sooner or later.

Co-Authored-By: Sam <thesumm@users.noreply.github.com>

* compiler fixes

added boost-filesystem to appveyor.yml
fixed a few more compiler errors.

* cleanup on script.cpp

removed using namespace for std / boost filesystem

* some fixes

had to make adjustment so lua callbacks and xml settings work alongside and don't crash the server

* small fixes on movements & function additions

Have to revert the function + callback for stepin/stepout & additem/removeitem as it doesn't make sense on the second look and might cause a stackoverflow
I've also reworked the equip/dequip so it doesn't get double calls.
It'll first check if functions return true if not it won't bother to read the callback

accidently used an old spellbook.lua

added :aid(ids) :uid(ids) functions for MoveEvents

* revert to 'using' functions and suggestion of Djarek

Could revert most of movements.h

made the declaration of the static functions more clear

Co-Authored-By: Damian Jarek <djarek@users.noreply.github.com>

* small fixes

removed commentary from movement.cpp
added newline for position.lua
reworked spellbook.lua with table.concat

* Monster handler & other stuff

- MonsterType's can now be created through lua functions.
- added an interface to create MonsterType's easily through lua files (register_monster_type.lua)
- added #example.lua in 'scripts\monsters\'
- renamed action vector functions for a better standard
- renamed _lib folder to lib, this folder gets now loaded when the other lib folder gets loaded aswell
- moved loading lua scripts out of the scriptfilemanager, we need to load everything after monsters etc. is loaded so MonsterType script manipulation does work
- added Loot() & MonsterSpell() metatables

* fix compiler error

* forgot to remove test code

removed test outfit from MonsterType

* small changes

- added createFunctions(class) it virtually creates the get/set functions for the class passed on
- 'events' folder in monsters is excluded from auto parsing files, as we load callbacks for specific monsters which have an eventFile set to 'true' or 'filename' in this folder.

* compiler error fix

* minor change on createFunctions

* stripping path string

* added Game.createMonsterType(name) and small fixes

- added Game.createMonsterType(name)
- reworked MonsterType(name) to return nil if the MonsterType does not exist, so we don't suddenly create a MonsterType if we do not even want to.
- changed reinterpret_cast to static_cast

* config.lua option for console

- added an option to disable scripts console logging, it can be disabled by placing 'showScriptsLogInConsole = false' into config.lua

* initial revscriptsys

creates a new folder called 'scripts' in the data folder.

lua files placed in the 'scripts' or sub folders will automaticly get registered on load with the right setup ofcourse.

Registering happens in the lua file itself, doesn't require xml settings.

lua files can be deactivated by placing a '#' infront of the filename ex: '#positions.lua' it wont get loaded then.

Currently it supports:
-Actions
-TalkActions
-CreatureEvents
-GlobalEvents
-MoveEvents

There is still stuff on the todo list but they'll get added sooner or later.

Co-Authored-By: Sam <thesumm@users.noreply.github.com>

cleanup on script.cpp

removed using namespace for std / boost filesystem

small fixes on movements & function additions

Have to revert the function + callback for stepin/stepout & additem/removeitem as it doesn't make sense on the second look and might cause a stackoverflow
I've also reworked the equip/dequip so it doesn't get double calls.
It'll first check if functions return true if not it won't bother to read the callback

accidently used an old spellbook.lua

added :aid(ids) :uid(ids) functions for MoveEvents

Monster handler & other stuff

- MonsterType's can now be created through lua functions.
- added an interface to create MonsterType's easily through lua files (register_monster_type.lua)
- added #example.lua in 'scripts\monsters\'
- renamed action vector functions for a better standard
- renamed _lib folder to lib, this folder gets now loaded when the other lib folder gets loaded aswell
- moved loading lua scripts out of the scriptfilemanager, we need to load everything after monsters etc. is loaded so MonsterType script manipulation does work
- added Loot() & MonsterSpell() metatables

small changes

- added createFunctions(class) it virtually creates the get/set functions for the class passed on
- 'events' folder in monsters is excluded from auto parsing files, as we load callbacks for specific monsters which have an eventFile set to 'true' or 'filename' in this folder.

stripping path string

added Game.createMonsterType(name) and small fixes

- added Game.createMonsterType(name)
- reworked MonsterType(name) to return nil if the MonsterType does not exist, so we don't suddenly create a MonsterType if we do not even want to.
- changed reinterpret_cast to static_cast

config.lua option for console

- added an option to disable scripts console logging, it can be disabled by placing 'showScriptsLogInConsole = false' into config.lua
2019-04-16 16:33:38 +02:00
Marcin
b2a6be2ecd Explicit uint16_t type cast to avoid compiler's warning (#2542) 2019-03-15 00:31:24 -04:00
Vulcanx
0c84c15928 Add error message when failing to load RSA key (#2501) 2018-10-09 21:02:28 -04:00
Ranieri Althoff
1e044c4c4e
Load RSA private key from PEM file (#2496)
* Load RSA private key from PEM file

* Add FindCrypto++ and install on CI

* vcpkg: install cryptopp

* Fix constness and static init
2018-09-18 22:20:44 +00:00
vankk
020ed5fd36 Update copyright for 2018 (#2452) 2018-03-05 00:39:47 +01:00
Daniel Speichert
20df00b63c Ship default config.lua as config.lua.dist (#2416)
If config.lua.dist exists and config.lua does not, we will copy config.lua.dist to config.lua on lauch.
2018-01-06 12:51:27 +01:00
Damian Jarek
c214eaff44 Removed FILELOADER_ERRORS (#2398)
The error information was discarded anyway, so this provided no value.
Removed redundant declarations in OTB::Node.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2017-12-29 19:33:42 -05:00
Mark Samman
b1839eaf26 Fix inconsistencies between declaration and definition arg names (#2350)
* Fix inconsistencies between declaration and definition arg names
* Update ban.h
2017-12-17 20:24:37 +01:00
Ranieri Althoff
263d3018f2 Fix function attributes and visibility issues (#2363)
* Fix function attributes and visibility

- Replace `protected` visibility with `private` for `final` classes
- Remove `final` attribute from `final` class methods
- Add `override` attribute when applicable
- Add `[[noreturn]]` attribute where applicable

* Remove unused attribute

* Fix visibility (protected to private)
2017-10-16 18:26:03 -02:00
Ranieri Althoff
29752b6a30
Omit variables where unneeded to name 2017-01-01 16:55:12 -02:00
Ranieri Althoff
2ffd686f3b
Use return by reference on singletons 2017-01-01 16:26:09 -02:00
Bruno Minervino
cc8e15e916 Update copyright year for 2017 (#2034) 2017-01-01 15:39:31 +01:00
Damian Jarek
c689b4b027 POSIX signal handling (#1435)
* Added UNIX signal handling for SIGTERM, SIGHUP, SIGINT, SIGUSR1.

Using signal_set allows us to use the same interface for handling
signals on UNIX-likes and console events on Windows.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>

* Fix indentation in project file

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2016-11-15 21:29:42 +01:00