Commit graph

86 commits

Author SHA1 Message Date
Lukáš Novotný
f4b9be4314
Improve held weight computations (#650) 2024-06-17 09:56:40 +02:00
Kevin Eady
d916f86408
Update container OnRemove, CanRemove program parameters (#647)
* Implementation
- Add `amount` to CanRemove script
- Add `split_from` to OnRemove script

* Tests

* Add docs and core-changes

* Fix tests... maybe?

* Restore testing for client events in container event tests
2024-05-16 22:49:51 +02:00
Kevin Eady
c4f6e32e88
Add held_weight_multiplier for containers; Fix missing tooltip updates (for weight) (#646)
* Implementation

* wip testing

* allow setting held weight mod to long value

* more tests

* address github actions warnings
- unary minus operator applied to unsigned type, result still unsigned

* Add docs, core-changes

* fix GetItemDescriptor() for HeldWeightMultiplierMod; update tests

* update docs a bit more

* Remove mod suffix
2024-05-14 08:24:19 +02:00
turleypol
9d2bf0ec60
replaced all uppercase hex formatting with lowercase variant (#645) 2024-05-05 09:13:12 +02:00
Kevin Eady
ac97667b3b
Corpse equipment changes; Fix support of MaxItems 0 for containers (#635)
* Implementation

* Add core-changes

* Fix warnings

* Fix support of MaxItems 0 for "unlimited" in containers

* add initial tests

* Update core-changes
2024-03-24 10:17:35 +01:00
Kevin Eady
35d16b8e5d
Add item.weight_multiplier_mod (#633)
* Add item.weight_multiplier_mod

* Add test for item.weight_multiplier_mod

* add core-changes and docs

* Address review comments
- Use `Clib::clamp_convert`
- Remove new `weight_of` function
2024-03-16 19:59:53 +01:00
turleypol
08bd3c7ce5
Savefile rewrite (#601)
* rewrite of saving, replaced operator way with a generic add method, thus
not everywhere the formating of the savefiles is hardcoded.
since its the last spot which uses the old formating lib, remobed the
lib

* removed cmake of old format lib

* testscripts for load/save of UObject,Item,Armor,Weapon

* fixed: member faster_cast_recovery and faster_cast_recovery_mod getter returned
a wrong value

* wrong/missing docs

* test containers, lockable, map, spellbooks
fixed save bug in map and spellbook
removed ancient savestrategy experiments

* added corpse test
splitted testfiles

* fixed loading (ancient bug) and saving (PR bug) of Reportables
added tests for houses, boats, accounts and chars

* fixed include

* fix shutdown leak

* added npc tests
upload complete coretest folder also on failure

* do not write and load RegisteredHouse for NPCs two times
readded extra newline between accounts

* tests for guild, party, realm
added resource cfgs, but a test is not really possible since nothing of
interest is stored

* added datafile, storage test

* activated resource loading, 25year old bug, but since the stored values
are senseless it makes no real difference.
added a few wtf comments
catch all exceptions during formatting of log lines

* replaced .write with explixit .begin, .end and .comment.
for leftovers.txt the StreamSaver was also used, since the format is
different use directly ofstream

* added corechanges
2024-01-24 18:49:06 +01:00
turleypol
d848deae18
POLLOG* macros use the new formatting (#598)
* POLLOG* macros use the new formatting
removed all old logging functions

* removed old fmt lib from everything except StreamWriter
removed unneeded functions

* fixed review comments
2024-01-16 17:55:42 +01:00
Kevin Eady
ecec3a2206
reworked get_item and its undo behaviour (#514)
* reworked get_item and its undo behaviour.
old position gets stored and in case of failures restored

* removed ancient container content defines

* Fix some packet oddities
- dropitem: Success sent after rejections
- getitem: Double Delete Item packet due to item->extricate

* Store container serial when creating GottenInfo

* Add tests

* add socket mutex to disconnect checks

* Use mutable socket mutex

* add core changes

---------

Co-authored-by: turleypol <turley@polserver.com>
2023-05-23 17:07:23 +02:00
turleypol
eeb57d489a
Drop/getitem related pos refactoring (#497)
* refactored move_item

* container location methods

* dropitem position refactors

* addressed pr comments.
fixed comment
more readable algo for random location
2023-01-05 00:10:51 +01:00
turleypol
7ee1b64e19
replaced baseclass x,y,z,realm members with Pos4d. (#420)
* replaced baseclass x,y,z,realm members with Pos4d.
Adapted the code, no changes except making the compiler happy

* review changes

* Fixed gotten_item

* fixed copy&waste
2021-09-10 20:17:25 +02:00
turleypol
cccf84dfc8
Fewer compile warnings (#413)
* added escriptgrammar as external lib where it belongs. Silenced warnings.

* bscript compiler warning fixes

* special include file to get rid of gcc warnings about antlr4

* misc windows warnings

* time specifc warnings

* buildfix + apple warnings

* never trust apple

* windows debug build warnings

* some windows clang warnings

* last warning fix
2021-08-28 22:26:15 +02:00
turleypol
ec9cd8026b
Descriptorbugs (#406)
* tests for several descriptor loading related problems

* fixed copy of cprops from descriptor to intrinsic items
fixed container test

* added shield npcdesc entry

* fixed nodrop/exception loading from itemdesc

* fixed compilation error

* attackdelay should later also trigger creation of npc weapon, added test for it

* intrinsic weapon gets created when AttackSpeed or AttackDelay is set.

* added docs

* changed doc entry

* fixed typo
2021-08-03 14:58:50 +02:00
turleypol
5df6fa6703 check if container is orphan when adding items as content.
for now it crashes the shard to have the backtrace. (would crash anyway
later)
2019-03-20 20:05:44 +01:00
turleypol
e1b14dcd00 moved polfile/uofile files into plib to cleanup atleast a bit the
compile dependencies
2018-12-21 20:27:05 +01:00
turleypol
983c6a3c73 first round for scripted object class methods 2018-10-13 00:03:40 +02:00
turleypol
a5e6206164 Added cmake option to run clang-tidy
used everywhere nullptr
2018-10-09 16:36:35 +02:00
GIB
771f2884d5 Changes to the way the flags were processed.
Removed references to non-inuse items.
Updated documentation.
Included new Racalac Guide documentation supplied by Yukiko.
Clangified my changes.
Updated change log.
2018-09-07 10:19:17 +08:00
GIB
b9071bbde8 Changes to include flags for findobjtypeincontainer. 2018-09-06 22:34:51 +08:00
esdete
dc2d29b433 NULL to nullptr 2018-07-31 14:30:29 +02:00
esdete
af675c65a1 First minor changes c++11.
Try commit, if the direction of changes is compliant with Core Devs Team
2018-07-30 23:02:15 +02:00
turleypol
dbb25bdb62
Include and buildsystem cleanup (#45)
Include cleanup
Reworked buildsystem (Linux only)
Removed dynamic libs, Linux now again uses static linking (like windows)
2018-01-29 21:55:48 +01:00
turleypol
798eda5b63 Cleanup of header includes. 2018-01-01 21:52:14 +01:00
turley
dcda893e2a new item member no_drop disallows any drops
new container/npc member no_drop_exception if set target is valid even
if no_drop is set
poltool can now unpack and print compressed gump pkts from a pol/razor
pkt log
2017-09-10 12:41:13 +02:00
turley
c855a27815 Added new baseclass for uobject
contains only minimum data and can be created with arbritary data.
This reduces memory overhead for each los-check.
Plus minor cleanup
2016-12-12 22:21:59 +01:00
turley
a983d25e4e removed bool members and replaced them with flags.
Further decrease memory foodprint.
2016-12-07 23:34:16 +01:00
turley
189cad3479 Formating everything
Authors are not forced to use the clang-format setting, but should
atleast be inspired by the style.
The only thing which is now not allowed are tabs for ident/alignment!
2016-02-19 19:26:35 +01:00
turley
ed7b16b233 normalized lineendings 2016-02-11 22:54:43 +01:00
turley
92cc1b4d70 Use weakptr to uoexecutor in the threaded sql call
changed client class from ref_counted to also hold like the uoexecutor a weakptr, use it in the ClientObjImp.
Renamed NPCRef to NpcRef like its been told since years in a TODO comment
fixed some warnings from VS2015
2016-02-10 23:09:05 +01:00
Gabriele Tozzi
d1ac902926 Documentation: reformatted headers for DoxyGen 2016-01-28 14:52:40 +01:00
Gabriele Tozzi
0eb6c8af4f Regression fix: previous commit broke CreateItemInInventory
Force stacking behavior is now back, when used in an explicit way.
Also checked call hierarchy for similar introduced bugs: none found.
2015-10-18 17:15:22 +02:00
Gabriele Tozzi
7d91c369a0 Fixed: The core could stack non-stackable items
Item::can_add_to_self and UContainer::find_addable_stack were not
taking item's stackability into account
2015-10-18 14:01:49 +02:00
turley
188b2797ed Replaced old dynprop_map with new dynproperties.
Moved also extended_statbar,skillcap, movementcost_mod infos into the dynprops
2015-05-09 13:00:12 +02:00
turley
79dff37246 Splitted gamestate external. 2015-01-02 14:46:44 +01:00
turley
88ec380941 Moved globals into separate directory. 2014-12-30 15:20:59 +01:00
turley
2737393f2a Tried to put all global vars into centralized structures.
Currently plib/systemstate, pol/uvars, pol/ucfg, pol/multi/multidef

Next step should be to split them based on usage, since its currently a bit of include hell...
2014-12-30 14:14:41 +01:00
frozenblit
f57f0f6f0f Encapsulated calls to getmember<> and setmember<> 2014-11-09 23:45:08 +01:00
frozenblit
a704a90208 Another round of stl_inc.h cleanups 2014-11-01 22:27:42 +01:00
frozenblit
39bd45f60d Separating wornitems and corpses from containers
I created new headers to see if we can reduce the include hell that
we're in.
2014-10-31 00:02:41 +01:00
frozenblit
afd4006959 Fixed another crash bug with corpses
When an item was destroyed, the list of equipped items on the corpse was
not updated and there was a dangling pointer left there.

Changed UContainer::remove() to virtual and made an override for it in
UCorpse. This should fix it.
2014-10-30 21:01:45 +01:00
frozenblit
a40c426eb8 Moving the place where we reset an item's slot
There are three functions to remove an item from a container, but only
one of them was resetting the item's slot. Moving to the one which is
called by the other two.
2014-09-29 22:06:34 +02:00
frozenblit
8ab9b31717 Added Item::reset_slot()
Coverity complained about not checking when calling slot_index(0). To
make it clear that it can't fail, I've added a reset_slot() and changed
where needed.
2014-09-28 14:34:21 +02:00
frozenblit
b8382d7955 Cleanup of corpse code
Improved the generation of corpse cloth packets by just checking the
equipped items. (Should speed up crowded areas with many corpses which
have items inside)

The corpse clothing will be sent again to nearby chars if items are
added.

Ensured that the equipped layer is reloaded if the shard restarts.
2014-09-21 21:15:54 +02:00
frozenblit
6e02431ee0 Fixed corpses not equipping items placed on them
Items placed on corpses will be equipped even if the corpse doesn't have
an OnInsert script.
2014-09-21 15:47:29 +02:00
frozenblit
b9fdfa1e07 Fixed possible crash in corpses involving layers
Buffer overrun was occurring when an item had a tile_layer larger than
25. This is the likely reason behind some crashes.

Moved valid_equip_layer() from Character to the namespace Items.

There were calls to PutItemOnLayer() which didn't check if the item had
a proper layer, so I've added asserts to make sure this won't happen
again.
2014-09-21 15:41:20 +02:00
turley
54b4691bdd c++11 random mersenne twister usage added (patch submitted by Kimungu)
started to split the packet build logic into own classes (SendWorldItem/Multi checks itself which packet version needs to be build)
2014-08-01 17:05:58 +00:00
turley
b2572d69f7 fixed size estimation. MoveObjectToLocation on a boat now unregisteres the boat first thus small changes are also possible. 2014-07-05 09:40:15 +00:00
turley
331792c755 added more memoryusage estimation 2014-06-07 09:00:37 +00:00
turley
fb873de803 decoupled headers to optimize a bit the build time 2014-05-03 09:06:19 +00:00
turley
9acf8fa43c added StackWalker lib for complete backtraces under windows
simplified some loops
fixed a crash on char death with non moveable robe layer items
2014-04-25 09:30:50 +00:00