Commit graph

211 commits

Author SHA1 Message Date
turleypol
b216a16d36
refactored npcmod,decay to use Pos classes, removed all wrappers from Realm (#652)
* refactored npcmod,decay to use Pos classes
get rid of some realm methods used to wrap Pos

* all wrappers in Realm are now gone

* review comments
2024-07-07 15:32:29 +02:00
turleypol
a88d76acc3
refactor uomod to use pos classes (#651)
* refactor uomod to use pos classes

* fixed ambiguous call
2024-07-06 07:56:02 +02:00
turleypol
9d2bf0ec60
replaced all uppercase hex formatting with lowercase variant (#645) 2024-05-05 09:13:12 +02:00
Kevin Eady
1a2668e36b
Trigger WalkOnScript for Boats; Add lastrealm to WalkOnScript (#638)
* Add boat walkon script

* Add tests

* Add lastrealm to walkon script

* Update walkon tests for last position check

* Update docs

* Add core-changes

* Add pre-test cleanup to corpse equipment tests
2024-03-24 14:39:11 +01:00
Kevin Eady
593cfffb83
Add uninit, true, false keywords to grammar (#596)
* Update grammar

* Update expression handling for uninit

* update existing tests

* Add new tests

* Remove fullpath from escriptgrammar generation comment

* fix tests

* Update eScript guide

* Declare escript version 0x11

* Add core-changes

* Add `true` and `false` to grammar

* true/false implementation

* Fix existing tests

* Add new tests

* Update core changes

* add docs

* Fix BooleanValue::describe_to

* bool optimizations

* optimize uninit

* remove unused var assignments

* Update grammar for case labels for uninit, booleans

* Fix case label handling for uninit, true, false

* Tests

* Fix compiler version display v1.1700000017881393 -> v1.17

* optimize boolean binary operations

* fix unary boolean optimizer

* add boolean, uninit optimizer test

* Use new fmt lib apis

* Fix compiler warning

* really fix warning lol

* Add Executor[Module]::getParam for bools, FindSubstance test
2024-01-20 05:38:25 +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
turleypol
154a68a9fd
LEAKLOG, DEBUGLOG, SCRIPTLOG, FLEXLOG changed to new logging (#597)
* LEAKLOG, DEBUGLOG, SCRIPTLOG changed to new logging

* updated FLEXLOG
2024-01-13 17:08:33 +01:00
turleypol
ec91d7cc3c
Codecleanup from #581 (#583)
* is_visible_to_me checks now also in_visual_range
added obj::distance_to
fixed warnings

* no magic numbers for snprintf
2023-12-26 17:47:40 +01:00
turleypol
d873551c25
removed pol_distance/inrange* functions (#556)
* removed pol_distance/inrange* functions
replaced lastxyz with Pos4d

* replaced WorldIterator::InVisualRange with InMaxVisualRange returning
all objects in maximum update range. Adapted each caller, they now have
to check in_visual_range
Multis should now be send to clients with its footprint in mind.
added testscript for boat moving in/out of range

* removed non pos InRange/InBox functions
gamestate.update_range doesnt need to be a Vector, renamed

* corrected send_action_to_inrange

* replaced clip methods with general numeric type clamp function

* added Range2d constructor with radius

* splitted update_range. chr has now a los_size (how far can it see) and
an object has a visible_size (0 for objects 1/2 footprint for multis)

* use in_range instead of pol_distance

* corrected order of checks

* fixed warnings

* fixed visual size of multis
testclient added wornitems pkt support
added tests for los

* corechanges
2023-12-25 22:02:52 +01:00
Lukáš Novotný
3448860049
Add value parameter validation for PerformAction (#574) 2023-12-16 11:47:05 +01:00
Peter Wedder
42f15b809f
Add new EScript function: GetStandingCoordinates, and a new option to GetStandingLayers (#476)
* Make GetStandingLayer recognize items & fix bug affecting the z-coordinates returned.

* Oblige oppressive line length requirements

* Don't need this workaround anymore

* Add includeitems parameter to GetStandingLayers.

* Add GetStandingCoordinates EScript function.

* Remove semicolon from documentation.

* Fix line length nags.

* Add "x", "y" members to documentation.

* Reformat code.

* Update corechanges.

* Fix line break in core changes.

* Remove dummy parameter by removing broken reinterpret_cast.

* Update GetStandingLayers documentation.

* Remove x,y parameter overload of get_walkheights.

* mf_GetStandingLayers: use Pos2d instead of x, y params.

* Remove x,y param overloads of readdynamics. Rename flagless version to read_walkable_dynamics.

* mf_GetStandingCoordinates: Refactor to use Core::Pos2d, Core::Range2d and Realms::Realm.

* Clarify GetStandingCoordinates documentation.

* Use correct error message in documentation.

* Fix function signature in uo.em

* Add test script for GetStandingCoordinates.

Adds a simple test script for GetStandingCoordinates which
compares the function's return value to known good data
from the test map.

* Update changelog

* Fix test

* Add a commented out block into test script to generate expected data

* Fix clearance check.

Walls and other tall shapes were not getting detected correctly.
2023-12-06 12:54:29 +01:00
Kevin Eady
e05dfd7d6d
fix crash control script crash on destroyed item (#563) 2023-11-13 07:27:14 +01:00
Kevin Eady
8b7596659c
Add support to restart Item control scripts via RestartScript (#557)
* Add implementation

* Add tests

* Update modules, docs, core-changes

* Address review comments
- Use single `getUObjectParam` instead of both `getItem/CharParam`
2023-11-02 15:23:24 +01:00
turleypol
4895bfdf16
rewrite of FindPath (#554)
* rewrite of FindPath
added parameter for movemode, before it was only possible to use
findpath on land

* unknown movemode is now an explicit error.
extended tests
docu

* added core changes

* typo
2023-10-23 19:35:40 +02: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
Kevin Eady
d9fd8d4590
Fix DestroyItem() crash when passing a multi (#506) 2023-02-28 16:26:25 +01:00
Kevin Eady
1b879bc59f
Add script helpers to implement stealing skill (#493)
* add item.character_owner

* Address review comments
- Cleanup chr_from_wornitems
- Return BError if no character owner

* Add Target option TGTOPT_ALLOW_NONLOCAL

* Address review comments
- Remove `Core::chr_from_wornitems`

* Add pol tests for snooping

* Add tests for TGTOPT_ALLOW_NONLOCAL

* target_nonlocal_checklos pol test debugging

* target_nonlocal_checklos pol test debugging
- Remove destroy of obstacle
- Add a CheckLosAt call to error return

* target_nonlocal_checklos pol test debugging
- Enable USAN build

* undo test debugging changes

* use mobile for los when targetting snoopable items

* Update core-changes

* Persist SnoopScript for items on save

* Add snoop_script_ to Item::estimatedSize

* document SnoopScript script type
2023-01-08 16:59:28 +01: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
Kevin Eady
ab151728d0
Add x, y parameters to create item function calls (#490) 2022-12-13 23:08:02 +01:00
Peter Wedder
3ea8fc55ea
Add force parameter to CreateNPCFromTemplate() (#475)
* Add force parameter to CreateNPCFromTemplate()

* Update documentation

* Rename parameter to forcelocation

* Fix parameter name in docs

* Fix parameter name in docs (again)
2022-10-13 19:59:07 +02:00
Kevin Eady
52c24101b9
Add support for cursed items (#466)
* Add support for cursed items

* Fix poldbg localvarmembers
2022-08-03 01:05:12 -04:00
Kevin Eady
78a60be06d
Ensure client has a character in SendOverallSeason (#459) 2022-04-29 17:07:35 +02:00
turleypol
3306c5e206
converted multidef (#441)
* converted multidef
added to the testsuite a big multi
ListMultisInBox now uses the update range, but since its the only spot
and the chances are low that someone really has such a big multi
corechanges are not really worth it I would say

* Fixed a few grid bugs, one endless loop and changed the range a chr can move while customhouse is active
2021-11-09 20:01:16 +01:00
turleypol
f99ab2dbaf
switched internals of realms, changed packetdefs (#432)
* switched internals of realms, changed packetdefs

* restructured ListenPoint a bit

* moved actual listenpt code to private method

* simplified listenptr loop and the same for guilds to fix ancient fixme

* added todo for future us
2021-10-26 10:52:13 +02:00
turleypol
ce9834e1ef
Regions Pos class refactor (#426)
* Regions Pos class refactor

* switched memorylayout of regions. y first to be more cache friendly
2021-09-13 20:27:13 +02:00
turleypol
95783a3226
removed ufacing move_delta, added getPos*Param (#424)
* removed ufacing move_delta, added getPos*Param

* renamed move_self to move_to
2021-09-12 14:39:06 +02:00
turleypol
9fe3e36cff
use Pos classes in Map and Door (#422)
* use Pos classes in Map and Door
removed most of the functions in ufacing.cpp
removed Plib::UFACING
added executor getPos2d

* added forward methods to baseobject, lets see where it ends :)

* fix typo

* moved methods to uobject
2021-09-11 22:38:43 +02: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
Kevin Eady
808bb07ef2
Fixed target cancelling bug (#404)
* Fixed target cancelling bug

* address review comments

* remove fixme
2021-07-21 19:01:03 +02:00
Fernando Rozenblit
ebaeab3dc8
Add option to receive only PC or NPC area events (#364)
* Add option to receive only PC or NPC area events: EnableEvents(ev, range, evmask)
where evmask can be:
0 -> accepts events from both PC or NPC (as it is now)
1 -> accepts events from PC only
2 -> accepts events from NPC only

* Add docs and entry in uo.em
* Add entered/leftarea tests
2021-02-27 23:46:21 +01:00
Fernando Rozenblit
c49f5b4abb
Reorganize regions and realms (#228)
* Moved realms.h and realms.cpp to realms/..

* Moved regions into their own folder
2020-08-17 22:29:07 +02:00
Kevin Eady
5bbc53ab6c
Add exit_code to uo::Shutdown() (#176)
* Add exit_code to uo::Shutdown()

Co-authored-by: Eric Swanson <eric.the.unicorn@gmail.com>
2020-08-03 20:30:27 +02:00
Kevin Eady
12d6186d10
Script option enhancements (#118)
* Fix SCRIPTOPT_CAN_ACCESS_OFFLINE_MOBILES

* Add SCRIPTOPT_SURVIVE_ATTACHED_DISCONNECT

* wip beginning work on templatization

* Use PolModule in pol-specific modules

* wip, creating PolModule with getXYZParam

* wip 1, moving getXYZ to UOExecutor

* compilable with PolObjectImp / PolApplicObj

* add type guard

* wip, change signatures

change signatures of script_method, script_method_id, and
custom_script_method

* compilable (windows)

* linux fixes

* namespace fixes

* remove uoexhelp

* formatting

* compilable

- move can_access_offline_mobiles back to uoexec
- add guildscrobj and partyscrobj sources
- move EGuildRefObjImp and EPartyRefObjImp
- wip, implement asUOExec
- formatting uoexec.cpp,.h

* finish uoexec() helper

* some cleanup
2020-02-08 09:21:35 +01:00
Jonathan Morland-Barrett
e66eac2b71
AddAmount returns ItemRef on success. (#114)
**BREAKING CHANGE**
Whilst the break may be minor for some its still worth checking if you evaluate the response from AddAmount anywhere in your scripts.
If you compare it to 1 (int) you need to update this as the function no longer returns an integer on success.
* Update AddAmount() function from uo.em to return the original itemref on a successful addition of amount.
2020-01-04 19:51:28 +08:00
turleypol
4885c9b0ce fixed hopefully different behaviour of SendQeustArrow with an invalid param on linux and windows 2020-01-03 09:56:17 +01:00
turleypol
7e8f92bc85 rewrote module function generation, maybe this works 2019-11-10 22:04:08 +01:00
Kevin Eady
ca850a0c76 project refactoring 2019-10-18 21:32:30 +02:00
Kevin Eady
5c0fb7c4ea First support for .em-parsed module function tbls
- Create module parser custom target
- Include generated tables in .cpp sources
- Standardize module function names based off .em names
2019-10-17 22:37:26 +02:00
Kevin Eady
b55e852a5b wip 1 2019-10-17 19:08:49 +02:00
turleypol
f5310f48f4 Merge remote-tracking branch 'origin/master' into utf8
* origin/master:
  Style...
  Getting rid of a warning
  Fixed wrong return type
  style issues :p
  Fixed the check for max line length and some other minor issues
  Added SocketLineReader class, which is responsible for reading lines from a socket in a more efficient way. Modified Aux, Debug and WWW to use the new class.
  removed some ancient macros from clib.h
  Added error for if NaN sent as PID
  Update docs to use different wording to prevent confusion.
  Updated Docs.
  Fix for GetProcess() not actually loading the parent PID.
  Update docs to use different wording to prevent confusion.
  updated travis build clang and ninja
  Updated Docs.
  Fix for GetProcess() not actually loading the parent PID.
  Improved network code used by http and aux servers

Conflicts:
	pol-core/doc/core-changes.txt
2019-09-02 18:55:07 +02:00
turleypol
691d330c07 removed some ancient macros from clib.h 2019-08-25 09:05:15 +02:00
turleypol
ebe884c2fe Merge remote-tracking branch 'origin/master' into utf8
* origin/master: (70 commits)
  Fix to items randomly loading with AOS props due to incorrect initalization of props on load of server.
  Rectify core not clearing mobiles from client during shadow realm shift.
  SendQuestArrow() fix for HSA clients (#91)
  Hotfix/start skill script (#90)
  Noninvasive dynaprops (#89)
  Update objref.xml
  Some network error conditions were missing...
  Final adjustments to core-changes
  Added Turley's missing core-changes :P
  Improved connection handling:  - Linux isn't limited to 1024 connections anymore  - Windows may have some slight performance boost
  removed senseless gitignore files
  use generator unspecific clean cmd in build_tools.sh always generate compile_commands.json force color diagnostic (to work with ninja)
  Curl building uses now the same compiler as pol
  fixed target_link_directories system header declaration
  check if container is orphan when adding items as content. for now it crashes the shard to have the backtrace. (would crash anyway later)
  add corechanges for doc changes
  new build target "clang_format" runs clang-format on current modified or new files in pol-core dir.
  Formatting
  Fix xml indentation
  fix indentation
  ...

Conflicts:
	pol-core/bscript/execmodl.cpp
	pol-core/doc/core-changes.txt
	pol-core/pol/getmsg.cpp
	pol-core/pol/module/unimod.cpp
2019-08-16 19:02:53 +02:00
GIB
76487f0ab2
SendQuestArrow() fix for HSA clients (#91)
* Changed SendQuestArrow to receive an arrow id rather than requiring an object reference.
*Added new error if no id is supplied to a cancellation request.
* .Fix uo.em to have correct default.
2019-06-19 10:30:41 +08:00
Kevin Eady
c002cdd5c3 Remove osmodule includes 2019-03-15 00:58:55 +01:00
Kevin Eady
44f2ebbe90 Refactor to make os_module private in UOExecutor 2019-03-11 21:37:51 +01:00
turleypol
395083a31c memoryestimation did not add the module cost per executor
added EstimateSize util.em function returns estimated memorysize in
bytes of given argument. (docs to be done)
2019-02-01 23:18:43 +01:00
turleypol
f4ae345155 If a unicode string is detected as param sysmsg etc module functions
automatically use the unicode replacement
2019-01-03 22:14:10 +01:00
turleypol
6fd2883182 cleanup of char profile pkt 2019-01-03 11:39:59 +01:00
turleypol
cc27bb611f removed last usage of convertUCtoArray 2019-01-03 11:00:46 +01:00