Commit graph

29 commits

Author SHA1 Message Date
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
Charles Kerr
75969075dd changed some values to const references 2022-06-16 08:17:28 -04:00
Charles Kerr
eef49dd0b7 tag and cleanup 2022-06-09 11:41:07 -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
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
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
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
Charles Kerr
75fc56b0dd NULL to nullptr 2021-06-12 07:30:23 -04: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
4110086944 UString to std::tsring
More UString instances replaced by std::string and associates (punt)

Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-24 04:21:57 +08:00
Xoduz
48494090ec 0.99.4i
Fixed an error in tweak command (js/commands/targeting/tweak.js) when attempting to use it on characters with no backpacks
Updated a bunch of casts to use UOX3-specific typedefs for consistency
Startup performance is now faster by an additional 70% over the previous commit, primarily due to modernization of HandleLine() functions in cBaseobject.cpp, cChar.cpp, cItem.cpp and cMultiObj.cpp (punt)
2021-04-23 23:54:52 +08:00
Xoduz
c76a41215f 0.99.4e
Added support for packet 0xE2 (New Character Animation, used to play animations in client v7.0.0.0+) via cEffects::PlayNewCharacterAnimation( CChar *mChar, UI16 actionID, UI16 subActionID, UI08 subSubActionID )
Added support for new animation packet in JS Character method DoAction() using a second parameter that specifies animation variation, which if present forces server to send new animation packet instead of old. This means the 'action/npcaction commands can now be used to play animations on gargoyles/humans in client v7.0.0.0+ using the following syntax: 'action [action subAction]
Created new enums for character actions and sub-actions, and updated code to refer to these instead of using "magic" numbers
Added new options in UOX.INI under [settings] section:
	FORCENEWANIMATIONPACKET=0/1 // If enabled (default), forces the use of the new animation packet for playing various character animations for both NPCs in general and for player characters connected with client v7.0.0.0+
Updated various actions performed by players and NPCs to use new animation packet (combat, spellcasting, mining) if connected with client v7.0.0.0+ and ini setting to force new animation packet is enabled
Added basic support for gargoyle flying ability. Can now use flying ability itself to enter/exit flying state, and the state change will also get sent to nearby players. Flying players are treated the same way as mounted players; polymorph spells will auto-dismounts mounted/flying player, same rules for stealth applies to flying as riding, etc.
Exposed Character property to JS engine:
	.isFlying // returns true if character is flying
Moved Orc and Ratman races from RACE 1 and 2 to RACE 22 and 23 in dfndata/race/races.dfn to make room for two new player races, that are applied to new player characters during character creation:
	[RACE 1] - Elf
	[RACE 2] - Gargoyle
