2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
//| File - cAccountClass.cpp
//| Date - 12/6/2002 4:16:33 AM
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
//| Purpose - Seeing as I had screwed up accounts so bad, I started from
//| scratch. The concept of how they work has been reevaluated
//| and will be changed to suit a more understandable direction.
//| See xRFC0004 for complete specification and implementaion
//| information.
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
2003-01-20 16:14:57 +00:00
# include "uox3.h"
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
# include "cVersionClass.h"
2021-07-04 07:57:42 +08:00
# include "enums.h"
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
# include <cstdint>
# include <filesystem>
# include "StringUtility.hpp"
2022-03-05 09:12:21 -05:00
# include "osunique.hpp"
2021-06-12 08:02:17 -04:00
# if PLATFORM != WINDOWS
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
# include <arpa/inet.h>
2012-11-03 18:11:04 +00:00
# endif
cAccountClass * Accounts ;
2003-01-20 16:14:57 +00:00
2012-11-03 18:11:04 +00:00
const UI08 CHARACTERCOUNT = 7 ;
2003-01-20 16:14:57 +00:00
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
//| Function - Class Construction and Desctruction
//| Date - 12/6/2002 4:18:58 AM
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
//| Purpose - Classic class construction and destruction
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
//|
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
//| Changes - Added the member to handle the stream to packet packing
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
//| symantics. I put it here because from most levels of
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
//| object the pointer to accounts data is fairly consistant
//| and readily available
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
cAccountClass : : cAccountClass ( ) : m_sAccountsDirectory ( " . \\ " )
2003-01-20 16:14:57 +00:00
{
2012-11-03 18:11:04 +00:00
m_wHighestAccount = 0x0000 ;
2022-10-24 18:39:33 +08:00
I = m_mapUsernameIdMap . end ( ) ;
2012-11-03 18:11:04 +00:00
actbInvalid . wAccountIndex = AB_INVALID_ID ;
2003-01-20 16:14:57 +00:00
}
//
2022-10-24 18:39:33 +08:00
cAccountClass : : cAccountClass ( const std : : string & sAccountsPath ) : cAccountClass ( )
{
2003-01-20 16:14:57 +00:00
// Set accounts path.
try
{
2022-10-24 18:39:33 +08:00
m_sAccountsDirectory = sAccountsPath ;
2012-11-03 18:11:04 +00:00
}
catch ( . . . )
2003-01-20 16:14:57 +00:00
{
throw ;
}
}
2022-06-14 11:36:04 -04:00
2003-01-20 16:14:57 +00:00
//
cAccountClass : : ~ cAccountClass ( )
{
}
//
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - cAccountClass::CreateAccountSystem()
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
//| Date - 12/6/2002 4:19:53 AM
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
//| Purpose - Instead of expecting end users to fix the accounts by hand
//| the idea of a member function that would provide some means
//| to automate the process was devised.
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
//|
//| This function is intended for use in uox3 v0.97.0 and
//| v0.97.1+ builds for converting them to the new system. This
//| member function will also create a new account system for
//| pre v0.97.00 versions. However pre UOX3 v0.97.00 characters
//| will be lost even if world files have been converted and
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
//| unable to locate the respective character ID number when
//| converting the world.
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
UI16 cAccountClass : : CreateAccountSystem ( void )
2003-01-20 16:14:57 +00:00
{
// Get the system account path. Should have been set at construction.
std : : string sActPath = m_sAccountsDirectory ;
// Check account path to make sure that its at least got data in it.
2012-11-03 18:11:04 +00:00
if ( sActPath . length ( ) < = 3 )
2003-01-20 16:14:57 +00:00
{
// If your wondering why a length of 3 - IE: 'C:\'. Send back indication that no accounts were processed
return 0x0000 ;
}
// Build the full path and filename string here for access.adm
std : : string sAccessAdm = sActPath ;
2022-10-24 18:39:33 +08:00
sAccessAdm + = ( sActPath [ sActPath . length ( ) - 1 ] = = ' \\ ' | | sActPath [ sActPath . length ( ) - 1 ] = = ' / ' ) ? " access.adm " : " /access.adm " ;
2003-01-20 16:14:57 +00:00
// Create stream and open the Access.adm file if it exists.
2012-11-03 18:11:04 +00:00
//bool bIsNew = true;
2022-10-24 18:39:33 +08:00
std : : fstream fs1 ( sAccessAdm . c_str ( ) , std : : ios : : in ) ;
2012-11-03 18:11:04 +00:00
// Following is commented out, as it only serves to set bIsNew=false at the moment, which is not used anywhere
//if( !fs1.is_open() )
//{
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
// Ok there was no access.adm this implies that this is a pre v0.97.00 release
2012-11-03 18:11:04 +00:00
// bIsNew=false;
//}
2003-01-20 16:14:57 +00:00
// Build the full path and filename string here for accounts.adm
std : : string sAccountsAdm = sActPath ;
2022-10-24 18:39:33 +08:00
sAccountsAdm + = ( sActPath [ sActPath . length ( ) - 1 ] = = ' \\ ' | | sActPath [ sActPath . length ( ) - 1 ] = = ' / ' ) ? " accounts.adm " : " /accounts.adm " ;
2003-01-20 16:14:57 +00:00
// Create stream and open the Accounts.Adm file for processing
2022-10-24 18:39:33 +08:00
std : : fstream fs2 ( sAccountsAdm . c_str ( ) , std : : ios : : in ) ;
2012-11-03 18:11:04 +00:00
if ( ! fs2 . is_open ( ) )
2003-01-20 16:14:57 +00:00
{
// ok there was some error. Either the file doesn't exist or a system error.
2012-11-03 18:11:04 +00:00
if ( fs1 . is_open ( ) )
2022-10-24 18:39:33 +08:00
{
2003-01-20 16:14:57 +00:00
fs1 . close ( ) ;
2022-10-24 18:39:33 +08:00
}
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
return 0x0000 ;
2003-01-20 16:14:57 +00:00
}
// We need to read from the stream once before entering the loop
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
std : : string sLine ;
2012-11-03 18:11:04 +00:00
std : : getline ( fs2 , sLine ) ;
2003-01-20 16:14:57 +00:00
// Ok start the loop and process
2012-11-03 18:11:04 +00:00
bool bBraces [ 3 ] = { false , false , false } ;
bool bBraces2 [ 3 ] = { false , false , false } ;
2022-10-24 18:39:33 +08:00
CAccountBlock_st actb ;
UI16 wAccountId = 0x0000 ;
2022-11-14 19:24:29 -05:00
[[maybe_unused]] UI16 wAccessId = 0x0000 ;
2012-11-03 18:11:04 +00:00
UI16 wAccountCount = 0x0000 ;
UI08 nLockCount = 0x00 ;
bool bSkipUAD = false ;
actb . reset ( ) ;
2022-03-04 07:35:46 -05:00
sLine = oldstrutil : : trim ( oldstrutil : : removeTrailing ( sLine , " // " ) ) ;
2012-11-03 18:11:04 +00:00
while ( ! fs2 . eof ( ) & & ! fs2 . fail ( ) )
{
if ( sLine . empty ( ) | | sLine . length ( ) = = 0 ) // Either nothing on the line, or there was a comment we've ignored
{
std : : getline ( fs2 , sLine ) ;
2022-03-04 07:35:46 -05:00
sLine = oldstrutil : : trim ( oldstrutil : : removeTrailing ( sLine , " // " ) ) ;
2003-01-20 16:14:57 +00:00
continue ;
}
2003-01-26 20:54:31 +00:00
// Check to see if there is an EOF for those that are like legacy FREAKS!!! Freaks I say!!
2012-11-03 18:11:04 +00:00
if ( " EOF " = = sLine )
2003-01-26 20:54:31 +00:00
{
2012-11-03 18:11:04 +00:00
std : : getline ( fs2 , sLine ) ;
2022-03-04 07:35:46 -05:00
sLine = oldstrutil : : trim ( oldstrutil : : removeTrailing ( sLine , " // " ) ) ;
2003-01-26 20:54:31 +00:00
continue ;
}
2003-01-20 16:14:57 +00:00
// Keep track of the section account lines. There is nothing to process till at least one of these has been read
2012-11-03 18:11:04 +00:00
if ( sLine . substr ( 0 , 15 ) = = " SECTION ACCOUNT " )
2003-01-20 16:14:57 +00:00
{
2021-07-04 02:26:43 +08:00
// Ok the section block was found, Tokenize the string to get the account #
2022-10-24 18:39:33 +08:00
auto accountIdFromFile = oldstrutil : : value < SI32 > ( oldstrutil : : extractSection ( sLine , " " , 2 , 2 ) ) ;
if ( accountIdFromFile = = 0 & & wAccountCount > 0 )
2021-07-04 02:26:43 +08:00
{
actb . wAccountIndex = wAccountCount ;
2022-10-24 18:39:33 +08:00
wAccountId = wAccountCount ;
2021-07-04 02:26:43 +08:00
}
else
{
2022-10-24 18:39:33 +08:00
actb . wAccountIndex = accountIdFromFile ;
wAccountId = accountIdFromFile ;
2021-07-04 02:26:43 +08:00
}
2003-01-20 16:14:57 +00:00
// Increment the account acount
2012-11-03 18:11:04 +00:00
+ + wAccountCount ;
2021-07-04 02:26:43 +08:00
2003-01-20 16:14:57 +00:00
// Ok, we have parsed out the account ID, Set bBraces[2] to true to allow block reading
2012-11-03 18:11:04 +00:00
bBraces [ 0 ] = false ;
bBraces [ 1 ] = false ;
bBraces [ 2 ] = true ;
2003-01-20 16:14:57 +00:00
// Get the next line and continue
2012-11-03 18:11:04 +00:00
std : : getline ( fs2 , sLine ) ;
2022-03-04 07:35:46 -05:00
sLine = oldstrutil : : trim ( oldstrutil : : removeTrailing ( sLine , " // " ) ) ;
2003-01-20 16:14:57 +00:00
continue ;
}
// Fail safe. If bBraces[2] isn't set there is no need to even run this code
2012-11-03 18:11:04 +00:00
if ( ! bBraces [ 2 ] )
2003-01-20 16:14:57 +00:00
{
// Make sure the get the next line to process.
2012-11-03 18:11:04 +00:00
std : : getline ( fs2 , sLine ) ;
2022-03-04 07:35:46 -05:00
sLine = oldstrutil : : trim ( oldstrutil : : removeTrailing ( sLine , " // " ) ) ;
2003-01-20 16:14:57 +00:00
continue ;
}
// If we get here then were reading a block now. Check for the openning brace.
2012-11-03 18:11:04 +00:00
if ( sLine [ 0 ] = = ' { ' & & ! bBraces [ 0 ] & & ! bBraces [ 1 ] )
2003-01-20 16:14:57 +00:00
{
2012-11-03 18:11:04 +00:00
bBraces [ 0 ] = true ;
std : : getline ( fs2 , sLine ) ;
2022-03-04 07:35:46 -05:00
sLine = oldstrutil : : trim ( oldstrutil : : removeTrailing ( sLine , " // " ) ) ;
2003-01-20 16:14:57 +00:00
continue ;
}
2022-10-24 18:39:33 +08:00
if ( ( ( sLine [ 0 ] = = ' { ' ) & & bBraces [ 0 ] ) | | ( ( sLine [ 0 ] = = ' { ' ) & & bBraces [ 1 ] ) )
2003-01-20 16:14:57 +00:00
{
fs2 . close ( ) ;
fs1 . close ( ) ;
return 0x0000 ;
}
2012-11-03 18:11:04 +00:00
if ( sLine [ 0 ] = = ' } ' & & bBraces [ 0 ] & & ! bBraces [ 1 ] )
2003-01-20 16:14:57 +00:00
{
// Ok we shoud shove this into the map(s) for use later
2022-10-24 18:39:33 +08:00
m_mapUsernameIdMap [ actb . wAccountIndex ] = actb ;
m_mapUsernameMap [ actb . sUsername ] = & m_mapUsernameIdMap [ actb . wAccountIndex ] ;
2003-01-20 16:14:57 +00:00
// Ok we have finished with this access block clean up and continue processing
2012-11-03 18:11:04 +00:00
bBraces [ 0 ] = false ;
bBraces [ 1 ] = false ;
bBraces [ 2 ] = false ;
bBraces [ 0 ] = false ;
nLockCount = 0 ;
std : : getline ( fs2 , sLine ) ;
2022-03-04 07:35:46 -05:00
sLine = oldstrutil : : trim ( oldstrutil : : removeTrailing ( sLine , " // " ) ) ;
2003-01-20 16:14:57 +00:00
continue ;
}
// Set up the tokenizing
2022-03-04 07:35:46 -05:00
auto ssecs = oldstrutil : : sections ( sLine , " " ) ;
auto l = oldstrutil : : trim ( oldstrutil : : removeTrailing ( ssecs [ 0 ] , " // " ) ) ;
2021-07-04 02:26:43 +08:00
std : : string r = " " ;
if ( ssecs . size ( ) > 1 )
{
2022-03-04 07:35:46 -05:00
r = oldstrutil : : trim ( oldstrutil : : removeTrailing ( ssecs [ 1 ] , " // " ) ) ;
2021-07-04 02:26:43 +08:00
}
2003-01-20 16:14:57 +00:00
// Parse and store based on tag
2012-11-03 18:11:04 +00:00
if ( " NAME " = = l )
2003-01-20 16:14:57 +00:00
{
2012-11-03 18:11:04 +00:00
if ( ! r . empty ( ) & & r . length ( ) ! = 0 )
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
{
2022-03-04 07:35:46 -05:00
actb . sUsername = r ; //oldstrutil::lower( r );
2021-07-04 02:26:43 +08:00
if ( ssecs . size ( ) > 2 )
2022-10-24 18:39:33 +08:00
{
2022-03-04 07:35:46 -05:00
actb . sUsername + = ssecs [ 2 ] ; // oldstrutil::lower( ssecs[2] );
2022-10-24 18:39:33 +08:00
}
2021-07-04 02:26:43 +08:00
// Next thing were going to do is make sure there isn't a duplicate username.
2022-10-24 18:39:33 +08:00
while ( IsUser ( actb . sUsername ) )
2021-07-04 02:26:43 +08:00
{
// This username is already on the list, keep adding a random value to the end of the username until we find a free one
2022-10-24 18:39:33 +08:00
actb . sUsername + = oldstrutil : : number ( RandomNum ( 10000 , 20000 ) ) ;
2021-07-04 02:26:43 +08:00
}
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
}
2003-01-20 16:14:57 +00:00
else
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
{
2012-11-03 18:11:04 +00:00
actb . sUsername = " ERROR " ;
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
}
2012-11-03 18:11:04 +00:00
std : : getline ( fs2 , sLine ) ;
2022-03-04 07:35:46 -05:00
sLine = oldstrutil : : trim ( oldstrutil : : removeTrailing ( sLine , " // " ) ) ;
2003-01-20 16:14:57 +00:00
continue ;
}
2012-11-03 18:11:04 +00:00
else if ( l = = " PASS " )
2003-01-20 16:14:57 +00:00
{
2012-11-03 18:11:04 +00:00
if ( ! r . empty ( ) & & r . length ( ) ! = 0 )
2003-01-20 16:14:57 +00:00
{
// Ok strip the password and store it.
2012-11-03 18:11:04 +00:00
actb . sPassword = r ;
2003-01-20 16:14:57 +00:00
// Now we have to parse the crap in access.adm. Were not gonna look at much format just the 2 tags we need.
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
std : : string sLine2 ;
2012-11-03 18:11:04 +00:00
if ( fs1 . is_open ( ) )
2003-01-20 16:14:57 +00:00
{
2012-11-03 18:11:04 +00:00
std : : getline ( fs1 , sLine2 ) ;
2022-03-04 07:35:46 -05:00
sLine2 = oldstrutil : : trim ( oldstrutil : : removeTrailing ( sLine2 , " // " ) ) ;
2012-11-03 18:11:04 +00:00
bBraces2 [ 2 ] = true ;
while ( ! fs1 . eof ( ) & & bBraces2 [ 2 ] & & ! fs1 . fail ( ) )
2003-01-20 16:14:57 +00:00
{
2012-11-03 18:11:04 +00:00
if ( sLine2 . empty ( ) & & sLine2 . length ( ) ! = 0 )
2003-01-20 16:14:57 +00:00
{
2012-11-03 18:11:04 +00:00
std : : getline ( fs1 , sLine2 ) ;
2022-03-04 07:35:46 -05:00
sLine2 = oldstrutil : : trim ( oldstrutil : : removeTrailing ( sLine2 , " // " ) ) ;
2003-01-20 16:14:57 +00:00
continue ;
}
// Keep track of the section account lines. There is nothing to process till at least one of these has been read
2022-10-24 18:39:33 +08:00
if ( sLine2 . substr ( 0 , 14 ) = = " SECTION ACCESS " )
2003-01-20 16:14:57 +00:00
{
// Ok the section block was found, Tokenize the string to get the account #
2022-10-24 18:39:33 +08:00
wAccessId = oldstrutil : : value < SI32 > ( oldstrutil : : extractSection ( sLine2 , " " , 2 ) ) ;
2003-01-20 16:14:57 +00:00
// Ok, we have parsed out the account ID, Set bBraces[2] to true to allow block reading
2012-11-03 18:11:04 +00:00
bBraces2 [ 0 ] = false ;
bBraces2 [ 1 ] = false ;
bBraces2 [ 2 ] = true ;
std : : getline ( fs1 , sLine2 ) ;
2003-01-20 16:14:57 +00:00
continue ;
}
// Fail safe. If bBraces[2] isn't set there is no need to even run this code
2012-11-03 18:11:04 +00:00
if ( ! bBraces2 [ 2 ] )
2003-01-20 16:14:57 +00:00
{
// Make sure the get the next line to process.
2012-11-03 18:11:04 +00:00
std : : getline ( fs1 , sLine2 ) ;
2003-01-20 16:14:57 +00:00
continue ;
}
// If we get here then were reading a block now. Check for the openning brace.
2012-11-03 18:11:04 +00:00
if ( sLine2 [ 0 ] = = ' { ' & & ! bBraces2 [ 0 ] & & ! bBraces2 [ 1 ] )
2003-01-20 16:14:57 +00:00
{
2012-11-03 18:11:04 +00:00
bBraces2 [ 0 ] = true ;
std : : getline ( fs1 , sLine2 ) ;
2003-01-20 16:14:57 +00:00
continue ;
}
2022-10-24 18:39:33 +08:00
if ( ( ( sLine2 [ 0 ] = = ' { ' ) & & bBraces2 [ 0 ] ) | | ( ( sLine2 [ 0 ] = = ' { ' ) & & bBraces2 [ 1 ] ) )
2003-01-20 16:14:57 +00:00
{
fs2 . close ( ) ;
fs1 . close ( ) ;
return 0x0000 ;
}
// Loop reading this block till the end brace is encountered.
2012-11-03 18:11:04 +00:00
while ( bBraces2 [ 0 ] & & ! fs1 . eof ( ) & & ! fs1 . fail ( ) )
2003-01-20 16:14:57 +00:00
{
// Read in the next line
2012-11-03 18:11:04 +00:00
std : : getline ( fs1 , sLine2 ) ;
2003-01-20 16:14:57 +00:00
// check for the closing brace
2012-11-03 18:11:04 +00:00
if ( sLine2 [ 0 ] = = ' } ' & & bBraces2 [ 0 ] & & ! bBraces2 [ 1 ] )
2003-01-20 16:14:57 +00:00
{
2012-11-03 18:11:04 +00:00
bBraces2 [ 0 ] = false ;
bBraces2 [ 1 ] = false ;
bBraces2 [ 2 ] = false ;
2003-01-20 16:14:57 +00:00
break ;
}
2022-03-04 07:35:46 -05:00
auto ssecs = oldstrutil : : sections ( sLine2 , " " ) ;
auto l2 = oldstrutil : : trim ( oldstrutil : : removeTrailing ( ssecs [ 0 ] , " // " ) ) ;
auto r2 = oldstrutil : : trim ( oldstrutil : : removeTrailing ( ssecs [ 1 ] , " // " ) ) ;
2003-01-20 16:14:57 +00:00
// Parse and store based on tag
2012-11-03 18:11:04 +00:00
if ( " PATH " = = l2 )
2003-01-20 16:14:57 +00:00
{
2012-11-03 18:11:04 +00:00
if ( ! r2 . empty ( ) & & r2 . length ( ) ! = 0 ) // Ok strip the name and store it. We need to make it all the same case for comparisons
2022-10-24 18:39:33 +08:00
{
2012-11-03 18:11:04 +00:00
actb . sPath = r2 + actb . sUsername + " .uad " ;
2022-10-24 18:39:33 +08:00
}
2003-01-20 16:14:57 +00:00
else
2022-10-24 18:39:33 +08:00
{
2012-11-03 18:11:04 +00:00
actb . sPath = " " ;
2022-10-24 18:39:33 +08:00
}
2003-01-20 16:14:57 +00:00
continue ;
}
2012-11-03 18:11:04 +00:00
if ( l2 = = " FLAGS " )
2003-01-20 16:14:57 +00:00
{
2012-11-03 18:11:04 +00:00
if ( ! r2 . empty ( ) & & r2 . length ( ) ! = 0 )
2003-01-20 16:14:57 +00:00
{
// Ok strip the flags and store it. We need to make it all the same case for comparisons
2022-10-24 18:39:33 +08:00
actb . wFlags = static_cast < UI16 > ( std : : stoul ( r2 , nullptr , 0 ) ) ; // -- Uses internal conversion code
2012-11-03 18:11:04 +00:00
if ( actb . wAccountIndex = = 0 )
2022-10-24 18:39:33 +08:00
{
2012-11-03 18:11:04 +00:00
actb . wFlags . set ( AB_FLAGS_GM , true ) ;
2022-10-24 18:39:33 +08:00
}
2003-01-20 16:14:57 +00:00
}
else
{
2012-11-03 18:11:04 +00:00
actb . wFlags . reset ( ) ;
if ( actb . wAccountIndex = = 0 )
2022-10-24 18:39:33 +08:00
{
2012-11-03 18:11:04 +00:00
actb . wFlags . set ( AB_FLAGS_GM , true ) ;
2022-10-24 18:39:33 +08:00
}
2003-01-20 16:14:57 +00:00
}
continue ;
}
}
2012-11-03 18:11:04 +00:00
std : : getline ( fs1 , sLine ) ;
2003-01-20 16:14:57 +00:00
}
}
else
{
// Ok we might as well add the file name to this path, cause we will need it to open the
2022-10-24 18:39:33 +08:00
std : : string sTemp ( sActPath ) ;
2003-01-20 16:14:57 +00:00
sTemp + = actb . sUsername ;
2003-01-26 20:54:31 +00:00
sTemp + = " / " ;
actb . sPath = sTemp ;
// Need to create the directory for this entry as an access.adm isn't available
2022-10-24 18:39:33 +08:00
std : : filesystem : : create_directory ( std : : filesystem : : path ( actb . sPath ) ) ;
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
2003-01-26 20:54:31 +00:00
// Now build the uad filename, and path,
sTemp + = actb . sUsername ;
2003-01-20 16:14:57 +00:00
sTemp + = " .uad " ;
2003-01-26 20:54:31 +00:00
// Now that we have this we need to open, and write out this file.
2022-10-24 18:39:33 +08:00
std : : fstream fsUADFile ( sTemp . c_str ( ) , std : : ios : : trunc | std : : ios : : out ) ;
2012-11-03 18:11:04 +00:00
if ( ! fsUADFile . is_open ( ) )
2003-01-26 20:54:31 +00:00
{
fs2 . close ( ) ;
return 0x0000 ;
}
2022-10-24 18:39:33 +08:00
WriteUADHeader ( fsUADFile , actb ) ;
2003-01-26 20:54:31 +00:00
// Need to write out the charcters
2021-07-04 02:26:43 +08:00
for ( UI08 ii = 1 ; ii < CHARACTERCOUNT + 1 ; + + ii )
2003-03-05 21:28:34 +00:00
{
2022-10-24 18:39:33 +08:00
fsUADFile < < " CHARACTER- " < < std : : dec < < static_cast < SI32 > ( ii ) < < " 0xffffffff [UNKNOWN] " < < std : : endl ;
2003-03-05 21:28:34 +00:00
}
2003-01-26 20:54:31 +00:00
fsUADFile . close ( ) ;
// Flood fill the actb class for accounts
2021-07-04 02:26:43 +08:00
for ( UI08 i = 0 ; i < CHARACTERCOUNT ; i + + )
2012-11-03 18:11:04 +00:00
{
actb . dwCharacters [ i ] = INVALIDSERIAL ;
2021-06-12 07:30:23 -04:00
actb . lpCharacters [ i ] = nullptr ;
2003-01-26 20:54:31 +00:00
}
2003-01-20 16:14:57 +00:00
// Ok strip the name and store it. We need to make it all the same case for comparisons
2012-11-03 18:11:04 +00:00
actb . wFlags = 0x0004 ;
2003-01-26 20:54:31 +00:00
// If account 0 then we set gm privs
2022-10-24 18:39:33 +08:00
if ( wAccountId = = 0 )
{
2012-11-03 18:11:04 +00:00
actb . wFlags . set ( AB_FLAGS_GM , true ) ;
2022-10-24 18:39:33 +08:00
}
2012-11-03 18:11:04 +00:00
bSkipUAD = true ;
2003-01-20 16:14:57 +00:00
}
}
else
{
// r was not valid when passed in. Deal with it here
}
// Ok we have finished with this access block clean up and continue processing
2022-10-24 18:39:33 +08:00
bBraces2 [ 0 ] = false ;
bBraces2 [ 1 ] = false ;
bBraces2 [ 2 ] = false ;
2012-11-03 18:11:04 +00:00
std : : getline ( fs2 , sLine ) ;
2003-01-20 16:14:57 +00:00
continue ;
}
2012-11-03 18:11:04 +00:00
else if ( l = = " LASTIP " )
2003-01-20 16:14:57 +00:00
{
2022-03-04 07:35:46 -05:00
auto psecs = oldstrutil : : sections ( r , " . " ) ;
2021-07-04 02:26:43 +08:00
if ( ! r . empty ( ) & & r . length ( ) ! = 0 & & psecs . size ( ) = = 4 )
{
2022-10-24 18:39:33 +08:00
actb . dwLastIP = CalcSerial ( oldstrutil : : value < SI08 > ( psecs [ 0 ] ) , oldstrutil : : value < SI08 > ( psecs [ 1 ] ) , oldstrutil : : value < SI08 > ( psecs [ 2 ] ) , oldstrutil : : value < SI08 > ( psecs [ 3 ] ) ) ;
2021-07-04 02:26:43 +08:00
}
2003-01-20 16:14:57 +00:00
else
2021-07-04 02:26:43 +08:00
{
2012-11-03 18:11:04 +00:00
actb . dwLastIP = 0x00000000 ;
2021-07-04 02:26:43 +08:00
}
2012-11-03 18:11:04 +00:00
std : : getline ( fs2 , sLine ) ;
2003-01-20 16:14:57 +00:00
continue ;
}
2012-11-03 18:11:04 +00:00
else if ( l = = " CONTACT " )
2003-01-20 16:14:57 +00:00
{
// Ok strip the name and store it. We need to make it all the same case for comparisons
2012-11-03 18:11:04 +00:00
if ( ! r . empty ( ) & & r . length ( ) ! = 0 )
2022-10-24 18:39:33 +08:00
{
2022-03-04 07:35:46 -05:00
actb . sContact = oldstrutil : : lower ( r ) ;
2022-10-24 18:39:33 +08:00
}
2003-01-20 16:14:57 +00:00
else
2022-10-24 18:39:33 +08:00
{
2012-11-03 18:11:04 +00:00
actb . sContact = " UNKNOWN " ;
2022-10-24 18:39:33 +08:00
}
2012-11-03 18:11:04 +00:00
std : : getline ( fs2 , sLine ) ;
2003-01-20 16:14:57 +00:00
continue ;
}
2012-11-03 18:11:04 +00:00
else if ( l = = " TIMEBAN " )
2003-01-20 16:14:57 +00:00
{
2012-11-03 18:11:04 +00:00
if ( ! r . empty ( ) & & r . length ( ) ! = 0 )
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
{
2022-10-24 18:39:33 +08:00
actb . wTimeBan = static_cast < UI32 > ( std : : stoul ( r , nullptr , 0 ) ) ;
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
}
2003-01-20 16:14:57 +00:00
else
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
{
2012-11-03 18:11:04 +00:00
actb . wTimeBan = 0 ;
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
}
2012-11-03 18:11:04 +00:00
std : : getline ( fs2 , sLine ) ;
2003-01-20 16:14:57 +00:00
continue ;
}
2022-01-10 07:33:51 +08:00
else if ( l = = " FIRSTLOGIN " )
{
if ( ! r . empty ( ) & & r . length ( ) ! = 0 )
{
2022-10-24 18:39:33 +08:00
actb . wFirstLogin = static_cast < UI32 > ( std : : stoul ( r , nullptr , 0 ) ) ;
2022-01-10 07:33:51 +08:00
}
else
{
actb . wFirstLogin = 0 ;
}
std : : getline ( fs2 , sLine ) ;
continue ;
}
UOX3 0.99.6-RC6
Removed arbitrary and hidden restrictions on refreshing list of online players shown with 'wholist command
Fixed an issue where player ghosts that get teleported would not see themselves get updated to new location
Fixed a server crash from clients disconnecting while running server in debug mode
Improved how container updates are sent to players; now only sends to clients that have actually opened the container, and who are still within range
Added more information about UO data files being loaded during server startup
Enhanced the GM 'add menu to allow clicking directly on images of items/npcs to add them, and adjusted size of menus to accommodate this
Fixed an issue with fleeing NPCs that could cause them to attempt to flee across time and space, regardless of distance to target/attacker in combat
Added NPC AI that runs away from players if they get too close (even outside combat). Applied to hind, rabbits, squirrels, ferrets and various birds by default:
AI_ANIMAL_SCARED (aitype 12)
Fixed issues with NPCs fleeing forever, or getting stuck in flee/don't flee loop, by introducing max fleeing distance (50 tiles) and cooldown (30 sec) on fleeing
Updated onNameRequest JS Event to include third parameter with origin of name request, so script responses can be tailored appropriately:
onNameRequest( myObj, requestedBy, requestSource )
Potential values for requestSource:
0 - Speech/System Messages
1 - Guild Menus
2 - Stat Window (self)
3 - Stat Window (other)
4 - Tooltip
5 - Paperdoll Journal
6 - Paperdoll
7 - Single Click / All-Names
8 - System
9 - Secure Trade Window
Added Adaptive Performance System (APS) that dynamically adjust how often NPC AI/movement is checked based on overall shard performance. If performance drops below defined threshold, UOX3 gradually slows down checks for NPC AI/movement to prioritize player movement/speech/command responsiveness. If performance climbs back up above threshold, slowdowns are gradually removed. The following UOX.INI options have been added under [system] category to support this system:
APSPERFTHRESHOLD=50 // Performance threshold (measured in simulation cycles/sec) below which the APS kicks in
APSINTERVAL=100 // How often (in milliseconds) the APS checks performance and makes adjustments (if needed) to balance out shard performance
APSDELAYSTEP=50 // How much the delay timer is modified by (in milliseconds) each time APS makes adjustments
APSDELAYMAXCAP=2000 // Max amount of of delay APS can introduce for NPC AI/movement handling when attempting to restore shard performance
Added new JS Methods for Region objects:
.GetOrePrefs( oreType ) // Get ore preference data for ore type found in town region. Returned as an array containing the following data:
orePrefData -> [
oreName, // name of ore
color, // color of ore
minskill, // min skill to mine ore
ingotName, // name of ingot created from ore
makemenu, // makemenu entry for crafting something from ingot
oreChance, // default global chance of finding this ore type
scriptID // script attached to mined ore
],
orePrefChance // Chance of finding this ore type in given town region
.GetOreChance() // Get base chance of finding any ore in town region
Moved Mining skill plus gravedigging feature from hard code to scripts (js/skill/mining.js) to make it easier to maintain and/or customize, and removed hard coded variants
Gravedigging now relies on the ore resource system behind the scenes to restrict how often graves in a given area can be dug up
Fixed some incorrect references to .worldNumber Character property in misc scripts (should be .worldnumber)
Made some "hard-scripted" system messages in misc scripts use dictionary system instead
Added spawn region for banker NPCs in Serpent's Hold (dfndata/spawn/felucca/spawn_town_serpents_hold.dfn, dfndata/spawn/trammel/spawn_town_serpents_hold.dfn)
Fixed region definition of Ocllo to actually cover the entire town (dfndata/regions/regions.dfn)
Added numerous additional locations accessible with 'goplace # command, for key locations in Ilshenar, Malas, Tokuno Islands and Ter Mur (dfndata/location/location.dfn)
Revised travel-menu portion of GM menu (shortcut: 'travel) to include more travel options based on new locations (dfndata/items/travelmenu.dfn and travelmenu.bulk.dfn)
Fixed an issue where NPCs could attempt to attack targets in other worlds/instances
Added new JS Event that triggers for characters who are about to deal damage in combat. Complimentary to onDamage, which triggers for chars receiving damage:
onDamageDeal( dmgDealer, dmgReceiver, damageValue, damageType )
Added new JS Event that can trigger in global script upon creation of new player chars. Note that this will trigger in place of onCreateDFN event for player characters:
onCreatePlayer( pChar )
Added new JS Event that triggers for characters selecting a target with a spell. Complimentary to onSpellTarget, which triggers for targets selected with a spell:
onSpellTargetSelect( caster, target, spellNum )
Updated onCombatStart and onCombatEnd JS Events to also trigger for the other party in combat
Updated onPickup JS Event to include a third parameter - the potential container item was picked up from. Event now also triggers event in scripts attached to said containers:
onPickup( iPickedUp, pChar, iCont )
Added tracking of total playtime per individual character, and per account across all characters, and exposed these properties to JS engine:
.totalPlayTime // Account property, total playtime across all chars
.playTime // Character property, total playtime on given character only
Added new player-accessible command ('playtime) to spit out the playtime of current character/account as a whole (js/commands/playtime.js)
Implemented first version of Young Player System:
Replaced the UNUSED9 account flag with YOUNG, to be used by Young/New Player System
Added new JS Account property that gets/sets whether player account is considered Young:
.isYoung
Added new Char timers:
TIMER_YOUNGHEAL // Restricts how often Young players are healed by NPC healers
TIMER_YOUNGMESSAGE // Restricts how often Young players are warned about dangerous looking monsters in overworld
Updated GM commands 'get and 'set to get/set .isYoung property of player's account (js/commands/targeting/get.js and set.js)
Added new UOX.INI setting to enable/disable Young Player System (enabled by default):
YOUNGPLAYERSYSTEM=1
If Young Player System is enabled, all newly created player accounts are automatically marked with Young flag
Added new script to handle various restrictions and functions related to Young characters (js/player/young_player.js):
Young characters will have [Young] displayed over their head
Young characters will have their Young status checked and verified on every login + every stat/skill gain, to revoke the Young status if any of the following is true:
Account has a total playtime of more than 40 hours
Any character has more than 350 total (base) skill points
Any character has more than 70 skill points in a single skill
Any character has more than 150 total stat points
Any character has more than 80 stat points in a single stat
Young characters can renounce their Young status manually by saying the words "I renounce my young player status"
Young characters get two additional items upon creation:
a new player ticket (can be combined with any other players new player ticket for both players to get a reward)
a sextant (shows Young players directions to nearest moongate/bank regardless of where they are, as long as outdoors)
Young characters cannot target other player characters with hostile spells or skills
Young characters cannot be the target of other player characters' hostile spells or skills
Young characters can only cast beneficial spells upon themselves or other Young characters
Young characters can only be the target of beneficial spells from other Young players
Young players (and their pets/followers) cannot attack or harm any other players (or their pets/followers), nor themselves be attacked or harmed by any other players (or their pets/followers), whether from combat, spells, skills or items
Young players don't lose any of their items on death, and are teleported to the nearest healer upon death with all their items intact
Young players receive a warning upon entering dungeons that monsters there will be hostile
Updated global script (js/server/global.js) to:
Check/Verify Young status of players upon login
Attach young player script on login/creation for players on Young accounts
Give specific items to Young players upon creation
Added new script (js/item/corpse.js) that is assigned to all freshly created corpses. This script handles restrictions related to Young players interactions with corpses, and the interactions of other players with corpses of Young players
Updated JS Method .Carve() to return true/false depending on whether carving a corpse was successful
Updated Healer AI in code to heal nearby injured Young players
Updated Evil AI and Evil Caster AI in code to avoid selecting Young players as targets in combat outside of dungeons
Added a new section to UOX.INI - [young player starting locations] - that can be used to define starting locations for Young players. If only one such location is provided, all players start there. Otherwise, it matches the same starting location setup as the regular one - with one entry per town in Britannia.
Restricted transferring and/or friending of pets (code) and hirelings (hirelings.js) between Young and non-Young players
Restricted Young players from recalling or gating to Felucca facet
Young players can instantly logout from anywhere, at any time
2023-07-01 20:02:40 +08:00
else if ( l = = " TOTALPLAYTIME " )
{
if ( ! r . empty ( ) & & r . length ( ) ! = 0 )
{
actb . wTotalPlayTime = static_cast < UI32 > ( std : : stoul ( r , nullptr , 0 ) ) ;
}
else
{
actb . wTotalPlayTime = 0 ;
}
std : : getline ( fs2 , sLine ) ;
continue ;
}
2012-11-03 18:11:04 +00:00
else if ( l = = " LOCK " )
2003-01-26 20:54:31 +00:00
{
2012-11-03 18:11:04 +00:00
if ( nLockCount < = 5 )
2003-01-26 20:54:31 +00:00
{
2022-10-24 18:39:33 +08:00
if ( std : : stoi ( r , nullptr , 0 ) > 0 )
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
{
2022-10-24 18:39:33 +08:00
actb . wFlags . set ( ( AB_FLAGS_CHARACTER1 + static_cast < size_t > ( nLockCount ) ) , true ) ;
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
}
2003-01-26 20:54:31 +00:00
}
2012-11-03 18:11:04 +00:00
+ + nLockCount ;
std : : getline ( fs2 , sLine ) ;
2003-01-26 20:54:31 +00:00
continue ;
}
2012-11-03 18:11:04 +00:00
else if ( l = = " PUBLIC " )
2003-01-20 16:14:57 +00:00
{
2012-11-03 18:11:04 +00:00
if ( ! r . empty ( ) & & r . length ( ) ! = 0 )
2003-01-20 16:14:57 +00:00
{
// Ok strip the name and store it. We need to make it all the same case for comparisons
2012-11-03 18:11:04 +00:00
if ( r = = " ON " ) // Set the Public Flag on. Public implies that a users conatact information can be published on the web.
2022-10-24 18:39:33 +08:00
{
2012-11-03 18:11:04 +00:00
actb . wFlags . set ( AB_FLAGS_PUBLIC , true ) ;
2022-10-24 18:39:33 +08:00
}
2003-01-20 16:14:57 +00:00
}
2012-11-03 18:11:04 +00:00
std : : getline ( fs2 , sLine ) ;
2003-01-20 16:14:57 +00:00
continue ;
}
2012-11-03 18:11:04 +00:00
else if ( l . substr ( 0 , 10 ) = = " CHARACTER- " )
2003-01-20 16:14:57 +00:00
{
2022-10-24 18:39:33 +08:00
SI32 charNum = std : : stoi ( l . substr ( 10 ) , nullptr , 0 ) ;
2021-07-04 07:57:42 +08:00
if ( charNum < 1 | | charNum > CHARACTERCOUNT )
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
{
2022-10-24 18:39:33 +08:00
Console . Error ( " Invalid character found in accounts " ) ;
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
}
2012-11-03 18:11:04 +00:00
else
2003-01-20 16:14:57 +00:00
{
2022-11-27 20:51:50 -05:00
r = oldstrutil : : trim ( r ) ;
if ( ! r . empty ( ) )
2003-01-20 16:14:57 +00:00
{
2022-11-27 20:51:50 -05:00
auto temp = oldstrutil : : value < std : : int64_t > ( r ) ; // int64_t used for promotion from 32-bit int
if ( ( temp > 0 ) & & ( temp < static_cast < std : : int64_t > ( INVALIDSERIAL ) ) )
{
actb . dwCharacters [ charNum - 1 ] = static_cast < UI32 > ( std : : stoul ( r , nullptr , 0 ) ) ;
actb . lpCharacters [ charNum - 1 ] = CalcCharObjFromSer ( actb . dwCharacters [ charNum - 1 ] ) ;
}
else
{
actb . dwCharacters [ charNum - 1 ] = INVALIDSERIAL ;
actb . lpCharacters [ charNum - 1 ] = nullptr ;
}
2003-01-20 16:14:57 +00:00
}
}
2012-11-03 18:11:04 +00:00
std : : getline ( fs2 , sLine ) ;
2003-01-20 16:14:57 +00:00
continue ;
}
2012-11-03 18:11:04 +00:00
std : : getline ( fs2 , sLine ) ;
2003-01-20 16:14:57 +00:00
}
//
m_wHighestAccount = wAccountCount ;
// Make sure to close our open paths.
fs2 . close ( ) ;
fs1 . close ( ) ;
2003-01-26 20:54:31 +00:00
// If this is the first run with a legacy accounts.adm then we dont need to do this
2012-11-03 18:11:04 +00:00
if ( ! bSkipUAD )
2003-01-20 16:14:57 +00:00
{
2003-01-26 20:54:31 +00:00
// Ok the next thing were going to have to do is check paths, make new paths and write the UAD file back into the respective directory
2022-10-24 18:39:33 +08:00
for ( MAPUSERNAMEID_ITERATOR CJ = m_mapUsernameIdMap . begin ( ) ; CJ ! = m_mapUsernameIdMap . end ( ) ; + + CJ )
2003-01-20 16:14:57 +00:00
{
2003-01-26 20:54:31 +00:00
// Pull the data into a usable form
2022-10-24 18:39:33 +08:00
CAccountBlock_st & actbTemp = CJ - > second ;
2003-01-26 20:54:31 +00:00
// Now we want to copy the files from the path to the new directory.
2022-10-24 18:39:33 +08:00
char cDirSep = sActPath [ sActPath . length ( ) - 1 ] ;
2012-11-03 18:11:04 +00:00
std : : string sNewPath ( sActPath ) ;
if ( cDirSep = = ' \\ ' | | cDirSep = = ' / ' )
2003-01-20 16:14:57 +00:00
{
2003-01-26 20:54:31 +00:00
sNewPath + = actbTemp . sUsername ;
sNewPath + = " / " ;
2003-01-20 16:14:57 +00:00
}
2003-01-26 20:54:31 +00:00
else
{
sNewPath + = " / " ;
sNewPath + = actbTemp . sUsername ;
sNewPath + = " / " ;
}
// Create the accounts directory now that we have the username added. If it exists it doesn't matter.
2022-10-24 18:39:33 +08:00
if ( ! std : : filesystem : : exists ( std : : filesystem : : path ( sNewPath ) ) )
{
auto create_status = std : : filesystem : : create_directory ( std : : filesystem : : path ( sNewPath ) ) ;
if ( ! create_status )
{
Console . Error ( oldstrutil : : format ( " CreateAccountSystem(): Couldn't create directory %s " , sNewPath . c_str ( ) ) ) ;
m_mapUsernameIdMap . clear ( ) ;
2003-01-26 20:54:31 +00:00
m_mapUsernameMap . clear ( ) ;
return 0L ;
}
2003-01-20 16:14:57 +00:00
}
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
2003-01-26 20:54:31 +00:00
// Now open and copy the files. to their new location.
2012-11-03 18:11:04 +00:00
if ( ! actbTemp . sPath . length ( ) )
2003-01-20 16:14:57 +00:00
{
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
// the file/path was not found so we should make an entry
2022-10-24 18:39:33 +08:00
std : : string sOutFile ( sNewPath ) ;
if ( sOutFile [ sOutFile . length ( ) - 1 ] ! = ' \\ ' & & sOutFile [ sOutFile . length ( ) - 1 ] ! = ' / ' )
{
2003-01-27 01:33:44 +00:00
sOutFile + = " / " ;
2022-10-24 18:39:33 +08:00
}
2003-01-26 20:54:31 +00:00
sOutFile + = actbTemp . sUsername ;
sOutFile + = " .uad " ;
2022-10-24 18:39:33 +08:00
std : : fstream fsOut ( sOutFile . c_str ( ) , std : : ios : : out ) ;
2012-11-03 18:11:04 +00:00
if ( ! fsOut . is_open ( ) )
2003-01-26 20:54:31 +00:00
{
return 0L ;
}
// Ok we have to write the new username.uad file in the directory
2012-11-03 18:11:04 +00:00
WriteUADHeader ( fsOut , actbTemp ) ;
2003-01-26 20:54:31 +00:00
// Ok write out the characters and the charcter names if we know them
2021-07-04 07:57:42 +08:00
for ( SI32 i = 0 ; i < CHARACTERCOUNT ; + + i )
2003-01-26 20:54:31 +00:00
{
2022-10-24 18:39:33 +08:00
fsOut < < " CHARACTER- " < < ( i + 1 ) < < " 0x " < < std : : hex
< < ( actbTemp . dwCharacters [ i ] ! = INVALIDSERIAL ? actbTemp . lpCharacters [ i ] - > GetSerial ( ) : INVALIDSERIAL )
< < " [ " < < ( char * ) ( actbTemp . lpCharacters [ i ] ! = nullptr ? actbTemp . lpCharacters [ i ] - > GetName ( ) . c_str ( ) : " UNKNOWN " ) < < " ] \n " ;
2003-01-26 20:54:31 +00:00
}
// Close the files since we dont need them anymore
fsOut . close ( ) ;
2003-01-20 16:14:57 +00:00
}
2003-01-26 20:54:31 +00:00
else
2003-01-20 16:14:57 +00:00
{
2022-10-24 18:39:33 +08:00
std : : fstream fsIn ( actbTemp . sPath . c_str ( ) , std : : ios : : in ) ;
std : : string sOutFile ( sNewPath ) ;
if ( sOutFile [ sOutFile . length ( ) - 1 ] ! = ' \\ ' & & sOutFile [ sOutFile . length ( ) - 1 ] ! = ' / ' )
{
2003-01-27 01:33:44 +00:00
sOutFile + = " / " ;
2022-10-24 18:39:33 +08:00
}
2003-01-26 20:54:31 +00:00
sOutFile + = actbTemp . sUsername ;
sOutFile + = " .uad " ;
2022-03-04 07:35:46 -05:00
sOutFile = oldstrutil : : replaceSlash ( sOutFile ) ;
2022-10-24 18:39:33 +08:00
std : : fstream fsOut ( sOutFile . c_str ( ) , std : : ios : : out ) ;
2012-11-03 18:11:04 +00:00
if ( ! fsOut . is_open ( ) )
2003-01-26 20:54:31 +00:00
{
// we cannot open the out file.
fsIn . close ( ) ;
// free up any allocation of memory made.
2022-10-24 18:39:33 +08:00
m_mapUsernameIdMap . clear ( ) ;
2003-01-26 20:54:31 +00:00
m_mapUsernameMap . clear ( ) ;
return 0L ;
}
// ok Lets just copy one file to the next.
2012-11-03 18:11:04 +00:00
while ( ! fsIn . eof ( ) & & ! fsIn . fail ( ) )
2003-01-26 20:54:31 +00:00
{
char szLine [ 128 ] ;
2022-10-24 18:39:33 +08:00
fsIn . getline ( szLine , 127 ) ;
2003-01-26 20:54:31 +00:00
fsOut < < szLine < < std : : endl ;
2012-11-03 18:11:04 +00:00
if ( ! fsIn . is_open ( ) )
2003-01-27 01:33:44 +00:00
break ;
2003-01-26 20:54:31 +00:00
}
fsOut . close ( ) ;
2003-01-20 16:14:57 +00:00
fsIn . close ( ) ;
}
2003-01-26 20:54:31 +00:00
// Now were done so we want to update the path in our records before we write them
2012-11-03 18:11:04 +00:00
actbTemp . sPath = sNewPath ;
}
2003-01-26 20:54:31 +00:00
}
2003-01-20 16:14:57 +00:00
// Make a back up first, then Dump to new file,
2022-10-24 18:39:33 +08:00
std : : string sBUAccess ( sAccessAdm ) ;
2003-01-27 01:33:44 +00:00
sBUAccess + = " .bu " ;
2022-10-24 18:39:33 +08:00
[[maybe_unused]] int renameResult = rename ( sAccessAdm . c_str ( ) , sBUAccess . c_str ( ) ) ;
2003-01-27 01:33:44 +00:00
//
2022-10-24 18:39:33 +08:00
SI32 kk = 0 ;
std : : string szltoa2 ;
std : : string sBUPath ( sAccountsAdm ) ;
2003-01-20 16:14:57 +00:00
sBUPath + = " .bu " ;
2022-10-24 18:39:33 +08:00
SI32 nResp = rename ( sAccountsAdm . c_str ( ) , sBUPath . c_str ( ) ) ;
2003-01-26 20:54:31 +00:00
std : : string sNewPath = sBUPath ;
2012-11-03 18:11:04 +00:00
while ( nResp = = - 1 )
2003-01-26 20:54:31 +00:00
{
// Loop through 255 numbers, these will be added to the end of the bu in case a bu exists.
2022-03-04 07:35:46 -05:00
szltoa2 = oldstrutil : : format ( " %d " , kk + + ) ;
2003-01-27 01:33:44 +00:00
sNewPath + = szltoa2 ;
2022-10-24 18:39:33 +08:00
nResp = rename ( sAccountsAdm . c_str ( ) , sNewPath . c_str ( ) ) ;
2003-01-26 20:54:31 +00:00
sNewPath = sBUPath ;
} ;
2022-10-24 18:39:33 +08:00
std : : fstream fsOut ( sAccountsAdm . c_str ( ) , std : : ios : : trunc | std : : ios : : out ) ;
2012-11-03 18:11:04 +00:00
if ( ! fsOut . is_open ( ) )
2003-01-20 16:14:57 +00:00
{
// Error opening output file. Free up any allocation of memory made.
2022-10-24 18:39:33 +08:00
m_mapUsernameIdMap . clear ( ) ;
2003-01-20 16:14:57 +00:00
m_mapUsernameMap . clear ( ) ;
return 0L ;
}
2012-11-03 18:11:04 +00:00
WriteAccountsHeader ( fsOut ) ;
2022-10-24 18:39:33 +08:00
for ( MAPUSERNAMEID_ITERATOR CI = m_mapUsernameIdMap . begin ( ) ; CI ! = m_mapUsernameIdMap . end ( ) ; + + CI )
2003-01-20 16:14:57 +00:00
{
2022-10-24 18:39:33 +08:00
CAccountBlock_st & actbTemp = CI - > second ;
2012-11-03 18:11:04 +00:00
WriteAccountSection ( actbTemp , fsOut ) ;
2003-01-20 16:14:57 +00:00
}
// Close the file
fsOut . close ( ) ;
return wAccountCount ;
}
2022-10-24 18:39:33 +08:00
void cAccountClass : : WriteAccountSection ( CAccountBlock_st & actbTemp , std : : fstream & fsOut )
2003-01-20 16:14:57 +00:00
{
2012-11-03 18:11:04 +00:00
fsOut < < " SECTION ACCOUNT " < < std : : dec < < actbTemp . wAccountIndex < < std : : endl ;
fsOut < < " { " < < std : : endl ;
fsOut < < " NAME " < < actbTemp . sUsername < < std : : endl ;
fsOut < < " PASS " < < actbTemp . sPassword < < std : : endl ;
fsOut < < " FLAGS 0x " < < std : : hex < < actbTemp . wFlags . to_ulong ( ) < < std : : dec < < std : : endl ;
2022-10-24 18:39:33 +08:00
fsOut < < " PATH " < < oldstrutil : : replaceSlash ( actbTemp . sPath ) < < std : : endl ;
2012-11-03 18:11:04 +00:00
fsOut < < " TIMEBAN 0x " < < std : : hex < < actbTemp . wTimeBan < < std : : dec < < std : : endl ;
2022-01-10 07:33:51 +08:00
fsOut < < " FIRSTLOGIN 0x " < < std : : hex < < actbTemp . wFirstLogin < < std : : dec < < std : : endl ;
UOX3 0.99.6-RC6
Removed arbitrary and hidden restrictions on refreshing list of online players shown with 'wholist command
Fixed an issue where player ghosts that get teleported would not see themselves get updated to new location
Fixed a server crash from clients disconnecting while running server in debug mode
Improved how container updates are sent to players; now only sends to clients that have actually opened the container, and who are still within range
Added more information about UO data files being loaded during server startup
Enhanced the GM 'add menu to allow clicking directly on images of items/npcs to add them, and adjusted size of menus to accommodate this
Fixed an issue with fleeing NPCs that could cause them to attempt to flee across time and space, regardless of distance to target/attacker in combat
Added NPC AI that runs away from players if they get too close (even outside combat). Applied to hind, rabbits, squirrels, ferrets and various birds by default:
AI_ANIMAL_SCARED (aitype 12)
Fixed issues with NPCs fleeing forever, or getting stuck in flee/don't flee loop, by introducing max fleeing distance (50 tiles) and cooldown (30 sec) on fleeing
Updated onNameRequest JS Event to include third parameter with origin of name request, so script responses can be tailored appropriately:
onNameRequest( myObj, requestedBy, requestSource )
Potential values for requestSource:
0 - Speech/System Messages
1 - Guild Menus
2 - Stat Window (self)
3 - Stat Window (other)
4 - Tooltip
5 - Paperdoll Journal
6 - Paperdoll
7 - Single Click / All-Names
8 - System
9 - Secure Trade Window
Added Adaptive Performance System (APS) that dynamically adjust how often NPC AI/movement is checked based on overall shard performance. If performance drops below defined threshold, UOX3 gradually slows down checks for NPC AI/movement to prioritize player movement/speech/command responsiveness. If performance climbs back up above threshold, slowdowns are gradually removed. The following UOX.INI options have been added under [system] category to support this system:
APSPERFTHRESHOLD=50 // Performance threshold (measured in simulation cycles/sec) below which the APS kicks in
APSINTERVAL=100 // How often (in milliseconds) the APS checks performance and makes adjustments (if needed) to balance out shard performance
APSDELAYSTEP=50 // How much the delay timer is modified by (in milliseconds) each time APS makes adjustments
APSDELAYMAXCAP=2000 // Max amount of of delay APS can introduce for NPC AI/movement handling when attempting to restore shard performance
Added new JS Methods for Region objects:
.GetOrePrefs( oreType ) // Get ore preference data for ore type found in town region. Returned as an array containing the following data:
orePrefData -> [
oreName, // name of ore
color, // color of ore
minskill, // min skill to mine ore
ingotName, // name of ingot created from ore
makemenu, // makemenu entry for crafting something from ingot
oreChance, // default global chance of finding this ore type
scriptID // script attached to mined ore
],
orePrefChance // Chance of finding this ore type in given town region
.GetOreChance() // Get base chance of finding any ore in town region
Moved Mining skill plus gravedigging feature from hard code to scripts (js/skill/mining.js) to make it easier to maintain and/or customize, and removed hard coded variants
Gravedigging now relies on the ore resource system behind the scenes to restrict how often graves in a given area can be dug up
Fixed some incorrect references to .worldNumber Character property in misc scripts (should be .worldnumber)
Made some "hard-scripted" system messages in misc scripts use dictionary system instead
Added spawn region for banker NPCs in Serpent's Hold (dfndata/spawn/felucca/spawn_town_serpents_hold.dfn, dfndata/spawn/trammel/spawn_town_serpents_hold.dfn)
Fixed region definition of Ocllo to actually cover the entire town (dfndata/regions/regions.dfn)
Added numerous additional locations accessible with 'goplace # command, for key locations in Ilshenar, Malas, Tokuno Islands and Ter Mur (dfndata/location/location.dfn)
Revised travel-menu portion of GM menu (shortcut: 'travel) to include more travel options based on new locations (dfndata/items/travelmenu.dfn and travelmenu.bulk.dfn)
Fixed an issue where NPCs could attempt to attack targets in other worlds/instances
Added new JS Event that triggers for characters who are about to deal damage in combat. Complimentary to onDamage, which triggers for chars receiving damage:
onDamageDeal( dmgDealer, dmgReceiver, damageValue, damageType )
Added new JS Event that can trigger in global script upon creation of new player chars. Note that this will trigger in place of onCreateDFN event for player characters:
onCreatePlayer( pChar )
Added new JS Event that triggers for characters selecting a target with a spell. Complimentary to onSpellTarget, which triggers for targets selected with a spell:
onSpellTargetSelect( caster, target, spellNum )
Updated onCombatStart and onCombatEnd JS Events to also trigger for the other party in combat
Updated onPickup JS Event to include a third parameter - the potential container item was picked up from. Event now also triggers event in scripts attached to said containers:
onPickup( iPickedUp, pChar, iCont )
Added tracking of total playtime per individual character, and per account across all characters, and exposed these properties to JS engine:
.totalPlayTime // Account property, total playtime across all chars
.playTime // Character property, total playtime on given character only
Added new player-accessible command ('playtime) to spit out the playtime of current character/account as a whole (js/commands/playtime.js)
Implemented first version of Young Player System:
Replaced the UNUSED9 account flag with YOUNG, to be used by Young/New Player System
Added new JS Account property that gets/sets whether player account is considered Young:
.isYoung
Added new Char timers:
TIMER_YOUNGHEAL // Restricts how often Young players are healed by NPC healers
TIMER_YOUNGMESSAGE // Restricts how often Young players are warned about dangerous looking monsters in overworld
Updated GM commands 'get and 'set to get/set .isYoung property of player's account (js/commands/targeting/get.js and set.js)
Added new UOX.INI setting to enable/disable Young Player System (enabled by default):
YOUNGPLAYERSYSTEM=1
If Young Player System is enabled, all newly created player accounts are automatically marked with Young flag
Added new script to handle various restrictions and functions related to Young characters (js/player/young_player.js):
Young characters will have [Young] displayed over their head
Young characters will have their Young status checked and verified on every login + every stat/skill gain, to revoke the Young status if any of the following is true:
Account has a total playtime of more than 40 hours
Any character has more than 350 total (base) skill points
Any character has more than 70 skill points in a single skill
Any character has more than 150 total stat points
Any character has more than 80 stat points in a single stat
Young characters can renounce their Young status manually by saying the words "I renounce my young player status"
Young characters get two additional items upon creation:
a new player ticket (can be combined with any other players new player ticket for both players to get a reward)
a sextant (shows Young players directions to nearest moongate/bank regardless of where they are, as long as outdoors)
Young characters cannot target other player characters with hostile spells or skills
Young characters cannot be the target of other player characters' hostile spells or skills
Young characters can only cast beneficial spells upon themselves or other Young characters
Young characters can only be the target of beneficial spells from other Young players
Young players (and their pets/followers) cannot attack or harm any other players (or their pets/followers), nor themselves be attacked or harmed by any other players (or their pets/followers), whether from combat, spells, skills or items
Young players don't lose any of their items on death, and are teleported to the nearest healer upon death with all their items intact
Young players receive a warning upon entering dungeons that monsters there will be hostile
Updated global script (js/server/global.js) to:
Check/Verify Young status of players upon login
Attach young player script on login/creation for players on Young accounts
Give specific items to Young players upon creation
Added new script (js/item/corpse.js) that is assigned to all freshly created corpses. This script handles restrictions related to Young players interactions with corpses, and the interactions of other players with corpses of Young players
Updated JS Method .Carve() to return true/false depending on whether carving a corpse was successful
Updated Healer AI in code to heal nearby injured Young players
Updated Evil AI and Evil Caster AI in code to avoid selecting Young players as targets in combat outside of dungeons
Added a new section to UOX.INI - [young player starting locations] - that can be used to define starting locations for Young players. If only one such location is provided, all players start there. Otherwise, it matches the same starting location setup as the regular one - with one entry per town in Britannia.
Restricted transferring and/or friending of pets (code) and hirelings (hirelings.js) between Young and non-Young players
Restricted Young players from recalling or gating to Felucca facet
Young players can instantly logout from anywhere, at any time
2023-07-01 20:02:40 +08:00
fsOut < < " TOTALPLAYTIME 0x " < < std : : hex < < actbTemp . wTotalPlayTime < < std : : dec < < std : : endl ;
2022-10-24 18:39:33 +08:00
fsOut < < " LASTIP " < < static_cast < SI32 > ( ( actbTemp . dwLastIP & 0xFF000000 ) > > 24 ) < < " . "
< < static_cast < SI32 > ( ( actbTemp . dwLastIP & 0x00FF0000 ) > > 16 ) < < " . "
< < static_cast < SI32 > ( ( actbTemp . dwLastIP & 0x0000FF00 ) > > 8 ) < < " . "
< < static_cast < SI32 > ( ( actbTemp . dwLastIP & 0x000000FF ) % 256 ) < < std : : endl ;
fsOut < < " CONTACT " < < ( actbTemp . sContact . length ( ) ? actbTemp . sContact : " NA " ) < < std : : endl ;
2012-11-03 18:11:04 +00:00
for ( UI08 ii = 0 ; ii < CHARACTERCOUNT ; + + ii )
{
SERIAL charSer = INVALIDSERIAL ;
std : : string charName = " UNKNOWN " ;
2021-07-04 02:26:43 +08:00
if ( actbTemp . lpCharacters [ ii ] ! = nullptr & & actbTemp . dwCharacters [ ii ] ! = INVALIDSERIAL )
2012-11-03 18:11:04 +00:00
{
charSer = actbTemp . dwCharacters [ ii ] ;
charName = actbTemp . lpCharacters [ ii ] - > GetName ( ) ;
}
2022-10-24 18:39:33 +08:00
fsOut < < " CHARACTER- " < < std : : dec < < ( ii + 1 ) < < " 0x " < < std : : hex < < charSer < < std : : dec ;
2012-11-03 18:11:04 +00:00
fsOut < < " [ " < < charName . c_str ( ) < < " ] " < < std : : endl ;
2003-01-20 16:14:57 +00:00
}
2012-11-03 18:11:04 +00:00
fsOut < < " } " < < std : : endl < < std : : endl ;
2003-01-20 16:14:57 +00:00
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - cAccountClass::AddAccount()
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
//| Date - 12/12/2002 11:15:20 PM
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
//| Purpose - This function creates in memory as well as on disk a new account that will
//| allow access to the server from external clients. The basic goal of this
//| function is to create a new account record with no characters. Because this
//| function may be called from in game a hard copy will be made as well instead of
//| waiting for a save to make the changes perminent.
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
//|
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
//| sUsername: Name of the account
//| sPassword: Password of the account
//| sContact: Historically this is the valid email address for this account
//| wAttributes: What attributes should this account start with
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
//| Returns - [UI16] Containing the account number of new accounts or 0
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
//| NOTE - This function does NOT add this account to the accounts map. This function ONLY
//| creates the directories, and entries required to load these new accounts. The
//| idea was not to have to rely on the accounts in memory, so that accounts that
//| are added, are added immediatly to the hard copy.
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
//| NOTE - For any new accounts to be loaded into the internal accounts map structure,
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
//| accounts must be reloaded!
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
UI16 cAccountClass : : AddAccount ( std : : string sUsername , std : : string sPassword , const std : : string & sContact , UI16 wAttributes )
2003-01-20 16:14:57 +00:00
{
// First were going to make sure that the needed fields are sent in with at least data
2022-02-26 17:02:32 +08:00
if ( sUsername . length ( ) < 4 | | sPassword . length ( ) < 5 )
2003-01-20 16:14:57 +00:00
{
2022-02-26 17:02:32 +08:00
// Username and password must be 4 and 5 characters or more in length, respectively
2022-10-24 18:39:33 +08:00
Console . Log ( oldstrutil : : format ( " ERROR: Unable to create account for username '%s' with password of '%s'. Username/Password to short " , sUsername . c_str ( ) , sPassword . c_str ( ) ) , " accounts.log " ) ;
2003-01-20 16:14:57 +00:00
return 0x0000 ;
}
// Next thing were going to do is make sure there isn't a duplicate username.
2022-10-24 18:39:33 +08:00
if ( IsUser ( sUsername ) )
2003-01-20 16:14:57 +00:00
{
// This username is already on the list.
return 0x0000 ;
}
// If we get here then were going to create a new account block, and create all the needed directories and files.
2022-10-24 18:39:33 +08:00
CAccountBlock_st actbTemp ;
2012-11-03 18:11:04 +00:00
actbTemp . reset ( ) ;
2003-01-20 16:14:57 +00:00
// Build as much of the account block that we can right now.
2012-11-03 18:11:04 +00:00
actbTemp . sUsername = sUsername ;
actbTemp . sPassword = sPassword ;
actbTemp . sContact = sContact ;
actbTemp . wFlags = wAttributes ;
actbTemp . wTimeBan = 0 ;
2022-01-10 07:33:51 +08:00
actbTemp . wFirstLogin = 0 ;
UOX3 0.99.6-RC6
Removed arbitrary and hidden restrictions on refreshing list of online players shown with 'wholist command
Fixed an issue where player ghosts that get teleported would not see themselves get updated to new location
Fixed a server crash from clients disconnecting while running server in debug mode
Improved how container updates are sent to players; now only sends to clients that have actually opened the container, and who are still within range
Added more information about UO data files being loaded during server startup
Enhanced the GM 'add menu to allow clicking directly on images of items/npcs to add them, and adjusted size of menus to accommodate this
Fixed an issue with fleeing NPCs that could cause them to attempt to flee across time and space, regardless of distance to target/attacker in combat
Added NPC AI that runs away from players if they get too close (even outside combat). Applied to hind, rabbits, squirrels, ferrets and various birds by default:
AI_ANIMAL_SCARED (aitype 12)
Fixed issues with NPCs fleeing forever, or getting stuck in flee/don't flee loop, by introducing max fleeing distance (50 tiles) and cooldown (30 sec) on fleeing
Updated onNameRequest JS Event to include third parameter with origin of name request, so script responses can be tailored appropriately:
onNameRequest( myObj, requestedBy, requestSource )
Potential values for requestSource:
0 - Speech/System Messages
1 - Guild Menus
2 - Stat Window (self)
3 - Stat Window (other)
4 - Tooltip
5 - Paperdoll Journal
6 - Paperdoll
7 - Single Click / All-Names
8 - System
9 - Secure Trade Window
Added Adaptive Performance System (APS) that dynamically adjust how often NPC AI/movement is checked based on overall shard performance. If performance drops below defined threshold, UOX3 gradually slows down checks for NPC AI/movement to prioritize player movement/speech/command responsiveness. If performance climbs back up above threshold, slowdowns are gradually removed. The following UOX.INI options have been added under [system] category to support this system:
APSPERFTHRESHOLD=50 // Performance threshold (measured in simulation cycles/sec) below which the APS kicks in
APSINTERVAL=100 // How often (in milliseconds) the APS checks performance and makes adjustments (if needed) to balance out shard performance
APSDELAYSTEP=50 // How much the delay timer is modified by (in milliseconds) each time APS makes adjustments
APSDELAYMAXCAP=2000 // Max amount of of delay APS can introduce for NPC AI/movement handling when attempting to restore shard performance
Added new JS Methods for Region objects:
.GetOrePrefs( oreType ) // Get ore preference data for ore type found in town region. Returned as an array containing the following data:
orePrefData -> [
oreName, // name of ore
color, // color of ore
minskill, // min skill to mine ore
ingotName, // name of ingot created from ore
makemenu, // makemenu entry for crafting something from ingot
oreChance, // default global chance of finding this ore type
scriptID // script attached to mined ore
],
orePrefChance // Chance of finding this ore type in given town region
.GetOreChance() // Get base chance of finding any ore in town region
Moved Mining skill plus gravedigging feature from hard code to scripts (js/skill/mining.js) to make it easier to maintain and/or customize, and removed hard coded variants
Gravedigging now relies on the ore resource system behind the scenes to restrict how often graves in a given area can be dug up
Fixed some incorrect references to .worldNumber Character property in misc scripts (should be .worldnumber)
Made some "hard-scripted" system messages in misc scripts use dictionary system instead
Added spawn region for banker NPCs in Serpent's Hold (dfndata/spawn/felucca/spawn_town_serpents_hold.dfn, dfndata/spawn/trammel/spawn_town_serpents_hold.dfn)
Fixed region definition of Ocllo to actually cover the entire town (dfndata/regions/regions.dfn)
Added numerous additional locations accessible with 'goplace # command, for key locations in Ilshenar, Malas, Tokuno Islands and Ter Mur (dfndata/location/location.dfn)
Revised travel-menu portion of GM menu (shortcut: 'travel) to include more travel options based on new locations (dfndata/items/travelmenu.dfn and travelmenu.bulk.dfn)
Fixed an issue where NPCs could attempt to attack targets in other worlds/instances
Added new JS Event that triggers for characters who are about to deal damage in combat. Complimentary to onDamage, which triggers for chars receiving damage:
onDamageDeal( dmgDealer, dmgReceiver, damageValue, damageType )
Added new JS Event that can trigger in global script upon creation of new player chars. Note that this will trigger in place of onCreateDFN event for player characters:
onCreatePlayer( pChar )
Added new JS Event that triggers for characters selecting a target with a spell. Complimentary to onSpellTarget, which triggers for targets selected with a spell:
onSpellTargetSelect( caster, target, spellNum )
Updated onCombatStart and onCombatEnd JS Events to also trigger for the other party in combat
Updated onPickup JS Event to include a third parameter - the potential container item was picked up from. Event now also triggers event in scripts attached to said containers:
onPickup( iPickedUp, pChar, iCont )
Added tracking of total playtime per individual character, and per account across all characters, and exposed these properties to JS engine:
.totalPlayTime // Account property, total playtime across all chars
.playTime // Character property, total playtime on given character only
Added new player-accessible command ('playtime) to spit out the playtime of current character/account as a whole (js/commands/playtime.js)
Implemented first version of Young Player System:
Replaced the UNUSED9 account flag with YOUNG, to be used by Young/New Player System
Added new JS Account property that gets/sets whether player account is considered Young:
.isYoung
Added new Char timers:
TIMER_YOUNGHEAL // Restricts how often Young players are healed by NPC healers
TIMER_YOUNGMESSAGE // Restricts how often Young players are warned about dangerous looking monsters in overworld
Updated GM commands 'get and 'set to get/set .isYoung property of player's account (js/commands/targeting/get.js and set.js)
Added new UOX.INI setting to enable/disable Young Player System (enabled by default):
YOUNGPLAYERSYSTEM=1
If Young Player System is enabled, all newly created player accounts are automatically marked with Young flag
Added new script to handle various restrictions and functions related to Young characters (js/player/young_player.js):
Young characters will have [Young] displayed over their head
Young characters will have their Young status checked and verified on every login + every stat/skill gain, to revoke the Young status if any of the following is true:
Account has a total playtime of more than 40 hours
Any character has more than 350 total (base) skill points
Any character has more than 70 skill points in a single skill
Any character has more than 150 total stat points
Any character has more than 80 stat points in a single stat
Young characters can renounce their Young status manually by saying the words "I renounce my young player status"
Young characters get two additional items upon creation:
a new player ticket (can be combined with any other players new player ticket for both players to get a reward)
a sextant (shows Young players directions to nearest moongate/bank regardless of where they are, as long as outdoors)
Young characters cannot target other player characters with hostile spells or skills
Young characters cannot be the target of other player characters' hostile spells or skills
Young characters can only cast beneficial spells upon themselves or other Young characters
Young characters can only be the target of beneficial spells from other Young players
Young players (and their pets/followers) cannot attack or harm any other players (or their pets/followers), nor themselves be attacked or harmed by any other players (or their pets/followers), whether from combat, spells, skills or items
Young players don't lose any of their items on death, and are teleported to the nearest healer upon death with all their items intact
Young players receive a warning upon entering dungeons that monsters there will be hostile
Updated global script (js/server/global.js) to:
Check/Verify Young status of players upon login
Attach young player script on login/creation for players on Young accounts
Give specific items to Young players upon creation
Added new script (js/item/corpse.js) that is assigned to all freshly created corpses. This script handles restrictions related to Young players interactions with corpses, and the interactions of other players with corpses of Young players
Updated JS Method .Carve() to return true/false depending on whether carving a corpse was successful
Updated Healer AI in code to heal nearby injured Young players
Updated Evil AI and Evil Caster AI in code to avoid selecting Young players as targets in combat outside of dungeons
Added a new section to UOX.INI - [young player starting locations] - that can be used to define starting locations for Young players. If only one such location is provided, all players start there. Otherwise, it matches the same starting location setup as the regular one - with one entry per town in Britannia.
Restricted transferring and/or friending of pets (code) and hirelings (hirelings.js) between Young and non-Young players
Restricted Young players from recalling or gating to Felucca facet
Young players can instantly logout from anywhere, at any time
2023-07-01 20:02:40 +08:00
actbTemp . wTotalPlayTime = 0 ;
2012-11-03 18:11:04 +00:00
actbTemp . dwLastIP = 0 ;
for ( UI08 ii = 0 ; ii < CHARACTERCOUNT ; + + ii )
{
2021-06-12 07:30:23 -04:00
actbTemp . lpCharacters [ ii ] = nullptr ;
2012-11-03 18:11:04 +00:00
actbTemp . dwCharacters [ ii ] = INVALIDSERIAL ;
2003-01-20 16:14:57 +00:00
}
UOX3 0.99.6-RC6
Removed arbitrary and hidden restrictions on refreshing list of online players shown with 'wholist command
Fixed an issue where player ghosts that get teleported would not see themselves get updated to new location
Fixed a server crash from clients disconnecting while running server in debug mode
Improved how container updates are sent to players; now only sends to clients that have actually opened the container, and who are still within range
Added more information about UO data files being loaded during server startup
Enhanced the GM 'add menu to allow clicking directly on images of items/npcs to add them, and adjusted size of menus to accommodate this
Fixed an issue with fleeing NPCs that could cause them to attempt to flee across time and space, regardless of distance to target/attacker in combat
Added NPC AI that runs away from players if they get too close (even outside combat). Applied to hind, rabbits, squirrels, ferrets and various birds by default:
AI_ANIMAL_SCARED (aitype 12)
Fixed issues with NPCs fleeing forever, or getting stuck in flee/don't flee loop, by introducing max fleeing distance (50 tiles) and cooldown (30 sec) on fleeing
Updated onNameRequest JS Event to include third parameter with origin of name request, so script responses can be tailored appropriately:
onNameRequest( myObj, requestedBy, requestSource )
Potential values for requestSource:
0 - Speech/System Messages
1 - Guild Menus
2 - Stat Window (self)
3 - Stat Window (other)
4 - Tooltip
5 - Paperdoll Journal
6 - Paperdoll
7 - Single Click / All-Names
8 - System
9 - Secure Trade Window
Added Adaptive Performance System (APS) that dynamically adjust how often NPC AI/movement is checked based on overall shard performance. If performance drops below defined threshold, UOX3 gradually slows down checks for NPC AI/movement to prioritize player movement/speech/command responsiveness. If performance climbs back up above threshold, slowdowns are gradually removed. The following UOX.INI options have been added under [system] category to support this system:
APSPERFTHRESHOLD=50 // Performance threshold (measured in simulation cycles/sec) below which the APS kicks in
APSINTERVAL=100 // How often (in milliseconds) the APS checks performance and makes adjustments (if needed) to balance out shard performance
APSDELAYSTEP=50 // How much the delay timer is modified by (in milliseconds) each time APS makes adjustments
APSDELAYMAXCAP=2000 // Max amount of of delay APS can introduce for NPC AI/movement handling when attempting to restore shard performance
Added new JS Methods for Region objects:
.GetOrePrefs( oreType ) // Get ore preference data for ore type found in town region. Returned as an array containing the following data:
orePrefData -> [
oreName, // name of ore
color, // color of ore
minskill, // min skill to mine ore
ingotName, // name of ingot created from ore
makemenu, // makemenu entry for crafting something from ingot
oreChance, // default global chance of finding this ore type
scriptID // script attached to mined ore
],
orePrefChance // Chance of finding this ore type in given town region
.GetOreChance() // Get base chance of finding any ore in town region
Moved Mining skill plus gravedigging feature from hard code to scripts (js/skill/mining.js) to make it easier to maintain and/or customize, and removed hard coded variants
Gravedigging now relies on the ore resource system behind the scenes to restrict how often graves in a given area can be dug up
Fixed some incorrect references to .worldNumber Character property in misc scripts (should be .worldnumber)
Made some "hard-scripted" system messages in misc scripts use dictionary system instead
Added spawn region for banker NPCs in Serpent's Hold (dfndata/spawn/felucca/spawn_town_serpents_hold.dfn, dfndata/spawn/trammel/spawn_town_serpents_hold.dfn)
Fixed region definition of Ocllo to actually cover the entire town (dfndata/regions/regions.dfn)
Added numerous additional locations accessible with 'goplace # command, for key locations in Ilshenar, Malas, Tokuno Islands and Ter Mur (dfndata/location/location.dfn)
Revised travel-menu portion of GM menu (shortcut: 'travel) to include more travel options based on new locations (dfndata/items/travelmenu.dfn and travelmenu.bulk.dfn)
Fixed an issue where NPCs could attempt to attack targets in other worlds/instances
Added new JS Event that triggers for characters who are about to deal damage in combat. Complimentary to onDamage, which triggers for chars receiving damage:
onDamageDeal( dmgDealer, dmgReceiver, damageValue, damageType )
Added new JS Event that can trigger in global script upon creation of new player chars. Note that this will trigger in place of onCreateDFN event for player characters:
onCreatePlayer( pChar )
Added new JS Event that triggers for characters selecting a target with a spell. Complimentary to onSpellTarget, which triggers for targets selected with a spell:
onSpellTargetSelect( caster, target, spellNum )
Updated onCombatStart and onCombatEnd JS Events to also trigger for the other party in combat
Updated onPickup JS Event to include a third parameter - the potential container item was picked up from. Event now also triggers event in scripts attached to said containers:
onPickup( iPickedUp, pChar, iCont )
Added tracking of total playtime per individual character, and per account across all characters, and exposed these properties to JS engine:
.totalPlayTime // Account property, total playtime across all chars
.playTime // Character property, total playtime on given character only
Added new player-accessible command ('playtime) to spit out the playtime of current character/account as a whole (js/commands/playtime.js)
Implemented first version of Young Player System:
Replaced the UNUSED9 account flag with YOUNG, to be used by Young/New Player System
Added new JS Account property that gets/sets whether player account is considered Young:
.isYoung
Added new Char timers:
TIMER_YOUNGHEAL // Restricts how often Young players are healed by NPC healers
TIMER_YOUNGMESSAGE // Restricts how often Young players are warned about dangerous looking monsters in overworld
Updated GM commands 'get and 'set to get/set .isYoung property of player's account (js/commands/targeting/get.js and set.js)
Added new UOX.INI setting to enable/disable Young Player System (enabled by default):
YOUNGPLAYERSYSTEM=1
If Young Player System is enabled, all newly created player accounts are automatically marked with Young flag
Added new script to handle various restrictions and functions related to Young characters (js/player/young_player.js):
Young characters will have [Young] displayed over their head
Young characters will have their Young status checked and verified on every login + every stat/skill gain, to revoke the Young status if any of the following is true:
Account has a total playtime of more than 40 hours
Any character has more than 350 total (base) skill points
Any character has more than 70 skill points in a single skill
Any character has more than 150 total stat points
Any character has more than 80 stat points in a single stat
Young characters can renounce their Young status manually by saying the words "I renounce my young player status"
Young characters get two additional items upon creation:
a new player ticket (can be combined with any other players new player ticket for both players to get a reward)
a sextant (shows Young players directions to nearest moongate/bank regardless of where they are, as long as outdoors)
Young characters cannot target other player characters with hostile spells or skills
Young characters cannot be the target of other player characters' hostile spells or skills
Young characters can only cast beneficial spells upon themselves or other Young characters
Young characters can only be the target of beneficial spells from other Young players
Young players (and their pets/followers) cannot attack or harm any other players (or their pets/followers), nor themselves be attacked or harmed by any other players (or their pets/followers), whether from combat, spells, skills or items
Young players don't lose any of their items on death, and are teleported to the nearest healer upon death with all their items intact
Young players receive a warning upon entering dungeons that monsters there will be hostile
Updated global script (js/server/global.js) to:
Check/Verify Young status of players upon login
Attach young player script on login/creation for players on Young accounts
Give specific items to Young players upon creation
Added new script (js/item/corpse.js) that is assigned to all freshly created corpses. This script handles restrictions related to Young players interactions with corpses, and the interactions of other players with corpses of Young players
Updated JS Method .Carve() to return true/false depending on whether carving a corpse was successful
Updated Healer AI in code to heal nearby injured Young players
Updated Evil AI and Evil Caster AI in code to avoid selecting Young players as targets in combat outside of dungeons
Added a new section to UOX.INI - [young player starting locations] - that can be used to define starting locations for Young players. If only one such location is provided, all players start there. Otherwise, it matches the same starting location setup as the regular one - with one entry per town in Britannia.
Restricted transferring and/or friending of pets (code) and hirelings (hirelings.js) between Young and non-Young players
Restricted Young players from recalling or gating to Felucca facet
Young players can instantly logout from anywhere, at any time
2023-07-01 20:02:40 +08:00
if ( cwmWorldState - > ServerData ( ) - > YoungPlayerSystem ( ) )
{
actbTemp . wFlags . set ( AB_FLAGS_YOUNG , 1 ) ;
}
2003-01-20 16:14:57 +00:00
// Ok we have everything except the path to the account dir, so make that now
2012-11-03 18:11:04 +00:00
std : : string sTempPath ( m_sAccountsDirectory ) ;
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
if ( sTempPath [ sTempPath . length ( ) - 1 ] = = ' \\ ' | | sTempPath [ sTempPath . length ( ) - 1 ] = = ' / ' )
2012-11-03 18:11:04 +00:00
{
2022-03-04 07:35:46 -05:00
auto szTempBuff = sUsername ; // oldstrutil::lower( sUsername );
2012-11-03 18:11:04 +00:00
sTempPath + = szTempBuff ;
sTempPath + = " / " ;
2022-03-04 07:35:46 -05:00
sTempPath = oldstrutil : : replaceSlash ( sTempPath ) ;
2012-11-03 18:11:04 +00:00
actbTemp . sPath = sTempPath ;
2003-01-20 16:14:57 +00:00
}
else
2012-11-03 18:11:04 +00:00
{
2022-03-04 07:35:46 -05:00
auto szTempBuff = sUsername ; //oldstrutil::lower( sUsername );
2012-11-03 18:11:04 +00:00
sTempPath + = " / " ;
sTempPath + = szTempBuff ;
sTempPath + = " / " ;
2022-03-04 07:35:46 -05:00
sTempPath = oldstrutil : : replaceSlash ( sTempPath ) ;
2012-11-03 18:11:04 +00:00
actbTemp . sPath = sTempPath ;
2003-01-20 16:14:57 +00:00
}
// Ok now that we got here we need to make the directory, and create the username.uad file
2022-10-24 18:39:33 +08:00
if ( ! std : : filesystem : : exists ( std : : filesystem : : path ( actbTemp . sPath ) ) )
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
{
2022-10-24 18:39:33 +08:00
auto create_status = std : : filesystem : : create_directory ( std : : filesystem : : path ( actbTemp . sPath ) ) ;
if ( ! create_status )
{
Console . Error ( oldstrutil : : format ( " AddAccount(): Couldn't create directory %s " , actbTemp . sPath . c_str ( ) ) ) ;
2012-11-03 18:11:04 +00:00
return 0x0000 ;
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
2012-11-03 18:11:04 +00:00
}
2003-01-20 16:14:57 +00:00
}
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
2003-01-20 16:14:57 +00:00
// Ok now thats finished. We need to do one last thing. Create the username.uad file in the account directory
2022-10-24 18:39:33 +08:00
std : : string sUsernameUADPath ( actbTemp . sPath ) ;
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
if ( sUsernameUADPath [ sUsernameUADPath . length ( ) - 1 ] = = ' \\ ' | | sUsernameUADPath [ sUsernameUADPath . length ( ) - 1 ] = = ' / ' )
2003-01-20 16:14:57 +00:00
{
sUsernameUADPath + = actbTemp . sUsername ;
sUsernameUADPath + = " .uad " ;
}
else
{
sUsernameUADPath + = " / " ;
sUsernameUADPath + = actbTemp . sUsername ;
sUsernameUADPath + = " .uad " ;
}
// Fix the paths to make sure that all the characters are unified
2022-03-04 07:35:46 -05:00
sUsernameUADPath = oldstrutil : : replaceSlash ( sUsernameUADPath ) ;
2003-01-20 16:14:57 +00:00
// Open the file in APPEND to end mode.
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
std : : fstream fsAccountsUAD ( sUsernameUADPath . c_str ( ) , std : : ios : : out | std : : ios : : trunc ) ;
2012-11-03 18:11:04 +00:00
if ( ! fsAccountsUAD . is_open ( ) )
2003-01-20 16:14:57 +00:00
{
// Ok we were unable to open the file so this user will not be added.
return 0x0000 ;
}
// were using the ID due to its numbering, it will always show the account blocks in ID order least to greatest.
actbTemp . wAccountIndex = m_wHighestAccount + 1 ;
// Ok we have to write the new username.uad file in the directory
2022-10-24 18:39:33 +08:00
fsAccountsUAD < < " //AI3.0 " < < " -UV " < < CVersionClass : : GetVersion ( ) < < " -BD " < < CVersionClass : : GetBuild ( ) < < " -DS " < < time ( nullptr ) < < " -ED " < < CVersionClass : : GetRealBuild ( ) < < " \n " ;
2003-01-20 16:14:57 +00:00
fsAccountsUAD < < " //------------------------------------------------------------------------------ " < < std : : endl ;
fsAccountsUAD < < " // UAD Path: " < < actbTemp . sPath < < std : : endl ; //"\n";
fsAccountsUAD < < " //------------------------------------------------------------------------------ " < < std : : endl ;
fsAccountsUAD < < " // UOX3 uses this file to store any extra administration info \n " ;
fsAccountsUAD < < " //------------------------------------------------------------------------------ \n " ;
fsAccountsUAD < < " ID " < < actbTemp . wAccountIndex < < " \n " ;
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
fsAccountsUAD < < " NAME " < < actbTemp . sUsername < < " \n " ;
fsAccountsUAD < < " PASS " < < actbTemp . sPassword < < " \n " ;
2012-11-03 18:11:04 +00:00
fsAccountsUAD < < " BANTIME " < < std : : hex < < " 0x " < < actbTemp . wTimeBan < < std : : dec < < " \n " ;
2022-01-10 07:33:51 +08:00
fsAccountsUAD < < " FIRSTLOGIN " < < std : : hex < < " 0x " < < actbTemp . wFirstLogin < < std : : dec < < " \n " ;
UOX3 0.99.6-RC6
Removed arbitrary and hidden restrictions on refreshing list of online players shown with 'wholist command
Fixed an issue where player ghosts that get teleported would not see themselves get updated to new location
Fixed a server crash from clients disconnecting while running server in debug mode
Improved how container updates are sent to players; now only sends to clients that have actually opened the container, and who are still within range
Added more information about UO data files being loaded during server startup
Enhanced the GM 'add menu to allow clicking directly on images of items/npcs to add them, and adjusted size of menus to accommodate this
Fixed an issue with fleeing NPCs that could cause them to attempt to flee across time and space, regardless of distance to target/attacker in combat
Added NPC AI that runs away from players if they get too close (even outside combat). Applied to hind, rabbits, squirrels, ferrets and various birds by default:
AI_ANIMAL_SCARED (aitype 12)
Fixed issues with NPCs fleeing forever, or getting stuck in flee/don't flee loop, by introducing max fleeing distance (50 tiles) and cooldown (30 sec) on fleeing
Updated onNameRequest JS Event to include third parameter with origin of name request, so script responses can be tailored appropriately:
onNameRequest( myObj, requestedBy, requestSource )
Potential values for requestSource:
0 - Speech/System Messages
1 - Guild Menus
2 - Stat Window (self)
3 - Stat Window (other)
4 - Tooltip
5 - Paperdoll Journal
6 - Paperdoll
7 - Single Click / All-Names
8 - System
9 - Secure Trade Window
Added Adaptive Performance System (APS) that dynamically adjust how often NPC AI/movement is checked based on overall shard performance. If performance drops below defined threshold, UOX3 gradually slows down checks for NPC AI/movement to prioritize player movement/speech/command responsiveness. If performance climbs back up above threshold, slowdowns are gradually removed. The following UOX.INI options have been added under [system] category to support this system:
APSPERFTHRESHOLD=50 // Performance threshold (measured in simulation cycles/sec) below which the APS kicks in
APSINTERVAL=100 // How often (in milliseconds) the APS checks performance and makes adjustments (if needed) to balance out shard performance
APSDELAYSTEP=50 // How much the delay timer is modified by (in milliseconds) each time APS makes adjustments
APSDELAYMAXCAP=2000 // Max amount of of delay APS can introduce for NPC AI/movement handling when attempting to restore shard performance
Added new JS Methods for Region objects:
.GetOrePrefs( oreType ) // Get ore preference data for ore type found in town region. Returned as an array containing the following data:
orePrefData -> [
oreName, // name of ore
color, // color of ore
minskill, // min skill to mine ore
ingotName, // name of ingot created from ore
makemenu, // makemenu entry for crafting something from ingot
oreChance, // default global chance of finding this ore type
scriptID // script attached to mined ore
],
orePrefChance // Chance of finding this ore type in given town region
.GetOreChance() // Get base chance of finding any ore in town region
Moved Mining skill plus gravedigging feature from hard code to scripts (js/skill/mining.js) to make it easier to maintain and/or customize, and removed hard coded variants
Gravedigging now relies on the ore resource system behind the scenes to restrict how often graves in a given area can be dug up
Fixed some incorrect references to .worldNumber Character property in misc scripts (should be .worldnumber)
Made some "hard-scripted" system messages in misc scripts use dictionary system instead
Added spawn region for banker NPCs in Serpent's Hold (dfndata/spawn/felucca/spawn_town_serpents_hold.dfn, dfndata/spawn/trammel/spawn_town_serpents_hold.dfn)
Fixed region definition of Ocllo to actually cover the entire town (dfndata/regions/regions.dfn)
Added numerous additional locations accessible with 'goplace # command, for key locations in Ilshenar, Malas, Tokuno Islands and Ter Mur (dfndata/location/location.dfn)
Revised travel-menu portion of GM menu (shortcut: 'travel) to include more travel options based on new locations (dfndata/items/travelmenu.dfn and travelmenu.bulk.dfn)
Fixed an issue where NPCs could attempt to attack targets in other worlds/instances
Added new JS Event that triggers for characters who are about to deal damage in combat. Complimentary to onDamage, which triggers for chars receiving damage:
onDamageDeal( dmgDealer, dmgReceiver, damageValue, damageType )
Added new JS Event that can trigger in global script upon creation of new player chars. Note that this will trigger in place of onCreateDFN event for player characters:
onCreatePlayer( pChar )
Added new JS Event that triggers for characters selecting a target with a spell. Complimentary to onSpellTarget, which triggers for targets selected with a spell:
onSpellTargetSelect( caster, target, spellNum )
Updated onCombatStart and onCombatEnd JS Events to also trigger for the other party in combat
Updated onPickup JS Event to include a third parameter - the potential container item was picked up from. Event now also triggers event in scripts attached to said containers:
onPickup( iPickedUp, pChar, iCont )
Added tracking of total playtime per individual character, and per account across all characters, and exposed these properties to JS engine:
.totalPlayTime // Account property, total playtime across all chars
.playTime // Character property, total playtime on given character only
Added new player-accessible command ('playtime) to spit out the playtime of current character/account as a whole (js/commands/playtime.js)
Implemented first version of Young Player System:
Replaced the UNUSED9 account flag with YOUNG, to be used by Young/New Player System
Added new JS Account property that gets/sets whether player account is considered Young:
.isYoung
Added new Char timers:
TIMER_YOUNGHEAL // Restricts how often Young players are healed by NPC healers
TIMER_YOUNGMESSAGE // Restricts how often Young players are warned about dangerous looking monsters in overworld
Updated GM commands 'get and 'set to get/set .isYoung property of player's account (js/commands/targeting/get.js and set.js)
Added new UOX.INI setting to enable/disable Young Player System (enabled by default):
YOUNGPLAYERSYSTEM=1
If Young Player System is enabled, all newly created player accounts are automatically marked with Young flag
Added new script to handle various restrictions and functions related to Young characters (js/player/young_player.js):
Young characters will have [Young] displayed over their head
Young characters will have their Young status checked and verified on every login + every stat/skill gain, to revoke the Young status if any of the following is true:
Account has a total playtime of more than 40 hours
Any character has more than 350 total (base) skill points
Any character has more than 70 skill points in a single skill
Any character has more than 150 total stat points
Any character has more than 80 stat points in a single stat
Young characters can renounce their Young status manually by saying the words "I renounce my young player status"
Young characters get two additional items upon creation:
a new player ticket (can be combined with any other players new player ticket for both players to get a reward)
a sextant (shows Young players directions to nearest moongate/bank regardless of where they are, as long as outdoors)
Young characters cannot target other player characters with hostile spells or skills
Young characters cannot be the target of other player characters' hostile spells or skills
Young characters can only cast beneficial spells upon themselves or other Young characters
Young characters can only be the target of beneficial spells from other Young players
Young players (and their pets/followers) cannot attack or harm any other players (or their pets/followers), nor themselves be attacked or harmed by any other players (or their pets/followers), whether from combat, spells, skills or items
Young players don't lose any of their items on death, and are teleported to the nearest healer upon death with all their items intact
Young players receive a warning upon entering dungeons that monsters there will be hostile
Updated global script (js/server/global.js) to:
Check/Verify Young status of players upon login
Attach young player script on login/creation for players on Young accounts
Give specific items to Young players upon creation
Added new script (js/item/corpse.js) that is assigned to all freshly created corpses. This script handles restrictions related to Young players interactions with corpses, and the interactions of other players with corpses of Young players
Updated JS Method .Carve() to return true/false depending on whether carving a corpse was successful
Updated Healer AI in code to heal nearby injured Young players
Updated Evil AI and Evil Caster AI in code to avoid selecting Young players as targets in combat outside of dungeons
Added a new section to UOX.INI - [young player starting locations] - that can be used to define starting locations for Young players. If only one such location is provided, all players start there. Otherwise, it matches the same starting location setup as the regular one - with one entry per town in Britannia.
Restricted transferring and/or friending of pets (code) and hirelings (hirelings.js) between Young and non-Young players
Restricted Young players from recalling or gating to Felucca facet
Young players can instantly logout from anywhere, at any time
2023-07-01 20:02:40 +08:00
fsAccountsUAD < < " TOTALPLAYTIME " < < std : : hex < < " 0x " < < actbTemp . wTotalPlayTime < < std : : dec < < " \n " ;
2022-10-24 18:39:33 +08:00
fsAccountsUAD < < " LASTIP " < < static_cast < SI32 > ( ( actbTemp . dwLastIP & 0xFF000000 ) > > 24 ) < < " . "
< < static_cast < SI32 > ( ( actbTemp . dwLastIP & 0x00FF0000 ) > > 16 ) < < " . "
< < static_cast < SI32 > ( ( actbTemp . dwLastIP & 0x0000FF00 ) > > 8 ) < < " . "
< < static_cast < SI32 > ( ( actbTemp . dwLastIP & 0x000000FF ) % 256 ) < < " \n " ;
2012-11-03 18:11:04 +00:00
fsAccountsUAD < < " CONTACT " < < actbTemp . sContact < < " \n " ;
2003-01-20 16:14:57 +00:00
fsAccountsUAD < < " //------------------------------------------------------------------------------ \n " ;
// Ok write out the characters and the charcter names if we know them
2012-11-03 18:11:04 +00:00
for ( UI08 i = 0 ; i < CHARACTERCOUNT ; + + i )
2003-01-20 16:14:57 +00:00
{
2022-10-24 18:39:33 +08:00
fsAccountsUAD < < " CHARACTER- " < < ( i + 1 ) < < " 0x " < < std : : hex
< < ( actbTemp . dwCharacters [ i ] ! = INVALIDSERIAL ? actbTemp . dwCharacters [ i ] : INVALIDSERIAL )
< < " [ " < < ( char * ) ( actbTemp . lpCharacters [ i ] ! = nullptr ? actbTemp . lpCharacters [ i ] - > GetName ( ) . c_str ( ) : " INVALID " )
< < " ] \n " ;
2003-01-20 16:14:57 +00:00
}
// Close the files since we dont need them anymore
fsAccountsUAD . close ( ) ;
// Ok now we can add this record to the accounts.adm file
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
std : : string sAccountsADMPath ( m_sAccountsDirectory ) ;
if ( sAccountsADMPath [ sAccountsADMPath . length ( ) - 1 ] = = ' \\ ' | | sAccountsADMPath [ sAccountsADMPath . length ( ) - 1 ] = = ' / ' )
2022-10-24 18:39:33 +08:00
{
2003-01-20 16:14:57 +00:00
sAccountsADMPath + = " accounts.adm " ;
2022-10-24 18:39:33 +08:00
}
2003-01-20 16:14:57 +00:00
else
2022-10-24 18:39:33 +08:00
{
2003-01-20 16:14:57 +00:00
sAccountsADMPath + = " /accounts.adm " ;
2022-10-24 18:39:33 +08:00
}
2003-01-20 16:14:57 +00:00
// Open the file in APPEND to end mode.
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
std : : fstream fsAccountsADM ( sAccountsADMPath . c_str ( ) , std : : ios : : out | std : : ios : : app ) ;
2012-11-03 18:11:04 +00:00
if ( ! fsAccountsADM . is_open ( ) )
2003-01-20 16:14:57 +00:00
{
// Ok we were unable to open the file so this user will not be added.
return 0x0000 ;
}
2012-11-03 18:11:04 +00:00
WriteAccountSection ( actbTemp , fsAccountsADM ) ;
2003-01-20 16:14:57 +00:00
fsAccountsADM . close ( ) ;
// Ok might be a good thing to add this account to the map(s) now.
2022-10-24 18:39:33 +08:00
m_mapUsernameIdMap [ actbTemp . wAccountIndex ] = actbTemp ;
m_mapUsernameMap [ actbTemp . sUsername ] = & m_mapUsernameIdMap [ actbTemp . wAccountIndex ] ;
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
m_wHighestAccount = actbTemp . wAccountIndex ;
2003-01-20 16:14:57 +00:00
// Return to the calling function
2022-10-24 18:39:33 +08:00
return static_cast < UI16 > ( m_mapUsernameIdMap . size ( ) ) ;
2003-01-20 16:14:57 +00:00
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - cAccountClass::IsUser()
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
//| Date - 12/16/2002 12:09:13 AM
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
//| Purpose - The only function that this function member servers is to return a response
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
//| based on the existance of the specified username.
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
bool cAccountClass : : IsUser ( std : : string sUsername )
2003-01-20 16:14:57 +00:00
{
2022-10-24 18:39:33 +08:00
MAPUSERNAME_ITERATOR I = m_mapUsernameMap . find ( sUsername ) ;
2012-11-03 18:11:04 +00:00
return ( I ! = m_mapUsernameMap . end ( ) ) ;
2003-01-20 16:14:57 +00:00
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - cAccountClass::size()
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
//| Date - 12/17/2002 3:35:31 PM
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
//| Purpose - Returns the current count of accounts that are currently stored in the account map.
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
2020-08-13 21:48:27 +08:00
UI32 cAccountClass : : size ( )
2003-01-20 16:14:57 +00:00
{
2022-10-24 18:39:33 +08:00
return static_cast < SI32 > ( m_mapUsernameMap . size ( ) ) ;
2012-11-03 18:11:04 +00:00
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - cAccountClass::Load()
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
//| Date - 12/17/2002 4:00:47 PM
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
//| Purpose - Load the internal accounts structure from the accounts.adm
//| file. Due to the nature of this function we will empty the
//| previous contents of the account map, and reload them.
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
//|
//| Changes - 1/20/2003 - Forgot to put in place the lookup to see if
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
//| accounts need to be updated to the v3 format. Should only
//| need to check the first line of the accounts.adm file.
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
//| NOTE: Do not remove this line if you wish to convert
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
//| properly. Without the first line this function will assume
//| that the accounts file is a v2 format file(UOX3 v0.97.0).
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
//|
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
//| Changes - 1/20/2003 - Added support for the DTL libs, and create a
//| general SQL query for MSAccess, MSSQL, and mySQL
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
UI16 cAccountClass : : Load ( void )
2012-11-03 18:11:04 +00:00
{
2003-01-20 16:14:57 +00:00
// Now we can load the accounts file in and re fill the map.
2012-11-03 18:11:04 +00:00
std : : string sAccountsADM ( m_sAccountsDirectory ) ;
2022-10-24 18:39:33 +08:00
sAccountsADM + = ( m_sAccountsDirectory [ m_sAccountsDirectory . length ( ) - 1 ] = = ' \\ ' | | m_sAccountsDirectory [ m_sAccountsDirectory . length ( ) - 1 ] = = ' / ' ) ? " accounts.adm " : " /accounts.adm " ;
sAccountsADM = oldstrutil : : replaceSlash ( sAccountsADM ) ;
2003-01-20 16:14:57 +00:00
// Check to see what version the current accounts.adm file is.
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
std : : string sLine ;
2022-10-24 18:39:33 +08:00
std : : fstream fsAccountsADMTest ( sAccountsADM . c_str ( ) , std : : ios : : in ) ;
2012-11-03 18:11:04 +00:00
if ( ! fsAccountsADMTest . is_open ( ) )
2003-01-20 16:14:57 +00:00
{
// we were unable to load any accounts
return 0x0000 ;
}
2012-11-03 18:11:04 +00:00
std : : getline ( fsAccountsADMTest , sLine ) ;
2003-01-20 16:14:57 +00:00
// Check to see if this is a V3 file.
2012-11-03 18:11:04 +00:00
if ( sLine . find ( " AV3.0 " ) = = std : : string : : npos )
2003-01-20 16:14:57 +00:00
{
2003-01-26 20:54:31 +00:00
// CreateAccountSystem renames accounts.adm for back up purposes, so we need to release its file isntance before calling
fsAccountsADMTest . close ( ) ;
Console < < myendl < < " o Processing legacy UOX3 accounts.adm file " ;
UI16 wResponse = CreateAccountSystem ( ) ;
Console . PrintDone ( ) ;
Console < < " - Processed " < < wResponse < < " account blocks. " < < myendl ;
2003-01-20 16:14:57 +00:00
// Nope, not a v3 file.. so we should attempt a convert
2003-01-26 20:54:31 +00:00
return wResponse ;
2003-01-20 16:14:57 +00:00
}
2003-03-05 21:28:34 +00:00
else
2022-10-24 18:39:33 +08:00
{
2003-03-05 21:28:34 +00:00
Console < < myendl < < " o Processing accounts file " ;
2022-10-24 18:39:33 +08:00
}
2012-11-03 18:11:04 +00:00
if ( fsAccountsADMTest . is_open ( ) )
2022-10-24 18:39:33 +08:00
{
2003-01-26 20:54:31 +00:00
fsAccountsADMTest . close ( ) ;
2022-10-24 18:39:33 +08:00
}
2003-01-20 16:14:57 +00:00
// OK now we can open the file.
2022-10-24 18:39:33 +08:00
std : : fstream fsAccountsADM ( sAccountsADM . c_str ( ) , std : : ios : : in ) ;
2012-11-03 18:11:04 +00:00
if ( ! fsAccountsADM . is_open ( ) ) // we were unable to load any accounts
2003-01-20 16:14:57 +00:00
return 0x0000 ;
2012-11-03 18:11:04 +00:00
2003-01-20 16:14:57 +00:00
// We need to read from the stream once before entering the loop
2012-11-03 18:11:04 +00:00
std : : getline ( fsAccountsADM , sLine ) ;
2022-03-04 07:35:46 -05:00
sLine = oldstrutil : : trim ( oldstrutil : : removeTrailing ( sLine , " // " ) ) ;
2003-01-20 16:14:57 +00:00
// Ok start the loop and process
2012-11-03 18:11:04 +00:00
bool bBraces [ 3 ] = { false , false , false } ;
2022-11-14 19:24:29 -05:00
[[maybe_unused]] bool bBraces2 [ 3 ] = { false , false , false } ;
2022-10-24 18:39:33 +08:00
CAccountBlock_st actb ;
UI16 wAccountId = 0x0000 ;
2012-11-03 18:11:04 +00:00
UI16 wAccountCount = 0x0000 ;
2022-10-24 18:39:33 +08:00
UI32 dwChars [ CHARACTERCOUNT ] = { INVALIDSERIAL , INVALIDSERIAL , INVALIDSERIAL , INVALIDSERIAL , INVALIDSERIAL , INVALIDSERIAL } ;
2012-11-03 18:11:04 +00:00
actb . reset ( ) ;
m_wHighestAccount = 0x0000 ;
while ( ! fsAccountsADM . eof ( ) & & ! fsAccountsADM . fail ( ) )
2003-01-20 16:14:57 +00:00
{
// Process each Line read in from the accounts.adm file. Handle Comments first
2022-10-24 18:39:33 +08:00
if ( sLine [ 0 ] = = ' \\ ' | | sLine [ 0 ] = = ' ; ' | | sLine [ 0 ] = = ' / ' | | sLine [ 0 ] = = ' \' ' | | sLine [ 0 ] = = 0x13 | | sLine [ 0 ] = = 0x00 )
2003-01-20 16:14:57 +00:00
{
2012-11-03 18:11:04 +00:00
std : : getline ( fsAccountsADM , sLine ) ;
2022-03-04 07:35:46 -05:00
sLine = oldstrutil : : trim ( oldstrutil : : removeTrailing ( sLine , " // " ) ) ;
2003-01-20 16:14:57 +00:00
continue ;
}
// Keep track of the section account lines. There is nothing to process till at least one of these has been read
2012-11-03 18:11:04 +00:00
if ( sLine . substr ( 0 , 15 ) = = " SECTION ACCOUNT " )
2003-01-20 16:14:57 +00:00
{
// Increment the account acount
2012-11-03 18:11:04 +00:00
+ + wAccountCount ;
2022-10-24 18:39:33 +08:00
actb . wAccountIndex = wAccountId = oldstrutil : : value < SI32 > ( oldstrutil : : extractSection ( sLine , " " , 2 ) ) ;
2012-11-03 18:11:04 +00:00
2003-01-20 16:14:57 +00:00
// Scan for hiegest account. Needed for additional accounts.
2012-11-03 18:11:04 +00:00
if ( actb . wAccountIndex > m_wHighestAccount )
2022-10-24 18:39:33 +08:00
{
2003-01-20 16:14:57 +00:00
m_wHighestAccount = actb . wAccountIndex ;
2022-10-24 18:39:33 +08:00
}
2003-01-20 16:14:57 +00:00
// Ok, we have parsed out the account ID, Set bBraces[2] to true to allow block reading
2012-11-03 18:11:04 +00:00
bBraces [ 0 ] = false ;
bBraces [ 1 ] = false ;
bBraces [ 2 ] = true ;
2003-01-20 16:14:57 +00:00
// Get the next line and continue
2012-11-03 18:11:04 +00:00
std : : getline ( fsAccountsADM , sLine ) ;
2022-03-04 07:35:46 -05:00
sLine = oldstrutil : : trim ( oldstrutil : : removeTrailing ( sLine , " // " ) ) ;
2003-01-20 16:14:57 +00:00
continue ;
}
// Fail safe. If bBraces[2] isn't set there is no need to even run this code
2012-11-03 18:11:04 +00:00
if ( ! bBraces [ 2 ] )
2003-01-20 16:14:57 +00:00
{
// Make sure the get the next line to process.
2012-11-03 18:11:04 +00:00
std : : getline ( fsAccountsADM , sLine ) ;
2022-03-04 07:35:46 -05:00
sLine = oldstrutil : : trim ( oldstrutil : : removeTrailing ( sLine , " // " ) ) ;
2003-01-20 16:14:57 +00:00
continue ;
}
// If we get here then were reading a block now. Check for the openning brace.
2022-10-24 18:39:33 +08:00
if ( sLine [ 0 ] = = ' { ' & & ! bBraces [ 0 ] & & ! bBraces [ 1 ] )
2003-01-20 16:14:57 +00:00
{
bBraces [ 0 ] = true ;
2012-11-03 18:11:04 +00:00
std : : getline ( fsAccountsADM , sLine ) ;
2022-03-04 07:35:46 -05:00
sLine = oldstrutil : : trim ( oldstrutil : : removeTrailing ( sLine , " // " ) ) ;
2003-01-20 16:14:57 +00:00
continue ;
}
2022-10-24 18:39:33 +08:00
if ( ( ( sLine [ 0 ] = = ' { ' ) & & bBraces [ 0 ] ) | | ( ( sLine [ 0 ] = = ' { ' ) & & bBraces [ 1 ] ) )
2003-01-20 16:14:57 +00:00
{
fsAccountsADM . close ( ) ;
return 0x0000 ;
}
// Loop reading this block till the end brace is encountered.
2022-10-24 18:39:33 +08:00
if ( sLine [ 0 ] = = ' } ' & & bBraces [ 0 ] & & ! bBraces [ 1 ] )
2003-01-20 16:14:57 +00:00
{
2003-03-05 21:28:34 +00:00
// Peel the dwChars Array here
2022-10-24 18:39:33 +08:00
CAccountBlock_st actbTemp ;
CAccountBlock_st actbTempName ;
2012-11-03 18:11:04 +00:00
MAPUSERNAME_ITERATOR J ;
2022-10-24 18:39:33 +08:00
MAPUSERNAMEID_ITERATOR I = m_mapUsernameIdMap . find ( actb . wAccountIndex ) ;
if ( I ! = m_mapUsernameIdMap . end ( ) )
2003-03-05 21:28:34 +00:00
{
// OK there is an id in memory so we should check to see if its the same.
actbTemp = I - > second ;
2022-10-24 18:39:33 +08:00
J = m_mapUsernameMap . find ( actbTemp . sUsername ) ;
actbTempName = ( * J - > second ) ;
2012-11-03 18:11:04 +00:00
for ( UI08 ii = 0 ; ii < CHARACTERCOUNT ; + + ii )
2003-03-05 21:28:34 +00:00
{
2012-11-03 18:11:04 +00:00
// Doesn't matter, at all times the accounts.adm file will be valid over memory
if ( actbTemp . dwCharacters [ ii ] ! = INVALIDSERIAL )
2003-03-05 21:28:34 +00:00
{
2012-11-03 18:11:04 +00:00
actbTemp . dwCharacters [ ii ] = actbTempName . dwCharacters [ ii ] = dwChars [ ii ] ;
2022-10-24 18:39:33 +08:00
actbTempName . lpCharacters [ ii ] = actbTemp . lpCharacters [ ii ] = CalcCharObjFromSer ( dwChars [ ii ] ) ;
if ( actbTemp . lpCharacters [ ii ] ! = nullptr & & actbTempName . lpCharacters [ ii ] ! = nullptr )
2003-03-05 21:28:34 +00:00
{
2012-11-03 18:11:04 +00:00
actbTemp . lpCharacters [ ii ] - > SetAccount ( actbTemp ) ;
actbTempName . lpCharacters [ ii ] - > SetAccount ( actbTempName ) ;
2003-03-05 21:28:34 +00:00
}
}
}
}
else
{
2012-11-03 18:11:04 +00:00
// OK well since its not in memory then its safe to assume that we need to add this one
actbTemp = actbTempName = actb ;
for ( UI08 jj = 0 ; jj < CHARACTERCOUNT ; + + jj )
2003-03-05 21:28:34 +00:00
{
2012-11-03 18:11:04 +00:00
actbTemp . dwCharacters [ jj ] = actbTempName . dwCharacters [ jj ] = dwChars [ jj ] ;
2022-10-24 18:39:33 +08:00
actbTemp . lpCharacters [ jj ] = actbTempName . lpCharacters [ jj ] = CalcCharObjFromSer ( dwChars [ jj ] ) ;
if ( actbTemp . lpCharacters [ jj ] ! = nullptr & & actbTempName . lpCharacters [ jj ] ! = nullptr )
2012-11-03 18:11:04 +00:00
{
actbTemp . lpCharacters [ jj ] - > SetAccount ( actbTemp ) ;
actbTempName . lpCharacters [ jj ] - > SetAccount ( actbTempName ) ;
}
2003-03-05 21:28:34 +00:00
}
}
2022-10-24 18:39:33 +08:00
actb . wAccountIndex = actbTemp . wAccountIndex = wAccountId ;
actbTempName . wAccountIndex = wAccountId ;
2003-01-20 16:14:57 +00:00
// Ok we shoud shove this into the map(s) for use later
2022-10-24 18:39:33 +08:00
m_mapUsernameIdMap [ wAccountId ] = actbTemp ;
m_mapUsernameMap [ actb . sUsername ] = & m_mapUsernameIdMap [ wAccountId ] ;
2012-11-03 18:11:04 +00:00
actb . reset ( ) ;
2003-01-20 16:14:57 +00:00
// Ok we have finished with this access block clean up and continue processing
2012-11-03 18:11:04 +00:00
bBraces [ 0 ] = false ;
bBraces [ 1 ] = false ;
bBraces [ 2 ] = false ;
std : : getline ( fsAccountsADM , sLine ) ;
2022-03-04 07:35:46 -05:00
sLine = oldstrutil : : trim ( oldstrutil : : removeTrailing ( sLine , " // " ) ) ;
2012-11-03 18:11:04 +00:00
for ( UI08 kk = 0 ; kk < CHARACTERCOUNT ; + + kk )
2003-03-05 21:28:34 +00:00
{
2022-10-24 18:39:33 +08:00
dwChars [ kk ] = INVALIDSERIAL ;
2003-03-05 21:28:34 +00:00
}
2003-01-20 16:14:57 +00:00
continue ;
}
2022-03-04 07:35:46 -05:00
auto ssecs = oldstrutil : : sections ( sLine , " " ) ;
auto l = oldstrutil : : trim ( oldstrutil : : removeTrailing ( ssecs [ 0 ] , " // " ) ) ;
auto r = oldstrutil : : trim ( oldstrutil : : removeTrailing ( ssecs [ 1 ] , " // " ) ) ;
2003-01-20 16:14:57 +00:00
// Parse and store based on tag
2012-11-03 18:11:04 +00:00
if ( l = = " NAME " )
2003-01-20 16:14:57 +00:00
{
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
// Ok strip the name and store it. We need to make it all the same case for comparisons
if ( ! r . empty ( ) & & r . length ( ) ! = 0 )
{
2022-03-04 07:35:46 -05:00
actb . sUsername = r ; //oldstrutil::lower( r );
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
}
2003-01-20 16:14:57 +00:00
else
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
{
2012-11-03 18:11:04 +00:00
actb . sUsername = " ERROR " ;
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
}
2012-11-03 18:11:04 +00:00
std : : getline ( fsAccountsADM , sLine ) ;
2022-03-04 07:35:46 -05:00
sLine = oldstrutil : : trim ( oldstrutil : : removeTrailing ( sLine , " // " ) ) ;
2003-01-20 16:14:57 +00:00
continue ;
}
2012-11-03 18:11:04 +00:00
else if ( l = = " PASS " )
2003-01-20 16:14:57 +00:00
{
2012-11-03 18:11:04 +00:00
if ( ! r . empty ( ) & & r . length ( ) ! = 0 )
2003-01-20 16:14:57 +00:00
{
// Ok strip the password and store it.
2012-11-03 18:11:04 +00:00
actb . sPassword = r ;
2003-01-20 16:14:57 +00:00
// Now we have to parse the crap in access.adm. Were not gonna look at much format just the 2 tags we need.
}
else
{
// r was not valid when passed in. Deal with it here
}
// Ok we have finished with this access block clean up and continue processing
2012-11-03 18:11:04 +00:00
bBraces2 [ 0 ] = false ;
bBraces2 [ 1 ] = false ;
bBraces2 [ 2 ] = false ;
std : : getline ( fsAccountsADM , sLine ) ;
2022-03-04 07:35:46 -05:00
sLine = oldstrutil : : trim ( oldstrutil : : removeTrailing ( sLine , " // " ) ) ;
2003-01-20 16:14:57 +00:00
continue ;
}
2012-11-03 18:11:04 +00:00
else if ( l = = " FLAGS " )
2003-01-20 16:14:57 +00:00
{
2012-11-03 18:11:04 +00:00
if ( ! r . empty ( ) & & r . length ( ) ! = 0 )
2003-01-20 16:14:57 +00:00
{
2022-10-24 18:39:33 +08:00
actb . wFlags = static_cast < UI16 > ( std : : stoul ( r , nullptr , 0 ) ) ;
2012-11-03 18:11:04 +00:00
if ( actb . wAccountIndex = = 0 )
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
{
2012-11-03 18:11:04 +00:00
actb . wFlags . set ( AB_FLAGS_GM , true ) ;
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
}
2003-01-20 16:14:57 +00:00
}
else
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
{
2012-11-03 18:11:04 +00:00
actb . wFlags . set ( AB_FLAGS_PUBLIC , true ) ;
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
}
2012-11-03 18:11:04 +00:00
std : : getline ( fsAccountsADM , sLine ) ;
2022-03-04 07:35:46 -05:00
sLine = oldstrutil : : trim ( oldstrutil : : removeTrailing ( sLine , " // " ) ) ;
2003-01-20 16:14:57 +00:00
continue ;
}
2012-11-03 18:11:04 +00:00
else if ( l = = " PATH " )
2003-01-20 16:14:57 +00:00
{
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
// Ok strip the name and store it. We need to make it all the same case for comparisons
if ( ! r . empty ( ) & & r . length ( ) ! = 0 )
{
2012-11-03 18:11:04 +00:00
actb . sPath = r ;
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
}
2003-01-20 16:14:57 +00:00
else
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
{
2012-11-03 18:11:04 +00:00
actb . sPath = " ERROR " ;
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
}
2012-11-03 18:11:04 +00:00
std : : getline ( fsAccountsADM , sLine ) ;
2022-03-04 07:35:46 -05:00
sLine = oldstrutil : : trim ( oldstrutil : : removeTrailing ( sLine , " // " ) ) ;
2003-01-20 16:14:57 +00:00
continue ;
}
2012-11-03 18:11:04 +00:00
else if ( l = = " TIMEBAN " )
2003-01-20 16:14:57 +00:00
{
2012-11-03 18:11:04 +00:00
if ( ! r . empty ( ) & & r . length ( ) ! = 0 )
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
{
2022-10-24 18:39:33 +08:00
actb . wTimeBan = static_cast < UI32 > ( std : : stoul ( r , nullptr , 0 ) ) ;
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
}
2003-01-20 16:14:57 +00:00
else
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
{
2012-11-03 18:11:04 +00:00
actb . wTimeBan = 0 ;
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
}
2012-11-03 18:11:04 +00:00
std : : getline ( fsAccountsADM , sLine ) ;
2022-03-04 07:35:46 -05:00
sLine = oldstrutil : : trim ( oldstrutil : : removeTrailing ( sLine , " // " ) ) ;
2003-01-20 16:14:57 +00:00
continue ;
}
2022-01-10 07:33:51 +08:00
else if ( l = = " FIRSTLOGIN " )
{
if ( ! r . empty ( ) & & r . length ( ) ! = 0 )
{
2022-10-24 18:39:33 +08:00
actb . wFirstLogin = static_cast < UI32 > ( std : : stoul ( r , nullptr , 0 ) ) ;
2022-01-10 07:33:51 +08:00
}
else
{
actb . wFirstLogin = 0 ;
}
std : : getline ( fsAccountsADM , sLine ) ;
2022-03-04 07:35:46 -05:00
sLine = oldstrutil : : trim ( oldstrutil : : removeTrailing ( sLine , " // " ) ) ;
2022-01-10 07:33:51 +08:00
continue ;
}
UOX3 0.99.6-RC6
Removed arbitrary and hidden restrictions on refreshing list of online players shown with 'wholist command
Fixed an issue where player ghosts that get teleported would not see themselves get updated to new location
Fixed a server crash from clients disconnecting while running server in debug mode
Improved how container updates are sent to players; now only sends to clients that have actually opened the container, and who are still within range
Added more information about UO data files being loaded during server startup
Enhanced the GM 'add menu to allow clicking directly on images of items/npcs to add them, and adjusted size of menus to accommodate this
Fixed an issue with fleeing NPCs that could cause them to attempt to flee across time and space, regardless of distance to target/attacker in combat
Added NPC AI that runs away from players if they get too close (even outside combat). Applied to hind, rabbits, squirrels, ferrets and various birds by default:
AI_ANIMAL_SCARED (aitype 12)
Fixed issues with NPCs fleeing forever, or getting stuck in flee/don't flee loop, by introducing max fleeing distance (50 tiles) and cooldown (30 sec) on fleeing
Updated onNameRequest JS Event to include third parameter with origin of name request, so script responses can be tailored appropriately:
onNameRequest( myObj, requestedBy, requestSource )
Potential values for requestSource:
0 - Speech/System Messages
1 - Guild Menus
2 - Stat Window (self)
3 - Stat Window (other)
4 - Tooltip
5 - Paperdoll Journal
6 - Paperdoll
7 - Single Click / All-Names
8 - System
9 - Secure Trade Window
Added Adaptive Performance System (APS) that dynamically adjust how often NPC AI/movement is checked based on overall shard performance. If performance drops below defined threshold, UOX3 gradually slows down checks for NPC AI/movement to prioritize player movement/speech/command responsiveness. If performance climbs back up above threshold, slowdowns are gradually removed. The following UOX.INI options have been added under [system] category to support this system:
APSPERFTHRESHOLD=50 // Performance threshold (measured in simulation cycles/sec) below which the APS kicks in
APSINTERVAL=100 // How often (in milliseconds) the APS checks performance and makes adjustments (if needed) to balance out shard performance
APSDELAYSTEP=50 // How much the delay timer is modified by (in milliseconds) each time APS makes adjustments
APSDELAYMAXCAP=2000 // Max amount of of delay APS can introduce for NPC AI/movement handling when attempting to restore shard performance
Added new JS Methods for Region objects:
.GetOrePrefs( oreType ) // Get ore preference data for ore type found in town region. Returned as an array containing the following data:
orePrefData -> [
oreName, // name of ore
color, // color of ore
minskill, // min skill to mine ore
ingotName, // name of ingot created from ore
makemenu, // makemenu entry for crafting something from ingot
oreChance, // default global chance of finding this ore type
scriptID // script attached to mined ore
],
orePrefChance // Chance of finding this ore type in given town region
.GetOreChance() // Get base chance of finding any ore in town region
Moved Mining skill plus gravedigging feature from hard code to scripts (js/skill/mining.js) to make it easier to maintain and/or customize, and removed hard coded variants
Gravedigging now relies on the ore resource system behind the scenes to restrict how often graves in a given area can be dug up
Fixed some incorrect references to .worldNumber Character property in misc scripts (should be .worldnumber)
Made some "hard-scripted" system messages in misc scripts use dictionary system instead
Added spawn region for banker NPCs in Serpent's Hold (dfndata/spawn/felucca/spawn_town_serpents_hold.dfn, dfndata/spawn/trammel/spawn_town_serpents_hold.dfn)
Fixed region definition of Ocllo to actually cover the entire town (dfndata/regions/regions.dfn)
Added numerous additional locations accessible with 'goplace # command, for key locations in Ilshenar, Malas, Tokuno Islands and Ter Mur (dfndata/location/location.dfn)
Revised travel-menu portion of GM menu (shortcut: 'travel) to include more travel options based on new locations (dfndata/items/travelmenu.dfn and travelmenu.bulk.dfn)
Fixed an issue where NPCs could attempt to attack targets in other worlds/instances
Added new JS Event that triggers for characters who are about to deal damage in combat. Complimentary to onDamage, which triggers for chars receiving damage:
onDamageDeal( dmgDealer, dmgReceiver, damageValue, damageType )
Added new JS Event that can trigger in global script upon creation of new player chars. Note that this will trigger in place of onCreateDFN event for player characters:
onCreatePlayer( pChar )
Added new JS Event that triggers for characters selecting a target with a spell. Complimentary to onSpellTarget, which triggers for targets selected with a spell:
onSpellTargetSelect( caster, target, spellNum )
Updated onCombatStart and onCombatEnd JS Events to also trigger for the other party in combat
Updated onPickup JS Event to include a third parameter - the potential container item was picked up from. Event now also triggers event in scripts attached to said containers:
onPickup( iPickedUp, pChar, iCont )
Added tracking of total playtime per individual character, and per account across all characters, and exposed these properties to JS engine:
.totalPlayTime // Account property, total playtime across all chars
.playTime // Character property, total playtime on given character only
Added new player-accessible command ('playtime) to spit out the playtime of current character/account as a whole (js/commands/playtime.js)
Implemented first version of Young Player System:
Replaced the UNUSED9 account flag with YOUNG, to be used by Young/New Player System
Added new JS Account property that gets/sets whether player account is considered Young:
.isYoung
Added new Char timers:
TIMER_YOUNGHEAL // Restricts how often Young players are healed by NPC healers
TIMER_YOUNGMESSAGE // Restricts how often Young players are warned about dangerous looking monsters in overworld
Updated GM commands 'get and 'set to get/set .isYoung property of player's account (js/commands/targeting/get.js and set.js)
Added new UOX.INI setting to enable/disable Young Player System (enabled by default):
YOUNGPLAYERSYSTEM=1
If Young Player System is enabled, all newly created player accounts are automatically marked with Young flag
Added new script to handle various restrictions and functions related to Young characters (js/player/young_player.js):
Young characters will have [Young] displayed over their head
Young characters will have their Young status checked and verified on every login + every stat/skill gain, to revoke the Young status if any of the following is true:
Account has a total playtime of more than 40 hours
Any character has more than 350 total (base) skill points
Any character has more than 70 skill points in a single skill
Any character has more than 150 total stat points
Any character has more than 80 stat points in a single stat
Young characters can renounce their Young status manually by saying the words "I renounce my young player status"
Young characters get two additional items upon creation:
a new player ticket (can be combined with any other players new player ticket for both players to get a reward)
a sextant (shows Young players directions to nearest moongate/bank regardless of where they are, as long as outdoors)
Young characters cannot target other player characters with hostile spells or skills
Young characters cannot be the target of other player characters' hostile spells or skills
Young characters can only cast beneficial spells upon themselves or other Young characters
Young characters can only be the target of beneficial spells from other Young players
Young players (and their pets/followers) cannot attack or harm any other players (or their pets/followers), nor themselves be attacked or harmed by any other players (or their pets/followers), whether from combat, spells, skills or items
Young players don't lose any of their items on death, and are teleported to the nearest healer upon death with all their items intact
Young players receive a warning upon entering dungeons that monsters there will be hostile
Updated global script (js/server/global.js) to:
Check/Verify Young status of players upon login
Attach young player script on login/creation for players on Young accounts
Give specific items to Young players upon creation
Added new script (js/item/corpse.js) that is assigned to all freshly created corpses. This script handles restrictions related to Young players interactions with corpses, and the interactions of other players with corpses of Young players
Updated JS Method .Carve() to return true/false depending on whether carving a corpse was successful
Updated Healer AI in code to heal nearby injured Young players
Updated Evil AI and Evil Caster AI in code to avoid selecting Young players as targets in combat outside of dungeons
Added a new section to UOX.INI - [young player starting locations] - that can be used to define starting locations for Young players. If only one such location is provided, all players start there. Otherwise, it matches the same starting location setup as the regular one - with one entry per town in Britannia.
Restricted transferring and/or friending of pets (code) and hirelings (hirelings.js) between Young and non-Young players
Restricted Young players from recalling or gating to Felucca facet
Young players can instantly logout from anywhere, at any time
2023-07-01 20:02:40 +08:00
else if ( l = = " TOTALPLAYTIME " )
{
if ( ! r . empty ( ) & & r . length ( ) ! = 0 )
{
actb . wTotalPlayTime = static_cast < UI32 > ( std : : stoul ( r , nullptr , 0 ) ) ;
}
else
{
actb . wTotalPlayTime = 0 ;
}
std : : getline ( fsAccountsADM , sLine ) ;
sLine = oldstrutil : : trim ( oldstrutil : : removeTrailing ( sLine , " // " ) ) ;
continue ;
}
2012-11-03 18:11:04 +00:00
else if ( l = = " CONTACT " )
2003-01-20 16:14:57 +00:00
{
// Ok strip the name and store it. We need to make it all the same case for comparisons
2012-11-03 18:11:04 +00:00
if ( ! r . empty ( ) & & r . length ( ) ! = 0 )
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
{
2022-03-04 07:35:46 -05:00
actb . sContact = oldstrutil : : lower ( r ) ;
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
}
2003-01-20 16:14:57 +00:00
else
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
{
2012-11-03 18:11:04 +00:00
actb . sContact = " UNKNOWN " ;
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
}
2012-11-03 18:11:04 +00:00
std : : getline ( fsAccountsADM , sLine ) ;
2022-03-04 07:35:46 -05:00
sLine = oldstrutil : : trim ( oldstrutil : : removeTrailing ( sLine , " // " ) ) ;
2003-01-20 16:14:57 +00:00
continue ;
}
2012-11-03 18:11:04 +00:00
else if ( l = = " LASTIP " )
2003-01-20 16:14:57 +00:00
{
2022-03-04 07:35:46 -05:00
auto psecs = oldstrutil : : sections ( r , " . " ) ;
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
if ( ! r . empty ( ) & & r . length ( ) ! = 0 & & psecs . size ( ) = = 4 )
{
2022-10-24 18:39:33 +08:00
actb . dwLastIP = CalcSerial ( oldstrutil : : value < SI08 > ( psecs [ 0 ] ) , oldstrutil : : value < SI08 > ( psecs [ 1 ] ) ,
oldstrutil : : value < SI08 > ( psecs [ 2 ] ) , oldstrutil : : value < SI08 > ( psecs [ 3 ] ) ) ;
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
}
2003-01-20 16:14:57 +00:00
else
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
{
2012-11-03 18:11:04 +00:00
actb . dwLastIP = 0x00000000 ;
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
}
2012-11-03 18:11:04 +00:00
std : : getline ( fsAccountsADM , sLine ) ;
2022-03-04 07:35:46 -05:00
sLine = oldstrutil : : trim ( oldstrutil : : removeTrailing ( sLine , " // " ) ) ;
2003-01-20 16:14:57 +00:00
continue ;
}
2012-11-03 18:11:04 +00:00
else if ( l . substr ( 0 , 10 ) = = " CHARACTER- " ) // It's a character
2003-01-20 16:14:57 +00:00
{
2022-10-24 18:39:33 +08:00
auto charNum = static_cast < UI08 > ( std : : stoul ( l . substr ( 10 ) , nullptr , 0 ) ) ;
2012-11-03 18:11:04 +00:00
if ( charNum < 1 | | charNum > CHARACTERCOUNT )
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
{
2022-10-24 18:39:33 +08:00
Console . Error ( " Invalid character found in accounts " ) ;
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
}
2003-01-20 16:14:57 +00:00
else
{
2012-11-03 18:11:04 +00:00
if ( ! r . empty ( ) & & r . length ( ) ! = 0 )
{
// Ok strip the name and store it. We need to make it all the same case for comparisons
2022-10-24 18:39:33 +08:00
dwChars [ charNum - 1 ] = static_cast < UI32 > ( std : : stoul ( r , nullptr , 0 ) ) ;
2012-11-03 18:11:04 +00:00
std : : getline ( fsAccountsADM , sLine ) ;
continue ;
}
else
{
dwChars [ charNum - 1 ] = INVALIDSERIAL ;
}
2003-01-20 16:14:57 +00:00
}
2012-11-03 18:11:04 +00:00
std : : getline ( fsAccountsADM , sLine ) ;
2022-03-04 07:35:46 -05:00
sLine = oldstrutil : : trim ( oldstrutil : : removeTrailing ( sLine , " // " ) ) ;
2003-01-20 16:14:57 +00:00
continue ;
}
2012-11-03 18:11:04 +00:00
std : : getline ( fsAccountsADM , sLine ) ;
2022-03-04 07:35:46 -05:00
sLine = oldstrutil : : trim ( oldstrutil : : removeTrailing ( sLine , " // " ) ) ;
2012-11-03 18:11:04 +00:00
actb . reset ( ) ;
2003-03-05 21:28:34 +00:00
}
2012-11-03 18:11:04 +00:00
// We need to see if there are any new accounts to come.
2022-11-14 19:24:29 -05:00
[[maybe_unused]] UI16 wImportCount = 0x0000 ;
2012-11-03 18:11:04 +00:00
wImportCount = ImportAccounts ( ) ;
2003-01-20 16:14:57 +00:00
// Return the number of accounts loaded
2022-10-24 18:39:33 +08:00
return static_cast < UI16 > ( m_mapUsernameMap . size ( ) ) ;
2003-01-20 16:14:57 +00:00
}
2003-03-05 21:28:34 +00:00
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - cAccountClass::TransCharacter()
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
//| Date - 1/7/2003 5:39:12 AM
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
//| Purpose - Transfer a character from a known slot on a specified
2012-11-03 18:11:04 +00:00
//| account, to a new account and slot.
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
bool cAccountClass : : TransCharacter ( UI16 wSAccountId , UI16 wSSlot , UI16 wDAccountId )
2003-01-20 16:14:57 +00:00
{
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
// please leave these declarations alone. When we do this VC autocompetion doesn't work cause this isn't shoved on the stack with type info
2022-10-24 18:39:33 +08:00
MAPUSERNAMEID_ITERATOR I = m_mapUsernameIdMap . find ( wSAccountId ) ;
2003-03-05 21:28:34 +00:00
//
2022-10-24 18:39:33 +08:00
if ( I = = m_mapUsernameIdMap . end ( ) )
2003-01-20 16:14:57 +00:00
{
// This ID was not found.
return false ;
}
// Get the account block for this ID
2022-10-24 18:39:33 +08:00
CAccountBlock_st & actbId = I - > second ;
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
// Ok now we need to get the matching username map
2022-10-24 18:39:33 +08:00
MAPUSERNAME_ITERATOR J = m_mapUsernameMap . find ( actbId . sUsername ) ;
if ( J = = m_mapUsernameMap . end ( ) )
2003-01-20 16:14:57 +00:00
{
// This ID was not found.
return false ;
}
// Get the account block for this username.
2012-11-03 18:11:04 +00:00
2003-01-20 16:14:57 +00:00
// ok we will check to see if there is a valid char in source slot, if not we will return
2022-10-24 18:39:33 +08:00
if ( actbId . dwCharacters [ wSSlot ] = = INVALIDSERIAL )
2003-01-20 16:14:57 +00:00
return false ;
//
2022-10-24 18:39:33 +08:00
MAPUSERNAMEID_ITERATOR II = m_mapUsernameIdMap . find ( wDAccountId ) ;
if ( II = = m_mapUsernameIdMap . end ( ) )
2003-01-20 16:14:57 +00:00
{
// This ID was not found.
return false ;
}
// Get the account block for this ID
2022-10-24 18:39:33 +08:00
CAccountBlock_st & actbIID = II - > second ;
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
// Ok now we need to get the matching username map
2022-10-24 18:39:33 +08:00
MAPUSERNAME_ITERATOR JJ = m_mapUsernameMap . find ( actbIID . sUsername ) ;
if ( JJ = = m_mapUsernameMap . end ( ) )
2003-01-20 16:14:57 +00:00
{
// This ID was not found.
return false ;
}
// Get the account block for this username.
2012-11-03 18:11:04 +00:00
2003-01-20 16:14:57 +00:00
// ok at this point I/II = SourceID, and DestID and J/JJ SourceName/DestName
2022-10-24 18:39:33 +08:00
if ( AddCharacter ( wDAccountId , actbId . dwCharacters [ wSSlot ] , actbId . lpCharacters [ wSSlot ] ) )
2003-01-20 16:14:57 +00:00
{
// OK the character was added, need to remove it from the source.
2022-10-24 18:39:33 +08:00
DelCharacter ( wSAccountId , static_cast < SI32 > ( wSSlot ) ) ;
2012-11-03 18:11:04 +00:00
Save ( false ) ;
2003-01-20 16:14:57 +00:00
return true ;
}
return false ;
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - cAccountClass::AddCharacter()
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
//| Date - 12/18/2002 2:09:04 AM
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
//| Purpose - Add a character object to the in memory storage.
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
bool cAccountClass : : AddCharacter ( UI16 wAccountId , CChar * lpObject )
2003-01-20 16:14:57 +00:00
{
// Make sure that the lpObject pointer is valid
2022-10-24 18:39:33 +08:00
if ( lpObject = = nullptr )
2003-01-20 16:14:57 +00:00
return false ;
2022-10-24 18:39:33 +08:00
2003-01-20 16:14:57 +00:00
// Ok we need to do is get see if this account id exists
2022-10-24 18:39:33 +08:00
MAPUSERNAMEID_ITERATOR I = m_mapUsernameIdMap . find ( wAccountId ) ;
if ( I = = m_mapUsernameIdMap . end ( ) )
2003-01-20 16:14:57 +00:00
{
// This ID was not found.
return false ;
}
// Get the account block for this ID
2022-10-24 18:39:33 +08:00
CAccountBlock_st & actbId = I - > second ;
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
// Ok now we need to get the matching username map
2022-10-24 18:39:33 +08:00
MAPUSERNAME_ITERATOR J = m_mapUsernameMap . find ( actbId . sUsername ) ;
if ( J = = m_mapUsernameMap . end ( ) )
2003-01-20 16:14:57 +00:00
{
// This ID was not found.
return false ;
}
// Get the account block for this username.
2022-10-24 18:39:33 +08:00
CAccountBlock_st & actbName = ( * J - > second ) ;
2003-01-20 16:14:57 +00:00
// ok now that we have both of our account blocks we can update them. We will use teh first empty slot for this character
2012-11-03 18:11:04 +00:00
bool bExit = false ;
for ( UI08 i = 0 ; i < CHARACTERCOUNT ; + + i )
2003-01-20 16:14:57 +00:00
{
2022-10-24 18:39:33 +08:00
if ( actbId . dwCharacters [ i ] ! = lpObject - > GetSerial ( ) & & actbName . dwCharacters [ i ] ! = lpObject - > GetSerial ( )
& & actbId . dwCharacters [ i ] = = INVALIDSERIAL & & actbName . dwCharacters [ i ] = = INVALIDSERIAL )
2003-01-20 16:14:57 +00:00
{
// ok this slot is empty, we will stach this character in this slot
2022-10-24 18:39:33 +08:00
actbId . lpCharacters [ i ] = lpObject ;
actbId . dwCharacters [ i ] = lpObject - > GetSerial ( ) ;
actbName . lpCharacters [ i ] = lpObject ;
actbName . dwCharacters [ i ] = lpObject - > GetSerial ( ) ;
2003-01-20 16:14:57 +00:00
// we do not need to continue throught this loop anymore.
2022-10-24 18:39:33 +08:00
bExit = true ;
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
break ;
2003-01-20 16:14:57 +00:00
}
}
// If we were successfull then we return true
2012-11-03 18:11:04 +00:00
if ( bExit )
2003-01-20 16:14:57 +00:00
{
// make sure to put the values back into the maps corrected.
2022-10-24 18:39:33 +08:00
m_mapUsernameIdMap [ actbId . wAccountIndex ] = actbId ;
2003-01-20 16:14:57 +00:00
return true ;
}
return false ;
}
//
2022-10-24 18:39:33 +08:00
bool cAccountClass : : AddCharacter ( UI16 wAccountId , UI32 dwCharacterId , CChar * lpObject )
2003-01-20 16:14:57 +00:00
{
// Make sure that the lpObject pointer is valid
2022-10-24 18:39:33 +08:00
if ( lpObject = = nullptr )
2003-01-20 16:14:57 +00:00
return false ;
2022-10-24 18:39:33 +08:00
2003-01-20 16:14:57 +00:00
// Ok we need to do is get see if this account id exists
MAPUSERNAMEID_ITERATOR I ;
2022-10-24 18:39:33 +08:00
I = m_mapUsernameIdMap . find ( wAccountId ) ;
if ( I = = m_mapUsernameIdMap . end ( ) )
2003-01-20 16:14:57 +00:00
{
// This ID was not found.
return false ;
}
// Get the account block for this ID
2022-10-24 18:39:33 +08:00
CAccountBlock_st & actbId = I - > second ;
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
// Ok now we need to get the matching username map
2022-10-24 18:39:33 +08:00
MAPUSERNAME_ITERATOR J = m_mapUsernameMap . find ( actbId . sUsername ) ;
if ( J = = m_mapUsernameMap . end ( ) )
2003-01-20 16:14:57 +00:00
{
// This ID was not found.
return false ;
}
// Get the account block for this username.
2022-10-24 18:39:33 +08:00
CAccountBlock_st & actbName = ( * J - > second ) ;
2003-01-20 16:14:57 +00:00
// ok now that we have both of our account blocks we can update them. We will use teh first empty slot for this character
2022-10-24 18:39:33 +08:00
bool bExit = false ;
2012-11-03 18:11:04 +00:00
for ( UI08 i = 0 ; i < CHARACTERCOUNT ; + + i )
2003-01-20 16:14:57 +00:00
{
2022-10-24 18:39:33 +08:00
if ( actbId . dwCharacters [ i ] ! = lpObject - > GetSerial ( ) & & actbName . dwCharacters [ i ] ! = lpObject - > GetSerial ( )
& & actbId . dwCharacters [ i ] = = INVALIDSERIAL & & actbName . dwCharacters [ i ] = = INVALIDSERIAL )
2003-01-20 16:14:57 +00:00
{
// ok this slot is empty, we will stach this character in this slot
2022-10-24 18:39:33 +08:00
actbId . lpCharacters [ i ] = lpObject ;
actbId . dwCharacters [ i ] = dwCharacterId ;
2012-11-03 18:11:04 +00:00
actbName . lpCharacters [ i ] = lpObject ;
2022-10-24 18:39:33 +08:00
actbName . dwCharacters [ i ] = dwCharacterId ;
2003-01-20 16:14:57 +00:00
// we do not need to continue throught this loop anymore.
2022-10-24 18:39:33 +08:00
bExit = true ;
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
break ;
2003-01-20 16:14:57 +00:00
}
}
// If we were successfull then we return true
2012-11-03 18:11:04 +00:00
if ( bExit )
2003-01-20 16:14:57 +00:00
{
// make sure to put the values back into the maps corrected.
2022-10-24 18:39:33 +08:00
m_mapUsernameIdMap [ actbId . wAccountIndex ] = actbId ;
Save ( false ) ;
2003-01-20 16:14:57 +00:00
return true ;
}
return false ;
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - cAccountClass::clear()
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
//| Date - 12/18/2002 2:24:07 AM
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
//| Purpose - This function is used to clear out all entries contained
2012-11-03 18:11:04 +00:00
//| in both the Username, and UsernameID map structures.
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
bool cAccountClass : : clear ( void )
2003-01-20 16:14:57 +00:00
{
// First we should check to make sure that we can even use the objects, or they are not already cleared
try
{
2022-10-24 18:39:33 +08:00
if ( m_mapUsernameMap . empty ( ) | | m_mapUsernameIdMap . empty ( ) )
2003-01-20 16:14:57 +00:00
{
return false ;
}
// ok clear the map
2022-10-24 18:39:33 +08:00
m_mapUsernameIdMap . clear ( ) ;
2003-01-20 16:14:57 +00:00
m_mapUsernameMap . clear ( ) ;
2022-10-24 18:39:33 +08:00
m_wHighestAccount = 0x0000 ;
2003-01-20 16:14:57 +00:00
}
2012-11-03 18:11:04 +00:00
catch ( . . . )
2003-01-20 16:14:57 +00:00
{
return false ;
}
return true ;
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - cAccountClass::DelAccount( std::string sUsername )
//| cAccountClass::DelAccount( UI16 wAccountId )
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
//| Date - 12/18/2002 2:56:34 AM
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
//| Purpose - Remove an account from the internal account storage map.
2012-11-03 18:11:04 +00:00
//| At this point this function will only remove the account
//| block from the accounts.adm and not the physical files
//| on the storage medium.
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
bool cAccountClass : : DelAccount ( std : : string sUsername )
2003-01-20 16:14:57 +00:00
{
// Ok were just going to get the ID number for this account and make the ID function do all the work
2022-10-24 18:39:33 +08:00
MAPUSERNAME_ITERATOR I = m_mapUsernameMap . find ( sUsername ) ;
if ( I = = m_mapUsernameMap . end ( ) )
2003-01-20 16:14:57 +00:00
return false ;
2022-10-24 18:39:33 +08:00
CAccountBlock_st & actbTemp = ( * I - > second ) ;
2003-01-20 16:14:57 +00:00
// Ok lets do the work now
2012-11-03 18:11:04 +00:00
return DelAccount ( actbTemp . wAccountIndex ) ;
2003-01-20 16:14:57 +00:00
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
bool cAccountClass : : DelAccount ( UI16 wAccountId )
2003-01-20 16:14:57 +00:00
{
// Ok we need to get the ID block again as it wasn't passed in
2022-10-24 18:39:33 +08:00
MAPUSERNAMEID_ITERATOR I = m_mapUsernameIdMap . find ( wAccountId ) ;
if ( I = = m_mapUsernameIdMap . end ( ) )
2003-01-20 16:14:57 +00:00
return false ;
2022-10-24 18:39:33 +08:00
CAccountBlock_st & actbId = I - > second ;
2003-01-20 16:14:57 +00:00
// Now we need to get the matching username map entry
2022-10-24 18:39:33 +08:00
MAPUSERNAME_ITERATOR J = m_mapUsernameMap . find ( actbId . sUsername ) ;
if ( J = = m_mapUsernameMap . end ( ) )
2003-01-20 16:14:57 +00:00
return false ;
2012-11-03 18:11:04 +00:00
2003-01-20 16:14:57 +00:00
// Before we delete this account we need to spin the characters, and list them in the orphan.adm file
2022-10-24 18:39:33 +08:00
std : : string sTempPath ( m_sAccountsDirectory ) ;
if ( sTempPath [ sTempPath . length ( ) - 1 ] = = ' \\ ' | | sTempPath [ sTempPath . length ( ) - 1 ] = = ' / ' )
{
2003-01-20 16:14:57 +00:00
sTempPath + = " orphans.adm " ;
2022-10-24 18:39:33 +08:00
}
2003-01-20 16:14:57 +00:00
else
2022-10-24 18:39:33 +08:00
{
2003-01-20 16:14:57 +00:00
sTempPath + = " /orphans.adm " ;
2022-10-24 18:39:33 +08:00
}
2003-01-20 16:14:57 +00:00
// First lets see if the file exists.
2022-10-24 18:39:33 +08:00
bool bOrphanHeader = false ;
std : : fstream fsOrphansADMTest ( sTempPath . c_str ( ) , std : : ios : : in ) ;
2012-11-03 18:11:04 +00:00
if ( ! fsOrphansADMTest . is_open ( ) )
2022-10-24 18:39:33 +08:00
{
bOrphanHeader = true ;
}
2003-01-20 16:14:57 +00:00
fsOrphansADMTest . close ( ) ;
// ok open the stream for append and add this record to the end of the file
2022-10-24 18:39:33 +08:00
std : : fstream fsOrphansADM ( sTempPath . c_str ( ) , std : : ios : : out | std : : ios : : app ) ;
2012-11-03 18:11:04 +00:00
if ( ! fsOrphansADM . is_open ( ) )
2003-01-20 16:14:57 +00:00
return false ;
2022-10-24 18:39:33 +08:00
2003-01-20 16:14:57 +00:00
// If this is a new file then we need to write the header first
2012-11-03 18:11:04 +00:00
if ( bOrphanHeader )
2003-01-20 16:14:57 +00:00
{
2012-11-03 18:11:04 +00:00
WriteOrphanHeader ( fsOrphansADM ) ;
2003-01-20 16:14:57 +00:00
}
// Spin the characters here
2012-11-03 18:11:04 +00:00
for ( UI08 jj = 0 ; jj < CHARACTERCOUNT ; + + jj )
2003-01-20 16:14:57 +00:00
{
// If this slot is 0xffffffff or (-1) then we dont need to put it into the orphans.adm
2022-10-24 18:39:33 +08:00
if ( actbId . dwCharacters [ jj ] ! = INVALIDSERIAL ) // Ok build then write what we need to the file
{
fsOrphansADM < < " , " < < actbId . lpCharacters [ jj ] - > GetName ( ) < < " , " < < actbId . lpCharacters [ jj ] - > GetX ( )
< < " , " < < actbId . lpCharacters [ jj ] - > GetY ( ) < < " , " < < static_cast < SI32 > ( actbId . lpCharacters [ jj ] - > GetZ ( ) ) < < std : : endl ;
}
2003-01-20 16:14:57 +00:00
}
fsOrphansADM . close ( ) ;
2012-11-03 18:11:04 +00:00
// Ok we have both the map iterators pointing to the right place. Erase these entries
2022-10-24 18:39:33 +08:00
m_mapUsernameIdMap . erase ( I ) ;
m_mapUsernameMap . erase ( J ) ;
2003-01-20 16:14:57 +00:00
// Just a means to show that an accounts has been removed when looking at the directories
char szDirName [ 40 ] ;
char szDirPath [ MAX_PATH ] ;
2022-10-24 18:39:33 +08:00
memset ( szDirName , 0x00 , sizeof ( SI08 ) * 40 ) ;
memset ( szDirPath , 0x00 , sizeof ( SI08 ) * MAX_PATH ) ;
2003-01-20 16:14:57 +00:00
// Ok copy only the username portion to this so we can build a correct rename path
2022-10-24 18:39:33 +08:00
strcopy ( szDirName , 40 , & actbId . sPath [ actbId . sPath . length ( ) - actbId . sUsername . length ( ) - 1 ] ) ;
//strcpy(szDirName,&actbId.sPath[actbId.sPath.length()-actbId.sUsername.length()-1]);
strncopy ( szDirPath , MAX_PATH , actbId . sPath . c_str ( ) , actbId . sPath . length ( ) - actbId . sUsername . length ( ) - 1 ) ;
std : : string sNewDir ( szDirPath ) ;
2003-01-20 16:14:57 +00:00
sNewDir + = " _ " ;
sNewDir + = szDirName ;
2022-10-24 18:39:33 +08:00
[[maybe_unused]] int retVal = rename ( actbId . sPath . c_str ( ) , sNewDir . c_str ( ) ) ;
2003-01-20 16:14:57 +00:00
// We have to run a save to make sure that the accoung it removed.
2012-11-03 18:11:04 +00:00
Save ( false ) ;
2003-01-20 16:14:57 +00:00
return true ;
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - cAccountClass::SetPath()
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
//| Date - 12/19/2002 12:29:59 AM
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
//| Purpose - Set the internal string to contain the path to the accounts
2012-11-03 18:11:04 +00:00
//| directory. This path much not contain a filename, As there
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
//| is no checking implemented.
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
bool cAccountClass : : SetPath ( const std : : string & sPath )
2003-01-20 16:14:57 +00:00
{
try
{
m_sAccountsDirectory = sPath ;
return true ;
}
2012-11-03 18:11:04 +00:00
catch ( . . . )
2003-01-20 16:14:57 +00:00
{
return false ;
}
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - cAccountClass::GetPath()
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
//| Date - 12/19/2002 12:34:01 AM
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
//| Purpose - Return a copy of the current accounts directory stored
2012-11-03 18:11:04 +00:00
//| internally
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
std : : string cAccountClass : : GetPath ( void )
2003-01-20 16:14:57 +00:00
{
return m_sAccountsDirectory ;
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - cAccountClass::DelCharacter()
//o------------------------------------------------------------------------------------------------o
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
//| Purpose - Remove a character from the accounts map. Currently this
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
//| character object resource is not freed. The Character ID,
2021-06-12 07:30:23 -04:00
//| and CChar object holders will be set to -1, and nullptr
2012-11-03 18:11:04 +00:00
//| respectivly. As a consolation the characters will be for
//| the interim listed in the orphan.adm file. This file will
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
//| contain simply the username, and character ID that was
2012-11-03 18:11:04 +00:00
//| removed. For those that are wondering why this might be.
//| Until the system itself deletes the character and items
//| at least we will have a listing of orphaned character in
//| game that a GM can use to locate, or even assign to another
//| account.
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
SI08 cAccountClass : : DelCharacter ( UI16 wAccountId , UI08 nSlot )
2003-01-20 16:14:57 +00:00
{
// Do the simple here, save us some work
2021-07-04 07:57:42 +08:00
if ( nSlot > = CHARACTERCOUNT )
2022-10-24 18:39:33 +08:00
{
2021-07-04 07:57:42 +08:00
return CDR_BADREQUEST ;
2022-10-24 18:39:33 +08:00
}
2021-07-04 07:57:42 +08:00
2003-01-20 16:14:57 +00:00
// ok were going to need to get the respective blocked from the maps
2022-10-24 18:39:33 +08:00
MAPUSERNAMEID_ITERATOR I = m_mapUsernameIdMap . find ( wAccountId ) ;
if ( I = = m_mapUsernameIdMap . end ( ) )
2021-07-04 07:57:42 +08:00
return CDR_CHARNOTFOUND ;
2022-10-24 18:39:33 +08:00
CAccountBlock_st & actbId = I - > second ;
2021-07-04 07:57:42 +08:00
2003-01-20 16:14:57 +00:00
// Ok now that we have the ID Map block we can get the Username Block
2022-10-24 18:39:33 +08:00
MAPUSERNAME_ITERATOR J = m_mapUsernameMap . find ( actbId . sUsername ) ;
2021-07-04 07:57:42 +08:00
if ( J = = m_mapUsernameMap . end ( ) )
return CDR_BADPASSWORD ;
2022-10-24 18:39:33 +08:00
CAccountBlock_st & actbName = ( * J - > second ) ;
2021-07-04 07:57:42 +08:00
2012-11-03 18:11:04 +00:00
// Check to see if this record has been flagged changed
2021-07-04 07:57:42 +08:00
// Edit: What's this supposed to do? All it does is prevent players from deleting their character on the first try... then it succeedes on the second try
2022-10-24 18:39:33 +08:00
/*if( actbId.bChanged )
2012-11-03 18:11:04 +00:00
{
I - > second . bChanged = false ;
2021-07-04 07:57:42 +08:00
return CDR_CHARISQUEUED ;
} */
2003-01-20 16:14:57 +00:00
// We have both blocks now. We should validate the slot, and make the changes
2022-10-24 18:39:33 +08:00
if ( actbId . dwCharacters [ nSlot ] = = INVALIDSERIAL | | actbName . dwCharacters [ nSlot ] = = INVALIDSERIAL )
2021-07-04 07:57:42 +08:00
return CDR_CHARNOTFOUND ;
2003-01-20 16:14:57 +00:00
// We need to make a entry in the orphan.adm file for this block before we change it
2022-10-24 18:39:33 +08:00
std : : string sTempPath ( m_sAccountsDirectory ) ;
2021-07-04 07:57:42 +08:00
if ( sTempPath [ sTempPath . length ( ) - 1 ] = = ' \\ ' | | sTempPath [ sTempPath . length ( ) - 1 ] = = ' / ' )
2022-10-24 18:39:33 +08:00
{
2003-01-20 16:14:57 +00:00
sTempPath + = " orphans.adm " ;
2022-10-24 18:39:33 +08:00
}
2003-01-20 16:14:57 +00:00
else
2022-10-24 18:39:33 +08:00
{
2003-01-20 16:14:57 +00:00
sTempPath + = " /orphans.adm " ;
2022-10-24 18:39:33 +08:00
}
2021-07-04 07:57:42 +08:00
2003-01-20 16:14:57 +00:00
// First lets see if the file exists.
2022-10-24 18:39:33 +08:00
bool bOrphanHeader = false ;
std : : fstream fsOrphansADMTest ( sTempPath . c_str ( ) , std : : ios : : in ) ;
2012-11-03 18:11:04 +00:00
if ( ! fsOrphansADMTest . is_open ( ) )
2022-10-24 18:39:33 +08:00
{
2021-07-04 07:57:42 +08:00
bOrphanHeader = true ;
2022-10-24 18:39:33 +08:00
}
2003-01-20 16:14:57 +00:00
fsOrphansADMTest . close ( ) ;
2021-07-04 07:57:42 +08:00
2003-01-20 16:14:57 +00:00
// ok open the stream for append and add this record to the end of the file
2022-10-24 18:39:33 +08:00
std : : fstream fsOrphansADM ( sTempPath . c_str ( ) , std : : ios : : out | std : : ios : : app ) ;
2012-11-03 18:11:04 +00:00
if ( ! fsOrphansADM . is_open ( ) )
2021-07-04 07:57:42 +08:00
return CDR_BADREQUEST ;
2003-01-20 16:14:57 +00:00
// If this is a new file then we need to write the header first
2012-11-03 18:11:04 +00:00
if ( bOrphanHeader )
2003-01-20 16:14:57 +00:00
{
2022-10-24 18:39:33 +08:00
WriteOrphanHeader ( fsOrphansADM ) ;
2003-01-20 16:14:57 +00:00
}
2021-07-04 07:57:42 +08:00
2003-01-20 16:14:57 +00:00
// Ok build then write what we need to the file
2022-10-24 18:39:33 +08:00
fsOrphansADM < < actbId . sUsername < < " =0x " < < std : : hex < < actbId . dwCharacters [ nSlot ] < < " , "
< < ( actbId . lpCharacters [ nSlot ] ! = nullptr ? actbId . lpCharacters [ nSlot ] - > GetName ( ) : " UNKNOWN " ) < < " ,0x "
< < ( actbId . lpCharacters [ nSlot ] ! = nullptr ? actbId . lpCharacters [ nSlot ] - > GetX ( ) : 0 ) < < " ,0x "
< < ( actbId . lpCharacters [ nSlot ] ! = nullptr ? actbId . lpCharacters [ nSlot ] - > GetY ( ) : 0 ) < < " , " < < std : : dec
< < ( actbId . lpCharacters [ nSlot ] ! = nullptr ? static_cast < SI32 > ( actbId . lpCharacters [ nSlot ] - > GetZ ( ) ) : static_cast < SI32 > ( 0 ) ) < < std : : endl ;
2003-01-20 16:14:57 +00:00
fsOrphansADM . close ( ) ;
2021-07-04 07:57:42 +08:00
2003-01-20 16:14:57 +00:00
// Ok there is something in this slot so we should remove it.
2022-10-24 18:39:33 +08:00
actbId . dwCharacters [ nSlot ] = actbName . dwCharacters [ nSlot ] = INVALIDSERIAL ;
actbId . lpCharacters [ nSlot ] = actbName . lpCharacters [ nSlot ] = nullptr ;
2021-07-04 07:57:42 +08:00
2003-03-05 21:28:34 +00:00
// need to reorder the accounts or have to change the addchar code to ignore invalid serials(earier here)
2022-10-24 18:39:33 +08:00
CAccountBlock_st actbScratch ;
2012-11-03 18:11:04 +00:00
actbScratch . reset ( ) ;
2022-10-24 18:39:33 +08:00
actbScratch = actbId ;
2021-07-04 07:57:42 +08:00
SI32 kk = 0 ;
2003-03-05 21:28:34 +00:00
// Dont mind this loop, becuase we needed a copy of the data too we need to invalidate actbScracthes pointers, and indexs
2012-11-03 18:11:04 +00:00
for ( UI08 ll = 0 ; ll < CHARACTERCOUNT ; + + ll )
2003-03-05 21:28:34 +00:00
{
2022-10-24 18:39:33 +08:00
if ( actbId . dwCharacters [ ll ] ! = INVALIDSERIAL & & actbId . lpCharacters [ ll ] ! = nullptr )
2003-03-05 21:28:34 +00:00
{
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
// OK we keep this entry
2022-10-24 18:39:33 +08:00
actbScratch . dwCharacters [ kk ] = actbId . dwCharacters [ ll ] ;
actbScratch . lpCharacters [ kk ] = actbId . lpCharacters [ ll ] ;
2021-07-04 07:57:42 +08:00
kk + = 1 ;
2003-03-05 21:28:34 +00:00
}
}
2021-07-04 07:57:42 +08:00
2012-11-03 18:11:04 +00:00
// Fill the rest with standard empty values.
2021-07-04 07:57:42 +08:00
UI08 jj = 0 ;
2012-11-03 18:11:04 +00:00
for ( jj = kk ; jj < CHARACTERCOUNT ; + + jj )
{
2021-07-04 07:57:42 +08:00
actbScratch . dwCharacters [ jj ] = INVALIDSERIAL ;
actbScratch . lpCharacters [ jj ] = nullptr ;
2012-11-03 18:11:04 +00:00
}
2021-07-04 07:57:42 +08:00
2012-11-03 18:11:04 +00:00
// Now copy back out the info to the structures
for ( jj = 0 ; jj < CHARACTERCOUNT ; + + jj )
{
2022-10-24 18:39:33 +08:00
actbId . dwCharacters [ jj ] = actbName . dwCharacters [ jj ] = actbScratch . dwCharacters [ jj ] ;
actbId . lpCharacters [ jj ] = actbName . lpCharacters [ jj ] = actbScratch . lpCharacters [ jj ] ;
2012-11-03 18:11:04 +00:00
}
2022-10-24 18:39:33 +08:00
actbId . bChanged = actbName . bChanged = true ;
2021-07-04 07:57:42 +08:00
2003-01-20 16:14:57 +00:00
// Now we have to put the values back into the maps
try
{
2022-10-24 18:39:33 +08:00
I - > second = actbId ;
[[maybe_unused]] MAPUSERNAMEID_ITERATOR Q = m_mapUsernameIdMap . find ( actbId . wAccountIndex ) ;
2021-07-04 07:57:42 +08:00
Save ( false ) ;
2003-01-20 16:14:57 +00:00
}
2012-11-03 18:11:04 +00:00
catch ( . . . )
2003-01-20 16:14:57 +00:00
{
2021-07-04 07:57:42 +08:00
return CDR_BADREQUEST ;
2003-01-20 16:14:57 +00:00
}
2021-07-04 07:57:42 +08:00
return CDR_SUCCESS ;
2003-01-20 16:14:57 +00:00
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - cAccountClass::GetAccountByName()
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
//| Date - 12/19/2002 2:16:37 AM
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
//| Purpose - Search the map for an account but the username that was specified.
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
CAccountBlock_st & cAccountClass : : GetAccountByName ( std : : string sUsername )
2003-01-20 16:14:57 +00:00
{
// Ok now we need to get the map blocks for this account.
2022-10-24 18:39:33 +08:00
MAPUSERNAME_ITERATOR I = m_mapUsernameMap . find ( sUsername ) ;
2012-11-03 18:11:04 +00:00
if ( I ! = m_mapUsernameMap . end ( ) )
{
2022-10-24 18:39:33 +08:00
CAccountBlock_st & actbName = ( * I - > second ) ;
2012-11-03 18:11:04 +00:00
// Get the block from the ID map, so we can check that they are the same.
2022-10-24 18:39:33 +08:00
MAPUSERNAMEID_ITERATOR J = m_mapUsernameIdMap . find ( actbName . wAccountIndex ) ;
if ( J ! = m_mapUsernameIdMap . end ( ) )
2012-11-03 18:11:04 +00:00
{
2022-10-24 18:39:33 +08:00
CAccountBlock_st & actbId = J - > second ;
2012-11-03 18:11:04 +00:00
// Check to see that these both are equal where it counts.
2022-10-24 18:39:33 +08:00
if ( actbId . sUsername = = actbName . sUsername | | actbId . sPassword = = actbName . sPassword )
{
2012-11-03 18:11:04 +00:00
return actbName ;
2022-10-24 18:39:33 +08:00
}
2012-11-03 18:11:04 +00:00
}
2003-01-20 16:14:57 +00:00
}
2012-11-03 18:11:04 +00:00
return actbInvalid ;
2003-01-20 16:14:57 +00:00
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - cAccountClass::GetAccountByName()
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
//| Date - 12/19/2002 2:17:31 AM
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
//| Purpose - Search the map for an account but the username that was specified.
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
CAccountBlock_st & cAccountClass : : GetAccountById ( UI16 wAccountId )
2003-01-20 16:14:57 +00:00
{
// Ok now we need to get the map blocks for this account.
2022-10-24 18:39:33 +08:00
MAPUSERNAMEID_ITERATOR I = m_mapUsernameIdMap . find ( wAccountId ) ;
if ( I ! = m_mapUsernameIdMap . end ( ) )
2012-11-03 18:11:04 +00:00
{
2022-10-24 18:39:33 +08:00
CAccountBlock_st & actbId = I - > second ;
2012-11-03 18:11:04 +00:00
// Get the block from the ID map, so we can check that they are the same.
2022-10-24 18:39:33 +08:00
MAPUSERNAME_ITERATOR J = m_mapUsernameMap . find ( actbId . sUsername ) ;
2012-11-03 18:11:04 +00:00
if ( J ! = m_mapUsernameMap . end ( ) )
{
2022-10-24 18:39:33 +08:00
CAccountBlock_st & actbName = ( * J - > second ) ;
2012-11-03 18:11:04 +00:00
// Check to see that these both are equal where it counts.
2022-10-24 18:39:33 +08:00
if ( actbId . sUsername = = actbName . sUsername | | actbId . sPassword = = actbName . sPassword )
return actbId ;
2012-11-03 18:11:04 +00:00
}
2003-01-20 16:14:57 +00:00
}
2012-11-03 18:11:04 +00:00
return actbInvalid ;
2003-01-20 16:14:57 +00:00
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - cAccountClass::Save()
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
//| Date - 12/19/2002 2:45:39 AM
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
//| Purpose - Save the contents of the internal structures out to a flat
2012-11-03 18:11:04 +00:00
//| file where it can be loaded later, and archived for later
//| use should a crash occur and the userfile is damaged. At
//| this stage this function will only write out the accounts.adm
//| file, even though the access.adm will still eventually
//| be used for server sharing.
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
2022-11-14 19:24:29 -05:00
UI16 cAccountClass : : Save ( [[maybe_unused]] bool bForceLoad )
2003-01-20 16:14:57 +00:00
{
// Ok were not going to mess around. so we open truncate the file and write
2022-10-24 18:39:33 +08:00
std : : string sTemp ( m_sAccountsDirectory ) ;
if ( sTemp [ sTemp . length ( ) - 1 ] = = ' \\ ' | | sTemp [ sTemp . length ( ) - 1 ] = = ' / ' )
{
2003-01-20 16:14:57 +00:00
sTemp + = " accounts.adm " ;
2022-10-24 18:39:33 +08:00
}
2003-01-20 16:14:57 +00:00
else
2022-10-24 18:39:33 +08:00
{
2003-01-20 16:14:57 +00:00
sTemp + = " /accounts.adm " ;
2022-10-24 18:39:33 +08:00
}
sTemp = oldstrutil : : replaceSlash ( sTemp ) ;
2003-01-20 16:14:57 +00:00
// Ok we have the path, now open the file and start saving
2022-10-24 18:39:33 +08:00
std : : fstream fsAccountsAdm ( sTemp . c_str ( ) , std : : ios : : out | std : : ios : : trunc ) ;
if ( ! fsAccountsAdm . is_open ( ) )
2003-01-20 16:14:57 +00:00
return 0x0000 ;
2022-10-24 18:39:33 +08:00
2003-01-20 16:14:57 +00:00
// OK first we need to write the header.
2022-10-24 18:39:33 +08:00
WriteAccountsHeader ( fsAccountsAdm ) ;
2003-01-20 16:14:57 +00:00
// Now we need to iterate through each account block in the map, and save
2012-11-03 18:11:04 +00:00
MAPUSERNAMEID_ITERATOR CI ;
2022-10-24 18:39:33 +08:00
for ( CI = m_mapUsernameIdMap . begin ( ) ; CI ! = m_mapUsernameIdMap . end ( ) ; + + CI )
2003-01-20 16:14:57 +00:00
{
// Get a usable structure for this iterator
2022-10-24 18:39:33 +08:00
CAccountBlock_st & actbId = CI - > second ;
2003-01-20 16:14:57 +00:00
// Ok we are going to load up each username block from that map too for checking
2022-10-24 18:39:33 +08:00
MAPUSERNAME_ITERATOR JI = m_mapUsernameMap . find ( actbId . sUsername ) ;
CAccountBlock_st & actbName = ( * JI - > second ) ;
2003-01-20 16:14:57 +00:00
// Check to make sure at least that the username and passwords match
2022-10-24 18:39:33 +08:00
if ( actbId . sUsername ! = actbName . sUsername | | actbId . sPassword ! = actbName . sPassword )
2003-01-20 16:14:57 +00:00
{
// there was an error between blocks
2022-10-24 18:39:33 +08:00
Console . Error ( oldstrutil : : format ( " Save(): Mismatch %s - %s (Duplicate username in accounts file?) " , actbId . sUsername . c_str ( ) , actbName . sUsername . c_str ( ) ) ) ;
fsAccountsAdm . close ( ) ;
2003-01-20 16:14:57 +00:00
return 0xFFFF ;
}
// Ok write this block to the file
2022-10-24 18:39:33 +08:00
WriteAccountSection ( actbId , fsAccountsAdm ) ;
2003-03-07 04:17:42 +00:00
// Need to check to see if the path is valid.
2022-10-24 18:39:33 +08:00
std : : fstream fsTest ( actbId . sPath . c_str ( ) , std : : ios : : in ) ;
bool bPathExists = fsTest . is_open ( ) ;
2003-03-07 04:17:42 +00:00
fsTest . close ( ) ;
2003-03-07 04:11:24 +00:00
// Make sure that if there is no path that we make one
2022-10-24 18:39:33 +08:00
if ( ! actbId . sPath . length ( ) | | ! bPathExists )
2003-03-07 04:11:24 +00:00
{
2022-10-24 18:39:33 +08:00
std : : string sTempPath ( m_sAccountsDirectory ) ;
if ( sTempPath [ sTempPath . length ( ) - 1 ] = = ' \\ ' | | sTempPath [ sTempPath . length ( ) - 1 ] = = ' / ' )
2003-03-07 04:11:24 +00:00
{
2022-10-24 18:39:33 +08:00
auto szTempBuff = actbId . sUsername ; // oldstrutil::lower( actbId.sUsername );
2012-11-03 18:11:04 +00:00
sTempPath + = szTempBuff ;
sTempPath + = " / " ;
2022-03-04 07:35:46 -05:00
sTempPath = oldstrutil : : replaceSlash ( sTempPath ) ;
2022-10-24 18:39:33 +08:00
actbId . sPath = sTempPath ;
2003-03-07 04:11:24 +00:00
}
else
2012-11-03 18:11:04 +00:00
{
2022-10-24 18:39:33 +08:00
auto szTempBuff = actbId . sUsername ; // oldstrutil::lower( actbId.sUsername );
2012-11-03 18:11:04 +00:00
sTempPath + = " / " ;
sTempPath + = szTempBuff ;
sTempPath + = " / " ;
2022-03-04 07:35:46 -05:00
sTempPath = oldstrutil : : replaceSlash ( sTempPath ) ;
2022-10-24 18:39:33 +08:00
actbId . sPath = sTempPath ;
2003-03-07 04:11:24 +00:00
}
}
2003-03-07 04:17:42 +00:00
// Close the test path
2003-03-07 04:11:24 +00:00
// Ok now that we got here we need to make the directory, and create the username.uad file
2022-10-24 18:39:33 +08:00
if ( ! std : : filesystem : : exists ( std : : filesystem : : path ( actbId . sPath ) ) )
{
auto create_status = std : : filesystem : : create_directory ( std : : filesystem : : path ( actbId . sPath ) ) ;
if ( ! create_status )
{
Console . Error ( oldstrutil : : format ( " Save(): Couldn't create directory %s " , actbId . sPath . c_str ( ) ) ) ;
fsAccountsAdm < < " // !!! Couldn't save .uad file !!! " < < std : : endl ;
2012-11-03 18:11:04 +00:00
continue ;
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
2012-11-03 18:11:04 +00:00
}
2003-03-07 04:11:24 +00:00
}
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
2003-03-07 04:11:24 +00:00
// Ok now thats finished. We need to do one last thing. Create the username.uad file in the account directory
2022-10-24 18:39:33 +08:00
std : : string sUsernameUadPath ( actbId . sPath ) ;
if ( sUsernameUadPath [ sUsernameUadPath . length ( ) - 1 ] = = ' \\ ' | | sUsernameUadPath [ sUsernameUadPath . length ( ) - 1 ] = = ' / ' )
2003-03-07 04:11:24 +00:00
{
2022-10-24 18:39:33 +08:00
sUsernameUadPath + = actbId . sUsername ;
sUsernameUadPath + = " .uad " ;
2003-03-07 04:11:24 +00:00
}
else
{
2022-10-24 18:39:33 +08:00
sUsernameUadPath + = " / " ;
sUsernameUadPath + = actbId . sUsername ;
sUsernameUadPath + = " .uad " ;
2003-03-07 04:11:24 +00:00
}
// Fix the paths to make sure that all the characters are unified
2022-10-24 18:39:33 +08:00
sUsernameUadPath = oldstrutil : : replaceSlash ( sUsernameUadPath ) ;
2003-03-07 04:11:24 +00:00
// Open the file in APPEND to end mode.
2022-10-24 18:39:33 +08:00
std : : fstream fsAccountsUad ( sUsernameUadPath . c_str ( ) , std : : ios : : out | std : : ios : : trunc ) ;
if ( ! fsAccountsUad . is_open ( ) )
2003-03-07 04:11:24 +00:00
{
// Ok we were unable to open the file so this user will not be added.
2022-10-24 18:39:33 +08:00
Console . Error ( oldstrutil : : format ( " Save(): Couldn't open file %s " , sUsernameUadPath . c_str ( ) ) ) ;
fsAccountsAdm < < " // !!! Couldn't save .uad file !!! " < < std : : endl ;
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
continue ;
2003-01-20 16:14:57 +00:00
}
// Ok we have to write the new username.uad file in the directory
2022-10-24 18:39:33 +08:00
WriteUADHeader ( fsAccountsUad , actbId ) ;
2003-01-20 16:14:57 +00:00
// Ok write out the characters and the charcter names if we know them
2012-11-03 18:11:04 +00:00
for ( UI08 ii = 0 ; ii < CHARACTERCOUNT ; + + ii )
2003-01-20 16:14:57 +00:00
{
2022-10-24 18:39:33 +08:00
fsAccountsUad < < " CHARACTER- " < < ( ii + 1 ) < < " 0x " < < std : : hex
< < ( actbId . dwCharacters [ ii ] ! = INVALIDSERIAL ? actbId . dwCharacters [ ii ] : INVALIDSERIAL ) < < " [ "
< < ( char * ) ( actbId . lpCharacters [ ii ] ! = nullptr ? actbId . lpCharacters [ ii ] - > GetName ( ) . c_str ( ) : " INVALID " ) < < " ] \n " ;
2003-01-20 16:14:57 +00:00
}
// Close the files since we dont need them anymore
2022-10-24 18:39:33 +08:00
fsAccountsUad . close ( ) ;
2003-01-20 16:14:57 +00:00
}
// Ok were done looping so we can close the file and return the count of accounts
2022-10-24 18:39:33 +08:00
fsAccountsAdm . close ( ) ;
return static_cast < UI16 > ( m_mapUsernameIdMap . size ( ) ) ;
2003-01-20 16:14:57 +00:00
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - cAccountClass::ImportAccounts()
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
//| Date - 4/30/2003 2:32:13 PM
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
//| Purpose - Scan for a file with the name of "newaccounts.adm" and if
2012-11-03 18:11:04 +00:00
//| this file exists then parsed for the new accounts which
//| will be added to the internal account maps. If this file
//| does not exist then no action will take place and will
//| return 0. Otherwise this function will return the total
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
//| count of accounts that were added. Please note that the
2012-11-03 18:11:04 +00:00
//| file will be deleted after it is parsed, and duplicates
//| will not be allowed.
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
//|
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
//| NOTES - Format: user=username,password,flags,emailaddress
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
//|
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
//| Where:. Username, Password, Flags, and Email are all selfexplanitory.
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
//|
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
UI16 cAccountClass : : ImportAccounts ( void )
2012-11-03 18:11:04 +00:00
{
// Prepare to load in the newaccounts.adm file. This file if it exists will contain new accounts to be added to the server.
2022-10-24 18:39:33 +08:00
std : : string sImportAccounts ( m_sAccountsDirectory ) ;
sImportAccounts + = ( m_sAccountsDirectory [ m_sAccountsDirectory . length ( ) - 1 ] = = ' \\ ' | | m_sAccountsDirectory [ m_sAccountsDirectory . length ( ) - 1 ] = = ' / ' ) ? " newaccounts.adm " : " /newaccounts.adm " ;
sImportAccounts = oldstrutil : : replaceSlash ( sImportAccounts ) ;
2012-11-03 18:11:04 +00:00
// Check to see what version the current accounts.adm file is.
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
std : : string sLine ;
2012-11-03 18:11:04 +00:00
std : : fstream fsInputAccountsTest ( sImportAccounts . c_str ( ) , std : : ios : : in ) ;
if ( ! fsInputAccountsTest . is_open ( ) )
{
// we were unable to load any accounts
return 0x0000 ;
}
// Now that we have a file, we want to read it, and add these accounts to the system
std : : getline ( fsInputAccountsTest , sLine ) ;
2022-03-04 07:35:46 -05:00
sLine = oldstrutil : : trim ( oldstrutil : : removeTrailing ( sLine , " // " ) ) ;
2012-11-03 18:11:04 +00:00
UI16 wAccountCount = 0x0000 ;
UI16 wCurrentFlags = 0x0004 ;
while ( ! fsInputAccountsTest . eof ( ) & & ! fsInputAccountsTest . fail ( ) )
{
// Process each Line read in from the accounts.adm file. Handle Comments first
if ( sLine . empty ( ) | | sLine . length ( ) = = 0 )
{
std : : getline ( fsInputAccountsTest , sLine ) ;
2022-03-04 07:35:46 -05:00
sLine = oldstrutil : : trim ( oldstrutil : : removeTrailing ( sLine , " // " ) ) ;
2012-11-03 18:11:04 +00:00
continue ;
}
2022-03-04 07:35:46 -05:00
auto esecs = oldstrutil : : sections ( sLine , " = " ) ;
auto l = oldstrutil : : trim ( oldstrutil : : removeTrailing ( esecs [ 0 ] , " // " ) ) ;
auto r = oldstrutil : : trim ( oldstrutil : : removeTrailing ( esecs [ 1 ] , " // " ) ) ;
2012-11-03 18:11:04 +00:00
if ( l = = " USER " )
{
// OK we have an account to import, start parsing it.
std : : string user , pass ;
2022-03-04 07:35:46 -05:00
auto csecs = oldstrutil : : sections ( r , " , " ) ;
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
2022-03-04 07:35:46 -05:00
user = oldstrutil : : trim ( oldstrutil : : removeTrailing ( csecs [ 0 ] , " // " ) ) ;
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
if ( csecs . size ( ) > 1 )
{
2022-03-04 07:35:46 -05:00
pass = oldstrutil : : trim ( oldstrutil : : removeTrailing ( csecs [ 1 ] , " // " ) ) ;
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
}
2012-11-03 18:11:04 +00:00
if ( user . empty ( ) | | user . length ( ) = = 0 | | pass . empty ( ) | | pass . length ( ) = = 0 )
{
// error there are no NULLS allowed for usernames, passwords. So we move to the next.
// NOTE! This record will be dropped onces parsing is completed as file is deleted.
std : : getline ( fsInputAccountsTest , sLine ) ;
2022-03-04 07:35:46 -05:00
sLine = oldstrutil : : trim ( oldstrutil : : removeTrailing ( sLine , " // " ) ) ;
2012-11-03 18:11:04 +00:00
continue ;
}
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
std : : string flags ;
if ( csecs . size ( ) > 2 )
{
2022-03-04 07:35:46 -05:00
flags = oldstrutil : : trim ( oldstrutil : : removeTrailing ( csecs [ 2 ] , " // " ) ) ;
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
}
// Set flags to a default value. and in this case I believe that its 0x00000004
if ( flags . empty ( ) | | flags . length ( ) = = 0 )
{
2012-11-03 18:11:04 +00:00
wCurrentFlags = 0x0000 ;
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
}
2012-11-03 18:11:04 +00:00
else
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
{
2022-10-24 18:39:33 +08:00
wCurrentFlags = static_cast < UI16 > ( std : : stoul ( flags , nullptr , 0 ) ) ;
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
}
std : : string email ;
if ( csecs . size ( ) > 3 )
{
2022-03-04 07:35:46 -05:00
email = oldstrutil : : trim ( oldstrutil : : removeTrailing ( csecs [ 3 ] , " // " ) ) ;
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
}
2012-11-03 18:11:04 +00:00
if ( email . empty ( ) | | email . length ( ) = = 0 )
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
{
2012-11-03 18:11:04 +00:00
email = " N/A " ;
More string handling modernization, and a minor fix
Increased default timer for worldsaves from 5 to 10 minutes
Fixed an issue where the tile command could spawn items with incorrect ID because tempInt2 wasn't reset properly
Additional string handling modernization in cAccountClass.cpp, cHTMLSystem.cpp, CResponse.cpp, cServerData.cpp, cServerData.h, cServerDefinitions.cpp, cSocket.cpp, cSpawnRegion.cpp, cSpawnRegion.h, cWeather.cpp, Dictionary.cpp, effect.cpp and uox3.cpp (punt)
2021-04-26 18:26:39 +08:00
}
2012-11-03 18:11:04 +00:00
if ( AddAccount ( user , pass , email , wCurrentFlags ) = = 0x0000 )
{
// As requested we are going to stuff back accounts into their own file
2022-10-24 18:39:33 +08:00
std : : string sOutputBadAccounts ( m_sAccountsDirectory ) ;
sOutputBadAccounts + = ( m_sAccountsDirectory [ m_sAccountsDirectory . length ( ) - 1 ] = = ' \\ ' | | m_sAccountsDirectory [ m_sAccountsDirectory . length ( ) - 1 ] = = ' / ' ) ? " failed_accounts.log " : " /failed_accounts.log " ;
sOutputBadAccounts = oldstrutil : : replaceSlash ( sOutputBadAccounts ) ;
2012-11-03 18:11:04 +00:00
// Open the file and append this to the end
2022-10-24 18:39:33 +08:00
std : : fstream fsOutputBadAccounts ( sOutputBadAccounts . c_str ( ) , std : : ios : : app ) ;
2012-11-03 18:11:04 +00:00
if ( ! fsOutputBadAccounts . is_open ( ) )
{
// The bad accounts file wasn't writable or something so were going to skip it
std : : getline ( fsInputAccountsTest , sLine ) ;
2022-03-04 07:35:46 -05:00
sLine = oldstrutil : : trim ( oldstrutil : : removeTrailing ( sLine , " // " ) ) ;
2012-11-03 18:11:04 +00:00
continue ;
}
// Write the failed line to the file
fsOutputBadAccounts < < sLine < < std : : endl ;
fsOutputBadAccounts . close ( ) ;
// OK there was a problem entering this accounts into the system. Possibly a duplicate? or Other issues
Console < < " NOTICE: New account was not processed. Please see failed_accounts.log for details. " < < myendl ;
std : : getline ( fsInputAccountsTest , sLine ) ;
2022-03-04 07:35:46 -05:00
sLine = oldstrutil : : trim ( oldstrutil : : removeTrailing ( sLine , " // " ) ) ;
2012-11-03 18:11:04 +00:00
continue ;
}
wAccountCount + + ;
}
// Need to make sure we get the next line
std : : getline ( fsInputAccountsTest , sLine ) ;
2022-03-04 07:35:46 -05:00
sLine = oldstrutil : : trim ( oldstrutil : : removeTrailing ( sLine , " // " ) ) ;
2012-11-03 18:11:04 +00:00
}
// Make sure to close the file
fsInputAccountsTest . close ( ) ;
// No that we have this step completed, we need to empty the file, and write a header
std : : fstream fsWriteHeader ( sImportAccounts . c_str ( ) , std : : ios : : out ) ;
if ( ! fsWriteHeader . is_open ( ) )
{
// we were unable to load any accounts
return wAccountCount ;
}
// Write the header and close.
WriteImportHeader ( fsWriteHeader ) ;
fsWriteHeader . close ( ) ;
// Return total of accounts that were successfully added
return wAccountCount ;
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - cAccountClass::Begin()
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
//| Date - 1/14/2003 5:47:28 AM
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
//| Purpose - Returns the First iterator in a set. If there is no record
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
//| then END() will be returned. This function will set the
2012-11-03 18:11:04 +00:00
//| internal Iterator to the first record or will indicate
//| end().
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
MAPUSERNAMEID_ITERATOR & cAccountClass : : Begin ( void )
2003-01-20 16:14:57 +00:00
{
2022-10-24 18:39:33 +08:00
I = m_mapUsernameIdMap . begin ( ) ;
2003-01-20 16:14:57 +00:00
return I ;
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - cAccountClass::End()
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
//| Date - 1/14/2003 5:48:32 AM
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
//| Purpose - Returns the Last iterator in a set. This function forces
2012-11-03 18:11:04 +00:00
//| the internal iterator to one past the last record. It
//| will also return End() as a result.
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
MAPUSERNAMEID_ITERATOR & cAccountClass : : End ( void )
2003-01-20 16:14:57 +00:00
{
2022-10-24 18:39:33 +08:00
I = m_mapUsernameIdMap . end ( ) ;
2003-01-20 16:14:57 +00:00
return I ;
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - cAccountClass::Last()
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
//| Date - 1/14/2003 6:03:22 AM
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
//| Purpose - For those that need a means to get the last valid record
2012-11-03 18:11:04 +00:00
//| in the container, without having to process the Iterator
//| and back it up one record. By default the map will return
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
//| end() when there is no record to return for us.
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
//|
//| NOTE: This will update the current internal iterator to
2012-11-03 18:11:04 +00:00
//| the last record as well.
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
MAPUSERNAMEID_ITERATOR & cAccountClass : : Last ( void )
2003-01-20 16:14:57 +00:00
{
2022-10-24 18:39:33 +08:00
I = m_mapUsernameIdMap . end ( ) ;
2012-11-03 18:11:04 +00:00
- - I ;
2003-01-20 16:14:57 +00:00
return I ;
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - cAccountClass::operator++()
//| cAccountClass::operator--()
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
//| Date - 1/14/2003 5:33:13 AM
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
//| Purpose - Use this operators to control the internal iterator that
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
//| points into the UsernameID map. This will work only on
//| this map. It will be assumed that the UsernameMap will
//| be matching this exactally.
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
cAccountClass & cAccountClass : : operator + + ( )
2003-01-20 16:14:57 +00:00
{
// just increment I, the rest will be handled internally
I + + ;
2022-10-24 18:39:33 +08:00
return ( * this ) ;
2003-01-20 16:14:57 +00:00
}
//
2022-10-24 18:39:33 +08:00
cAccountClass & cAccountClass : : operator - - ( SI32 )
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
{
2003-01-20 16:14:57 +00:00
I - - ;
2022-10-24 18:39:33 +08:00
return ( * this ) ;
2003-01-20 16:14:57 +00:00
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - cAccountClass::AccountsHeader()
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
//| Date - 12/19/2002 2:56:36 AM
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
//| Purpose - Writes the Accounts.Adm header to the specified output
2012-11-03 18:11:04 +00:00
//| stream.
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
void cAccountClass : : WriteAccountsHeader ( std : : fstream & fsOut )
2003-01-20 16:14:57 +00:00
{
2022-10-24 18:39:33 +08:00
fsOut < < " //AV3.0 " < < " -UV " < < CVersionClass : : GetVersion ( ) < < " -BD " < < CVersionClass : : GetBuild ( ) < < " -DS " < < time ( nullptr ) < < " -ED " < < CVersionClass : : GetRealBuild ( ) < < std : : endl ;
2003-01-20 16:14:57 +00:00
fsOut < < " //------------------------------------------------------------------------------ " < < std : : endl ;
fsOut < < " //accounts.adm[TEXT] : UOX3 uses this file for shared accounts access between servers " < < std : : endl ;
fsOut < < " // " < < std : : endl ;
fsOut < < " // Format: " < < std : : endl ;
fsOut < < " // SECTION ACCOUNT 0 " < < std : : endl ;
fsOut < < " // { " < < std : : endl ;
fsOut < < " // NAME username " < < std : : endl ;
fsOut < < " // PASS password " < < std : : endl ;
fsOut < < " // FLAGS 0x0000 " < < std : : endl ;
fsOut < < " // PATH c:/uox3/Accounts/path2userdata/ " < < std : : endl ;
fsOut < < " // TIMEBAN 0 " < < std : : endl ;
2022-01-10 07:33:51 +08:00
fsOut < < " // FIRSTLOGIN 0 " < < std : : endl ;
UOX3 0.99.6-RC6
Removed arbitrary and hidden restrictions on refreshing list of online players shown with 'wholist command
Fixed an issue where player ghosts that get teleported would not see themselves get updated to new location
Fixed a server crash from clients disconnecting while running server in debug mode
Improved how container updates are sent to players; now only sends to clients that have actually opened the container, and who are still within range
Added more information about UO data files being loaded during server startup
Enhanced the GM 'add menu to allow clicking directly on images of items/npcs to add them, and adjusted size of menus to accommodate this
Fixed an issue with fleeing NPCs that could cause them to attempt to flee across time and space, regardless of distance to target/attacker in combat
Added NPC AI that runs away from players if they get too close (even outside combat). Applied to hind, rabbits, squirrels, ferrets and various birds by default:
AI_ANIMAL_SCARED (aitype 12)
Fixed issues with NPCs fleeing forever, or getting stuck in flee/don't flee loop, by introducing max fleeing distance (50 tiles) and cooldown (30 sec) on fleeing
Updated onNameRequest JS Event to include third parameter with origin of name request, so script responses can be tailored appropriately:
onNameRequest( myObj, requestedBy, requestSource )
Potential values for requestSource:
0 - Speech/System Messages
1 - Guild Menus
2 - Stat Window (self)
3 - Stat Window (other)
4 - Tooltip
5 - Paperdoll Journal
6 - Paperdoll
7 - Single Click / All-Names
8 - System
9 - Secure Trade Window
Added Adaptive Performance System (APS) that dynamically adjust how often NPC AI/movement is checked based on overall shard performance. If performance drops below defined threshold, UOX3 gradually slows down checks for NPC AI/movement to prioritize player movement/speech/command responsiveness. If performance climbs back up above threshold, slowdowns are gradually removed. The following UOX.INI options have been added under [system] category to support this system:
APSPERFTHRESHOLD=50 // Performance threshold (measured in simulation cycles/sec) below which the APS kicks in
APSINTERVAL=100 // How often (in milliseconds) the APS checks performance and makes adjustments (if needed) to balance out shard performance
APSDELAYSTEP=50 // How much the delay timer is modified by (in milliseconds) each time APS makes adjustments
APSDELAYMAXCAP=2000 // Max amount of of delay APS can introduce for NPC AI/movement handling when attempting to restore shard performance
Added new JS Methods for Region objects:
.GetOrePrefs( oreType ) // Get ore preference data for ore type found in town region. Returned as an array containing the following data:
orePrefData -> [
oreName, // name of ore
color, // color of ore
minskill, // min skill to mine ore
ingotName, // name of ingot created from ore
makemenu, // makemenu entry for crafting something from ingot
oreChance, // default global chance of finding this ore type
scriptID // script attached to mined ore
],
orePrefChance // Chance of finding this ore type in given town region
.GetOreChance() // Get base chance of finding any ore in town region
Moved Mining skill plus gravedigging feature from hard code to scripts (js/skill/mining.js) to make it easier to maintain and/or customize, and removed hard coded variants
Gravedigging now relies on the ore resource system behind the scenes to restrict how often graves in a given area can be dug up
Fixed some incorrect references to .worldNumber Character property in misc scripts (should be .worldnumber)
Made some "hard-scripted" system messages in misc scripts use dictionary system instead
Added spawn region for banker NPCs in Serpent's Hold (dfndata/spawn/felucca/spawn_town_serpents_hold.dfn, dfndata/spawn/trammel/spawn_town_serpents_hold.dfn)
Fixed region definition of Ocllo to actually cover the entire town (dfndata/regions/regions.dfn)
Added numerous additional locations accessible with 'goplace # command, for key locations in Ilshenar, Malas, Tokuno Islands and Ter Mur (dfndata/location/location.dfn)
Revised travel-menu portion of GM menu (shortcut: 'travel) to include more travel options based on new locations (dfndata/items/travelmenu.dfn and travelmenu.bulk.dfn)
Fixed an issue where NPCs could attempt to attack targets in other worlds/instances
Added new JS Event that triggers for characters who are about to deal damage in combat. Complimentary to onDamage, which triggers for chars receiving damage:
onDamageDeal( dmgDealer, dmgReceiver, damageValue, damageType )
Added new JS Event that can trigger in global script upon creation of new player chars. Note that this will trigger in place of onCreateDFN event for player characters:
onCreatePlayer( pChar )
Added new JS Event that triggers for characters selecting a target with a spell. Complimentary to onSpellTarget, which triggers for targets selected with a spell:
onSpellTargetSelect( caster, target, spellNum )
Updated onCombatStart and onCombatEnd JS Events to also trigger for the other party in combat
Updated onPickup JS Event to include a third parameter - the potential container item was picked up from. Event now also triggers event in scripts attached to said containers:
onPickup( iPickedUp, pChar, iCont )
Added tracking of total playtime per individual character, and per account across all characters, and exposed these properties to JS engine:
.totalPlayTime // Account property, total playtime across all chars
.playTime // Character property, total playtime on given character only
Added new player-accessible command ('playtime) to spit out the playtime of current character/account as a whole (js/commands/playtime.js)
Implemented first version of Young Player System:
Replaced the UNUSED9 account flag with YOUNG, to be used by Young/New Player System
Added new JS Account property that gets/sets whether player account is considered Young:
.isYoung
Added new Char timers:
TIMER_YOUNGHEAL // Restricts how often Young players are healed by NPC healers
TIMER_YOUNGMESSAGE // Restricts how often Young players are warned about dangerous looking monsters in overworld
Updated GM commands 'get and 'set to get/set .isYoung property of player's account (js/commands/targeting/get.js and set.js)
Added new UOX.INI setting to enable/disable Young Player System (enabled by default):
YOUNGPLAYERSYSTEM=1
If Young Player System is enabled, all newly created player accounts are automatically marked with Young flag
Added new script to handle various restrictions and functions related to Young characters (js/player/young_player.js):
Young characters will have [Young] displayed over their head
Young characters will have their Young status checked and verified on every login + every stat/skill gain, to revoke the Young status if any of the following is true:
Account has a total playtime of more than 40 hours
Any character has more than 350 total (base) skill points
Any character has more than 70 skill points in a single skill
Any character has more than 150 total stat points
Any character has more than 80 stat points in a single stat
Young characters can renounce their Young status manually by saying the words "I renounce my young player status"
Young characters get two additional items upon creation:
a new player ticket (can be combined with any other players new player ticket for both players to get a reward)
a sextant (shows Young players directions to nearest moongate/bank regardless of where they are, as long as outdoors)
Young characters cannot target other player characters with hostile spells or skills
Young characters cannot be the target of other player characters' hostile spells or skills
Young characters can only cast beneficial spells upon themselves or other Young characters
Young characters can only be the target of beneficial spells from other Young players
Young players (and their pets/followers) cannot attack or harm any other players (or their pets/followers), nor themselves be attacked or harmed by any other players (or their pets/followers), whether from combat, spells, skills or items
Young players don't lose any of their items on death, and are teleported to the nearest healer upon death with all their items intact
Young players receive a warning upon entering dungeons that monsters there will be hostile
Updated global script (js/server/global.js) to:
Check/Verify Young status of players upon login
Attach young player script on login/creation for players on Young accounts
Give specific items to Young players upon creation
Added new script (js/item/corpse.js) that is assigned to all freshly created corpses. This script handles restrictions related to Young players interactions with corpses, and the interactions of other players with corpses of Young players
Updated JS Method .Carve() to return true/false depending on whether carving a corpse was successful
Updated Healer AI in code to heal nearby injured Young players
Updated Evil AI and Evil Caster AI in code to avoid selecting Young players as targets in combat outside of dungeons
Added a new section to UOX.INI - [young player starting locations] - that can be used to define starting locations for Young players. If only one such location is provided, all players start there. Otherwise, it matches the same starting location setup as the regular one - with one entry per town in Britannia.
Restricted transferring and/or friending of pets (code) and hirelings (hirelings.js) between Young and non-Young players
Restricted Young players from recalling or gating to Felucca facet
Young players can instantly logout from anywhere, at any time
2023-07-01 20:02:40 +08:00
fsOut < < " // TOTALPLAYTIME 0 " < < std : : endl ;
2012-11-03 18:11:04 +00:00
fsOut < < " // LASTIP 127.0.0.1 " < < std : : endl ;
2003-01-20 16:14:57 +00:00
fsOut < < " // CONTACT NONE " < < std : : endl ;
fsOut < < " // CHARACTER-1 0xffffffff " < < std : : endl ;
fsOut < < " // CHARACTER-2 0xffffffff " < < std : : endl ;
fsOut < < " // CHARACTER-3 0xffffffff " < < std : : endl ;
fsOut < < " // CHARACTER-4 0xffffffff " < < std : : endl ;
fsOut < < " // CHARACTER-5 0xffffffff " < < std : : endl ;
2012-11-03 18:11:04 +00:00
fsOut < < " // CHARACTER-6 0xffffffff " < < std : : endl ;
2021-04-13 22:27:24 +08:00
fsOut < < " // CHARACTER-7 0xffffffff " < < std : : endl ;
2003-01-20 16:14:57 +00:00
fsOut < < " // } " < < std : : endl ;
fsOut < < " // " < < std : : endl ;
fsOut < < " // FLAGS: " < < std : : endl ;
2012-11-03 18:11:04 +00:00
fsOut < < " // Bit: 0x0001) Banned 0x0002) Suspended 0x0004) Public 0x0008) Currently Logged In " < < std : : endl ;
fsOut < < " // 0x0010) Char-1 Blocked 0x0020) Char-2 Blocked 0x0040) Char-3 Blocked 0x0080) Char-4 Blocked " < < std : : endl ;
UOX3 0.99.6-RC6
Removed arbitrary and hidden restrictions on refreshing list of online players shown with 'wholist command
Fixed an issue where player ghosts that get teleported would not see themselves get updated to new location
Fixed a server crash from clients disconnecting while running server in debug mode
Improved how container updates are sent to players; now only sends to clients that have actually opened the container, and who are still within range
Added more information about UO data files being loaded during server startup
Enhanced the GM 'add menu to allow clicking directly on images of items/npcs to add them, and adjusted size of menus to accommodate this
Fixed an issue with fleeing NPCs that could cause them to attempt to flee across time and space, regardless of distance to target/attacker in combat
Added NPC AI that runs away from players if they get too close (even outside combat). Applied to hind, rabbits, squirrels, ferrets and various birds by default:
AI_ANIMAL_SCARED (aitype 12)
Fixed issues with NPCs fleeing forever, or getting stuck in flee/don't flee loop, by introducing max fleeing distance (50 tiles) and cooldown (30 sec) on fleeing
Updated onNameRequest JS Event to include third parameter with origin of name request, so script responses can be tailored appropriately:
onNameRequest( myObj, requestedBy, requestSource )
Potential values for requestSource:
0 - Speech/System Messages
1 - Guild Menus
2 - Stat Window (self)
3 - Stat Window (other)
4 - Tooltip
5 - Paperdoll Journal
6 - Paperdoll
7 - Single Click / All-Names
8 - System
9 - Secure Trade Window
Added Adaptive Performance System (APS) that dynamically adjust how often NPC AI/movement is checked based on overall shard performance. If performance drops below defined threshold, UOX3 gradually slows down checks for NPC AI/movement to prioritize player movement/speech/command responsiveness. If performance climbs back up above threshold, slowdowns are gradually removed. The following UOX.INI options have been added under [system] category to support this system:
APSPERFTHRESHOLD=50 // Performance threshold (measured in simulation cycles/sec) below which the APS kicks in
APSINTERVAL=100 // How often (in milliseconds) the APS checks performance and makes adjustments (if needed) to balance out shard performance
APSDELAYSTEP=50 // How much the delay timer is modified by (in milliseconds) each time APS makes adjustments
APSDELAYMAXCAP=2000 // Max amount of of delay APS can introduce for NPC AI/movement handling when attempting to restore shard performance
Added new JS Methods for Region objects:
.GetOrePrefs( oreType ) // Get ore preference data for ore type found in town region. Returned as an array containing the following data:
orePrefData -> [
oreName, // name of ore
color, // color of ore
minskill, // min skill to mine ore
ingotName, // name of ingot created from ore
makemenu, // makemenu entry for crafting something from ingot
oreChance, // default global chance of finding this ore type
scriptID // script attached to mined ore
],
orePrefChance // Chance of finding this ore type in given town region
.GetOreChance() // Get base chance of finding any ore in town region
Moved Mining skill plus gravedigging feature from hard code to scripts (js/skill/mining.js) to make it easier to maintain and/or customize, and removed hard coded variants
Gravedigging now relies on the ore resource system behind the scenes to restrict how often graves in a given area can be dug up
Fixed some incorrect references to .worldNumber Character property in misc scripts (should be .worldnumber)
Made some "hard-scripted" system messages in misc scripts use dictionary system instead
Added spawn region for banker NPCs in Serpent's Hold (dfndata/spawn/felucca/spawn_town_serpents_hold.dfn, dfndata/spawn/trammel/spawn_town_serpents_hold.dfn)
Fixed region definition of Ocllo to actually cover the entire town (dfndata/regions/regions.dfn)
Added numerous additional locations accessible with 'goplace # command, for key locations in Ilshenar, Malas, Tokuno Islands and Ter Mur (dfndata/location/location.dfn)
Revised travel-menu portion of GM menu (shortcut: 'travel) to include more travel options based on new locations (dfndata/items/travelmenu.dfn and travelmenu.bulk.dfn)
Fixed an issue where NPCs could attempt to attack targets in other worlds/instances
Added new JS Event that triggers for characters who are about to deal damage in combat. Complimentary to onDamage, which triggers for chars receiving damage:
onDamageDeal( dmgDealer, dmgReceiver, damageValue, damageType )
Added new JS Event that can trigger in global script upon creation of new player chars. Note that this will trigger in place of onCreateDFN event for player characters:
onCreatePlayer( pChar )
Added new JS Event that triggers for characters selecting a target with a spell. Complimentary to onSpellTarget, which triggers for targets selected with a spell:
onSpellTargetSelect( caster, target, spellNum )
Updated onCombatStart and onCombatEnd JS Events to also trigger for the other party in combat
Updated onPickup JS Event to include a third parameter - the potential container item was picked up from. Event now also triggers event in scripts attached to said containers:
onPickup( iPickedUp, pChar, iCont )
Added tracking of total playtime per individual character, and per account across all characters, and exposed these properties to JS engine:
.totalPlayTime // Account property, total playtime across all chars
.playTime // Character property, total playtime on given character only
Added new player-accessible command ('playtime) to spit out the playtime of current character/account as a whole (js/commands/playtime.js)
Implemented first version of Young Player System:
Replaced the UNUSED9 account flag with YOUNG, to be used by Young/New Player System
Added new JS Account property that gets/sets whether player account is considered Young:
.isYoung
Added new Char timers:
TIMER_YOUNGHEAL // Restricts how often Young players are healed by NPC healers
TIMER_YOUNGMESSAGE // Restricts how often Young players are warned about dangerous looking monsters in overworld
Updated GM commands 'get and 'set to get/set .isYoung property of player's account (js/commands/targeting/get.js and set.js)
Added new UOX.INI setting to enable/disable Young Player System (enabled by default):
YOUNGPLAYERSYSTEM=1
If Young Player System is enabled, all newly created player accounts are automatically marked with Young flag
Added new script to handle various restrictions and functions related to Young characters (js/player/young_player.js):
Young characters will have [Young] displayed over their head
Young characters will have their Young status checked and verified on every login + every stat/skill gain, to revoke the Young status if any of the following is true:
Account has a total playtime of more than 40 hours
Any character has more than 350 total (base) skill points
Any character has more than 70 skill points in a single skill
Any character has more than 150 total stat points
Any character has more than 80 stat points in a single stat
Young characters can renounce their Young status manually by saying the words "I renounce my young player status"
Young characters get two additional items upon creation:
a new player ticket (can be combined with any other players new player ticket for both players to get a reward)
a sextant (shows Young players directions to nearest moongate/bank regardless of where they are, as long as outdoors)
Young characters cannot target other player characters with hostile spells or skills
Young characters cannot be the target of other player characters' hostile spells or skills
Young characters can only cast beneficial spells upon themselves or other Young characters
Young characters can only be the target of beneficial spells from other Young players
Young players (and their pets/followers) cannot attack or harm any other players (or their pets/followers), nor themselves be attacked or harmed by any other players (or their pets/followers), whether from combat, spells, skills or items
Young players don't lose any of their items on death, and are teleported to the nearest healer upon death with all their items intact
Young players receive a warning upon entering dungeons that monsters there will be hostile
Updated global script (js/server/global.js) to:
Check/Verify Young status of players upon login
Attach young player script on login/creation for players on Young accounts
Give specific items to Young players upon creation
Added new script (js/item/corpse.js) that is assigned to all freshly created corpses. This script handles restrictions related to Young players interactions with corpses, and the interactions of other players with corpses of Young players
Updated JS Method .Carve() to return true/false depending on whether carving a corpse was successful
Updated Healer AI in code to heal nearby injured Young players
Updated Evil AI and Evil Caster AI in code to avoid selecting Young players as targets in combat outside of dungeons
Added a new section to UOX.INI - [young player starting locations] - that can be used to define starting locations for Young players. If only one such location is provided, all players start there. Otherwise, it matches the same starting location setup as the regular one - with one entry per town in Britannia.
Restricted transferring and/or friending of pets (code) and hirelings (hirelings.js) between Young and non-Young players
Restricted Young players from recalling or gating to Felucca facet
Young players can instantly logout from anywhere, at any time
2023-07-01 20:02:40 +08:00
fsOut < < " // 0x0100) Char-5 Blocked 0x0200) Char-6 Blocked 0x0400) Char-7 Blocked 0x0800) Young " < < std : : endl ;
2012-11-03 18:11:04 +00:00
fsOut < < " // 0x1000) Unused 0x2000) Seer 0x4000) Counselor 0x8000) GM Account " < < std : : endl ;
2003-01-20 16:14:57 +00:00
fsOut < < " // " < < std : : endl ;
fsOut < < " // TIMEBAN: " < < std : : endl ;
fsOut < < " // This would be the end date of a timed ban. " < < std : : endl ;
fsOut < < " // " < < std : : endl ;
2022-01-10 07:33:51 +08:00
fsOut < < " // FIRSTLOGIN: " < < std : : endl ;
fsOut < < " // This would be timestamp of the account's first login. " < < std : : endl ;
fsOut < < " // " < < std : : endl ;
UOX3 0.99.6-RC6
Removed arbitrary and hidden restrictions on refreshing list of online players shown with 'wholist command
Fixed an issue where player ghosts that get teleported would not see themselves get updated to new location
Fixed a server crash from clients disconnecting while running server in debug mode
Improved how container updates are sent to players; now only sends to clients that have actually opened the container, and who are still within range
Added more information about UO data files being loaded during server startup
Enhanced the GM 'add menu to allow clicking directly on images of items/npcs to add them, and adjusted size of menus to accommodate this
Fixed an issue with fleeing NPCs that could cause them to attempt to flee across time and space, regardless of distance to target/attacker in combat
Added NPC AI that runs away from players if they get too close (even outside combat). Applied to hind, rabbits, squirrels, ferrets and various birds by default:
AI_ANIMAL_SCARED (aitype 12)
Fixed issues with NPCs fleeing forever, or getting stuck in flee/don't flee loop, by introducing max fleeing distance (50 tiles) and cooldown (30 sec) on fleeing
Updated onNameRequest JS Event to include third parameter with origin of name request, so script responses can be tailored appropriately:
onNameRequest( myObj, requestedBy, requestSource )
Potential values for requestSource:
0 - Speech/System Messages
1 - Guild Menus
2 - Stat Window (self)
3 - Stat Window (other)
4 - Tooltip
5 - Paperdoll Journal
6 - Paperdoll
7 - Single Click / All-Names
8 - System
9 - Secure Trade Window
Added Adaptive Performance System (APS) that dynamically adjust how often NPC AI/movement is checked based on overall shard performance. If performance drops below defined threshold, UOX3 gradually slows down checks for NPC AI/movement to prioritize player movement/speech/command responsiveness. If performance climbs back up above threshold, slowdowns are gradually removed. The following UOX.INI options have been added under [system] category to support this system:
APSPERFTHRESHOLD=50 // Performance threshold (measured in simulation cycles/sec) below which the APS kicks in
APSINTERVAL=100 // How often (in milliseconds) the APS checks performance and makes adjustments (if needed) to balance out shard performance
APSDELAYSTEP=50 // How much the delay timer is modified by (in milliseconds) each time APS makes adjustments
APSDELAYMAXCAP=2000 // Max amount of of delay APS can introduce for NPC AI/movement handling when attempting to restore shard performance
Added new JS Methods for Region objects:
.GetOrePrefs( oreType ) // Get ore preference data for ore type found in town region. Returned as an array containing the following data:
orePrefData -> [
oreName, // name of ore
color, // color of ore
minskill, // min skill to mine ore
ingotName, // name of ingot created from ore
makemenu, // makemenu entry for crafting something from ingot
oreChance, // default global chance of finding this ore type
scriptID // script attached to mined ore
],
orePrefChance // Chance of finding this ore type in given town region
.GetOreChance() // Get base chance of finding any ore in town region
Moved Mining skill plus gravedigging feature from hard code to scripts (js/skill/mining.js) to make it easier to maintain and/or customize, and removed hard coded variants
Gravedigging now relies on the ore resource system behind the scenes to restrict how often graves in a given area can be dug up
Fixed some incorrect references to .worldNumber Character property in misc scripts (should be .worldnumber)
Made some "hard-scripted" system messages in misc scripts use dictionary system instead
Added spawn region for banker NPCs in Serpent's Hold (dfndata/spawn/felucca/spawn_town_serpents_hold.dfn, dfndata/spawn/trammel/spawn_town_serpents_hold.dfn)
Fixed region definition of Ocllo to actually cover the entire town (dfndata/regions/regions.dfn)
Added numerous additional locations accessible with 'goplace # command, for key locations in Ilshenar, Malas, Tokuno Islands and Ter Mur (dfndata/location/location.dfn)
Revised travel-menu portion of GM menu (shortcut: 'travel) to include more travel options based on new locations (dfndata/items/travelmenu.dfn and travelmenu.bulk.dfn)
Fixed an issue where NPCs could attempt to attack targets in other worlds/instances
Added new JS Event that triggers for characters who are about to deal damage in combat. Complimentary to onDamage, which triggers for chars receiving damage:
onDamageDeal( dmgDealer, dmgReceiver, damageValue, damageType )
Added new JS Event that can trigger in global script upon creation of new player chars. Note that this will trigger in place of onCreateDFN event for player characters:
onCreatePlayer( pChar )
Added new JS Event that triggers for characters selecting a target with a spell. Complimentary to onSpellTarget, which triggers for targets selected with a spell:
onSpellTargetSelect( caster, target, spellNum )
Updated onCombatStart and onCombatEnd JS Events to also trigger for the other party in combat
Updated onPickup JS Event to include a third parameter - the potential container item was picked up from. Event now also triggers event in scripts attached to said containers:
onPickup( iPickedUp, pChar, iCont )
Added tracking of total playtime per individual character, and per account across all characters, and exposed these properties to JS engine:
.totalPlayTime // Account property, total playtime across all chars
.playTime // Character property, total playtime on given character only
Added new player-accessible command ('playtime) to spit out the playtime of current character/account as a whole (js/commands/playtime.js)
Implemented first version of Young Player System:
Replaced the UNUSED9 account flag with YOUNG, to be used by Young/New Player System
Added new JS Account property that gets/sets whether player account is considered Young:
.isYoung
Added new Char timers:
TIMER_YOUNGHEAL // Restricts how often Young players are healed by NPC healers
TIMER_YOUNGMESSAGE // Restricts how often Young players are warned about dangerous looking monsters in overworld
Updated GM commands 'get and 'set to get/set .isYoung property of player's account (js/commands/targeting/get.js and set.js)
Added new UOX.INI setting to enable/disable Young Player System (enabled by default):
YOUNGPLAYERSYSTEM=1
If Young Player System is enabled, all newly created player accounts are automatically marked with Young flag
Added new script to handle various restrictions and functions related to Young characters (js/player/young_player.js):
Young characters will have [Young] displayed over their head
Young characters will have their Young status checked and verified on every login + every stat/skill gain, to revoke the Young status if any of the following is true:
Account has a total playtime of more than 40 hours
Any character has more than 350 total (base) skill points
Any character has more than 70 skill points in a single skill
Any character has more than 150 total stat points
Any character has more than 80 stat points in a single stat
Young characters can renounce their Young status manually by saying the words "I renounce my young player status"
Young characters get two additional items upon creation:
a new player ticket (can be combined with any other players new player ticket for both players to get a reward)
a sextant (shows Young players directions to nearest moongate/bank regardless of where they are, as long as outdoors)
Young characters cannot target other player characters with hostile spells or skills
Young characters cannot be the target of other player characters' hostile spells or skills
Young characters can only cast beneficial spells upon themselves or other Young characters
Young characters can only be the target of beneficial spells from other Young players
Young players (and their pets/followers) cannot attack or harm any other players (or their pets/followers), nor themselves be attacked or harmed by any other players (or their pets/followers), whether from combat, spells, skills or items
Young players don't lose any of their items on death, and are teleported to the nearest healer upon death with all their items intact
Young players receive a warning upon entering dungeons that monsters there will be hostile
Updated global script (js/server/global.js) to:
Check/Verify Young status of players upon login
Attach young player script on login/creation for players on Young accounts
Give specific items to Young players upon creation
Added new script (js/item/corpse.js) that is assigned to all freshly created corpses. This script handles restrictions related to Young players interactions with corpses, and the interactions of other players with corpses of Young players
Updated JS Method .Carve() to return true/false depending on whether carving a corpse was successful
Updated Healer AI in code to heal nearby injured Young players
Updated Evil AI and Evil Caster AI in code to avoid selecting Young players as targets in combat outside of dungeons
Added a new section to UOX.INI - [young player starting locations] - that can be used to define starting locations for Young players. If only one such location is provided, all players start there. Otherwise, it matches the same starting location setup as the regular one - with one entry per town in Britannia.
Restricted transferring and/or friending of pets (code) and hirelings (hirelings.js) between Young and non-Young players
Restricted Young players from recalling or gating to Felucca facet
Young players can instantly logout from anywhere, at any time
2023-07-01 20:02:40 +08:00
fsOut < < " // TOTALPLAYTIME: " < < std : : endl ;
fsOut < < " // This would be total playtime on account in minutes across all characters, since first login. " < < std : : endl ;
fsOut < < " // " < < std : : endl ;
2003-01-20 16:14:57 +00:00
fsOut < < " // CONTACT: " < < std : : endl ;
fsOut < < " // Usually this is the email address, but can be used as a comment or ICQ " < < std : : endl ;
2012-11-03 18:11:04 +00:00
fsOut < < " // " < < std : : endl ;
fsOut < < " // LASTIP: " < < std : : endl ;
fsOut < < " // The last IP this account was used from. " < < std : : endl ;
2003-01-20 16:14:57 +00:00
fsOut < < " //------------------------------------------------------------------------------ " < < std : : endl ;
}
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
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - cAccountClass::WriteAccessHeader()
//o------------------------------------------------------------------------------------------------o
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
//| Purpose - Writes the Access.Adm header to the specified output stream.
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
void cAccountClass : : WriteAccessHeader ( std : : fstream & fsOut )
2003-01-20 16:14:57 +00:00
{
2022-10-24 18:39:33 +08:00
fsOut < < " //SA3.0 " < < " -UV " < < CVersionClass : : GetVersion ( ) < < " -BD " < < CVersionClass : : GetBuild ( ) < < " -DS " < < time ( nullptr ) < < " -ED " < < CVersionClass : : GetRealBuild ( ) < < std : : endl ;
2003-01-20 16:14:57 +00:00
fsOut < < " //------------------------------------------------------------------------------ " < < std : : endl ;
fsOut < < " //access.adm[TEXT] : UOX3 uses this file for shared accounts access between servers " < < std : : endl ;
fsOut < < " // " < < std : : endl ;
fsOut < < " // Format: " < < std : : endl ;
fsOut < < " // SECTION ACCESS 0 " < < std : : endl ;
fsOut < < " // { " < < std : : endl ;
fsOut < < " // NAME username " < < std : : endl ;
fsOut < < " // PASS password " < < std : : endl ;
fsOut < < " // PATH c:/uox3/Accounts/path2userdata/ " < < std : : endl ;
fsOut < < " // FLAGS 0x0000 " < < std : : endl ;
2012-11-03 18:11:04 +00:00
fsOut < < " // CONTACT NONE " < < std : : endl ;
2003-01-20 16:14:57 +00:00
fsOut < < " // } " < < std : : endl ;
fsOut < < " // " < < std : : endl ;
fsOut < < " // FLAGS: " < < std : : endl ;
2012-11-03 18:11:04 +00:00
fsOut < < " // Bit: 0x0001) Banned 0x0002) Suspended 0x0004) Public 0x0008) Currently Logged In " < < std : : endl ;
fsOut < < " // 0x0010) Char-1 Blocked 0x0020) Char-2 Blocked 0x0040) Char-3 Blocked 0x0080) Char-4 Blocked " < < std : : endl ;
UOX3 0.99.6-RC6
Removed arbitrary and hidden restrictions on refreshing list of online players shown with 'wholist command
Fixed an issue where player ghosts that get teleported would not see themselves get updated to new location
Fixed a server crash from clients disconnecting while running server in debug mode
Improved how container updates are sent to players; now only sends to clients that have actually opened the container, and who are still within range
Added more information about UO data files being loaded during server startup
Enhanced the GM 'add menu to allow clicking directly on images of items/npcs to add them, and adjusted size of menus to accommodate this
Fixed an issue with fleeing NPCs that could cause them to attempt to flee across time and space, regardless of distance to target/attacker in combat
Added NPC AI that runs away from players if they get too close (even outside combat). Applied to hind, rabbits, squirrels, ferrets and various birds by default:
AI_ANIMAL_SCARED (aitype 12)
Fixed issues with NPCs fleeing forever, or getting stuck in flee/don't flee loop, by introducing max fleeing distance (50 tiles) and cooldown (30 sec) on fleeing
Updated onNameRequest JS Event to include third parameter with origin of name request, so script responses can be tailored appropriately:
onNameRequest( myObj, requestedBy, requestSource )
Potential values for requestSource:
0 - Speech/System Messages
1 - Guild Menus
2 - Stat Window (self)
3 - Stat Window (other)
4 - Tooltip
5 - Paperdoll Journal
6 - Paperdoll
7 - Single Click / All-Names
8 - System
9 - Secure Trade Window
Added Adaptive Performance System (APS) that dynamically adjust how often NPC AI/movement is checked based on overall shard performance. If performance drops below defined threshold, UOX3 gradually slows down checks for NPC AI/movement to prioritize player movement/speech/command responsiveness. If performance climbs back up above threshold, slowdowns are gradually removed. The following UOX.INI options have been added under [system] category to support this system:
APSPERFTHRESHOLD=50 // Performance threshold (measured in simulation cycles/sec) below which the APS kicks in
APSINTERVAL=100 // How often (in milliseconds) the APS checks performance and makes adjustments (if needed) to balance out shard performance
APSDELAYSTEP=50 // How much the delay timer is modified by (in milliseconds) each time APS makes adjustments
APSDELAYMAXCAP=2000 // Max amount of of delay APS can introduce for NPC AI/movement handling when attempting to restore shard performance
Added new JS Methods for Region objects:
.GetOrePrefs( oreType ) // Get ore preference data for ore type found in town region. Returned as an array containing the following data:
orePrefData -> [
oreName, // name of ore
color, // color of ore
minskill, // min skill to mine ore
ingotName, // name of ingot created from ore
makemenu, // makemenu entry for crafting something from ingot
oreChance, // default global chance of finding this ore type
scriptID // script attached to mined ore
],
orePrefChance // Chance of finding this ore type in given town region
.GetOreChance() // Get base chance of finding any ore in town region
Moved Mining skill plus gravedigging feature from hard code to scripts (js/skill/mining.js) to make it easier to maintain and/or customize, and removed hard coded variants
Gravedigging now relies on the ore resource system behind the scenes to restrict how often graves in a given area can be dug up
Fixed some incorrect references to .worldNumber Character property in misc scripts (should be .worldnumber)
Made some "hard-scripted" system messages in misc scripts use dictionary system instead
Added spawn region for banker NPCs in Serpent's Hold (dfndata/spawn/felucca/spawn_town_serpents_hold.dfn, dfndata/spawn/trammel/spawn_town_serpents_hold.dfn)
Fixed region definition of Ocllo to actually cover the entire town (dfndata/regions/regions.dfn)
Added numerous additional locations accessible with 'goplace # command, for key locations in Ilshenar, Malas, Tokuno Islands and Ter Mur (dfndata/location/location.dfn)
Revised travel-menu portion of GM menu (shortcut: 'travel) to include more travel options based on new locations (dfndata/items/travelmenu.dfn and travelmenu.bulk.dfn)
Fixed an issue where NPCs could attempt to attack targets in other worlds/instances
Added new JS Event that triggers for characters who are about to deal damage in combat. Complimentary to onDamage, which triggers for chars receiving damage:
onDamageDeal( dmgDealer, dmgReceiver, damageValue, damageType )
Added new JS Event that can trigger in global script upon creation of new player chars. Note that this will trigger in place of onCreateDFN event for player characters:
onCreatePlayer( pChar )
Added new JS Event that triggers for characters selecting a target with a spell. Complimentary to onSpellTarget, which triggers for targets selected with a spell:
onSpellTargetSelect( caster, target, spellNum )
Updated onCombatStart and onCombatEnd JS Events to also trigger for the other party in combat
Updated onPickup JS Event to include a third parameter - the potential container item was picked up from. Event now also triggers event in scripts attached to said containers:
onPickup( iPickedUp, pChar, iCont )
Added tracking of total playtime per individual character, and per account across all characters, and exposed these properties to JS engine:
.totalPlayTime // Account property, total playtime across all chars
.playTime // Character property, total playtime on given character only
Added new player-accessible command ('playtime) to spit out the playtime of current character/account as a whole (js/commands/playtime.js)
Implemented first version of Young Player System:
Replaced the UNUSED9 account flag with YOUNG, to be used by Young/New Player System
Added new JS Account property that gets/sets whether player account is considered Young:
.isYoung
Added new Char timers:
TIMER_YOUNGHEAL // Restricts how often Young players are healed by NPC healers
TIMER_YOUNGMESSAGE // Restricts how often Young players are warned about dangerous looking monsters in overworld
Updated GM commands 'get and 'set to get/set .isYoung property of player's account (js/commands/targeting/get.js and set.js)
Added new UOX.INI setting to enable/disable Young Player System (enabled by default):
YOUNGPLAYERSYSTEM=1
If Young Player System is enabled, all newly created player accounts are automatically marked with Young flag
Added new script to handle various restrictions and functions related to Young characters (js/player/young_player.js):
Young characters will have [Young] displayed over their head
Young characters will have their Young status checked and verified on every login + every stat/skill gain, to revoke the Young status if any of the following is true:
Account has a total playtime of more than 40 hours
Any character has more than 350 total (base) skill points
Any character has more than 70 skill points in a single skill
Any character has more than 150 total stat points
Any character has more than 80 stat points in a single stat
Young characters can renounce their Young status manually by saying the words "I renounce my young player status"
Young characters get two additional items upon creation:
a new player ticket (can be combined with any other players new player ticket for both players to get a reward)
a sextant (shows Young players directions to nearest moongate/bank regardless of where they are, as long as outdoors)
Young characters cannot target other player characters with hostile spells or skills
Young characters cannot be the target of other player characters' hostile spells or skills
Young characters can only cast beneficial spells upon themselves or other Young characters
Young characters can only be the target of beneficial spells from other Young players
Young players (and their pets/followers) cannot attack or harm any other players (or their pets/followers), nor themselves be attacked or harmed by any other players (or their pets/followers), whether from combat, spells, skills or items
Young players don't lose any of their items on death, and are teleported to the nearest healer upon death with all their items intact
Young players receive a warning upon entering dungeons that monsters there will be hostile
Updated global script (js/server/global.js) to:
Check/Verify Young status of players upon login
Attach young player script on login/creation for players on Young accounts
Give specific items to Young players upon creation
Added new script (js/item/corpse.js) that is assigned to all freshly created corpses. This script handles restrictions related to Young players interactions with corpses, and the interactions of other players with corpses of Young players
Updated JS Method .Carve() to return true/false depending on whether carving a corpse was successful
Updated Healer AI in code to heal nearby injured Young players
Updated Evil AI and Evil Caster AI in code to avoid selecting Young players as targets in combat outside of dungeons
Added a new section to UOX.INI - [young player starting locations] - that can be used to define starting locations for Young players. If only one such location is provided, all players start there. Otherwise, it matches the same starting location setup as the regular one - with one entry per town in Britannia.
Restricted transferring and/or friending of pets (code) and hirelings (hirelings.js) between Young and non-Young players
Restricted Young players from recalling or gating to Felucca facet
Young players can instantly logout from anywhere, at any time
2023-07-01 20:02:40 +08:00
fsOut < < " // 0x0100) Char-5 Blocked 0x0200) Char-6 Blocked 0x0400) Char-7 Blocked 0x0800) Young " < < std : : endl ;
2012-11-03 18:11:04 +00:00
fsOut < < " // 0x1000) Unused 0x2000) Seer 0x4000) Counselor 0x8000) GM Account " < < std : : endl ;
2003-01-20 16:14:57 +00:00
fsOut < < " //------------------------------------------------------------------------------ " < < std : : endl ;
}
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
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - cAccountClass::WriteOrphanHeader()
//o------------------------------------------------------------------------------------------------o
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
//| Purpose - Writes the Orphan.Adm header to the specified output stream.
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
void cAccountClass : : WriteOrphanHeader ( std : : fstream & fsOut )
2003-01-20 16:14:57 +00:00
{
2022-10-24 18:39:33 +08:00
fsOut < < " //OI3.0 " < < " -UV " < < CVersionClass : : GetVersion ( ) < < " -BD " < < CVersionClass : : GetBuild ( ) < < " -DS " < < time ( nullptr ) < < " -ED " < < CVersionClass : : GetRealBuild ( ) < < " \n " ;
2003-01-20 16:14:57 +00:00
fsOut < < " //------------------------------------------------------------------------------ " < < std : : endl ;
fsOut < < " // Orphans.Adm " < < std : : endl ;
fsOut < < " //------------------------------------------------------------------------------ " < < std : : endl ;
fsOut < < " // UOX3 uses this file to store any characters that have been removed from " < < std : : endl ;
2012-11-03 18:11:04 +00:00
fsOut < < " // an account. They are stored here so there is some history of user deltions " < < std : : endl ;
fsOut < < " // of their characters. At best the co-ordinate may be available. " < < std : : endl ;
fsOut < < " // Name, X/Y/Z values if available will be displayed to ease locating trouble " < < std : : endl ;
fsOut < < " // users, and where they deleted their characters last. " < < std : : endl ;
2003-01-20 16:14:57 +00:00
fsOut < < " // " < < std : : endl ;
fsOut < < " // The format is as follows: " < < std : : endl ;
fsOut < < " // " < < std : : endl ;
fsOut < < " // username=ID,CharacterName,X,Y,Z " < < std : : endl ;
fsOut < < " // " < < std : : endl ;
fsOut < < " // NOTE: CharacterName, and Coordinates may not be available. " < < std : : endl ;
fsOut < < " //------------------------------------------------------------------------------ \n " ;
}
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
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - cAccountClass::WriteUADHeader()
//o------------------------------------------------------------------------------------------------o
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
//| Purpose - Writes the Username.uad header to the specified output stream.
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
void cAccountClass : : WriteUADHeader ( std : : fstream & fsOut , CAccountBlock_st & actbTemp )
2003-01-20 16:14:57 +00:00
{
2022-10-24 18:39:33 +08:00
fsOut < < " //AI3.0 " < < " -UV " < < CVersionClass : : GetVersion ( ) < < " -BD " < < CVersionClass : : GetBuild ( ) < < " -DS " < < time ( nullptr ) < < " -ED " < < CVersionClass : : GetRealBuild ( ) < < std : : endl ;
2003-01-20 16:14:57 +00:00
fsOut < < " //------------------------------------------------------------------------------ " < < std : : endl ;
fsOut < < " // UAD Path: " < < actbTemp . sPath < < std : : endl ;
fsOut < < " //------------------------------------------------------------------------------ " < < std : : endl ;
fsOut < < " // UOX3 uses this file to store any extra administration info \n " ;
fsOut < < " //------------------------------------------------------------------------------ " < < std : : endl ;
fsOut < < " ID " < < actbTemp . wAccountIndex < < std : : endl ;
2003-01-26 20:54:31 +00:00
fsOut < < " NAME " < < actbTemp . sUsername < < std : : endl ;
fsOut < < " PASS " < < actbTemp . sPassword < < std : : endl ;
2012-11-03 18:11:04 +00:00
fsOut < < " BANTIME " < < std : : hex < < " 0x " < < actbTemp . wTimeBan < < std : : dec < < std : : endl ;
2022-01-10 07:33:51 +08:00
fsOut < < " FIRSTLOGIN " < < std : : hex < < " 0x " < < actbTemp . wFirstLogin < < std : : dec < < std : : endl ;
UOX3 0.99.6-RC6
Removed arbitrary and hidden restrictions on refreshing list of online players shown with 'wholist command
Fixed an issue where player ghosts that get teleported would not see themselves get updated to new location
Fixed a server crash from clients disconnecting while running server in debug mode
Improved how container updates are sent to players; now only sends to clients that have actually opened the container, and who are still within range
Added more information about UO data files being loaded during server startup
Enhanced the GM 'add menu to allow clicking directly on images of items/npcs to add them, and adjusted size of menus to accommodate this
Fixed an issue with fleeing NPCs that could cause them to attempt to flee across time and space, regardless of distance to target/attacker in combat
Added NPC AI that runs away from players if they get too close (even outside combat). Applied to hind, rabbits, squirrels, ferrets and various birds by default:
AI_ANIMAL_SCARED (aitype 12)
Fixed issues with NPCs fleeing forever, or getting stuck in flee/don't flee loop, by introducing max fleeing distance (50 tiles) and cooldown (30 sec) on fleeing
Updated onNameRequest JS Event to include third parameter with origin of name request, so script responses can be tailored appropriately:
onNameRequest( myObj, requestedBy, requestSource )
Potential values for requestSource:
0 - Speech/System Messages
1 - Guild Menus
2 - Stat Window (self)
3 - Stat Window (other)
4 - Tooltip
5 - Paperdoll Journal
6 - Paperdoll
7 - Single Click / All-Names
8 - System
9 - Secure Trade Window
Added Adaptive Performance System (APS) that dynamically adjust how often NPC AI/movement is checked based on overall shard performance. If performance drops below defined threshold, UOX3 gradually slows down checks for NPC AI/movement to prioritize player movement/speech/command responsiveness. If performance climbs back up above threshold, slowdowns are gradually removed. The following UOX.INI options have been added under [system] category to support this system:
APSPERFTHRESHOLD=50 // Performance threshold (measured in simulation cycles/sec) below which the APS kicks in
APSINTERVAL=100 // How often (in milliseconds) the APS checks performance and makes adjustments (if needed) to balance out shard performance
APSDELAYSTEP=50 // How much the delay timer is modified by (in milliseconds) each time APS makes adjustments
APSDELAYMAXCAP=2000 // Max amount of of delay APS can introduce for NPC AI/movement handling when attempting to restore shard performance
Added new JS Methods for Region objects:
.GetOrePrefs( oreType ) // Get ore preference data for ore type found in town region. Returned as an array containing the following data:
orePrefData -> [
oreName, // name of ore
color, // color of ore
minskill, // min skill to mine ore
ingotName, // name of ingot created from ore
makemenu, // makemenu entry for crafting something from ingot
oreChance, // default global chance of finding this ore type
scriptID // script attached to mined ore
],
orePrefChance // Chance of finding this ore type in given town region
.GetOreChance() // Get base chance of finding any ore in town region
Moved Mining skill plus gravedigging feature from hard code to scripts (js/skill/mining.js) to make it easier to maintain and/or customize, and removed hard coded variants
Gravedigging now relies on the ore resource system behind the scenes to restrict how often graves in a given area can be dug up
Fixed some incorrect references to .worldNumber Character property in misc scripts (should be .worldnumber)
Made some "hard-scripted" system messages in misc scripts use dictionary system instead
Added spawn region for banker NPCs in Serpent's Hold (dfndata/spawn/felucca/spawn_town_serpents_hold.dfn, dfndata/spawn/trammel/spawn_town_serpents_hold.dfn)
Fixed region definition of Ocllo to actually cover the entire town (dfndata/regions/regions.dfn)
Added numerous additional locations accessible with 'goplace # command, for key locations in Ilshenar, Malas, Tokuno Islands and Ter Mur (dfndata/location/location.dfn)
Revised travel-menu portion of GM menu (shortcut: 'travel) to include more travel options based on new locations (dfndata/items/travelmenu.dfn and travelmenu.bulk.dfn)
Fixed an issue where NPCs could attempt to attack targets in other worlds/instances
Added new JS Event that triggers for characters who are about to deal damage in combat. Complimentary to onDamage, which triggers for chars receiving damage:
onDamageDeal( dmgDealer, dmgReceiver, damageValue, damageType )
Added new JS Event that can trigger in global script upon creation of new player chars. Note that this will trigger in place of onCreateDFN event for player characters:
onCreatePlayer( pChar )
Added new JS Event that triggers for characters selecting a target with a spell. Complimentary to onSpellTarget, which triggers for targets selected with a spell:
onSpellTargetSelect( caster, target, spellNum )
Updated onCombatStart and onCombatEnd JS Events to also trigger for the other party in combat
Updated onPickup JS Event to include a third parameter - the potential container item was picked up from. Event now also triggers event in scripts attached to said containers:
onPickup( iPickedUp, pChar, iCont )
Added tracking of total playtime per individual character, and per account across all characters, and exposed these properties to JS engine:
.totalPlayTime // Account property, total playtime across all chars
.playTime // Character property, total playtime on given character only
Added new player-accessible command ('playtime) to spit out the playtime of current character/account as a whole (js/commands/playtime.js)
Implemented first version of Young Player System:
Replaced the UNUSED9 account flag with YOUNG, to be used by Young/New Player System
Added new JS Account property that gets/sets whether player account is considered Young:
.isYoung
Added new Char timers:
TIMER_YOUNGHEAL // Restricts how often Young players are healed by NPC healers
TIMER_YOUNGMESSAGE // Restricts how often Young players are warned about dangerous looking monsters in overworld
Updated GM commands 'get and 'set to get/set .isYoung property of player's account (js/commands/targeting/get.js and set.js)
Added new UOX.INI setting to enable/disable Young Player System (enabled by default):
YOUNGPLAYERSYSTEM=1
If Young Player System is enabled, all newly created player accounts are automatically marked with Young flag
Added new script to handle various restrictions and functions related to Young characters (js/player/young_player.js):
Young characters will have [Young] displayed over their head
Young characters will have their Young status checked and verified on every login + every stat/skill gain, to revoke the Young status if any of the following is true:
Account has a total playtime of more than 40 hours
Any character has more than 350 total (base) skill points
Any character has more than 70 skill points in a single skill
Any character has more than 150 total stat points
Any character has more than 80 stat points in a single stat
Young characters can renounce their Young status manually by saying the words "I renounce my young player status"
Young characters get two additional items upon creation:
a new player ticket (can be combined with any other players new player ticket for both players to get a reward)
a sextant (shows Young players directions to nearest moongate/bank regardless of where they are, as long as outdoors)
Young characters cannot target other player characters with hostile spells or skills
Young characters cannot be the target of other player characters' hostile spells or skills
Young characters can only cast beneficial spells upon themselves or other Young characters
Young characters can only be the target of beneficial spells from other Young players
Young players (and their pets/followers) cannot attack or harm any other players (or their pets/followers), nor themselves be attacked or harmed by any other players (or their pets/followers), whether from combat, spells, skills or items
Young players don't lose any of their items on death, and are teleported to the nearest healer upon death with all their items intact
Young players receive a warning upon entering dungeons that monsters there will be hostile
Updated global script (js/server/global.js) to:
Check/Verify Young status of players upon login
Attach young player script on login/creation for players on Young accounts
Give specific items to Young players upon creation
Added new script (js/item/corpse.js) that is assigned to all freshly created corpses. This script handles restrictions related to Young players interactions with corpses, and the interactions of other players with corpses of Young players
Updated JS Method .Carve() to return true/false depending on whether carving a corpse was successful
Updated Healer AI in code to heal nearby injured Young players
Updated Evil AI and Evil Caster AI in code to avoid selecting Young players as targets in combat outside of dungeons
Added a new section to UOX.INI - [young player starting locations] - that can be used to define starting locations for Young players. If only one such location is provided, all players start there. Otherwise, it matches the same starting location setup as the regular one - with one entry per town in Britannia.
Restricted transferring and/or friending of pets (code) and hirelings (hirelings.js) between Young and non-Young players
Restricted Young players from recalling or gating to Felucca facet
Young players can instantly logout from anywhere, at any time
2023-07-01 20:02:40 +08:00
fsOut < < " TOTALPLAYTIME " < < std : : hex < < " 0x " < < actbTemp . wTotalPlayTime < < std : : dec < < std : : endl ;
2022-10-24 18:39:33 +08:00
fsOut < < " LASTIP " < < static_cast < SI32 > ( ( actbTemp . dwLastIP & 0xFF000000 ) > > 24 ) < < " . "
< < static_cast < SI32 > ( ( actbTemp . dwLastIP & 0x00FF0000 ) > > 16 ) < < " . "
< < static_cast < SI32 > ( ( actbTemp . dwLastIP & 0x0000FF00 ) > > 8 ) < < " . "
< < static_cast < SI32 > ( ( actbTemp . dwLastIP & 0x000000FF ) % 256 ) < < std : : endl ;
2012-11-03 18:11:04 +00:00
fsOut < < " CONTACT " < < actbTemp . sContact < < std : : endl ;
2003-01-20 16:14:57 +00:00
fsOut < < " //------------------------------------------------------------------------------ " < < std : : endl ;
}
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
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - cAccountClass::WriteImportHeader()
//o------------------------------------------------------------------------------------------------o
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
//| Purpose - Writes the Username.uad header to the specified output stream.
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
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
void cAccountClass : : WriteImportHeader ( std : : fstream & fsOut )
2012-11-03 18:11:04 +00:00
{
2022-10-24 18:39:33 +08:00
fsOut < < " //AIMP3.0 " < < " -UV " < < CVersionClass : : GetVersion ( ) < < " -BD " < < CVersionClass : : GetBuild ( ) < < " -DS " < < time ( nullptr ) < < " -ED " < < CVersionClass : : GetRealBuild ( ) < < std : : endl ;
2012-11-03 18:11:04 +00:00
fsOut < < " //------------------------------------------------------------------------------ " < < std : : endl ;
fsOut < < " // UOX3 uses this file to store new accounts that are to be imported on the next " < < std : : endl ;
fsOut < < " // time the server does a world save, or world load. " < < std : : endl ;
fsOut < < " //------------------------------------------------------------------------------ " < < std : : endl ;
fsOut < < " // FORMAT: " < < std : : endl ;
fsOut < < " // " < < std : : endl ;
fsOut < < " // USER=username,password,flags,contact " < < std : : endl ;
fsOut < < " // " < < std : : endl ;
fsOut < < " // WHERE: username - Username of the accounts to create. " < < std : : endl ;
fsOut < < " // password - Password of the account to create. " < < std : : endl ;
fsOut < < " // flags - See accounts.adm for correct flag values. " < < std : : endl ;
fsOut < < " // contact - Usually this is the email address, but can be used as a comment or ICQ " < < std : : endl ;
fsOut < < " // " < < std : : endl ;
fsOut < < " // NOTE: Flags, and contact values are not required, defaults will be used. " < < std : : endl ;
fsOut < < " // NOTE: Please ensure you press ENTER after your last line for proper loading. " < < std : : endl ;
fsOut < < " //------------------------------------------------------------------------------ " < < std : : endl ;
}