2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
2002-04-07 20:53:41 +00:00
//| cConsole.cpp
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
2002-04-07 20:53:41 +00:00
//| In essence, CConsole is our nice generic class for outputting display.
//| As long as the interface is kept the same, we can display whatever we wish
//| too. We store a set of coordinates being the window corner and size, for
//| systems with windowing support, which describes the window we are in.
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
2002-04-07 20:53:41 +00:00
//| Version History
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
//| 1.7 Added comments (29. October 2001)
//| 2.0 Added filter masking (22nd January 2002)
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
2002-04-07 20:53:41 +00:00
// Header
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"
2002-04-07 20:53:41 +00:00
# include "cConsole.h"
2012-11-03 18:11:04 +00:00
# include "cThreadQueue.h"
# include "ObjectFactory.h"
# include "network.h"
# include "ssection.h"
# include "CJSMapping.h"
# include "teffect.h"
# include "cMagic.h"
# include "magic.h"
# include "regions.h"
# include "commands.h"
# include "cServerDefinitions.h"
# include "cHTMLSystem.h"
# include "cRaces.h"
# include "cGuild.h"
# include "cScript.h"
Numerous changes with focus on feature and stability parity across Windows, Linux and MacOS platforms
Added new Makefile that handles compiling UOX3 and Spidermonkey on both Linux and MacOS (punt)
Added VS solution (SpiderMonkey.sln) and VC++ project files for compiling SpiderMonkey on Windows (Xuri)
Updated SpiderMonkey from v1.6.0 to v1.7.0
Added optimization flag -O2 for release build in CMakeLists.txt in project root (Xuri)
Added StringUtility file with general common string manipulation functions (punt)
Updated RandomNum function to use a "seedless" random number generator from C++11 instead of the old C rand() function. (punt)
Overall code cleanup to remove/replace platform-dependent code (punt)
Replaced potentially unsafe usage of C string stuff like sprintf, vsprintf, vsnprintf, strncat, strcpy and strlen throughout the code with calls to a format() function containing only a single, safe use of vsnprintf, ensuring there's a single place of failure if there's anything to fix and and making it easy to potentially replace this with std::format from C++20 when the time comes. (punt)
Replaced usage of char in many places with std::string (punt)
Started process of replacing UString usage with functions provided through StringUtility instead (punt)
Replaced platform specific fileIO handling in Windows/Linux with cross-platform C++17 standard std::filesystem (punt)
Replaced platform specific time handling by using cross-platform chrono library (punt)
Removed UOX namespace to reduce complexity (punt)
Elimitated template code approach to singletons for more modern c++ constructs, removing dependices in the process (punt)
Removed ODBC support; it hasn't been touched since the initial implementation in 2008, and there is a lack of someone to maintain the code. (punt)
Removed some platform specific files like uoxlinux.h, which is no longer required (punt)
Removed legacy crash protection code, and removed support for cluox (punt)
Removed legacy "support" for Borland compiler (punt)
Removed legacy VC++ 6 Workspace/Project files, VS2005 Solution/Project files, as these are no longer supported (Xuri)
Removed legacy BUILD folder with outdated compilation instructions (Xuri)
Removed old Changelog file (merged into Changelog.txt) (Xuri)
Fixed a pointer bug for items in multis on world load (punt)
Fixed a dictionary related issue that caused segmentation faults on Linux/MacOS (punt)
Fixed an issue with callbacks to JS scripts that caused segmentation faults on Linux/MacOS (punt)
Paths in uox.ini should now load properly on all platforms regardless of whether those paths use slashes or backslashes, and whether or not they end in a slash/backslash. (punt)
Moved to c++17 style of threading, and got rid of threadsafeobject.cpp/h (punt)
Replaced parsing of UOX.INI tags with a system that's more easily maintainable (punt)
Added some new commands to js/commands/custom/misc-cmd.js (Xuri)
cont // Targeted item will be made a container, set to nondecay and movable 2
endfight // Targeted character (and character being fought) will stop fighting
getmulti // Get multiObject for targeted item
finditem // Find item at layer X
movespeed // Set movement speed of target player (0x0 Normal, 0x1 Mounted, 0x2 Slow (walk only), 0x3 Hybrid ("jog"?), 0x4 Frozen)
Added new HTML based documentation in docs folder, and removed many old legacy docs that are either incorporated into this document already or no longer relevant for the current UOX3 version (Xuri)
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2020-09-07 18:09:55 +08:00
# include "StringUtility.hpp"
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
# include <iostream>
0.99.4v
Added JS command to reload dictionaries
'reloaddictionaries
Fixed a server crash related to casting of spells
Fixed some issues with Line-of-Sight checks related to items under/above ground, LoS checks between different floors of buildings, etc.
Updated handling of skill-training keywords to be based on language-independent keyword IDs rather than trying to match player-input text to specific skill-names
Updated animal-trainer/stablemasterscript (js/npc/ai/stablemaster.js) with several changes:
Fixed an issue where the same pet would be stabled in all available slots if payment was taken from player's bank account instead of their backpack
Fixed an issue where stablemaster would not pause walking for a while when a player interacts with them
Converted all system messages and text messages in stablemaster script to dictionary entries
Added new NPC AI type to source - AI_STABLEMASTER (9) - and assigned this to animal trainers. This is used to identify this type of NPCs for the purpose of displaying relevant context menus
Reworked banker AI script (js/npc/ai/banker.js) to use triggerwords from client instead of hard-defined strings, to work better with multiple languages (and work with all relevant triggerwords)
Fixed a bug with banker AI script (js/npc/ai/banker.js) that prevented players from using the "withdraw" command
Re-added NPC AI 8 to banker NPCs (dfndata/npc/male_vendors.dfn and female_vendors.dfn) so code can check for presence of this AI when handling context menus
Removed remaining hard-coded banking functionality - all handled by script anyway
Added new context menu option for NPC bankers - Open Bankbox
Updated code handling of context menus to only show context menus when relevant:
Open Paperdoll - Shows for all characters with a paperdoll
Open Backpack - Shows for player's character, pack animals and hirelings
Open Bankbox - Shows for banker NPCs (if within 8 tiles)
Buy/Sell - Shows for vendor NPCs (if within 8 tiles, and if they have anything for sale/are buying anything)
Added new context menu entries for pets, which can be used if player is within 12 tiles of pet:
Command: Kill
Command: Stop
Command: Follow
Command: Stay
Command: Guard
Add Friend
Remove Friend
Transfer
Release
Added new context menu entries for stablemasters/animal trainers:
Claim All Pets
Stable Pet
Added new context menu entries for Escort Quest NPCs
Ask Destination (if within 3 tiles)
Accept Escort (if within 3 tiles)
Abandon Escort
Added new context menus for NPCs that can teach skills to players (limited to max 10 per NPC)
Train [skillName]
Added new AI script for NPC hirelings (3204=js/npc/ai/hireling.js), who can be hired to follow the player around for a limited amount of time, and function the same way as pets. In addition to the regular pet commands, these speech commands are supported:
hire // The hireling will respond with the cost to hire them
dismiss // Replaces the "release" command for pets; will dismiss the hireling
patrol // The hireling will patrol between it's current location and a second targeted location nearby
move // The hireling will try to shuffle out of the way
fetch // The hireling will try to fetch a targeted item
drop // The hireling will drop to the ground all loot they're currently carrying
report // The hireling will report on the remaining time they're hired for
Added new NPC DFN tag used by code to detect hireling NPCs for the purpose of displaying context menus:
HIRELING // No additional value/data needed for tag
Added new context menu entries for Hireling NPCs, in addition to the ones for regular pets:
Hire // Can be used within 3 steps of the hireling, who will respond with cost to hire them
Dismiss // Replaces the "release" command for pets, will dismiss the hireling
Added HIRELING tag and SCRIPT=3204 to and updated stats of various NPCs that will be hireable:
m_fighter, f_fighter, m_beggar, f_beggar, m_peasant, f_peasant, m_sailor, f_sailor, m_pirate, f_pirate
Added new hireling NPC:
m_paladin, f_paladin
Added new UOX ini setting to enable/disable context menus
CONTEXTMENUS=1/0 (defaults to 1)
Added new Item JS Method to check if an item's ID is on a specified food list
.IsOnFoodList( foodList ) // Returns true/false if item's ID is on specified foodList
Added new OMNIVORE food list and assigned it to [basehuman] DFN section
Added new Character JS Properties
.isGuarded // Gets/Sets whether character is guarded by a pet/hireling
.guarding // Gets/Sets the object (if any) being guarded by a pet/hireling
Fixed multiple issues with health bars, flagging and character highlighting
Added some crash protection for invalid data used with CUSTOMINTTAG and CUSTOMSTRINGTAG DFN tags for Items, NPCs and Multis
Fixed an issue which prevented hard-coded checks from running when using items
Added new global js object (Timer) to make the use of character timers in JS more robust, with properties matching timer names from enum in source.
Properties:
.TIMEOUT // Time until next attack can be done in combat
.INVIS // Time until invisible character becomes visible
.HUNGER // Time until character grows more hungry
.THIRST // Time until character grows more thirsty
.POISONTIME // Time until next tick of poison damage
.POISONTEXT // Time until next message about suffering from poison
.POISONWEAROFF // Time until poison wears off
.SPELLTIME // Time until spell cast is completed. Can be set to 0 to interrupt
.ANTISPAM // Time until next speech message can be sent (for anti spam purposes)
.CRIMFLAG // Time until criminal flag runs out
.MURDERRATE // Time until next murder count decay
.PEACETIMER // Time until character can re-enter combat after being affected by peacemaking
.FLYINGTOGGLE // Time until next time flying ability can be toggled for gargoyles
.MOVETIME // Time until NPC can move again
.SPATIMER // Time until next time NPC can cast a spell
.SUMMONTIME // Time until a summoned NPC will vanish
.EVADETIME // Time until an NPC will exit evade state
.LOGOUT // Time it takes for a player char to vanish after logout
Examples of use:
var hungerTimer = myChar.GetTimer( Timer.HUNGER )
myChar.SetTimer( Timer.HUNGER, 15000 )
Added new Character JS Methods to add, remove and list friends of a pet/hireling:
.AddFriend( playerToAdd ) // Adds player to friend list
.RemoveFriend( playerToRemove ) // Removes player from friend list
.GetFriendList() // Gets list of friends
.ClearFriendList() // Clears list of friends
Added new Character JS Method to fetch a player character's list of pets/followers
.GetPetList() // Gets list of pets/followers
Added new persistent NPC property to keep track of a pet's previous owners, whether those tamed the pet or had it transferred to them. Every time a pet is tamed, or is transferred to a new owner, this list is updated:
GenericList< CChar * > petOwnerList
Added new Character JS Method to check if a player is on a pet's owner list as a previous owner:
.HasBeenOwner( mChar )
Previous owners of a pet can re-tame it with guaranteed chance of success
Updated JS Method Refresh() to be usable with both items or characters, to send updated state of object to nearby players
Added character tooltip [Guarded] for characters being guarded by a pet/hireling
Pets/hirelings that are transferred will now immediately start following their new master instead of wandering freely
Pets/hirelings can no longer be transferred between players as long as either party is flagged as a criminal
Pets/hirelings can no longer be transferred to dead players
Pets/hirelings can no longer be transferred to NPCs
Summoned creatures can no longer be transferred to other players
Summoned creatures can no longer have friends
Friend lists of pets/hirelings are now cleared when the pet/hireling is transferred to another player
Added new UOX.INI settings to control how many pets players can have active:
MAXCONTROLSLOTS=0 // Maximum number of pet control slots available to player. Disabled if 0
MAXFOLLOWERS=5 // Maximum pets/followers a player can have active at the same time. Used if control slots are disabled
MAXPETOWNERS=5 // Maximum number of different owners a pet can have over its lifetime before it becomes impossible to retame
Added new NPC property and NPC DFN tag that keeps track of how many pet control slots an NPC would take up if owned by a player:
UI08 controlSlots // source property
CONTROLSLOTS=# // DFN tag
Added new Character JS properties:
.ownerCount // Get the total number of owners a pet/hireling has had, based on NPC's petOwnerList
.controlSlots // Get/Set number of pet control slots an NPC will occupy
.controlSlotsUsed // Get/Set the number of control slots used by a player
Updated get (js/commands/targeting/get.js) and set (js/commands/targeting/set.js) commands to support getting/setting the following character properties:
deaths
ownerCount (read only)
controlSlots
controlSlotsUsed
Updated NPC DFNs with default CONTROLSLOT=# tags
Increased the max distance from player that onSpeech JS event will trigger from 7 to 12
Updated how "all attack" and "all follow" commands for pets are handled. Now loops through all pets owned by character and executes command for each eligible pet
Fixed an issue where NPCs could follow characters in different worlds/instances than them selves
Updated default max amount of items that can be sold to NPC vendors from 5 to 250
Guards can no longer train players in skills
Updated equipment itemlists (dfndata/items/itemlists/itemlists.dfn) with blank entries to introduce some more variety in the type of clothes NPCs wear in general
Added new NPCs to DFNs (dfndata/npc/undead.dfn) and added them to undead npclist:
[skeletalmage] // variation of [bonemage]
[skeletalknight] // variation of [boneknight]
Updated Titles (dfndata/titles/titles.dfn) with up-to-date titles for skills around Pub 15, and added titles for skills added after that. Also added "Elder" and "Legendary" titles for 110 and 120 skillpoints
Updated EQUIPITEM tag in newbie.dfn (dfndata/newbie/newbie.dfn) to support an optional hue parameter (EQUIPITEM=id,hue)
Updated starting equipment for new characters (dfndata/newbie/newbie.dfn), with commented out practice weapons. Uncomment to use
Added item definitions for practice weapons (dfndata/items/gear/weapons/practice_weapons.dfn):
practice_skinning_knife
practice_hatchet
practice_axe
practice_mace
practice_longsword
practice_spear
practice_bow
practice_club
practice_crook
practice_gnarled_staff
Updated mount statues DFN (dfndata/items/misc/mount-statues.dfn) and JS (js/npc/pets/*.js) files to include pet control slot related stuff
Pets now inherit the karma of their owners, but revert to their original karma upon release
Pets and hirelings will no longer follow the ghosts of their dead owners, but stay to guard their corpse
Added optional 9th parameter for JS Function CreateDFNItem to specify a color for item created. This comes before the other optional parameters - worldNumber and instanceID (which are only used if character is NULL):
CreateDFNItem( mSock, mChar, sectionName, inPack, iAmount, itemType, iColor, worldNumber, instanceID )
Added ID of Giant Beetle to various pack animal checks
Pack animals will now drop any newbie/blessed items stored in their packs upon death
Added new NPC properties to track pet loyalty, and exposed these as Character JS properties, and NPC DFN tags:
JS Properties
.maxLoyalty // Defaults to 100
.loyalty // Starts at 25
DFN Tags
MAXLOYALTY=# // Defaults to 100
LOYALTY=# // Starts at 25
Updated TriggerEvent JS function to support return values (int, bool, string, object) from called script
Updated various JS scripts to make use of new TriggerEvent functionality and reduce reliance on custom tags:
js/item/archerybutte.js
js/item/trainingdummy.js
js/server/data/combatanims.js
js/server/data/weapontypes.js
Updated archerybutte script to use dictionary for system and text messages
Updated archerybutte script to support increased range, distance penalty and dex/str bonuses when calculating score
Added new UOX.INI settings under [pets and hirelings] section related to pet control and loyalty:
CHECKPETCONTROLDIFFICULTY=1 // Enable/Disable pet control difficulty system
PETLOYALTYGAINONSUCCESS=1 // Amount of pet loyalty gained on successful pet command use
PETLOYALTYLOSSONFAILURE=3 // Amount of pet loyalty lost on failed pet command use
PETLOYALTYRATE=900 // Amount of seconds between each time pet loyalty is automatically reduced by 1. Takes 25 hours to deplete completely from max
Added new persistent NPC property that keeps track of the difficulty of taming and controlling a pet, and exposed it as a Character JS property:
.orneriness
Every time a tamed pet is released or goes wild, its "orneriness" increases, making it more difficult for other players to tame, and more difficult for anyone to control.
Updated CBasePetResponse::canControlPet() function to use pet control difficulty system if enabled, which checks player's animal taming/animal lore skill vs a pet's "orneriness" to determine chance of pet accepting a given pet command
On successful use of pet command, increases pet loyalty by value defined in PETLOYALTYGAINONSUCCESS ini setting
On failed use of pet command, decreases pet loyalty by value defined in PETLOYALTYLOSSONFAILURE ini setting
Added new Character JS Method to calculate chance of a player successfully controlling the pet:
.CalculateControlChance( mChar ) // Returns value between 0 and 1000 indicating chance of success
Feeding a pet will now restore its loyalty to maximum
Pets will now lose loyalty on hunger checks when at maximum hunger
Pets that are maximum hungry will now only have a chance to go wild if loyalty has dropped to zero
Added new DFN tag for creatures.dfn - TYPE - which contains a string describing the type of creature
Added secure pet trading. Players who trade pets will now see a pet transfer deed appear in a secure trade window with the name and type of creature, and upon completion of the trade the associated pet will be instantly transferred to the other player
Updated resource JS scripts (js/server/resource/*) to use dictionaries for all system messages
Updated skill JS scripts (js/skill/*) to use dictionaries for all system messages
Updated housing JS scripts (js/server/house/*) to use dictionaries for all system messages
Updated item JS scripts (js/item/*) to use dictionaries for all system messages
Updated magic JS scripts (js/magic/*) to use dictionaries for all system messages
Updated NPC AI JS scripts (js/npc/ai/*) to use dictionaries for all system messages
Updated command JS scripts (js/commands/*) to use dictionaries for all system messages, gump tooltips, etc
Updated code to use dictionaries for all system messages
Fixed incorrect spelling for UOX.INI setting HIDEW(H)ILEMOUNTED and updated hiding skill (js/skill/hiding.js) to actually allow/disallow hiding while mounted based on this setting
Added new Character JS Method to make it easier to make one NPC initiate combat with another:
.InitiateCombat( targetChar ) // Character attempts to initiate combat with target character
Updated parrying portion of combat code to be in line with Pub15/pre-AoS parrying mechanics. High AR shields now absorb more damage on a successful parry, while low AR shields have a higher chance of parrying. Shields are also now more effective against archery attacks (full absorption potential) than melee attacks (half absorption potential).
Updated combat damage calculations to be in line with Pub15/pre-AoS damage calculations
Adjusted default value of COMBATNPCDAMAGERATE ini setting (damage divisor when target is a player) from 2 to 1 to account for these changes.
Removed dictionary.UNK, and made dictionary.ZRO the default dictionary used for all unsupported languages
Added dictionary support for additional languages: Portuguese, Italian, Czech
Updated default dictionaries for the following languages: English, French
Added default dictionaries for the following languages: German, Spanish, Portuguese, Italian, Czech (note that translations have been provided by automatic services and will contain inaccuracies!)
Added new UOX.INI setting to allow specifying a default dictionary language for server, which if set will force that language for all dictionary messages, regardless of client settings:
SERVERLANGUAGE=0 // Set default server dictionary language. Supported languages: 0 - None/language used by each client, 1 - English, 2 - German, 3 - Spanish, 5 - French, 6 - Portuguese, 7 - Italian, 8 - Czech
Added new function in combat.cpp - AdjustArmorClassDamage() - which adjusts the damage dealt in combat based on whether armour class (AC DFN tag or .ac JS property) of weapon and armour equipped on hit location of target match up. A weapon with armour class 1 would essentially be doubly effective against armour of armour class 1. Allows setting up things like piercing weapons being better against some armor types than mace weapons, etc.
Added new UOX.INI setting under [combat] to enable/disable double damage from armour class bonuses:
ARMORCLASSDAMAGEBONUS=0/1 //defaults to 0)
2021-07-28 16:02:56 +08:00
# include <cctype>
2022-06-26 09:01:30 -04:00
# include <stdexcept>
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
2021-06-12 08:02:17 -04:00
# if PLATFORM != WINDOWS
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
# include <termios.h>
# include <unistd.h>
Numerous changes with focus on feature and stability parity across Windows, Linux and MacOS platforms
Added new Makefile that handles compiling UOX3 and Spidermonkey on both Linux and MacOS (punt)
Added VS solution (SpiderMonkey.sln) and VC++ project files for compiling SpiderMonkey on Windows (Xuri)
Updated SpiderMonkey from v1.6.0 to v1.7.0
Added optimization flag -O2 for release build in CMakeLists.txt in project root (Xuri)
Added StringUtility file with general common string manipulation functions (punt)
Updated RandomNum function to use a "seedless" random number generator from C++11 instead of the old C rand() function. (punt)
Overall code cleanup to remove/replace platform-dependent code (punt)
Replaced potentially unsafe usage of C string stuff like sprintf, vsprintf, vsnprintf, strncat, strcpy and strlen throughout the code with calls to a format() function containing only a single, safe use of vsnprintf, ensuring there's a single place of failure if there's anything to fix and and making it easy to potentially replace this with std::format from C++20 when the time comes. (punt)
Replaced usage of char in many places with std::string (punt)
Started process of replacing UString usage with functions provided through StringUtility instead (punt)
Replaced platform specific fileIO handling in Windows/Linux with cross-platform C++17 standard std::filesystem (punt)
Replaced platform specific time handling by using cross-platform chrono library (punt)
Removed UOX namespace to reduce complexity (punt)
Elimitated template code approach to singletons for more modern c++ constructs, removing dependices in the process (punt)
Removed ODBC support; it hasn't been touched since the initial implementation in 2008, and there is a lack of someone to maintain the code. (punt)
Removed some platform specific files like uoxlinux.h, which is no longer required (punt)
Removed legacy crash protection code, and removed support for cluox (punt)
Removed legacy "support" for Borland compiler (punt)
Removed legacy VC++ 6 Workspace/Project files, VS2005 Solution/Project files, as these are no longer supported (Xuri)
Removed legacy BUILD folder with outdated compilation instructions (Xuri)
Removed old Changelog file (merged into Changelog.txt) (Xuri)
Fixed a pointer bug for items in multis on world load (punt)
Fixed a dictionary related issue that caused segmentation faults on Linux/MacOS (punt)
Fixed an issue with callbacks to JS scripts that caused segmentation faults on Linux/MacOS (punt)
Paths in uox.ini should now load properly on all platforms regardless of whether those paths use slashes or backslashes, and whether or not they end in a slash/backslash. (punt)
Moved to c++17 style of threading, and got rid of threadsafeobject.cpp/h (punt)
Replaced parsing of UOX.INI tags with a system that's more easily maintainable (punt)
Added some new commands to js/commands/custom/misc-cmd.js (Xuri)
cont // Targeted item will be made a container, set to nondecay and movable 2
endfight // Targeted character (and character being fought) will stop fighting
getmulti // Get multiObject for targeted item
finditem // Find item at layer X
movespeed // Set movement speed of target player (0x0 Normal, 0x1 Mounted, 0x2 Slow (walk only), 0x3 Hybrid ("jog"?), 0x4 Frozen)
Added new HTML based documentation in docs folder, and removed many old legacy docs that are either incorporated into this document already or no longer relevant for the current UOX3 version (Xuri)
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2020-09-07 18:09:55 +08:00
# include <sys/ioctl.h>
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
struct termios initial_terminal_state ;
2012-11-03 18:11:04 +00:00
# else
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
Numerous changes with focus on feature and stability parity across Windows, Linux and MacOS platforms
Added new Makefile that handles compiling UOX3 and Spidermonkey on both Linux and MacOS (punt)
Added VS solution (SpiderMonkey.sln) and VC++ project files for compiling SpiderMonkey on Windows (Xuri)
Updated SpiderMonkey from v1.6.0 to v1.7.0
Added optimization flag -O2 for release build in CMakeLists.txt in project root (Xuri)
Added StringUtility file with general common string manipulation functions (punt)
Updated RandomNum function to use a "seedless" random number generator from C++11 instead of the old C rand() function. (punt)
Overall code cleanup to remove/replace platform-dependent code (punt)
Replaced potentially unsafe usage of C string stuff like sprintf, vsprintf, vsnprintf, strncat, strcpy and strlen throughout the code with calls to a format() function containing only a single, safe use of vsnprintf, ensuring there's a single place of failure if there's anything to fix and and making it easy to potentially replace this with std::format from C++20 when the time comes. (punt)
Replaced usage of char in many places with std::string (punt)
Started process of replacing UString usage with functions provided through StringUtility instead (punt)
Replaced platform specific fileIO handling in Windows/Linux with cross-platform C++17 standard std::filesystem (punt)
Replaced platform specific time handling by using cross-platform chrono library (punt)
Removed UOX namespace to reduce complexity (punt)
Elimitated template code approach to singletons for more modern c++ constructs, removing dependices in the process (punt)
Removed ODBC support; it hasn't been touched since the initial implementation in 2008, and there is a lack of someone to maintain the code. (punt)
Removed some platform specific files like uoxlinux.h, which is no longer required (punt)
Removed legacy crash protection code, and removed support for cluox (punt)
Removed legacy "support" for Borland compiler (punt)
Removed legacy VC++ 6 Workspace/Project files, VS2005 Solution/Project files, as these are no longer supported (Xuri)
Removed legacy BUILD folder with outdated compilation instructions (Xuri)
Removed old Changelog file (merged into Changelog.txt) (Xuri)
Fixed a pointer bug for items in multis on world load (punt)
Fixed a dictionary related issue that caused segmentation faults on Linux/MacOS (punt)
Fixed an issue with callbacks to JS scripts that caused segmentation faults on Linux/MacOS (punt)
Paths in uox.ini should now load properly on all platforms regardless of whether those paths use slashes or backslashes, and whether or not they end in a slash/backslash. (punt)
Moved to c++17 style of threading, and got rid of threadsafeobject.cpp/h (punt)
Replaced parsing of UOX.INI tags with a system that's more easily maintainable (punt)
Added some new commands to js/commands/custom/misc-cmd.js (Xuri)
cont // Targeted item will be made a container, set to nondecay and movable 2
endfight // Targeted character (and character being fought) will stop fighting
getmulti // Get multiObject for targeted item
finditem // Find item at layer X
movespeed // Set movement speed of target player (0x0 Normal, 0x1 Mounted, 0x2 Slow (walk only), 0x3 Hybrid ("jog"?), 0x4 Frozen)
Added new HTML based documentation in docs folder, and removed many old legacy docs that are either incorporated into this document already or no longer relevant for the current UOX3 version (Xuri)
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2020-09-07 18:09:55 +08:00
# include <conio.h>
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
# undef min
# undef max
DWORD initial_terminal_state ;
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
# endif
2022-06-11 07:55:06 -04:00
using namespace std : : string_literals ;
CEndL myendl ;
2002-04-07 20:53:41 +00:00
2022-10-24 18:39:33 +08:00
constexpr auto NORMALMODE = std : : uint8_t ( 0 ) ;
constexpr auto WARNINGMODE = std : : uint8_t ( 1 ) ;
constexpr auto ERRORMODE = std : : uint8_t ( 2 ) ;
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
//const UI08 COLOURMODE = 3;
2022-10-24 18:39:33 +08:00
const std : : string CConsole : : ESC = " \x1b " s ;
const std : : string CConsole : : CSI = CConsole : : ESC + " [ " s ;
const std : : string CConsole : : BEL = " \x07 " s ;
2022-06-11 07:55:06 -04:00
// Command sequences
2022-10-24 18:39:33 +08:00
const std : : string CConsole : : ATTRIBUTE = CConsole : : CSI + " #m " s ; // find/replace on # with attribute number
const std : : string CConsole : : MOVE = CConsole : : CSI + " ROW;COLH " s ; // we are going to find/replace on ROW/COL
const std : : string CConsole : : HORIZMOVE = CConsole : : CSI + " COLG " s ;
const std : : string CConsole : : VERTMOVE = CConsole : : CSI + " ROWd " s ;
const std : : string CConsole : : OFFCURSOR = CConsole : : CSI + " ?25l " s ;
const std : : string CConsole : : ONCURSOR = CConsole : : CSI + " ?25h " s ;
2022-06-11 07:55:06 -04:00
2022-10-24 18:39:33 +08:00
const std : : string CConsole : : ONGRAPHIC = CConsole : : ESC + " (0 " s ;
const std : : string CConsole : : OFFGRAPHIC = CConsole : : ESC + " (B " s ;
2022-06-11 07:55:06 -04:00
2022-10-24 18:39:33 +08:00
const std : : string CConsole : : SETTITLE = CConsole : : ESC + " ]2;TITLEs " s + CConsole : : BEL ;
2022-06-11 07:55:06 -04:00
2022-10-24 18:39:33 +08:00
const std : : string CConsole : : CLEAR = CConsole : : CSI + " 2J " s ;
2012-11-03 18:11:04 +00:00
// Forward function declarations
2022-10-24 18:39:33 +08:00
auto EndMessage ( SI32 x ) - > void ;
auto LoadCustomTitle ( ) - > void ;
auto LoadSkills ( ) - > void ;
auto LoadSpawnRegions ( ) - > void ;
auto LoadRegions ( ) - > void ;
auto LoadTeleportLocations ( ) - > void ;
auto LoadCreatures ( ) - > void ;
auto LoadPlaces ( ) - > void ;
auto UnloadRegions ( ) - > void ;
auto UnloadSpawnRegions ( ) - > void ;
auto LoadTeleportLocations ( ) - > void ;
//o------------------------------------------------------------------------------------------------o
Instance-support and misc code cleanup
Misc code and documentation cleanup:
Updated and standardized function comment blocks throughout entire codebase
Grouped getters and setters together in pairs and documented them as one
Removed empty and/or non-useful information from comment blocks
Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors
Added new feature - Instances
Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified.
Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present)
Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present)
Updated TWEAK menu to include WorldNumber and instanceID
Fixed BaseWeight option in TWEAK menu
Updated CBase_Teleport - now takes an optional 5th parameter instanceID
Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID
Updated SE_FindMulti now takes an optional 5th parameter - instanceID
Updated SE_GetItem now takes an optional 5th parameter - instanceID
Updated SE_FindItem now takes an optional 6th parameter - instanceID
Added new JS property for Items, Characters, Regions: .instanceID
Added JS property for Regions: .members - returns comma-separated list of town member serials
Updated JS scripts making use of the above-mentioned JS Methods/Functions
Updated dictionaries with new tweak menu entry texts
Exposed SpawnRegions to JS engine, and updated JS docs with details:
SpawnRegion JS Functions
IterateOverSpawnRegions()
GetSpawnRegion( spawnRegNum )
GetSpawnRegionCount()
SpawnRegion JS Properties
name
regionNum
itemList
npcList
item
npc
maxItems
maxNpcs
itemCount
npcCount
onlyOutside
prefZ
x1
y1
x2
y2
world
instanceID
minTime
maxTime
call
2020-08-08 13:57:15 +08:00
//| Function - CConsole()
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
Instance-support and misc code cleanup
Misc code and documentation cleanup:
Updated and standardized function comment blocks throughout entire codebase
Grouped getters and setters together in pairs and documented them as one
Removed empty and/or non-useful information from comment blocks
Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors
Added new feature - Instances
Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified.
Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present)
Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present)
Updated TWEAK menu to include WorldNumber and instanceID
Fixed BaseWeight option in TWEAK menu
Updated CBase_Teleport - now takes an optional 5th parameter instanceID
Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID
Updated SE_FindMulti now takes an optional 5th parameter - instanceID
Updated SE_GetItem now takes an optional 5th parameter - instanceID
Updated SE_FindItem now takes an optional 6th parameter - instanceID
Added new JS property for Items, Characters, Regions: .instanceID
Added JS property for Regions: .members - returns comma-separated list of town member serials
Updated JS scripts making use of the above-mentioned JS Methods/Functions
Updated dictionaries with new tweak menu entry texts
Exposed SpawnRegions to JS engine, and updated JS docs with details:
SpawnRegion JS Functions
IterateOverSpawnRegions()
GetSpawnRegion( spawnRegNum )
GetSpawnRegionCount()
SpawnRegion JS Properties
name
regionNum
itemList
npcList
item
npc
maxItems
maxNpcs
itemCount
npcCount
onlyOutside
prefZ
x1
y1
x2
y2
world
instanceID
minTime
maxTime
call
2020-08-08 13:57:15 +08:00
//| Purpose - Class Constructor and deconstructor
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
2012-11-03 18:11:04 +00:00
CConsole : : CConsole ( ) : width ( 80 ) , height ( 25 ) ,
2022-10-24 18:39:33 +08:00
currentMode ( NORMALMODE ) , previousColour ( CNORMAL ) , logEcho ( false )
{
is_initialized = false ;
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
}
2022-10-24 18:39:33 +08:00
CConsole : : ~ CConsole ( )
{
if ( is_initialized )
{
MoveTo ( 1 , height ) ;
Reset ( ) ;
2022-06-11 07:55:06 -04:00
}
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::Initialize()
//o------------------------------------------------------------------------------------------------o
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
//| Purpose - Prepare console/terminal for UOX3 output
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : Initialize ( ) - > void
{
is_initialized = true ;
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
# if !defined(_WIN32)
2022-10-24 18:39:33 +08:00
tcgetattr ( 1 , & initial_terminal_state ) ; // get the current state of the terminal
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
auto temp = initial_terminal_state ;
2022-10-24 18:39:33 +08:00
temp . c_lflag = temp . c_lflag & ( ~ ECHO ) & ( ~ ICANON ) ; // Disable echo and canonical (line) mode
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
temp . c_cc [ VMIN ] = 0 ; // in non canonical mode we non blocking read
temp . c_cc [ VTIME ] = 0 ; // in non canonical mode we non blocking read
2022-10-24 18:39:33 +08:00
tcsetattr ( 1 , TCSANOW , & temp ) ;
2012-11-03 18:11:04 +00:00
# else
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
// Set the input to non echo and non canonical (line) mode
2022-10-24 18:39:33 +08:00
auto hco = GetStdHandle ( STD_OUTPUT_HANDLE ) ;
GetConsoleMode ( hco , & initial_terminal_state ) ;
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
auto temp = initial_terminal_state ;
2022-10-24 18:39:33 +08:00
temp = ( temp & ( ~ ENABLE_ECHO_INPUT ) & ( ~ ENABLE_LINE_INPUT ) & ( ~ ENABLE_MOUSE_INPUT ) ) ;
SetConsoleMode ( hco , initial_terminal_state ) ;
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
# endif
}
Numerous changes with focus on feature and stability parity across Windows, Linux and MacOS platforms
Added new Makefile that handles compiling UOX3 and Spidermonkey on both Linux and MacOS (punt)
Added VS solution (SpiderMonkey.sln) and VC++ project files for compiling SpiderMonkey on Windows (Xuri)
Updated SpiderMonkey from v1.6.0 to v1.7.0
Added optimization flag -O2 for release build in CMakeLists.txt in project root (Xuri)
Added StringUtility file with general common string manipulation functions (punt)
Updated RandomNum function to use a "seedless" random number generator from C++11 instead of the old C rand() function. (punt)
Overall code cleanup to remove/replace platform-dependent code (punt)
Replaced potentially unsafe usage of C string stuff like sprintf, vsprintf, vsnprintf, strncat, strcpy and strlen throughout the code with calls to a format() function containing only a single, safe use of vsnprintf, ensuring there's a single place of failure if there's anything to fix and and making it easy to potentially replace this with std::format from C++20 when the time comes. (punt)
Replaced usage of char in many places with std::string (punt)
Started process of replacing UString usage with functions provided through StringUtility instead (punt)
Replaced platform specific fileIO handling in Windows/Linux with cross-platform C++17 standard std::filesystem (punt)
Replaced platform specific time handling by using cross-platform chrono library (punt)
Removed UOX namespace to reduce complexity (punt)
Elimitated template code approach to singletons for more modern c++ constructs, removing dependices in the process (punt)
Removed ODBC support; it hasn't been touched since the initial implementation in 2008, and there is a lack of someone to maintain the code. (punt)
Removed some platform specific files like uoxlinux.h, which is no longer required (punt)
Removed legacy crash protection code, and removed support for cluox (punt)
Removed legacy "support" for Borland compiler (punt)
Removed legacy VC++ 6 Workspace/Project files, VS2005 Solution/Project files, as these are no longer supported (Xuri)
Removed legacy BUILD folder with outdated compilation instructions (Xuri)
Removed old Changelog file (merged into Changelog.txt) (Xuri)
Fixed a pointer bug for items in multis on world load (punt)
Fixed a dictionary related issue that caused segmentation faults on Linux/MacOS (punt)
Fixed an issue with callbacks to JS scripts that caused segmentation faults on Linux/MacOS (punt)
Paths in uox.ini should now load properly on all platforms regardless of whether those paths use slashes or backslashes, and whether or not they end in a slash/backslash. (punt)
Moved to c++17 style of threading, and got rid of threadsafeobject.cpp/h (punt)
Replaced parsing of UOX.INI tags with a system that's more easily maintainable (punt)
Added some new commands to js/commands/custom/misc-cmd.js (Xuri)
cont // Targeted item will be made a container, set to nondecay and movable 2
endfight // Targeted character (and character being fought) will stop fighting
getmulti // Get multiObject for targeted item
finditem // Find item at layer X
movespeed // Set movement speed of target player (0x0 Normal, 0x1 Mounted, 0x2 Slow (walk only), 0x3 Hybrid ("jog"?), 0x4 Frozen)
Added new HTML based documentation in docs folder, and removed many old legacy docs that are either incorporated into this document already or no longer relevant for the current UOX3 version (Xuri)
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2020-09-07 18:09:55 +08:00
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole()::Reset()
//o------------------------------------------------------------------------------------------------o
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
//| Purpose - Reset console/terminal to its original state
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : Reset ( ) - > void
{
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
std : : cout . flush ( ) ;
2022-10-24 18:39:33 +08:00
# if !defined( _WIN32 )
tcsetattr ( 1 , TCSAFLUSH , & initial_terminal_state ) ;
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
std : : cout < < std : : endl ;
# else
2022-10-24 18:39:33 +08:00
auto hco = GetStdHandle ( STD_OUTPUT_HANDLE ) ;
SetConsoleMode ( hco , initial_terminal_state ) ;
2012-11-03 18:11:04 +00:00
# endif
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::SetTitle()
//o------------------------------------------------------------------------------------------------o
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
//| Purpose - Set console/terminal window title
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : SetTitle ( const std : : string & value ) - > void
{
# if !defined( _WIN32 )
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
auto cmd = SETTITLE ;
2022-10-24 18:39:33 +08:00
auto loc = cmd . find ( " TITLE " ) ;
cmd . replace ( loc , 5 , value ) ;
SendCMD ( cmd ) ;
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
# else
SetConsoleTitle ( value . c_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
# endif
2002-04-07 20:53:41 +00:00
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::SendCMD()
//o------------------------------------------------------------------------------------------------o
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
//| Purpose - Send cmd to terminal
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : SendCMD ( const std : : string & cmd ) - > CConsole &
{
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
std : : cout < < cmd ;
std : : cout . flush ( ) ;
return * this ;
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::WindowSize()
//o------------------------------------------------------------------------------------------------o
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
//| Purpose - Set window size in columns and rows
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : WindowSize ( ) - > std : : pair < int , int >
{
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
int row = 0 ;
int col = 0 ;
2022-10-24 18:39:33 +08:00
# if !defined( _WIN32 )
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
// Get the window size
winsize winsz ;
2022-10-24 18:39:33 +08:00
ioctl ( 0 , TIOCGWINSZ , & winsz ) ;
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
col = winsz . ws_col ;
row = winsz . ws_row ;
# else
2022-10-24 18:39:33 +08:00
HANDLE hco = GetStdHandle ( STD_OUTPUT_HANDLE ) ;
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
CONSOLE_SCREEN_BUFFER_INFO csbi ;
GetConsoleScreenBufferInfo ( hco , & csbi ) ;
col = csbi . dwSize . X ;
row = csbi . dwSize . Y ;
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
# endif
2022-10-24 18:39:33 +08:00
return std : : make_pair ( row , col ) ;
2002-04-07 20:53:41 +00:00
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole()::DoClearScreen()
//o------------------------------------------------------------------------------------------------o
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
//| Purpose - Clears the screen
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : DoClearScreen ( ) - > void
{
# if defined( _WIN32 )
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
unsigned long y ;
COORD xy ;
xy . X = 0 ;
xy . Y = 0 ;
2022-10-24 18:39:33 +08:00
auto hco = GetStdHandle ( STD_OUTPUT_HANDLE ) ;
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
FillConsoleOutputCharacter ( hco , ' ' , width * height , xy , & y ) ;
SetConsoleCursorPosition ( hco , xy ) ;
# else
std : : string cmd = CSI ;
2022-10-24 18:39:33 +08:00
cmd = cmd + std : : string ( " 2J " ) ;
SendCMD ( cmd ) ;
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
# endif
}
2002-04-07 20:53:41 +00:00
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
Instance-support and misc code cleanup
Misc code and documentation cleanup:
Updated and standardized function comment blocks throughout entire codebase
Grouped getters and setters together in pairs and documented them as one
Removed empty and/or non-useful information from comment blocks
Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors
Added new feature - Instances
Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified.
Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present)
Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present)
Updated TWEAK menu to include WorldNumber and instanceID
Fixed BaseWeight option in TWEAK menu
Updated CBase_Teleport - now takes an optional 5th parameter instanceID
Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID
Updated SE_FindMulti now takes an optional 5th parameter - instanceID
Updated SE_GetItem now takes an optional 5th parameter - instanceID
Updated SE_FindItem now takes an optional 6th parameter - instanceID
Added new JS property for Items, Characters, Regions: .instanceID
Added JS property for Regions: .members - returns comma-separated list of town member serials
Updated JS scripts making use of the above-mentioned JS Methods/Functions
Updated dictionaries with new tweak menu entry texts
Exposed SpawnRegions to JS engine, and updated JS docs with details:
SpawnRegion JS Functions
IterateOverSpawnRegions()
GetSpawnRegion( spawnRegNum )
GetSpawnRegionCount()
SpawnRegion JS Properties
name
regionNum
itemList
npcList
item
npc
maxItems
maxNpcs
itemCount
npcCount
onlyOutside
prefZ
x1
y1
x2
y2
world
instanceID
minTime
maxTime
call
2020-08-08 13:57:15 +08:00
//| Function - << Overrriding
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
Instance-support and misc code cleanup
Misc code and documentation cleanup:
Updated and standardized function comment blocks throughout entire codebase
Grouped getters and setters together in pairs and documented them as one
Removed empty and/or non-useful information from comment blocks
Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors
Added new feature - Instances
Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified.
Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present)
Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present)
Updated TWEAK menu to include WorldNumber and instanceID
Fixed BaseWeight option in TWEAK menu
Updated CBase_Teleport - now takes an optional 5th parameter instanceID
Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID
Updated SE_FindMulti now takes an optional 5th parameter - instanceID
Updated SE_GetItem now takes an optional 5th parameter - instanceID
Updated SE_FindItem now takes an optional 6th parameter - instanceID
Added new JS property for Items, Characters, Regions: .instanceID
Added JS property for Regions: .members - returns comma-separated list of town member serials
Updated JS scripts making use of the above-mentioned JS Methods/Functions
Updated dictionaries with new tweak menu entry texts
Exposed SpawnRegions to JS engine, and updated JS docs with details:
SpawnRegion JS Functions
IterateOverSpawnRegions()
GetSpawnRegion( spawnRegNum )
GetSpawnRegionCount()
SpawnRegion JS Properties
name
regionNum
itemList
npcList
item
npc
maxItems
maxNpcs
itemCount
npcCount
onlyOutside
prefZ
x1
y1
x2
y2
world
instanceID
minTime
maxTime
call
2020-08-08 13:57:15 +08:00
//| Purpose - Let you use << and >>
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : operator < < ( const char * output ) - > CConsole &
{
2012-11-03 18:11:04 +00:00
StartOfLineCheck ( ) ;
2021-06-12 08:02:17 -04:00
# if PLATFORM == WINDOWS
2012-11-03 18:11:04 +00:00
CONSOLE_SCREEN_BUFFER_INFO ScrBuffInfo ;
2022-10-24 18:39:33 +08:00
auto hco = GetStdHandle ( STD_OUTPUT_HANDLE ) ;
2012-11-03 18:11:04 +00:00
GetConsoleScreenBufferInfo ( hco , & ScrBuffInfo ) ;
2022-06-11 07:55:06 -04:00
std : : string toDisplay = output ;
2022-10-24 18:39:33 +08:00
if ( ScrBuffInfo . dwCursorPosition . X + toDisplay . length ( ) > ScrBuffInfo . dwSize . X )
{
2012-11-03 18:11:04 +00:00
bool wrapDone = false ;
2022-10-24 18:39:33 +08:00
while ( ! wrapDone )
{
2012-11-03 18:11:04 +00:00
GetConsoleScreenBufferInfo ( hco , & ScrBuffInfo ) ;
Code cleanup
Embraced the usage of R32, R64, SI16, UI16, SI32, UI32, SI64 and UI64 typedef aliases as replacement for built-in types throughout the sourcecode:
typedef float R32;
typedef double R64;
typedef signed char SI08;
typedef unsigned char UI08;
typedef signed short int SI16;
typedef unsigned short int UI16;
typedef signed int SI32;
typedef unsigned int UI32;
typedef signed long long SI64;
typedef unsigned long long UI64;
As part of this process, UI32 was redefined from unsigned long int to unsigned int, and SI32 from signed long int to signed int to ensure the size of variables using these remain the same (32bit) across both Windows, Linux and MacOS for both 32bit and 64bit platforms
Replaced instances of toLong() with toInt(), and toULong() to toUInt()
Replaced instances of "long" and "int" with SI32 where possible
Replaced instances of "unsigned long" and "unsigned int" with UI32 where possible
Replaced instances of "float" with R32 where possible
2020-08-12 23:46:33 +08:00
SI32 diff = ScrBuffInfo . dwSize . X - ScrBuffInfo . dwCursorPosition . X - 1 ;
2022-10-24 18:39:33 +08:00
if ( diff > toDisplay . length ( ) )
{
2012-11-03 18:11:04 +00:00
std : : cout < < toDisplay ;
wrapDone = true ;
}
2022-10-24 18:39:33 +08:00
else
{
2012-11-03 18:11:04 +00:00
std : : cout < < toDisplay . substr ( 0 , diff ) ;
2022-10-24 18:39:33 +08:00
( * this ) < < myendl ;
2012-11-03 18:11:04 +00:00
StartOfLineCheck ( ) ;
toDisplay = toDisplay . substr ( diff ) ;
}
}
}
2022-10-24 18:39:33 +08:00
else
{
std : : cout < < output ;
2002-04-07 20:53:41 +00:00
}
2022-06-11 07:55:06 -04:00
# else
std : : cout < < output ;
# endif
2022-10-24 18:39:33 +08:00
return ( * this ) ;
2002-04-07 20:53:41 +00:00
}
2022-06-11 07:55:06 -04:00
//================================================================================================
2022-10-24 18:39:33 +08:00
auto CConsole : : operator < < ( const std : : uint8_t * output ) - > CConsole &
{
2012-11-03 18:11:04 +00:00
StartOfLineCheck ( ) ;
2022-10-24 18:39:33 +08:00
std : : cout < < reinterpret_cast < const char * > ( output ) ;
return ( * this ) ;
2002-04-07 20:53:41 +00:00
}
2022-06-11 07:55:06 -04:00
//================================================================================================
2022-10-24 18:39:33 +08:00
auto CConsole : : operator < < ( const std : : int8_t * output ) - > CConsole &
{
2012-11-03 18:11:04 +00:00
StartOfLineCheck ( ) ;
2022-10-24 18:39:33 +08:00
std : : cout < < reinterpret_cast < const char * > ( output ) ;
return ( * this ) ;
2002-04-07 20:53:41 +00:00
}
2022-06-11 07:55:06 -04:00
//================================================================================================
2022-10-24 18:39:33 +08:00
auto CConsole : : operator < < ( const std : : uint8_t & output ) - > CConsole &
{
2012-11-03 18:11:04 +00:00
StartOfLineCheck ( ) ;
2022-10-24 23:42:16 +08:00
std : : cout < < static_cast < UI16 > ( output ) ;
2022-10-24 18:39:33 +08:00
return ( * this ) ;
2002-04-07 20:53:41 +00:00
}
2022-06-11 07:55:06 -04:00
//================================================================================================
2022-10-24 18:39:33 +08:00
auto CConsole : : operator < < ( const std : : int8_t & output ) - > CConsole &
{
2012-11-03 18:11:04 +00:00
StartOfLineCheck ( ) ;
2022-10-24 18:39:33 +08:00
std : : cout < < static_cast < std : : int16_t > ( output ) ;
return ( * this ) ;
2002-04-07 20:53:41 +00:00
}
2022-06-11 07:55:06 -04:00
//================================================================================================
2022-10-24 23:42:16 +08:00
auto CConsole : : operator < < ( const UI16 & output ) - > CConsole &
2022-10-24 18:39:33 +08:00
{
2012-11-03 18:11:04 +00:00
StartOfLineCheck ( ) ;
2022-06-11 07:55:06 -04:00
std : : cout < < output ;
2022-10-24 18:39:33 +08:00
return ( * this ) ;
2002-04-07 20:53:41 +00:00
}
2022-06-11 07:55:06 -04:00
//================================================================================================
2022-10-24 18:39:33 +08:00
auto CConsole : : operator < < ( const std : : int16_t & output ) - > CConsole &
{
2012-11-03 18:11:04 +00:00
StartOfLineCheck ( ) ;
2022-06-11 07:55:06 -04:00
std : : cout < < output ;
2022-10-24 18:39:33 +08:00
return ( * this ) ;
2002-04-07 20:53:41 +00:00
}
2022-06-11 07:55:06 -04:00
//================================================================================================
2022-10-24 18:39:33 +08:00
auto CConsole : : operator < < ( const std : : uint32_t & output ) - > CConsole &
{
Code cleanup
Embraced the usage of R32, R64, SI16, UI16, SI32, UI32, SI64 and UI64 typedef aliases as replacement for built-in types throughout the sourcecode:
typedef float R32;
typedef double R64;
typedef signed char SI08;
typedef unsigned char UI08;
typedef signed short int SI16;
typedef unsigned short int UI16;
typedef signed int SI32;
typedef unsigned int UI32;
typedef signed long long SI64;
typedef unsigned long long UI64;
As part of this process, UI32 was redefined from unsigned long int to unsigned int, and SI32 from signed long int to signed int to ensure the size of variables using these remain the same (32bit) across both Windows, Linux and MacOS for both 32bit and 64bit platforms
Replaced instances of toLong() with toInt(), and toULong() to toUInt()
Replaced instances of "long" and "int" with SI32 where possible
Replaced instances of "unsigned long" and "unsigned int" with UI32 where possible
Replaced instances of "float" with R32 where possible
2020-08-12 23:46:33 +08:00
StartOfLineCheck ( ) ;
2022-06-11 07:55:06 -04:00
std : : cout < < output ;
2022-10-24 18:39:33 +08:00
return ( * this ) ;
Code cleanup
Embraced the usage of R32, R64, SI16, UI16, SI32, UI32, SI64 and UI64 typedef aliases as replacement for built-in types throughout the sourcecode:
typedef float R32;
typedef double R64;
typedef signed char SI08;
typedef unsigned char UI08;
typedef signed short int SI16;
typedef unsigned short int UI16;
typedef signed int SI32;
typedef unsigned int UI32;
typedef signed long long SI64;
typedef unsigned long long UI64;
As part of this process, UI32 was redefined from unsigned long int to unsigned int, and SI32 from signed long int to signed int to ensure the size of variables using these remain the same (32bit) across both Windows, Linux and MacOS for both 32bit and 64bit platforms
Replaced instances of toLong() with toInt(), and toULong() to toUInt()
Replaced instances of "long" and "int" with SI32 where possible
Replaced instances of "unsigned long" and "unsigned int" with UI32 where possible
Replaced instances of "float" with R32 where possible
2020-08-12 23:46:33 +08:00
}
2022-06-11 07:55:06 -04:00
//================================================================================================
2022-10-24 18:39:33 +08:00
auto CConsole : : operator < < ( const std : : int32_t & output ) - > CConsole &
{
Code cleanup
Embraced the usage of R32, R64, SI16, UI16, SI32, UI32, SI64 and UI64 typedef aliases as replacement for built-in types throughout the sourcecode:
typedef float R32;
typedef double R64;
typedef signed char SI08;
typedef unsigned char UI08;
typedef signed short int SI16;
typedef unsigned short int UI16;
typedef signed int SI32;
typedef unsigned int UI32;
typedef signed long long SI64;
typedef unsigned long long UI64;
As part of this process, UI32 was redefined from unsigned long int to unsigned int, and SI32 from signed long int to signed int to ensure the size of variables using these remain the same (32bit) across both Windows, Linux and MacOS for both 32bit and 64bit platforms
Replaced instances of toLong() with toInt(), and toULong() to toUInt()
Replaced instances of "long" and "int" with SI32 where possible
Replaced instances of "unsigned long" and "unsigned int" with UI32 where possible
Replaced instances of "float" with R32 where possible
2020-08-12 23:46:33 +08:00
StartOfLineCheck ( ) ;
2022-06-11 07:55:06 -04:00
std : : cout < < output ;
2022-10-24 18:39:33 +08:00
return ( * this ) ;
Code cleanup
Embraced the usage of R32, R64, SI16, UI16, SI32, UI32, SI64 and UI64 typedef aliases as replacement for built-in types throughout the sourcecode:
typedef float R32;
typedef double R64;
typedef signed char SI08;
typedef unsigned char UI08;
typedef signed short int SI16;
typedef unsigned short int UI16;
typedef signed int SI32;
typedef unsigned int UI32;
typedef signed long long SI64;
typedef unsigned long long UI64;
As part of this process, UI32 was redefined from unsigned long int to unsigned int, and SI32 from signed long int to signed int to ensure the size of variables using these remain the same (32bit) across both Windows, Linux and MacOS for both 32bit and 64bit platforms
Replaced instances of toLong() with toInt(), and toULong() to toUInt()
Replaced instances of "long" and "int" with SI32 where possible
Replaced instances of "unsigned long" and "unsigned int" with UI32 where possible
Replaced instances of "float" with R32 where possible
2020-08-12 23:46:33 +08:00
}
2022-06-11 07:55:06 -04:00
//================================================================================================
2022-10-24 18:39:33 +08:00
auto CConsole : : operator < < ( const std : : uint64_t & output ) - > CConsole &
{
2012-11-03 18:11:04 +00:00
StartOfLineCheck ( ) ;
2022-06-11 07:55:06 -04:00
std : : cout < < output ;
2022-10-24 18:39:33 +08:00
return ( * this ) ;
2002-04-07 20:53:41 +00:00
}
2022-06-11 07:55:06 -04:00
//================================================================================================
2022-10-24 18:39:33 +08:00
auto CConsole : : operator < < ( const std : : int64_t & output ) - > CConsole &
{
2012-11-03 18:11:04 +00:00
StartOfLineCheck ( ) ;
2022-06-11 07:55:06 -04:00
std : : cout < < output ;
2022-10-24 18:39:33 +08:00
return ( * this ) ;
2002-04-07 20:53:41 +00:00
}
2022-06-11 07:55:06 -04:00
//================================================================================================
2022-10-24 18:39:33 +08:00
auto CConsole : : operator < < ( const float & output ) - > CConsole &
{
2012-11-03 18:11:04 +00:00
StartOfLineCheck ( ) ;
2022-06-11 07:55:06 -04:00
std : : cout < < output ;
2022-10-24 18:39:33 +08:00
return ( * this ) ;
2022-06-11 07:55:06 -04:00
2002-04-07 20:53:41 +00:00
}
2022-06-11 07:55:06 -04:00
//================================================================================================
2022-10-24 18:39:33 +08:00
auto CConsole : : operator < < ( const double & output ) - > CConsole &
{
2012-11-03 18:11:04 +00:00
StartOfLineCheck ( ) ;
2022-06-11 07:55:06 -04:00
std : : cout < < output ;
2022-10-24 18:39:33 +08:00
return ( * this ) ;
2022-06-11 07:55:06 -04:00
}
//================================================================================================
2022-10-24 18:39:33 +08:00
auto CConsole : : operator < < ( const long double & output ) - > CConsole &
{
2012-11-03 18:11:04 +00:00
StartOfLineCheck ( ) ;
2022-06-11 07:55:06 -04:00
std : : cout < < output ;
2022-10-24 18:39:33 +08:00
return ( * this ) ;
2002-04-07 20:53:41 +00:00
}
2012-11-03 18:11:04 +00:00
2022-06-11 07:55:06 -04:00
//================================================================================================
2022-10-24 18:39:33 +08:00
auto CConsole : : operator < < ( CBaseObject * output ) - > CConsole &
{
2022-06-11 07:55:06 -04:00
StartOfLineCheck ( ) ;
( * this ) < < output - > GetSerial ( ) ;
2022-10-24 18:39:33 +08:00
return ( * this ) ;
2002-04-07 20:53:41 +00:00
}
2022-06-11 07:55:06 -04:00
//================================================================================================
2022-10-24 18:39:33 +08:00
auto CConsole : : operator < < ( const CBaseObject * output ) - > CConsole &
{
2012-11-03 18:11:04 +00:00
StartOfLineCheck ( ) ;
2022-06-11 07:55:06 -04:00
( * this ) < < output - > GetSerial ( ) ;
2022-10-24 18:39:33 +08:00
return ( * this ) ;
2002-04-07 20:53:41 +00:00
}
2022-06-11 07:55:06 -04:00
//================================================================================================
2022-10-24 18:39:33 +08:00
auto CConsole : : operator < < ( const CBaseObject & output ) - > CConsole &
{
2012-11-03 18:11:04 +00:00
StartOfLineCheck ( ) ;
2022-06-11 07:55:06 -04:00
( * this ) < < output . GetSerial ( ) ;
2022-10-24 18:39:33 +08:00
return ( * this ) ;
2012-11-03 18:11:04 +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
2022-06-11 07:55:06 -04:00
//================================================================================================
2022-10-24 18:39:33 +08:00
auto CConsole : : operator < < ( const std : : string & output ) - > CConsole &
{
2022-06-11 07:55:06 -04:00
StartOfLineCheck ( ) ;
std : : cout < < output ;
2022-10-24 18:39:33 +08:00
return ( * this ) ;
2022-06-11 07:55:06 -04:00
}
//================================================================================================
2022-11-14 21:12:12 -05:00
auto CConsole : : operator < < ( [[maybe_unused]] CEndL & myObj ) - > CConsole &
2022-10-24 18:39:33 +08:00
{
if ( curLeft = = 0 )
{
2022-06-11 07:55:06 -04:00
PrintStartOfLine ( ) ;
}
std : : cout < < std : : endl ;
curLeft = 0 ;
+ + curTop ;
2022-10-24 18:39:33 +08:00
return ( * this ) ;
2022-06-11 07:55:06 -04:00
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::Print()
//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 - Prints the console with the "|"
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : Print ( const std : : string & msg ) - > void
{
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
StartOfLineCheck ( ) ;
std : : cout < < msg ;
2022-10-24 18:39:33 +08:00
if ( ( msg . size ( ) > 0 ) & & ( msg [ msg . size ( ) - 1 ] = = ' \n ' ) )
{
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
curLeft = 0 ;
Numerous changes with focus on feature and stability parity across Windows, Linux and MacOS platforms
Added new Makefile that handles compiling UOX3 and Spidermonkey on both Linux and MacOS (punt)
Added VS solution (SpiderMonkey.sln) and VC++ project files for compiling SpiderMonkey on Windows (Xuri)
Updated SpiderMonkey from v1.6.0 to v1.7.0
Added optimization flag -O2 for release build in CMakeLists.txt in project root (Xuri)
Added StringUtility file with general common string manipulation functions (punt)
Updated RandomNum function to use a "seedless" random number generator from C++11 instead of the old C rand() function. (punt)
Overall code cleanup to remove/replace platform-dependent code (punt)
Replaced potentially unsafe usage of C string stuff like sprintf, vsprintf, vsnprintf, strncat, strcpy and strlen throughout the code with calls to a format() function containing only a single, safe use of vsnprintf, ensuring there's a single place of failure if there's anything to fix and and making it easy to potentially replace this with std::format from C++20 when the time comes. (punt)
Replaced usage of char in many places with std::string (punt)
Started process of replacing UString usage with functions provided through StringUtility instead (punt)
Replaced platform specific fileIO handling in Windows/Linux with cross-platform C++17 standard std::filesystem (punt)
Replaced platform specific time handling by using cross-platform chrono library (punt)
Removed UOX namespace to reduce complexity (punt)
Elimitated template code approach to singletons for more modern c++ constructs, removing dependices in the process (punt)
Removed ODBC support; it hasn't been touched since the initial implementation in 2008, and there is a lack of someone to maintain the code. (punt)
Removed some platform specific files like uoxlinux.h, which is no longer required (punt)
Removed legacy crash protection code, and removed support for cluox (punt)
Removed legacy "support" for Borland compiler (punt)
Removed legacy VC++ 6 Workspace/Project files, VS2005 Solution/Project files, as these are no longer supported (Xuri)
Removed legacy BUILD folder with outdated compilation instructions (Xuri)
Removed old Changelog file (merged into Changelog.txt) (Xuri)
Fixed a pointer bug for items in multis on world load (punt)
Fixed a dictionary related issue that caused segmentation faults on Linux/MacOS (punt)
Fixed an issue with callbacks to JS scripts that caused segmentation faults on Linux/MacOS (punt)
Paths in uox.ini should now load properly on all platforms regardless of whether those paths use slashes or backslashes, and whether or not they end in a slash/backslash. (punt)
Moved to c++17 style of threading, and got rid of threadsafeobject.cpp/h (punt)
Replaced parsing of UOX.INI tags with a system that's more easily maintainable (punt)
Added some new commands to js/commands/custom/misc-cmd.js (Xuri)
cont // Targeted item will be made a container, set to nondecay and movable 2
endfight // Targeted character (and character being fought) will stop fighting
getmulti // Get multiObject for targeted item
finditem // Find item at layer X
movespeed // Set movement speed of target player (0x0 Normal, 0x1 Mounted, 0x2 Slow (walk only), 0x3 Hybrid ("jog"?), 0x4 Frozen)
Added new HTML based documentation in docs folder, and removed many old legacy docs that are either incorporated into this document already or no longer relevant for the current UOX3 version (Xuri)
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2020-09-07 18:09:55 +08:00
}
2002-04-07 20:53:41 +00:00
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::Log()
//o------------------------------------------------------------------------------------------------o
Instance-support and misc code cleanup
Misc code and documentation cleanup:
Updated and standardized function comment blocks throughout entire codebase
Grouped getters and setters together in pairs and documented them as one
Removed empty and/or non-useful information from comment blocks
Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors
Added new feature - Instances
Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified.
Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present)
Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present)
Updated TWEAK menu to include WorldNumber and instanceID
Fixed BaseWeight option in TWEAK menu
Updated CBase_Teleport - now takes an optional 5th parameter instanceID
Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID
Updated SE_FindMulti now takes an optional 5th parameter - instanceID
Updated SE_GetItem now takes an optional 5th parameter - instanceID
Updated SE_FindItem now takes an optional 6th parameter - instanceID
Added new JS property for Items, Characters, Regions: .instanceID
Added JS property for Regions: .members - returns comma-separated list of town member serials
Updated JS scripts making use of the above-mentioned JS Methods/Functions
Updated dictionaries with new tweak menu entry texts
Exposed SpawnRegions to JS engine, and updated JS docs with details:
SpawnRegion JS Functions
IterateOverSpawnRegions()
GetSpawnRegion( spawnRegNum )
GetSpawnRegionCount()
SpawnRegion JS Properties
name
regionNum
itemList
npcList
item
npc
maxItems
maxNpcs
itemCount
npcCount
onlyOutside
prefZ
x1
y1
x2
y2
world
instanceID
minTime
maxTime
call
2020-08-08 13:57:15 +08:00
//| Purpose - Writes to the logfile
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : Log ( const std : : string & msg , const std : : string & filename ) - > void
{
if ( cwmWorldState )
{
if ( cwmWorldState - > ServerData ( ) - > ServerConsoleLog ( ) )
{
2022-07-04 14:38:28 -04:00
std : : ofstream toWrite ;
std : : string realFileName ; // 022602: in windows a path can be max 512 chars, this at 128 coud potentially cause crashes if the path is longer than 128 chars
2022-10-24 18:39:33 +08:00
if ( cwmWorldState ! = nullptr )
{
2022-07-04 14:38:28 -04:00
realFileName = cwmWorldState - > ServerData ( ) - > Directory ( CSDDP_LOGS ) + filename ;
}
2022-10-24 18:39:33 +08:00
else
{
2022-07-04 14:38:28 -04:00
realFileName = filename ;
}
2022-10-24 18:39:33 +08:00
2022-07-04 14:38:28 -04:00
char timeStr [ 256 ] ;
RealTime ( timeStr ) ;
2022-10-24 18:39:33 +08:00
2022-07-04 14:38:28 -04:00
toWrite . open ( realFileName . c_str ( ) , std : : ios : : out | std : : ios : : app ) ;
2022-10-24 18:39:33 +08:00
if ( toWrite . is_open ( ) )
{
2022-07-04 14:38:28 -04:00
toWrite < < " [ " < < timeStr < < " ] " < < msg < < std : : endl ;
}
toWrite . close ( ) ;
2022-10-24 18:39:33 +08:00
if ( LogEcho ( ) )
{
Print ( oldstrutil : : format ( " %s%s \n " , timeStr , msg . c_str ( ) ) ) ;
2022-07-04 14:38:28 -04:00
}
2022-06-11 07:55:06 -04:00
}
2003-03-14 23:23:37 +00:00
}
2002-04-07 20:53:41 +00:00
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::Log()
//o------------------------------------------------------------------------------------------------o
Instance-support and misc code cleanup
Misc code and documentation cleanup:
Updated and standardized function comment blocks throughout entire codebase
Grouped getters and setters together in pairs and documented them as one
Removed empty and/or non-useful information from comment blocks
Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors
Added new feature - Instances
Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified.
Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present)
Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present)
Updated TWEAK menu to include WorldNumber and instanceID
Fixed BaseWeight option in TWEAK menu
Updated CBase_Teleport - now takes an optional 5th parameter instanceID
Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID
Updated SE_FindMulti now takes an optional 5th parameter - instanceID
Updated SE_GetItem now takes an optional 5th parameter - instanceID
Updated SE_FindItem now takes an optional 6th parameter - instanceID
Added new JS property for Items, Characters, Regions: .instanceID
Added JS property for Regions: .members - returns comma-separated list of town member serials
Updated JS scripts making use of the above-mentioned JS Methods/Functions
Updated dictionaries with new tweak menu entry texts
Exposed SpawnRegions to JS engine, and updated JS docs with details:
SpawnRegion JS Functions
IterateOverSpawnRegions()
GetSpawnRegion( spawnRegNum )
GetSpawnRegionCount()
SpawnRegion JS Properties
name
regionNum
itemList
npcList
item
npc
maxItems
maxNpcs
itemCount
npcCount
onlyOutside
prefZ
x1
y1
x2
y2
world
instanceID
minTime
maxTime
call
2020-08-08 13:57:15 +08:00
//| Purpose - Log to the console.log file
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : Log ( const std : : string & msg ) - > void
{
if ( cwmWorldState - > ServerData ( ) - > ServerConsoleLog ( ) )
{
Log ( msg , " console.log " ) ;
2022-06-11 07:55:06 -04:00
}
2002-04-07 20:53:41 +00:00
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::Error()
//o------------------------------------------------------------------------------------------------o
Instance-support and misc code cleanup
Misc code and documentation cleanup:
Updated and standardized function comment blocks throughout entire codebase
Grouped getters and setters together in pairs and documented them as one
Removed empty and/or non-useful information from comment blocks
Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors
Added new feature - Instances
Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified.
Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present)
Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present)
Updated TWEAK menu to include WorldNumber and instanceID
Fixed BaseWeight option in TWEAK menu
Updated CBase_Teleport - now takes an optional 5th parameter instanceID
Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID
Updated SE_FindMulti now takes an optional 5th parameter - instanceID
Updated SE_GetItem now takes an optional 5th parameter - instanceID
Updated SE_FindItem now takes an optional 6th parameter - instanceID
Added new JS property for Items, Characters, Regions: .instanceID
Added JS property for Regions: .members - returns comma-separated list of town member serials
Updated JS scripts making use of the above-mentioned JS Methods/Functions
Updated dictionaries with new tweak menu entry texts
Exposed SpawnRegions to JS engine, and updated JS docs with details:
SpawnRegion JS Functions
IterateOverSpawnRegions()
GetSpawnRegion( spawnRegNum )
GetSpawnRegionCount()
SpawnRegion JS Properties
name
regionNum
itemList
npcList
item
npc
maxItems
maxNpcs
itemCount
npcCount
onlyOutside
prefZ
x1
y1
x2
y2
world
instanceID
minTime
maxTime
call
2020-08-08 13:57:15 +08:00
//| Purpose - Writes to the error log and the console.
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : Error ( const std : : string & msg ) - > void
{
try
{
2022-06-26 09:01:30 -04:00
UI08 oldMode = CurrentMode ( ) ;
CurrentMode ( ERRORMODE ) ;
2022-10-24 18:39:33 +08:00
Log ( msg , " error.log " ) ;
if ( curLeft ! = 0 )
{
( * this ) < < myendl ;
2022-06-26 09:01:30 -04:00
}
TurnRed ( ) ;
2022-10-24 18:39:33 +08:00
( * this ) < < " ERROR: " < < ( const char * ) & msg [ 0 ] < < myendl ;
2022-06-26 09:01:30 -04:00
TurnNormal ( ) ;
CurrentMode ( oldMode ) ;
}
2022-10-24 18:39:33 +08:00
catch ( const std : : exception & e )
{
2023-08-24 17:43:35 -04:00
std : : cerr < < " Error print reporting 'error'. Error was: " < < e . what ( ) < < std : : endl ;
2022-10-24 18:39:33 +08:00
exit ( 1 ) ;
2022-06-11 07:55:06 -04:00
}
2002-04-07 20:53:41 +00:00
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::PrintSectionBegin()
//o------------------------------------------------------------------------------------------------o
Instance-support and misc code cleanup
Misc code and documentation cleanup:
Updated and standardized function comment blocks throughout entire codebase
Grouped getters and setters together in pairs and documented them as one
Removed empty and/or non-useful information from comment blocks
Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors
Added new feature - Instances
Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified.
Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present)
Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present)
Updated TWEAK menu to include WorldNumber and instanceID
Fixed BaseWeight option in TWEAK menu
Updated CBase_Teleport - now takes an optional 5th parameter instanceID
Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID
Updated SE_FindMulti now takes an optional 5th parameter - instanceID
Updated SE_GetItem now takes an optional 5th parameter - instanceID
Updated SE_FindItem now takes an optional 6th parameter - instanceID
Added new JS property for Items, Characters, Regions: .instanceID
Added JS property for Regions: .members - returns comma-separated list of town member serials
Updated JS scripts making use of the above-mentioned JS Methods/Functions
Updated dictionaries with new tweak menu entry texts
Exposed SpawnRegions to JS engine, and updated JS docs with details:
SpawnRegion JS Functions
IterateOverSpawnRegions()
GetSpawnRegion( spawnRegNum )
GetSpawnRegionCount()
SpawnRegion JS Properties
name
regionNum
itemList
npcList
item
npc
maxItems
maxNpcs
itemCount
npcCount
onlyOutside
prefZ
x1
y1
x2
y2
world
instanceID
minTime
maxTime
call
2020-08-08 13:57:15 +08:00
//| Purpose - Prints a section seperator
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : PrintSectionBegin ( ) - > void
{
2002-04-07 20:53:41 +00:00
TurnBrightWhite ( ) ;
2003-01-13 15:58:29 +00:00
std : : cout < < " o " ;
2022-10-24 18:39:33 +08:00
for ( auto j = 1 ; j < width - 1 ; + + j )
{
2003-01-13 15:58:29 +00:00
std : : cout < < " - " ;
2022-06-11 07:55:06 -04:00
}
2022-10-24 18:39:33 +08:00
std : : cout < < " o " ;
2002-04-07 20:53:41 +00:00
curLeft = 0 ;
curTop = 0 ;
TurnNormal ( ) ;
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::Start()
//o------------------------------------------------------------------------------------------------o
Instance-support and misc code cleanup
Misc code and documentation cleanup:
Updated and standardized function comment blocks throughout entire codebase
Grouped getters and setters together in pairs and documented them as one
Removed empty and/or non-useful information from comment blocks
Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors
Added new feature - Instances
Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified.
Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present)
Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present)
Updated TWEAK menu to include WorldNumber and instanceID
Fixed BaseWeight option in TWEAK menu
Updated CBase_Teleport - now takes an optional 5th parameter instanceID
Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID
Updated SE_FindMulti now takes an optional 5th parameter - instanceID
Updated SE_GetItem now takes an optional 5th parameter - instanceID
Updated SE_FindItem now takes an optional 6th parameter - instanceID
Added new JS property for Items, Characters, Regions: .instanceID
Added JS property for Regions: .members - returns comma-separated list of town member serials
Updated JS scripts making use of the above-mentioned JS Methods/Functions
Updated dictionaries with new tweak menu entry texts
Exposed SpawnRegions to JS engine, and updated JS docs with details:
SpawnRegion JS Functions
IterateOverSpawnRegions()
GetSpawnRegion( spawnRegNum )
GetSpawnRegionCount()
SpawnRegion JS Properties
name
regionNum
itemList
npcList
item
npc
maxItems
maxNpcs
itemCount
npcCount
onlyOutside
prefZ
x1
y1
x2
y2
world
instanceID
minTime
maxTime
call
2020-08-08 13:57:15 +08:00
//| Purpose - Migration of constart function to here
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : Start ( const std : : string & temp ) - > void
{
auto size = WindowSize ( ) ;
width = std : : get < 1 > ( size ) ;
height = std : : get < 0 > ( size ) ;
SetTitle ( temp ) ;
2002-04-07 20:53:41 +00:00
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::TurnYellow()
///o------------------------------------------------------------------------------------------------o
Instance-support and misc code cleanup
Misc code and documentation cleanup:
Updated and standardized function comment blocks throughout entire codebase
Grouped getters and setters together in pairs and documented them as one
Removed empty and/or non-useful information from comment blocks
Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors
Added new feature - Instances
Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified.
Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present)
Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present)
Updated TWEAK menu to include WorldNumber and instanceID
Fixed BaseWeight option in TWEAK menu
Updated CBase_Teleport - now takes an optional 5th parameter instanceID
Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID
Updated SE_FindMulti now takes an optional 5th parameter - instanceID
Updated SE_GetItem now takes an optional 5th parameter - instanceID
Updated SE_FindItem now takes an optional 6th parameter - instanceID
Added new JS property for Items, Characters, Regions: .instanceID
Added JS property for Regions: .members - returns comma-separated list of town member serials
Updated JS scripts making use of the above-mentioned JS Methods/Functions
Updated dictionaries with new tweak menu entry texts
Exposed SpawnRegions to JS engine, and updated JS docs with details:
SpawnRegion JS Functions
IterateOverSpawnRegions()
GetSpawnRegion( spawnRegNum )
GetSpawnRegionCount()
SpawnRegion JS Properties
name
regionNum
itemList
npcList
item
npc
maxItems
maxNpcs
itemCount
npcCount
onlyOutside
prefZ
x1
y1
x2
y2
world
instanceID
minTime
maxTime
call
2020-08-08 13:57:15 +08:00
//| Purpose - Turns the text yellow
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : TurnYellow ( ) - > void
{
2021-06-12 08:02:17 -04:00
# if PLATFORM == WINDOWS
2022-10-24 18:39:33 +08:00
auto hco = GetStdHandle ( STD_OUTPUT_HANDLE ) ;
2002-04-07 20:53:41 +00:00
SetConsoleTextAttribute ( hco , FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY ) ;
# else
2003-03-10 23:40:08 +00:00
std : : cout < < " \033 [1;33m " ;
2002-04-07 20:53:41 +00:00
# endif
previousColour = CYELLOW ;
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::TurnRed()
//o------------------------------------------------------------------------------------------------o
Instance-support and misc code cleanup
Misc code and documentation cleanup:
Updated and standardized function comment blocks throughout entire codebase
Grouped getters and setters together in pairs and documented them as one
Removed empty and/or non-useful information from comment blocks
Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors
Added new feature - Instances
Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified.
Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present)
Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present)
Updated TWEAK menu to include WorldNumber and instanceID
Fixed BaseWeight option in TWEAK menu
Updated CBase_Teleport - now takes an optional 5th parameter instanceID
Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID
Updated SE_FindMulti now takes an optional 5th parameter - instanceID
Updated SE_GetItem now takes an optional 5th parameter - instanceID
Updated SE_FindItem now takes an optional 6th parameter - instanceID
Added new JS property for Items, Characters, Regions: .instanceID
Added JS property for Regions: .members - returns comma-separated list of town member serials
Updated JS scripts making use of the above-mentioned JS Methods/Functions
Updated dictionaries with new tweak menu entry texts
Exposed SpawnRegions to JS engine, and updated JS docs with details:
SpawnRegion JS Functions
IterateOverSpawnRegions()
GetSpawnRegion( spawnRegNum )
GetSpawnRegionCount()
SpawnRegion JS Properties
name
regionNum
itemList
npcList
item
npc
maxItems
maxNpcs
itemCount
npcCount
onlyOutside
prefZ
x1
y1
x2
y2
world
instanceID
minTime
maxTime
call
2020-08-08 13:57:15 +08:00
//| Purpose - Turns the text red
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : TurnRed ( ) - > void
{
2021-06-12 08:02:17 -04:00
# if PLATFORM == WINDOWS
2022-10-24 18:39:33 +08:00
auto hco = GetStdHandle ( STD_OUTPUT_HANDLE ) ;
2002-04-07 20:53:41 +00:00
SetConsoleTextAttribute ( hco , FOREGROUND_RED | FOREGROUND_INTENSITY ) ;
# else
2003-03-10 23:40:08 +00:00
std : : cout < < " \033 [1;31m " ;
2002-04-07 20:53:41 +00:00
# endif
previousColour = CRED ;
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::TurnGreen()
//o------------------------------------------------------------------------------------------------o
Instance-support and misc code cleanup
Misc code and documentation cleanup:
Updated and standardized function comment blocks throughout entire codebase
Grouped getters and setters together in pairs and documented them as one
Removed empty and/or non-useful information from comment blocks
Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors
Added new feature - Instances
Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified.
Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present)
Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present)
Updated TWEAK menu to include WorldNumber and instanceID
Fixed BaseWeight option in TWEAK menu
Updated CBase_Teleport - now takes an optional 5th parameter instanceID
Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID
Updated SE_FindMulti now takes an optional 5th parameter - instanceID
Updated SE_GetItem now takes an optional 5th parameter - instanceID
Updated SE_FindItem now takes an optional 6th parameter - instanceID
Added new JS property for Items, Characters, Regions: .instanceID
Added JS property for Regions: .members - returns comma-separated list of town member serials
Updated JS scripts making use of the above-mentioned JS Methods/Functions
Updated dictionaries with new tweak menu entry texts
Exposed SpawnRegions to JS engine, and updated JS docs with details:
SpawnRegion JS Functions
IterateOverSpawnRegions()
GetSpawnRegion( spawnRegNum )
GetSpawnRegionCount()
SpawnRegion JS Properties
name
regionNum
itemList
npcList
item
npc
maxItems
maxNpcs
itemCount
npcCount
onlyOutside
prefZ
x1
y1
x2
y2
world
instanceID
minTime
maxTime
call
2020-08-08 13:57:15 +08:00
//| Purpose - Turns the text green
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : TurnGreen ( ) - > void
{
2021-06-12 08:02:17 -04:00
# if PLATFORM == WINDOWS
2022-10-24 18:39:33 +08:00
auto hco = GetStdHandle ( STD_OUTPUT_HANDLE ) ;
2002-04-07 20:53:41 +00:00
SetConsoleTextAttribute ( hco , FOREGROUND_GREEN | FOREGROUND_INTENSITY ) ;
# else
2003-03-10 23:40:08 +00:00
std : : cout < < " \033 [1;32m " ;
2002-04-07 20:53:41 +00:00
# endif
previousColour = CGREEN ;
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::TurnBlue()
//o------------------------------------------------------------------------------------------------o
Instance-support and misc code cleanup
Misc code and documentation cleanup:
Updated and standardized function comment blocks throughout entire codebase
Grouped getters and setters together in pairs and documented them as one
Removed empty and/or non-useful information from comment blocks
Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors
Added new feature - Instances
Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified.
Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present)
Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present)
Updated TWEAK menu to include WorldNumber and instanceID
Fixed BaseWeight option in TWEAK menu
Updated CBase_Teleport - now takes an optional 5th parameter instanceID
Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID
Updated SE_FindMulti now takes an optional 5th parameter - instanceID
Updated SE_GetItem now takes an optional 5th parameter - instanceID
Updated SE_FindItem now takes an optional 6th parameter - instanceID
Added new JS property for Items, Characters, Regions: .instanceID
Added JS property for Regions: .members - returns comma-separated list of town member serials
Updated JS scripts making use of the above-mentioned JS Methods/Functions
Updated dictionaries with new tweak menu entry texts
Exposed SpawnRegions to JS engine, and updated JS docs with details:
SpawnRegion JS Functions
IterateOverSpawnRegions()
GetSpawnRegion( spawnRegNum )
GetSpawnRegionCount()
SpawnRegion JS Properties
name
regionNum
itemList
npcList
item
npc
maxItems
maxNpcs
itemCount
npcCount
onlyOutside
prefZ
x1
y1
x2
y2
world
instanceID
minTime
maxTime
call
2020-08-08 13:57:15 +08:00
//| Purpose - Turns the text blue
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : TurnBlue ( ) - > void
{
2021-06-12 08:02:17 -04:00
# if PLATFORM == WINDOWS
2022-10-24 18:39:33 +08:00
auto hco = GetStdHandle ( STD_OUTPUT_HANDLE ) ;
2002-04-07 20:53:41 +00:00
SetConsoleTextAttribute ( hco , FOREGROUND_BLUE | FOREGROUND_INTENSITY ) ;
# else
2003-03-10 23:40:08 +00:00
std : : cout < < " \033 [1;34m " ;
2002-04-07 20:53:41 +00:00
# endif
previousColour = CBLUE ;
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::TurnNormal()
//o------------------------------------------------------------------------------------------------o
Instance-support and misc code cleanup
Misc code and documentation cleanup:
Updated and standardized function comment blocks throughout entire codebase
Grouped getters and setters together in pairs and documented them as one
Removed empty and/or non-useful information from comment blocks
Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors
Added new feature - Instances
Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified.
Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present)
Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present)
Updated TWEAK menu to include WorldNumber and instanceID
Fixed BaseWeight option in TWEAK menu
Updated CBase_Teleport - now takes an optional 5th parameter instanceID
Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID
Updated SE_FindMulti now takes an optional 5th parameter - instanceID
Updated SE_GetItem now takes an optional 5th parameter - instanceID
Updated SE_FindItem now takes an optional 6th parameter - instanceID
Added new JS property for Items, Characters, Regions: .instanceID
Added JS property for Regions: .members - returns comma-separated list of town member serials
Updated JS scripts making use of the above-mentioned JS Methods/Functions
Updated dictionaries with new tweak menu entry texts
Exposed SpawnRegions to JS engine, and updated JS docs with details:
SpawnRegion JS Functions
IterateOverSpawnRegions()
GetSpawnRegion( spawnRegNum )
GetSpawnRegionCount()
SpawnRegion JS Properties
name
regionNum
itemList
npcList
item
npc
maxItems
maxNpcs
itemCount
npcCount
onlyOutside
prefZ
x1
y1
x2
y2
world
instanceID
minTime
maxTime
call
2020-08-08 13:57:15 +08:00
//| Purpose - Returns text to normal white
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : TurnNormal ( ) - > void
{
2021-06-12 08:02:17 -04:00
# if PLATFORM == WINDOWS
2022-10-24 18:39:33 +08:00
auto hco = GetStdHandle ( STD_OUTPUT_HANDLE ) ;
2002-04-07 20:53:41 +00:00
SetConsoleTextAttribute ( hco , FOREGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN ) ;
# else
2003-03-10 23:40:08 +00:00
std : : cout < < " \033 [0;37m " ;
2002-04-07 20:53:41 +00:00
# endif
previousColour = CNORMAL ;
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::TurnBrightWhite()
//o------------------------------------------------------------------------------------------------o
Instance-support and misc code cleanup
Misc code and documentation cleanup:
Updated and standardized function comment blocks throughout entire codebase
Grouped getters and setters together in pairs and documented them as one
Removed empty and/or non-useful information from comment blocks
Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors
Added new feature - Instances
Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified.
Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present)
Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present)
Updated TWEAK menu to include WorldNumber and instanceID
Fixed BaseWeight option in TWEAK menu
Updated CBase_Teleport - now takes an optional 5th parameter instanceID
Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID
Updated SE_FindMulti now takes an optional 5th parameter - instanceID
Updated SE_GetItem now takes an optional 5th parameter - instanceID
Updated SE_FindItem now takes an optional 6th parameter - instanceID
Added new JS property for Items, Characters, Regions: .instanceID
Added JS property for Regions: .members - returns comma-separated list of town member serials
Updated JS scripts making use of the above-mentioned JS Methods/Functions
Updated dictionaries with new tweak menu entry texts
Exposed SpawnRegions to JS engine, and updated JS docs with details:
SpawnRegion JS Functions
IterateOverSpawnRegions()
GetSpawnRegion( spawnRegNum )
GetSpawnRegionCount()
SpawnRegion JS Properties
name
regionNum
itemList
npcList
item
npc
maxItems
maxNpcs
itemCount
npcCount
onlyOutside
prefZ
x1
y1
x2
y2
world
instanceID
minTime
maxTime
call
2020-08-08 13:57:15 +08:00
//| Purpose - Returns text to bright white
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : TurnBrightWhite ( ) - > void
{
2021-06-12 08:02:17 -04:00
# if PLATFORM == WINDOWS
2022-10-24 18:39:33 +08:00
auto hco = GetStdHandle ( STD_OUTPUT_HANDLE ) ;
2002-04-07 20:53:41 +00:00
SetConsoleTextAttribute ( hco , FOREGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY ) ;
# else
2003-03-10 23:40:08 +00:00
std : : cout < < " \033 [1;37m " ;
2002-04-07 20:53:41 +00:00
# endif
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::PrintDone()
//o------------------------------------------------------------------------------------------------o
Instance-support and misc code cleanup
Misc code and documentation cleanup:
Updated and standardized function comment blocks throughout entire codebase
Grouped getters and setters together in pairs and documented them as one
Removed empty and/or non-useful information from comment blocks
Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors
Added new feature - Instances
Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified.
Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present)
Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present)
Updated TWEAK menu to include WorldNumber and instanceID
Fixed BaseWeight option in TWEAK menu
Updated CBase_Teleport - now takes an optional 5th parameter instanceID
Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID
Updated SE_FindMulti now takes an optional 5th parameter - instanceID
Updated SE_GetItem now takes an optional 5th parameter - instanceID
Updated SE_FindItem now takes an optional 6th parameter - instanceID
Added new JS property for Items, Characters, Regions: .instanceID
Added JS property for Regions: .members - returns comma-separated list of town member serials
Updated JS scripts making use of the above-mentioned JS Methods/Functions
Updated dictionaries with new tweak menu entry texts
Exposed SpawnRegions to JS engine, and updated JS docs with details:
SpawnRegion JS Functions
IterateOverSpawnRegions()
GetSpawnRegion( spawnRegNum )
GetSpawnRegionCount()
SpawnRegion JS Properties
name
regionNum
itemList
npcList
item
npc
maxItems
maxNpcs
itemCount
npcCount
onlyOutside
prefZ
x1
y1
x2
y2
world
instanceID
minTime
maxTime
call
2020-08-08 13:57:15 +08:00
//| Purpose - Prints colored "[done]" message
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : PrintDone ( ) - > void
{
2003-03-14 23:23:37 +00:00
PrintSpecial ( CGREEN , " done " ) ;
2002-04-07 20:53:41 +00:00
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::PrintFailed()
//o------------------------------------------------------------------------------------------------o
Instance-support and misc code cleanup
Misc code and documentation cleanup:
Updated and standardized function comment blocks throughout entire codebase
Grouped getters and setters together in pairs and documented them as one
Removed empty and/or non-useful information from comment blocks
Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors
Added new feature - Instances
Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified.
Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present)
Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present)
Updated TWEAK menu to include WorldNumber and instanceID
Fixed BaseWeight option in TWEAK menu
Updated CBase_Teleport - now takes an optional 5th parameter instanceID
Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID
Updated SE_FindMulti now takes an optional 5th parameter - instanceID
Updated SE_GetItem now takes an optional 5th parameter - instanceID
Updated SE_FindItem now takes an optional 6th parameter - instanceID
Added new JS property for Items, Characters, Regions: .instanceID
Added JS property for Regions: .members - returns comma-separated list of town member serials
Updated JS scripts making use of the above-mentioned JS Methods/Functions
Updated dictionaries with new tweak menu entry texts
Exposed SpawnRegions to JS engine, and updated JS docs with details:
SpawnRegion JS Functions
IterateOverSpawnRegions()
GetSpawnRegion( spawnRegNum )
GetSpawnRegionCount()
SpawnRegion JS Properties
name
regionNum
itemList
npcList
item
npc
maxItems
maxNpcs
itemCount
npcCount
onlyOutside
prefZ
x1
y1
x2
y2
world
instanceID
minTime
maxTime
call
2020-08-08 13:57:15 +08:00
//| Purpose - Prints colored "[failed]" message
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : PrintFailed ( ) - > void
{
2003-03-14 23:23:37 +00:00
PrintSpecial ( CRED , " Failed " ) ;
2002-04-07 20:53:41 +00:00
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::PrintPassed()
//o------------------------------------------------------------------------------------------------o
Instance-support and misc code cleanup
Misc code and documentation cleanup:
Updated and standardized function comment blocks throughout entire codebase
Grouped getters and setters together in pairs and documented them as one
Removed empty and/or non-useful information from comment blocks
Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors
Added new feature - Instances
Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified.
Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present)
Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present)
Updated TWEAK menu to include WorldNumber and instanceID
Fixed BaseWeight option in TWEAK menu
Updated CBase_Teleport - now takes an optional 5th parameter instanceID
Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID
Updated SE_FindMulti now takes an optional 5th parameter - instanceID
Updated SE_GetItem now takes an optional 5th parameter - instanceID
Updated SE_FindItem now takes an optional 6th parameter - instanceID
Added new JS property for Items, Characters, Regions: .instanceID
Added JS property for Regions: .members - returns comma-separated list of town member serials
Updated JS scripts making use of the above-mentioned JS Methods/Functions
Updated dictionaries with new tweak menu entry texts
Exposed SpawnRegions to JS engine, and updated JS docs with details:
SpawnRegion JS Functions
IterateOverSpawnRegions()
GetSpawnRegion( spawnRegNum )
GetSpawnRegionCount()
SpawnRegion JS Properties
name
regionNum
itemList
npcList
item
npc
maxItems
maxNpcs
itemCount
npcCount
onlyOutside
prefZ
x1
y1
x2
y2
world
instanceID
minTime
maxTime
call
2020-08-08 13:57:15 +08:00
//| Purpose - Prints colored "[skipped]" message
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : PrintPassed ( ) - > void
{
2003-03-14 23:23:37 +00:00
PrintSpecial ( CYELLOW , " Skipped " ) ;
2002-04-07 20:53:41 +00:00
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::ClearScreen()
//o------------------------------------------------------------------------------------------------o
Instance-support and misc code cleanup
Misc code and documentation cleanup:
Updated and standardized function comment blocks throughout entire codebase
Grouped getters and setters together in pairs and documented them as one
Removed empty and/or non-useful information from comment blocks
Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors
Added new feature - Instances
Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified.
Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present)
Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present)
Updated TWEAK menu to include WorldNumber and instanceID
Fixed BaseWeight option in TWEAK menu
Updated CBase_Teleport - now takes an optional 5th parameter instanceID
Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID
Updated SE_FindMulti now takes an optional 5th parameter - instanceID
Updated SE_GetItem now takes an optional 5th parameter - instanceID
Updated SE_FindItem now takes an optional 6th parameter - instanceID
Added new JS property for Items, Characters, Regions: .instanceID
Added JS property for Regions: .members - returns comma-separated list of town member serials
Updated JS scripts making use of the above-mentioned JS Methods/Functions
Updated dictionaries with new tweak menu entry texts
Exposed SpawnRegions to JS engine, and updated JS docs with details:
SpawnRegion JS Functions
IterateOverSpawnRegions()
GetSpawnRegion( spawnRegNum )
GetSpawnRegionCount()
SpawnRegion JS Properties
name
regionNum
itemList
npcList
item
npc
maxItems
maxNpcs
itemCount
npcCount
onlyOutside
prefZ
x1
y1
x2
y2
world
instanceID
minTime
maxTime
call
2020-08-08 13:57:15 +08:00
//| Purpose - Clears the screen
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : ClearScreen ( ) - > void
{
DoClearScreen ( ) ;
2002-04-07 20:53:41 +00:00
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::PrintBasedOnVal()
//o------------------------------------------------------------------------------------------------o
//| Purpose - Prints "done" or "failed" messages based on boolean passed in
//o------------------------------------------------------------------------------------------------o
auto CConsole : : PrintBasedOnVal ( bool value ) - > void
{
if ( value )
{
2002-04-07 20:53:41 +00:00
PrintDone ( ) ;
2022-06-11 07:55:06 -04:00
}
2022-10-24 18:39:33 +08:00
else
{
2002-04-07 20:53:41 +00:00
PrintFailed ( ) ;
2022-06-11 07:55:06 -04:00
}
2002-04-07 20:53:41 +00:00
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::Warning()
//o------------------------------------------------------------------------------------------------o
Instance-support and misc code cleanup
Misc code and documentation cleanup:
Updated and standardized function comment blocks throughout entire codebase
Grouped getters and setters together in pairs and documented them as one
Removed empty and/or non-useful information from comment blocks
Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors
Added new feature - Instances
Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified.
Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present)
Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present)
Updated TWEAK menu to include WorldNumber and instanceID
Fixed BaseWeight option in TWEAK menu
Updated CBase_Teleport - now takes an optional 5th parameter instanceID
Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID
Updated SE_FindMulti now takes an optional 5th parameter - instanceID
Updated SE_GetItem now takes an optional 5th parameter - instanceID
Updated SE_FindItem now takes an optional 6th parameter - instanceID
Added new JS property for Items, Characters, Regions: .instanceID
Added JS property for Regions: .members - returns comma-separated list of town member serials
Updated JS scripts making use of the above-mentioned JS Methods/Functions
Updated dictionaries with new tweak menu entry texts
Exposed SpawnRegions to JS engine, and updated JS docs with details:
SpawnRegion JS Functions
IterateOverSpawnRegions()
GetSpawnRegion( spawnRegNum )
GetSpawnRegionCount()
SpawnRegion JS Properties
name
regionNum
itemList
npcList
item
npc
maxItems
maxNpcs
itemCount
npcCount
onlyOutside
prefZ
x1
y1
x2
y2
world
instanceID
minTime
maxTime
call
2020-08-08 13:57:15 +08:00
//| Purpose - Writes to the warning log and the console.
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : Warning ( const std : : string & msg ) - > void
{
2012-11-03 18:11:04 +00:00
UI08 oldMode = CurrentMode ( ) ;
2002-04-07 20:53:41 +00:00
CurrentMode ( WARNINGMODE ) ;
2022-10-24 18:39:33 +08:00
Log ( msg , " warning.log " ) ;
if ( curLeft ! = 0 )
{
( * this ) < < myendl ;
2022-06-11 07:55:06 -04:00
}
2002-04-07 20:53:41 +00:00
TurnBlue ( ) ;
2022-10-24 18:39:33 +08:00
( * this ) < < " WARNING: " < < ( const char * ) & msg [ 0 ] < < myendl ;
2002-04-07 20:53:41 +00:00
TurnNormal ( ) ;
2022-10-24 18:39:33 +08:00
CurrentMode ( oldMode ) ;
2002-04-07 20:53:41 +00:00
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - Console::CurrentMode()
//o------------------------------------------------------------------------------------------------o
Instance-support and misc code cleanup
Misc code and documentation cleanup:
Updated and standardized function comment blocks throughout entire codebase
Grouped getters and setters together in pairs and documented them as one
Removed empty and/or non-useful information from comment blocks
Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors
Added new feature - Instances
Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified.
Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present)
Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present)
Updated TWEAK menu to include WorldNumber and instanceID
Fixed BaseWeight option in TWEAK menu
Updated CBase_Teleport - now takes an optional 5th parameter instanceID
Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID
Updated SE_FindMulti now takes an optional 5th parameter - instanceID
Updated SE_GetItem now takes an optional 5th parameter - instanceID
Updated SE_FindItem now takes an optional 6th parameter - instanceID
Added new JS property for Items, Characters, Regions: .instanceID
Added JS property for Regions: .members - returns comma-separated list of town member serials
Updated JS scripts making use of the above-mentioned JS Methods/Functions
Updated dictionaries with new tweak menu entry texts
Exposed SpawnRegions to JS engine, and updated JS docs with details:
SpawnRegion JS Functions
IterateOverSpawnRegions()
GetSpawnRegion( spawnRegNum )
GetSpawnRegionCount()
SpawnRegion JS Properties
name
regionNum
itemList
npcList
item
npc
maxItems
maxNpcs
itemCount
npcCount
onlyOutside
prefZ
x1
y1
x2
y2
world
instanceID
minTime
maxTime
call
2020-08-08 13:57:15 +08:00
//| Purpose - Gets/Sets console's output mode
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : CurrentMode ( ) const - > std : : uint8_t
{
2002-04-07 20:53:41 +00:00
return currentMode ;
}
2022-10-24 18:39:33 +08:00
auto CConsole : : CurrentMode ( std : : uint8_t value ) - > void
{
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
currentMode = value ;
}
2002-04-07 20:53:41 +00:00
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::PrintStartOfLine()
//o------------------------------------------------------------------------------------------------o
Instance-support and misc code cleanup
Misc code and documentation cleanup:
Updated and standardized function comment blocks throughout entire codebase
Grouped getters and setters together in pairs and documented them as one
Removed empty and/or non-useful information from comment blocks
Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors
Added new feature - Instances
Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified.
Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present)
Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present)
Updated TWEAK menu to include WorldNumber and instanceID
Fixed BaseWeight option in TWEAK menu
Updated CBase_Teleport - now takes an optional 5th parameter instanceID
Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID
Updated SE_FindMulti now takes an optional 5th parameter - instanceID
Updated SE_GetItem now takes an optional 5th parameter - instanceID
Updated SE_FindItem now takes an optional 6th parameter - instanceID
Added new JS property for Items, Characters, Regions: .instanceID
Added JS property for Regions: .members - returns comma-separated list of town member serials
Updated JS scripts making use of the above-mentioned JS Methods/Functions
Updated dictionaries with new tweak menu entry texts
Exposed SpawnRegions to JS engine, and updated JS docs with details:
SpawnRegion JS Functions
IterateOverSpawnRegions()
GetSpawnRegion( spawnRegNum )
GetSpawnRegionCount()
SpawnRegion JS Properties
name
regionNum
itemList
npcList
item
npc
maxItems
maxNpcs
itemCount
npcCount
onlyOutside
prefZ
x1
y1
x2
y2
world
instanceID
minTime
maxTime
call
2020-08-08 13:57:15 +08:00
//| Purpose - Set colour of console text at start of a new line
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : PrintStartOfLine ( ) - > void
{
2002-04-07 20:53:41 +00:00
TurnBrightWhite ( ) ;
2003-01-13 15:58:29 +00:00
std : : cout < < " | " ;
2022-10-24 18:39:33 +08:00
switch ( previousColour )
{
2012-11-03 18:11:04 +00:00
case CBLUE : TurnBlue ( ) ; break ;
case CRED : TurnRed ( ) ; break ;
case CGREEN : TurnGreen ( ) ; break ;
case CYELLOW : TurnYellow ( ) ; break ;
2022-10-24 18:39:33 +08:00
case CBWHITE : break ; // current colour
2012-11-03 18:11:04 +00:00
case CNORMAL :
default : TurnNormal ( ) ; break ;
2002-04-07 20:53:41 +00:00
}
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::MoveTo( SI32 x, SI32 y )
//o------------------------------------------------------------------------------------------------o
Instance-support and misc code cleanup
Misc code and documentation cleanup:
Updated and standardized function comment blocks throughout entire codebase
Grouped getters and setters together in pairs and documented them as one
Removed empty and/or non-useful information from comment blocks
Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors
Added new feature - Instances
Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified.
Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present)
Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present)
Updated TWEAK menu to include WorldNumber and instanceID
Fixed BaseWeight option in TWEAK menu
Updated CBase_Teleport - now takes an optional 5th parameter instanceID
Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID
Updated SE_FindMulti now takes an optional 5th parameter - instanceID
Updated SE_GetItem now takes an optional 5th parameter - instanceID
Updated SE_FindItem now takes an optional 6th parameter - instanceID
Added new JS property for Items, Characters, Regions: .instanceID
Added JS property for Regions: .members - returns comma-separated list of town member serials
Updated JS scripts making use of the above-mentioned JS Methods/Functions
Updated dictionaries with new tweak menu entry texts
Exposed SpawnRegions to JS engine, and updated JS docs with details:
SpawnRegion JS Functions
IterateOverSpawnRegions()
GetSpawnRegion( spawnRegNum )
GetSpawnRegionCount()
SpawnRegion JS Properties
name
regionNum
itemList
npcList
item
npc
maxItems
maxNpcs
itemCount
npcCount
onlyOutside
prefZ
x1
y1
x2
y2
world
instanceID
minTime
maxTime
call
2020-08-08 13:57:15 +08:00
//| Purpose - Set console cursor position
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
2021-06-12 08:02:17 -04:00
# if PLATFORM == WINDOWS
2022-10-24 18:39:33 +08:00
auto CConsole : : MoveTo ( SI32 x , SI32 y ) - > void
{
auto hco = GetStdHandle ( STD_OUTPUT_HANDLE ) ;
2002-04-07 20:53:41 +00:00
COORD Pos ;
2022-10-24 18:39:33 +08:00
if ( y = = - 1 )
{
2002-04-07 20:53:41 +00:00
CONSOLE_SCREEN_BUFFER_INFO ScrBuffInfo ;
GetConsoleScreenBufferInfo ( hco , & ScrBuffInfo ) ;
Pos . Y = ScrBuffInfo . dwCursorPosition . Y ;
2022-10-24 18:39:33 +08:00
Pos . X = static_cast < UI16 > ( x ) ;
2002-04-07 20:53:41 +00:00
SetConsoleCursorPosition ( hco , Pos ) ;
2012-11-03 18:11:04 +00:00
}
2022-10-24 18:39:33 +08:00
else
{
Pos . X = static_cast < UI16 > ( x ) ;
Pos . Y = static_cast < UI16 > ( y ) ;
2002-04-07 20:53:41 +00:00
SetConsoleCursorPosition ( hco , Pos ) ;
}
}
# else
2022-11-14 21:12:12 -05:00
void CConsole : : MoveTo ( SI32 x , [[maybe_unused]] SI32 y )
2022-10-24 18:39:33 +08:00
{
2003-03-10 23:40:08 +00:00
std : : cout < < " \033 [255D " ;
std : : cout < < " \033 [ " < < x < < " C " ;
2002-04-07 20:53:41 +00:00
}
# endif
2003-03-04 13:44:35 +00:00
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::LogEcho()
//o------------------------------------------------------------------------------------------------o
Instance-support and misc code cleanup
Misc code and documentation cleanup:
Updated and standardized function comment blocks throughout entire codebase
Grouped getters and setters together in pairs and documented them as one
Removed empty and/or non-useful information from comment blocks
Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors
Added new feature - Instances
Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified.
Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present)
Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present)
Updated TWEAK menu to include WorldNumber and instanceID
Fixed BaseWeight option in TWEAK menu
Updated CBase_Teleport - now takes an optional 5th parameter instanceID
Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID
Updated SE_FindMulti now takes an optional 5th parameter - instanceID
Updated SE_GetItem now takes an optional 5th parameter - instanceID
Updated SE_FindItem now takes an optional 6th parameter - instanceID
Added new JS property for Items, Characters, Regions: .instanceID
Added JS property for Regions: .members - returns comma-separated list of town member serials
Updated JS scripts making use of the above-mentioned JS Methods/Functions
Updated dictionaries with new tweak menu entry texts
Exposed SpawnRegions to JS engine, and updated JS docs with details:
SpawnRegion JS Functions
IterateOverSpawnRegions()
GetSpawnRegion( spawnRegNum )
GetSpawnRegionCount()
SpawnRegion JS Properties
name
regionNum
itemList
npcList
item
npc
maxItems
maxNpcs
itemCount
npcCount
onlyOutside
prefZ
x1
y1
x2
y2
world
instanceID
minTime
maxTime
call
2020-08-08 13:57:15 +08:00
//| Purpose - Checks whether console should echo log messages
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : LogEcho ( ) const - > bool
{
2003-03-04 13:44:35 +00:00
return logEcho ;
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::LogEcho()
Instance-support and misc code cleanup
Misc code and documentation cleanup:
Updated and standardized function comment blocks throughout entire codebase
Grouped getters and setters together in pairs and documented them as one
Removed empty and/or non-useful information from comment blocks
Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors
Added new feature - Instances
Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified.
Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present)
Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present)
Updated TWEAK menu to include WorldNumber and instanceID
Fixed BaseWeight option in TWEAK menu
Updated CBase_Teleport - now takes an optional 5th parameter instanceID
Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID
Updated SE_FindMulti now takes an optional 5th parameter - instanceID
Updated SE_GetItem now takes an optional 5th parameter - instanceID
Updated SE_FindItem now takes an optional 6th parameter - instanceID
Added new JS property for Items, Characters, Regions: .instanceID
Added JS property for Regions: .members - returns comma-separated list of town member serials
Updated JS scripts making use of the above-mentioned JS Methods/Functions
Updated dictionaries with new tweak menu entry texts
Exposed SpawnRegions to JS engine, and updated JS docs with details:
SpawnRegion JS Functions
IterateOverSpawnRegions()
GetSpawnRegion( spawnRegNum )
GetSpawnRegionCount()
SpawnRegion JS Properties
name
regionNum
itemList
npcList
item
npc
maxItems
maxNpcs
itemCount
npcCount
onlyOutside
prefZ
x1
y1
x2
y2
world
instanceID
minTime
maxTime
call
2020-08-08 13:57:15 +08:00
//| Date - 2/03/2003
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
Instance-support and misc code cleanup
Misc code and documentation cleanup:
Updated and standardized function comment blocks throughout entire codebase
Grouped getters and setters together in pairs and documented them as one
Removed empty and/or non-useful information from comment blocks
Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors
Added new feature - Instances
Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified.
Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present)
Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present)
Updated TWEAK menu to include WorldNumber and instanceID
Fixed BaseWeight option in TWEAK menu
Updated CBase_Teleport - now takes an optional 5th parameter instanceID
Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID
Updated SE_FindMulti now takes an optional 5th parameter - instanceID
Updated SE_GetItem now takes an optional 5th parameter - instanceID
Updated SE_FindItem now takes an optional 6th parameter - instanceID
Added new JS property for Items, Characters, Regions: .instanceID
Added JS property for Regions: .members - returns comma-separated list of town member serials
Updated JS scripts making use of the above-mentioned JS Methods/Functions
Updated dictionaries with new tweak menu entry texts
Exposed SpawnRegions to JS engine, and updated JS docs with details:
SpawnRegion JS Functions
IterateOverSpawnRegions()
GetSpawnRegion( spawnRegNum )
GetSpawnRegionCount()
SpawnRegion JS Properties
name
regionNum
itemList
npcList
item
npc
maxItems
maxNpcs
itemCount
npcCount
onlyOutside
prefZ
x1
y1
x2
y2
world
instanceID
minTime
maxTime
call
2020-08-08 13:57:15 +08:00
//| Purpose - Enables/Disables whether console should echo log messages
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : LogEcho ( bool value ) - > void
{
2003-03-04 13:44:35 +00:00
logEcho = value ;
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::StartOfLineCheck()
//o------------------------------------------------------------------------------------------------o
Instance-support and misc code cleanup
Misc code and documentation cleanup:
Updated and standardized function comment blocks throughout entire codebase
Grouped getters and setters together in pairs and documented them as one
Removed empty and/or non-useful information from comment blocks
Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors
Added new feature - Instances
Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified.
Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present)
Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present)
Updated TWEAK menu to include WorldNumber and instanceID
Fixed BaseWeight option in TWEAK menu
Updated CBase_Teleport - now takes an optional 5th parameter instanceID
Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID
Updated SE_FindMulti now takes an optional 5th parameter - instanceID
Updated SE_GetItem now takes an optional 5th parameter - instanceID
Updated SE_FindItem now takes an optional 6th parameter - instanceID
Added new JS property for Items, Characters, Regions: .instanceID
Added JS property for Regions: .members - returns comma-separated list of town member serials
Updated JS scripts making use of the above-mentioned JS Methods/Functions
Updated dictionaries with new tweak menu entry texts
Exposed SpawnRegions to JS engine, and updated JS docs with details:
SpawnRegion JS Functions
IterateOverSpawnRegions()
GetSpawnRegion( spawnRegNum )
GetSpawnRegionCount()
SpawnRegion JS Properties
name
regionNum
itemList
npcList
item
npc
maxItems
maxNpcs
itemCount
npcCount
onlyOutside
prefZ
x1
y1
x2
y2
world
instanceID
minTime
maxTime
call
2020-08-08 13:57:15 +08:00
//| Purpose - Reduces excess work in overloaded functions by checking
//| to see if the start of line has to be done here
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : StartOfLineCheck ( ) - > void
{
if ( curLeft = = 0 )
{
2003-03-04 13:44:35 +00:00
PrintStartOfLine ( ) ;
curLeft = 1 ;
}
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::PrintSpecial()
//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 - This is much like PrintFailed, PrintDone and so on except
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
//| we specify the text and the colour
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : PrintSpecial ( UI08 colour , const std : : string & msg ) - > void
{
2012-11-03 18:11:04 +00:00
StartOfLineCheck ( ) ;
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 stringLength = msg . size ( ) + 3 ;
2022-10-24 18:39:33 +08:00
MoveTo ( static_cast < SI32 > ( width - stringLength ) ) ;
2012-11-03 18:11:04 +00:00
TurnNormal ( ) ;
2022-10-24 18:39:33 +08:00
( * this ) < < " [ " ;
switch ( colour )
{
2003-03-04 13:44:35 +00:00
default :
case CNORMAL : break ;
case CBLUE : TurnBlue ( ) ; break ;
case CRED : TurnRed ( ) ; break ;
case CGREEN : TurnGreen ( ) ; break ;
case CYELLOW : TurnYellow ( ) ; break ;
case CBWHITE : TurnBrightWhite ( ) ; break ;
2012-11-03 18:11:04 +00:00
}
2022-10-24 18:39:33 +08:00
( * this ) < < msg ;
2012-11-03 18:11:04 +00:00
TurnNormal ( ) ;
2022-10-24 18:39:33 +08:00
( * this ) < < " ] " < < myendl ;
2012-11-03 18:11:04 +00:00
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::cl_getch()
//o------------------------------------------------------------------------------------------------o
2012-11-03 18:11:04 +00:00
//| Purpose - Read a character from stdin, in a cluox compatble way.
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
//| This routine is non-blocking!
2012-11-03 18:11:04 +00:00
//| Returns - >0 -> character read
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
//| -1 -> no char available.
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
Instance-support and misc code cleanup
Misc code and documentation cleanup:
Updated and standardized function comment blocks throughout entire codebase
Grouped getters and setters together in pairs and documented them as one
Removed empty and/or non-useful information from comment blocks
Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors
Added new feature - Instances
Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified.
Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present)
Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present)
Updated TWEAK menu to include WorldNumber and instanceID
Fixed BaseWeight option in TWEAK menu
Updated CBase_Teleport - now takes an optional 5th parameter instanceID
Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID
Updated SE_FindMulti now takes an optional 5th parameter - instanceID
Updated SE_GetItem now takes an optional 5th parameter - instanceID
Updated SE_FindItem now takes an optional 6th parameter - instanceID
Added new JS property for Items, Characters, Regions: .instanceID
Added JS property for Regions: .members - returns comma-separated list of town member serials
Updated JS scripts making use of the above-mentioned JS Methods/Functions
Updated dictionaries with new tweak menu entry texts
Exposed SpawnRegions to JS engine, and updated JS docs with details:
SpawnRegion JS Functions
IterateOverSpawnRegions()
GetSpawnRegion( spawnRegNum )
GetSpawnRegionCount()
SpawnRegion JS Properties
name
regionNum
itemList
npcList
item
npc
maxItems
maxNpcs
itemCount
npcCount
onlyOutside
prefZ
x1
y1
x2
y2
world
instanceID
minTime
maxTime
call
2020-08-08 13:57:15 +08:00
//| Notes - now cluox is GUI wrapper over uox using stdin and stdout redirection to capture
Numerous changes with focus on feature and stability parity across Windows, Linux and MacOS platforms
Added new Makefile that handles compiling UOX3 and Spidermonkey on both Linux and MacOS (punt)
Added VS solution (SpiderMonkey.sln) and VC++ project files for compiling SpiderMonkey on Windows (Xuri)
Updated SpiderMonkey from v1.6.0 to v1.7.0
Added optimization flag -O2 for release build in CMakeLists.txt in project root (Xuri)
Added StringUtility file with general common string manipulation functions (punt)
Updated RandomNum function to use a "seedless" random number generator from C++11 instead of the old C rand() function. (punt)
Overall code cleanup to remove/replace platform-dependent code (punt)
Replaced potentially unsafe usage of C string stuff like sprintf, vsprintf, vsnprintf, strncat, strcpy and strlen throughout the code with calls to a format() function containing only a single, safe use of vsnprintf, ensuring there's a single place of failure if there's anything to fix and and making it easy to potentially replace this with std::format from C++20 when the time comes. (punt)
Replaced usage of char in many places with std::string (punt)
Started process of replacing UString usage with functions provided through StringUtility instead (punt)
Replaced platform specific fileIO handling in Windows/Linux with cross-platform C++17 standard std::filesystem (punt)
Replaced platform specific time handling by using cross-platform chrono library (punt)
Removed UOX namespace to reduce complexity (punt)
Elimitated template code approach to singletons for more modern c++ constructs, removing dependices in the process (punt)
Removed ODBC support; it hasn't been touched since the initial implementation in 2008, and there is a lack of someone to maintain the code. (punt)
Removed some platform specific files like uoxlinux.h, which is no longer required (punt)
Removed legacy crash protection code, and removed support for cluox (punt)
Removed legacy "support" for Borland compiler (punt)
Removed legacy VC++ 6 Workspace/Project files, VS2005 Solution/Project files, as these are no longer supported (Xuri)
Removed legacy BUILD folder with outdated compilation instructions (Xuri)
Removed old Changelog file (merged into Changelog.txt) (Xuri)
Fixed a pointer bug for items in multis on world load (punt)
Fixed a dictionary related issue that caused segmentation faults on Linux/MacOS (punt)
Fixed an issue with callbacks to JS scripts that caused segmentation faults on Linux/MacOS (punt)
Paths in uox.ini should now load properly on all platforms regardless of whether those paths use slashes or backslashes, and whether or not they end in a slash/backslash. (punt)
Moved to c++17 style of threading, and got rid of threadsafeobject.cpp/h (punt)
Replaced parsing of UOX.INI tags with a system that's more easily maintainable (punt)
Added some new commands to js/commands/custom/misc-cmd.js (Xuri)
cont // Targeted item will be made a container, set to nondecay and movable 2
endfight // Targeted character (and character being fought) will stop fighting
getmulti // Get multiObject for targeted item
finditem // Find item at layer X
movespeed // Set movement speed of target player (0x0 Normal, 0x1 Mounted, 0x2 Slow (walk only), 0x3 Hybrid ("jog"?), 0x4 Frozen)
Added new HTML based documentation in docs folder, and removed many old legacy docs that are either incorporated into this document already or no longer relevant for the current UOX3 version (Xuri)
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2020-09-07 18:09:55 +08:00
//| the console, if it is active uox can't use kbhit() to determine if there is a
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
//| character aviable, it can only get one directly by getch().
//| However the problem arises that uox will get blocked if none is aviable.
//| The solution to this problem is that cluox also hands over the second pipe-end
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
//| of stdin so uox can write itself into this stream. To determine if a character is
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
//| now done that way. UOX write's itself a ZERO on the other end of the pipe, and reads
//| a charecter, if it is again the same ZERO just putted in nothing was entered. However
//| it is not a zero the user has entered a char.
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : cl_getch ( ) - > std : : int32_t
{
2021-06-12 08:02:17 -04:00
# if PLATFORM != WINDOWS
2022-10-24 18:39:33 +08:00
char data = 0 ;
auto a = : : read ( 0 , & data , 1 ) ; // This doesn't block on getting a line due to initalization
if ( a > 0 )
{
2022-01-12 08:33:44 +08:00
// Look for escape!
2022-10-24 18:39:33 +08:00
if ( data = = 27 )
{
2022-01-10 07:33:51 +08:00
// This was an escape, see if we have another item
2022-10-24 18:39:33 +08:00
a = : : read ( 0 , & data , 1 ) ;
if ( a > 0 )
{
2022-01-12 08:33:44 +08:00
// See if this is a CSI
2022-10-24 18:39:33 +08:00
if ( data = = ' [ ' )
{
2022-01-12 08:33:44 +08:00
// It is an control sequence!
// Some sequences end with a ~, some dont. So, we now get to see
2022-10-24 18:39:33 +08:00
a = : : read ( 0 , & data , 1 ) ;
while ( a > 0 )
{
if ( ( data = = ' A ' ) | | ( data = = ' B ' ) | | ( data = = ' C ' ) | | ( data = = ' D ' ) | | ( ( data = = ' H ' ) & & ( data = = ' F ' ) ) | | ( data = = ' ~ ' ) )
{
2022-01-12 08:33:44 +08:00
break ;
}
2022-10-24 18:39:33 +08:00
a = : : read ( 0 , & data , 1 ) ;
2022-01-12 08:33:44 +08:00
}
return - 1 ;
}
2022-10-24 18:39:33 +08:00
else if ( data = = ' O ' ) // this could be F1-F4
{
a = : : read ( 0 , & data , 1 ) ;
if ( a > 0 )
{
if ( ( data = = ' P ' ) | | ( data = = ' Q ' ) | | ( data = = ' R ' ) | | ( data = = ' S ' ) )
{
2022-01-12 08:33:44 +08:00
// It was F1,F2,F3,F4
return - 1 ;
}
// Soooooo, we have now lost two characters, this one and the preceeding O that where after the ESC
return 27 ;
}
// It wasnt, so we have a choice, return -1 (since we got ESC O, or return ESC and lose O
return 27 ;
}
2022-10-24 18:39:33 +08:00
else
{
2022-01-12 08:33:44 +08:00
// Ok, it isn't an CSI (Control Sequence). But we have all ready lost/read the next
// character. That will be lost, return escape
return 27 ;
}
2022-01-10 07:33:51 +08:00
}
2022-10-24 18:39:33 +08:00
else
{
2022-01-12 08:33:44 +08:00
// There was nothing after the escape, so just send the escape
2022-01-10 07:33:51 +08:00
return 27 ; // return escape
}
}
2022-01-12 08:33:44 +08:00
// Not escape if here, so just return it
2022-10-24 18:39:33 +08:00
return static_cast < SI32 > ( data ) ;
2012-11-03 18:11:04 +00:00
}
2022-10-24 18:39:33 +08:00
else
{
Fixes for Console behaviour on Linux and Windows, addition of JS properties for user accounts
Fixed long-standing issue with UOX3 console not resetting terminal properly after shutdown on Linux, after updating cConsole.cpp/h to conform to standard unix terminal commands/settings for certain features (punt)
Fixed an issue that could cause a crash on Windows when attempting to broadcast system messages from the UOX3 console (punt)
Fixed an issue that prevented text input in UOX3 console for system broadcasts from being displayed on Linux and MacOS (punt)
Added support for new JS Object - IUE_ACCOUNT - which can be accessed via character property .account. The following account properties have been exposed to the JS engine:
.id // Account ID (Read-Only)
.username // Account Username (Read-Only)
.flags // Flags set on account (Read-Only)
.comment // Comment/contact info
.character1 // Character in account slot 1 (Read-Only)
.character2 // Character in account slot 2 (Read-Only)
.character3 // Character in account slot 3 (Read-Only)
.character4 // Character in account slot 4 (Read-Only)
.character5 // Character in account slot 5 (Read-Only)
.character6 // Character in account slot 6 (Read-Only)
.character7 // Character in account slot 7 (Read-Only)
.currentChar // Currently logged in character (if any) (Read-Only)
.lastIP // Last IP used to connect to account (Read-Only)
// Flag shortcuts
.isBanned // Is account banned?
.isSuspended // Is account suspended?
.isPublic // Is comment/contact info to be considered public info?
.isOnline // Is account online?
.isSlot1Blocked // Is character slot 1 blocked?
.isSlot2Blocked // Is character slot 2 blocked?
.isSlot3Blocked // Is character slot 3 blocked?
.isSlot4Blocked // Is character slot 4 blocked?
.isSlot5Blocked // Is character slot 5 blocked?
.isSlot6Blocked // Is character slot 6 blocked?
.isSlot7Blocked // Is character slot 7 blocked?
.unused9 // Unused flag
.unused10 // Unused flag
.isSeer // Is account marked as Seer account?
.isCounselor // Is account marked as Counselor account?
.isGM // Is account marked as GM account?
Fixed 'addaccount command - can now once again be used to add a new user account to the server from in-game. See accounts.adm for info on available flags. Syntax:
'addaccount [username] [password] [(optional)flags]
Updated 'get command to allow retrieving certain account properties for targeted player characters:
username, flags, comment, character1, character2, character3, character4, character5, character6, character7, lastIP, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor and isGM
Updated 'set command to allow setting certain account properties for targeted player characters:
comment, password, isBanned, isSuspended, isPublic, isOnline, isSlot1Blocked, isSlot2Blocked, isSlot3Blocked, isSlot4Blocked, isSlot5Blocked, isSlot6Blocked, isSlot7Blocked, unused9, unused10, isSeer, isCounselor, isGM
Updated 'tweak command to allow viewing and modifying of certain account properties for targeted player characters
Note that any changes to account properties will not go into effect until a worldsave or manual save of accounts via console has taken place.
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2021-04-16 21:14:50 +08:00
return - 1 ;
2012-11-03 18:11:04 +00:00
}
2022-10-24 18:39:33 +08:00
2012-11-03 18:11:04 +00:00
# else
2022-06-11 07:55:06 -04:00
// uox is not wrapped simply use the kbhit routine
2022-10-24 18:39:33 +08:00
if ( _kbhit ( ) )
{
2022-06-11 07:55:06 -04:00
return _getch ( ) ;
}
2022-10-24 18:39:33 +08:00
else
{
2022-06-11 07:55:06 -04:00
return - 1 ;
}
2012-11-03 18:11:04 +00:00
# endif
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::Poll()
//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 - Facilitate console control. SysOp keys, and localhost
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
//| controls.
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : Poll ( ) - > void
{
Code cleanup
Embraced the usage of R32, R64, SI16, UI16, SI32, UI32, SI64 and UI64 typedef aliases as replacement for built-in types throughout the sourcecode:
typedef float R32;
typedef double R64;
typedef signed char SI08;
typedef unsigned char UI08;
typedef signed short int SI16;
typedef unsigned short int UI16;
typedef signed int SI32;
typedef unsigned int UI32;
typedef signed long long SI64;
typedef unsigned long long UI64;
As part of this process, UI32 was redefined from unsigned long int to unsigned int, and SI32 from signed long int to signed int to ensure the size of variables using these remain the same (32bit) across both Windows, Linux and MacOS for both 32bit and 64bit platforms
Replaced instances of toLong() with toInt(), and toULong() to toUInt()
Replaced instances of "long" and "int" with SI32 where possible
Replaced instances of "unsigned long" and "unsigned int" with UI32 where possible
Replaced instances of "float" with R32 where possible
2020-08-12 23:46:33 +08:00
SI32 c = cl_getch ( ) ;
2022-10-24 18:39:33 +08:00
if ( c > 0 )
{
c = std : : toupper ( c ) ;
2012-11-03 18:11:04 +00:00
Process ( c ) ;
2003-03-04 13:44:35 +00:00
}
}
2012-11-03 18:11:04 +00:00
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::Process()
//o------------------------------------------------------------------------------------------------o
Instance-support and misc code cleanup
Misc code and documentation cleanup:
Updated and standardized function comment blocks throughout entire codebase
Grouped getters and setters together in pairs and documented them as one
Removed empty and/or non-useful information from comment blocks
Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors
Added new feature - Instances
Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified.
Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present)
Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present)
Updated TWEAK menu to include WorldNumber and instanceID
Fixed BaseWeight option in TWEAK menu
Updated CBase_Teleport - now takes an optional 5th parameter instanceID
Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID
Updated SE_FindMulti now takes an optional 5th parameter - instanceID
Updated SE_GetItem now takes an optional 5th parameter - instanceID
Updated SE_FindItem now takes an optional 6th parameter - instanceID
Added new JS property for Items, Characters, Regions: .instanceID
Added JS property for Regions: .members - returns comma-separated list of town member serials
Updated JS scripts making use of the above-mentioned JS Methods/Functions
Updated dictionaries with new tweak menu entry texts
Exposed SpawnRegions to JS engine, and updated JS docs with details:
SpawnRegion JS Functions
IterateOverSpawnRegions()
GetSpawnRegion( spawnRegNum )
GetSpawnRegionCount()
SpawnRegion JS Properties
name
regionNum
itemList
npcList
item
npc
maxItems
maxNpcs
itemCount
npcCount
onlyOutside
prefZ
x1
y1
x2
y2
world
instanceID
minTime
maxTime
call
2020-08-08 13:57:15 +08:00
//| Purpose - Handle keypresses in console
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 - 05042004 - added some console debugging stuff.
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
//| Ideally this will all be placed onto a DEBUG menu which
//| a user will be able to select using the <, and > keys
//| respectivly. This functionality hasn't been implemented
//| at the current time of writing, but will be when possible.
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : Process ( std : : int32_t c ) - > void
{
if ( c = = ' * ' )
{
if ( cwmWorldState - > GetSecure ( ) )
{
2012-11-03 18:11:04 +00:00
messageLoop < < " Secure mode disabled. Press ? for a commands list " ;
2022-06-11 07:55:06 -04:00
}
2022-10-24 18:39:33 +08:00
else
{
2012-11-03 18:11:04 +00:00
messageLoop < < " Secure mode re-enabled " ;
2022-06-11 07:55:06 -04:00
}
2012-11-03 18:11:04 +00:00
cwmWorldState - > SetSecure ( ! cwmWorldState - > GetSecure ( ) ) ;
2022-10-24 18:39:33 +08:00
return ;
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
}
else
2012-11-03 18:11:04 +00:00
{
if ( cwmWorldState - > GetSecure ( ) )
{
messageLoop < < " Secure mode prevents keyboard commands! Press '*' to disable " ;
2022-10-24 18:39:33 +08:00
return ;
2012-11-03 18:11:04 +00:00
}
2022-10-24 18:39:33 +08:00
JSCONSOLEKEYMAP_ITERATOR toFind = JSKeyHandler . find ( c ) ;
if ( toFind ! = JSKeyHandler . end ( ) )
{
if ( toFind - > second . isEnabled )
{
cScript * toExecute = JSMapping - > GetScript ( toFind - > second . scriptId ) ;
if ( toExecute )
{
// All commands that execute are of the form: command_commandname (to avoid possible clashes)
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 defined( UOX_DEBUG_MODE )
2022-10-24 18:39:33 +08:00
Print ( oldstrutil : : format ( " Executing JS keystroke %c %s \n " , c , toFind - > second . cmdName . c_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
# endif
2022-10-24 18:39:33 +08:00
jsval eventRetVal ;
2023-07-02 19:23:21 +08:00
[[maybe_unused]] JSBool retVal = toExecute - > CallParticularEvent ( toFind - > second . cmdName . c_str ( ) , nullptr , 0 , & eventRetVal ) ;
2012-11-03 18:11:04 +00:00
}
2022-10-24 18:39:33 +08:00
return ;
2012-11-03 18:11:04 +00:00
}
2022-10-24 18:39:33 +08:00
}
2023-07-08 14:25:04 -04:00
[[maybe_unused]] CSocket * tSock = nullptr ;
2022-10-24 18:39:33 +08:00
//char outputline[128], temp[1024];
std : : string outputline , temp ;
SI32 indexcount = 0 ;
bool kill = false ;
SI32 j = 0 ;
switch ( c )
{
case ' ! ' :
// Force server to save accounts file
messageLoop < < " CMD: Saving Accounts... " ;
Accounts - > Save ( ) ;
messageLoop < < MSG_PRINTDONE ;
break ;
case ' @ ' :
// Force server to save all files.(Manual save)
messageLoop < < MSG_WORLDSAVE ;
break ;
case ' Y ' :
SI32 keyresp ;
std : : cout < < " System: " ;
std : : cout . flush ( ) ;
while ( ! kill )
{
keyresp = cl_getch ( ) ;
switch ( keyresp )
{
case - 1 : // no key pressed
case 0 :
break ;
case 0x1B :
outputline = " " ;
indexcount = 0 ;
kill = true ;
std : : cout < < std : : endl ;
messageLoop < < " CMD: System broadcast canceled. " ;
break ;
case 0x08 :
- - indexcount ;
if ( indexcount < 0 )
{
2022-06-11 07:55:06 -04:00
indexcount = 0 ;
}
2022-10-24 18:39:33 +08:00
else
{
std : : cout < < " \b \b " ;
}
break ;
case 0x0A :
case 0x0D :
outputline [ indexcount ] = 0 ;
messageLoop . NewMessage ( MSG_CONSOLEBCAST , outputline . c_str ( ) ) ;
indexcount = 0 ;
kill = true ;
std : : cout < < std : : endl ;
temp = oldstrutil : : format ( " CMD: System broadcast sent message \" %s \" " , outputline . c_str ( ) ) ;
outputline = " " ;
messageLoop < < temp ;
break ;
default :
outputline = outputline + std : : string ( 1 , static_cast < SI08 > ( keyresp ) ) ;
indexcount = indexcount + 1 ;
std : : cout < < static_cast < SI08 > ( keyresp ) ;
std : : cout . flush ( ) ;
break ;
2012-11-03 18:11:04 +00:00
}
2022-10-24 18:39:33 +08:00
keyresp = 0x00 ;
2012-11-03 18:11:04 +00:00
}
2022-10-24 18:39:33 +08:00
break ;
case ' [ ' :
{
// We want to group all the contents of the multimap container numerically by group. We rely on the self ordering in the multimap implementation to do this.
messageLoop < < " " ;
messageLoop < < " Auto-AddMenu Statistics " ;
messageLoop < < " " ;
std : : string szBuffer ;
// We need to get an iteration into the map first of all the top level ULONGs then we can get an equal range.
std : : map < UI32 , UI08 > localMap ;
localMap . clear ( ) ;
for ( ADDMENUMAP_CITERATOR CJ = g_mmapAddMenuMap . begin ( ) ; CJ ! = g_mmapAddMenuMap . end ( ) ; CJ + + )
{
// check to see if the group id has been checked already
if ( localMap . find ( CJ - > first ) = = localMap . end ( ) )
{
localMap . insert ( std : : make_pair ( CJ - > first , 0 ) ) ;
szBuffer = " " ;
szBuffer = oldstrutil : : format ( " AddMenuGroup %u: " , CJ - > first ) ;
messageLoop < < szBuffer ;
std : : pair < ADDMENUMAP_CITERATOR , ADDMENUMAP_CITERATOR > pairRange = g_mmapAddMenuMap . equal_range ( CJ - > first ) ;
SI32 count = 0 ;
for ( ADDMENUMAP_CITERATOR CI = pairRange . first ; CI ! = pairRange . second ; CI + + )
{
count + + ;
2022-06-11 07:55:06 -04:00
}
2022-10-24 18:39:33 +08:00
szBuffer = " " ;
szBuffer = oldstrutil : : format ( " Found %i Auto-AddMenu Item(s). " , count ) ;
messageLoop < < szBuffer ;
2022-06-11 07:55:06 -04:00
}
2022-10-24 18:39:33 +08:00
}
messageLoop < < MSG_SECTIONBEGIN ;
break ;
}
case ' < ' :
messageLoop < < " Function not implemented. " ;
break ;
case ' > ' :
messageLoop < < " Function not implemented. " ;
break ;
case 0x1B :
case ' Q ' :
messageLoop < < MSG_SECTIONBEGIN ;
messageLoop < < " CMD: Immediate Shutdown initialized! " ;
messageLoop < < MSG_SHUTDOWN ;
break ;
case ' 0 ' :
if ( ! cwmWorldState - > GetReloadingScripts ( ) )
{
cwmWorldState - > SetReloadingScripts ( true ) ;
// Reload all the files. If there are issues with these files change the order reloaded from here first.
cwmWorldState - > ServerData ( ) - > Load ( ) ;
messageLoop < < " CMD: Loading All " ;
messageLoop < < " Server INI... " ;
// Reload accounts, and update Access.adm if new accounts available.
messageLoop < < " Loading Accounts... " ;
Accounts - > Load ( ) ;
messageLoop < < MSG_PRINTDONE ;
// Reload Region Files
messageLoop < < " Loading Regions... " ;
UnloadRegions ( ) ;
LoadRegions ( ) ;
messageLoop < < MSG_PRINTDONE ;
messageLoop < < " Loading Teleport Locations... " ;
LoadTeleportLocations ( ) ;
messageLoop < < MSG_PRINTDONE ;
// Reload the serve spawn regions
messageLoop < < " Loading Spawn Regions... " ;
2025-04-29 09:34:51 +08:00
FileLookup - > Reload ( spawn_def ) ;
2022-10-24 18:39:33 +08:00
UnloadSpawnRegions ( ) ;
LoadSpawnRegions ( ) ;
messageLoop < < MSG_PRINTDONE ;
// Reload the server command list
messageLoop < < " Loading commands... " ;
Commands - > Load ( ) ;
messageLoop < < MSG_PRINTDONE ;
// Reload DFN's
messageLoop < < " Loading Server DFN... " ;
FileLookup - > Reload ( ) ;
messageLoop < < MSG_PRINTDONE ;
// messageLoop access is REQUIRED, as this function is executing in a different thread, so we need thread safety
messageLoop < < " Loading JSE Scripts... " ;
// Reload the current Spells
messageLoop < < " Loading spells... " ;
Magic - > LoadScript ( ) ;
messageLoop < < MSG_PRINTDONE ;
// Reload the HTML output templates
messageLoop < < " Loading HTML Templates... " ;
HTMLTemplates - > Unload ( ) ;
HTMLTemplates - > Load ( ) ;
cwmWorldState - > SetReloadingScripts ( false ) ;
messageLoop < < MSG_PRINTDONE ;
}
else
{
messageLoop < < " Server can only load one script at a time " ;
}
break ;
case ' T ' :
// Timed shut down(10 minutes)
messageLoop < < " CMD: 10 Minute Server Shutdown Announced(Timed) " ;
2025-05-31 01:47:47 +08:00
cwmWorldState - > SetEndTime ( BuildTimeValue ( 600.0 ) ) ;
2022-10-24 18:39:33 +08:00
EndMessage ( 0 ) ;
break ;
case ' D ' :
// Disconnect account 0 (useful when client crashes)
UOX3 0.99.6-RC6
Removed arbitrary and hidden restrictions on refreshing list of online players shown with 'wholist command
Fixed an issue where player ghosts that get teleported would not see themselves get updated to new location
Fixed a server crash from clients disconnecting while running server in debug mode
Improved how container updates are sent to players; now only sends to clients that have actually opened the container, and who are still within range
Added more information about UO data files being loaded during server startup
Enhanced the GM 'add menu to allow clicking directly on images of items/npcs to add them, and adjusted size of menus to accommodate this
Fixed an issue with fleeing NPCs that could cause them to attempt to flee across time and space, regardless of distance to target/attacker in combat
Added NPC AI that runs away from players if they get too close (even outside combat). Applied to hind, rabbits, squirrels, ferrets and various birds by default:
AI_ANIMAL_SCARED (aitype 12)
Fixed issues with NPCs fleeing forever, or getting stuck in flee/don't flee loop, by introducing max fleeing distance (50 tiles) and cooldown (30 sec) on fleeing
Updated onNameRequest JS Event to include third parameter with origin of name request, so script responses can be tailored appropriately:
onNameRequest( myObj, requestedBy, requestSource )
Potential values for requestSource:
0 - Speech/System Messages
1 - Guild Menus
2 - Stat Window (self)
3 - Stat Window (other)
4 - Tooltip
5 - Paperdoll Journal
6 - Paperdoll
7 - Single Click / All-Names
8 - System
9 - Secure Trade Window
Added Adaptive Performance System (APS) that dynamically adjust how often NPC AI/movement is checked based on overall shard performance. If performance drops below defined threshold, UOX3 gradually slows down checks for NPC AI/movement to prioritize player movement/speech/command responsiveness. If performance climbs back up above threshold, slowdowns are gradually removed. The following UOX.INI options have been added under [system] category to support this system:
APSPERFTHRESHOLD=50 // Performance threshold (measured in simulation cycles/sec) below which the APS kicks in
APSINTERVAL=100 // How often (in milliseconds) the APS checks performance and makes adjustments (if needed) to balance out shard performance
APSDELAYSTEP=50 // How much the delay timer is modified by (in milliseconds) each time APS makes adjustments
APSDELAYMAXCAP=2000 // Max amount of of delay APS can introduce for NPC AI/movement handling when attempting to restore shard performance
Added new JS Methods for Region objects:
.GetOrePrefs( oreType ) // Get ore preference data for ore type found in town region. Returned as an array containing the following data:
orePrefData -> [
oreName, // name of ore
color, // color of ore
minskill, // min skill to mine ore
ingotName, // name of ingot created from ore
makemenu, // makemenu entry for crafting something from ingot
oreChance, // default global chance of finding this ore type
scriptID // script attached to mined ore
],
orePrefChance // Chance of finding this ore type in given town region
.GetOreChance() // Get base chance of finding any ore in town region
Moved Mining skill plus gravedigging feature from hard code to scripts (js/skill/mining.js) to make it easier to maintain and/or customize, and removed hard coded variants
Gravedigging now relies on the ore resource system behind the scenes to restrict how often graves in a given area can be dug up
Fixed some incorrect references to .worldNumber Character property in misc scripts (should be .worldnumber)
Made some "hard-scripted" system messages in misc scripts use dictionary system instead
Added spawn region for banker NPCs in Serpent's Hold (dfndata/spawn/felucca/spawn_town_serpents_hold.dfn, dfndata/spawn/trammel/spawn_town_serpents_hold.dfn)
Fixed region definition of Ocllo to actually cover the entire town (dfndata/regions/regions.dfn)
Added numerous additional locations accessible with 'goplace # command, for key locations in Ilshenar, Malas, Tokuno Islands and Ter Mur (dfndata/location/location.dfn)
Revised travel-menu portion of GM menu (shortcut: 'travel) to include more travel options based on new locations (dfndata/items/travelmenu.dfn and travelmenu.bulk.dfn)
Fixed an issue where NPCs could attempt to attack targets in other worlds/instances
Added new JS Event that triggers for characters who are about to deal damage in combat. Complimentary to onDamage, which triggers for chars receiving damage:
onDamageDeal( dmgDealer, dmgReceiver, damageValue, damageType )
Added new JS Event that can trigger in global script upon creation of new player chars. Note that this will trigger in place of onCreateDFN event for player characters:
onCreatePlayer( pChar )
Added new JS Event that triggers for characters selecting a target with a spell. Complimentary to onSpellTarget, which triggers for targets selected with a spell:
onSpellTargetSelect( caster, target, spellNum )
Updated onCombatStart and onCombatEnd JS Events to also trigger for the other party in combat
Updated onPickup JS Event to include a third parameter - the potential container item was picked up from. Event now also triggers event in scripts attached to said containers:
onPickup( iPickedUp, pChar, iCont )
Added tracking of total playtime per individual character, and per account across all characters, and exposed these properties to JS engine:
.totalPlayTime // Account property, total playtime across all chars
.playTime // Character property, total playtime on given character only
Added new player-accessible command ('playtime) to spit out the playtime of current character/account as a whole (js/commands/playtime.js)
Implemented first version of Young Player System:
Replaced the UNUSED9 account flag with YOUNG, to be used by Young/New Player System
Added new JS Account property that gets/sets whether player account is considered Young:
.isYoung
Added new Char timers:
TIMER_YOUNGHEAL // Restricts how often Young players are healed by NPC healers
TIMER_YOUNGMESSAGE // Restricts how often Young players are warned about dangerous looking monsters in overworld
Updated GM commands 'get and 'set to get/set .isYoung property of player's account (js/commands/targeting/get.js and set.js)
Added new UOX.INI setting to enable/disable Young Player System (enabled by default):
YOUNGPLAYERSYSTEM=1
If Young Player System is enabled, all newly created player accounts are automatically marked with Young flag
Added new script to handle various restrictions and functions related to Young characters (js/player/young_player.js):
Young characters will have [Young] displayed over their head
Young characters will have their Young status checked and verified on every login + every stat/skill gain, to revoke the Young status if any of the following is true:
Account has a total playtime of more than 40 hours
Any character has more than 350 total (base) skill points
Any character has more than 70 skill points in a single skill
Any character has more than 150 total stat points
Any character has more than 80 stat points in a single stat
Young characters can renounce their Young status manually by saying the words "I renounce my young player status"
Young characters get two additional items upon creation:
a new player ticket (can be combined with any other players new player ticket for both players to get a reward)
a sextant (shows Young players directions to nearest moongate/bank regardless of where they are, as long as outdoors)
Young characters cannot target other player characters with hostile spells or skills
Young characters cannot be the target of other player characters' hostile spells or skills
Young characters can only cast beneficial spells upon themselves or other Young characters
Young characters can only be the target of beneficial spells from other Young players
Young players (and their pets/followers) cannot attack or harm any other players (or their pets/followers), nor themselves be attacked or harmed by any other players (or their pets/followers), whether from combat, spells, skills or items
Young players don't lose any of their items on death, and are teleported to the nearest healer upon death with all their items intact
Young players receive a warning upon entering dungeons that monsters there will be hostile
Updated global script (js/server/global.js) to:
Check/Verify Young status of players upon login
Attach young player script on login/creation for players on Young accounts
Give specific items to Young players upon creation
Added new script (js/item/corpse.js) that is assigned to all freshly created corpses. This script handles restrictions related to Young players interactions with corpses, and the interactions of other players with corpses of Young players
Updated JS Method .Carve() to return true/false depending on whether carving a corpse was successful
Updated Healer AI in code to heal nearby injured Young players
Updated Evil AI and Evil Caster AI in code to avoid selecting Young players as targets in combat outside of dungeons
Added a new section to UOX.INI - [young player starting locations] - that can be used to define starting locations for Young players. If only one such location is provided, all players start there. Otherwise, it matches the same starting location setup as the regular one - with one entry per town in Britannia.
Restricted transferring and/or friending of pets (code) and hirelings (hirelings.js) between Young and non-Young players
Restricted Young players from recalling or gating to Felucca facet
Young players can instantly logout from anywhere, at any time
2023-07-01 20:02:40 +08:00
for ( auto & tSock : Network - > connClients )
2022-10-24 18:39:33 +08:00
{
if ( tSock - > AcctNo ( ) = = 0 )
{
2012-11-03 18:11:04 +00:00
Network - > Disconnect ( tSock ) ;
2022-06-11 07:55:06 -04:00
}
2012-11-03 18:11:04 +00:00
}
2022-10-24 18:39:33 +08:00
messageLoop < < " CMD: Socket Disconnected(Account 0). " ;
break ;
case ' K ' :
{
for ( auto & tSock : Network - > connClients )
{
Network - > Disconnect ( tSock ) ;
2012-11-03 18:11:04 +00:00
}
2022-10-24 18:39:33 +08:00
messageLoop < < " CMD: All Connections Closed. " ;
}
break ;
case ' P ' :
{
UI32 networkTimeCount = cwmWorldState - > ServerProfile ( ) - > NetworkTimeCount ( ) ;
UI32 timerTimeCount = cwmWorldState - > ServerProfile ( ) - > TimerTimeCount ( ) ;
UI32 autoTimeCount = cwmWorldState - > ServerProfile ( ) - > AutoTimeCount ( ) ;
UI32 loopTimeCount = cwmWorldState - > ServerProfile ( ) - > LoopTimeCount ( ) ;
// 1/13/2003 - Dreoth - Log Performance Information enhancements
LogEcho ( true ) ;
Log ( " --- Starting Performance Dump --- " , " performance.log " ) ;
Log ( " \t Performance Dump: " , " performance.log " ) ;
Log ( oldstrutil : : format ( " \t Network code: %.2fmsec [%i samples] " , static_cast < R32 > ( static_cast < R32 > ( cwmWorldState - > ServerProfile ( ) - > NetworkTime ( ) ) / static_cast < R32 > ( networkTimeCount ) ) , networkTimeCount ) , " performance.log " ) ;
Log ( oldstrutil : : format ( " \t Timer code: %.2fmsec [%i samples] " , static_cast < R32 > ( static_cast < R32 > ( cwmWorldState - > ServerProfile ( ) - > TimerTime ( ) ) / static_cast < R32 > ( timerTimeCount ) ) , timerTimeCount ) , " performance.log " ) ;
Log ( oldstrutil : : format ( " \t Auto code: %.2fmsec [%i samples] " , static_cast < R32 > ( static_cast < R32 > ( cwmWorldState - > ServerProfile ( ) - > AutoTime ( ) ) / static_cast < R32 > ( autoTimeCount ) ) , autoTimeCount ) , " performance.log " ) ;
Log ( oldstrutil : : format ( " \t Loop Time: %.2fmsec [%i samples] " , static_cast < R32 > ( static_cast < R32 > ( cwmWorldState - > ServerProfile ( ) - > LoopTime ( ) ) / static_cast < R32 > ( loopTimeCount ) ) , loopTimeCount ) , " performance.log " ) ;
Log ( oldstrutil : : format ( " \t Characters: %i/%i - Items: %i/%i (Dynamic) " , ObjectFactory : : GetSingleton ( ) . CountOfObjects ( OT_CHAR ) , ObjectFactory : : GetSingleton ( ) . SizeOfObjects ( OT_CHAR ) , ObjectFactory : : GetSingleton ( ) . CountOfObjects ( OT_ITEM ) , ObjectFactory : : GetSingleton ( ) . SizeOfObjects ( OT_ITEM ) ) , " performance.log " ) ;
Log ( oldstrutil : : format ( " \t Simulation Cycles: %f per sec " , ( 1000.0 * ( 1.0 / static_cast < R32 > ( static_cast < R32 > ( cwmWorldState - > ServerProfile ( ) - > LoopTime ( ) ) / static_cast < R32 > ( loopTimeCount ) ) ) ) ) , " performance.log " ) ;
Log ( oldstrutil : : format ( " \t Bytes sent: %i " , cwmWorldState - > ServerProfile ( ) - > GlobalSent ( ) ) , " performance.log " ) ;
Log ( oldstrutil : : format ( " \t Bytes Received: %i " , cwmWorldState - > ServerProfile ( ) - > GlobalReceived ( ) ) , " performance.log " ) ;
Log ( " --- Performance Dump Complete --- " , " performance.log " ) ;
LogEcho ( false ) ;
break ;
}
case ' W ' :
{
// Display logged in chars
messageLoop < < " CMD: Current Users in the World: " ;
{
for ( auto & iSock : Network - > connClients )
2022-06-11 07:55:06 -04:00
{
2022-10-24 18:39:33 +08:00
+ + j ;
CChar * mChar = iSock - > CurrcharObj ( ) ;
temp = oldstrutil : : format ( " %i) %s [%x %x %x %x] " , j - 1 , mChar - > GetName ( ) . c_str ( ) , mChar - > GetSerial ( 1 ) , mChar - > GetSerial ( 2 ) , mChar - > GetSerial ( 3 ) , mChar - > GetSerial ( 4 ) ) ;
messageLoop < < temp ;
Numerous changes with focus on feature and stability parity across Windows, Linux and MacOS platforms
Added new Makefile that handles compiling UOX3 and Spidermonkey on both Linux and MacOS (punt)
Added VS solution (SpiderMonkey.sln) and VC++ project files for compiling SpiderMonkey on Windows (Xuri)
Updated SpiderMonkey from v1.6.0 to v1.7.0
Added optimization flag -O2 for release build in CMakeLists.txt in project root (Xuri)
Added StringUtility file with general common string manipulation functions (punt)
Updated RandomNum function to use a "seedless" random number generator from C++11 instead of the old C rand() function. (punt)
Overall code cleanup to remove/replace platform-dependent code (punt)
Replaced potentially unsafe usage of C string stuff like sprintf, vsprintf, vsnprintf, strncat, strcpy and strlen throughout the code with calls to a format() function containing only a single, safe use of vsnprintf, ensuring there's a single place of failure if there's anything to fix and and making it easy to potentially replace this with std::format from C++20 when the time comes. (punt)
Replaced usage of char in many places with std::string (punt)
Started process of replacing UString usage with functions provided through StringUtility instead (punt)
Replaced platform specific fileIO handling in Windows/Linux with cross-platform C++17 standard std::filesystem (punt)
Replaced platform specific time handling by using cross-platform chrono library (punt)
Removed UOX namespace to reduce complexity (punt)
Elimitated template code approach to singletons for more modern c++ constructs, removing dependices in the process (punt)
Removed ODBC support; it hasn't been touched since the initial implementation in 2008, and there is a lack of someone to maintain the code. (punt)
Removed some platform specific files like uoxlinux.h, which is no longer required (punt)
Removed legacy crash protection code, and removed support for cluox (punt)
Removed legacy "support" for Borland compiler (punt)
Removed legacy VC++ 6 Workspace/Project files, VS2005 Solution/Project files, as these are no longer supported (Xuri)
Removed legacy BUILD folder with outdated compilation instructions (Xuri)
Removed old Changelog file (merged into Changelog.txt) (Xuri)
Fixed a pointer bug for items in multis on world load (punt)
Fixed a dictionary related issue that caused segmentation faults on Linux/MacOS (punt)
Fixed an issue with callbacks to JS scripts that caused segmentation faults on Linux/MacOS (punt)
Paths in uox.ini should now load properly on all platforms regardless of whether those paths use slashes or backslashes, and whether or not they end in a slash/backslash. (punt)
Moved to c++17 style of threading, and got rid of threadsafeobject.cpp/h (punt)
Replaced parsing of UOX.INI tags with a system that's more easily maintainable (punt)
Added some new commands to js/commands/custom/misc-cmd.js (Xuri)
cont // Targeted item will be made a container, set to nondecay and movable 2
endfight // Targeted character (and character being fought) will stop fighting
getmulti // Get multiObject for targeted item
finditem // Find item at layer X
movespeed // Set movement speed of target player (0x0 Normal, 0x1 Mounted, 0x2 Slow (walk only), 0x3 Hybrid ("jog"?), 0x4 Frozen)
Added new HTML based documentation in docs folder, and removed many old legacy docs that are either incorporated into this document already or no longer relevant for the current UOX3 version (Xuri)
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2020-09-07 18:09:55 +08:00
}
2012-11-03 18:11:04 +00:00
}
2022-10-24 18:39:33 +08:00
temp = oldstrutil : : format ( " Total users online: %i " , j ) ;
messageLoop < < temp ;
break ;
}
case ' M ' :
UI32 tmp , total ;
total = 0 ;
tmp = 0 ;
messageLoop < < " CMD: UOX Memory Information: " ;
UI32 m , n ;
m = static_cast < std : : uint32_t > ( ObjectFactory : : GetSingleton ( ) . SizeOfObjects ( OT_CHAR ) ) ;
total + = tmp = m + m * sizeof ( CTEffect ) + m * sizeof ( SI08 ) + m * sizeof ( intptr_t ) * 5 ;
temp = oldstrutil : : format ( " Characters: %u bytes [%u chars ( %u allocated )] " , tmp , ObjectFactory : : GetSingleton ( ) . CountOfObjects ( OT_CHAR ) , m ) ;
messageLoop < < temp ;
n = static_cast < std : : uint32_t > ( ObjectFactory : : GetSingleton ( ) . SizeOfObjects ( OT_ITEM ) ) ;
total + = tmp = n + n * sizeof ( intptr_t ) * 4 ;
temp = oldstrutil : : format ( " Items: %u bytes [%u items ( %u allocated )] " , tmp , ObjectFactory : : GetSingleton ( ) . CountOfObjects ( OT_ITEM ) , n ) ;
messageLoop < < temp ;
temp = oldstrutil : : format ( " You save I: %lu & C: %lu bytes! " , m * sizeof ( CItem ) - ObjectFactory : : GetSingleton ( ) . CountOfObjects ( OT_ITEM ) , m * sizeof ( CChar ) - ObjectFactory : : GetSingleton ( ) . CountOfObjects ( OT_CHAR ) ) ;
total + = tmp = 69 * sizeof ( CSpellInfo ) ;
temp = oldstrutil : : format ( temp , " Spells: %i bytes " , tmp ) ;
messageLoop < < " Sizes: " ;
temp = oldstrutil : : format ( " CItem : %lu bytes " , sizeof ( CItem ) ) ;
messageLoop < < temp ;
temp = oldstrutil : : format ( " CChar : %lu bytes " , sizeof ( CChar ) ) ;
messageLoop < < temp ;
temp = oldstrutil : : format ( " TEffect: %lu bytes %lui total) " , sizeof ( CTEffect ) , sizeof ( CTEffect ) * cwmWorldState - > tempEffects . Num ( ) ) ;
messageLoop < < temp ;
temp = oldstrutil : : format ( " Approximate Total: %i bytes " , total ) ;
messageLoop < < temp ;
break ;
case ' ? ' :
messageLoop < < MSG_SECTIONBEGIN ;
messageLoop < < " Console commands: " ;
messageLoop < < MSG_SECTIONBEGIN ;
messageLoop < < " ShardOP: " ;
messageLoop < < " * - Lock/Unlock Console ? - Commands list(this) " ;
messageLoop < < " C - Configuration H - Unused " ;
messageLoop < < " Y - Console Broadcast Q - Quit/Exit " ;
messageLoop < < " Load Commands: " ;
messageLoop < < " 1 - Ini 2 - Accounts " ;
messageLoop < < " 3 - Regions 4 - Spawn Regions " ;
messageLoop < < " 5 - Spells 6 - Commands " ;
messageLoop < < " 7 - Dfn's 8 - JavaScript " ;
messageLoop < < " 9 - HTML Templates 0 - ALL(1-9) " ;
messageLoop < < " Save Commands: " ;
messageLoop < < " ! - Accounts @ - World(w/AccountImport) " ;
messageLoop < < " # - Unused $ - Unused " ;
messageLoop < < " % - Unused ^ - Unused " ;
messageLoop < < " & - Unused ( - Unused " ;
messageLoop < < " ) - Unused " ;
messageLoop < < " Server Maintenence: " ;
messageLoop < < " P - Performance W - Characters Online " ;
messageLoop < < " M - Memory Information T - 10 Minute Shutdown " ;
messageLoop < < " F - Display Priority Maps " ;
messageLoop < < " Network Maintenence: " ;
messageLoop < < " D - Disconnect Acct0 K - Disconnect All " ;
messageLoop < < " Z - Socket Logging " ;
messageLoop < < MSG_SECTIONBEGIN ;
break ;
case ' z ' :
case ' Z ' :
{
auto loggingEnabled = false ;
{
for ( auto & snSock : Network - > connClients )
2022-06-11 07:55:06 -04:00
{
2022-10-24 18:39:33 +08:00
if ( snSock )
{
snSock - > Logging ( ! snSock - > Logging ( ) ) ;
2022-06-11 07:55:06 -04:00
}
}
2022-10-24 18:39:33 +08:00
auto iter = Network - > connClients . begin ( ) ;
if ( iter ! = Network - > connClients . end ( ) )
{
loggingEnabled = ( * iter ) - > Logging ( ) ;
Numerous changes with focus on feature and stability parity across Windows, Linux and MacOS platforms
Added new Makefile that handles compiling UOX3 and Spidermonkey on both Linux and MacOS (punt)
Added VS solution (SpiderMonkey.sln) and VC++ project files for compiling SpiderMonkey on Windows (Xuri)
Updated SpiderMonkey from v1.6.0 to v1.7.0
Added optimization flag -O2 for release build in CMakeLists.txt in project root (Xuri)
Added StringUtility file with general common string manipulation functions (punt)
Updated RandomNum function to use a "seedless" random number generator from C++11 instead of the old C rand() function. (punt)
Overall code cleanup to remove/replace platform-dependent code (punt)
Replaced potentially unsafe usage of C string stuff like sprintf, vsprintf, vsnprintf, strncat, strcpy and strlen throughout the code with calls to a format() function containing only a single, safe use of vsnprintf, ensuring there's a single place of failure if there's anything to fix and and making it easy to potentially replace this with std::format from C++20 when the time comes. (punt)
Replaced usage of char in many places with std::string (punt)
Started process of replacing UString usage with functions provided through StringUtility instead (punt)
Replaced platform specific fileIO handling in Windows/Linux with cross-platform C++17 standard std::filesystem (punt)
Replaced platform specific time handling by using cross-platform chrono library (punt)
Removed UOX namespace to reduce complexity (punt)
Elimitated template code approach to singletons for more modern c++ constructs, removing dependices in the process (punt)
Removed ODBC support; it hasn't been touched since the initial implementation in 2008, and there is a lack of someone to maintain the code. (punt)
Removed some platform specific files like uoxlinux.h, which is no longer required (punt)
Removed legacy crash protection code, and removed support for cluox (punt)
Removed legacy "support" for Borland compiler (punt)
Removed legacy VC++ 6 Workspace/Project files, VS2005 Solution/Project files, as these are no longer supported (Xuri)
Removed legacy BUILD folder with outdated compilation instructions (Xuri)
Removed old Changelog file (merged into Changelog.txt) (Xuri)
Fixed a pointer bug for items in multis on world load (punt)
Fixed a dictionary related issue that caused segmentation faults on Linux/MacOS (punt)
Fixed an issue with callbacks to JS scripts that caused segmentation faults on Linux/MacOS (punt)
Paths in uox.ini should now load properly on all platforms regardless of whether those paths use slashes or backslashes, and whether or not they end in a slash/backslash. (punt)
Moved to c++17 style of threading, and got rid of threadsafeobject.cpp/h (punt)
Replaced parsing of UOX.INI tags with a system that's more easily maintainable (punt)
Added some new commands to js/commands/custom/misc-cmd.js (Xuri)
cont // Targeted item will be made a container, set to nondecay and movable 2
endfight // Targeted character (and character being fought) will stop fighting
getmulti // Get multiObject for targeted item
finditem // Find item at layer X
movespeed // Set movement speed of target player (0x0 Normal, 0x1 Mounted, 0x2 Slow (walk only), 0x3 Hybrid ("jog"?), 0x4 Frozen)
Added new HTML based documentation in docs folder, and removed many old legacy docs that are either incorporated into this document already or no longer relevant for the current UOX3 version (Xuri)
Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2020-09-07 18:09:55 +08:00
}
2012-11-03 18:11:04 +00:00
}
2022-10-24 18:39:33 +08:00
if ( loggingEnabled )
{
messageLoop < < " CMD: Network Logging Enabled. " ;
}
else
{
messageLoop < < " CMD: Network Logging Disabled. " ;
}
break ;
2012-11-03 18:11:04 +00:00
}
2022-10-24 18:39:33 +08:00
case ' c ' :
case ' C ' :
// Shows a configuration header
DisplaySettings ( ) ;
break ;
case ' f ' :
case ' F ' :
FileLookup - > DisplayPriorityMap ( ) ;
break ;
default :
temp = oldstrutil : : format ( " Key \' %c \' [%i] does not perform a function " , static_cast < SI08 > ( c ) , c ) ;
messageLoop < < temp ;
break ;
2012-11-03 18:11:04 +00:00
}
}
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::DisplaySettings()
//o------------------------------------------------------------------------------------------------o
2012-11-03 18:11:04 +00:00
//| Purpose - UOX startup stuff
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
//| Moved that here because we need it in processkey now
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 - 10/21/2002 - found the bug in one spot, just
2012-11-03 18:11:04 +00:00
//| happened upon this quick fix. for BackUp operation.
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : DisplaySettings ( ) - > void
{
2012-11-03 18:11:04 +00:00
std : : map < bool , std : : string > activeMap ;
activeMap [ true ] = " Activated! " ;
activeMap [ false ] = " Disabled! " ;
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
// UOX.ini status
2012-11-03 18:11:04 +00:00
( * this ) < < " Server Settings: " < < myendl ;
( * this ) < < " -Archiving[ " ;
if ( cwmWorldState - > ServerData ( ) - > ServerBackupStatus ( ) )
( * this ) < < " Enabled]. ( " < < cwmWorldState - > ServerData ( ) - > Directory ( CSDDP_BACKUP ) < < " ) " < < myendl ;
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
else
2012-11-03 18:11:04 +00:00
( * this ) < < " Disabled] " < < myendl ;
( * this ) < < " -Weapons & Armour Rank System: " ;
( * this ) < < activeMap [ cwmWorldState - > ServerData ( ) - > RankSystemStatus ( ) ] < < myendl ;
( * this ) < < " -Vendors buy by item name: " ;
( * this ) < < activeMap [ cwmWorldState - > ServerData ( ) - > SellByNameStatus ( ) ] < < myendl ;
( * this ) < < " -Adv. Trade System: " ;
( * this ) < < activeMap [ cwmWorldState - > ServerData ( ) - > TradeSystemStatus ( ) ] < < myendl ;
2022-10-24 18:39:33 +08:00
( * this ) < < " -Races: " < < static_cast < UI32 > ( Races - > Count ( ) ) < < myendl ;
( * this ) < < " -Guilds: " < < static_cast < UI32 > ( GuildSys - > NumGuilds ( ) ) < < myendl ;
( * this ) < < " -Char count: " < < ObjectFactory : : GetSingleton ( ) . CountOfObjects ( OT_CHAR ) < < myendl ;
( * this ) < < " -Item count: " < < ObjectFactory : : GetSingleton ( ) . CountOfObjects ( OT_ITEM ) < < myendl ;
2012-11-03 18:11:04 +00:00
( * this ) < < " -Num Accounts: " < < Accounts - > size ( ) < < myendl ;
( * this ) < < " Directories: " < < myendl ;
( * this ) < < " -Shared: " < < cwmWorldState - > ServerData ( ) - > Directory ( CSDDP_SHARED ) < < myendl ;
( * this ) < < " -Archive: " < < cwmWorldState - > ServerData ( ) - > Directory ( CSDDP_BACKUP ) < < myendl ;
( * this ) < < " -Data: " < < cwmWorldState - > ServerData ( ) - > Directory ( CSDDP_DATA ) < < myendl ;
( * this ) < < " -Defs: " < < cwmWorldState - > ServerData ( ) - > Directory ( CSDDP_DEFS ) < < myendl ;
( * this ) < < " -Scripts: " < < cwmWorldState - > ServerData ( ) - > Directory ( CSDDP_SCRIPTS ) < < myendl ;
0.99.4q - decorate command, welcome gump, and more
Added entry for a new directory path in uox.ini:
SCRIPTDATADIRECTORY=./js/jsdata/ - dedicated to generic data read/written by JS scripts, data not directly linked to live content, which should not live or die by the state of the SHAREDDIRECTORY. Existing scripts will continue to write/read files in the SHAREDDIRECTORY if no changes are made.
Updated JS File Method .Open() to support an optional fourth argument (requires third argument):
useScriptDataDir (boolean) - when this fourth argument is included as true, UOX3 will look for the file in the SCRIPTDATADIRECTORY instead of the SHAREDDIRECTORY. Third argument - folderName - is required for this fourth argument to be used. New syntaxes:
.Open( fileName, fileMode )
.Open( fileName, fileMode, folderName )
.Open( fileName, fileMode, folderName, useScriptDataDir )
Updated JS File Function DeleteFile() to support an optional third argument (requires second argument):
useScriptDataDir (boolean) - when this third argument is included as true, UOX3 will look for the file in the SCRIPTDATADIRECTORY instead of the SHAREDDIRECTORY. Second argument - folderName - is required for this third argument to be used. New syntaxes:
DeleteFile( fileName )
DeleteFile( fileName, folderName )
DeleteFile( fileName, folderName, useScriptDataDir )
Added new admin command (js/commands/decorate.js) to allow saving/loading world templates. These templates are essentially text files (with .jsdata file extension) that contain the bare minimum amount of details needed to decorate an entire game world, a facet or even a specific area of a facet. The files can be bundled with UOX3 for a smoother first-time-user-experience, can be easily shared with other people as blueprints for world decoration, and they can be saved and loaded on the fly without impacting existing data on a shard. By default, the command will save/load items to/from different files per facet based on the following item categories: doors, signs, lights, moongates, teleporters, misc (everything else).
Command syntax:
'decorate save
Save all items to the default templates, based on each item's objectCategory and facet
'decorate save [objectCategory]
Save all items of specified objectCategory, regardless of facet
'decorate save [facetName]
Save all items on specified facet, regardless of objectCategory
'decorate save [customFileName]
Save all items of all objectCategories on all facets to custom template file
'decorate save [objectCategory] [facetName]
Save all items of specified objectCategory in the specified facet
'decorate save [customFileName] [facetName] x1 y1 x2 y2
Save all items within specified coordinates on specified facet to customFileName
'decorate load
Load all items from the default templates, regardless of objectCategory and facet
'decorate load [objectCategory]
Load all items of specified objectCategory, regardless of facet
'decorate load [facetName]
Load all items on specified facet, regardless of objectCategory
'decorate load [customFileName]
Load all items from file named [customFileName]
'decorate load [objectCategory] [facetName]
Load all items of specified objectCategory in the specified facet
'decorate copy [sourceFacet] [targetFacet]
Copy all items from one facet to another
'decorate clean
Clean up duplicate decorations that might have been loaded/added by accident.
Note that world templates are by default stored in and read from a subfolder named "worldtemplates" under the new SCRIPTDATADIRECTORY (which defaults to UOX3/js/jsdata/)
Added welcome gump that is displayed automatically for characters on the admin account (account 0) on first login. This welcome gump gives new shard admins the option to either start with a blank and empty world, or to load the default UOX3 world - based on the default set of worldfile templates provided with UOX3, if any. It also provides a few tips to get started, as well as links to various documentation pages, forum and Discord server. The welcome gump can also be re-opened at a later stage using a new admin command: 'welcome
Updated Item JS Method Dupe() to support passing NULL instead of a socket, for duplicating items without needing to place them in a player's backpack
2021-06-11 07:59:35 +08:00
( * this ) < < " -ScriptData: " < < cwmWorldState - > ServerData ( ) - > Directory ( CSDDP_SCRIPTDATA ) < < myendl ;
2012-11-03 18:11:04 +00:00
( * this ) < < " -HTML: " < < cwmWorldState - > ServerData ( ) - > Directory ( CSDDP_HTML ) < < myendl ;
( * this ) < < " -Books: " < < cwmWorldState - > ServerData ( ) - > Directory ( CSDDP_BOOKS ) < < myendl ;
( * this ) < < " -MessageBoards: " < < cwmWorldState - > ServerData ( ) - > Directory ( CSDDP_MSGBOARD ) < < myendl ;
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - void RegisterKey()
//o------------------------------------------------------------------------------------------------o
Instance-support and misc code cleanup
Misc code and documentation cleanup:
Updated and standardized function comment blocks throughout entire codebase
Grouped getters and setters together in pairs and documented them as one
Removed empty and/or non-useful information from comment blocks
Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors
Added new feature - Instances
Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified.
Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present)
Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present)
Updated TWEAK menu to include WorldNumber and instanceID
Fixed BaseWeight option in TWEAK menu
Updated CBase_Teleport - now takes an optional 5th parameter instanceID
Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID
Updated SE_FindMulti now takes an optional 5th parameter - instanceID
Updated SE_GetItem now takes an optional 5th parameter - instanceID
Updated SE_FindItem now takes an optional 6th parameter - instanceID
Added new JS property for Items, Characters, Regions: .instanceID
Added JS property for Regions: .members - returns comma-separated list of town member serials
Updated JS scripts making use of the above-mentioned JS Methods/Functions
Updated dictionaries with new tweak menu entry texts
Exposed SpawnRegions to JS engine, and updated JS docs with details:
SpawnRegion JS Functions
IterateOverSpawnRegions()
GetSpawnRegion( spawnRegNum )
GetSpawnRegionCount()
SpawnRegion JS Properties
name
regionNum
itemList
npcList
item
npc
maxItems
maxNpcs
itemCount
npcCount
onlyOutside
prefZ
x1
y1
x2
y2
world
instanceID
minTime
maxTime
call
2020-08-08 13:57:15 +08:00
//| Purpose - Registers key input for detection in console
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : RegisterKey ( SI32 key , std : : string cmdName , UI16 scriptId ) - > void
{
2012-11-03 18:11:04 +00:00
# if defined( UOX_DEBUG_MODE )
2022-10-24 18:39:33 +08:00
messageLoop < < oldstrutil : : format ( " Registering key \" %c \" " , key ) ;
2012-11-03 18:11:04 +00:00
# endif
2022-10-24 18:39:33 +08:00
JSKeyHandler [ key ] = JSConsoleEntry_st ( scriptId , cmdName ) ;
2012-11-03 18:11:04 +00:00
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::SetKeyStatus()
//o------------------------------------------------------------------------------------------------o
Instance-support and misc code cleanup
Misc code and documentation cleanup:
Updated and standardized function comment blocks throughout entire codebase
Grouped getters and setters together in pairs and documented them as one
Removed empty and/or non-useful information from comment blocks
Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors
Added new feature - Instances
Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified.
Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present)
Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present)
Updated TWEAK menu to include WorldNumber and instanceID
Fixed BaseWeight option in TWEAK menu
Updated CBase_Teleport - now takes an optional 5th parameter instanceID
Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID
Updated SE_FindMulti now takes an optional 5th parameter - instanceID
Updated SE_GetItem now takes an optional 5th parameter - instanceID
Updated SE_FindItem now takes an optional 6th parameter - instanceID
Added new JS property for Items, Characters, Regions: .instanceID
Added JS property for Regions: .members - returns comma-separated list of town member serials
Updated JS scripts making use of the above-mentioned JS Methods/Functions
Updated dictionaries with new tweak menu entry texts
Exposed SpawnRegions to JS engine, and updated JS docs with details:
SpawnRegion JS Functions
IterateOverSpawnRegions()
GetSpawnRegion( spawnRegNum )
GetSpawnRegionCount()
SpawnRegion JS Properties
name
regionNum
itemList
npcList
item
npc
maxItems
maxNpcs
itemCount
npcCount
onlyOutside
prefZ
x1
y1
x2
y2
world
instanceID
minTime
maxTime
call
2020-08-08 13:57:15 +08:00
//| Purpose - Enabling/Disabling specific key input in console
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : SetKeyStatus ( SI32 key , bool isEnabled ) - > void
{
2022-06-11 07:55:06 -04:00
auto toFind = JSKeyHandler . find ( key ) ;
2022-10-24 18:39:33 +08:00
if ( toFind ! = JSKeyHandler . end ( ) )
{
2012-11-03 18:11:04 +00:00
toFind - > second . isEnabled = isEnabled ;
}
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::RegisterFunc()
//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 - Registers console function
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : RegisterFunc ( const std : : string & cmdFunc , const std : : string & cmdName , UI16 scriptId ) - > void
{
2012-11-03 18:11:04 +00:00
# if defined( UOX_DEBUG_MODE )
2022-10-24 18:39:33 +08:00
Print ( oldstrutil : : format ( " Registering console func \" %s \" \n " , cmdFunc . c_str ( ) ) ) ;
2012-11-03 18:11:04 +00:00
# endif
2022-10-24 18:39:33 +08:00
JSConsoleFunctions [ oldstrutil : : upper ( cmdFunc ) ] = JSConsoleEntry_st ( scriptId , cmdName ) ;
2012-11-03 18:11:04 +00:00
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::SetFuncStatus()
//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 - Enables/disables console function
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : SetFuncStatus ( const std : : string & cmdFunc , bool isEnabled ) - > void
{
2022-06-11 07:55:06 -04:00
auto upper = oldstrutil : : upper ( cmdFunc ) ;
auto toFind = JSConsoleFunctions . find ( upper ) ;
2022-10-24 18:39:33 +08:00
if ( toFind ! = JSConsoleFunctions . end ( ) )
{
2012-11-03 18:11:04 +00:00
toFind - > second . isEnabled = isEnabled ;
}
}
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
//| Function - CConsole::Registration()
//o------------------------------------------------------------------------------------------------o
Instance-support and misc code cleanup
Misc code and documentation cleanup:
Updated and standardized function comment blocks throughout entire codebase
Grouped getters and setters together in pairs and documented them as one
Removed empty and/or non-useful information from comment blocks
Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors
Added new feature - Instances
Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified.
Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present)
Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present)
Updated TWEAK menu to include WorldNumber and instanceID
Fixed BaseWeight option in TWEAK menu
Updated CBase_Teleport - now takes an optional 5th parameter instanceID
Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID
Updated SE_FindMulti now takes an optional 5th parameter - instanceID
Updated SE_GetItem now takes an optional 5th parameter - instanceID
Updated SE_FindItem now takes an optional 6th parameter - instanceID
Added new JS property for Items, Characters, Regions: .instanceID
Added JS property for Regions: .members - returns comma-separated list of town member serials
Updated JS scripts making use of the above-mentioned JS Methods/Functions
Updated dictionaries with new tweak menu entry texts
Exposed SpawnRegions to JS engine, and updated JS docs with details:
SpawnRegion JS Functions
IterateOverSpawnRegions()
GetSpawnRegion( spawnRegNum )
GetSpawnRegionCount()
SpawnRegion JS Properties
name
regionNum
itemList
npcList
item
npc
maxItems
maxNpcs
itemCount
npcCount
onlyOutside
prefZ
x1
y1
x2
y2
world
instanceID
minTime
maxTime
call
2020-08-08 13:57:15 +08:00
//| Purpose - Registers console script
2022-10-24 18:39:33 +08:00
//o------------------------------------------------------------------------------------------------o
auto CConsole : : Registration ( ) - > void
{
2022-06-11 07:55:06 -04:00
auto spellSection = JSMapping - > GetSection ( SCPT_CONSOLE ) ;
2022-10-24 18:39:33 +08:00
for ( const auto & [ spellname , ourScript ] : spellSection - > collection ( ) )
{
if ( ourScript )
{
2012-11-03 18:11:04 +00:00
ourScript - > ScriptRegistration ( " Console " ) ;
2022-06-11 07:55:06 -04:00
}
2012-11-03 18:11:04 +00:00
}
}