Updated orcs and ratmen in dfndata/npc/humanoids.dfn with race IDs 22 and 23 respectively
Added items in dfndata/items/skills/tools/cooking.dfn to item menu under Skills > Tools > Cooking
Fixed an issue where moving items around within a container at max item capacity was not allowed
The GM command 'set can now modify a character's current mana using 'set mana #
Added JS command to get specific object property values (using same property names as 'set command):
	'get [objectProperty]
Exposed Item/Character properties to JS:
	.oldX // Previous X coordinate for object
	.oldY // Previous Y coordinate for object
	.oldZ // Previous Z coordinate for object
Exposed Character properties to JS:
	.mana // Character's current amount of mana
Updated version of Winsock requested by UOX3 from 2.0 to 2.2
Exposed timer for updating NPC flags to [timers] section of UOX.INI:
	NPCFLAGUPDATETIMER=5 // Interval in seconds between each time NPC flags are updated. Default adjusted down from 30 to 5 seconds
Fixed an issue where UOX3 was trying to output some debug/warning messages to console using the wrong console method
Made some small tweaks to NPC pathfinding to make NPCs more likely to pick a new target location when their old one is blocked
Added HP DFN tag to guard NPCs to prevent them from spawning with half health
Removed -lstdc++fs from Makefile and replaced with special instructions for users of gcc below v9.x
Fixed a buffer overrun issue with tiledata item names
Eliminated a bunch of compilation warnings in VS2017
Updated JS Method CreateDFNItem to allow creating items without referencing a socket/character. Syntax:
	var myItem = CreateDFNItem( null, null, itemSectionID, amount, "ITEM", false, worldNumber, instanceID );
Added functional chessboard that operates on standard chess rules. Pieces cannot be removed from the board, snap to the chessboard grid when dropped, are subject to movement restrictions per chesspiece, will capture opponent pieces if landing on their square. Board can be reset by dragging king-piece off to the side of the board (js/item/gameboards.js and js/item/chesspiece.js)
Added functional checkerboard, with pieces that cannot be removed, can only move in diagonals, can jump across opponent pieces to capture them. Board can be reset by ??? (js/item/gameboards.js and js/item/checkerpiece.js)
Using the 'go command without any additional parameters will now open the GM travel menu (js/commands/go.js)
2021-04-08 18:54:15 +08:00
Xoduz
e8d21cbc4d Misc small fixes
Fixed an issue with books where server could get stuck in an infinite loop if number of lines per page was higher than 8. Now capped at 8 lines per page.
	Renamed item type enum IT_READABLEBOOK to IT_BOOK, since it's the item type used by both readable and writeable books.
	Changed ANIMALATTACKCHANCE to use a scale of 1 to 1000 instead of 1 to 100, for additional granularity in setting the chance for animals to get attacked by monsters. An INI value of 15 now translates as 1.5% chance (per NPC AI cycle!) instead of the previous 15%
	Removed new GetEnvironment() function and expanded on the use of the existing OS_STR define in Config.h
	Updated fireworks wand (IT_FIREWORKSWAND) so effects no longer play permanently in ClassicUO client
	Fixed an issue with converting a house from public to private while there were player vendors in the house
	Ported player vendor deeds and placement of player vendors to JS (UOX3/js/server/house/playerVendorDeed.js) and added checks to make sure player is in a house they own, that can hold more player vendors, and that they are trying to add the vendor in a location that's not blocking any doors.
	Partially ported guildstone deed functionality to JS (UOX3/js/item/guildstone.js) and added various additional checks to make sure player is in a house they own, they're not already in a guild, no other guildstones exist in the house and they're not trying to place it in a location that blocks any doors. Main guild creation code is still hardcoded, though.
	Removed some unused item types that have been marked as candidates for deletion for over 15 years (IT_CHAOSGATEOPENER, IT_CHAOSGATE, IT_GUILLOTINEANIM, IT_TRAININGDUMMYANIM)!
	Updated UOX3 documentation with complete list of item types, and item layers, in addition to other small additions.
	Fixed an issue with advanced pathfinding where NPCs in some cases would stop 1 tile before reaching the target location
	Fixed an issue where no crafting resources would ever be lost if failing to craft an item that only required 1 of a given crafting resource
	Fixed an issue with pathfinding that could cause NPCs to queue up in long rows when attempting to reach the same target in combat when advanced pathfinding was disabled
	Added functionality to allow guild masters to move guildstones by transforming these into portable stones that can be used to place the guildstones in new locations
	Updated timestamp for packet logs to include milliseconds for greater granularity
2020-11-08 05:53:01 +08:00
Xoduz
166d3b0119 Numerous changes with focus on feature and stability parity across Windows, Linux and MacOS platforms
Added new Makefile that handles compiling UOX3 and Spidermonkey on both Linux and MacOS (punt)
Added VS solution (SpiderMonkey.sln) and VC++ project files for compiling SpiderMonkey on Windows (Xuri)
Updated SpiderMonkey from v1.6.0 to v1.7.0
Added optimization flag -O2 for release build in CMakeLists.txt in project root (Xuri)
Added StringUtility file with general common string manipulation functions (punt)
Updated RandomNum function to use a "seedless" random number generator from C++11 instead of the old C rand() function. (punt)
Overall code cleanup to remove/replace platform-dependent code (punt)
Replaced potentially unsafe usage of C string stuff like sprintf, vsprintf, vsnprintf, strncat, strcpy and strlen throughout the code with calls to a format() function containing only a single, safe use of vsnprintf, ensuring there's a single place of failure if there's anything to fix and and making it easy to potentially replace this with std::format from C++20 when the time comes. (punt)
Replaced usage of char in many places with std::string (punt)
Started process of replacing UString usage with functions provided through StringUtility instead (punt)
Replaced platform specific fileIO handling in Windows/Linux with cross-platform C++17 standard std::filesystem (punt)
Replaced platform specific time handling by using cross-platform chrono library (punt)
Removed UOX namespace to reduce complexity (punt)
Elimitated template code approach to singletons for more modern c++ constructs, removing dependices in the process (punt)
Removed ODBC support; it hasn't been touched since the initial implementation in 2008, and there is a lack of someone to maintain the code. (punt)
Removed some platform specific files like uoxlinux.h, which is no longer required (punt)
Removed legacy crash protection code, and removed support for cluox (punt)
Removed legacy "support" for Borland compiler (punt)
Removed legacy VC++ 6 Workspace/Project files, VS2005 Solution/Project files, as these are no longer supported (Xuri)
Removed legacy BUILD folder with outdated compilation instructions (Xuri)
Removed old Changelog file (merged into Changelog.txt) (Xuri)
Fixed a pointer bug for items in multis on world load (punt)
Fixed a dictionary related issue that caused segmentation faults on Linux/MacOS (punt)
Fixed an issue with callbacks to JS scripts that caused segmentation faults on Linux/MacOS (punt)
Paths in uox.ini should now load properly on all platforms regardless of whether those paths use slashes or backslashes, and whether or not they end in a slash/backslash. (punt)
Moved to c++17 style of threading, and got rid of threadsafeobject.cpp/h (punt)
Replaced parsing of UOX.INI tags with a system that's more easily maintainable (punt)
Added some new commands to js/commands/custom/misc-cmd.js (Xuri)
	cont		// Targeted item will be made a container, set to nondecay and movable 2
	endfight	// Targeted character (and character being fought) will stop fighting
	getmulti	// Get multiObject for targeted item
	finditem	// Find item at layer X
	movespeed	// Set movement speed of target player (0x0 Normal, 0x1 Mounted, 0x2 Slow (walk only), 0x3 Hybrid ("jog"?), 0x4 Frozen)
Added new HTML based documentation in docs folder, and removed many old legacy docs that are either incorporated into this document already or no longer relevant for the current UOX3 version (Xuri)

Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2020-09-07 18:09:55 +08:00
Xoduz
342385d2f2 Instance-support and misc code cleanup
Misc code and documentation cleanup:
	Updated and standardized function comment blocks throughout entire codebase
	Grouped getters and setters together in pairs and documented them as one
	Removed empty and/or non-useful information from comment blocks
	Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors
Added new feature - Instances
	Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified.
Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present)
Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present)
Updated TWEAK menu to include WorldNumber and instanceID
Fixed BaseWeight option in TWEAK menu
Updated CBase_Teleport - now takes an optional 5th parameter instanceID
Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID
Updated SE_FindMulti now takes an optional 5th parameter - instanceID
Updated SE_GetItem now takes an optional 5th parameter - instanceID
Updated SE_FindItem now takes an optional 6th parameter - instanceID
Added new JS property for Items, Characters, Regions: .instanceID
Added JS property for Regions: .members - returns comma-separated list of town member serials
Updated JS scripts making use of the above-mentioned JS Methods/Functions
Updated dictionaries with new tweak menu entry texts
Exposed SpawnRegions to JS engine, and updated JS docs with details:
	SpawnRegion JS Functions
		IterateOverSpawnRegions()
		GetSpawnRegion( spawnRegNum )
		GetSpawnRegionCount()
	SpawnRegion JS Properties
		name
		regionNum
		itemList
		npcList
		item
		npc
		maxItems
		maxNpcs
		itemCount
		npcCount
		onlyOutside
		prefZ
		x1
		y1
		x2
		y2
		world
		instanceID
		minTime
		maxTime
		call
