Commit graph

12 commits

Author SHA1 Message Date
Daniel Stratton
41216827f3 Add onGumpPress event and update existing scripts 2025-11-10 07:42:57 +10:00
strattond
36d6c0745a Revert "Use BaseObject instead of Character | Item where appropriate"
This reverts commit 0c870a5c92.
2025-08-13 15:01:25 +10:00
strattond
0c870a5c92 Use BaseObject instead of Character | Item where appropriate 2025-08-13 14:58:43 +10:00
strattond
9ded72183c Remove context restore functions 2025-08-13 14:55:28 +10:00
strattond
bf1a5ae360 Add JSDoc for command registration 2025-08-13 14:49:57 +10:00
strattond
5aecf0ba81 More event return validation 2025-08-12 16:45:07 +10:00
strattond
faf7b4672a Fix two events. Update JSDoc for the scripts 2025-08-12 11:31:41 +10:00
strattond
6a53759445 Fix TriggerEvent definition. Add ts check to every script 2025-08-06 20:37:11 +10:00
Xoduz
e38be292e3 0.99.6d
Cleaned up an issue with last commit where wrong npclists were used in some spawn regions
Made a few additional adjustments to the new spawn regions in Lost Lands/New Haven
Included more changes related to poison updates that should've been in previous commit (like the complete UOX.INI support for POISONCORROSIONSYSTEM setting)
Adjusted region setup for New Haven to set the individual "building" regions within as a sub-region of the main town (regions.dfn)
Fixed an issue where the displayed HP of an equipped item would not update correctly
Further updates to convert timers 32-bit to 64-bit. This affects and addresses some potential issues with: Character creation/NPC guild-join timestamps, NPC movement, combat timers, idle timeouts, item decay, spellcasting
Added support for new JS Events that can trigger from global script, and can be used to store persistent custom entries in players' paperdoll profiles:
	onProfileRequest( socket, profileOwnerChar ) - Triggers when client requests data for a paperdoll profile
	onProfileUpdate( socket, updatedText ) - Triggers when client sends updated data from paperdoll profile
Added two new helper functions in code that allows faster (but very slightly less accurate) distance checks between two points: 	GetApproxDist( Point3_st a, Point3_st b )
	GetApproxDist( CBaseObject *a, CBaseObject *b )
Improved pathfinding for NPCs attempting to follow another character, by adopting a system of weighted variables to help the NPC determine when to recalculate the path vs when to stick with the old, combined with faster distance checks via GetApproxDist(). The end result of this is faster, smarter and more responsive NPC followers and NPC opponents in combat. The variables influencing this include: how far the target has moved from last pathfind target location, whether NPC is heading in the overall right direction or not, time since last path calculation and some small randomization to avoid edge case jitters.
Updated default command levels in commands.dfn, code and scripts to support the Seer role and make space for some custom roles. These are the new defaults as listed in commands.dfn, which should not be changed as they are linked to specific enums in code. Do take note that this might invalidate command levels for existing GMs/Seers/Counselors, who might need another round of 'make gm/seer/cns from an admin:
	ADMIN - command level 10
	GM - command level 9
	SEER - command level 7
	CNS - command level 4
	PLAYER - command level 0
