uox3/source/cHTMLSystem.cpp

888 lines
29 KiB
C++
Raw Normal View History

// HTML Template
2002-04-07 20:53:41 +00:00
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 "uox3.h"
#include "cHTMLSystem.h"
2002-10-25 04:57:23 +00:00
#include "cVersionClass.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 "cGuild.h"
#include "townregion.h"
#include "cRaces.h"
#include "cServerDefinitions.h"
#include "ssection.h"
#include "gump.h"
#include "scriptc.h"
#include "CPacketSend.h"
#include "ObjectFactory.h"
2002-10-25 04:57:23 +00:00
cHTMLTemplates *HTMLTemplates;
2002-04-07 20:53:41 +00:00
cHTMLTemplate::cHTMLTemplate() : UpdateTimer( 60 ), Loaded( false ), Type( ETT_INVALIDTEMPLATE ), ScheduledUpdate( 0 )
2002-04-07 20:53:41 +00:00
{
Name = "";
Content = "";
OutputFile.reserve( MAX_PATH );
InputFile.reserve( MAX_PATH );
2002-04-07 20:53:41 +00:00
}
cHTMLTemplate::~cHTMLTemplate()
{
}
std::string GetUptime( void )
{
UI32 total = (cwmWorldState->GetUICurrentTime() - cwmWorldState->GetStartTime() ) / 1000;
UI32 ho = total / 3600;
total -= ho * 3600;
UI32 mi = total / 60;
total -= mi * 60;
UI32 se = total;
total = 0;
std::string builtString = "";
if( ho < 10 )
{
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
builtString += std::string("0");
}
builtString += strutil::number( ho ) + ":";
if( mi < 10 )
{
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
builtString += std::string("0");
}
builtString += strutil::number( mi ) + std::string(":");
if( se < 10 )
{
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
builtString += std::string("0");
}
builtString += strutil::number( se );
return builtString;
}
bool CountNPCFunctor( CBaseObject *a, UI32 &b, void *extraData )
{
bool retVal = true;
if( ValidateObject( a ) )
{
CChar *j = static_cast< CChar * >(a);
if( j->IsNpc() )
++b;
}
return retVal;
2002-04-07 20:53:41 +00: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
//o-----------------------------------------------------------------------------------------------o
//| Function - void cHTMLTemplate::Process( void )
//| Date - 1/18/2003 4:43:17 AM
//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 -
//|
//| Changes - 08062003 - For the record this is some of the
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
//| most fucked up shit I have EVER SEEN!! Written to truely
//| handle multiple Templates.
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
//o-----------------------------------------------------------------------------------------------o
2002-04-07 20:53:41 +00:00
void cHTMLTemplate::Process( void )
{
// Need to check to see if the server is actually running, of so we do not want to process the offline template.
if(cwmWorldState->GetKeepRun() && this->GetTemplateType() == ETT_OFFLINE )
return;
2002-04-07 20:53:41 +00:00
// Only read the Status Page if it's not already loaded
if( !Loaded )
LoadTemplate();
// Parse the Content...
std::string ParsedContent = Content;
2002-04-07 20:53:41 +00:00
// Replacing Placeholders
// Account-Count
std::string AccountCount = strutil::number( (Accounts->size()) );
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
size_t Pos = ParsedContent.find( "%accounts" );
while( Pos != std::string::npos )
2002-04-07 20:53:41 +00:00
{
ParsedContent.replace( Pos, 9, AccountCount );
Pos = ParsedContent.find( "%accounts" );
2002-04-07 20:53:41 +00:00
}
// Version
std::string Version = CVersionClass::GetVersion();
Version += ".";
Version += CVersionClass::GetBuild();
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) -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 caused by changing an items layer -Fixed a bug causing NPC's to always be the first attacker -Armor DEF system overhauled to match OSI system -Updated Hash Table Remove() calls to remove unrefrenced parameter "index" -Changed cSocket::Get/SetDWord() to a UI32 to fix problems checking it against INVALIDSERIAL and storing large serial numbers -Changed cSocket::AddID() to a UI32 for the same reason as above -Changed cSocket:::Get/SetWord() to a UI16 to fix possible problems storing ID's -Fixed up calcStealDiff() to match new weight system -Minor updates to CPStatsWindow to match the new Armor DEF system and Weight system -Fixed calls to getTileName() so the names container was set with MAX_NAME -Fixed up getFieldDir() using direction typedefs -Changed Get/SetMagic() to Get/SetMovable() -Cleaned up some unrefrenced params -Changed some int's to UI16's in books.cpp -WorldSave Changes: -XYZ and worldnum to Location=x,y,z,worldnum -HiDamage and LoDamage into Damage=hidamage,lodamage -Strength,st2,Dexterity,dx2,Intelligence,in2 changed to Strength=str,st2, Intelligence=int,in2, Dexterity=dex,dx2 -DWord0-3 changed to DWords=0,1,2,3 -FX1,FY1,FX2,FY2,FZ1 changed to WanderArea=FX1,FY1,FX2,FY2,FZ1 -MoreX,MoreY,MoreZ changed to MoreXYZ=morex,morey,morez -More,More2 changed to More=more,more2 -Type,Type2 changed to Type=type,type2 -Light,Rain,Heat,Cold,Snow,Lightning changed to RaceDamage=Light,Rain,Heat,Cold,Snow,Lightning -Fame,Karma,Kills changed to Reputation=fame,karma,kills -Complete rewrite to the Weight system -Weight is more permanent, removed need to recalc it constantly -Packs now show the weight of themselves and all their contents -Packs now have a weight limit (currently hardcapped to 400, should make it based on type of container and possibly scriptable) -All items use the weight value given to them in the scripts unless the entry is 0 in which case they pull weight from the MUL's -Better handling of overloaded for teleport / recall / walking -Weight will max out at 65535 stones and can not go lower than 0 stones -Items container is now set as a cBaseObject -Fixed up itemsfx() and renamed it to itemSound(), now better handles Gold sfx and where an item was dropped (ie in a pack or on the ground) -Cleaned up goldsfx() and renamed it to goldSound() -Many fixes to get/drop/wear/packItem functions -Minor fixes/cleanups in movement.cpp -Fixed a worldsave crash with tamed creatures -Pressing 0 in console reloads items as well as everything else -Made dagger usable for carve again -Fixed a horse mounting distance check -Noted (and in some cases fixed) unrefrenced variables throughout the code -Converted inscribe.gmp to inscribe.dfn and used NewMakeMenu() in favor of the old make menu system -Updated GetMagic() == 3 calls to IsLockedDown() calls (as that is all it should be used for) -Fixed up all IsLockedDown() calls, resources that are LockedDown can NOT be used, even by GM, until released -Also note, items that should be usable if locked: Skill items (looms, training dummies, etc, Recall runes) -Moved the two functions from newbie.cpp to pcmanage.cpp and removed newbie.cpp from the project -Moved action() and impaction() to effects.cpp -Moved isHuman() to npcs.cpp -Where possible made functions that were part of classes private -Made use of cCombat::getWeaponTyp
2003-03-13 09:05:58 +00:00
Version += " [";
Version += OS_STR;
Version += "]";
2002-04-07 20:53:41 +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
Pos = ParsedContent.find( "%version" );
while( Pos != std::string::npos )
2002-04-07 20:53:41 +00:00
{
ParsedContent.replace( Pos, 8, Version );
Pos = ParsedContent.find( "%version" );
2002-04-07 20:53:41 +00:00
}
// Character Count
std::string CharacterCount = strutil::number( ObjectFactory::getSingleton().CountOfObjects( OT_CHAR ) );
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
Pos = ParsedContent.find( "%charcount" );
while( Pos != std::string::npos )
2002-04-07 20:53:41 +00:00
{
ParsedContent.replace( Pos, 10, CharacterCount );
Pos = ParsedContent.find( "%charcount" );
2002-04-07 20:53:41 +00:00
}
// Item Count
std::string ItemCount = strutil::number( ObjectFactory::getSingleton().CountOfObjects( OT_ITEM ) );
Pos = ParsedContent.find( "%itemcount" );
while( Pos != std::string::npos )
2002-04-07 20:53:41 +00:00
{
ParsedContent.replace( Pos, 10, ItemCount );
Pos = ParsedContent.find( "%itemcount" );
2002-04-07 20:53:41 +00:00
}
// Connection Count (GMs, Counselors, Player)
UI32 gm = 0, cns = 0, ccount = 0;
2021-06-12 07:30:23 -04:00
CSocket *tSock = nullptr;
CChar *tChar = nullptr;
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
// Get all Network Connections
2002-04-07 20:53:41 +00:00
{
Misc fixes - 0.99.3a Undid dictionary rename from ENG to ENU and FRE to FRA; these are not actual language codes, but groups of language codes - ENU covers all English language codes, FRA covers all French ones. Refined build notes Updated Debug Information Format for Debug x64 platform in VS project properties to Program Database for Edit and Continue Minor fix for a half-broken system (automatic adding of items to add-menu) that needs to be revamped or removed Commented out some thread-locking code that was causing UOX3 to crash under certain circumstances Fixed a few cases of threads sleeping for microseconds instead of milliseconds Replaced all calls to UOXSleep with direct call to std::this_thread::sleep_for(), and removed UOXSleep function from funcdecl.h Fixed an issue with "Gold" ore/ingot type, which was mislabelled as "Golden" in the ORE_LIST section of skills.dfn Fixed an issue where crafting skills might consume the wrong resource if additional resources of the same ID but different color were present in player's backpack Improved AmbientFootsteps feature so footstep sounds are played more in tune with character movement AmbientFootsteps now also play for NPC movement Changed how code handles randomizing between MINTIME and MAXTIME values from region spawners; now multiplies values by 60 (to get seconds) before randomizing, instead of after, to make use of full range of seconds between the values (which are in minutes) Adjusted default global NPC movement speeds in [speedup} section of uox.ini to use less extreme values Added a DEBUGMOVEMULTIPLIER define in cChar.cpp used to multiply NPC movement delays by the specified value (1.75 by default) when running UOX3 in debug mode, due to reduced server performance in debug mode Documentation updates: Added section on DFN tags for Character, Item, Region, SpawnRegion and Weather DFNs. Added Feature documentation for Mining and customizable ores Added More details in feature documentation for Spawn Regions Updated feature documentation for Dictionaries Added more details in UOX3 history section
2020-09-16 02:51:20 +08:00
//std::scoped_lock lock(Network->internallock);
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
Network->pushConn();
for( tSock = Network->FirstSocket(); !Network->FinishedSockets(); tSock = Network->NextSocket() )
{
tChar = tSock->CurrcharObj();
if( !ValidateObject( tChar ) )
continue;
if( tChar->IsGM() )
++gm;
else if( tChar->IsCounselor() )
++cns;
else
++ccount;
}
Network->popConn();
2002-04-07 20:53:41 +00:00
}
// GMs
std::string GMCount = strutil::number( gm );
Pos = ParsedContent.find( "%online_gms" );
while( Pos != std::string::npos )
2002-04-07 20:53:41 +00:00
{
(cwmWorldState->GetKeepRun())?ParsedContent.replace( Pos, 11, GMCount ):ParsedContent.replace( Pos, 11, "0" );
Pos = ParsedContent.find( "%online_gms" );
2002-04-07 20:53:41 +00:00
}
// Counselor
std::string CounsiCount = strutil::number( cns );
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
Pos = ParsedContent.find( "%online_couns" );
while( Pos != std::string::npos )
2002-04-07 20:53:41 +00:00
{
(cwmWorldState->GetKeepRun())?ParsedContent.replace( Pos, 13, CounsiCount ):ParsedContent.replace( Pos, 13, "0");
Pos = ParsedContent.find( "%online_couns" );
2002-04-07 20:53:41 +00:00
}
// Player
std::string PlayerCount = strutil::number( ccount );
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
Pos = ParsedContent.find( "%online_player" );
while( Pos != std::string::npos )
2002-04-07 20:53:41 +00:00
{
(cwmWorldState->GetKeepRun())?ParsedContent.replace( Pos, 14, PlayerCount ):ParsedContent.replace( Pos, 14, "0" );
Pos = ParsedContent.find( "%online_player" );
2002-04-07 20:53:41 +00:00
}
// Total
std::string AllCount = strutil::number( (ccount + gm + cns) );
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
Pos = ParsedContent.find( "%online_all" );
while( Pos != std::string::npos )
2002-04-07 20:53:41 +00:00
{
(cwmWorldState->GetKeepRun())?ParsedContent.replace( Pos, 11, AllCount ):ParsedContent.replace( Pos, 11, "0" );
Pos = ParsedContent.find( "%online_all" );
2002-04-07 20:53:41 +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
// Time
char time_str[256];
2002-04-07 20:53:41 +00:00
RealTime( time_str );
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
Pos = ParsedContent.find( "%time" );
while( Pos != std::string::npos )
2002-04-07 20:53:41 +00:00
{
(cwmWorldState->GetKeepRun())?ParsedContent.replace( Pos, 5, time_str ):ParsedContent.replace( Pos, 5, "Down" );
Pos = ParsedContent.find( "%time" );
}
// 24Time
RealTime24( time_str );
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
Pos = ParsedContent.find( "%24time" );
while( Pos != std::string::npos )
{
(cwmWorldState->GetKeepRun())?ParsedContent.replace( Pos, 7, time_str ):ParsedContent.replace( Pos, 7, "Down" );
Pos = ParsedContent.find( "%24time" );
}
// Timestamp
time_t currTime;
time( &currTime );
currTime = mktime( gmtime( &currTime ) );
std::string timestamp = strutil::number( currTime );
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
Pos = ParsedContent.find( "%tstamp" );
while( Pos != std::string::npos )
{
(cwmWorldState->GetKeepRun())?ParsedContent.replace( Pos, 7, timestamp ):ParsedContent.replace( Pos, 7, "Down" );
Pos = ParsedContent.find( "%tstamp" );
2002-04-07 20:53:41 +00:00
}
// IP(s) + PORT(s)
UI16 ServerCount = cwmWorldState->ServerData()->ServerCount();
if( ServerCount > 0 )
2002-04-07 20:53:41 +00:00
{
for( UI16 i = 0; i < ServerCount; ++i )
2002-04-07 20:53:41 +00:00
{
physicalServer *mServ = cwmWorldState->ServerData()->ServerEntry( i );
auto ipToken = strutil::format( "%%ip%i", i+1 );
2002-04-07 20:53:41 +00:00
2021-06-12 07:30:23 -04:00
if( mServ != nullptr )
2002-04-07 20:53:41 +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
Pos = ParsedContent.find( ipToken );
while( Pos != std::string::npos )
2002-04-07 20:53:41 +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
(cwmWorldState->GetKeepRun())?ParsedContent.replace( Pos, ipToken.size(), mServ->getIP().c_str()):ParsedContent.replace( Pos, ipToken.size(), "Down" );
Pos = ParsedContent.find( ipToken );
2002-04-07 20:53:41 +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
// i think we'll never get higher than 2 digits, anyway...
auto portToken = strutil::format( "%%port%i", i+1 );
2002-04-07 20:53:41 +00:00
2021-06-12 07:30:23 -04:00
if( mServ != nullptr )
2002-04-07 20:53:41 +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
Pos = ParsedContent.find( portToken );
while( Pos != std::string::npos )
2002-04-07 20:53:41 +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
auto myPort = std::to_string(mServ->getPort());
// Both paths do the same. Something seems missing
//if (cwmWorldState->GetKeepRun()){
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
ParsedContent.replace(Pos, portToken.size(), myPort);
//}
//else {
//ParsedContent.replace(Pos, portToken.size(), myPort);
//}
Pos = ParsedContent.find( portToken );
2002-04-07 20:53:41 +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
auto serverToken= strutil::format( "%%server%i", i+1 );
2002-04-07 20:53:41 +00:00
2021-06-12 07:30:23 -04:00
if( mServ != nullptr )
2002-04-07 20:53:41 +00:00
{
Pos = ParsedContent.find( serverToken );
while( Pos != std::string::npos )
2002-04-07 20:53:41 +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
if (cwmWorldState->GetKeepRun()) {
ParsedContent.replace(Pos, serverToken.size(), mServ->getName());
}
else {
ParsedContent.replace(Pos, serverToken.size(), "Down");
}
Pos = ParsedContent.find( serverToken );
2002-04-07 20:53:41 +00:00
}
}
}
}
// PLAYERLIST
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
Pos = ParsedContent.find( "%playerlist%" );
while( Pos != std::string::npos )
2002-04-07 20:53:41 +00:00
{
size_t SecondPos = ParsedContent.find( "%playerlist%", Pos+1 );
if( SecondPos == std::string::npos ) // there's no closing part!
break;
std::string myInline = ParsedContent.substr( Pos, SecondPos - Pos + 12 );
std::string PlayerList;
{
Misc fixes - 0.99.3a Undid dictionary rename from ENG to ENU and FRE to FRA; these are not actual language codes, but groups of language codes - ENU covers all English language codes, FRA covers all French ones. Refined build notes Updated Debug Information Format for Debug x64 platform in VS project properties to Program Database for Edit and Continue Minor fix for a half-broken system (automatic adding of items to add-menu) that needs to be revamped or removed Commented out some thread-locking code that was causing UOX3 to crash under certain circumstances Fixed a few cases of threads sleeping for microseconds instead of milliseconds Replaced all calls to UOXSleep with direct call to std::this_thread::sleep_for(), and removed UOXSleep function from funcdecl.h Fixed an issue with "Gold" ore/ingot type, which was mislabelled as "Golden" in the ORE_LIST section of skills.dfn Fixed an issue where crafting skills might consume the wrong resource if additional resources of the same ID but different color were present in player's backpack Improved AmbientFootsteps feature so footstep sounds are played more in tune with character movement AmbientFootsteps now also play for NPC movement Changed how code handles randomizing between MINTIME and MAXTIME values from region spawners; now multiplies values by 60 (to get seconds) before randomizing, instead of after, to make use of full range of seconds between the values (which are in minutes) Adjusted default global NPC movement speeds in [speedup} section of uox.ini to use less extreme values Added a DEBUGMOVEMULTIPLIER define in cChar.cpp used to multiply NPC movement delays by the specified value (1.75 by default) when running UOX3 in debug mode, due to reduced server performance in debug mode Documentation updates: Added section on DFN tags for Character, Item, Region, SpawnRegion and Weather DFNs. Added Feature documentation for Mining and customizable ores Added More details in feature documentation for Spawn Regions Updated feature documentation for Dictionaries Added more details in UOX3 history section
2020-09-16 02:51:20 +08:00
//std::scoped_lock lock(Network->internallock);
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
Network->pushConn();
for( tSock = Network->FirstSocket(); !Network->FinishedSockets(); tSock = Network->NextSocket() )
2002-04-07 20:53:41 +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
try
2002-04-07 20:53:41 +00:00
{
2021-06-12 07:30:23 -04:00
if( tSock != nullptr )
2002-04-07 20:53:41 +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
CChar *tChar = tSock->CurrcharObj();
if( ValidateObject( tChar ) )
{
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
std::string parsedInline = myInline;
parsedInline.replace( 0, 12, "" );
parsedInline.replace( parsedInline.length()-12, 12, "" );
// Tokens for the PlayerList
// %playername
// %playertitle
// %playerip
// %playeraccount
// %playerx
// %playery
// %playerz
// %playerrace
// %playerregion
// PlayerName
size_t sPos = parsedInline.find( "%playername" );
while( sPos != std::string::npos )
{
(cwmWorldState->GetKeepRun())?parsedInline.replace( sPos, 11, tChar->GetName() ):parsedInline.replace( sPos, 11, "" );
sPos = parsedInline.find( "%playername" );
}
// PlayerTitle
sPos = parsedInline.find( "%playertitle" );
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
while( sPos != std::string::npos )
{
(cwmWorldState->GetKeepRun())?parsedInline.replace( sPos, 12, tChar->GetTitle() ):parsedInline.replace( sPos, 12, "" );
sPos = parsedInline.find( "%playertitle" );
}
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
// PlayerIP
sPos = parsedInline.find( "%playerip" );
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
while( sPos != std::string::npos )
{
CSocket *mySock = tChar->GetSocket();
auto ClientIP = strutil::format("%i.%i.%i.%i", mySock->ClientIP4(), mySock->ClientIP3(), mySock->ClientIP3(), mySock->ClientIP1() );
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
(cwmWorldState->GetKeepRun())?parsedInline.replace( sPos, 9, ClientIP ):parsedInline.replace( sPos, 9, "" );
sPos = parsedInline.find( "%playerip" );
}
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
// PlayerAccount
sPos = parsedInline.find( "%playeraccount" );
while( sPos != std::string::npos )
{
CAccountBlock& toScan = tChar->GetAccount();
if( toScan.wAccountIndex != AB_INVALID_ID )
(cwmWorldState->GetKeepRun())?parsedInline.replace( sPos, 14, toScan.sUsername):parsedInline.replace( sPos, 14, "" );
sPos = parsedInline.find( "%playeraccount" );
}
// PlayerX
sPos = parsedInline.find( "%playerx" );
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
while( sPos != std::string::npos )
{
std::string myX = strutil::number( tChar->GetX() );
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
(cwmWorldState->GetKeepRun())?parsedInline.replace( sPos, 8, myX ):parsedInline.replace( sPos, 8, "" );
sPos = parsedInline.find( "%playerx" );
}
// PlayerY
sPos = parsedInline.find( "%playery" );
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
while( sPos != std::string::npos )
{
std::string myY = strutil::number( tChar->GetY() );
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
(cwmWorldState->GetKeepRun())?parsedInline.replace( sPos, 8, myY ):parsedInline.replace( sPos, 8, "" );
sPos = parsedInline.find( "%playery" );
}
// PlayerZ
sPos = parsedInline.find( "%playerz" );
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
while( sPos != std::string::npos )
{
std::string myZ = strutil::number( tChar->GetZ() );
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
(cwmWorldState->GetKeepRun())?parsedInline.replace( sPos, 8, myZ ):parsedInline.replace( sPos, 8, "" );
sPos = parsedInline.find( "%playerz" );
}
// PlayerRace -- needs testing
sPos = parsedInline.find( "%playerrace" );
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
while( sPos != std::string::npos )
{
RACEID myRace = tChar->GetRace();
const std::string rName = Races->Name( myRace );
size_t raceLenName = rName.length();
if( raceLenName > 0 )
(cwmWorldState->GetKeepRun())?parsedInline.replace( sPos, 11, rName ):parsedInline.replace( sPos, 11, "");
sPos = parsedInline.find( "%playerrace" );
}
// PlayerRegion
sPos = parsedInline.find( "%playerregion" );
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
while( sPos != std::string::npos )
{
(cwmWorldState->GetKeepRun())?parsedInline.replace( sPos, 13, tChar->GetRegion()->GetName() ):parsedInline.replace( sPos, 13, "");
sPos = parsedInline.find( "%playerregion" );
}
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
PlayerList += parsedInline;
}
2002-04-07 20:53:41 +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
catch( ... )
{
Console << "| EXCEPTION: Invalid character/socket pointer found. Ignored." << myendl;
}
2002-04-07 20:53:41 +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
Network->popConn();
2002-04-07 20:53:41 +00:00
}
(cwmWorldState->GetKeepRun())?ParsedContent.replace( Pos, myInline.length(), PlayerList ):ParsedContent.replace( Pos, myInline.length(), "");
Pos = ParsedContent.find( "%playerlist%" );
2002-04-07 20:53:41 +00:00
}
// GuildCount
std::string GuildCount = strutil::number( (SI32)GuildSys->NumGuilds() );
Pos = ParsedContent.find( "%guildcount" );
while( Pos != std::string::npos )
2002-04-07 20:53:41 +00:00
{
(cwmWorldState->GetKeepRun())?ParsedContent.replace( Pos, 11, GuildCount ):ParsedContent.replace( Pos, 11, "" );
Pos = ParsedContent.find( "%guildcount" );
2002-04-07 20:53:41 +00:00
}
// GUILDLIST
Pos = ParsedContent.find( "%guildlist%" );
while( Pos != std::string::npos )
2002-04-07 20:53:41 +00:00
{
size_t SecondPos = ParsedContent.find( "%guildlist%", Pos+1 );
if( SecondPos == std::string::npos ) // can't find closing
break;
std::string myInline = ParsedContent.substr( Pos, SecondPos - Pos + 11 );
std::string GuildList;
2002-04-07 20:53:41 +00:00
for( SI16 i = 0; i < (SI16)GuildSys->NumGuilds(); ++i )
2002-04-07 20:53:41 +00:00
{
std::string parsedInline = myInline;
2002-04-07 20:53:41 +00:00
parsedInline.replace( 0, 11, "" );
parsedInline.replace( parsedInline.length()-11, 11, "" );
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
// Tokens for the GuildList
// %guildid
// %guildname
2002-04-07 20:53:41 +00:00
// GuildID
size_t sPos;
2002-04-07 20:53:41 +00:00
CGuild *myGuild = GuildSys->Guild( i );
std::string GuildID = strutil::number( i );
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
sPos = parsedInline.find( "%guildid" );
while( sPos != std::string::npos )
2002-04-07 20:53:41 +00:00
{
(cwmWorldState->GetKeepRun())?parsedInline.replace( sPos, 8, GuildID ):parsedInline.replace( sPos, 8, "" );
sPos = parsedInline.find( "%guildid" );
2002-04-07 20:53:41 +00:00
}
// GuildName
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
sPos = parsedInline.find( "%guildname" );
while( sPos != std::string::npos )
2002-04-07 20:53:41 +00:00
{
(cwmWorldState->GetKeepRun())?parsedInline.replace( sPos, 10, myGuild->Name() ):parsedInline.replace( sPos, 10, "" );
sPos = parsedInline.find( "%guildname" );
2002-04-07 20:53:41 +00:00
}
GuildList += parsedInline;
}
(cwmWorldState->GetKeepRun())?ParsedContent.replace( Pos, myInline.length(), GuildList ):ParsedContent.replace( Pos, myInline.length(), "" );
Pos = ParsedContent.find( "%guildlist%" );
2002-04-07 20:53:41 +00:00
}
//NPCCount
UI32 npccount = 0;
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
UI32 b = 0;
2021-06-12 07:30:23 -04:00
ObjectFactory::getSingleton().IterateOver( OT_CHAR, b, nullptr, &CountNPCFunctor );
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
npccount = b;
2002-04-07 20:53:41 +00:00
std::string npcs = strutil::number( npccount );
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
Pos = ParsedContent.find( "%npcs" );
while( Pos != std::string::npos )
2002-04-07 20:53:41 +00:00
{
(cwmWorldState->GetKeepRun())?ParsedContent.replace( Pos, 5, npcs ):ParsedContent.replace( Pos, 5, "0" );
Pos = ParsedContent.find( "%npcs" );
2002-04-07 20:53:41 +00:00
}
// Performance Dump
R64 eps = 0.00000000001;
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
Pos = ParsedContent.find( "%performance" );
while( Pos != std::string::npos )
2002-04-07 20:53:41 +00:00
{
std::string performance;
std::ostringstream myStream( performance );
if( cwmWorldState->GetKeepRun() )
{
UI32 networkTimeCount = cwmWorldState->ServerProfile()->NetworkTimeCount();
UI32 timerTimeCount = cwmWorldState->ServerProfile()->TimerTimeCount();
UI32 autoTimeCount = cwmWorldState->ServerProfile()->AutoTimeCount();
UI32 loopTimeCount = cwmWorldState->ServerProfile()->LoopTimeCount();
myStream << "Network code: " << (R32)((R32)cwmWorldState->ServerProfile()->NetworkTime()/(R32)networkTimeCount) << "msec [" << networkTimeCount << " samples] <BR>";
myStream << "Timer code: " << (R32)((R32)cwmWorldState->ServerProfile()->TimerTime()/(R32)timerTimeCount) << "msec [" << timerTimeCount << " samples] <BR>";
myStream << "Auto code: " << (R32)((R32)cwmWorldState->ServerProfile()->AutoTime()/(R32)autoTimeCount) << "msec [" << autoTimeCount << " samples] <BR>";
myStream << "Loop Time: " << (R32)((R32)cwmWorldState->ServerProfile()->LoopTime()/(R32)loopTimeCount) << "msec [" << loopTimeCount << " samples] <BR>";
if( !( cwmWorldState->ServerProfile()->LoopTime() < eps || loopTimeCount < eps ) )
myStream << "Simulation Cycles: " << (1000.0*(1.0/(R32)((R32)cwmWorldState->ServerProfile()->LoopTime()/(R32)loopTimeCount))) << " per sec <BR>";
else
myStream << "Simulation Cycles: Greater than 10000 <BR> ";
}
else
{
myStream << "Network code: 0" << "<BR>";
myStream << "Timer code: 0" << "<BR>";
myStream << "Auto code: 0" << "<BR>";
myStream << "Loop Time: 0" << "<BR>";
myStream << "Simulation Cycles: 0<BR>";
}
ParsedContent.replace( Pos, 12, myStream.str() );
Pos = ParsedContent.find( "%performance" );
2002-04-07 20:53:41 +00:00
}
// Uptime
Pos = ParsedContent.find( "%uptime" );
while( Pos != std::string::npos )
{
std::string builtString = GetUptime();
ParsedContent.replace( Pos, 7, builtString );
Pos = ParsedContent.find( "%uptime" );
2002-04-07 20:53:41 +00:00
}
// Simulation Cycles (whatever that may be...)
Pos = ParsedContent.find( "%simcycles" );
while( Pos != std::string::npos )
2002-04-07 20:53:41 +00:00
{
std::string simcycles;
std::ostringstream myStream( simcycles );
2002-04-07 20:53:41 +00:00
if( cwmWorldState->GetKeepRun() )
{
if( !( cwmWorldState->ServerProfile()->LoopTime() < eps || cwmWorldState->ServerProfile()->LoopTimeCount() < eps ) )
myStream << "Simulation Cycles: " << (1000.0*(1.0/(R32)((R32)cwmWorldState->ServerProfile()->LoopTime()/(R32)cwmWorldState->ServerProfile()->LoopTimeCount()))) << " per sec <BR>";
else
myStream << "Simulation Cycles: Greater than 10000 <BR> ";
}
else
{
myStream << "Simulation Cycles: 0<BR> ";
}
ParsedContent.replace( Pos, 10, myStream.str() );
Pos = ParsedContent.find( "%simcycles" );
2002-04-07 20:53:41 +00:00
}
// Update Time in SECONDS
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
Pos = ParsedContent.find( "%updatetime" );
while( Pos != std::string::npos )
2002-04-07 20:53:41 +00:00
{
std::string strUpdateTimer = strutil::number( UpdateTimer );
(cwmWorldState->GetKeepRun())?ParsedContent.replace( Pos, 11, strUpdateTimer ):ParsedContent.replace( Pos, 11, "0" );
Pos = ParsedContent.find( "%updatetime" );
2002-04-07 20:53:41 +00:00
}
// End Replacing Placeholders
// Print the Content out to the new file...
std::ofstream Output;
Output.open( OutputFile.c_str(), std::ios::out );
if( Output.is_open() )
2002-04-07 20:53:41 +00:00
{
Output << ParsedContent;
Output.close();
2002-04-07 20:53:41 +00:00
}
else
Console.error( strutil::format(" Couldn't open the template file %s for writing", OutputFile.c_str()) );
2002-04-07 20:53:41 +00: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
//o-----------------------------------------------------------------------------------------------o
//| Function - void Poll( void )
//o-----------------------------------------------------------------------------------------------o
2002-04-07 20:53:41 +00:00
//| Purpose - Updates the page if needed
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
//o-----------------------------------------------------------------------------------------------o
void cHTMLTemplate::Poll( void )
2002-04-07 20:53:41 +00:00
{
if( ScheduledUpdate < cwmWorldState->GetUICurrentTime() || !cwmWorldState->GetKeepRun() )
2002-04-07 20:53:41 +00:00
{
Process();
ScheduledUpdate = BuildTimeValue( (R32)UpdateTimer );
}
}
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
//o-----------------------------------------------------------------------------------------------o
//| Function - void LoadTemplate( void )
//o-----------------------------------------------------------------------------------------------o
//| Purpose - Loads the Template into memory
//|
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 - 08062003 - Updated this member function to actually handle
//| loading the different templates for use later.
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
//o-----------------------------------------------------------------------------------------------o
2002-04-07 20:53:41 +00:00
void cHTMLTemplate::LoadTemplate( void )
{
Content = "";
2002-04-07 20:53:41 +00:00
std::ifstream InputFile1( InputFile.c_str() );
2002-04-07 20:53:41 +00:00
if( !InputFile1.is_open() )
{
Console.error( strutil::format("Couldn't open HTML Template File %s", InputFile.c_str()) );
return;
}
while( !InputFile1.eof() && !InputFile1.fail() )
{
std::string Line;
std::getline( InputFile1, Line );
Content += Line;
}
2002-04-07 20:53:41 +00:00
InputFile1.close();
2002-04-07 20:53:41 +00:00
Loaded = true;
2002-04-07 20:53:41 +00: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
//o-----------------------------------------------------------------------------------------------o
//| Function - void UnloadTemplate( void )
//o-----------------------------------------------------------------------------------------------o
2002-04-07 20:53:41 +00:00
//| Purpose - Unloads the Template (i.e. for reloading)
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 - 08062003 - Updated to properly unload a template
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
//| and to unload the correect template, instead of just the
//| status template.
//o-----------------------------------------------------------------------------------------------o
2002-04-07 20:53:41 +00:00
void cHTMLTemplate::UnloadTemplate( void )
{
Content="";
2002-04-07 20:53:41 +00:00
Loaded = false;
}
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
//o-----------------------------------------------------------------------------------------------o
//| Function - void Load( ScriptSection *found )
//o-----------------------------------------------------------------------------------------------o
2002-04-07 20:53:41 +00:00
//| Purpose - Loads the HTML Template from a ScriptSection
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
//o-----------------------------------------------------------------------------------------------o
2002-04-07 20:53:41 +00:00
void cHTMLTemplate::Load( ScriptSection *found )
{
std::string tag, data, UTag, UData, fullPath;
2002-04-07 20:53:41 +00:00
for( tag = found->First(); !found->AtEnd(); tag = found->Next() )
{
data = found->GrabData();
UTag = strutil::upper( tag );
if( UTag == "UPDATE" )
{
UpdateTimer = static_cast<UI32>(std::stoul(data, nullptr, 0));
}
else if( UTag == "TYPE" )
2002-04-07 20:53:41 +00:00
{
UData = strutil::upper( data );
if( UData == "STATUS" )
{
Type = ETT_ONLINE;
}
else if( UData == "OFFLINE" )
{
2002-04-07 20:53:41 +00:00
Type = ETT_OFFLINE;
}
else if( UData == "PLAYER" )
{
2002-04-07 20:53:41 +00:00
Type = ETT_PLAYER;
}
else if( UData == "GUILD" )
{
2002-04-07 20:53:41 +00:00
Type = ETT_GUILD;
}
else if( UData == "GMSTATUS" )
{
Type = ETT_GMSTATUS;
}
2002-04-07 20:53:41 +00:00
}
else if( UTag == "INPUT" )
2002-04-07 20:53:41 +00:00
{
fullPath = cwmWorldState->ServerData()->Directory( CSDDP_DEFS ) + "html/" + data;
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
//LOOKATME
InputFile = strutil::trim(fullPath).substr( 0, MAX_PATH - 1 );
2002-04-07 20:53:41 +00:00
}
else if( UTag == "OUTPUT" )
2002-04-07 20:53:41 +00:00
{
fullPath = cwmWorldState->ServerData()->Directory( CSDDP_HTML ) + data;
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
//LOOKATME
OutputFile = strutil::trim(fullPath).substr( 0, MAX_PATH - 1 );
2002-04-07 20:53:41 +00:00
}
else if( UTag == "NAME" )
2002-04-07 20:53:41 +00:00
Name = data;
}
2002-04-07 20:53:41 +00:00
ScheduledUpdate = 0;
Loaded = false;
}
cHTMLTemplates::cHTMLTemplates()
{
Templates.resize( 0 );
2002-04-07 20:53:41 +00:00
}
cHTMLTemplates::~cHTMLTemplates()
{
Unload();
2002-04-07 20:53:41 +00: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
//o-----------------------------------------------------------------------------------------------o
//| Function - void Load( void )
//o-----------------------------------------------------------------------------------------------o
2002-04-07 20:53:41 +00:00
//| Purpose - Loads the HTML Templates from the scripts
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
//o-----------------------------------------------------------------------------------------------o
2002-04-07 20:53:41 +00:00
void cHTMLTemplates::Load( void )
{
for( Script *toCheck = FileLookup->FirstScript( html_def ); !FileLookup->FinishedScripts( html_def ); toCheck = FileLookup->NextScript( html_def ) )
2002-04-07 20:53:41 +00:00
{
2021-06-12 07:30:23 -04:00
if( toCheck != nullptr )
2002-04-07 20:53:41 +00:00
{
size_t NumEntries = toCheck->NumEntries();
2002-04-07 20:53:41 +00:00
if( NumEntries == 0 )
continue;
2002-04-07 20:53:41 +00:00
2021-06-12 07:30:23 -04:00
for( ScriptSection *found = toCheck->FirstEntry(); found != nullptr; found = toCheck->NextEntry() )
2002-04-07 20:53:41 +00:00
{
cHTMLTemplate *Template = new cHTMLTemplate();
Template->Load( found );
Templates.push_back( Template );
}
}
}
}
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
//o-----------------------------------------------------------------------------------------------o
//| Function - void Unload( void )
//o-----------------------------------------------------------------------------------------------o
2002-04-07 20:53:41 +00:00
//| Purpose - Unloads all Templates
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
//o-----------------------------------------------------------------------------------------------o
2002-04-07 20:53:41 +00:00
void cHTMLTemplates::Unload( void )
{
if( Templates.empty() )
2002-04-07 20:53:41 +00:00
return;
for( size_t i = 0; i < Templates.size(); ++i )
2002-04-07 20:53:41 +00:00
{
delete Templates[ i ];
2021-06-12 07:30:23 -04:00
Templates[i] = nullptr;
2002-04-07 20:53:41 +00:00
}
Templates.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
//o-----------------------------------------------------------------------------------------------o
//| Function - void Poll( ETemplateType nTemplateID )
//o-----------------------------------------------------------------------------------------------o
2002-04-07 20:53:41 +00:00
//| Purpose - Polls the templates for updates
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
//o-----------------------------------------------------------------------------------------------o
void cHTMLTemplates::Poll( ETemplateType nTemplateID )
2002-04-07 20:53:41 +00:00
{
std::vector< cHTMLTemplate* >::const_iterator tIter;
for( tIter = Templates.begin(); tIter != Templates.end(); ++tIter )
2002-04-07 20:53:41 +00:00
{
cHTMLTemplate *toPoll = (*tIter);
2021-06-12 07:30:23 -04:00
if( toPoll != nullptr )
{
if( nTemplateID == -1 || toPoll->GetTemplateType() == nTemplateID )
toPoll->Poll();
}
2002-04-07 20:53:41 +00: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
//o-----------------------------------------------------------------------------------------------o
//| Function - void TemplateInfoGump( CSocket *mySocket )
//o-----------------------------------------------------------------------------------------------o
2002-04-07 20:53:41 +00:00
//| Purpose - Shows an information gump about current templates
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
//o-----------------------------------------------------------------------------------------------o
void cHTMLTemplates::TemplateInfoGump( CSocket *mySocket )
2002-04-07 20:53:41 +00:00
{
CGump InfoGump = CGump( false, false );
InfoGump.SetSerial( 1 ); // Serial for the HTML Status Callback
InfoGump.StartPage();
// Add an exit button
InfoGump.AddButton( 40, 300, cwmWorldState->ServerData()->ButtonCancel(), static_cast<UI16>( cwmWorldState->ServerData()->ButtonCancel() + 1 ), 1, 0, 0 );
2002-04-07 20:53:41 +00:00
InfoGump.AddBackground( 0, 0, cwmWorldState->ServerData()->BackgroundPic(), 350, 350 );
2002-04-07 20:53:41 +00:00
// 10 Max Templates per page
UI32 Entries = 0; // Entries per page
UI16 CurrentPage = 0; // Page
2002-04-07 20:53:41 +00:00
for( UI32 i = 0; i < Templates.size(); ++i )
2002-04-07 20:53:41 +00:00
{
if( Entries == 0 )
{
// We should add a next button if we're not starting the first page
if( CurrentPage != 0 )
InfoGump.AddButton( 300, 250, cwmWorldState->ServerData()->ButtonRight(), static_cast<UI16>( cwmWorldState->ServerData()->ButtonRight() + 1 ), 0, static_cast<UI16>( CurrentPage + 1 ), 0 );
2002-04-07 20:53:41 +00:00
CurrentPage = InfoGump.StartPage();
}
// If we're not on the first page add the "back" button
if( CurrentPage > 1 )
InfoGump.AddButton( 30, 250, cwmWorldState->ServerData()->ButtonLeft(), static_cast<UI16>( cwmWorldState->ServerData()->ButtonLeft() + 1 ), 0, static_cast<UI16>( CurrentPage - 1 ), 0 );
2002-04-07 20:53:41 +00:00
++Entries;
2002-04-07 20:53:41 +00:00
// ~25 pixel per entry
InfoGump.AddText( 40, static_cast<UI16>( 40 + (Entries-1)*25 ), cwmWorldState->ServerData()->LeftTextColour(), strutil::format( "%s (%i)", Templates[ i ]->GetName().c_str(), i ) );
2002-04-07 20:53:41 +00:00
if( Entries == 5 )
Entries = 0;
}
InfoGump.Send( mySocket );
}
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
//o-----------------------------------------------------------------------------------------------o
//| Function - std::string GetName( void ) const
//o-----------------------------------------------------------------------------------------------o
2002-04-07 20:53:41 +00:00
//| Purpose - Returns the name of the Template
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
//o-----------------------------------------------------------------------------------------------o
std::string cHTMLTemplate::GetName( void ) const
2002-04-07 20:53:41 +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
return Name;
2002-04-07 20:53:41 +00: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
//o-----------------------------------------------------------------------------------------------o
//| Function - std::string GetOutput( void ) const
//o-----------------------------------------------------------------------------------------------o
2002-04-07 20:53:41 +00:00
//| Purpose - Gets the Output Filename
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
//o-----------------------------------------------------------------------------------------------o
std::string cHTMLTemplate::GetOutput( void ) const
2002-04-07 20:53:41 +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
return OutputFile;
2002-04-07 20:53:41 +00: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
//o-----------------------------------------------------------------------------------------------o
//| Function - std::string GetInput( void ) const
//o-----------------------------------------------------------------------------------------------o
2002-04-07 20:53:41 +00:00
//| Purpose - Gets the Input Filename
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
//o-----------------------------------------------------------------------------------------------o
std::string cHTMLTemplate::GetInput( void ) const
2002-04-07 20:53:41 +00:00
{
return InputFile;
}
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
//o-----------------------------------------------------------------------------------------------o
//| Function - UI32 GetScheduledUpdate( void ) const
//o-----------------------------------------------------------------------------------------------o
2002-04-07 20:53:41 +00:00
//| Purpose - Gets the next scheduled Update time
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
//o-----------------------------------------------------------------------------------------------o
UI32 cHTMLTemplate::GetScheduledUpdate( void ) const
2002-04-07 20:53:41 +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
return ScheduledUpdate;
2002-04-07 20:53:41 +00: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
//o-----------------------------------------------------------------------------------------------o
//| Function - UI32 GetUpdateTimer( void ) const
//o-----------------------------------------------------------------------------------------------o
2002-04-07 20:53:41 +00:00
//| Purpose - Gets the Update timer
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
//o-----------------------------------------------------------------------------------------------o
UI32 cHTMLTemplate::GetUpdateTimer( void ) const
2002-04-07 20:53:41 +00:00
{
return UpdateTimer;
}
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
//o-----------------------------------------------------------------------------------------------o
//| Function - ETemplateType GetTemplateType( void ) const
//o-----------------------------------------------------------------------------------------------o
2002-04-07 20:53:41 +00:00
//| Purpose - Gets the Template Type
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
//o-----------------------------------------------------------------------------------------------o
ETemplateType cHTMLTemplate::GetTemplateType( void ) const
2002-04-07 20:53:41 +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
return Type;
2002-04-07 20:53:41 +00:00
}