2020-08-08 13:57:15 +08:00
Geir Ove Alnes
e1d376a1fd Updating CVS to bring it up to speed with latest UOX3 version - 0.99.2 2012-11-03 18:11:04 +00:00
Matthew Randall
afc0c8e0ac Added:
-JS Get/Set "vulnerable" handlers for character properties (Abaddon)
  -willHunger with Get/Set HungerStatus() wrappers to CChar class (can now
   selectively stop a character/creature from continuing to hunger)
  -JS Get/Set "willhunger" handlers for character properties Changed:
  Linux compile fixes (thanks Malketh)
	Hash.h warning fixed (thanks Philantrop)
	Fixes to getRootPack() and getPackOwner()
	Removed many #includes from the global scope, including them in the specific files that need them
		This should greatly reduce compile time and filesize, along with the need to recompile after altering most headers
	Removed the linux ifdefs around typedefd function declarations, this should work with gcc 3.2
	Moved global loading functions into a new cFileIO() class to take them out of global scope
	Fixed an issue causing items to not be sent to the client (thanks Malketh)
	Moved some global structs into the CWorldMain class
	Fixed a bug causing a crash on character / item creation
	Moved all effects stuff into its own class to take it out of global scope
	Changed the variable CChar::region to CChar::regionNum to avoid conflicts with the cTownRegion region[] indexes
	Moved getbestskill(), isHuman(), and inDungeon() into the CChar class to remove them from global scope
	Took npcSimpleAttackTarget() out of global scope
	Rewrote restock() to make use of restockNPC()
	Changed the typedef'd iterator in hash.h to HASHITERATOR to kill a Linux warning
	Renamed cEffects::soundeffect() to PlaySound() and removed unneeded overloads
	Fixed a bug causing executebatch to be set with locationcount data
	Rewrote cEffects::bgsound()
	Documented sounds.cpp
	Misc minor cleanups / fixes
