uox3/source/calcfuncs.cpp

122 lines
4.2 KiB
C++
Raw Permalink Normal View History

//o------------------------------------------------------------------------------------------------o
Instance-support and misc code cleanup Misc code and documentation cleanup: Updated and standardized function comment blocks throughout entire codebase Grouped getters and setters together in pairs and documented them as one Removed empty and/or non-useful information from comment blocks Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors Added new feature - Instances Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified. Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present) Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present) Updated TWEAK menu to include WorldNumber and instanceID Fixed BaseWeight option in TWEAK menu Updated CBase_Teleport - now takes an optional 5th parameter instanceID Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID Updated SE_FindMulti now takes an optional 5th parameter - instanceID Updated SE_GetItem now takes an optional 5th parameter - instanceID Updated SE_FindItem now takes an optional 6th parameter - instanceID Added new JS property for Items, Characters, Regions: .instanceID Added JS property for Regions: .members - returns comma-separated list of town member serials Updated JS scripts making use of the above-mentioned JS Methods/Functions Updated dictionaries with new tweak menu entry texts Exposed SpawnRegions to JS engine, and updated JS docs with details: SpawnRegion JS Functions IterateOverSpawnRegions() GetSpawnRegion( spawnRegNum ) GetSpawnRegionCount() SpawnRegion JS Properties name regionNum itemList npcList item npc maxItems maxNpcs itemCount npcCount onlyOutside prefZ x1 y1 x2 y2 world instanceID minTime maxTime call
2020-08-08 13:57:15 +08:00
//| File - calcfuncs.cpp
//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 - Various functions to calculate objects from serials
//o------------------------------------------------------------------------------------------------o
2002-04-07 20:53:41 +00:00
#include "uox3.h"
Added: -JS Get/Set "vulnerable" handlers for character properties (Abaddon) -willHunger with Get/Set HungerStatus() wrappers to CChar class (can now selectively stop a character/creature from continuing to hunger) -JS Get/Set "willhunger" handlers for character properties Changed: Linux compile fixes (thanks Malketh) Hash.h warning fixed (thanks Philantrop) Fixes to getRootPack() and getPackOwner() Removed many #includes from the global scope, including them in the specific files that need them This should greatly reduce compile time and filesize, along with the need to recompile after altering most headers Removed the linux ifdefs around typedefd function declarations, this should work with gcc 3.2 Moved global loading functions into a new cFileIO() class to take them out of global scope Fixed an issue causing items to not be sent to the client (thanks Malketh) Moved some global structs into the CWorldMain class Fixed a bug causing a crash on character / item creation Moved all effects stuff into its own class to take it out of global scope Changed the variable CChar::region to CChar::regionNum to avoid conflicts with the cTownRegion region[] indexes Moved getbestskill(), isHuman(), and inDungeon() into the CChar class to remove them from global scope Took npcSimpleAttackTarget() out of global scope Rewrote restock() to make use of restockNPC() Changed the typedef'd iterator in hash.h to HASHITERATOR to kill a Linux warning Renamed cEffects::soundeffect() to PlaySound() and removed unneeded overloads Fixed a bug causing executebatch to be set with locationcount data Rewrote cEffects::bgsound() Documented sounds.cpp Misc minor cleanups / fixes Removed: sendItemsInRange() (CChar::Teleport() does the same thing) Many #includes that were not being used deathMenu() respawnnow() and moved all of its code into command_respawn() one instance of cEffects::scpSoundEffect() and renamed the other to PlaySound() 3/13/2003 Changed Fixed an issue allowing the server to not have a dictionary.ZRO (which would cause a crash when a dictionary entry was called with no language) Fixed an issue causing the server to puke when it attempted a restart Moved SpawnRandomItem() into cItem class Moved SpawnRandomMonster() into cCharHandle class Broke necro.dfn into fishing.dfn and digging.dfn Made better use of SpawnRandomItem() and SpawnRandomMonster() 3/12/2003 Added: CPOpenGump and CPSpeech packet class to remove some global vars (Note these are pretty basic classes and someone with a better understanding of how we handle sending/recieving packets could probably expand these to make better use of them) Changed: Moved many global vars into the CWorldMain() class Cleaned ResetVars() in uox3.cpp as ResetDefaults() in CWorldMain() now handles much of that Added a check to ensure text wasn't sent twice in talking(), should fix double-speech Cleaned up cmdtable.cpp removing a couple duplicate entries, etc Changed target() to only require 4 values (as the first two were always 0 and 1) Removed many unneeded typedefs and globals Went through cServerData() and noted unused server.ini entries Moved title1(), title2(), and title3() to cClick.cpp since that is their only usage, made use of MAX_TITLE to ensure we wouldn't overrun the buffers, and renamed them matching what title they were 3/11/2003 Changed: Fixed a potentially very serious bugs with how containers were being set upon loading the world Fixed possible re-adding of weight to containers and characters at load Fixed a bug causing equipped items that were not weapons to take damage in combat Minor cleanups / warning fixes / Linux compatability issues (punt) 3/7/2003 Overhauls/Additions/Major Changes Changed: Tweaks/Object Conversions/Misc Small Changes Changed: Changed CItem::Get/SetLayer() to a UI08 Fixed a bug in speech causing you to see your own text twice Fixed a nasty crash bug
2003-03-23 10:18:02 +00:00
#include "townregion.h"
#include "network.h"
#include "ObjectFactory.h"
2002-04-07 20:53:41 +00:00
//o------------------------------------------------------------------------------------------------o
//| Function - CalcCharObjFromSer()
//o------------------------------------------------------------------------------------------------o
2002-04-07 20:53:41 +00:00
//| Purpose - Calculate the character object based on the calling serial
//o------------------------------------------------------------------------------------------------o
CChar *CalcCharObjFromSer( SERIAL targSerial )
2002-04-07 20:53:41 +00:00
{
CBaseObject *findItem = ObjectFactory::GetSingleton().FindObject( targSerial );
2021-06-12 07:30:23 -04:00
CChar *toRet = nullptr;
if( findItem != nullptr )
{
if( findItem->CanBeObjType( OT_CHAR ))
{
toRet = static_cast<CChar *>( findItem );
}
}
return toRet;
2002-04-07 20:53:41 +00:00
}
//o------------------------------------------------------------------------------------------------o
//| Function - CalcItemObjFromSer()
//o------------------------------------------------------------------------------------------------o
2002-04-07 20:53:41 +00:00
//| Purpose - Calculate the item object based on the calling serial
//o------------------------------------------------------------------------------------------------o
CItem *CalcItemObjFromSer( SERIAL targSerial )
2002-04-07 20:53:41 +00:00
{
CBaseObject *findItem = ObjectFactory::GetSingleton().FindObject( targSerial );
2021-06-12 07:30:23 -04:00
CItem *toRet = nullptr;
if( findItem != nullptr )
{
if( findItem->CanBeObjType( OT_ITEM ))
{
toRet = static_cast<CItem *>( findItem );
}
}
return toRet;
2002-04-07 20:53:41 +00:00
}
CMultiObj *CalcMultiFromSer( SERIAL targSerial )
2002-04-07 20:53:41 +00:00
{
CBaseObject *findMulti = ObjectFactory::GetSingleton().FindObject( targSerial );
2021-06-12 07:30:23 -04:00
CMultiObj *toRet = nullptr;
if( findMulti != nullptr )
{
if( findMulti->CanBeObjType( OT_MULTI ))
{
toRet = static_cast<CMultiObj *>( findMulti );
}
}
return toRet;
2002-04-07 20:53:41 +00:00
}
//o--------------------------------------------------------------------------
//| Function - CalcRegionFromXY()
2002-04-07 20:53:41 +00:00
//o--------------------------------------------------------------------------
UOX3 0.99.5b Fixed an issue where karma titles would inadvertently have the space behind the title trimmed before being displayed in paperdoll, resulting in erroneous display of title + name there Fixed an issue with a cooking script (js/skill/cooking/cooking.js) where sweet dough would not get consumed properly on cooking (Dragon Slayer) Updated C++ function calcRegionFromXY to work with CBaseObject instead of CChar, so it also works for Items Items now have current town region stored as an object property during runtime. This is calculated on load, when container property is updated, and when an item is picked up or dropped. The region is also accessible via the (read-only) JS Item property .region Added new JS Event to allow capturing button presses from the old-school gump displayed by client via packet 0x76, which was originally used by the old-school crafting menus in T2A. The requirement for this to work is that the gump in question must have a gumpID between 0x4000 and 0xffff (which can be set when manually creating a packet with this ID via JS), and the Event itself must be in the global script: onScrollingGumpPress( pSock, gumpID, buttonID ) Added new JS Event to allow better control over which names UOX3 sends to the client for characters: onNameRequest( myObj, requestedBy ) // return custom string, or return empty string/nothing/true/false to use default name Updated JS Events to also work for Items (previously only worked for Characters) onLightChange( myObj, lightLevel ) onTempChange( myObj, temp ) onWeatherChange( myObj, weatherType ) Adjusted default temperature for town regions with no weather systems defined from 0 to 20 degrees Celsius Updated some JS scripts (fishing.js, baking.js and cooking.js) to make use of GetTempTag/SetTempTag rather than GetTag/SetTag Added cancel-checks to targeting functions in command script for add-commands (js/commands/targeting/add.js) Updated get command script (js/commands/targeting/get.js) to allow retrieving region ID and name using 'get region Updated misc command script (js/commands/custom/misc-cmd.js) to add 'gettemptag and 'settemptag commands, used to retrieve/set temporary custom tags from/on objects Fixed a bug where Spirit Speak skill would be checked for race languages even if the race had LANGUAGEMIN defined as 0 (or not defined at all) Fixed an issue where players using regular UO client would get stuck in a black void after teleporting between worlds, by adding an additional character refresh after the teleport Fixed an issue where crafting tools for Blacksmithing and Carpentry would attempt to fetch the value of an incorrectly named INI setting to handle durability loss for the tools Added new setting under [settings] section of UOX.INI to control whether it should be possible to craft weapons from coloured ingots or not: CRAFTCOLOUREDWEAPONS=0/1 // If enabled(1), players can craft coloured weapons. Defaults to disabled(0) Fixed an issue where the correct ingots were not consumed when attempting to craft items using colored ingots Fixed a rogue debug message leftover in the scissor script
2022-02-13 22:49:37 +08:00
//| Purpose - Find what region x and y are in. This should be done for all items on world load, and when any of the
//| item's location and/or container properties change
2002-04-07 20:53:41 +00:00
//o--------------------------------------------------------------------------
CTownRegion *CalcRegionFromXY( SI16 x, SI16 y, UI08 worldNumber, UI16 instanceId, CBaseObject *mObj )
2002-04-07 20:53:41 +00:00
{
// Reset sub region of character
if( ValidateObject( mObj ))
UOX3 0.99.5b Fixed an issue where karma titles would inadvertently have the space behind the title trimmed before being displayed in paperdoll, resulting in erroneous display of title + name there Fixed an issue with a cooking script (js/skill/cooking/cooking.js) where sweet dough would not get consumed properly on cooking (Dragon Slayer) Updated C++ function calcRegionFromXY to work with CBaseObject instead of CChar, so it also works for Items Items now have current town region stored as an object property during runtime. This is calculated on load, when container property is updated, and when an item is picked up or dropped. The region is also accessible via the (read-only) JS Item property .region Added new JS Event to allow capturing button presses from the old-school gump displayed by client via packet 0x76, which was originally used by the old-school crafting menus in T2A. The requirement for this to work is that the gump in question must have a gumpID between 0x4000 and 0xffff (which can be set when manually creating a packet with this ID via JS), and the Event itself must be in the global script: onScrollingGumpPress( pSock, gumpID, buttonID ) Added new JS Event to allow better control over which names UOX3 sends to the client for characters: onNameRequest( myObj, requestedBy ) // return custom string, or return empty string/nothing/true/false to use default name Updated JS Events to also work for Items (previously only worked for Characters) onLightChange( myObj, lightLevel ) onTempChange( myObj, temp ) onWeatherChange( myObj, weatherType ) Adjusted default temperature for town regions with no weather systems defined from 0 to 20 degrees Celsius Updated some JS scripts (fishing.js, baking.js and cooking.js) to make use of GetTempTag/SetTempTag rather than GetTag/SetTag Added cancel-checks to targeting functions in command script for add-commands (js/commands/targeting/add.js) Updated get command script (js/commands/targeting/get.js) to allow retrieving region ID and name using 'get region Updated misc command script (js/commands/custom/misc-cmd.js) to add 'gettemptag and 'settemptag commands, used to retrieve/set temporary custom tags from/on objects Fixed a bug where Spirit Speak skill would be checked for race languages even if the race had LANGUAGEMIN defined as 0 (or not defined at all) Fixed an issue where players using regular UO client would get stuck in a black void after teleporting between worlds, by adding an additional character refresh after the teleport Fixed an issue where crafting tools for Blacksmithing and Carpentry would attempt to fetch the value of an incorrectly named INI setting to handle durability loss for the tools Added new setting under [settings] section of UOX.INI to control whether it should be possible to craft weapons from coloured ingots or not: CRAFTCOLOUREDWEAPONS=0/1 // If enabled(1), players can craft coloured weapons. Defaults to disabled(0) Fixed an issue where the correct ingots were not consumed when attempting to craft items using colored ingots Fixed a rogue debug message leftover in the scissor script
2022-02-13 22:49:37 +08:00
{
mObj->SetSubRegion( 0 );
// Check if object is an item, and if it's in a container
if( mObj->GetObjType() == OT_ITEM && static_cast<CItem *>( mObj )->GetContSerial() != INVALIDSERIAL )
UOX3 0.99.5b Fixed an issue where karma titles would inadvertently have the space behind the title trimmed before being displayed in paperdoll, resulting in erroneous display of title + name there Fixed an issue with a cooking script (js/skill/cooking/cooking.js) where sweet dough would not get consumed properly on cooking (Dragon Slayer) Updated C++ function calcRegionFromXY to work with CBaseObject instead of CChar, so it also works for Items Items now have current town region stored as an object property during runtime. This is calculated on load, when container property is updated, and when an item is picked up or dropped. The region is also accessible via the (read-only) JS Item property .region Added new JS Event to allow capturing button presses from the old-school gump displayed by client via packet 0x76, which was originally used by the old-school crafting menus in T2A. The requirement for this to work is that the gump in question must have a gumpID between 0x4000 and 0xffff (which can be set when manually creating a packet with this ID via JS), and the Event itself must be in the global script: onScrollingGumpPress( pSock, gumpID, buttonID ) Added new JS Event to allow better control over which names UOX3 sends to the client for characters: onNameRequest( myObj, requestedBy ) // return custom string, or return empty string/nothing/true/false to use default name Updated JS Events to also work for Items (previously only worked for Characters) onLightChange( myObj, lightLevel ) onTempChange( myObj, temp ) onWeatherChange( myObj, weatherType ) Adjusted default temperature for town regions with no weather systems defined from 0 to 20 degrees Celsius Updated some JS scripts (fishing.js, baking.js and cooking.js) to make use of GetTempTag/SetTempTag rather than GetTag/SetTag Added cancel-checks to targeting functions in command script for add-commands (js/commands/targeting/add.js) Updated get command script (js/commands/targeting/get.js) to allow retrieving region ID and name using 'get region Updated misc command script (js/commands/custom/misc-cmd.js) to add 'gettemptag and 'settemptag commands, used to retrieve/set temporary custom tags from/on objects Fixed a bug where Spirit Speak skill would be checked for race languages even if the race had LANGUAGEMIN defined as 0 (or not defined at all) Fixed an issue where players using regular UO client would get stuck in a black void after teleporting between worlds, by adding an additional character refresh after the teleport Fixed an issue where crafting tools for Blacksmithing and Carpentry would attempt to fetch the value of an incorrectly named INI setting to handle durability loss for the tools Added new setting under [settings] section of UOX.INI to control whether it should be possible to craft weapons from coloured ingots or not: CRAFTCOLOUREDWEAPONS=0/1 // If enabled(1), players can craft coloured weapons. Defaults to disabled(0) Fixed an issue where the correct ingots were not consumed when attempting to craft items using colored ingots Fixed a rogue debug message leftover in the scissor script
2022-02-13 22:49:37 +08:00
{
// Item is in a container, so find the root container (whether character or item) and use its coordinates to calculate region
CBaseObject *rootContainer = FindItemOwner( static_cast<CItem *>( mObj ));
UOX3 0.99.5b Fixed an issue where karma titles would inadvertently have the space behind the title trimmed before being displayed in paperdoll, resulting in erroneous display of title + name there Fixed an issue with a cooking script (js/skill/cooking/cooking.js) where sweet dough would not get consumed properly on cooking (Dragon Slayer) Updated C++ function calcRegionFromXY to work with CBaseObject instead of CChar, so it also works for Items Items now have current town region stored as an object property during runtime. This is calculated on load, when container property is updated, and when an item is picked up or dropped. The region is also accessible via the (read-only) JS Item property .region Added new JS Event to allow capturing button presses from the old-school gump displayed by client via packet 0x76, which was originally used by the old-school crafting menus in T2A. The requirement for this to work is that the gump in question must have a gumpID between 0x4000 and 0xffff (which can be set when manually creating a packet with this ID via JS), and the Event itself must be in the global script: onScrollingGumpPress( pSock, gumpID, buttonID ) Added new JS Event to allow better control over which names UOX3 sends to the client for characters: onNameRequest( myObj, requestedBy ) // return custom string, or return empty string/nothing/true/false to use default name Updated JS Events to also work for Items (previously only worked for Characters) onLightChange( myObj, lightLevel ) onTempChange( myObj, temp ) onWeatherChange( myObj, weatherType ) Adjusted default temperature for town regions with no weather systems defined from 0 to 20 degrees Celsius Updated some JS scripts (fishing.js, baking.js and cooking.js) to make use of GetTempTag/SetTempTag rather than GetTag/SetTag Added cancel-checks to targeting functions in command script for add-commands (js/commands/targeting/add.js) Updated get command script (js/commands/targeting/get.js) to allow retrieving region ID and name using 'get region Updated misc command script (js/commands/custom/misc-cmd.js) to add 'gettemptag and 'settemptag commands, used to retrieve/set temporary custom tags from/on objects Fixed a bug where Spirit Speak skill would be checked for race languages even if the race had LANGUAGEMIN defined as 0 (or not defined at all) Fixed an issue where players using regular UO client would get stuck in a black void after teleporting between worlds, by adding an additional character refresh after the teleport Fixed an issue where crafting tools for Blacksmithing and Carpentry would attempt to fetch the value of an incorrectly named INI setting to handle durability loss for the tools Added new setting under [settings] section of UOX.INI to control whether it should be possible to craft weapons from coloured ingots or not: CRAFTCOLOUREDWEAPONS=0/1 // If enabled(1), players can craft coloured weapons. Defaults to disabled(0) Fixed an issue where the correct ingots were not consumed when attempting to craft items using colored ingots Fixed a rogue debug message leftover in the scissor script
2022-02-13 22:49:37 +08:00
if( ValidateObject( rootContainer ))
{
x = rootContainer->GetX();
y = rootContainer->GetY();
worldNumber = rootContainer->WorldNumber();
instanceId = rootContainer->GetInstanceId();
UOX3 0.99.5b Fixed an issue where karma titles would inadvertently have the space behind the title trimmed before being displayed in paperdoll, resulting in erroneous display of title + name there Fixed an issue with a cooking script (js/skill/cooking/cooking.js) where sweet dough would not get consumed properly on cooking (Dragon Slayer) Updated C++ function calcRegionFromXY to work with CBaseObject instead of CChar, so it also works for Items Items now have current town region stored as an object property during runtime. This is calculated on load, when container property is updated, and when an item is picked up or dropped. The region is also accessible via the (read-only) JS Item property .region Added new JS Event to allow capturing button presses from the old-school gump displayed by client via packet 0x76, which was originally used by the old-school crafting menus in T2A. The requirement for this to work is that the gump in question must have a gumpID between 0x4000 and 0xffff (which can be set when manually creating a packet with this ID via JS), and the Event itself must be in the global script: onScrollingGumpPress( pSock, gumpID, buttonID ) Added new JS Event to allow better control over which names UOX3 sends to the client for characters: onNameRequest( myObj, requestedBy ) // return custom string, or return empty string/nothing/true/false to use default name Updated JS Events to also work for Items (previously only worked for Characters) onLightChange( myObj, lightLevel ) onTempChange( myObj, temp ) onWeatherChange( myObj, weatherType ) Adjusted default temperature for town regions with no weather systems defined from 0 to 20 degrees Celsius Updated some JS scripts (fishing.js, baking.js and cooking.js) to make use of GetTempTag/SetTempTag rather than GetTag/SetTag Added cancel-checks to targeting functions in command script for add-commands (js/commands/targeting/add.js) Updated get command script (js/commands/targeting/get.js) to allow retrieving region ID and name using 'get region Updated misc command script (js/commands/custom/misc-cmd.js) to add 'gettemptag and 'settemptag commands, used to retrieve/set temporary custom tags from/on objects Fixed a bug where Spirit Speak skill would be checked for race languages even if the race had LANGUAGEMIN defined as 0 (or not defined at all) Fixed an issue where players using regular UO client would get stuck in a black void after teleporting between worlds, by adding an additional character refresh after the teleport Fixed an issue where crafting tools for Blacksmithing and Carpentry would attempt to fetch the value of an incorrectly named INI setting to handle durability loss for the tools Added new setting under [settings] section of UOX.INI to control whether it should be possible to craft weapons from coloured ingots or not: CRAFTCOLOUREDWEAPONS=0/1 // If enabled(1), players can craft coloured weapons. Defaults to disabled(0) Fixed an issue where the correct ingots were not consumed when attempting to craft items using colored ingots Fixed a rogue debug message leftover in the scissor script
2022-02-13 22:49:37 +08:00
}
}
}
const RegLocs_st *getLoc = nullptr;
for( auto &[townId, myReg] : cwmWorldState->townRegions )
{
Misc Fixes and Updates Added support for MAXWEIGHTBONUS DFN tag for races, to allow increasing weight that can be carried by specific race, and a new GetWeightMax() code function to do the necessary calculations on demand Updated [default race bonuses] UOX.INI section with the following new settings for the 3 default playable races (only used if nothing else specified in races.dfn): HUMANMAXWEIGHTBONUS=0 ELFMAXWEIGHTBONUS=0 GARGOYLEMAXWEIGHTBONUS=0 Added support for ALLSKILLSG and ALLSKILLSL DFN tags for races, which allow defining skill bonus or loss across all skills for a given race Added new Character JS Method for adding skill points without triggering skillchange JS Events: .AddSkill( skillID, skillAmt, triggerEvents[true/false] ) Added new Boat JS Property to allow getting/setting movement types for Boats via scripts: .moveType // See UOX3 JS Engine Docs > JS Object Properties > Multi Properties for a detailed list of all supported movement types Added new Boat JS Method to allow turning boats via scripts: .TurnBoat( turnDir ) // 0 = straight (no turning), 1 = turn left, 2 = turn right, 3 = flip around Updated IterateOver/OnIterate JS Function/Event to support passing in optional socket parameter. New syntax: IterateOver( objectType[, socket ]); .OnIterate( sourceObject, targetObject, socket ) Updated Character/Item JS Method .Refresh() to support an optional socket argument, to specify which player to refresh the object for. New syntax: .Refresh( [socket] ) Added support for new region setting that can define a region as disabled/enabled via DFN (tag) or script (JS property). Disabled regions will be ignored by UOX3: DISABLED=0/1 // Region DFN tag .isDisabled // Region JS Property Fixed issue where JS tags and temporary JS tags would not be copied over when duplicating a character or item Removed strength requirements from base shield definitions - stats like these are handled per era (dfndata/items/gear/armor/base_armor.dfn) Fixed an issue where necromancer newbie armor would incorrectly inherit base versions of leather armor without stats (dfndata/items/gear/armor/leather_armor/leather.dfn) Fixed an issue where players would not correctly leave combat after hiding (js/skill/hiding.js) Fixed an issue with Healing skill where skill-checks for healing/veterinary would fail due to a misspelled variable (js/skill/healing.js) Updated smart-turn furniture script to prevent players from being able to turn furnitures that are occupied by characters (js/server/misc/furniture_smartturn.js) Updated Buff-bar script to only add buffs for client versions higher than 5.0.2, the client patch where this feature was added (js/server/network/0xDF_buffBar.js) Updated Vendor BDO Dispenser script to add alternative reward-table for AoS era (js/npc/ai/vendor_bdo_dispenser.js) Cleaned up some code (spaces to tabs, indentation, spacing)
2025-04-23 00:01:53 +08:00
if( myReg != nullptr && !myReg->IsDisabled() && myReg->WorldNumber() == worldNumber && myReg->GetInstanceId() == instanceId )
2002-04-07 20:53:41 +00:00
{
for( size_t j = 0; j < myReg->GetNumLocations(); ++j )
{
getLoc = myReg->GetLocation( j );
2021-06-12 07:30:23 -04:00
if( getLoc != nullptr )
{
UOX3 0.99.5b Fixed an issue where karma titles would inadvertently have the space behind the title trimmed before being displayed in paperdoll, resulting in erroneous display of title + name there Fixed an issue with a cooking script (js/skill/cooking/cooking.js) where sweet dough would not get consumed properly on cooking (Dragon Slayer) Updated C++ function calcRegionFromXY to work with CBaseObject instead of CChar, so it also works for Items Items now have current town region stored as an object property during runtime. This is calculated on load, when container property is updated, and when an item is picked up or dropped. The region is also accessible via the (read-only) JS Item property .region Added new JS Event to allow capturing button presses from the old-school gump displayed by client via packet 0x76, which was originally used by the old-school crafting menus in T2A. The requirement for this to work is that the gump in question must have a gumpID between 0x4000 and 0xffff (which can be set when manually creating a packet with this ID via JS), and the Event itself must be in the global script: onScrollingGumpPress( pSock, gumpID, buttonID ) Added new JS Event to allow better control over which names UOX3 sends to the client for characters: onNameRequest( myObj, requestedBy ) // return custom string, or return empty string/nothing/true/false to use default name Updated JS Events to also work for Items (previously only worked for Characters) onLightChange( myObj, lightLevel ) onTempChange( myObj, temp ) onWeatherChange( myObj, weatherType ) Adjusted default temperature for town regions with no weather systems defined from 0 to 20 degrees Celsius Updated some JS scripts (fishing.js, baking.js and cooking.js) to make use of GetTempTag/SetTempTag rather than GetTag/SetTag Added cancel-checks to targeting functions in command script for add-commands (js/commands/targeting/add.js) Updated get command script (js/commands/targeting/get.js) to allow retrieving region ID and name using 'get region Updated misc command script (js/commands/custom/misc-cmd.js) to add 'gettemptag and 'settemptag commands, used to retrieve/set temporary custom tags from/on objects Fixed a bug where Spirit Speak skill would be checked for race languages even if the race had LANGUAGEMIN defined as 0 (or not defined at all) Fixed an issue where players using regular UO client would get stuck in a black void after teleporting between worlds, by adding an additional character refresh after the teleport Fixed an issue where crafting tools for Blacksmithing and Carpentry would attempt to fetch the value of an incorrectly named INI setting to handle durability loss for the tools Added new setting under [settings] section of UOX.INI to control whether it should be possible to craft weapons from coloured ingots or not: CRAFTCOLOUREDWEAPONS=0/1 // If enabled(1), players can craft coloured weapons. Defaults to disabled(0) Fixed an issue where the correct ingots were not consumed when attempting to craft items using colored ingots Fixed a rogue debug message leftover in the scissor script
2022-02-13 22:49:37 +08:00
// Calculate the region/subregion of the object
if( getLoc->x1 <= x && getLoc->y1 <= y && getLoc->x2 >= x && getLoc->y2 >= y )
{
UOX3 0.99.5b Fixed an issue where karma titles would inadvertently have the space behind the title trimmed before being displayed in paperdoll, resulting in erroneous display of title + name there Fixed an issue with a cooking script (js/skill/cooking/cooking.js) where sweet dough would not get consumed properly on cooking (Dragon Slayer) Updated C++ function calcRegionFromXY to work with CBaseObject instead of CChar, so it also works for Items Items now have current town region stored as an object property during runtime. This is calculated on load, when container property is updated, and when an item is picked up or dropped. The region is also accessible via the (read-only) JS Item property .region Added new JS Event to allow capturing button presses from the old-school gump displayed by client via packet 0x76, which was originally used by the old-school crafting menus in T2A. The requirement for this to work is that the gump in question must have a gumpID between 0x4000 and 0xffff (which can be set when manually creating a packet with this ID via JS), and the Event itself must be in the global script: onScrollingGumpPress( pSock, gumpID, buttonID ) Added new JS Event to allow better control over which names UOX3 sends to the client for characters: onNameRequest( myObj, requestedBy ) // return custom string, or return empty string/nothing/true/false to use default name Updated JS Events to also work for Items (previously only worked for Characters) onLightChange( myObj, lightLevel ) onTempChange( myObj, temp ) onWeatherChange( myObj, weatherType ) Adjusted default temperature for town regions with no weather systems defined from 0 to 20 degrees Celsius Updated some JS scripts (fishing.js, baking.js and cooking.js) to make use of GetTempTag/SetTempTag rather than GetTag/SetTag Added cancel-checks to targeting functions in command script for add-commands (js/commands/targeting/add.js) Updated get command script (js/commands/targeting/get.js) to allow retrieving region ID and name using 'get region Updated misc command script (js/commands/custom/misc-cmd.js) to add 'gettemptag and 'settemptag commands, used to retrieve/set temporary custom tags from/on objects Fixed a bug where Spirit Speak skill would be checked for race languages even if the race had LANGUAGEMIN defined as 0 (or not defined at all) Fixed an issue where players using regular UO client would get stuck in a black void after teleporting between worlds, by adding an additional character refresh after the teleport Fixed an issue where crafting tools for Blacksmithing and Carpentry would attempt to fetch the value of an incorrectly named INI setting to handle durability loss for the tools Added new setting under [settings] section of UOX.INI to control whether it should be possible to craft weapons from coloured ingots or not: CRAFTCOLOUREDWEAPONS=0/1 // If enabled(1), players can craft coloured weapons. Defaults to disabled(0) Fixed an issue where the correct ingots were not consumed when attempting to craft items using colored ingots Fixed a rogue debug message leftover in the scissor script
2022-02-13 22:49:37 +08:00
// If object is in a subregion, store a reference to it
if( myReg->IsSubRegion() && ValidateObject( mObj ))
{
UOX3 0.99.5b Fixed an issue where karma titles would inadvertently have the space behind the title trimmed before being displayed in paperdoll, resulting in erroneous display of title + name there Fixed an issue with a cooking script (js/skill/cooking/cooking.js) where sweet dough would not get consumed properly on cooking (Dragon Slayer) Updated C++ function calcRegionFromXY to work with CBaseObject instead of CChar, so it also works for Items Items now have current town region stored as an object property during runtime. This is calculated on load, when container property is updated, and when an item is picked up or dropped. The region is also accessible via the (read-only) JS Item property .region Added new JS Event to allow capturing button presses from the old-school gump displayed by client via packet 0x76, which was originally used by the old-school crafting menus in T2A. The requirement for this to work is that the gump in question must have a gumpID between 0x4000 and 0xffff (which can be set when manually creating a packet with this ID via JS), and the Event itself must be in the global script: onScrollingGumpPress( pSock, gumpID, buttonID ) Added new JS Event to allow better control over which names UOX3 sends to the client for characters: onNameRequest( myObj, requestedBy ) // return custom string, or return empty string/nothing/true/false to use default name Updated JS Events to also work for Items (previously only worked for Characters) onLightChange( myObj, lightLevel ) onTempChange( myObj, temp ) onWeatherChange( myObj, weatherType ) Adjusted default temperature for town regions with no weather systems defined from 0 to 20 degrees Celsius Updated some JS scripts (fishing.js, baking.js and cooking.js) to make use of GetTempTag/SetTempTag rather than GetTag/SetTag Added cancel-checks to targeting functions in command script for add-commands (js/commands/targeting/add.js) Updated get command script (js/commands/targeting/get.js) to allow retrieving region ID and name using 'get region Updated misc command script (js/commands/custom/misc-cmd.js) to add 'gettemptag and 'settemptag commands, used to retrieve/set temporary custom tags from/on objects Fixed a bug where Spirit Speak skill would be checked for race languages even if the race had LANGUAGEMIN defined as 0 (or not defined at all) Fixed an issue where players using regular UO client would get stuck in a black void after teleporting between worlds, by adding an additional character refresh after the teleport Fixed an issue where crafting tools for Blacksmithing and Carpentry would attempt to fetch the value of an incorrectly named INI setting to handle durability loss for the tools Added new setting under [settings] section of UOX.INI to control whether it should be possible to craft weapons from coloured ingots or not: CRAFTCOLOUREDWEAPONS=0/1 // If enabled(1), players can craft coloured weapons. Defaults to disabled(0) Fixed an issue where the correct ingots were not consumed when attempting to craft items using colored ingots Fixed a rogue debug message leftover in the scissor script
2022-02-13 22:49:37 +08:00
mObj->SetSubRegion( myReg->GetRegionNum() );
continue;
}
return myReg;
}
}
}
2002-04-07 20:53:41 +00:00
}
2022-06-06 12:02:26 -04:00
2002-04-07 20:53:41 +00:00
}
return cwmWorldState->townRegions[0xFF];
2002-04-07 20:53:41 +00:00
}
UOX3 0.99.5b Fixed an issue where karma titles would inadvertently have the space behind the title trimmed before being displayed in paperdoll, resulting in erroneous display of title + name there Fixed an issue with a cooking script (js/skill/cooking/cooking.js) where sweet dough would not get consumed properly on cooking (Dragon Slayer) Updated C++ function calcRegionFromXY to work with CBaseObject instead of CChar, so it also works for Items Items now have current town region stored as an object property during runtime. This is calculated on load, when container property is updated, and when an item is picked up or dropped. The region is also accessible via the (read-only) JS Item property .region Added new JS Event to allow capturing button presses from the old-school gump displayed by client via packet 0x76, which was originally used by the old-school crafting menus in T2A. The requirement for this to work is that the gump in question must have a gumpID between 0x4000 and 0xffff (which can be set when manually creating a packet with this ID via JS), and the Event itself must be in the global script: onScrollingGumpPress( pSock, gumpID, buttonID ) Added new JS Event to allow better control over which names UOX3 sends to the client for characters: onNameRequest( myObj, requestedBy ) // return custom string, or return empty string/nothing/true/false to use default name Updated JS Events to also work for Items (previously only worked for Characters) onLightChange( myObj, lightLevel ) onTempChange( myObj, temp ) onWeatherChange( myObj, weatherType ) Adjusted default temperature for town regions with no weather systems defined from 0 to 20 degrees Celsius Updated some JS scripts (fishing.js, baking.js and cooking.js) to make use of GetTempTag/SetTempTag rather than GetTag/SetTag Added cancel-checks to targeting functions in command script for add-commands (js/commands/targeting/add.js) Updated get command script (js/commands/targeting/get.js) to allow retrieving region ID and name using 'get region Updated misc command script (js/commands/custom/misc-cmd.js) to add 'gettemptag and 'settemptag commands, used to retrieve/set temporary custom tags from/on objects Fixed a bug where Spirit Speak skill would be checked for race languages even if the race had LANGUAGEMIN defined as 0 (or not defined at all) Fixed an issue where players using regular UO client would get stuck in a black void after teleporting between worlds, by adding an additional character refresh after the teleport Fixed an issue where crafting tools for Blacksmithing and Carpentry would attempt to fetch the value of an incorrectly named INI setting to handle durability loss for the tools Added new setting under [settings] section of UOX.INI to control whether it should be possible to craft weapons from coloured ingots or not: CRAFTCOLOUREDWEAPONS=0/1 // If enabled(1), players can craft coloured weapons. Defaults to disabled(0) Fixed an issue where the correct ingots were not consumed when attempting to craft items using colored ingots Fixed a rogue debug message leftover in the scissor script
2022-02-13 22:49:37 +08:00