Updated how UOX3 makes use of the account-level flags 0x2000 (Seer) and 0x4000 (Counselor). If either of these flags are set on an account, all new characters created on the accounts will automatically receive the relevant command privileges.
Fixed an issue with 'wholist command that prevented admin characters from seeing characters with lower privilege levels in the list (js/commands/wholist.js)
Fixed an issue with hiding/GM hide that prevented admin characters from seeing hidden characters with lower privilege levels in the world
UOX3 now includes the cross-platform, header-only utf8cpp library found at https://github.com/nemtrif/utfcpp and freely available under Boost Software License v1.0. The immediate use-case for this is in code right now is to better handle strings related to custom paperdoll profiles, but will also look to make more heavy use of this in future updates
2025-06-28 22:37:42 +08:00
Xoduz
a140199853 Minor pathfinding revamp plus misc fixes
Updated target-based 'wipe command to also affect valid NPCs (non-invulnerable, non-pets) (js/commands/wipe.js)
	NPC admin gump (js/commands/wholist.js) will now force-refresh on next open after NPCs have been removed via the remove button in the menu
	Spawn Object admin gump (js/commands/spawnadmin.js) will now force-refresh on next open after spawn objects have been removed via the remove button in the menu
	Added three new GM commands (js/commands/targeting/xwalk.js) that can be used to control NPCs remotely:
		'xwalk	// Makes targeted NPC pathfind and walk to target location
		'xrun	// Makes targeted NPC pathfind and run to target location
		'xturn	// Makes targeted NPC turn towards target location
	Updated AdvancedPathfinding() in movement.cpp to include two optional parameters
		allowPartial // if true, move even if calculated path is blocked, until blocked (defaults to false)
		ignoreDoors // if true, ignore doors during pathfinding calculations and calculate the path is if the door was not there (defaults to false)
	Updated .WalkTo() and .RunTo() JS Character Methods to support the two additional pathfinding parameters, and also to support maxSteps values beyond 255
	Updated pathfinding heuristic from Manhattan (4-way) to Octile (8-way) distance for improved pathfinding accuracy and increased performance with diagonal movement
	In some situations, UOX3 will now calculate a new partial path for NPCs who failed to follow their assigned path, to get them closer to their final destination
	Optimized pathfinding logic for NPCs following a target (like pets/hirelings, or NPCs in combat), to reduce the amount of pathfinding calculations required when target is moving. The NPCs will now keep track of the general direction towards their target, and if the NPCs are already heading in the right direction, they'll  keep going as long as they have a path left to follow or until direction towards target has changed. This also eliminates a problem where NPCs would stick to their path until they reach the end, even if target has gone in a different direction.
	Updated logic for how NPCs turn during pathfinding. Instead of adding an extra "push" for direction into the calculated path itself to ensure NPC will both turn and move in that direction, which allowed some inaccuracies to creep into the calculated paths, that extra push is now handled while NPC is executing the path instead, whenever direction changes are needed
	Partial pathfinding is now enabled for fleeing NPCs by default, to increase their chances of getting further away from their opponent in combat
	Partial pathfinding is now enabled for NPCs in water by default, to allow them to get as close as possible to their opponent in combat
	Fixed an issue where NPC movement speeds would misbehave at certain speeds where the calculated movement time would get rounded down to zero
	NPCs will now play a fidgeting animation if they've remained motionless for 3 seconds or more while not in a state of actively trying to move/pathfind
	Increased max pathfinding steps for NPCs in combat from 50 to 75
	Fixed an issue where NPCs would stop and wait when they should have been moving, after successful pathfinding calculation
	Fixed an issue where NPCs that ignore a target and enter evade state would not leave combat
	Added two new JS Character properties that can be used to evaluate pathfinding success (for instance in combination with onPathFindEnd Event), and/or opens for manipulating pathfinding target locations via scripts:
		.pathTargX // Current NPC pathfinding target, X coordinate
		.pathTargY // Current NPC pathfinding target, Y coordinate
2025-05-05 00:03:09 +08:00
Xoduz
15da92aca2 Last batch of fixes for this PR
Fixes for updated wholist/spawnadmin menu crashing under certain circumstances using regular UO client
Updated logging of CPCharAndStartLoc packet to account for both old and new version of packet
Reloading Spawn Regions via 'reloadspawnregions JS command will now do a full reload from the DFN files (previously needed manual DFN reload before spawn region reload)
Reloading DFNs via 'reloaddfns JS command will now also reload creatures.dfn, titles.dfn, location.dfn
Reloading ALL via 'reloadall JS command will now also reload teleport.scp, creatures.dfn, titles.dfn, location.dfn
2025-04-29 09:34:51 +08:00
Xoduz
b129521c9e Wholist updated, menus to manage npcs and spawn objects, misc
Revamped 'wholist GM command entirely in JS, now comes with filters for names, online/offline status, sorting by name or last online date, quick-buttons to tweak/teleport/inspect, etc. Updated syntax:
	'wholist [on]
	'wholist off
	'wholist force
	Also available under alias 'playeradmin, with the same parameters
Added new JS command for GMs to assist managing NPCs, using updated wholist menu as basis: 'npcadmin
Added new JS command for GMs to assist managing object-based Spawners, using updated wholist menu as basis: 'spawnadmin
Exposed the following character properties to JS engine:
	.lastOn // String-formatted timestamp of last time character was oniline
	.lastOnSecs // Timestamp of last time character was online, expressed as seconds since Unix epoch
Added some validation (and re-synching) of lastOn vs lastOnSecs player character properties - only active when running in debug mode
Updated onBoatTurn JS Event to support a 4th parameter - a reference to the boat's tillerman:
	onBoatTurn( iBoat, oldDir, newDir, iTiller )
Added (missing from last commit) JS Method for boats to fetch tillerman reference: .GetTiller()
Updated JS Docs with details about onBoatTurn JS event, .GetTiller() method and .lastOn/.lastOnSecs properties
Added some console output with details about time taken for each regionspawn cycle
Added some new tiledata override entries for some tiles (stairs/platforms) missing NoShoot flag in some older clients (dfndata/maps/tiles.dfn)
2025-04-27 09:18:09 +08:00