Removed:
	sendItemsInRange() (CChar::Teleport() does the same thing)
	Many #includes that were not being used
	deathMenu()
	respawnnow() and moved all of its code into command_respawn()
	one instance of cEffects::scpSoundEffect() and renamed the other to PlaySound()

3/13/2003
Changed
	Fixed an issue allowing the server to not have a dictionary.ZRO (which would cause a crash when a dictionary entry was called with no language)
	Fixed an issue causing the server to puke when it attempted a restart
	Moved SpawnRandomItem() into cItem class
	Moved SpawnRandomMonster() into cCharHandle class
	Broke necro.dfn into fishing.dfn and digging.dfn
	Made better use of SpawnRandomItem() and SpawnRandomMonster()

3/12/2003
Added:
	CPOpenGump and CPSpeech packet class to remove some global vars (Note these are pretty basic classes and someone
		with a better understanding of how we handle sending/recieving packets could probably expand these to make better use of them)
Changed:
	Moved many global vars into the CWorldMain() class
	Cleaned ResetVars() in uox3.cpp as ResetDefaults() in CWorldMain() now handles much of that
	Added a check to ensure text wasn't sent twice in talking(), should fix double-speech
	Cleaned up cmdtable.cpp removing a couple duplicate entries, etc
	Changed target() to only require 4 values (as the first two were always 0 and 1)
	Removed many unneeded typedefs and globals
	Went through cServerData() and noted unused server.ini entries
	Moved title1(), title2(), and title3() to cClick.cpp since that is their only usage, made use
		of MAX_TITLE to ensure we wouldn't overrun the buffers, and renamed them matching what title they were

3/11/2003
Changed:
	Fixed a potentially very serious bugs with how containers were being set upon loading the world
	Fixed possible re-adding of weight to containers and characters at load
	Fixed a bug causing equipped items that were not weapons to take damage in combat
	Minor cleanups / warning fixes / Linux compatability issues (punt)

3/7/2003
Overhauls/Additions/Major Changes
Changed:

Tweaks/Object Conversions/Misc Small Changes
Changed:
	Changed CItem::Get/SetLayer() to a UI08
	Fixed a bug in speech causing you to see your own text twice
	Fixed a nasty crash bug
2003-03-23 10:18:02 +00:00
Matthew Randall
16ba505535 Mainly little smallish fixes. I think this covered double speech, and in valid speech when actually in range(not sure). And just general little code cleanups 2003-03-08 06:51:01 +00:00
Matthew Randall
aa5e1b64e9 Code tidying, switch over from Dist to isInRange(), Small weight fies. 2003-03-04 10:33:17 +00:00
Matthew Randall
7f22793b19 Part of the excessif file handle useage that was preventing UOX3 from saving more than 512 times. The maximum allowed count of file handles. 2002-10-25 04:51:09 +00:00
duckhead
ffd7a25027 Add files that were skipped due to dead revisions.
Add in changes to cServerDefinitions that will permit relative paths in DIRECTORY Setting in uox.ini
2002-04-07 21:27:53 +00:00
Charles Kerr
edd9557190 Deleted old unused source. Use the new directory tree 2001-02-27 01:37:28 +00:00
Thiago Correa
76a620a844 Merge with Build 0.70.03.21d 2001-02-17 05:15:40 +00:00
Thiago Correa
ad034ede2c Merge with Official Release 0.70.03.21c2
Exploit fix: Equiping weapon when dead.
Also has some improvements in SNOOPING
2001-02-06 18:21:41 +00:00
anshil
4220990cd6 some small beautifications 2001-02-01 18:18:13 +00:00
anshil
63acf90438 release 0.70.03.21a 2001-01-31 19:29:09 +00:00
anshil
e249bbde9d Correa's beautifcations 2001-01-27 09:33:52 +00:00
anshil
91addd1571 initial tree creation from official source release 0.70.03.21 2001-01-25 14:05:17 +00:00