Commit graph

78 commits

Author SHA1 Message Date
Xoduz
3ffbb2b07a Misc fixes for stablemaster script
Fixed status window sex flag not being correctly sent for player characters of a Gargoyle nature (Dragon Slayer)
Fixed some issues with static pet scripts (js/npc/pets/*) that would allow players to exceed max number of followers and/or controlslots when buying animals from animal trainer
Updated OnBuyFromVendor, onBoughtFromVendor, onSellToVendor and onSoldToVendor JS Events to include a fourth parameter - iAmount - the number of items bought/sold
Fixed some issues with stabling and claiming pets from animal trainer NPCs (js/npc/ai/stablemaster.js)
2023-05-30 08:14:36 +08:00
Xoduz
1efce7c7d1 Couple of minor changes 2023-05-30 02:05:37 +08:00
Xoduz
fa2aae242e UOX3 0.99.6-RC4
Fixed an issue that prevented onBuyFromVendor() and onBoughtFromVendor() JS Events from triggering when attached to NPC shopkeepers
Fixed an issue with help gump that prevented password management section from working as intended (js/server/misc/helpgump.js)
Fixed an issue where UOX3 would fail to load pre-HS multi.mul files
Added chess board to Misc->Games add menu (dfndata/items/ItemMenu.bulk.dfn)
Fixed an issue with 'move (alias for 'telestuff) command that referenced the wrong variable name (js/commands/targeting/tele.js)
When a player is teleported via the GM 'wholist menu, any pets within range are now also brought along for the ride
Consolidated error-reporting for JS Functions, Object Methods and Object Properties to provide more context (scriptID, filename, line number) when something goes wrong
Added some missing shield IDs (0xA649, 0xA64A, 0xA831, 0xA832) to IsShieldType() function
MAXRANGE item property previously only worked for ranged weapons; now it works for melee weapons too, and potentially allows melee weapons with combat range longer than 1 tile
MAXRANGE item property can now be used to define max combat range for melee weapons
Fixed an issue (non-critical) with .PlaceInPack() JS Method that would cause UOX3 to try adding items marked for deletion to refreshQueue and spam console with errors
Added missing AI scripts to summoned Blade Spirits and Energy Vortexes (dfndata/npc/magicsummon.dfn)
Fixed an issue with weight calculation for hireling backpacks (js/npc/ai/hireling.js)
Fixed an issue with the 'fix command, which would in most cases set character's Z to -1 regardless of location, but now adheres to map elevation instead
Fixed an issue with Pack AI (js/npc/ai/pack_ai.js) that prevented pack members from attacking target correctly (thanks Dragon Slayer)
Fixed an issue with DoesMapBlock JS Function that incorrectly checked for 6 function arguments, when it actually requires 8
Fixed an issue with DoesDynamicBlock JS Function that incorrectly checked for 8 function arguments, when it actually requires 9
Fixed an issue with runebook script (js/item/runebook.js) that prevented players from being able to use recall charges without having spellbook with spell in inventory
Fixed issues with placement of tall items on ground/floor, and with stacking of items in houses
Fixed incorrect alias for woodland armor (dfndata/items/gear/armor/other/armor/wood.dfn - thanks Dragon Slayer)
Fixed a critical issue with script context sometimes changing while executing a script, because of events in other scripts being triggered. Affected scripts can be safeguarded against this by the addition of a dummy callback function anywhere in the script: function _restorecontext_() {}
Fixed an issue with non-animal pets not gaining loyalty when being fed (thanks Dragon Slayer)
Added new JS Object Methods for Chars/Items/Multis to fetch list of custom tags associated with object:
	.GetTagMap()		// Gets list of persistent custom tags associated with object
	.GetTempTagMap()	// Gets list of temporary custom tags associated with object
Added new JS commands ('GETTAGMAP and 'GETTEMPTAGMAP) that spits out details of custom tags associated with targeted object (js/commands/custom/misc-cmd.js)
Added new JS command ('USEITEM) that acts as a short-cut for double-clicking on targeted item (js/commands/custom/misc-cmd.js)
Updated 'ADD # and 'ADD ITEM # JS commands to support targeting a container directly and adding the new item inside (js/commands/targeting/add.js)
Updated axe script to only perform lumberjacking skill-check when there's still wood available in a given area, and to play appropriate animations for Gargoyle players (js/item/axe.js)
Updated script for gameboards to make generated pieces newbiefied so they won't appear on ground if board decays (js/item/gameboards.js)
Updated script for stablemasters to avoid relying on global variables (js/npc/ai/stablemaster.js)
Updated names of items crafted with runic hammers to include the material name of the hammers used to craft them (js/skill/craft/crafting_complete.js)
Fixed a small issue with Detect Hidden skill that would return the wrong message if players found anyone hiding nearby (js/skill/detecthidden.js)
Fixed an issue that prevented tile overrides in dfndata/maps/tiles.dfn from loading properly
Added entries for a couple of walls with missing no-shoot flags to tile overrides in dfndata/maps/tiles.dfn
Updated JS Method .SoundEffect() to support optional third argument (creatureSoundNum) to play creature-defined sounds from dfndata/creatures/creatures.dfn. New syntax:
	.SoundEffect( soundID, allHear[, creatureSoundNum] ) // 0=SOUND_STARTATTACK, 1=SOUND_IDLE, 2=SOUND_ATTACK, 3=SOUND_DEFEND, 4=SOUND_DIE
Added new Character JS Methods:
	.SetRandomName( nameListID ) 	// apply a random name from specified namelist to character
	.FindItemSection( sectionID ) 	// find item in player's backpack with specified sectionID
Added new Socket JS Method:
	.OpenContainer()	// Opens specified container for socket
2023-05-30 01:47:26 +08:00
Xoduz
2958e34dbb Updates to PvP ruleset script and associated changes
Added initial pass for supporting Trammel PvP ruleset, which can be applied to and/or customized per facet and optionally overridden per region via js/server/misc/facetRulset.js (Dragon Slayer)
Misc script cleanup and extension of pvp ruleset script to include target handling for Blade Spirits/Energy Vortex, as well as the Provoke barding skill (Xuri)
Added custom AI scripts for summoned Blade Spirits (js/npc/ai/summon/blade_spirit.js) and Energy Vortexes (js/npc/ai/summon/energy_vortex.js) with updated target selection rules (based on target stats) and checks for active pvp ruleset (Xuri)
Added JS Function to check for existence of a JS event in another file (Xuri):
	DoesEventExist( scriptID, eventToCheck )
Updated scripted magic spells to check for facet ruleset before allowing casting hostile and/or beneficial spells on other players (Xuri)
Added new JS Method for Guilds to check if they are "at peace", i.e. NOT at war with any other guilds (Xuri):
	.IsAtPeace()	// Returns true if guild is at peace, and not at war with any other guilds
Added support for triggering onPickup JS event for Characters, and not just items (Xuri)
2023-05-21 02:14:17 +08:00
Xoduz
b5a7ee9000 BOD System
Created framework, gumps, initial system for Bulk Order Deeds (Dragon Slayer)
Expanded BOD system to include gold, fame and special item rewards (Xuri)
Added optional support for triggering BOD offers from shopkeepers via context menus (Xuri)
Added new UOX.INI section with settings for Bulk Order System: (Xuri)
	OFFERBODSFROMITEMSALES=1 	// If enabled, shopkeepers might offer BODs when players sell items to them
	OFFERBODSFROMCONTEXTMENU=0 	// If enabled, shopkeepers might offer BODs via context menu option
	BODSFROMCRAFTEDITEMSONLY=0 	// If enabled, only selling of crafted items will trigger BOD offers
	BODGOLDREWARDMULTIPLIER=1 	// Reward multiplier for Gold given for completing a BODs - defaults to 1.0
	BODFAMEREWARDMULTIPLIER=1 	// Reward multiplier for Fame given for completing a BOD - defaults to 1.0
Updated smithing-related create DFNs (dfndata/create/*) with proper names for entries (Xuri)
Added special BOD item rewards: (Xuri)
	Sturdy Pickaxe - More uses than normal pickaxes
	Sturdy Shovel - More uses than normal shovels
	Mining Gloves +1/+3/+5 - Boosts mining skill when equipped
	Runic Hammers - Adds bonuses to crafted weapons and armors, applied after crafting the items (js/skill/craft/crafting_complete.js)
	Colored Anvils - No unique property other than color, but can be added to houses as decoration/functional anvils
	Ancient Smithy Hammers +10/+15/+30/+60 - Boosts blacksmithy skill when equipped
	(Not fully implemented, AoS feature) Gargoyle's Pickaxe
	(Not fully implemented, AoS feature) Prospector's Tool
	(Not fully implemented, AoS feature) Powder of Temperament
	(Not fully implemented, AoS feature) Blacksmith Power Scrolls +5/+10/+15/+20
Updated onMakeItem() JS event to always include the create entry ID as a parameter, even when crafting an item failed (Xuri)
2023-03-17 15:51:56 +08:00
Xoduz
6282f976cf Fixes for issues that can lead to server crashes
Fixed an issue where EraStringToNum JS Function would return incorrect values and lead to unexpected behaviour
Added some safeguards against server crashes in onNameRequest() and onTooltip() JS Events
2023-03-10 22:38:53 +08:00
Xoduz
b27d60c1b8 UOX3 0.99.6-RC3
Updated Item DFNs with ORIGIN and SECTIONID tags for relevant items
Added JS Function to make comparing eras (based on object origin or server settings) easier:
	EraStringToNum( eraString )	// Takes an era string (uo, t2a, uor, td, lbr, aos, etc) and returns an int
Updated some JS scripts to use EraStringToNum() for era comparisons (potionkeg.js)
Default CORESHARDERA setting is now LBR
Removed PUB15 as a separate "era" - it's identical to late stage LBR anyway:
	Removed support for GETPUB15 tag
Added support for GETUO tag for items/NPCs:
	GETUO=<sectionID>		// Inherit DFN section if core shard era is Ultima Online (original release, before T2A)
Rewrote portions of MsgBoardQuestEscortCreate() function in msgboard.cpp to ensure only escort regions within same world as NPC can be selected as destinations
Increased maximum number of possible escort regions that can exist from 255 to 65535
Added region definitions for all shrines in Britannia (Fel & Trammel), and marked them as valid destinations for NPC escorts (uox3/regions/regions.dfn)
Moved bankers from vendor to human DFN files, and made them inherit basehuman instead of basevendor - since they are not vendors
To address an issue with escorted NPCs not timing out and vanishing if they are left in a "dormant" area of the world with no player activity, the NPCs are marked as "always awake" the moment they arrive at their destination. Note that the uox.ini setting ALLOWAWAKENPCS needs to be enabled for this to work.
Fixed an issue where spawnsection of spawners did not show up correctly in tweak menu
Fixed an issue where the generic Orc AI script didn't have a return true at end of onDamage() event, which prevented all orcs from taking damage in combat (js/npc/ai/monster/orc.js)
Moved Anatomy skill-check in healing script (js/skill/healing.js) from onCallback1() function to onTimer() to prevent the skill-check from being spammable
Added mount ID for Frost Mite in creatures.dfn, allowing it to be used as mount
Exposed the following character properties to JS engine, which can be used to view/adjust the permanent hair/beard options for a character:
	.hairStyle
	.hairColour
	.beardStyle
	.beardColour
Updated 'kill hair, 'shavehair, 'shavebeard and 'remove commands to clear permanent hair/beard colour and style properties in addition to removing the item itself
Added a GM override to let GMs place as many houses as they want (js/server/house/houseDeed.js)
Fixed an issue where attempting to sell items to NPC shopkeepers could result in client crashing
Added a new JS Event:
	onMultiLogout( iMulti, cPlayer ) 	// Handles players logging out while inside multis
Updated house script (js/server/house/house.js) with onMultiLogout event, which allows owners (always) and co-owners/friends/guests (if option enabled in uox.ini) to safely log out inside the house (without getting booted).
Added a "keyless" option for interacting with locked doors (js/item/doors.js) of player-owned houses, which lets owners/co-owners/friends/guests of a house use locked doors in the house without requiring a key in their backpack, if the options for that are enabled in UOX.INI. Enabled for owners/co-owners and friends by default (but not for guests)
	Note that if option to safely log out is enabled, but keyless option is NOT enabled, then the server will check if the player has a key to the house in their backpack, and eject them from the house upon logging out if not. This is to make sure players don't get stuck inside a house they can't get out of because they lack the rights to open doors etc.
Added new UOX.INI options, under the [houses] section:
	SAFECOOWNERLOGOUT=1 	// Allow co-owners to safely and instantly log out inside house
	SAFEFRIENDLOGOUT=1 		// Allow friends to safely and instantly log out inside house
	SAFEGUESTLOGOUT=1 		// Allow guests to safely and instantly log out inside house
	KEYLESSOWNERACCESS=1 	// Allow owner of house to use locked doors in house without key in pack
	KEYLESSCOOWNERACCESS=1 	// Allow co-owners of house to use locked doors in house without key in pack
	KEYLESSFRIENDACCESS=1 	// Allow friends of house to use locked doors in house without key in pack
	KEYLESSGUESTACCESS=0 	// Allow guests of house to use locked doors in house without key in pack
Fixed NOHAIR tag from races.dfn not being loaded correctly
2023-03-04 22:50:55 +08:00
Xoduz
61a2da3501 Misc updates
Extended GetSpawnRegion JS Function to fetch spawn region reference based on a set of coordinates. Supported syntax are now:
	GetSpawnRegion( spawnRegionID )
	GetSpawnRegion( x, y, worldNum, instanceID )
Added new DFN tags for Items and NPC:
	SECTIONID	// Override which [sectionID] is stored for an object
	ORIGIN		// Store reference to which expansion/era of UO an item/NPC originated in
Added new Item/Character JS property:
	.origin 	// Get reference to expansion/era of UO an item/NPC originated in
Fixed an issue with IsInBuilding JS Function which could only handled a limited subset of instance ID values
Corrected name of tag used to attach scripts to ore types - from SCRIPTID to SCRIPT
2022-12-31 18:07:42 +08:00
Xoduz
c531a39b4d Misc updates
Updated dictionary files,
Fixed a bug with the potionKeg script
Fixed an issue with onToolTip function introduced with previous commit
2022-11-27 14:59:31 +08:00
Xoduz
1af502e837 Potion Keg stuff
Implemented potion kegs; these can be crafted by carpenters/tinkerers, and can be used to store potions at a fraction of their original weight (Dragon Slayer)
Only the owner (if locked down), the current holder (if in backpack) or someone who have previously taste identified a potion keg may add additional potions to it (Xuri)
Potions dropped from monsters and bought from stores are unidentified by default, but can be identified by players using the taste identification skill. (Xuri)
Potions crafted by players are identified by default for all to see (Xuri)
Releasing locked down items in houses now set the items as movable (1) instead of client default (0) (Xuri)
Added socket as another parameter to the onToolTip JS event
2022-11-27 14:09:35 +08:00
Xoduz
0ce39a3410 Couple of small fixes
Fixed an issue with onDyeTarget event where the dyetub and target object parameters were not set properly
Fixed some incorrect casting animation-related variable assignments for AI_HEALER and AI_EVIL_HEALER
Fixed an issue with pets not going wild from lack of loyalty to their owners when at zero loyalty
Addressed issues with idle/fidget animation setup that could cause NPCs to blink out of existence
Removed stray semicolon behind control statement related to triggering of OnFacetChange JS event
Fixed an issue with Bless spell when cast from item
Some minor code cleanup
2022-10-27 00:54:41 +08:00
Xoduz
37a76083de Rest of the changes for 0.99.6-RC1
Misc cleanup and standardization of style and naming conventions in code and scripts
Added missing code for showing race in paperdoll based on ini setting
Players can no longer use Polymorph spell while incognitoed, or while under effect of tribal paint
Players can no longer use Incognito spell while polymorphed, or while under the effects of tribal paint
Facial hair is now removed from players who are under the effects of Incognito spell that changes their gender for female
2022-10-24 18:39:33 +08:00
Xoduz
101ceb679c New JS stuff, creating multis from scripts
Added new JS Events:
	onCarveCorpse( pUser, iCorpse )				// Triggers for iCorpse when being carved by pUser
	onFacetChange( mChar, oldFacet, newFacet ) 	// Triggers for character when moving between facets
	onDyeTarget( pUser, dyeTub, targItem ) 		// Triggers for dyeTub when player tries dying an item
Added new JS Functions to create houses (from house.dfn) and base multis (using raw multi IDs):
	CreateHouse( houseID, x, y, z, worldNum, instanceID );
	CreateBaseMulti( multiID, x, y, z, worldNum, instanceID );
Added new JS Character/Item Method:
	.HasScriptTrigger( scriptID )	// Returns true if script with scriptID is present on object
Added new JS commands for GMs in js/commands/custom/misc-cmd.js
	'addhouse houseID 	// Add house from house.dfn at target location
	'addmulti multiID 	// Add base multi from client multi files at target location
2022-10-20 05:12:13 +08:00
Xoduz
94233bfd52 Fix for help menu script - UOX3 0.99.5b-7
Fixed a missing definition for GetStartTime JS function which would cause an error in the help menu script
Tweaked some messages output to the UOX3 console during startup for improved clarity
2022-08-26 23:15:13 +08:00
Charles Kerr
a9c30281ef char* to string 2022-06-15 19:19:40 -04:00
Charles Kerr
01b46f26db STRINGLIST modernization
NOte, many method calls are passing copies of collections. Did not change, as that could change functionality (unlikely), but this is a syntax only exerersize.

Just changing value (copes) to reference (and provide a const/nonconst method) would see a  noticeable speed difference.
2022-06-06 11:27:53 -04:00
Charles Kerr
d90e16af86 changed defined FALSE/TRUE to intrinsic false/true 2022-06-06 03:55:13 -04:00
Charles Kerr
ba5a763033 Warning changes 2022-03-05 09:12:21 -05:00
Charles Kerr
d540835eb4 2022 project filters, and name change for strutil 2022-03-04 07:35:46 -05:00
Xoduz
f0323918fb Help Menu Revamp
Added JS-based help menu accessible via character paperdoll, with modernized style and UI, ability for players to change their password
Minor cleanup and addition of a few extra features to help menu, like a safe teleport option for players who are potentially stuck, updated server info details and integration with UOX3's existing GM paging system as support options (Xuri)
Added new JS functions to retrieve server data used for server stats in help menu:
	GetItemCount()				// Gets number of items on server
	GetMultiCount() 			// Gets number of multis on server
	GetCharacterCount()			// Gets number of characters on server
	GetServerVersionString() 	// Gets server version as a string
Added new UOX.INI settings to control safe teleport for stuck players via the Help menu in Paperdoll:
	MAXSAFETELEPORTSPERDAY=1 		// Max teleports per day, defaults to 1
	TELEPORTNEARESTSAFELOC=1 		// Teleport player to nearest safe location (1) or random safe location (0)
2022-02-26 07:26:47 +08:00
Xoduz
85e33d8a46 UOX3 0.99.5b
Fixed an issue where karma titles would inadvertently have the space behind the title trimmed before being displayed in paperdoll, resulting in erroneous display of title + name there
Fixed an issue with a cooking script (js/skill/cooking/cooking.js) where sweet dough would not get consumed properly on cooking (Dragon Slayer)
Updated C++ function calcRegionFromXY to work with CBaseObject instead of CChar, so it also works for Items
Items now have current town region stored as an object property during runtime. This is calculated on load, when container property is updated, and when an item is picked up or dropped. The region is also accessible via the (read-only) JS Item property .region
Added new JS Event to allow capturing button presses from the old-school gump displayed by client via packet 0x76, which was originally used by the old-school crafting menus in T2A. The requirement for this to work is that the gump in question must have a gumpID between 0x4000 and 0xffff (which can be set when manually creating a packet with this ID via JS), and the Event itself must be in the global script:
	onScrollingGumpPress( pSock, gumpID, buttonID )
Added new JS Event to allow better control over which names UOX3 sends to the client for characters:
	onNameRequest( myObj, requestedBy )	// return custom string, or return empty string/nothing/true/false to use default name
Updated JS Events to also work for Items (previously only worked for Characters)
	onLightChange( myObj, lightLevel )
	onTempChange( myObj, temp )
	onWeatherChange( myObj, weatherType )
Adjusted default temperature for town regions with no weather systems defined from 0 to 20 degrees Celsius
Updated some JS scripts (fishing.js, baking.js and cooking.js) to make use of GetTempTag/SetTempTag rather than GetTag/SetTag
Added cancel-checks to targeting functions in command script for add-commands (js/commands/targeting/add.js)
Updated get command script (js/commands/targeting/get.js) to allow retrieving region ID and name using 'get region
Updated misc command script (js/commands/custom/misc-cmd.js) to add 'gettemptag and 'settemptag commands, used to retrieve/set temporary custom tags from/on objects
Fixed a bug where Spirit Speak skill would be checked for race languages even if the race had LANGUAGEMIN defined as 0 (or not defined at all)
Fixed an issue where players using regular UO client would get stuck in a black void after teleporting between worlds, by adding an additional character refresh after the teleport
Fixed an issue where crafting tools for Blacksmithing and Carpentry would attempt to fetch the value of an incorrectly named INI setting to handle durability loss for the tools
Added new setting under [settings] section of UOX.INI to control whether it should be possible to craft weapons from coloured ingots or not:
	CRAFTCOLOUREDWEAPONS=0/1 	// If enabled(1), players can craft coloured weapons. Defaults to disabled(0)
Fixed an issue where the correct ingots were not consumed when attempting to craft items using colored ingots
Fixed a rogue debug message leftover in the scissor script
2022-02-13 22:49:37 +08:00
Xoduz
8148b8ccfb 0.99.5a
Improved overall performance of NPC pathfinding (by nearly 60%!) by eliminating some double-work done when checking for blocking dynamics and statics
Optimized how the system for determining which internal map regions should have active NPCs; instead of there always being 9 active map regions surrounding any given player who's online, that number will now vary between 3 to 6 map regions, depending on how far the player is from boundaries between such map regions. This should reduce the amount of NPCs active and trying to pathfind at any given point when players are online.
UOX3 now adapts the time between each time it checks Spawn Regions based on how "full" the Spawn Regions are on average - the nearer they are to max capacity, the longer time between each time Spawn Regions are checked
Fixed an issue with reloading of spawn regions where UOX3 would forget about previously spawned NPCs/Items and respawn everything all over again. As part of the reload process, UOX3 now iterates over previously spawned objects and deletes these where appropriate
Added two new races to races.dfn - Ophidian (RACE 25) and Terathan (RACE 26) - which have been setup as racial enemies
Updated the race ID of relevant Ophidian and Terathan NPCs (dfndata/npc/arachnids.dfn and dfndata/npc/reptiles.dfn)
Added support for NPCs engaging other NPCs in combat if they are marked as racial enemies via races.dfn
Extended the amount of JS events supported by UOX3's JS engine from 96 to 192
Added new JS Event to allow overriding behaviour from Help button in paperdoll:
	onHelpGump( pChar )			// Overrides default gump menu when pressing Help button in paperdoll
Added new JS Event to allow preventing characters from toggling on/off war/combat mode
	onWarModeToggle( p Char )	// return false to prevent war mode toggle
Added new JS Event to allow overriding target selection in combat for default AI behaviours:
	onAICombatTarget( pAttacker, pTarget ) // return true to select current target, or false to skip and look for another
Updated JS onDamage() JS event to allow returning false to override and prevent damage dealt to a character. Event must now return true to allow damage to go through
Updated JS Event onSwing to work for characters with no weapon equipped (iSwinging will be null, in this case)
Updated JS Object Method .KillTimers() to also work for Characters, not just Items
Added JS script that renders characters it's attached to immune to physical damage (js/npc/special/physical_immunity.js)
Renamed shadow_elemental.js to magical_immunity.js, as it's generic script that can be attached to any NPC
Added more pre-defined books to dfndata/misc/books.dfn (and dfndata/items/misc/books.dfn):
	A Welcome (a_welcome)			// Book by Blackthorn, dropped as loot by Betrayers
Added definitions for additional NPCs, with scripted special abilities where applicable:
	Orc Brute (orcbrute) 			// Throws Orc Lords, cannot be targeted by provoked creatures
	Orc Chopper (orcchopper)		// Attacks deal AoE damage to nearby targets
	Betrayer (betrayer)				// Colossal Blow (stuns and peacemakes), AoE poison (2m range)
	Golem Controller (m_golemcontroller/f_golemcontroller)
	Golem (golem)					// Colossal Blow (stuns and peacemakes)
	Crafted Golem (craftedgolem)	// Crafted version of golem
	Exodus Overseer (exodusoverseer) // Magical Shield (immune to physical damage until shield down)
	Exodus Minion Lord (exodusminionlord) // Magical Shield (immune to physical damage until shield down)
	Exodus Minion (exodusminion)	// Magical shield (immune to physical damage until shield down), periodic AoE burst
Added script that allows Tinkerers to craft golem followers via Clockwork Assembly items (js/item/clockwork_assembly.js)
Added script for mask of orcish kin, which when worn prevents all orcs from attacking the wearer (js/item/orcish_kin_mask.js)
Added AI script for Exodus clockwork NPCs, which amongst a few other things makes them spawn with a magical shield that prevents physical damage being dealt to them until the shield has been brought down by magic damage (js/npc/ai/monster/exodus_clockwork.js)
Added AI script for orc NPCs which prevent them from attacking characters wearing masks of orcish kin (js/npc/ai/monster/orc.js)
Added AI script for orc brute NPCs, which makes the NPCs toss orc lords (up to 10 in total) when attacked by magic spells (js/npc/ai/monster/orc_brute.js)
Added AI script for orc chopper NPCs, which makes the NPCs hit all nearby valid targets with their melee attacks (js/npc/ai/monster/orc_chopper.js)
Added script for NPC special ability Colossal Blow, which both stuns and adds a temporary peacemaking effect to targets (js/npc/special/colossal_blow.js)
Updated Provocation skill to disallow directing provoked creatures at targets with the custom tag provImmune present
Fixed an issue with initialization of wander areas for NPCs spawned via object spawners, which caused NPCs to not stick to their assigned areas, but wander according to their own free will. Can't have that!
Fixed some issues with itemlists pointing to non-existing items (a turnip and 10 of each magical reagent)
Fixed an issue where information on newly spawned characters would get sent twice to each nearby player
Changed default value of ACCOUNTFLUSH ini setting from 0.0 to 5.0 seconds
Misc minor cleanup of console messages during startup and shutdown
2022-01-24 17:58:19 +08:00
Xoduz
c4dc320719 0.99.5[RC4]
UOX3 now stores a timestamp for when an account receives its first login, which can be accessed via the new (read-only) JS Account Property .firstLogin.
UOX3 now stores a timestamp for when a player character is created, which can be accessed via the new (read-only) JS Character Property .createdOn. For legacy player characters, the creation timestamp is set the first time UOX3 loads the characters after this update.
Fixed an issue on Linux where pressing the arrow keys in the console would cause UOX3 to shut down
Updated UOX3 documentation
2022-01-10 07:33:51 +08:00
Xoduz
3cdd1d35c5 0.99.5[RC3]
Fixed an issue in HandleGumpInput that prevented compiling UOX3 properly on Linux
Added new uox.ini setting that determines if item stats on unidentified magic items are shown or hidden:
	HIDESTATSFORUNKNOWNMAGICITEMS=0/1 // Defaults to 1
Some minor updates to crafting related scripts
2022-01-08 08:24:24 +08:00
Xoduz
31a9e6b1e6 More updates to crafting system
Added new Item DFN tags:
	usesleft=# 	// The current amount of uses remaining for an item with limited use
	maxuses=# 	// The maximum amount of uses for an item with limted use
Added new JS Item properties to match DFN tags:
	.usesLeft
	.maxUses
Updated scripts to make use of .usesLeft property instead of custom "UsesLeft" tag
Updated DFNs to include usesleft and maxuses tags and uses_left_tooltip script for all tools with limited use
Crafting and gathering tools bought from NPC vendors will now support a random and limited amount of uses (between what is defined as "current" and "max" uses)
Crafting and gathering tools created by player crafters will support a limited amount of uses based on the quality of the item crafted
2022-01-01 07:58:45 +01:00
Xoduz
7879af0e18 Updates to crafting PR
Consolidated all blacksmithing menus into one script
Updated all the crafting scripts to reduce duplicate code
Various fixes and updates to crafting-related processes
Updated dictionaries with crafting-related entries
Adjusted maxSkill for Carpentry entries
Enabled Alchemy crafting entries for Explosion and Greater Explosion potions
2021-12-19 17:47:08 +08:00
Xoduz
ce10584755 0.99.4z+++
Added new JS Item Methods to get/set the value (0-255) for specific parts (1-4) of temp variables ("more", "morex", "morey", "morez"):
	.GetMoreVar( moreVarName, moreVarPart )
	.SetMoreVar( moreVarName, moreVarPart, moreVarValue )
Updated Remove Trap script (js/skill/removetrap.js) to make use of GetMoreVar() and SetMoreVar methods
Updated inRange JS event to also trigger for Items with this event attached, when player characters come within update range. Updated syntax:
	inRange( srcItem, pCharInRange )
	inRange( srcChar, objInRange )
When UOX3 retrieves data from the onToolTip() JS event to potentially display custom object tooltips, it will use the ID specified in a temporary JS tag ("tooltipCliloc") on the object as the clilocID being sent to the client with the tooltip text returned from the script. If no such tag exists on the object, it defaults to cliloc ID 1042971.
Added new JS event that triggers _after_ an item has been removed from a container (no return values supported):
	onContRemoveItem( iCont, objRemoved, pChar )
The JS Function SpawnNPC() can now spawn NPCs from NPCLISTS if provided with a boolean parameter flag (useNpcList). Updated syntax:
	CChar SpawnNPC( npcSection/npclist, x, y, z, worldnumber, instanceID, useNpcList )
Added new JS Event to allow detection of movement near an object (items only, for now). Distance at which it triggers determined by part 1 of the item's MORE property. Use long ranges with care! Syntax:
	onMoveDetect( srcObj, pChar, rangeToChar, oldCharX, oldCharY )
Added new JS script (js/server/misc/dungeon_traps.js) for handling trap mechanics in (primarily) dungeons. The traps all trigger on collision, and use different parts of the "morez" property to determine enabled/disabled status, damage, min skill required to disarm, max skill at which player can still gain skill from disarming. Disarming renders trap inactive for 60 seconds. Implemented trap types:
	Spike Traps 		// Active for ~5 seconds after triggered, deals damage every 1 second.
	Giant Spike Trap 	// Active for ~1 second after triggered, deals high instant damage one time
	Saw Traps			// Active for ~5 seconds after triggered, deals damage every 1 second.
	Gas Traps			// Active for ~5 seconds after triggered, applies poison to target every 1 second
	Fire Column Trap 	// Active for ~5 seconds after triggered, deals damage every 1 second after initial delay of 1 second
	Stone Face Traps	// Active for ~3 seconds after triggered, deals damage every 1 second after initial delay of 1 second
	Mushroom Trap 		// Active for ~2 seconds after triggered, applies poison to target every 1 second after an initial delay of 1 second
Added dungeon traps to 'add menu, under Buildings > Decs > Dungeon Traps
Added new commands to make modifying IDs of items (and NPCs) easier:
	'incid #	// Increment/decrement ID of target by specified amount
	'rincid #	// Repeatedly increment/decrement ID of target/multiple targets by specified amount
Updated 'add and 'radd commands with new, optional syntax to make adding trees easier (potentially with GM tools/macros), as it will add both trunk and leaf at same location with a single command:
	'add tree [trunkID] [leafID]
	'radd tree [trunkID] [leafID]
Updated AreaCommand GM command to include support for setting the .decayable property on multiple items at once. Also updated the script with appropriate system messages throughout, which now also show how many items were affected by use of the command
Added new item script (js/item/gate_opener.js) that can be used to make switches/levers raise/lower multiple nearby gates. See script comments for details on setup
Updated various JS scripts that used GetSByte() to retrieve Z of last targeted location from Socket to manually add height of targeted tile for client version below 7.0.9 only
Fixed an issue where items created with 'decorate load command could be set as decayable
Fixed an issue where multiple timers could be running on a single door by manually opening and closing it repeatedly. Closing a door will now kill the associated timer on said door.
Fixed incorrect IDs for secret doors in Item DFNs (they were off by 1, so would not work properly)
Updated name of all secret doors in dfndata/items/building/doors.dfn to inherit name from tiledata instead
Added secret door IDs to dfndata/harditems/harditems.dfn
Item and NPC definitions can now make use of randomization for the ID tag, for more variety. Syntax:
	id=[id1] [id2] [etc] // Example: id=0x0e42 0x0e43
Fixed MORE values of "hard scripted" books in dfndata/items/misc/books.dfn
Added Ice and Fire dungeon locations (dfndata/location/location.dfn) and added these to the GM travel menu (dfndata/item/travelmenu.dfn/travelmenu.bulk.dfn)
Fixed body ID for ancient wyrm NPCs, which also fixes their name (dfndata/npc/dragons.dfn)
Added more pre-defined books to dfndata/misc/books.dfn (and dfndata/items/misc/books.dfn):
	Quest of the Virtues – Volume 1 	// [quest_of_the_virtues_vol1]
	Fropoz's Journal 					// [fropoz_journal]
	Translated Gargoyle Journal 		// [translated_gargoyle_journal]
	Kabur's Journal 					// [kaburs_journal]
Updated code for spawn containers to allow spawning more than one item per container; by default, a spawn container will now spawn every item from an itemlist if set as the spawnobjlist property for that spawn container. These itemlists can contain direct item references, references to other itemlists or even lootlists
Added 4 levels of dungeon treasure chests that can be placed out as spawn objects in dungeons, with items and valuables spawning inside on a regular interval. These can be found in dfndata/items/gmmenu/dungeon_treasure_spawners.dfn, with associated itemlists being found in dfndata/items/itemlists/itemlists.dfn (dungeontreasureloot1, dungeontreasureloot2, dungeontreasureloot3 and dungeontreasureloot4). They can also be located in the 'add menu under GM Menu > Dungeon Treasures
Added spawn regions for dungeon treasure chests in the following areas:
	Covetous, Deceit, Despise, Destard, Fire, Hythloth, Ice, Shame, Wrong, Yew Crypts, Daemon Temple, Trinsic Passage, Cove Orc Fort, Terathan Keep, Vesper Bank, Trinsic Bank
Updated Lockpicking skill to check for the existence of skill difficulty on locks, and use those to perform skill checks when attempting to pick those locks. Difficulty on a lock can be setup using the morey property using this syntax:
	morey=[0x00] [0x00/0x01] [0x##] [0x##] // the first part is unused, the second is used with Unlock spell, the third and fourth are the minimum skill to unlock and the max skill that can be gained from picking the lock
Updated Unlock spell to check for existence of morey property value on lock. If there's a value, and the second part of the value is not 0x01, Unlock cannot be used to unlock the lock. By default, dungeon treasure containers level 1 and 2 are unlockable with the Unlock spell, while levels 3 and 4 are not, and require Lockpicking skill to unlock.
Fixed an issue where player characters would "skip a step" when moving under certain circumstances (like coming out of hiding)
Added new decorations in default world templates for the following areas:
	Covetous, Deceit, Despise, Destard, Fire, Hythloth, Ice, Shame, Wrong, Hedge Maze, Wind (city), Terathan Keep, Orc Caves, Ilshenar facet, Ilshenar dungeons
Updated decorations in default world templates for the following areas:
	All cities in Britannia and the Lost Lands
Updated decorations in default world templates to address issues like missing water/swamp tiles, floor/roof tiles, etc. in various places
Added special behaviours in some areas:
	Lever puzzle in Covetous
	Monster-spawning brazier in Deceit
	Switch/portcullis behaviour in Hedge Maze
Updated teleport.scp with teleport locations for:
	Hedge maze, Hythloth lvl 2 teleport maze, Wrong dungeon, Buccaneer's Den to/from mainland, various Ilshenar teleport locations
Players flagged as criminals or non-innocent aggressors in PvP combat can no longer use public moongates
Pets will now teleport along with the player both when using moongates (public or spell-based), recall, object-based teleporters or hard-defined teleport locations from teleport.scp
2021-11-26 02:19:03 +08:00
Xoduz
ea96763731 Updated JS events, fix for archery fire delay
Updated onStatGained, onStatLoss and onStatChange JS events:
	Additional parameters now supported by events - statGainAmount and statLossAmount
		onStatGained( player, statID, statGainAmount ) 	// statGainAmount is always positive
		onStatLoss( player, statID, statLossAmount ) 	// statLossAmount is always positive
		onStatChange( player, statID, statChangeAmount ) // statChangeAmount can be negative or positive
	The return value from onStatGain and onStatLoss events can now be used to control behaviour:
		return true - stat gain/loss is allowed, and server will go through with the stat update
		return false - stat gain/loss is not allowed, server will prevent the stat update, and will prevent additional scripts with same event and/or hard code from running
	onStatChange will now run as long as onStatGain or onStatLoss events return true, and if those events are not defined
Fixed an issue where Healing script (js/skills/healing.js) would break because Math.Round() was used instead of Math.round() (Thanks, HeyYaNITO!)
Fixed an issue where players would experience higher than expected delays for firing ranged weapons after moving
2021-10-28 16:19:47 +08:00
Xoduz
8ebe05c760 0.99.4y
Shifted [directories] section of UOX.INI further up in the file, to make it easier to find
Added new UOX.INI setting to control for which facets spawn regions are enabled (defaults to none):
	SPAWNREGIONSFACETS=#	// # is a bitmask that determines which facets to enable spawn regions for. Supported values:
		0 = No facets enabled (default)
		1 = Felucca
		2 = Trammel
		4 = Ilshenar
		8 = Malas
		16 = Tokuno
		32 = Ter Mur
			Examples: A value of 1 = only Felucca is enabled, value of 3 = Felucca + Trammel, 10 = Malas + Ilshenar, 63 = all facets enabled, etc.
Added new Admin commands to enable/disable spawn regions in specific facets (note that this does not affect already spawned objects):
	'enablespawns <facetNum/facetName>
	'disablespawns <facetNum/facetName>
Updated CSpawnRegion::doRegionSpawn() function to only spawn objects in spawn region if world associated with spawn region is enabled in SPAWNREGIONSFACET uox.ini setting
The community-based spawn file now comes bundled with UOX3, and shard admins can choose whether to activate the spawns from this file during the welcome gump that pops up first time they log in
Updated main UOX3 docs to add a simple filter feature, to make it easier to find stuff in the docs
2021-10-18 06:18:21 +08:00
Xoduz
f33e37ac06 Updated onSkillGain, onSkillLoss and onSkillChange JS events
Updated onSkillGain, onSkillLoss and onSkillChange JS events:
	Additional parameters now supported by events - skillGainAmount and skillLossAmount
		onSkillGain( player, skillID, skillGainAmount ) 	// skillGainAmount is always positive
		onSkillLoss( player, skillID, skillLossAmount ) 	// skillLossAmount is always positive
		onSkillChange( player, skillID, skillChangeAmount ) // skillChangeAmount can be negative or positive
	The return value from onSkillGain and onSkillLoss events can now be used to control behavior:
		return true - skill gain/loss is allowed, and server will go through with the skill update
		return false - skill gain/loss is not allowed, and server will prevent the skill update, but will not block additional scripts with same event from running
	onSkillChange will now run as long as onSkillGain or onSkillLoss events return true, and if those events are not defined
Updated JS Docs
2021-10-17 08:08:19 +08:00
Xoduz
69a8c090cd 0.99.4x
Fixed an issue where the color of NPC corpse names would not always match up with the NPC's flag color
Fixed a bug where the baseRange and maxRange properties of ranged weapons would not get saved to world files. These values are now saved in the format of RANGE=baseRange,maxRange
Changed the way items are added to containers, to ensure that the order in which the items are displayed to the player always reflects the order in which they were added; now the most recent item added/moved in a container will always be rendered on top of older items.
Made adjustments to how items are randomly added to containers; should use more of a given container gump's available area now
Exposed Item property to JS engine, which contains serial of the creator of an item:
	.creator 	// contains serial of the creator of an item. If set, maker's marks will show up in the item's tooltip
Fixed an issue where JS engine would lose track of script context if one script used CreateDFNItem() or SpawnNPC() functions and the new objects had events that triggered upon creation. UOX3 now restores the original script context at the tail end of these functions.
Added new JS Event to allow inserting custom tooltip text for objects, which will be displayed in tooltips right after the object name. Any text returned from the event will be displayed, and the text can make use of the same HTML tags as gumps to make changes to color, font, etc.
	onTooltip( myObj ) 		// Triggers for objects right before the object's tooltip properties are sent to client
Updated 'tweak and 'set commands to refresh item being modified if movable state of item changes, so the change is reflected in nearby clients
Fixed an issue with NPC vendors and items bought from players not being properly removed from the vendor's "bought container" when players buy them again
Ported Item Identification skill from code to JS (js/skill/itemid.js) and removed hard-coded version
Implemented magic item generator in JS (js/item/magic_item.js). When this script is attached to an NPC, it has a chance to generate magic weapons, armors, wands/staffs and rings as loot on the NPC's corpse when slain. The chance of getting quality magical items increases with the fame level of the NPC in question. The types of magical items generated follows the pattern of such items as implemented in UO prior to the AoS expansion.
	Examples:
		exceedingly accurate war hammer of vanquishing
		substantial, accurate axe of power and Daemon's Breath
		silver long sword
		massive platemail arms of Protection
		metal shield of defense
		durable ringmail tunic of guarding
	All magic items have a chance to have spell effects attached (with rings/wands being guaranteed to have these), with a limited amount of charges available. For weapons, these effects activate on successful hits in combat, while for armors they activate on equip, and then periodically as long as the item is worn. Rings and wands/staffs have to be manually activated and targeted - with the exception of rings of invisibility, which activate the moment you equip them!
	Related scripts:
		js/item/magic_armor_equipeffects.js
		js/item/magic_weapon_accbonus.js
		js/item/magic_weapon_equip.js
		js/item/magic_weapon_spell_attack.js
	The magic item loot generation script has been attached to a number of different NPCs, all of which now have a chance to drop magic items as loot when defeated.
A bonus magical item - the glacial staff - has also been implemented (js/item/magic_glacial_staff.js), and has a chance to drop as loot from Giant Ice Serpents!
Fixed an issue with CustomTarget where the target message would not be displayed if the cursorType parameter was provided
Fixed bug with 'rename command, which referenced a non-existing variable that caused a script crash
Added additional object properties to 'get and 'set commands:
	.shouldSave 		// Determines if an item should be saved in worldfiles or not
	.baseRange 			// Determines the base range of a ranged weapon, less than which it becomes less effective
	.maxRange 			// Determines the max range of a ranged weapon, beyond which it cannot reach its target
The feature that allows stats like Strength, Dexterity and Intelligence to provide bonuses to skill checks has been turned into a UOX.INI setting, which is disabled by default. The bonuses have also been nerfed; they will no longer contribute more to the success of a skill check than the actual skill being checked!
	STATSAFFECTSKILLCHECKS=0/1 	// If enabled, stats can provide bonuses to skill checks based on the weighting for those stats as setup in dfndata/skills/skills.dfn
Updated damage tracking code to include the type of damage that was dealt (PHYSICAl vs HEAT vs COLD, etc)
Updated Character JS Method Damage() to include a new parameter that can specify the type of damage that was dealt to the character. The new parameter must always be included if other optional parameters are used. Note that updates might be required for scripts making use of this method.Updated syntax:
	.Damage( amount )
	.Damage( amount, damageType )
	.Damage( amount, damageType, attacker )
	.Damage( amount, damageType, attacker, doRepsys )
	Supported damageTypes:
		PHYSICAL 	= 1
		LIGHT 		= 2
		RAIN 		= 3
		COLD 		= 4
		HEAT 		= 5
		LIGHTNING 	= 6 // magic damage
		POISON 		= 7
		SNOW 		= 8
Updated JS Event OnDamage to include an additional parameter that describes the type of damage that was dealt. New syntax:
	onDamage( damaged, attacker, damageValue, damageType )
Updated JS Event OnSpellTarget to allow rejecting a spell being cast on a target by returning a value of 2 from the script
Split the character priv flag for magic reflection into a temporary one (one-time magic reflection spell) and a permanent one (innate permanent reflection ability). The temporary effect is put in place by Magic Reflection spell, and is removed after a successful spell reflect. The permanent one is an innate ability of a character and is not removed even after a spell is reflected.
Added new Character JS property to get/set state of a character's permanent magic reflect ability:
	.permanentMagicReflect 		// 0 = disable, 1 = enable
Added special abilities/effects for the following NPCs:
	Acid Elementals now have a chance to damage the melee weapons of their attackers
	Dull Copper Elementals now explode on death
	Shadow Iron Elemental is immune to targeted spell damage
	Copper Elementals have permanent magic reflect, and reflect some physical damage back at their attacker
	Bronze Elementals deal passive area damage to nearby players every 5 to 10 seconds
	Valorite Elementals have permanent magic reflect, reflect some physical damage back at their attacker
	Snow/Ice Elementals deal passive area damage to nearby players every 5 to 10 seconds
	Lava Serpents deal passive area damage to nearby players every 5 to 10 seconds
	Phoenixes deal passive area damage to nearby players every 5 to 10 seconds
	Pixies have a chance to cast a random spell upon receiving a death blow:
		Bless (target)
		Curse (target)
		Explosion (target)
		Greater Poison (target)
		Greater Heal (self, prevents death)
	Ethereal Warriors will now resurrect dead players with positive karma
	Ethereal Warriors now have a chance to drain target's health, stamina or mana on hit
	Fire Breath special ability added to the following NPCs, with the random ability damage scaling with the NPCs current health:
		Hell Cat, 5 to 8 dmg at max health
		Fire Steed, 6 to 9 dmg at max health
		Hell Hounds, 8 to 11 dmg at max health
		Lava Lizard, 8 to 11 dmg at max health
		Predator Hell Cat, 9 to 14 dmg at max health
		Sea Serpent, 11 to 17 dmg at max health
		Swamp Dragon, 15 to 22 dmg at max health
		Armored Swamp Dragon, 15 to 22 dmg at max health
		Fire Gargoyle, 20 to 30 dmg at max health
		Deep Sea Serpent, 21 to 32 dmg at max health
		Serpentine Dragon, 22 to 32 dmg at max health
		Drake (Gray), 22 to 32 dmg at max health
		Drake (Red), 22 to 32 dmg at max health
		Nightmare, 26 to 39 dmg at max health
		Dark Steed, 26 to 39 dmg at max health
		Silver Steed, 26 to 39 dmg at max health
		Kraken, 39 to 59 dmg at max health
		Dragon (Red), 41 to 62 dmg at max health
		Dragon (Gray), 41 to 62 dmg at max health
		Shadow Wyrm, 50 to 75 dmg at max health
		Reptalon, 51 to 77 dmg at max health
		Skeletal Dragon, 52 to 77 dmg at max health
		Ancient Wyrm, 60 to 90 dmg at max health
Update stats, skills and loot for all currently implemented NPCs
Removed an ancient piece of code that prevented corpses from being generated for various elementals and blade spirits on death. This was originally put in place because these creatures had no corpses, and would replace it with a backpack instead, but these creatures now all have corpses in all client versions supported by UOX3
Updated potions script (js/item/potion.js) with updated formula for amount of hitpoints healed by healing potions, and added restrictions for using them when at full health and/or if poisoned (Dragon Slayer)
Fixed a bug where creatures (and humans, if FORCENEWANIMATIONPACKET was disabled in uox.ini) would play animations with wrong frame count, causing the animations to either freeze for a few frames at the end, or get cut off a couple of frames early
Implemented bonus hit chance for Archery skill, based on mention of such a bonus in Publish 5 patch notes and related UO House of Commons chat. This has been exposed as a UOX.INI setting where this bonus can be tweaked:
	ARCHERYHITBONUS=10 	// Bonus hit chance for Archery skill added to regular hit chance in combat. Defaults to 10%
Implemented optional extra delay between moving and being able to shoot with ranged weapons in combat (in addition to whatever delay is there due to speed of the ranged weapon). This is exposed as a UOX.INI setting:
	ARCHERYSHOOTDELAY=0.5 // Minimum delay in seconds from a player stops moving until they can start to fire their ranged weapon. Defaults to 0.5s
Fixed a bug where players who never entered combat mode could fire ranged weapons while moving
Updated Add-menu with some improvements for usability:
	Menu now directly on the Objects (previously "Shard") tab for quicker access, with a small welcome text and quick-link button for UOX3 docs
	Settings tab contains some (persistent, will be saved with character) options for how the Add-menu behaves, along with a few quick-access buttons to some useful commands. Available options:
		Option to add chosen item at specific location instead of in GM's backpack
		Option to add chosen item repeatedly until cancelled
		Option to automatically reopen Add-menu on last menu that was open when a selection is made
		Option to force decayable state of all added items to either off (doesn't decay), on (decays) or nothing (use item default)
		Option to force movable state of all added items to either off (not movable), on (movable) or nothing (use item default)
	Added a Home button at the bottom of the menu, that takes the user back to the front page of the Add-menu regardless of which menu page they're on
Updated Character/Socket JS Method SysMessage() with an optional parameter to specify the color used to display the system message. Updated syntax:
	.SysMessage( "Text" ) 									// Display "Text" to user as a system message with default system message color from ini
	.SysMessage( "Text %s %s", txtArg1, txtArg2 ) 			// Display "Text" to player with string arguments injected into text
	.SysMessage( txtColor, "Text" ) 						// Display "Text" to user with a specified color
	.SysMessage( txtColor, "Text %s %s", txtArg1, txtArg2 ) // Combination of text color, text and string arguments
Fixed a bug where hair/beard items could show up inside corpses
Fixed a bug where items could sometimes vanish (visually) from containers when bouncing back because player was not able to pick them up
Fixed a bug where players would be unable to pick up a freely movable item from a locked down container
Updated handling of item bouncing on pickup to use UOX3 dictionary messages instead of hard-coded client messages
Added support for new Dictionary language:
	dictionary.POL - Polish (SERVERLANGUAGE=8 in uox.ini, or client language 83 if SERVERLANGUAGE is set to 0)
Added taming restrictions for Unicorn, Ki-Rin and Cu Sidhe (js/skill/taming.js)
Added modification of some creatures stats after they've been tamed (js/skill/taming.js)
Added restrictions for who can ride certain creatures (Unicorn, Ki-Rin, Cu Sidhe)
Updated words of power for Meteor Swarm spell to follow the same logic as other spells using Kal (Summon): Kal Des Flam Ylem
Added new Item/Character JS Methods to get/set temporary custom tags which don't persist across worldsaves (or across reconnects, for players):
	.GetTempTag( "tagName" )
	.SetTempTag( "tagName", tagValue )
When applying HPMAX, STAMINAMAX AND MANAMAX DFN tags to new NPCs, their current HP, STAMINA and MANA properties will now be automatically updated to match
Fixed a server crash caused by empty speech messages sent from certain clients
Fixed a bug that prevented teleport locations in Felucca/Trammel from working properly
Updated calculations in code for duration and damage of existing poison strengths (1 - Lesser, 2 - Normal, 3 - Greater, 4 - Deadly) to match with ~Publish 15 (LBR/pre-AoS), and added another poison strength for monster usage (5 - Lethal)
The strength of the Poison and Poison Field spells is now based on the average of the caster's Magery and Poisoning skills, the distance from the target (Poison spell only) and the target's Resisting Spells skill. If caster is further away than 2 tiles from target, the poison strength always equals Lesser Poison, otherwise the following rules apply:
	If caster's combined skill is higher than 100.0, poison strength equals Greater Poison, with 5% chance of Deadly Poison (if Poison spell) or Deadly Poison (if Poison Field spell)
	If caster's combined skill is higher than 70.2, poison strength equals Greater Poison
	If caster's combined skill is higher than 30.2, poison strength equals Normal Poison
	If caster's combined skill is 30.2 or lower, poison strength equals Lesser Poison
	If target resists spell, poison strength is reduced by 1 level, unless it's already at the lowest level
Fixed an issue that would would let players move faster than they should have been allowed to
Fixed misc issues with Party System:
	Mana and Stamina should now update for Party Members when added to the party, when going in/out of range and when their stats update while in range
	Players who get disconnected or relog should now find themselves back in the same party they were in previously
	Added system messages to inform party members about updates to their party, and to let invited players know they've successfully joined a party (or rejoined, if relogging)
World saves now operate on the principle of only saving changes done since the last world save. Combined with the fact that NPCs in UOX3 are only active if there are players in the same/neighbouring map regions, shard owners may expect to see a decrease in world save times ranging from ~11% to ~99%, depending on how active and how spread out their player base is. If no changes have taken place since last save, saves are virtually instantaneous!
2021-09-20 21:35:17 +08:00
Xoduz
e54dec97d8 Fishing revamp
Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax:
	.DoAction( actionID ) // Old animation packet
	.DoAction( actionID, null, frameCount) // Old animation packet with frameCount
	.DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay
	.DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards
	.DoAction( actionID, subActionID ) // New animation packet
Extended fishing JS script to include:
	Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing.
	Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area.
	Updated timer system, LoS checks,
Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items).
Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure
Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated
Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates
Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them!
Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas
Fixed a bug where the new fish resource type was not getting regenerated or saved properly
Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas
Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly
Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function
Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this.
Updated Item DFN entry for sextants to include script=5033 tag
Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot
The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items.
Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate:
	[LOOTLIST shipwreck_treasure_special]
	{
	90|blank
	10|specialfishingnet
	}
Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time
Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI
Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect
Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking
Moved fishing skill out of code and into js for more user friendly control
Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
Xoduz
c9e4c29367 0.99.4v
Added JS command to reload dictionaries
	'reloaddictionaries
Fixed a server crash related to casting of spells
Fixed some issues with Line-of-Sight checks related to items under/above ground, LoS checks between different floors of buildings, etc.
Updated handling of skill-training keywords to be based on language-independent keyword IDs rather than trying to match player-input text to specific skill-names
Updated animal-trainer/stablemasterscript (js/npc/ai/stablemaster.js) with several changes:
	Fixed an issue where the same pet would be stabled in all available slots if payment was taken from player's bank account instead of their backpack
	Fixed an issue where stablemaster would not pause walking for a while when a player interacts with them
	Converted all system messages and text messages in stablemaster script to dictionary entries
Added new NPC AI type to source - AI_STABLEMASTER (9) - and assigned this to animal trainers. This is used to identify this type of NPCs for the purpose of displaying relevant context menus
Reworked banker AI script (js/npc/ai/banker.js) to use triggerwords from client instead of hard-defined strings, to work better with multiple languages (and work with all relevant triggerwords)
Fixed a bug with banker AI script (js/npc/ai/banker.js) that prevented players from using the "withdraw" command
Re-added NPC AI 8 to banker NPCs (dfndata/npc/male_vendors.dfn and female_vendors.dfn) so code can check for presence of this AI when handling context menus
Removed remaining hard-coded banking functionality - all handled by script anyway
Added new context menu option for NPC bankers - Open Bankbox
Updated code handling of context menus to only show context menus when relevant:
	Open Paperdoll - Shows for all characters with a paperdoll
	Open Backpack - Shows for player's character, pack animals and hirelings
	Open Bankbox - Shows for banker NPCs (if within 8 tiles)
	Buy/Sell - Shows for vendor NPCs (if within 8 tiles, and if they have anything for sale/are buying anything)
Added new context menu entries for pets, which can be used if player is within 12 tiles of pet:
	Command: Kill
	Command: Stop
	Command: Follow
	Command: Stay
	Command: Guard
	Add Friend
	Remove Friend
	Transfer
	Release
Added new context menu entries for stablemasters/animal trainers:
	Claim All Pets
	Stable Pet
Added new context menu entries for Escort Quest NPCs
	Ask Destination (if within 3 tiles)
	Accept Escort (if within 3 tiles)
	Abandon Escort
Added new context menus for NPCs that can teach skills to players (limited to max 10 per NPC)
	Train [skillName]
Added new AI script for NPC hirelings (3204=js/npc/ai/hireling.js), who can be hired to follow the player around for a limited amount of time, and function the same way as pets. In addition to the regular pet commands, these speech commands are supported:
	hire 	// The hireling will respond with the cost to hire them
	dismiss // Replaces the "release" command for pets; will dismiss the hireling
	patrol 	// The hireling will patrol between it's current location and a second targeted location nearby
	move 	// The hireling will try to shuffle out of the way
	fetch 	// The hireling will try to fetch a targeted item
	drop 	// The hireling will drop to the ground all loot they're currently carrying
	report 	// The hireling will report on the remaining time they're hired for
Added new NPC DFN tag used by code to detect hireling NPCs for the purpose of displaying context menus:
	HIRELING 	// No additional value/data needed for tag
Added new context menu entries for Hireling NPCs, in addition to the ones for regular pets:
	Hire 	// Can be used within 3 steps of the hireling, who will respond with cost to hire them
	Dismiss // Replaces the "release" command for pets, will dismiss the hireling
Added HIRELING tag and SCRIPT=3204 to and updated stats of various NPCs that will be hireable:
	m_fighter, f_fighter, m_beggar, f_beggar, m_peasant, f_peasant, m_sailor, f_sailor, m_pirate, f_pirate
Added new hireling NPC:
	m_paladin, f_paladin
Added new UOX ini setting to enable/disable context menus
	CONTEXTMENUS=1/0 (defaults to 1)
Added new Item JS Method to check if an item's ID is on a specified food list
	.IsOnFoodList( foodList )	// Returns true/false if item's ID is on specified foodList
Added new OMNIVORE food list and assigned it to [basehuman] DFN section
Added new Character JS Properties
	.isGuarded 		// Gets/Sets whether character is guarded by a pet/hireling
	.guarding 		// Gets/Sets the object (if any) being guarded by a pet/hireling
Fixed multiple issues with health bars, flagging and character highlighting
Added some crash protection for invalid data used with CUSTOMINTTAG and CUSTOMSTRINGTAG DFN tags for Items, NPCs and Multis
Fixed an issue which prevented hard-coded checks from running when using items
Added new global js object (Timer) to make the use of character timers in JS more robust, with properties matching timer names from enum in source.
	Properties:
		.TIMEOUT 		// Time until next attack can be done in combat
		.INVIS			// Time until invisible character becomes visible
		.HUNGER			// Time until character grows more hungry
		.THIRST			// Time until character grows more thirsty
		.POISONTIME		// Time until next tick of poison damage
		.POISONTEXT		// Time until next message about suffering from poison
		.POISONWEAROFF	// Time until poison wears off
		.SPELLTIME		// Time until spell cast is completed. Can be set to 0 to interrupt
		.ANTISPAM		// Time until next speech message can be sent (for anti spam purposes)
		.CRIMFLAG		// Time until criminal flag runs out
		.MURDERRATE		// Time until next murder count decay
		.PEACETIMER		// Time until character can re-enter combat after being affected by peacemaking
		.FLYINGTOGGLE	// Time until next time flying ability can be toggled for gargoyles
		.MOVETIME		// Time until NPC can move again
		.SPATIMER		// Time until next time NPC can cast a spell
		.SUMMONTIME		// Time until a summoned NPC will vanish
		.EVADETIME		// Time until an NPC will exit evade state
		.LOGOUT			// Time it takes for a player char to vanish after logout
	Examples of use:
		var hungerTimer = myChar.GetTimer( Timer.HUNGER )
		myChar.SetTimer( Timer.HUNGER, 15000 )
Added new Character JS Methods to add, remove and list friends of a pet/hireling:
	.AddFriend( playerToAdd )		// Adds player to friend list
	.RemoveFriend( playerToRemove )	// Removes player from friend list
	.GetFriendList()				// Gets list of friends
	.ClearFriendList()				// Clears list of friends
Added new Character JS Method to fetch a player character's list of pets/followers
	.GetPetList()		// Gets list of pets/followers
Added new persistent NPC property to keep track of a pet's previous owners, whether those tamed the pet or had it transferred to them. Every time a pet is tamed, or is transferred to a new owner, this list is updated:
	GenericList< CChar * >	petOwnerList
Added new Character JS Method to check if a player is on a pet's owner list as a previous owner:
	.HasBeenOwner( mChar )
Previous owners of a pet can re-tame it with guaranteed chance of success
Updated JS Method Refresh() to be usable with both items or characters, to send updated state of object to nearby players
Added character tooltip [Guarded] for characters being guarded by a pet/hireling
Pets/hirelings that are transferred will now immediately start following their new master instead of wandering freely
Pets/hirelings can no longer be transferred between players as long as either party is flagged as a criminal
Pets/hirelings can no longer be transferred to dead players
Pets/hirelings can no longer be transferred to NPCs
Summoned creatures can no longer be transferred to other players
Summoned creatures can no longer have friends
Friend lists of pets/hirelings are now cleared when the pet/hireling is transferred to another player
Added new UOX.INI settings to control how many pets players can have active:
	MAXCONTROLSLOTS=0 	// Maximum number of pet control slots available to player. Disabled if 0
	MAXFOLLOWERS=5 		// Maximum pets/followers a player can have active at the same time. Used if control slots are disabled
	MAXPETOWNERS=5 		// Maximum number of different owners a pet can have over its lifetime before it becomes impossible to retame
Added new NPC property and NPC DFN tag that keeps track of how many pet control slots an NPC would take up if owned by a player:
	UI08 controlSlots 	// source property
	CONTROLSLOTS=# 		// DFN tag
Added new Character JS properties:
	.ownerCount		// Get the total number of owners a pet/hireling has had, based on NPC's petOwnerList
	.controlSlots 	// Get/Set number of pet control slots an NPC will occupy
	.controlSlotsUsed // Get/Set the number of control slots used by a player
Updated get (js/commands/targeting/get.js) and set (js/commands/targeting/set.js) commands to support getting/setting the following character properties:
	deaths
	ownerCount (read only)
	controlSlots
	controlSlotsUsed
Updated NPC DFNs with default CONTROLSLOT=# tags
Increased the max distance from player that onSpeech JS event will trigger from 7 to 12
Updated how "all attack" and "all follow" commands for pets are handled. Now loops through all pets owned by character and executes command for each eligible pet
Fixed an issue where NPCs could follow characters in different worlds/instances than them selves
Updated default max amount of items that can be sold to NPC vendors from 5 to 250
Guards can no longer train players in skills
Updated equipment itemlists (dfndata/items/itemlists/itemlists.dfn) with blank entries to introduce some more variety in the type of clothes NPCs wear in general
Added new NPCs to DFNs (dfndata/npc/undead.dfn) and added them to undead npclist:
	[skeletalmage]		// variation of [bonemage]
	[skeletalknight]  	// variation of [boneknight]
Updated Titles (dfndata/titles/titles.dfn) with up-to-date titles for skills around Pub 15, and added titles for skills added after that. Also added "Elder" and "Legendary" titles for 110 and 120 skillpoints
Updated EQUIPITEM tag in newbie.dfn (dfndata/newbie/newbie.dfn) to support an optional hue parameter (EQUIPITEM=id,hue)
Updated starting equipment for new characters (dfndata/newbie/newbie.dfn), with commented out practice weapons. Uncomment to use
Added item definitions for practice weapons (dfndata/items/gear/weapons/practice_weapons.dfn):
	practice_skinning_knife
	practice_hatchet
	practice_axe
	practice_mace
	practice_longsword
	practice_spear
	practice_bow
	practice_club
	practice_crook
	practice_gnarled_staff
Updated mount statues DFN (dfndata/items/misc/mount-statues.dfn) and JS (js/npc/pets/*.js) files to include pet control slot related stuff
Pets now inherit the karma of their owners, but revert to their original karma upon release
Pets and hirelings will no longer follow the ghosts of their dead owners, but stay to guard their corpse
Added optional 9th parameter for JS Function CreateDFNItem to specify a color for item created. This comes before the other optional parameters - worldNumber and instanceID (which are only used if character is NULL):
	CreateDFNItem( mSock, mChar, sectionName, inPack, iAmount, itemType, iColor, worldNumber, instanceID )
Added ID of Giant Beetle to various pack animal checks
Pack animals will now drop any newbie/blessed items stored in their packs upon death
Added new NPC properties to track pet loyalty, and exposed these as Character JS properties, and NPC DFN tags:
	JS Properties
		.maxLoyalty 	// Defaults to 100
		.loyalty 		// Starts at 25
	DFN Tags
		MAXLOYALTY=# 	// Defaults to 100
		LOYALTY=# 		// Starts at 25
Updated TriggerEvent JS function to support return values (int, bool, string, object) from called script
Updated various JS scripts to make use of new TriggerEvent functionality and reduce reliance on custom tags:
	js/item/archerybutte.js
	js/item/trainingdummy.js
	js/server/data/combatanims.js
	js/server/data/weapontypes.js
Updated archerybutte script to use dictionary for system and text messages
Updated archerybutte script to support increased range, distance penalty and dex/str bonuses when calculating score
Added new UOX.INI settings under [pets and hirelings] section related to pet control and loyalty:
	CHECKPETCONTROLDIFFICULTY=1 	// Enable/Disable pet control difficulty system
	PETLOYALTYGAINONSUCCESS=1 		// Amount of pet loyalty gained on successful pet command use
	PETLOYALTYLOSSONFAILURE=3 		// Amount of pet loyalty lost on failed pet command use
	PETLOYALTYRATE=900 				// Amount of seconds between each time pet loyalty is automatically reduced by 1. Takes 25 hours to deplete completely from max
Added new persistent NPC property that keeps track of the difficulty of taming and controlling a pet, and exposed it as a Character JS property:
	.orneriness
Every time a tamed pet is released or goes wild, its "orneriness" increases, making it more difficult for other players to tame, and more difficult for anyone to control.
Updated CBasePetResponse::canControlPet() function to use pet control difficulty system if enabled, which checks player's animal taming/animal lore skill vs a pet's "orneriness" to determine chance of pet accepting a given pet command
	On successful use of pet command, increases pet loyalty by value defined in PETLOYALTYGAINONSUCCESS ini setting
	On failed use of pet command, decreases pet loyalty by value defined in PETLOYALTYLOSSONFAILURE ini setting
Added new Character JS Method to calculate chance of a player successfully controlling the pet:
	.CalculateControlChance( mChar )	// Returns value between 0 and 1000 indicating chance of success
Feeding a pet will now restore its loyalty to maximum
Pets will now lose loyalty on hunger checks when at maximum hunger
Pets that are maximum hungry will now only have a chance to go wild if loyalty has dropped to zero
Added new DFN tag for creatures.dfn - TYPE - which contains a string describing the type of creature
Added secure pet trading. Players who trade pets will now see a pet transfer deed appear in a secure trade window with the name and type of creature, and upon completion of the trade the associated pet will be instantly transferred to the other player
Updated resource JS scripts (js/server/resource/*) to use dictionaries for all system messages
Updated skill JS scripts (js/skill/*) to use dictionaries for all system messages
Updated housing JS scripts (js/server/house/*) to use dictionaries for all system messages
Updated item JS scripts (js/item/*) to use dictionaries for all system messages
Updated magic JS scripts (js/magic/*) to use dictionaries for all system messages
Updated NPC AI JS scripts (js/npc/ai/*) to use dictionaries for all system messages
Updated command JS scripts (js/commands/*) to use dictionaries for all system messages, gump tooltips, etc
Updated code to use dictionaries for all system messages
Fixed incorrect spelling for UOX.INI setting HIDEW(H)ILEMOUNTED and updated hiding skill (js/skill/hiding.js) to actually allow/disallow hiding while mounted based on this setting
Added new Character JS Method to make it easier to make one NPC initiate combat with another:
	.InitiateCombat( targetChar )	// Character attempts to initiate combat with target character
Updated parrying portion of combat code to be in line with Pub15/pre-AoS parrying mechanics. High AR shields now absorb more damage on a successful parry, while low AR shields have a higher chance of parrying. Shields are also now more effective against archery attacks (full absorption potential) than melee attacks (half absorption potential).
Updated combat damage calculations to be in line with Pub15/pre-AoS damage calculations
Adjusted default value of COMBATNPCDAMAGERATE ini setting (damage divisor when target is a player) from 2 to 1 to account for these changes.
Removed dictionary.UNK, and made dictionary.ZRO the default dictionary used for all unsupported languages
Added dictionary support for additional languages: Portuguese, Italian, Czech
Updated default dictionaries for the following languages: English, French
Added default dictionaries for the following languages: German, Spanish, Portuguese, Italian, Czech (note that translations have been provided by automatic services and will contain inaccuracies!)
Added new UOX.INI setting to allow specifying a default dictionary language for server, which if set will force that language for all dictionary messages, regardless of client settings:
	SERVERLANGUAGE=0 	// Set default server dictionary language. Supported languages: 0 - None/language used by each client, 1 - English, 2 - German, 3 - Spanish, 5 - French, 6 - Portuguese, 7 - Italian, 8 - Czech
Added new function in combat.cpp - AdjustArmorClassDamage() - which adjusts the damage dealt in combat based on whether armour class (AC DFN tag or .ac JS property) of weapon and armour equipped on hit location of target match up. A weapon with armour class 1 would essentially be doubly effective against armour of armour class 1. Allows setting up things like piercing weapons being better against some armor types than mace weapons, etc.
Added new UOX.INI setting under [combat] to enable/disable double damage from armour class bonuses:
	ARMORCLASSDAMAGEBONUS=0/1 //defaults to 0)
2021-07-28 16:02:56 +08:00
Charles Kerr
2bc886128c updated trim/ltrim/rtrim/simplify to not use regex (seems rather slow for our string sizes).
Updated to lower/toupper to be upper/lower
replaced occurrences of stripTrim with trim(removeTrailing))
replace stripComment with removeTrailing
2021-07-19 13:41:59 -04:00
Xoduz
c7a087f641 Added TriggerTrap JS function
Added new JS Function to force-trigger a trapped item, as if the player tried to open a trapped container:
		TriggerTrap( pChar, iTrap )
2021-07-06 07:28:19 +08:00
Xoduz
c1283e2ae6 0.99.4u
UOX3 now sends the appropriate packets (0x85 and/or 0x86) in response to client requests to delete a character from the char selection screen
Fixed an issue with fetching create entries in JS - was incorrectly limited by number of registered spells!
More code cleanup
2021-07-04 07:57:42 +08:00
Xoduz
6ca9ddc6f2 Various code/warning cleanup
Fixed an issue with ItemID skill where using the skill on a crafted item would not output a result if creator of item was unknown
Command logs now also include any parameters used with a command
Fixed an issue where messages used with CustomTarget JS function would not get truncated properly if longer than the allowed maximum length
Fixed some instances of potential buffer overrun and/or out-of-bounds memory access
Fixed some potential null pointer dereferences
Fixed a couple instances of missing breaks in switch cases
Added [[maybe_unused]] attributes in places where return values are intentionally unused
Added [[fallthrough]] attributes in places where switch case fallthroughs are intentional
Misc minor code cleanup
2021-07-04 02:26:43 +08:00
Xoduz
79447c5e09 Various changes
Fixed an issue with JS Function DeleteFile(), which would stop calling script from working if no file was found for deletion. Could break demolishing of houses, amongst other things
Fixed an issue with DoSEErrorMessage() function that prevented JS function error messages from being displayed in UOX3 console if message size was below 512
Fixed a bug that allowed players to place items on the same slot of walls when using a client that doesn't automatically restrict this
When dropping items, UOX3 will now look for a valid surface to drop them on, and move the item to said valid surface if applicable
Fixed an issue with loading of MultiCollections.uop where max boundaries of each multi was not set on load, preventing features that relied on finding corners of building from working (like automatic ban location detection for houses)
Added new function in mapstuff.cpp to check flags on dynamic items, and exposed it as a JS Function with same name and parameters:
	CheckDynamicFlag( SI16 x, SI16 y, SI08 oldz, UI08 worldNumber, UI16 instanceID, TileFlags toCheck );
Fixed an issue where items were not always properly added to/removed from map regions when picked up or dropped
Added new helper function in dist.cpp to find 3D distance between two points:
	getDist3D( point a, point b )
Added JS Function - DistanceBetween() - to find distance between two sets of coordinates, or two objects:
	DistanceBetween( x1, y1, x2, y2 )
	DistanceBetween( x1, y1, z1, x2, y2, z2 )
	DistanceBetween( sourceObject, targObject )
	DistanceBetween( sourceObject, targObject, checkZ )
Added Item JS Method - GetTileName() - to get name of an item directly from tiledata
Added new UOX.INI setting that defines the lower limit for when a purchase will withdraw money from bank instead of backpack:
	BANKBUYTHRESHOLD=2000
Split the UOX.INI setting CONSOLELOG into three parts, to enable/disable different forms of logging:
	CONSOLELOG=1/0 	// Toggles logging of console messages, warnings and errors
	NETWORKLOG=1/0 	// Toggles logging of network traffic
	SPEECHLOG=1/0 	// Toggles logging of player/staff speech
2021-06-27 23:23:31 +08:00
Xoduz
3393934b38 Misc tweaks and fixes
Fixed a potential server crash issue with OnUnequipAttempt JS event
Added additional parameter to onCombatDamageCalc JS event - hitLoc, which contains the hit location calculated by code for an attack. New syntax:
	onCombatDamageCalc( pAttacker, pDefender, fightSkill, hitLoc )
Moved CalculateHitLoc() and DoHitMessage() out of CHandleCombat::calcDamage(), so these can still happen if JS scripts override damage calculations using onCombatDamageCalc event
Hairs/Beards inside corpse containers now not movable, even if displayed in client for some reason
2021-06-17 16:52:49 +08:00
Xoduz
51bbdd61b2 Blood, bleeding, tracking fixes, forensics fix, race combat mods
Added cEffects::SpawnBloodEffect( UI08 worldNum, UI16 instanceID, UI16 bloodColour, BloodTypes bloodType ), which can be called upon to create blood splatter effects for things like death, bleeding, combat hits, etc.
Added random blood effects that spawn when a character dies, and decays according to new ini setting
Added new UOX.INI settings under [timers] to define how long blood effects take to decay:
	BLOODDECAYTIMER=3 			// Smaller blood effects spawned during combat, defaults to 3 seconds
	BLOODDECAYCORPSETIMER=450 	// Larger blood effects spawned upon death, defaults to half the duration of the default corpse decay timer
Fixed an issue with Forensic Evaluation skill (js/skills/forensics.js) not giving correct info on age of a corpse, because it incorrectly tried to check a .tempTime property instead of .tempTimer
Changed default value of MSGREDISPLAYTIME in [tracking] section of UOX.INI from 30 to 3, so tracking arrow will actually follow the target when it moves (every 3 seconds)
Fixed an issue with the Tracking skill where attempting to left-click on the tracking arrow would cause client to freeze up
Fixed an issue with the Tracking skill where right-clicking tracking arrow to dismiss it would not always work, especially if target had been killed/deleted
Fixed an issue with the Tracking skill where the tracking arrow would not be automatically dismissed if the tracked target was killed/deleted
Fixed an issue that prevented clients in 6.0.5 - 6.0.14.1 range from connecting even though CLIENTSUPPORT6050 was enabled in ini
Fixed an issue where client 6.0.14.2 was being mis-classified as a T2A client, and not the first of the SA clients as it should be
Changed how Race damage modifier is applied to damage dealt in combat - it's now a direct percentage bonus (or penalty) applied to the base damage dealt
Added in missing default [COMBAT MODS] section to dfndata/race/races.dfn. Each MOD# entry in this section represents a percentage modifier applied to skill checks for members of a race that subscribes to that MOD entry via skill tags like [SKILLNAME]G=# (bonus) or [SKILLNAME]L=# (penalty). These modifiers are also applied to base damage in combat, before other damage modifiers.
	Example1: SWORDSMANSHIPG=3 would apply a 20% bonus to swordsmanship skill checks for race the tag was added to, as well as a 20% bonus to base damage dealt in combat
	Example2: MACEFIGHTINGL=3 would apply a 20% penalty to macefighting skill checks for race the tag was added to, as well as a 20% penalty to base damage dealt in combat
2021-06-15 02:19:47 +08:00
Charles Kerr
75fc56b0dd NULL to nullptr 2021-06-12 07:30:23 -04:00
Xoduz
e63e0dac3e Various fixes
Added some error-checking to JS function AreaItemFunction() to avoid potential server crash
Fixed an issue introduced in 0.99.4m, where objects being added to/moved to specific worlds or instances were still visible to players in other worlds/instances
Fixed issue with loading SCPTRIG tag with value 65535 in older worldfiles, now treats these as if the value was 0
Updated JS Methods .AddCheckbox() and .AddRadio() to support specifying the gumpImageID to display when button is checked/selected.
	Updated syntaxes:
		.AddCheckbox( topHeight, topLeft, checkImage, defaultStatus, unk2 )
		.AddCheckbox( topHeight, topLeft, checkImageOff, checkImageOn, defaultStatus, unk2 )
		.AddRadio( topHeight, topLeft, radioImage, pressed, id )
		.AddRadio( topHeight, topLeft, radioImageOff, radioImageOn, pressed, id )
Added new Socket JS Method to close a specific generic gump:
	.CloseGump( gumpID, buttonID ) // gumpID is normally equal to 0xffff + scripttrigger of script gump is created in, while buttonID is the buttonID response we want the client to send when gump closes
Added new Gump JS Method to end a group of radio buttons started with AddGroup():
	.EndGroup()	// Ends previously started group element
Re-enabled Gump JS Method MasterGump(), in case someone can use it for something
	.MasterGump( masterGumpID ) // Define master gump of gump?
Added facet support for 'wipe and 'iwipe commands (js/commands/targeting/wipe.js). Updated syntax:
	'wipe/iwipe
		Brings up target cursors. Wipes all objects in area between target locations, on same facet as user
	'wipe/iwipe x1 y1 x2 y2
		Wipes all objects in specified area, on same facet as user
	'wipe [objType] [facet]
		Wipes all objects of specified type. If facet is specified, wipes only on that facet.
		objTypes: items, multis, boats, npcs, spawners or all
	'wipe all
		Wipes ALL objects, on ALL facets, regardless of object type
	'wipe all force
		Wipes ALL objects, on ALL facets, regardless of object type and whether wipeable flag is set
2021-06-11 05:37:25 +08:00
Xoduz
c508572352 Thirst system addition
Added thirst system that works similarly to existing hunger system, where characters (and optionally, pets) grow thirsty over time, and gradually draining their stamina (down to a minimum of 1) if too thirsty
Added new settings to uox.ini under a new [thirst] section to control thirst system:
	THIRSTRATE=6000 	// The rate at which characters grow more thirsty
	THIRSTDRAINVAL=2 	// The amount of stamina drained per thirst cycle when too thirsty
	PETTHIRSTOFFLINE=0 	// Enable/disable whether pets grow more thirsty over time while owners are offline
Added new JS properties for Characters related to thirst system (Xuri)
	.thirst 			// Get/Set current thirst level of character
	.thirstRate 		// Get character's thirst rate, based on racial properties or global settings
	.willthirst/ 		// Get/Set whether character will get thirsty
	.tamedThirstRate 	// Get/Set tamed pet's thirst rate
	.thirstWildChance 	// Get/Set tamed pet's chance at going wild if too thirsty
Updated JS script for drinks (js/server/resource/pitchers.js) to reduce character thirst when consumed, with appropriate system messages displayed based on character's thirst level (Xuri)
Updated JS commands get (js/commands/targeting/get.js), set (js/commands/targeting/set.js) and tweak (js/commands/targeting/tweak.js) to support getting/setting character hunger levels (Xuri)

Co-Authored-By: DragonSlayer62 <85514184+DragonSlayer62@users.noreply.github.com>
2021-06-11 04:03:16 +08:00
Malroth
944ea6e22c Thirst System
This will take stamina if the player gets thirsty this can be toggled on or off.
2021-06-07 21:05:50 -05:00
Xoduz
52ed2376f3 Some maintenance changes
Replaced UOX_MIN and UOX_MAX with std::min and std::max (punt)
Moved StringUtility functions into a new namespace: strutil (punt)
2021-05-27 05:42:35 +08:00
Xoduz
2265f52202 Minor JS revamp - multiple scripts per object!
Added TryParseJSVal() helper function in cScript.cpp, used to parse jsval values returned from script events. Provides results matching 0 (0, false), 1 (1, true) or any specific int value returned from script.
	JS events updated to use new TryParseJSVal helper function (no change in behaviour):
		onDecay, onResurrect, onCommand, onBuyFromVendor, onSellToVendor, onPickup, onCharDoubleClick, onSkillGump, onUseBandageMacro, onCombatStart, onCombatEnd, onDeathBlow, onBuy, onSell
	JS events with slight change of behaviour after update to use TryParseJSVal:
		onDrop, onDropItemOnItem, onDropItemOnNpc - previously, a blank or non-existent return value would be treated the same as a return true. This will now be treated as a return false. Update scripts accordingly!
	JS events updated to support return values from scripts:
		onCollide, onTalk, onSnooped, OnHungerChange
			Return false or nothing to prevent hard code from running
			Return true to allow hard code to run like normal
		onStolenFrom, onAISliver, onLightChange, onVirtueGumpPress, onQuestGump, onSpecialMove, onSwing, onClick, onHouseCommand, onSellToVendor, onSkillCheck, onSpellGain, onSpellLoss
			Return false to allow hard code and other scripts with event to run like normal
			Return true to prevent hard code and other scripts with event from running
		onSteal
			Return false or nothing to allow hard code and other scripts with event to run like normal
			Return true to prevent hard code and onStolenFrom event from running (theft failed?)
			Return 2 to prevent hard code, but allow onStolenFrom event to run (theft succeeded, but handled in script?)
		onLeaving, onEntrance, onEquip, onUnequip, onEnterEvadeState, onSoldToVendor, onBoughtFromVendor, onSpellSuccess, onSpellTarget, onFlagChange, onDeath
			Return false or nothing to allow other scripts with event to run like normal
			Return true to prevent other scripts with event from running
	Added new JS events that run prior to items being equipped/unequipped, with support for return values:
		onEquipAttempt( pEquipper, iEquipping )
		onUnequipAttempt( pEquipper, iUnequipping )
			Return false or nothing to reject attempt to equip/unequip item, and prevent hard-code or other scripts with event from running
			Return true to allow hard code to run like normal
	Added new JS event that runs prior to onSnooped event, for character doing the snooping:
		onSnoopAttempt( snooped, snooper )
			Return false or nothing to prevent hard code and other snooping-related events from running
			Return true to allow hard code and other snooping-related events to run like normal
	Updated onSnooped JS event to accept return values:
		Return true when success state is true to prevent other scripts with event from running
		Return true when success state is false to prevent hard code and other scripts with event from running
	Updated onClick JS event to also run for characters with event attached (return 1 to prevent showing hard-coded name for whatever object is clicked)
	Updated onSteal JS event to include a third parameter, an object reference for the target of the theft
	Added support for assigning multiple JS scripts per object (item, multi, char, region).
		Any time a scriptID is added to an object, the list of such IDs for that object will be sorted from lowest to highest scriptID, which also determines the execution order for the scripts. Note that if the same JS event is present in several scripts assigned to an object, each of those events will trigger, unless the rules about return values for said event prevent this
	DFNs for Items, Multis, Characters and Regions can now contain multiple SCRIPT=scriptID tags per definition. Each such SCRIPT tag will be applied to the object in question, then sorted from lowest to highest scriptID by server.
	Added new JS property for Items, Multis, Characters and Regions:
		.scriptTriggers 		// If used to get property, will return array object with all script IDs assigned to object. If used to set property, will add script ID to existing list of script IDs for object.
	Modified JS property for Items, Multis, Characters and Regions, which for backwards compatibility functions similar to in older versions:
		.scripttrigger 			// If used to get property, will return last script ID in list of script IDs assigned to object. If used to set property, will clear list of script IDs and assign only the new ID
	Added new JS Methods for Items, Multis, Characters and Regions:
		.AddScriptTrigger( scriptID ) 	// Adds a new scriptID to list of scripts assigned to object
		.RemoveScriptTrigger( scriptID ) // Remove a specific scriptID from object (0 = remove all)
	Moved SETSCPTRIG command from code to JS (js/commands/targeting/scptrig.js), and supplemented it with some additional commands:
		GETSCPTRIG				// List out all scriptIDs assigned to object
		SETSCPTRIG scriptID 	// Clears list of scriptIDs for object, then assigns the specified scriptID
		ADDSCPTRIG scriptID 	// Adds specified scriptID to list of scriptsIDs assigned to object
		REMOVESCPTRIG scriptID 	// Removes specified scriptID from list of scriptIDs assigned to object (0 = remove all)
2021-05-25 19:37:52 +08:00
Xoduz
8b8f1e1757 Improvements to teleport location handling, and misc other fixes
Reorganized teleport.scp file with logical groupings by map and area for easier maintenance
All teleport locations in teleport.scp without a source/target world specified will now work for both Felucca and Trammel facets
Deleted ustring.cpp/ustring.h from repository and removed last few straggling references to these	Teleport locations from teleport.scp are now sorted upon initial load, and no longer require being sorted in the file itself (punt)
Modified handling of CONT and PACKITEM tags loaded from worldfiles to no longer corrupt pointers (punt)

Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-28 19:19:05 +08:00
Xoduz
4729cb8fe5 More modernizing
Additional work done to modernize string handling in CPacketReceive.cpp, CPacketReceive.h, CPacketSend.cpp, CPacketSend.h, cScript.cpp, gumps.cpp (punt)

Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-25 05:01:06 +08:00
Xoduz
0bee2f33b5 0.99.4h
Exposed a (read-only) JS property for characters to fetch their hunger rate. Uses race's hunger rate if defined, otherwise uses HUNGERRATE form uox.ini:
	.hungerRate 		// Seconds between becoming hungrier
Updated 'get command to allow retrieving a character's hungerRate property
Added some details to console during UOX3 startup about which IPs and Ports UOX3 is listening to
Added new JS event that triggers when a player clicks on the Quest button in the paperdoll. Triggers from character script if present, or global script if not:
	onQuestGump( pUser )
Added new JS event that triggers when player toggles a special move from a combat book. See packet 0xBF, subCmd 0x19 in packet guides for details on the special moves, whose IDs range from 0x00 to 0x1D:
	onSpecialMove( pUser, abilityID )
Fixed invalid ID for items [0x0174] and [0x0175] in dfndata/items/building/walls/stone_walls.dfn
Updated FileSize() function in regions.cpp to fetch file size using std::filesystem::file_size() instead of creating an input stream, opening a file and then trying to seek the last position in the file
Added findNearbyObjects() function to findfuncs.cpp, to find all objects (characters and items) of CBaseObject class near a specified location
Improved performance when initializing multis on startup; now checks for items near multis, instead of checking for multis near every single item!
Improved performance when loading items and characters from worldfiles during startup; around 33% faster for release builds, around ~50% faster when running in debug mode through visual studio (punt)
Updated createSection() in ssection.cpp to use std::string and StringUtility functions instead of UString, and added some error handling (punt)

Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-23 02:13:17 +08:00
Xoduz
2445f39564 0.99.4g
Completed implementation of onDecay JS event, which was not actually hooked up to anything! Can now be used to interrupt decay for items. Returning false will prevent code from deleting the decaying item, while returning true will continue running the decay code as normal.
Fixed an issue with .brkPeaceChance JS Character property, which erroneously called on the GetBrkPeaceChanceGain()/SetBrkPeaceChanceGain() functions instead of GetBrkPeaceChance()/SetBrkPeaceChance()
Fixed issue with loading of UOP map files that was introduced in a previous commit while attempting to get rid of some warnings when compiling UOX3 on Windows!
2021-04-19 01:11:25 +08:00