uox3/source/items.cpp

1976 lines
70 KiB
C++
Raw Permalink Normal View History

#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 "cServerDefinitions.h"
#include "cSpawnRegion.h"
#include "ssection.h"
#include "CJSMapping.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 "scriptc.h"
#include "cScript.h"
#include "cEffects.h"
#include "CPacketSend.h"
#include "classes.h"
#include "regions.h"
#include "ObjectFactory.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"
using namespace std::string_literals;
2021-06-12 07:30:23 -04:00
cItem *Items = nullptr;
ItemTypes FindItemTypeFromTag( const std::string& strToFind );
void SetRandomName( CBaseObject *s, const std::string& namelist );
//o------------------------------------------------------------------------------------------------o
//| Function - bool ApplySpawnItemSection( CSpawnItem *applyTo, const DFNTAGS tag, const SI32 ndata, const SI32 odata, const std::string &cdata )
//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 - Load item data from script sections and apply to spawner objects
//o------------------------------------------------------------------------------------------------o
bool ApplySpawnItemSection( CSpawnItem *applyTo, const DFNTAGS tag, const SI32 ndata, const SI32 odata, const std::string& cdata )
{
if( !ValidateObject( applyTo ))
return false;
switch( tag )
{
case DFNTAG_SPAWNOBJLIST:
applyTo->IsSectionAList( true );
[[fallthrough]];
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
case DFNTAG_SPAWNOBJ:
applyTo->SetSpawnSection( cdata );
return true;
case DFNTAG_INTERVAL:
applyTo->SetInterval( 0, static_cast<UI08>( ndata ));
applyTo->SetInterval( 1, static_cast<UI08>( odata ));
Numerous changes with focus on feature and stability parity across Windows, Linux and MacOS platforms Added new Makefile that handles compiling UOX3 and Spidermonkey on both Linux and MacOS (punt) Added VS solution (SpiderMonkey.sln) and VC++ project files for compiling SpiderMonkey on Windows (Xuri) Updated SpiderMonkey from v1.6.0 to v1.7.0 Added optimization flag -O2 for release build in CMakeLists.txt in project root (Xuri) Added StringUtility file with general common string manipulation functions (punt) Updated RandomNum function to use a "seedless" random number generator from C++11 instead of the old C rand() function. (punt) Overall code cleanup to remove/replace platform-dependent code (punt) Replaced potentially unsafe usage of C string stuff like sprintf, vsprintf, vsnprintf, strncat, strcpy and strlen throughout the code with calls to a format() function containing only a single, safe use of vsnprintf, ensuring there's a single place of failure if there's anything to fix and and making it easy to potentially replace this with std::format from C++20 when the time comes. (punt) Replaced usage of char in many places with std::string (punt) Started process of replacing UString usage with functions provided through StringUtility instead (punt) Replaced platform specific fileIO handling in Windows/Linux with cross-platform C++17 standard std::filesystem (punt) Replaced platform specific time handling by using cross-platform chrono library (punt) Removed UOX namespace to reduce complexity (punt) Elimitated template code approach to singletons for more modern c++ constructs, removing dependices in the process (punt) Removed ODBC support; it hasn't been touched since the initial implementation in 2008, and there is a lack of someone to maintain the code. (punt) Removed some platform specific files like uoxlinux.h, which is no longer required (punt) Removed legacy crash protection code, and removed support for cluox (punt) Removed legacy "support" for Borland compiler (punt) Removed legacy VC++ 6 Workspace/Project files, VS2005 Solution/Project files, as these are no longer supported (Xuri) Removed legacy BUILD folder with outdated compilation instructions (Xuri) Removed old Changelog file (merged into Changelog.txt) (Xuri) Fixed a pointer bug for items in multis on world load (punt) Fixed a dictionary related issue that caused segmentation faults on Linux/MacOS (punt) Fixed an issue with callbacks to JS scripts that caused segmentation faults on Linux/MacOS (punt) Paths in uox.ini should now load properly on all platforms regardless of whether those paths use slashes or backslashes, and whether or not they end in a slash/backslash. (punt) Moved to c++17 style of threading, and got rid of threadsafeobject.cpp/h (punt) Replaced parsing of UOX.INI tags with a system that's more easily maintainable (punt) Added some new commands to js/commands/custom/misc-cmd.js (Xuri) cont // Targeted item will be made a container, set to nondecay and movable 2 endfight // Targeted character (and character being fought) will stop fighting getmulti // Get multiObject for targeted item finditem // Find item at layer X movespeed // Set movement speed of target player (0x0 Normal, 0x1 Mounted, 0x2 Slow (walk only), 0x3 Hybrid ("jog"?), 0x4 Frozen) Added new HTML based documentation in docs folder, and removed many old legacy docs that are either incorporated into this document already or no longer relevant for the current UOX3 version (Xuri) Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2020-09-07 18:09:55 +08:00
return true;
default:
break;
}
return false;
}
UI16 AddRandomColor( const std::string& colorlist );
//o------------------------------------------------------------------------------------------------o
//| Function - ApplyItemSection()
//o------------------------------------------------------------------------------------------------o
//| Purpose - Load items from the script sections to the array
//o------------------------------------------------------------------------------------------------o
auto ApplyItemSection( CItem *applyTo, CScriptSection *toApply, std::string sectionId ) -> bool
{
if( toApply == nullptr || !ValidateObject( applyTo ))
return false;
std::string cdata;
SI32 ndata = -1, odata = -1;
bool isSpawner = ( applyTo->GetObjType() == OT_SPAWNER );
TAGMAPOBJECT customTag;
std::string customTagName;
std::string customTagStringValue;
for( const auto &sec : toApply->collection2() )
{
auto tag = sec->tag;
cdata = sec->cdata;
odata = sec->odata;
ndata = sec->ndata;
2022-06-09 11:41:07 -04:00
if( isSpawner && ApplySpawnItemSection( static_cast<CSpawnItem *>( applyTo ), tag, ndata, odata, cdata ))
{
continue;
}
auto ssecs = oldstrutil::sections( oldstrutil::trim( oldstrutil::removeTrailing( cdata, "//" )), " " );
switch( tag )
{
2024-05-11 20:15:52 -05:00
case DFNTAG_ARTIFACTRARITY: applyTo->SetArtifactRarity( static_cast<SI16>( ndata )); break;
case DFNTAG_AMMO:
applyTo->SetAmmoId( static_cast<UI16>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[0], "//" )), nullptr, 0 )));
if( ssecs.size() > 1 )
{
applyTo->SetAmmoHue( static_cast<UI16>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[1], "//" )), nullptr, 0 )));
}
break;
case DFNTAG_AMMOFX:
applyTo->SetAmmoFX( static_cast<UI16>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[0], "//" )), nullptr, 0 )));
if( ssecs.size() > 1 )
{
applyTo->SetAmmoFXHue( static_cast<UI16>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[1], "//" )), nullptr, 0 )));
if( ssecs.size() > 2 )
{
applyTo->SetAmmoFXRender( static_cast<UI16>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[2], "//" )), nullptr, 0 )));
}
}
break;
case DFNTAG_AMOUNT:
if( ndata > 0 )
{
if( odata && odata > ndata )
{
UI16 rndAmount = static_cast<UI16>( RandomNum( ndata, odata ));
applyTo->SetAmount( rndAmount );
}
else
{
applyTo->SetAmount( ndata );
}
}
else
{
Console.Warning( oldstrutil::format( "Invalid data found in AMOUNT tag inside item script [%s]", sectionId.c_str() ));
}
break;
2025-01-16 21:33:31 -06:00
case DFNTAG_DURABILITYHPBONUS: applyTo->SetDurabilityHpBonus( static_cast<SI16>( ndata )); break;
case DFNTAG_DAMAGE:
case DFNTAG_ATT:
if( ndata >= 0 )
{
if( odata && odata > ndata )
{
applyTo->SetLoDamage( static_cast<SI16>( ndata ));
applyTo->SetHiDamage( static_cast<SI16>( odata ));
}
else
{
applyTo->SetLoDamage( static_cast<SI16>( ndata ));
applyTo->SetHiDamage( static_cast<SI16>( ndata ));
}
}
else
{
Console.Warning( oldstrutil::format( "Invalid data found in ATT/DAMAGE tag inside item script [%s]", sectionId.c_str() ));
}
break;
case DFNTAG_DAMAGEINCREASE: applyTo->SetDamageIncrease( static_cast<SI16>( ndata )); break;
case DFNTAG_AC: applyTo->SetArmourClass( static_cast<UI08>( ndata )); break;
2024-06-18 18:28:50 -05:00
case DFNTAG_HEALTHLEECH: applyTo->SetHealthLeech( static_cast<SI16>( ndata )); break;
case DFNTAG_STAMINALEECH: applyTo->SetStaminaLeech( static_cast<SI16>( ndata )); break;
case DFNTAG_MANALEECH: applyTo->SetManaLeech( static_cast<SI16>( ndata )); break;
case DFNTAG_BASERANGE: applyTo->SetBaseRange( static_cast<UI08>( ndata )); break;
2024-06-16 18:57:27 -05:00
case DFNTAG_HEALTHBONUS: applyTo->SetHealthBonus( static_cast<SI16>( ndata )); break;
case DFNTAG_STAMINABONUS: applyTo->SetStaminaBonus( static_cast<SI16>( ndata )); break;
case DFNTAG_MANABONUS: applyTo->SetManaBonus( static_cast<SI16>( ndata )); break;
case DFNTAG_CREATOR: applyTo->SetCreator( ndata ); break;
case DFNTAG_COLOUR: applyTo->SetColour( static_cast<UI16>( ndata )); break;
case DFNTAG_COLOURLIST: applyTo->SetColour( AddRandomColor( cdata )); break;
case DFNTAG_CORPSE: applyTo->SetCorpse( ndata != 0 ) ; break;
case DFNTAG_COLD: applyTo->SetWeatherDamage( COLD, ndata != 0 ); break;
case DFNTAG_ELEMENTRESIST:
if( ssecs.size() >= 4 )
{
applyTo->SetResist( static_cast<UI16>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[0], "//" )), nullptr, 0 )), HEAT );
applyTo->SetResist( static_cast<UI16>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[1], "//" )), nullptr, 0 )), COLD );
applyTo->SetResist( static_cast<UI16>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[2], "//" )), nullptr, 0 )), LIGHTNING );
applyTo->SetResist( static_cast<UI16>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[3], "//" )), nullptr, 0 )), POISON );
}
break;
case DFNTAG_ERBONUS:
if( ssecs.size() >= 4 )
{
applyTo->SetResist( applyTo->GetResist( HEAT ) + static_cast<UI16>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[0], "//" )), nullptr, 0 )), HEAT );
applyTo->SetResist( applyTo->GetResist( COLD ) + static_cast<UI16>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[1], "//" )), nullptr, 0 )), COLD );
applyTo->SetResist( applyTo->GetResist( LIGHTNING ) + static_cast<UI16>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[2], "//" )), nullptr, 0 )), LIGHTNING );
applyTo->SetResist( applyTo->GetResist( POISON ) + static_cast<UI16>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[3], "//" )), nullptr, 0 )), POISON );
}
break;
case DFNTAG_EVENT: applyTo->SetEvent( cdata ); break;
case DFNTAG_DAMAGEABLE: applyTo->SetDamageable(ndata != 0 ); break;
case DFNTAG_DEF:
if( ndata >= 0 )
{
if( odata && odata > ndata )
{
applyTo->SetResist( static_cast<UI16>( RandomNum( ndata, odata )), PHYSICAL );
}
else
{
applyTo->SetResist( ndata, PHYSICAL );
}
}
else
Console.Warning( oldstrutil::format( "Invalid data found in DEF tag inside item script [%s]", sectionId.c_str() ));
break;
case DFNTAG_DEFBONUS:
if( ndata >= 0 )
{
if( odata && odata > ndata )
{
applyTo->SetResist( applyTo->GetResist( PHYSICAL ) + static_cast<UI16>( RandomNum( ndata, odata )), PHYSICAL );
}
else
{
applyTo->SetResist( applyTo->GetResist( PHYSICAL ) + static_cast<UI16>( ndata ), PHYSICAL );
}
}
else
{
Console.Warning( oldstrutil::format( "Invalid data found in DEFBONUS tag inside item script [%s]", sectionId.c_str() ));
}
break;
case DFNTAG_DEX:
if( ndata > 0 )
{
if( odata && odata > ndata )
{
applyTo->SetDexterity( static_cast<SI16>( RandomNum( ndata, odata )));
}
else
{
applyTo->SetDexterity( ndata );
}
}
else
{
Console.Warning( oldstrutil::format( "Invalid data found in DEX tag inside item script [%s]", sectionId.c_str() ));
}
break;
case DFNTAG_DEXADD: applyTo->SetDexterity2( static_cast<SI16>( ndata )); break;
case DFNTAG_DIR: applyTo->SetDir( static_cast<UI08>( std::stoi( oldstrutil::trim( oldstrutil::removeTrailing( cdata, "//" )), nullptr, 0 ))); break;
case DFNTAG_DYE: applyTo->SetDye( ndata != 0 ); break;
case DFNTAG_DECAY:
if( ndata == 1 )
{
applyTo->SetDecayable( true );
}
else
{
applyTo->SetDecayable( false );
}
break;
case DFNTAG_DISPELLABLE: applyTo->SetDispellable( true ); break;
case DFNTAG_DISABLED: applyTo->SetDisabled( ndata != 0 ); break;
case DFNTAG_DOORFLAG: break;
2024-06-14 14:38:03 -05:00
case DFNTAG_DEFENSECHANCE: applyTo->SetDefenseChance( static_cast<SI16>( ndata )); break;
case DFNTAG_GOOD: applyTo->SetGood( static_cast<SI16>( ndata )); break;
case DFNTAG_GLOW: applyTo->SetGlow( ndata ); break;
case DFNTAG_GLOWBC: applyTo->SetGlowColour( static_cast<UI16>( ndata )); break;
case DFNTAG_GLOWTYPE: applyTo->SetGlowEffect( static_cast<UI08>( ndata )); break;
case DFNTAG_GET:
{
std::string scriptEntry = "";
if( ssecs.size() == 1 )
{
scriptEntry = cdata;
}
else
{
UI32 rndEntry = RandomNum( 0, static_cast<SI32>( ssecs.size() - 1 ));
scriptEntry = oldstrutil::trim( oldstrutil::removeTrailing( ssecs[rndEntry], "//" ));
}
auto toFind = FileLookup->FindEntry( scriptEntry, items_def );
if( toFind == nullptr )
{
Console.Warning( oldstrutil::format( "Invalid script entry (%s) called with GET tag, item serial 0x%X", scriptEntry.c_str(), applyTo->GetSerial() ));
}
else if( toFind == toApply )
{
Console.Warning( oldstrutil::format( "Infinite loop avoided with GET tag inside item script [%s]", scriptEntry.c_str() ));
}
else
{
ApplyItemSection( applyTo, toFind, scriptEntry );
}
break;
}
case DFNTAG_GETT2A:
case DFNTAG_GETUOR:
case DFNTAG_GETTD:
case DFNTAG_GETLBR:
case DFNTAG_GETAOS:
case DFNTAG_GETSE:
case DFNTAG_GETML:
case DFNTAG_GETSA:
case DFNTAG_GETHS:
case DFNTAG_GETTOL:
{
// Inherit stats for object based on active ruleset
bool getParent = false;
std::string tagName = "";
switch( cwmWorldState->ServerData()->ExpansionCoreShardEra() )
{
case ER_T2A: if( tag == DFNTAG_GETT2A ) { getParent = true; tagName = "GETT2A"; } break;
case ER_UOR: if( tag == DFNTAG_GETUOR ) { getParent = true; tagName = "GETUOR"; } break;
case ER_TD: if( tag == DFNTAG_GETTD ) { getParent = true; tagName = "GETTD"; } break;
case ER_LBR: if( tag == DFNTAG_GETLBR ) { getParent = true; tagName = "GETLBR"; } break;
case ER_AOS: if( tag == DFNTAG_GETAOS ) { getParent = true; tagName = "GETAOS"; } break;
case ER_SE: if( tag == DFNTAG_GETSE ) { getParent = true; tagName = "GETSE"; } break;
case ER_ML: if( tag == DFNTAG_GETML ) { getParent = true; tagName = "GETML"; } break;
case ER_SA: if( tag == DFNTAG_GETSA ) { getParent = true; tagName = "GETSA"; } break;
case ER_HS: if( tag == DFNTAG_GETHS ) { getParent = true; tagName = "GETHS"; } break;
case ER_TOL: if( tag == DFNTAG_GETTOL ) { getParent = true; tagName = "GETTOL"; } break;
default:
2022-06-09 11:41:07 -04:00
break;
}
if( getParent )
{
std::string scriptEntry = "";
if( ssecs.size() == 1 )
{
scriptEntry = cdata;
}
else
{
UI32 rndEntry = RandomNum( 0, static_cast<SI32>( ssecs.size() - 1 ));
scriptEntry = oldstrutil::trim( oldstrutil::removeTrailing( ssecs[rndEntry], "//" ));
}
CScriptSection *toFind = FileLookup->FindEntry( scriptEntry, items_def );
if( toFind == NULL )
{
Console.Warning( oldstrutil::format( "Invalid script entry (%s) called with %s tag, item serial 0x%X", scriptEntry.c_str(), tagName.c_str(), applyTo->GetSerial() ));
}
else if( toFind == toApply )
{
Console.Warning( oldstrutil::format( "Infinite loop avoided with %s tag inside item script [%s]", tagName.c_str(), scriptEntry.c_str() ));
}
else
{
ApplyItemSection( applyTo, toFind, scriptEntry );
}
}
break;
}
case DFNTAG_HP:
if( ndata > 0 )
{
if( odata && odata > ndata )
{
applyTo->SetHP( static_cast<SI16>( RandomNum( ndata, odata )));
}
else
{
applyTo->SetHP( ndata );
}
}
else
{
Console.Warning( oldstrutil::format( "Invalid data found in HP tag inside item script [%s]", sectionId.c_str() ));
}
break;
case DFNTAG_HIDAMAGE: applyTo->SetHiDamage( static_cast<SI16>( ndata )); break;
2024-06-14 14:38:03 -05:00
case DFNTAG_HITCHANCE: applyTo->SetHitChance( static_cast<SI16>( ndata )); break;
case DFNTAG_HEAT: applyTo->SetWeatherDamage( HEAT, ndata != 0 ); break;
case DFNTAG_ID: // applyTo->SetId( static_cast<UI16>( ndata )); break;
if( ssecs.size() == 1 )
{
applyTo->SetId( static_cast<UI16>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[0], "//" )), nullptr, 0 )));
}
else
{
SI32 rndEntry = RandomNum( 0, static_cast<SI32>( ssecs.size() - 1 ));
applyTo->SetId( static_cast<UI16>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[rndEntry], "//" )), nullptr, 0 )));
}
break;
case DFNTAG_INTELLIGENCE: applyTo->SetIntelligence( static_cast<SI16>( ndata )); break;
case DFNTAG_INTADD: applyTo->SetIntelligence2( static_cast<SI16>( ndata )); break;
case DFNTAG_LODAMAGE: applyTo->SetLoDamage( static_cast<SI16>( ndata )); break;
case DFNTAG_LAYER: applyTo->SetLayer( static_cast<ItemLayers>( ndata )); break;
case DFNTAG_LIGHT: applyTo->SetWeatherDamage( LIGHT, ndata != 0 ); break;
case DFNTAG_LIGHTNING: applyTo->SetWeatherDamage( LIGHTNING, ndata != 0 ); break;
2024-05-11 20:17:11 -05:00
case DFNTAG_LOWERSTATREQ: applyTo->SetLowerStatReq( static_cast<SI16>( ndata )); break;
case DFNTAG_LUCK: applyTo->SetLuck( static_cast<SI16>( ndata )); break;
case DFNTAG_MAXHP: applyTo->SetMaxHP( static_cast<UI16>( ndata )); break;
case DFNTAG_MAXITEMS: applyTo->SetMaxItems( static_cast<UI16>( ndata )); break;
case DFNTAG_MAXRANGE: applyTo->SetMaxRange( static_cast<UI08>( ndata )); break;
case DFNTAG_MAXUSES: applyTo->SetMaxUses( static_cast<UI16>( ndata )); break;
case DFNTAG_MOVABLE: applyTo->SetMovable( static_cast<SI08>( ndata )); break;
case DFNTAG_MORE:
if( ssecs.size() >= 4 )
{
applyTo->SetTempVar( CITV_MORE, 1, static_cast<UI08>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[0], "//" )), nullptr, 0 )));
applyTo->SetTempVar( CITV_MORE, 2, static_cast<UI08>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[1], "//" )), nullptr, 0 )));
applyTo->SetTempVar( CITV_MORE, 3, static_cast<UI08>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[2], "//" )), nullptr, 0 )));
applyTo->SetTempVar( CITV_MORE, 4, static_cast<UI08>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[3], "//" )), nullptr, 0 )));
}
else
{
applyTo->SetTempVar( CITV_MORE, static_cast<UI32>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[0], "//" )), nullptr, 0 )));
}
break;
Thief Revamp - 0.99.6-RC5 Added script for NPC guildmasters (js/npc/ai/guildmaster.js). Only one NPC guild has been setup in the script so far (more can be easily added) - the Thieves Guild - which if joined grants players the ability to steal from other players and to buy disguise kits Added two new NPCs, which there will now spawn one of in a random location in each city in Britannia (felucca facet): m_thief_guildmaster (dfndata/npc/male_human.dfn) f_thief_guildmaster (dfndata/npc/female_Human.dfn) Added two new character properties to keep track of which NPC guild a player (or NPC) belongs to. These properties have been exposed as the following Character JS properties: .npcGuild // ID of NPC guild, as defined in script .npcGuildJoined // Timestamp for when player joined NPC guild Added script for Disguise Kits (js/item/disguisekit.js). These allow members of the Thieves Guild to disguise themselves from the prying eyes of other players. Added two new character properties: .isDisguised // true/false flag for character being disguised .origName // used to store character's original name before disguise went into effect Moved implementation of Stealing skill from code to script (js/skill/stealing.js) and revamped it completely in the process. Changes include: New features: Town rare stealing - any item marked as "special stealable" with new item property .stealable can be stolen, even if it's locked down by a GM on the ground, or inside a container When stealing from item piles, thief can potentially steal the amount of items that makes up the max weight limit for what they can steal, from those piles Chance to successfully steal is now affected by whether there are any characters (NPCs or Players) that witness the attempt. Depends on distance to character, and direction character is facing Players now become "permagrey" when successfully stealing from another player, regardless of whether it's witnessed Players now receive a "stealing" flag when stealing from another player, regardless of whether it's witnessed Stolen items cannot be removed from thief's backpack for 30 seconds following the theft of the item (AoS core shard era and above) Optional AoS feature to steal special consumable items from monsters Updated default stealing rules: Updated calculations to determine chance of success when stealing Players cannot steal while engaged in combat Players are revealed if hidden as soon as they use the stealing skill Players can no longer steal items in the secure trade window Players can no longer steal items from NPC shopkeepers Both hands must be free to steal Stealing now checks line of sight to target player/object Only members of Thieves Guild (NPC guild) can now steal from other players, unless they are guild enemies Players can no longer steal from NPC guards by default Players can no longer steal from the same NPC monster more than once Only gold and gems can be stolen from innocent players in dungeon/ll areas of Felucca, if core shard era is set to AoS or higher Players can no longer steal items held on cursor by other players Orcish masks now eplode if player steals from orcs while wearing it If core shard era is set to LBR or lower, player is marked as an aggressor if they steal from another player Guards can only be called on players that are flagged as criminals within the first 10 seconds of them being flagged Stealing script options: Allow stealing entire containers (off by default pre-AoS) Return stolen items on thief death (off by default) Temporarily make stolen items immovable in thief's backpack (on by default post-AoS) Temporarily protect traded items (on by default) Let dexterity affect chance for successful theft (off by default) Let light level affect chance for successful theft (off by default) Allow stealing from NPC Guards (off by default) Allow stealing special loot from monsters (on by default post-ml) Moved implementation of Snooping skill from code to script (js/skill/snooping.js), with some changes: Players cannot snoop pack animals from inside a house, if the animal is outside The deeper inside main backpack a container sits, the harder it becomes to snoop inside it Included an optional feature that lets targets of snooping gradually become more aware, increasing the difficulty of succeeding. This awareness fades over time. Players have a chance to stay hidden while snooping, based on their Hiding skill Karma is now lowered by snooping regardless of success or failure Added tracking system for "aggressors" in combat. A player attacking someone (regardless of flag status) will be marked as aggressor to that someone for 2 minutes Added tracking system for "permagrey" flags - these are stored on a per-target basis, so a player can be flagged visibly as permagrey to multiple other players. Persists until player dies. Player combat targets and war mode are now cleared on logout Players will now be unable to hide if within visual distance and in line of sight of their attacker or current target in combat Server leave-announcement now only happens after the logout timer has expired, instead of the exact moment the player presses the logout button Fixed an issue that could cause swimming NPCs to swim on land NPCs now have the ability to temporarily ignore unreachable targets in combat. If attacked by someone they are ignoring, they will enter evade state and try to move away from that someone. SpawnRegions now support NPCLISTS with weighted entries. Example of an NPCLIST with 75% chance of spawning some kind of orc, and 25% chance of spawning a ratman archer: [NPCLIST example] { 75|NPCLIST=allorc 25|ratman } Added 3 additional "all purpose" item properties (.more0, .more1 and .more2) and exposed those to JS engine. These work the same as more/morex/morey/morez Mark spell now stores a 4th property on recall runes - instanceID. This is stored in the rune's .more0 property. Recall and Gate spells now check the recall rune (or runebook)'s 4th location property - instanceID - to determine where the player ends up Fixed a server crash related to equipment being automatically unequipped if character is no longer strong enough to have it equipped Added new JS Function to check if any characters at specified location potentially block movement: DoesCharacterBlock( x, y, z, worldNum, instanceID ) // returns true if a character exists at given coordinate (within z +/- 4)
2023-06-20 02:21:16 +08:00
case DFNTAG_MORE0:
if( ssecs.size() >= 4 )
{
applyTo->SetTempVar( CITV_MORE0, 1, static_cast<UI08>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[0], "//" )), nullptr, 0 )));
applyTo->SetTempVar( CITV_MORE0, 2, static_cast<UI08>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[1], "//" )), nullptr, 0 )));
applyTo->SetTempVar( CITV_MORE0, 3, static_cast<UI08>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[2], "//" )), nullptr, 0 )));
applyTo->SetTempVar( CITV_MORE0, 4, static_cast<UI08>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[3], "//" )), nullptr, 0 )));
}
else
{
applyTo->SetTempVar( CITV_MORE0, static_cast<UI32>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[0], "//" )), nullptr, 0 )));
}
break;
case DFNTAG_MORE1:
if( ssecs.size() >= 4 )
{
applyTo->SetTempVar( CITV_MORE1, 1, static_cast<UI08>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[0], "//" )), nullptr, 0 )));
applyTo->SetTempVar( CITV_MORE1, 2, static_cast<UI08>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[1], "//" )), nullptr, 0 )));
applyTo->SetTempVar( CITV_MORE1, 3, static_cast<UI08>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[2], "//" )), nullptr, 0 )));
applyTo->SetTempVar( CITV_MORE1, 4, static_cast<UI08>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[3], "//" )), nullptr, 0 )));
}
else
{
applyTo->SetTempVar( CITV_MORE1, static_cast<UI32>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[0], "//" )), nullptr, 0 )));
}
break;
case DFNTAG_MORE2:
if( ssecs.size() >= 4 )
{
applyTo->SetTempVar( CITV_MORE2, 1, static_cast<UI08>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[0], "//" )), nullptr, 0 )));
applyTo->SetTempVar( CITV_MORE2, 2, static_cast<UI08>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[1], "//" )), nullptr, 0 )));
applyTo->SetTempVar( CITV_MORE2, 3, static_cast<UI08>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[2], "//" )), nullptr, 0 )));
applyTo->SetTempVar( CITV_MORE2, 4, static_cast<UI08>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[3], "//" )), nullptr, 0 )));
}
else
{
applyTo->SetTempVar( CITV_MORE2, static_cast<UI32>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[0], "//" )), nullptr, 0 )));
}
break;
case DFNTAG_MOREX:
if( ssecs.size() >= 4 )
{
applyTo->SetTempVar( CITV_MOREX, 1, static_cast<UI08>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[0], "//" )), nullptr, 0 )));
applyTo->SetTempVar( CITV_MOREX, 2, static_cast<UI08>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[1], "//" )), nullptr, 0 )));
applyTo->SetTempVar( CITV_MOREX, 3, static_cast<UI08>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[2], "//" )), nullptr, 0 )));
applyTo->SetTempVar( CITV_MOREX, 4, static_cast<UI08>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[3], "//" )), nullptr, 0 )));
}
else
{
applyTo->SetTempVar( CITV_MOREX, static_cast<UI32>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[0], "//" )), nullptr, 0 )));
}
break;
case DFNTAG_MOREY:
if( ssecs.size() >= 4 )
{
applyTo->SetTempVar( CITV_MOREY, 1, static_cast<UI08>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[0], "//" )), nullptr, 0 )));
applyTo->SetTempVar( CITV_MOREY, 2, static_cast<UI08>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[1], "//" )), nullptr, 0 )));
applyTo->SetTempVar( CITV_MOREY, 3, static_cast<UI08>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[2], "//" )), nullptr, 0 )));
applyTo->SetTempVar( CITV_MOREY, 4, static_cast<UI08>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[3], "//" )), nullptr, 0 )));
}
else
{
applyTo->SetTempVar( CITV_MOREY, static_cast<UI32>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[0], "//" )), nullptr, 0 )));
}
break;
case DFNTAG_MOREZ:
if( ssecs.size() >= 4 )
{
applyTo->SetTempVar( CITV_MOREZ, 1, static_cast<UI08>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[0], "//" )), nullptr, 0 )));
applyTo->SetTempVar( CITV_MOREZ, 2, static_cast<UI08>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[1], "//" )), nullptr, 0 )));
applyTo->SetTempVar( CITV_MOREZ, 3, static_cast<UI08>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[2], "//" )), nullptr, 0 )));
applyTo->SetTempVar( CITV_MOREZ, 4, static_cast<UI08>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[3], "//" )), nullptr, 0 )));
}
else
{
applyTo->SetTempVar( CITV_MOREZ, static_cast<UI32>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[0], "//" )), nullptr, 0 )));
}
break;
case DFNTAG_NAME: applyTo->SetName( cdata ); break;
case DFNTAG_NAME2: applyTo->SetName2( cdata ); break;
2023-10-26 22:50:21 -05:00
case DFNTAG_NAMELIST: SetRandomName( applyTo, cdata ); break;
case DFNTAG_NEWBIE: applyTo->SetNewbie( true ); break;
case DFNTAG_OFFSPELL: applyTo->SetOffSpell( static_cast<SI08>( ndata )); break;
UOX3 0.99.6-RC3 Updated Item DFNs with ORIGIN and SECTIONID tags for relevant items Added JS Function to make comparing eras (based on object origin or server settings) easier: EraStringToNum( eraString ) // Takes an era string (uo, t2a, uor, td, lbr, aos, etc) and returns an int Updated some JS scripts to use EraStringToNum() for era comparisons (potionkeg.js) Default CORESHARDERA setting is now LBR Removed PUB15 as a separate "era" - it's identical to late stage LBR anyway: Removed support for GETPUB15 tag Added support for GETUO tag for items/NPCs: GETUO=<sectionID> // Inherit DFN section if core shard era is Ultima Online (original release, before T2A) Rewrote portions of MsgBoardQuestEscortCreate() function in msgboard.cpp to ensure only escort regions within same world as NPC can be selected as destinations Increased maximum number of possible escort regions that can exist from 255 to 65535 Added region definitions for all shrines in Britannia (Fel & Trammel), and marked them as valid destinations for NPC escorts (uox3/regions/regions.dfn) Moved bankers from vendor to human DFN files, and made them inherit basehuman instead of basevendor - since they are not vendors To address an issue with escorted NPCs not timing out and vanishing if they are left in a "dormant" area of the world with no player activity, the NPCs are marked as "always awake" the moment they arrive at their destination. Note that the uox.ini setting ALLOWAWAKENPCS needs to be enabled for this to work. Fixed an issue where spawnsection of spawners did not show up correctly in tweak menu Fixed an issue where the generic Orc AI script didn't have a return true at end of onDamage() event, which prevented all orcs from taking damage in combat (js/npc/ai/monster/orc.js) Moved Anatomy skill-check in healing script (js/skill/healing.js) from onCallback1() function to onTimer() to prevent the skill-check from being spammable Added mount ID for Frost Mite in creatures.dfn, allowing it to be used as mount Exposed the following character properties to JS engine, which can be used to view/adjust the permanent hair/beard options for a character: .hairStyle .hairColour .beardStyle .beardColour Updated 'kill hair, 'shavehair, 'shavebeard and 'remove commands to clear permanent hair/beard colour and style properties in addition to removing the item itself Added a GM override to let GMs place as many houses as they want (js/server/house/houseDeed.js) Fixed an issue where attempting to sell items to NPC shopkeepers could result in client crashing Added a new JS Event: onMultiLogout( iMulti, cPlayer ) // Handles players logging out while inside multis Updated house script (js/server/house/house.js) with onMultiLogout event, which allows owners (always) and co-owners/friends/guests (if option enabled in uox.ini) to safely log out inside the house (without getting booted). Added a "keyless" option for interacting with locked doors (js/item/doors.js) of player-owned houses, which lets owners/co-owners/friends/guests of a house use locked doors in the house without requiring a key in their backpack, if the options for that are enabled in UOX.INI. Enabled for owners/co-owners and friends by default (but not for guests) Note that if option to safely log out is enabled, but keyless option is NOT enabled, then the server will check if the player has a key to the house in their backpack, and eject them from the house upon logging out if not. This is to make sure players don't get stuck inside a house they can't get out of because they lack the rights to open doors etc. Added new UOX.INI options, under the [houses] section: SAFECOOWNERLOGOUT=1 // Allow co-owners to safely and instantly log out inside house SAFEFRIENDLOGOUT=1 // Allow friends to safely and instantly log out inside house SAFEGUESTLOGOUT=1 // Allow guests to safely and instantly log out inside house KEYLESSOWNERACCESS=1 // Allow owner of house to use locked doors in house without key in pack KEYLESSCOOWNERACCESS=1 // Allow co-owners of house to use locked doors in house without key in pack KEYLESSFRIENDACCESS=1 // Allow friends of house to use locked doors in house without key in pack KEYLESSGUESTACCESS=0 // Allow guests of house to use locked doors in house without key in pack Fixed NOHAIR tag from races.dfn not being loaded correctly
2023-03-04 22:50:55 +08:00
case DFNTAG_ORIGIN: applyTo->SetOrigin( static_cast<ExpansionRuleset>( cwmWorldState->ServerData()->EraStringToEnum( cdata ))); break;
case DFNTAG_POISONDAMAGE: applyTo->SetWeatherDamage( POISON, ndata != 0 ); break;
case DFNTAG_POISONED: applyTo->SetPoisoned( static_cast<UI08>( ndata )); break;
case DFNTAG_PILEABLE: applyTo->SetPileable( ndata != 0 ); break;
case DFNTAG_PRIV: applyTo->SetPriv( static_cast<UI08>( ndata )); break;
case DFNTAG_RANK:
applyTo->SetRank( static_cast<SI08>( ndata ));
if( applyTo->GetRank() <= 0 )
{
applyTo->SetRank( 10 );
}
break;
Rework of passive stat regeneration Updated code calculating passive health, stamina and mana regeneration for characters, based on new UOX.INI settings and bonuses from characters/items/races Added three new Character/Item/Race DFN tags to grant bonus health/stamina/mana regeneration: HEALTHREGENBONUS=# // 10 bonus points equates to 0.01 extra hp regen per second, independent of era STAMINAREGENBONUS=# // 10 bonus points equates to 0.05 extra stamina regen per second MANAREGENBONUS=# // 10 bonus point equates to 0.1 extra mana regen per second ...also available as JS Properties: .healthRegenBonus .staminaRegenBonus .manaRegenBonus Updated get/set JS commands to allow getting/setting regen bonuses for health, stamina and mana Updated races.dfn to include default +2 health regen bonus for humans, and +2 mana regen bonus for gargoyles. Added new UOX.INI settings under [Skills and Stats] section: HEALTHREGENMODE=1 // 0 = no passive health regen, 1 = default passive health regen STAMINAREGENMODE=1 // 0 = no passive stamina regen, 1 = default passive stamina regen (LBR or below), 2 = AoS or beyond, 3 = SA and beyond MANAREGENMODE=1 // 0 = no passive mana regen, 1 = default passive mana regen (LBR or below), 2 = AoS (Pub17), 3 = AoS/SE (Pub18 and beyond), 4 = ML, 5 = KR, 6 = SA and beyond HEALTHREGENCAP=# // Max cap for Health Regeneration Bonus stat per character STAMINAREGENCAP=# // Max cap for Stamina Regeneration Bonus stat per character MANAREGENCAP=# // Max cap for Mana Regeneration Bonus stat per character Added new UOX.INI section ([default race bonuses]) with the following new settings for the 3 default playable races (only used if nothing else specified in races.dfn): HUMANHEALTHREGENBONUS=0 // default health regen bonus for human race (2 from ML expansion onwards) HUMANSTAMINAREGENBONUS=0 // default stamina regen bonus for human race HUMANMANAREGENBONUS=0 // default mana regen bonus for human race ELFHEALTHREGENBONUS=0 // default health regen bonus for elf race ELFSTAMINAREGENBONUS=0 // default stamina regen bonus for elf race ELFMANAREGENBONUS=0 // default mana regen bonus for elf race GARGOYLEHEALTHREGENBONUS=0 // default health regen bonus for gargoyle race GARGOYLESTAMINAREGENBONUS=0 // default stamina regen bonus for gargoyle race GARGOYLEMANAREGENBONUS=0 // default mana regen bonus for gargoyle race (2 from SA expansion onwards) Updated UOX3 Documentation with new feature section on Stat Regeneration with details on stat regeneration rules and recommended settings per UO era Added support for Medable armors (have no effect on meditation skill and/or passive regen of mana when worn) and Mage Armors (can turn non-medable armor into medable armor) These properties are defined per armor piece using the first and second bits of the MORE property: MORE=0x1 0x0 0x0 0x0 // Medable Armor MORE=0x0 0x1 0x0 0x0 // Mage Armor The following armor types have been marked as medable by default: leather armor, leather ninja armor, leather samurai armor, leaf armor, gargish cloth armor, gargish leather armor and all hats and masks Updated JS Method .Defense() to support optional fourth and fifth parameters - excludeMedableArmor (true/false) and includeShield (true/false) Updated CalfDef function to support including shields in the calculations, and updated mana regen code to include shields when checking for equipped armor Updated Meditation skill JS script to exclude medable armor from armor check, include shields, and apply different rules for active meditation depending on mana regen mode Updated stat window to include defensive rating of shields (based on Parrying skill) and/or elemental resistances (if enabled in ini) Added a new property to CRace class, which is automatically set and incremented as UOX3 loads in races from races.dfn: raceID Added new Getters/Setters for CRace class to retrieve ID of a specific Race object Updated JS property .id for Race JS Object to return new race ID instead of iterating through list of races to compare race object and return index Reloading DFNs now also reloads Races
2025-04-20 06:05:44 +08:00
case DFNTAG_HEALTHREGENBONUS: applyTo->SetHealthRegenBonus( static_cast<SI16>( ndata )); break;
case DFNTAG_STAMINAREGENBONUS: applyTo->SetStaminaRegenBonus( static_cast<SI16>( ndata )); break;
case DFNTAG_MANAREGENBONUS: applyTo->SetManaRegenBonus( static_cast<SI16>( ndata )); break;
case DFNTAG_RACE: applyTo->SetRace( static_cast<UI16>( ndata )); break;
case DFNTAG_RESISTFIRE:
if( ndata >= 0 )
{
if( odata && odata > ndata )
{
applyTo->SetResist( static_cast<UI16>( RandomNum( ndata, odata )), HEAT );
}
else
{
applyTo->SetResist( ndata, HEAT );
}
}
else
{
Console.Warning( oldstrutil::format( "Invalid data found in RESISTFIRE tag inside Item script [%s]", sectionId.c_str() ));
}
break;
case DFNTAG_RESISTCOLD:
if( ndata >= 0 )
{
if( odata && odata > ndata )
{
applyTo->SetResist( static_cast<UI16>( RandomNum( ndata, odata )), COLD );
}
else
{
applyTo->SetResist( ndata, COLD );
}
}
else
{
Console.Warning( oldstrutil::format( "Invalid data found in RESISTCOLD tag inside Item script [%s]", sectionId.c_str() ));
}
break;
case DFNTAG_RESISTLIGHTNING:
if( ndata >= 0 )
{
if( odata && odata > ndata )
{
applyTo->SetResist( static_cast<UI16>( RandomNum( ndata, odata )), LIGHTNING );
}
else
{
applyTo->SetResist( ndata, LIGHTNING );
}
}
else
{
Console.Warning( oldstrutil::format( "Invalid data found in RESISTLIGHTNING tag inside Item script [%s]", sectionId.c_str() ));
}
break;
case DFNTAG_RESISTPOISON:
if( ndata >= 0 )
{
if( odata && odata > ndata )
{
applyTo->SetResist( static_cast<UI16>( RandomNum( ndata, odata )), POISON );
}
else
{
applyTo->SetResist( ndata, POISON );
}
}
else
{
Console.Warning( oldstrutil::format( "Invalid data found in RESISTPOISON tag inside Item script [%s]", sectionId.c_str() ));
}
break;
case DFNTAG_RESTOCK:
{
// Apply global restock multiplier from INI to item's restock property
auto restockMultiplier = cwmWorldState->ServerData()->GlobalRestockMultiplier();
applyTo->SetRestock( static_cast<UI16>( floor( static_cast<UI16>( ndata ) * restockMultiplier )));
break;
}
case DFNTAG_RAIN: applyTo->SetWeatherDamage( RAIN, ndata != 0 ); break;
case DFNTAG_SECTIONID: applyTo->SetSectionId( cdata ); break;
case DFNTAG_SK_MADE: applyTo->SetMadeWith( static_cast<SI08>( ndata )); break;
2025-01-14 22:32:25 -06:00
case DFNTAG_SWINGSPEEDINCREASE: applyTo->SetSwingSpeedIncrease( static_cast<SI16>( ndata )); break;
case DFNTAG_SPD: applyTo->SetSpeed( static_cast<UI08>( ndata )); break;
case DFNTAG_STRENGTH: applyTo->SetStrength( static_cast<SI16>( ndata )); break;
case DFNTAG_STRADD: applyTo->SetStrength2( static_cast<SI16>( ndata )); break;
Thief Revamp - 0.99.6-RC5 Added script for NPC guildmasters (js/npc/ai/guildmaster.js). Only one NPC guild has been setup in the script so far (more can be easily added) - the Thieves Guild - which if joined grants players the ability to steal from other players and to buy disguise kits Added two new NPCs, which there will now spawn one of in a random location in each city in Britannia (felucca facet): m_thief_guildmaster (dfndata/npc/male_human.dfn) f_thief_guildmaster (dfndata/npc/female_Human.dfn) Added two new character properties to keep track of which NPC guild a player (or NPC) belongs to. These properties have been exposed as the following Character JS properties: .npcGuild // ID of NPC guild, as defined in script .npcGuildJoined // Timestamp for when player joined NPC guild Added script for Disguise Kits (js/item/disguisekit.js). These allow members of the Thieves Guild to disguise themselves from the prying eyes of other players. Added two new character properties: .isDisguised // true/false flag for character being disguised .origName // used to store character's original name before disguise went into effect Moved implementation of Stealing skill from code to script (js/skill/stealing.js) and revamped it completely in the process. Changes include: New features: Town rare stealing - any item marked as "special stealable" with new item property .stealable can be stolen, even if it's locked down by a GM on the ground, or inside a container When stealing from item piles, thief can potentially steal the amount of items that makes up the max weight limit for what they can steal, from those piles Chance to successfully steal is now affected by whether there are any characters (NPCs or Players) that witness the attempt. Depends on distance to character, and direction character is facing Players now become "permagrey" when successfully stealing from another player, regardless of whether it's witnessed Players now receive a "stealing" flag when stealing from another player, regardless of whether it's witnessed Stolen items cannot be removed from thief's backpack for 30 seconds following the theft of the item (AoS core shard era and above) Optional AoS feature to steal special consumable items from monsters Updated default stealing rules: Updated calculations to determine chance of success when stealing Players cannot steal while engaged in combat Players are revealed if hidden as soon as they use the stealing skill Players can no longer steal items in the secure trade window Players can no longer steal items from NPC shopkeepers Both hands must be free to steal Stealing now checks line of sight to target player/object Only members of Thieves Guild (NPC guild) can now steal from other players, unless they are guild enemies Players can no longer steal from NPC guards by default Players can no longer steal from the same NPC monster more than once Only gold and gems can be stolen from innocent players in dungeon/ll areas of Felucca, if core shard era is set to AoS or higher Players can no longer steal items held on cursor by other players Orcish masks now eplode if player steals from orcs while wearing it If core shard era is set to LBR or lower, player is marked as an aggressor if they steal from another player Guards can only be called on players that are flagged as criminals within the first 10 seconds of them being flagged Stealing script options: Allow stealing entire containers (off by default pre-AoS) Return stolen items on thief death (off by default) Temporarily make stolen items immovable in thief's backpack (on by default post-AoS) Temporarily protect traded items (on by default) Let dexterity affect chance for successful theft (off by default) Let light level affect chance for successful theft (off by default) Allow stealing from NPC Guards (off by default) Allow stealing special loot from monsters (on by default post-ml) Moved implementation of Snooping skill from code to script (js/skill/snooping.js), with some changes: Players cannot snoop pack animals from inside a house, if the animal is outside The deeper inside main backpack a container sits, the harder it becomes to snoop inside it Included an optional feature that lets targets of snooping gradually become more aware, increasing the difficulty of succeeding. This awareness fades over time. Players have a chance to stay hidden while snooping, based on their Hiding skill Karma is now lowered by snooping regardless of success or failure Added tracking system for "aggressors" in combat. A player attacking someone (regardless of flag status) will be marked as aggressor to that someone for 2 minutes Added tracking system for "permagrey" flags - these are stored on a per-target basis, so a player can be flagged visibly as permagrey to multiple other players. Persists until player dies. Player combat targets and war mode are now cleared on logout Players will now be unable to hide if within visual distance and in line of sight of their attacker or current target in combat Server leave-announcement now only happens after the logout timer has expired, instead of the exact moment the player presses the logout button Fixed an issue that could cause swimming NPCs to swim on land NPCs now have the ability to temporarily ignore unreachable targets in combat. If attacked by someone they are ignoring, they will enter evade state and try to move away from that someone. SpawnRegions now support NPCLISTS with weighted entries. Example of an NPCLIST with 75% chance of spawning some kind of orc, and 25% chance of spawning a ratman archer: [NPCLIST example] { 75|NPCLIST=allorc 25|ratman } Added 3 additional "all purpose" item properties (.more0, .more1 and .more2) and exposed those to JS engine. These work the same as more/morex/morey/morez Mark spell now stores a 4th property on recall runes - instanceID. This is stored in the rune's .more0 property. Recall and Gate spells now check the recall rune (or runebook)'s 4th location property - instanceID - to determine where the player ends up Fixed a server crash related to equipment being automatically unequipped if character is no longer strong enough to have it equipped Added new JS Function to check if any characters at specified location potentially block movement: DoesCharacterBlock( x, y, z, worldNum, instanceID ) // returns true if a character exists at given coordinate (within z +/- 4)
2023-06-20 02:21:16 +08:00
case DFNTAG_STEALABLE: applyTo->SetStealable( static_cast<UI08>( ndata )); break;
case DFNTAG_SNOW: applyTo->SetWeatherDamage( SNOW, ndata != 0 ); break;
case DFNTAG_SCRIPT: applyTo->AddScriptTrigger( static_cast<UI16>( ndata )); break;
More young player stuff Added new Item DFN tag - SPELLS - which specifies which spells a spellbook starts with, using the following syntax: SPELLS=0x00000000,0x00000000,0x00000000 The existence of a spell from within each circle have specific values (0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80), and a combined value of 0xff if all spells in said circle are present. The first comma-separated value in the SPELLS tag represents spell values for circles 1 to 4, while the second comma-separated value represents the spell values for circles 5 to 8. The third comma-separated value is currently unused. The last two digits (0x000000##) of the first value in the SPELLS tag represent the combined value of spells from the first circle, the 5th and 6th digits (0x0000##00) spells from second circle, the 3rd and 4th from third circle (0x00##0000), and the 1st and 2nd from fourth circle (0x##000000). Repeat for the second value in the tag, with fifth (last two digits) to eight (first two digits) circle spells. Examples: spellbook with only 1st circle spells: SPELLS=0x000000ff,0x0,0x0 spellbook with only 2nd circle spells: SPELLS=0x0000ff00,0x0,0x0 spellbook with 1st - 2nd circle spells: SPELLS=0x0000ffff,0x0,0x0 spellbook with only 2nd and 5th circle spells: SPELLS=0x0000ff00,0x000000ff,0x0 spellbook with only 4th and 8th circle spells: SPELLS=0xff000000,0xff000000,0x0 spellbook with all spells, from all eight circles: SPELLS=0xffffffff,0xffffffff,0x0 Added Item DFN entries for spellbook pre-filled with circles 1 to 4, and for spellbook pre-filled with all spells, and added these to GM 'add menu (dfndata/items/magic/misc_magic.dfn) Fixed an incorrect character reference in Spyglass script (js/item/spyglass.js) Added Item DFN entry for a fireworks wand with 50 charges (dfndata/items/gear/magic_items.dfn) Added script for new player ticket (js/item/consumables/new_player_ticket.js)
2023-07-02 02:41:28 +08:00
case DFNTAG_SPELLS:
if( ssecs.size() == 3 )
{
applyTo->SetSpell( 0, static_cast<UI32>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[0], "//" )), nullptr, 0 )));
applyTo->SetSpell( 1, static_cast<UI32>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[1], "//" )), nullptr, 0 )));
applyTo->SetSpell( 2, static_cast<UI32>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( ssecs[2], "//" )), nullptr, 0 )));
}
else
{
Console.Warning( oldstrutil::format( "Invalid data found in SPELLS tag inside Item script [%s]", sectionId.c_str() ));
}
break;
case DFNTAG_TYPE:
ItemTypes iType;
iType = FindItemTypeFromTag( cdata );
if( iType == IT_COUNT )
{
iType = static_cast<ItemTypes>( ndata );
}
if( iType < IT_COUNT )
{
applyTo->SetType( iType );
}
break;
2025-03-08 21:10:37 -06:00
case DFNTAG_TITHING: applyTo->SetTithing( static_cast<UI32>( ndata )); break;
case DFNTAG_USESLEFT: applyTo->SetUsesLeft( static_cast<UI16>( ndata )); break;
case DFNTAG_VISIBLE: applyTo->SetVisible( static_cast<VisibleTypes>( ndata )); break;
case DFNTAG_VALUE:
if( ndata >= 0 )
{
if( odata && odata >= 0 )
{
applyTo->SetBuyValue( ndata );
applyTo->SetSellValue( odata );
}
else
{
// Only one value was specified in DFN tag - use it for both buy and sell value
applyTo->SetBuyValue( ndata );
applyTo->SetSellValue( ndata );
}
}
else
{
Console.Warning( oldstrutil::format( "Invalid data found in VALUE tag inside item script [%s]", sectionId.c_str() ));
}
break;
case DFNTAG_WEIGHT:
applyTo->SetWeight( ndata );
applyTo->SetBaseWeight( ndata ); // Let's set the base-weight as well. Primarily used for containers.
break;
case DFNTAG_WEIGHTMAX: applyTo->SetWeightMax( ndata ); break;
case DFNTAG_WIPE: applyTo->SetWipeable( ndata != 0 ); break;
case DFNTAG_ADDMENUITEM:
Console.Print( cdata );
break;
case DFNTAG_CUSTOMSTRINGTAG:
{
auto count = 0;
std::string result;
for( auto &sec : ssecs )
{
if( count > 0 )
{
if( count == 1 )
{
result = oldstrutil::trim( oldstrutil::removeTrailing( sec, "//" ));
}
else
{
result = result + " " + oldstrutil::trim( oldstrutil::removeTrailing( sec, "//" ));
}
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
}
count++;
}
customTagName = oldstrutil::trim( oldstrutil::removeTrailing( ssecs[0], "//" ));
customTagStringValue = result;
if( !customTagName.empty() && !customTagStringValue.empty() )
{
customTag.m_Destroy = false;
customTag.m_StringValue = customTagStringValue;
customTag.m_IntValue = static_cast<SI32>( customTag.m_StringValue.size() );
customTag.m_ObjectType = TAGMAP_TYPE_STRING;
applyTo->SetTag( customTagName, customTag );
}
else
{
Console.Warning( oldstrutil::format( "Invalid data found in CUSTOMSTRINGTAG tag inside Item script [%s] - Supported data format: <tagName> <text>", sectionId.c_str() ));
}
break;
}
case DFNTAG_CUSTOMINTTAG:
{
auto count = 0;
std::string result;
for( auto &sec : ssecs )
{
if( count > 0 )
Misc era-specific INI and combat changes, and other settings-related changes Added new INI settings: SHOWRACEWITHNAME=1 // If enabled, shows a character's race along with their name. Defaults to 1 SHOWITEMRESISTSTATS=0/1 // If enabled, shows item resistance stats in item tooltip. Defaults to 0 SHOWWEAPONDAMAGETYPES=1/0 // If enabled, shows weapon damage types in item tooltip. Defaults to 1 CASTSPELLSWHILEMOVING=0/1 // If enabled, players can cast spells while moving, without having to stop SHOWREPUTATIONTITLEINTOOLTIP=1/0 // If enabled, shows player's reputation title in tooltip. Defaults to 1 SHOWGUILDINFOINTOOLTIP=1/0 // If enabled, shows player's guild info in tooltip. Defaults to 1 Renamed 0xf1_connectUOServerPoll.js to 0xf1_freeshardServerPoll.js, and updated script to respond to the "standard" freeshard server poll request rather than the more specific (and now dead) ConnectUO one. Renamed INI setting CUOENABLED to FREESHARDSERVERPOLL Renamed INI setting CUOENABLED to FREESHARDSERVERPOLL Added new INI settings under [expansion settings] section to help shard admins customize some key behaviours of their shard, based on their preferred "era" of UO. Note that a value of "core" means the setting inherits the chosen era from the CORESHARDERA setting: CORESHARDERA=pub15 Defines the "core" era of the shard. Defaults to pub15 (Publish 15). any - determines which Item/NPC DFNs gets loaded, based on tags like GETT2A, GETPUB15 uor or later - enables bonus hit chance for archery via ARCHERYHITBONUS setting pub15 or earlier - final combat damage value reduced by half ARMORCALCULATION=core Defines era to base armor calculations on pub15 or earlier - different armor pieces contribute different percentage of the total Armor Rating aos or later - each armor piece contribute to sum total of Physical Resistance, and other elemental resistance stats STRENGTHDAMAGEBONUS=core Defines era to base strength damage bonus on uor or earlier - 20% damage bonus based on strength, capped at 200 strength td or later - 35% damage bonus based on strength if 100 strength or more, otherwise 30% damage bonus TACTICSDAMAGEBONUS=core Defines era to base tactics damage bonus on pub15 or earlier - bonus = Tactics skill + 50 aos or later - 68.75% damage bonus if GM Tactics, 62.5% bonus if below ANATOMYDAMAGEBONUS=core Defines era to base anatomy damage bonus on uor or earlier - bonus = Anatomy / 5 vs NPCs, Anatomy / 2.5 vs Players td or later - 30% damage bonus at GM anatomy, up to 20% below GM ml or later - 50% + 5 damage bonus at GM anatomy, up to 50% below GM LUMBERJACKDAMAGEBONUS=core Defines era to base lumberjacking damage bonus on uor or earlier - 35% damage bonus at GM skill, up to 25% below GM td or later - 30% damage bonus at GM skill, up to 20% below GM hs or later - 10% chance of 100% damage bonus RACIALDAMAGEBONUS=core Defines era to base racial damage bonus on sa or later - Gargoyles gain +15% damage bonus per each 20 HP lost DAMAGEBONUSCAP=core Defines era to base damage bonus cap on pub15 or earlier - No cap on damage bonus multiplier aos or later - Total damage bonus multiplier capped at 300% higher than base damage SHIELDPARRY=core Defines era to base shield parry calculations on t2a - chance to block is parryskill / 2. shield absorbs damage equivalent of AR/2 for melee, or equivalent of AR for archery uor to pub15 - higher AR equals lower block chance, but more damage absorbed. aos or later - chance to block dependent on parry skill vs bushido skill, with dex modifier WEAPONPARRY=core Defines era to base weapon parry calculations on aos or later - chance to parry with weapon based on parry skill and bushido skill, with a dex modifier, 16.6% chance weapon will take damage from parrying ml or later - chance to parry with weapon based on parry skill and bushido skill, with a dex modifier, 5% chance weapon will take damage from parrying, or 75% if opponent has mace WRESTLINGPARRY=core Defines era to base wrestling parry calculations on tol or later - From 12.5% chance (at GM wrestling, increases with higher skill) that an NPC will parry an attack COMBATHITCHANCE=core Defines era to base combat hit chance calculations on t2a to pub15 - hit chance based on attacker's skill vs defender's skill. No minimum chance to hit uor to pub15 - Additional bonus hit chance for archery aos to tol - hit chance based on attacker's skill (and hit chance increase) vs defender's skill (and defense chance increase). Minimum 2% chance to hit Supported era values: t2a, uor, td, lbr, pub15, aos, se, ml, sa, hs, tol and core (inherits era defined in CORESHARDERA) Added (optional) new Item/NPC DFN tags to help determine which variants of Items/NPCs to load from DFNs, based on chosen era in CORESHARDERA setting: GETT2A=<sectionID> // Inherit DFN section if core shard era is The Second Age GETTD=<sectionID> // Inherit DFN section if core shard era is Third Dawn GETUOR=<sectionID> // Inherit DFN section if core shard era is UO Renaissance GETLBR=<sectionID> // Inherit DFN section if core shard era is Lord Blackthorn's Revenge GETPUB15=<sectionID> // Inherit DFN section if core shard era is Pub15 GETAOS=<sectionID> // Inherit DFN section if core shard era is Age of Shadows GETSE=<sectionID> // Inherit DFN section if core shard era is Samurai Empire GETML=<sectionID> // Inherit DFN section if core shard era is Mondain's Legacy GETSA=<sectionID> // Inherit DFN section if core shard era is Stygian Abyss GETTOL=<sectionID> // Inherit DFN section if core shard era is Time of Legends
2022-10-20 13:12:47 +08:00
{
if( count == 1 )
Misc era-specific INI and combat changes, and other settings-related changes Added new INI settings: SHOWRACEWITHNAME=1 // If enabled, shows a character's race along with their name. Defaults to 1 SHOWITEMRESISTSTATS=0/1 // If enabled, shows item resistance stats in item tooltip. Defaults to 0 SHOWWEAPONDAMAGETYPES=1/0 // If enabled, shows weapon damage types in item tooltip. Defaults to 1 CASTSPELLSWHILEMOVING=0/1 // If enabled, players can cast spells while moving, without having to stop SHOWREPUTATIONTITLEINTOOLTIP=1/0 // If enabled, shows player's reputation title in tooltip. Defaults to 1 SHOWGUILDINFOINTOOLTIP=1/0 // If enabled, shows player's guild info in tooltip. Defaults to 1 Renamed 0xf1_connectUOServerPoll.js to 0xf1_freeshardServerPoll.js, and updated script to respond to the "standard" freeshard server poll request rather than the more specific (and now dead) ConnectUO one. Renamed INI setting CUOENABLED to FREESHARDSERVERPOLL Renamed INI setting CUOENABLED to FREESHARDSERVERPOLL Added new INI settings under [expansion settings] section to help shard admins customize some key behaviours of their shard, based on their preferred "era" of UO. Note that a value of "core" means the setting inherits the chosen era from the CORESHARDERA setting: CORESHARDERA=pub15 Defines the "core" era of the shard. Defaults to pub15 (Publish 15). any - determines which Item/NPC DFNs gets loaded, based on tags like GETT2A, GETPUB15 uor or later - enables bonus hit chance for archery via ARCHERYHITBONUS setting pub15 or earlier - final combat damage value reduced by half ARMORCALCULATION=core Defines era to base armor calculations on pub15 or earlier - different armor pieces contribute different percentage of the total Armor Rating aos or later - each armor piece contribute to sum total of Physical Resistance, and other elemental resistance stats STRENGTHDAMAGEBONUS=core Defines era to base strength damage bonus on uor or earlier - 20% damage bonus based on strength, capped at 200 strength td or later - 35% damage bonus based on strength if 100 strength or more, otherwise 30% damage bonus TACTICSDAMAGEBONUS=core Defines era to base tactics damage bonus on pub15 or earlier - bonus = Tactics skill + 50 aos or later - 68.75% damage bonus if GM Tactics, 62.5% bonus if below ANATOMYDAMAGEBONUS=core Defines era to base anatomy damage bonus on uor or earlier - bonus = Anatomy / 5 vs NPCs, Anatomy / 2.5 vs Players td or later - 30% damage bonus at GM anatomy, up to 20% below GM ml or later - 50% + 5 damage bonus at GM anatomy, up to 50% below GM LUMBERJACKDAMAGEBONUS=core Defines era to base lumberjacking damage bonus on uor or earlier - 35% damage bonus at GM skill, up to 25% below GM td or later - 30% damage bonus at GM skill, up to 20% below GM hs or later - 10% chance of 100% damage bonus RACIALDAMAGEBONUS=core Defines era to base racial damage bonus on sa or later - Gargoyles gain +15% damage bonus per each 20 HP lost DAMAGEBONUSCAP=core Defines era to base damage bonus cap on pub15 or earlier - No cap on damage bonus multiplier aos or later - Total damage bonus multiplier capped at 300% higher than base damage SHIELDPARRY=core Defines era to base shield parry calculations on t2a - chance to block is parryskill / 2. shield absorbs damage equivalent of AR/2 for melee, or equivalent of AR for archery uor to pub15 - higher AR equals lower block chance, but more damage absorbed. aos or later - chance to block dependent on parry skill vs bushido skill, with dex modifier WEAPONPARRY=core Defines era to base weapon parry calculations on aos or later - chance to parry with weapon based on parry skill and bushido skill, with a dex modifier, 16.6% chance weapon will take damage from parrying ml or later - chance to parry with weapon based on parry skill and bushido skill, with a dex modifier, 5% chance weapon will take damage from parrying, or 75% if opponent has mace WRESTLINGPARRY=core Defines era to base wrestling parry calculations on tol or later - From 12.5% chance (at GM wrestling, increases with higher skill) that an NPC will parry an attack COMBATHITCHANCE=core Defines era to base combat hit chance calculations on t2a to pub15 - hit chance based on attacker's skill vs defender's skill. No minimum chance to hit uor to pub15 - Additional bonus hit chance for archery aos to tol - hit chance based on attacker's skill (and hit chance increase) vs defender's skill (and defense chance increase). Minimum 2% chance to hit Supported era values: t2a, uor, td, lbr, pub15, aos, se, ml, sa, hs, tol and core (inherits era defined in CORESHARDERA) Added (optional) new Item/NPC DFN tags to help determine which variants of Items/NPCs to load from DFNs, based on chosen era in CORESHARDERA setting: GETT2A=<sectionID> // Inherit DFN section if core shard era is The Second Age GETTD=<sectionID> // Inherit DFN section if core shard era is Third Dawn GETUOR=<sectionID> // Inherit DFN section if core shard era is UO Renaissance GETLBR=<sectionID> // Inherit DFN section if core shard era is Lord Blackthorn's Revenge GETPUB15=<sectionID> // Inherit DFN section if core shard era is Pub15 GETAOS=<sectionID> // Inherit DFN section if core shard era is Age of Shadows GETSE=<sectionID> // Inherit DFN section if core shard era is Samurai Empire GETML=<sectionID> // Inherit DFN section if core shard era is Mondain's Legacy GETSA=<sectionID> // Inherit DFN section if core shard era is Stygian Abyss GETTOL=<sectionID> // Inherit DFN section if core shard era is Time of Legends
2022-10-20 13:12:47 +08:00
{
result = oldstrutil::trim( oldstrutil::removeTrailing( sec, "//" ));
Misc era-specific INI and combat changes, and other settings-related changes Added new INI settings: SHOWRACEWITHNAME=1 // If enabled, shows a character's race along with their name. Defaults to 1 SHOWITEMRESISTSTATS=0/1 // If enabled, shows item resistance stats in item tooltip. Defaults to 0 SHOWWEAPONDAMAGETYPES=1/0 // If enabled, shows weapon damage types in item tooltip. Defaults to 1 CASTSPELLSWHILEMOVING=0/1 // If enabled, players can cast spells while moving, without having to stop SHOWREPUTATIONTITLEINTOOLTIP=1/0 // If enabled, shows player's reputation title in tooltip. Defaults to 1 SHOWGUILDINFOINTOOLTIP=1/0 // If enabled, shows player's guild info in tooltip. Defaults to 1 Renamed 0xf1_connectUOServerPoll.js to 0xf1_freeshardServerPoll.js, and updated script to respond to the "standard" freeshard server poll request rather than the more specific (and now dead) ConnectUO one. Renamed INI setting CUOENABLED to FREESHARDSERVERPOLL Renamed INI setting CUOENABLED to FREESHARDSERVERPOLL Added new INI settings under [expansion settings] section to help shard admins customize some key behaviours of their shard, based on their preferred "era" of UO. Note that a value of "core" means the setting inherits the chosen era from the CORESHARDERA setting: CORESHARDERA=pub15 Defines the "core" era of the shard. Defaults to pub15 (Publish 15). any - determines which Item/NPC DFNs gets loaded, based on tags like GETT2A, GETPUB15 uor or later - enables bonus hit chance for archery via ARCHERYHITBONUS setting pub15 or earlier - final combat damage value reduced by half ARMORCALCULATION=core Defines era to base armor calculations on pub15 or earlier - different armor pieces contribute different percentage of the total Armor Rating aos or later - each armor piece contribute to sum total of Physical Resistance, and other elemental resistance stats STRENGTHDAMAGEBONUS=core Defines era to base strength damage bonus on uor or earlier - 20% damage bonus based on strength, capped at 200 strength td or later - 35% damage bonus based on strength if 100 strength or more, otherwise 30% damage bonus TACTICSDAMAGEBONUS=core Defines era to base tactics damage bonus on pub15 or earlier - bonus = Tactics skill + 50 aos or later - 68.75% damage bonus if GM Tactics, 62.5% bonus if below ANATOMYDAMAGEBONUS=core Defines era to base anatomy damage bonus on uor or earlier - bonus = Anatomy / 5 vs NPCs, Anatomy / 2.5 vs Players td or later - 30% damage bonus at GM anatomy, up to 20% below GM ml or later - 50% + 5 damage bonus at GM anatomy, up to 50% below GM LUMBERJACKDAMAGEBONUS=core Defines era to base lumberjacking damage bonus on uor or earlier - 35% damage bonus at GM skill, up to 25% below GM td or later - 30% damage bonus at GM skill, up to 20% below GM hs or later - 10% chance of 100% damage bonus RACIALDAMAGEBONUS=core Defines era to base racial damage bonus on sa or later - Gargoyles gain +15% damage bonus per each 20 HP lost DAMAGEBONUSCAP=core Defines era to base damage bonus cap on pub15 or earlier - No cap on damage bonus multiplier aos or later - Total damage bonus multiplier capped at 300% higher than base damage SHIELDPARRY=core Defines era to base shield parry calculations on t2a - chance to block is parryskill / 2. shield absorbs damage equivalent of AR/2 for melee, or equivalent of AR for archery uor to pub15 - higher AR equals lower block chance, but more damage absorbed. aos or later - chance to block dependent on parry skill vs bushido skill, with dex modifier WEAPONPARRY=core Defines era to base weapon parry calculations on aos or later - chance to parry with weapon based on parry skill and bushido skill, with a dex modifier, 16.6% chance weapon will take damage from parrying ml or later - chance to parry with weapon based on parry skill and bushido skill, with a dex modifier, 5% chance weapon will take damage from parrying, or 75% if opponent has mace WRESTLINGPARRY=core Defines era to base wrestling parry calculations on tol or later - From 12.5% chance (at GM wrestling, increases with higher skill) that an NPC will parry an attack COMBATHITCHANCE=core Defines era to base combat hit chance calculations on t2a to pub15 - hit chance based on attacker's skill vs defender's skill. No minimum chance to hit uor to pub15 - Additional bonus hit chance for archery aos to tol - hit chance based on attacker's skill (and hit chance increase) vs defender's skill (and defense chance increase). Minimum 2% chance to hit Supported era values: t2a, uor, td, lbr, pub15, aos, se, ml, sa, hs, tol and core (inherits era defined in CORESHARDERA) Added (optional) new Item/NPC DFN tags to help determine which variants of Items/NPCs to load from DFNs, based on chosen era in CORESHARDERA setting: GETT2A=<sectionID> // Inherit DFN section if core shard era is The Second Age GETTD=<sectionID> // Inherit DFN section if core shard era is Third Dawn GETUOR=<sectionID> // Inherit DFN section if core shard era is UO Renaissance GETLBR=<sectionID> // Inherit DFN section if core shard era is Lord Blackthorn's Revenge GETPUB15=<sectionID> // Inherit DFN section if core shard era is Pub15 GETAOS=<sectionID> // Inherit DFN section if core shard era is Age of Shadows GETSE=<sectionID> // Inherit DFN section if core shard era is Samurai Empire GETML=<sectionID> // Inherit DFN section if core shard era is Mondain's Legacy GETSA=<sectionID> // Inherit DFN section if core shard era is Stygian Abyss GETTOL=<sectionID> // Inherit DFN section if core shard era is Time of Legends
2022-10-20 13:12:47 +08:00
}
}
count++;
}
customTagName = oldstrutil::trim( oldstrutil::removeTrailing( ssecs[0], "//" ));
customTagStringValue = result;
if( !customTagName.empty() && !customTagStringValue.empty() )
{
customTag.m_Destroy = false;
customTag.m_IntValue = static_cast<SI32>( std::stoi( customTagStringValue, nullptr, 0 ));
customTag.m_ObjectType = TAGMAP_TYPE_INT;
customTag.m_StringValue = "";
applyTo->SetTag( customTagName, customTag );
if( count > 2 )
UOX3 0.99.5b-6 Increased world load speed by almost 20% by reducing how often loading progress is written to the console Increased world save speed by almost 50% through the use of binary mode and buffer tweaks for ofstream combined with a cached newline char and std::to_string instead of static_cast Fixed a server crash involving killing NPCs of a specific spawn region using the 'spawnkill # command Fixed a server crash involving moving items from decaying corpses to the ground Fixed a server crash involving carving up human corpses Fixed a server crash related to AreaCharacterFunction JS function, which could trigger for any script that potentially kills any NPC this function iterates over (like explosion potions) Fixed a server crash related to GMs attempting to add items from add-menu while having no backpack Fixed a client crash issue caused by attempting to sell house deeds back to architect NPCs Fixed an issue where players would get incorrect amounts of gold for selling house deeds back to architect NPCs Fixed an issue with characters dying onboard boats which prevented players from packing up the boats later Added new item property in code (via bools bitset) that can be used to enable/disable maker's mark on crafted items. This property can be set to true for items crafted at exceptional quality by GM craftsmen Exposed the new item property to JS engine: .isMarkedByMaker // If true, maker's mark will be displayed Updated default item tooltip to display " of exceptional quality" for items crafted with exceptional quality Updated default item tooltip to display "[Crafted] by [Crafter's Name]" for exceptional quality items crafted by GM craftsmen. The [Crafted] text comes from the MADEWORD defined in dfndata/skills/skills.dfn for the primary skill used to craft the item Updated old-school single-click names for items (when AoS bit is disabled in client/server features) to display exceptional status and/or maker's mark for appropriate items Fixed an issue with the display of titles for NPCs that used dictionary lookups for their title Added new UOX.INI settings under the [settings] section: DISPLAYMAKERSMARK=1/0 // Controls if maker's marks on crafted items are shown on a global level SHOWNPCTITLESOVERHEAD=1/0 // Controls whether NPC titles are shown over their heads SHOWINVULNERABLETAGOVERHEAD=0/1 // Controls whether invulnerable tags are shown overhead GLOBALRESTOCKMULTIPLIER=1.0 // Global multiplier applied to RESTOCK property of items when loaded from DFNs Added new UOX.INI settings under the [combat] section: PETCOMBATTRAINING=1/0 // Controls whether pets can gain skills/stats from combat HIRELINGCOMBATTRAINING=1/0 // Controls whether hirelings can gain skills/stats from combat NPCCOMBATTRAINING=0/1 // Controls whether NPCs in general can gain skills/stats from combat Fixed an issue where a player meeting the exact minimum requirements for crafting an item would always fail Fixed a bug with teleporting off boats to valid nearby locations when double-clicking boat planks while standing on it Updated behaviour of planks on boats: Boat key can unlock plank, but won't automatically open it Boat key used on an open, unlocked plank will lock and automatically close the plank Boat key used on an open, locked plank will unlock the plank and leave it open Player using an unlocked plank now opens it Player using an open plank will disembark (if onboard) or embark (if not) the boat Player can always open a locked plank if they're on the boat, even with no key, to allow disembarking the boat. Planks that are open, but locked cannot be accessed from outside the boat, and will close automatically after five of seconds Updated behaviour of Magic Lock/Unlock spells: Magic Lock cannot be used on objects inside a multi Magic Lock applies difficulty to lock based on caster's Magery skill Magic Lock effect will last between 7 to 50 seconds (depending on caster's Magery skill) Any object that can be locked via Magic Lock spell can also be unlocked via Magic Unlock spell, if caster has high enough Magery skill Fixed a bug where certain JS Functions, Methods and Properties would occasionally pass incorrect values to scripts that called upon them. Scripts that rely on the GetCurrentClock() Function, the .GetTimer() Method, .decayTime, .logTime, .oreTime and .fishTime Properties might need to be updated to account for the fix, which causes larger values to be passed in than before. Fixed a bug related to GetCurrentClock() that caused decay and respawning of dungeon chests from working properly Fixed a bug related to GetCurrentClock() and .logTime/.fishTime that prevented consumption and regeneration of log/fish resources from working properly Added a new JS Function: GetStartTime() // Returns a timestamp for when server started up Fixed a bug related to GetCurrentClock() where server uptime stats in help menu was showing up incorrectly Fixed a bug related to GetCurrentClock() and purging of registrations of visitors in public houses so their visits can be counted again later Fixed a bug related to GetCurrentClock() that caused monster speech to not work properly Fixed a Z-related issue that sometimes prevented players from fishing when standing on the shoreline next to the sea Fixed an issue with Animal Lore skill that would always return a pet's loyalty level as "Wild" Increased max range pets can be from their owner in order to still be included in moongate/teleporter travel from 12 to 24 tiles Fixed an issue where the alchemy bonus damage for explosion potions was off by an order of magnitude Fixed an issue where food IDs from foodlists referenced by other foodlists was not detected as valid food for tamed pets or NPCs Fixed an issue where Alchemy crafting skill did not properly check for the existence of the crafting tool before proceeding with the crafting process Fixed an issue that prevented the Teleport spell from working as intended Fixed an issue where players would still get 1 gold even if STARTGOLD in uox.ini was set to 0 Fixed an issue with mount restrictions script that prevented players from mounting Unicorns, Ki-rins and Cu Sidhes Fixed an issue where aggressive creatures wouldn't stop attacking player after being tamed (js/skill/taming.js) Added a system message to inform the player when they've dropped out of stealth due to taking too many steps Fixed an issue where hunger level of NPCs instantly dropped upon spawning because hunger timer was not active yet Fixed a bug where character corpses would appear with a [unidentified] tag attached Fixed an issue where the [unidentified] tag did not show up for unidentified magic items Added ANIMAL tag to a small bunch of creature definitions (dfndata/creatures/creatures.dfn) Fixed an issue with Bowcraft skill where player could not gain enough skill from crafting bows to reach min requirement for crossbows, and similiarly could not reach min requirement for heavy crossbows from crossbows Updated default value of MURDERDECAYTIMER INI setting from 60 seconds to 28800 seconds (8 hours), to match the amount of time it would take for one (short term) murder count to decay on LBR-era OSI shards.
2022-08-25 02:13:00 +08:00
{
Console.Warning( oldstrutil::format( "Multiple values detected for CUSTOMINTTAG in Item script [%s] - only first value will be used! Supported data format: <tagName> <value>", sectionId.c_str() ));
UOX3 0.99.5b-6 Increased world load speed by almost 20% by reducing how often loading progress is written to the console Increased world save speed by almost 50% through the use of binary mode and buffer tweaks for ofstream combined with a cached newline char and std::to_string instead of static_cast Fixed a server crash involving killing NPCs of a specific spawn region using the 'spawnkill # command Fixed a server crash involving moving items from decaying corpses to the ground Fixed a server crash involving carving up human corpses Fixed a server crash related to AreaCharacterFunction JS function, which could trigger for any script that potentially kills any NPC this function iterates over (like explosion potions) Fixed a server crash related to GMs attempting to add items from add-menu while having no backpack Fixed a client crash issue caused by attempting to sell house deeds back to architect NPCs Fixed an issue where players would get incorrect amounts of gold for selling house deeds back to architect NPCs Fixed an issue with characters dying onboard boats which prevented players from packing up the boats later Added new item property in code (via bools bitset) that can be used to enable/disable maker's mark on crafted items. This property can be set to true for items crafted at exceptional quality by GM craftsmen Exposed the new item property to JS engine: .isMarkedByMaker // If true, maker's mark will be displayed Updated default item tooltip to display " of exceptional quality" for items crafted with exceptional quality Updated default item tooltip to display "[Crafted] by [Crafter's Name]" for exceptional quality items crafted by GM craftsmen. The [Crafted] text comes from the MADEWORD defined in dfndata/skills/skills.dfn for the primary skill used to craft the item Updated old-school single-click names for items (when AoS bit is disabled in client/server features) to display exceptional status and/or maker's mark for appropriate items Fixed an issue with the display of titles for NPCs that used dictionary lookups for their title Added new UOX.INI settings under the [settings] section: DISPLAYMAKERSMARK=1/0 // Controls if maker's marks on crafted items are shown on a global level SHOWNPCTITLESOVERHEAD=1/0 // Controls whether NPC titles are shown over their heads SHOWINVULNERABLETAGOVERHEAD=0/1 // Controls whether invulnerable tags are shown overhead GLOBALRESTOCKMULTIPLIER=1.0 // Global multiplier applied to RESTOCK property of items when loaded from DFNs Added new UOX.INI settings under the [combat] section: PETCOMBATTRAINING=1/0 // Controls whether pets can gain skills/stats from combat HIRELINGCOMBATTRAINING=1/0 // Controls whether hirelings can gain skills/stats from combat NPCCOMBATTRAINING=0/1 // Controls whether NPCs in general can gain skills/stats from combat Fixed an issue where a player meeting the exact minimum requirements for crafting an item would always fail Fixed a bug with teleporting off boats to valid nearby locations when double-clicking boat planks while standing on it Updated behaviour of planks on boats: Boat key can unlock plank, but won't automatically open it Boat key used on an open, unlocked plank will lock and automatically close the plank Boat key used on an open, locked plank will unlock the plank and leave it open Player using an unlocked plank now opens it Player using an open plank will disembark (if onboard) or embark (if not) the boat Player can always open a locked plank if they're on the boat, even with no key, to allow disembarking the boat. Planks that are open, but locked cannot be accessed from outside the boat, and will close automatically after five of seconds Updated behaviour of Magic Lock/Unlock spells: Magic Lock cannot be used on objects inside a multi Magic Lock applies difficulty to lock based on caster's Magery skill Magic Lock effect will last between 7 to 50 seconds (depending on caster's Magery skill) Any object that can be locked via Magic Lock spell can also be unlocked via Magic Unlock spell, if caster has high enough Magery skill Fixed a bug where certain JS Functions, Methods and Properties would occasionally pass incorrect values to scripts that called upon them. Scripts that rely on the GetCurrentClock() Function, the .GetTimer() Method, .decayTime, .logTime, .oreTime and .fishTime Properties might need to be updated to account for the fix, which causes larger values to be passed in than before. Fixed a bug related to GetCurrentClock() that caused decay and respawning of dungeon chests from working properly Fixed a bug related to GetCurrentClock() and .logTime/.fishTime that prevented consumption and regeneration of log/fish resources from working properly Added a new JS Function: GetStartTime() // Returns a timestamp for when server started up Fixed a bug related to GetCurrentClock() where server uptime stats in help menu was showing up incorrectly Fixed a bug related to GetCurrentClock() and purging of registrations of visitors in public houses so their visits can be counted again later Fixed a bug related to GetCurrentClock() that caused monster speech to not work properly Fixed a Z-related issue that sometimes prevented players from fishing when standing on the shoreline next to the sea Fixed an issue with Animal Lore skill that would always return a pet's loyalty level as "Wild" Increased max range pets can be from their owner in order to still be included in moongate/teleporter travel from 12 to 24 tiles Fixed an issue where the alchemy bonus damage for explosion potions was off by an order of magnitude Fixed an issue where food IDs from foodlists referenced by other foodlists was not detected as valid food for tamed pets or NPCs Fixed an issue where Alchemy crafting skill did not properly check for the existence of the crafting tool before proceeding with the crafting process Fixed an issue that prevented the Teleport spell from working as intended Fixed an issue where players would still get 1 gold even if STARTGOLD in uox.ini was set to 0 Fixed an issue with mount restrictions script that prevented players from mounting Unicorns, Ki-rins and Cu Sidhes Fixed an issue where aggressive creatures wouldn't stop attacking player after being tamed (js/skill/taming.js) Added a system message to inform the player when they've dropped out of stealth due to taking too many steps Fixed an issue where hunger level of NPCs instantly dropped upon spawning because hunger timer was not active yet Fixed a bug where character corpses would appear with a [unidentified] tag attached Fixed an issue where the [unidentified] tag did not show up for unidentified magic items Added ANIMAL tag to a small bunch of creature definitions (dfndata/creatures/creatures.dfn) Fixed an issue with Bowcraft skill where player could not gain enough skill from crafting bows to reach min requirement for crossbows, and similiarly could not reach min requirement for heavy crossbows from crossbows Updated default value of MURDERDECAYTIMER INI setting from 60 seconds to 28800 seconds (8 hours), to match the amount of time it would take for one (short term) murder count to decay on LBR-era OSI shards.
2022-08-25 02:13:00 +08:00
}
}
else
{
Console.Warning( oldstrutil::format( "Invalid data found in CUSTOMINTTAG tag in Item script [%s] - Supported data format: <tagName> <value>", sectionId.c_str() ));
}
break;
}
case DFNTAG_SPAWNOBJ:
case DFNTAG_SPAWNOBJLIST:
break;
case DFNTAG_LOOT:
[[fallthrough]];
case DFNTAG_PACKITEM:
{
if( !cdata.empty() )
{
auto csecs = oldstrutil::sections( oldstrutil::trim( oldstrutil::removeTrailing( cdata, "//" )), "," );
if( csecs.size() > 1 )
{
UI16 iAmount = 0;
std::string amountData = oldstrutil::trim( oldstrutil::removeTrailing( csecs[1], "//" ));
auto tsects = oldstrutil::sections( amountData, " " );
if( tsects.size() > 1 ) // check if the second part of the tag-data contains two sections separated by a space
{
auto first = static_cast<UI16>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( tsects[0], "//" )), nullptr, 0 ));
auto second = static_cast<UI16>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( tsects[1], "//" )), nullptr, 0 ));
// Tag contained a minimum and maximum value for amount! Let's randomize!
iAmount = static_cast<UI16>( RandomNum( first, second ));
2022-06-09 11:41:07 -04:00
}
else
{
iAmount = static_cast<UI16>( std::stoul( amountData, nullptr, 0 ));
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
}
auto tdata = oldstrutil::trim( oldstrutil::removeTrailing( csecs[0], "//" ));
if( tag == DFNTAG_LOOT )
{
Items->AddRespawnItem( applyTo, tdata, true, true, iAmount, true );
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
}
else
{
Items->AddRespawnItem( applyTo, tdata, true, false, iAmount, false );
2022-06-09 11:41:07 -04:00
}
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
}
else
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
{
if( tag == DFNTAG_LOOT )
{
Items->AddRespawnItem( applyTo, cdata, true, true, 1, true );
}
else
{
Items->AddRespawnItem( applyTo, cdata, true, false, 1, false );
2022-06-09 11:41:07 -04:00
}
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
}
}
break;
}
default:
{
Console.Warning( oldstrutil::format( "Unknown items dfn tag %i %s %i %i ", tag, cdata.c_str(), ndata, odata ));
break;
}
}
}
return true;
}
//o------------------------------------------------------------------------------------------------o
//| Function - cItem::CreateItem()
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 - 10/12/2003
//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 - Creates a basic item and gives it an ID, Colour, and amount, also will
//| automatically look for an entry in harditems.dfn and set its location (be it in
//| a pack or on the ground).
//o------------------------------------------------------------------------------------------------o
CItem * cItem::CreateItem( CSocket *mSock, CChar *mChar, const UI16 itemId, const UI16 iAmount, const UI16 iColour,
const ObjectType itemType, bool inPack, bool shouldSave, UI08 worldNumber, UI16 instanceId, SI16 xLoc, SI16 yLoc, SI08 zLoc )
{
if( ValidateObject( mChar ))
Housing Revamp and more Updated JS SysMessage function to accept up to 10 extra, optional arguments, which can be used with dictionary messages that require additional parameters like %s or %i Added new type of house privilege in cMultiObj.cpp to keep track of friends of the multi - HOUSEPRIV_FRIEND - which is stored during worldsaves as one or more Friend=<player serial> tags in house.wsc Added new type of house privilege in cMultiObj.cpp to keep track of guests of the multi - HOUSEPRIV_GUEST - which is stored during worldsaves as one or more Guest=<player serial> tags in house.wsc When items are created for houses upon house placement, a reference to the multi's serial is now stored in the house sign's MORE property to allow easier tracking of which house a particular sign belongs to Added tracking of new, persistent properties for houses via cMultiObj.cpp/h: lockdowns, secure containers, vendors, guests, friends, owners, ban location, public status, number of visits, timestamps Added a multitude of new methods in cMultiObj.cpp/h to assist in improving the functionality of houses Added new tags for houses in house.dfn (default values applied if tag not specified): MAXSECURECONTAINERS=4 - Max amount of secure containers allowed in a multi MAXLOCKDOWNS=256 - Max amount of lockdowns allowed in a multi MAXVENDORS=10 - Max amount of vendors allowed in a multi MAXBANS=50 - Max amount of bans in a multi's ban list MAXFRIENDS=50 - Max amount of friends in a multi's friend list MAXGUESTS=50 - Max amount of guests in a multi's guest list MAXOWNERS=8 - Max amount of owners and co-owners in a multi's owner list MAXTRASHCONTAINERS=1 - Max amount of trash containers allowed in multi SCRIPT=<scriptID> - Assign a JS script-ID directly to a multi FRONTDOOR - indicates that a door is the front door of a house. Cannot be locked in public houses! INTERIORDOOR - indicates that a door is an interior door of a house. Can be locked in public houses. BANX - Location X offset for multi's ban location, if not used, will try to use SE corner of multi instead BANY - Location Y offset for multi's ban location, if not used, will try to use SE corner of multi instead Added JS Event: onHouseCommand( tSock, multiObj, cmdID ) - For handling spoken house commands via JS scripts attached to multi. Updated JS Events: onEntrance() - can now trigger both for multi being entered and/or object entering onLeaving() - can now trigger both for multi being left and/or object entering onSpeech() - can now also trigger for items (in addition to chars) with event & script attached, if UOX.INI setting ITEMSDETECTSPEECH is enabled Added JS Multi methods: .IsBoat() - Returns whether the item (or multi) is a boat .IsOwner( playerToCheck ) - Returns whether a player is the owner of a multi .IsOnOwnerList( playerToCheck ) - Returns whether a player is on the (co-)owner list of a multi .IsOnFriendList( playerToCheck ) - Returns whether a player is on the friend list of a multi .IsOnGuestList( playerToCheck ) - Returns whether a player is on the guest list of a multi .IsOnBanList( playerToCheck ) - Returns whether a player is on the ban list of a multi .AddToFriendList( playertoAdd ) - Adds player to the friend list of a multi .RemoveFromFriendList( playertoRemove ) - Removes player from the friend list of a multi .AddToGuestList( playertoAdd ) - Adds player to the guest list of a multi .RemoveFromGuestList( playertoRemove ) - Removes player from the guest list of a multi .ClearOwnerList() - Clears all entries from a multi's (co-)owner list .ClearFriendList() - Clears all entries from a multi's friend list .ClearGuestList() - Clears all entries from a multi's guest list .ClearBanList() - Clears all entries from a multi's ban list .SecureContainer( itemToSecure ) - Secures a container in a multi .UnsecureContainer( itemToUnsecure ) - Unsecures a container in a multi .IsSecureContainer( itemToCheck ) - Checks if specified item is a secure container in a multi .LockDownItem( itemToLockDown) - Locks down an item in a multi .ReleaseItem( itemToRelease ) - Releases a locked down item in a multi .KillKeys() - Deletes ALL keys associated with a multi .AddTrashCont( itemToAdd ) - Add trash container to multi's list of trash containers .RemoveTrashCont( itemToRemove ) - Remove trash container from multi's list of trash containers Added JS Item (Multi only) properties: .lockdowns - Get the number of lockdowns in a multi .maxLockdowns - Get/Set the max number of lockdowns allowed in a multi .secureContainers - Get the number of secure containers in a multi .maxSecureContainers - Get/Set the max number of secure containers allowed in a multi .trashContainers - Get the number of trash containers in a multi .maxTrashContainers - Get/Set the max number of trash containers allowed in a multi .friends - Get the number of friends in a multi's friend list .maxFriends - Get/Set the max number of friends allowed in a multi's friend list .guests - Get the number of guests in a multi's guest list .maxGuests - Get/Set the max number of guests allowed in a multi's guest list .owners - Get the number of owners in a multi's owner list .maxOwners - Get/Set the max number of owners allowed in a multi's owner list .bans - Get the number of banned players in a multi's ban list .maxBans - Get/Set the max number of banned players allowed in a multi's ban list .vendors - Get the number of player vendors in a multi .maxVendors - Get the max number of player vendors allowed in a multi .deed - Get the item sectionID for deed used to place multi .isPublic - Get/Set the private/public state of a multi .buildTimestamp - Get the timestamp for when the house was originally placed .tradeTimestamp - Get the timestamp for when the house was last traded to another player .banX - Get/Set the ban location X offset for the multi .banY - Get/Set the ban location Y offset for the multi Added JS Character properties: .multi = Get/Set the multi object the character is in .accountNum = Get the account number the character belongs to .housesOwned = Get a count of houses owned by the character .housesCoOwned = Get a count of houses co-owned by the character Updated JS cBaseObject Methods .FirstItem(), .NextItem() and .FinishedItems() to also support iterating through items in multis Updated JS multi Methods .FirstChar(), .NextChar() and .FinishedChars() to support an additional parameter to specify what kind of characters to loop through: "default" or no parameter - all characters inside the multi "owner" - players on multi's owner list "friend" - players on multi's friend list "guest" - players on multi's guest list "banned" - players on multi's ban list Added new INI tags to a new section of uox.ini called [houses] DECAYTIMERINHOUSE=3600 // Decay timer in seconds for non-locked down items inside houses PROTECTPRIVATEHOUSES=1 // Toggles whether private houses will automatically boot unauthorized visitors (1) or not (0) TRACKHOUSESPERACCOUNT=1 // Toggles whether to track (and restrict) house ownership per account (1) or per character (0) MAXHOUSESOWNABLE=1 // Specifies the max amount of houses a player can own per account/char, depending on how house ownership is tracked MAXHOUSESCOOWNABLE=10 // Specifies the max amount of houses a player can co-own per character CANOWNANDCOOWNHOUSES=1 // Toggles whether players can own and co-own houses at the same time COOWNHOUSESONSAMEACCOUNT=1 // Toggles whether characters on same account as house owner will be treated as co-owners Added new INI tags in [settings] section of uox.ini: ITEMSDETECTSPEECH=0 // If enabled, server will search for nearby items with onSpeech JS event running whenever a character speaks. Disabled by default. MAXPLAYERPACKITEMS=125 // Defines max item capacity for player (and NPC) backpacks. Defaults to 125. Moved most of the existing house functionality to JS and expanded upon it to reach feature parity with houses in regular UO around Publish 15/16, with various extras thrown in for good measure and all functionality being customizable: js/server/house/house.js (15000) - handles detection of house commands and characters entering/leaving houses js/server/house/houseSign.js (15001) - contains and handles all house-related gumps/menus and what is shown when players interact with house sign js/server/house/houseCommands.js (15002) - handles functionality of house commands and other functionality such as transfer of ownership, demolishing house, etc. js/server/house/houseDeed.js (15003) - handles initial rules that allow/disallow placement of additional houses for players All house-related menus now fully handled through JS All house commands and other functionality now fully handled through JS Removed redundant hard-coded house functionality Implemented Co-owners, friends, guests for houses, with access rules in place for entry, lockdowns, house commands, etc. Implemented Private and Public houses Implemented Secure Containers and Trash Barrels Definable max lockdowns, secure containers, player vendors, bans, friends, guests, owners, trash containers and more - per house type JS scripts can now be attached directly to houses Doors in houses can be marked as front doors or interior doors, and will be treated differently with regards to private and public houses Added new item to dfndata/items/containers/misc.dfn - [trashbarrel] Added new JS script (js/items/trashbarrel.js) with trash barrel functionality for houses. Trash barrels that are marked as secure containers are only accessible by owners, co-owners and friends of the house. Various options available at top of script. Updated js/items/axe.js to support chopping up trash barrels and house add-ons in houses owned by the player Fixed an issue with house doors being left behind after demolishing houses while their doors were open Fixed an issue where GMs could be banned from player houses Added Line of Sight checks to speech, to give players some privacy in their own homes Updated house placement code to more accurately check for other multis, dynamic and static objects when placing houses; now requires free space around each house that cannot be blocked by other houses or items that can block player movement, and disallows placement of houses on roads Updated house placement code to move characters blocking house placement to SE corner of the house Updated house placement code to disallow placing houses in guarded regions, or in dungeons Added new DFN tag for regions to enable/disable player houses in specific regions: HOUSING=0/1 Added new region (247) that covers path to Valley of Eodon in Felucca Added new region (248) that covers Valley of Eodon in Ter-Mur, with player housing disabled Added new region (249) that covers entire T2A lands, with player housing disabled Updated SPACEX and SPACEY values for all houses in dfndata/house/house.dfn to match updated house placement code Added new JS property to Regions that can be used to determine or change state of player housing in a region: .canPlaceHouse() Updated rules for usage of dye tubs to dye locked down items; now only house owners or co-owners may dye locked down items Updated rules for usage of the following locked down items in a house, which are now only usable by house owners and co-owners Dyes, Guildstone Deeds, Recall Runes (renaming), Rename Deeds, Townstone Deeds, House Deeds, Boat Models, Player Vendor Deeds, Ore, Hair Dye Updated rules for usage of the following locked down items in a house, which are now only usable by house owners, co-owners and friends: Keys, Dye Tubs, Magic Scrolls, Fireworks Wands, Magic Wands, Smithing Tools, Mining Tools, Fishing Poles Updated item lockdown rules to allow locking down (and releasing) items in a container as long as the container is locked down, and to only allow releasing a locked down container if it's empty of locked down items Updated item lockdown rules to only allow locking down movement-blocking items further than 2 tiles away from doors Updated rules for releasing items in houses - now the house owner can release any locked down items, co-owners can release items locked down by themselves or by friends, while friends can release only items locked down by themselves Added some feedback to player about why their attempted house placement failed Items added by GMs directly into multis will now decay based on the house-specific decay timer instead of the regular one Fixed an issue that could cause items to almost instantly decay after being released from lockdown in a house Placing house add-ons now properly takes into account SPACEX and SPACEY values when checking if they can fit in selected area of houses Re-added SPACEX and SPACEY values for Pentagram and Loom house add-ons House add-ons can now be converted back into house add-on deeds by chopping them with an axe Added new item type - IT_HOUSEADDON (201) - used by house add-ons placed in player houses Fixed a bug where keys would stop working after being added to a keyring, and would turn into blank keys upon release from the keyring Added visitor count for public player houses, which keeps track of how many visits a public house has received, with each player counted max 1 time every 24 hours Fixed an issue with FindPlayersInOldVisrange() where it didn't take into account that players could see buildings further away than the standard update range. This could cause players to see ghost images of buildings if they were at the "right" distance when the building was being demolished Added NODECAY tag to all signs and doors in dfndata/house/house.dfn Added FRONTDOOR or INTERIORDOOR (as appropriate) to all doors in dfndata/house/house.dfn Added BANX and BANY to specify ban location for some houses in dfndata/house/house.dfn instead of relying on finding SE corner automatically Implemented strongboxes (js/server/house/strongbox.js) for co-owners of a house, which can be placed with the house command "i wish to place a strongbox". Max capacity is 25 items Updated 'REMOVE command to take an optional parameter - itemID. If supplied, the command will remove all items with this itemID from a targeted container Fixed a bug when checking if dynamic items were blocking valid spawn locations for NPCs, some function arguments were in the wrong order! Improved code that finds valid spawn locations for items and NPCs spawned via spawn regions. As server gradually builds up lists of valid spawn locations per region over time, it will start using these lists more often, rather than always look for brand new spawn locations. Fixed a bug with CMulHandler::CheckStaticFlag() that prevented NPCs from spawning inside buildings with no static floors! Fixed an issue with repeating commands that prevented GMs from being able to cancel them when using the ClassicUO client Exposed character property .accountNum to JS engine Extended CDataList class to include a Clear() method for clearing lists Updated JS File method .Open() to support an optional, third argument - subFolderName - that defines in which sub-folder of UOX3/shared/ to store/look for a file. If no third argument is supplied, UOX3 will default to using the shared folder itself. Updated JS File method .Length() to return a value of -1 for files that don't exist Added new code function, exposed to JS engine with same parameters, which simply checks if a given tile ID has a specific flag bool CheckTileFlag( UI16 itemID, TILEFLAG flagToCheck ) Added JS function used to find the root container of an item (if any) FindRootContainer( itemSerial ) FindRootContainer( item ) Added new JS function that allows deleting files from UOX3/shared/ folder or subfolders of shared folder. If no subFolderName is provided, looks for file directly in shared folder itself. Restrictions on file- and folder-names apply. bool DeleteFile( fileName, subFolderName ) Added new JS functions for checking if a specific client or server feature is enabled. See documentation for full list of client/server features. GetClientFeature( bitNum ) // Returns true if specified client feature is enabled on server GetServerFeature( bitNum ) // Returns true if specified server feature is enabled on server Added new JS function for returning the value of almost any server setting from UOX.INI GetServerSetting( settingNameInDoubleQuotes ) Updated JS function DoesDynamicBlock() with two new parameters - checkOnlyMultis and checkOnlyNonMultis Updated JS function DoesMapBlock() with two new parameters - checkMultiPlacement and checkForRoad Fixed an issue where a LoS check would prevent players from accessing containers in their own backpack Added new functions in findfuncs.cpp to make it easier to find items near another object or location: findNearbyItems( object, distance ) findNearbyItems( x, y, worldNumber, instanceID, distance ) Added new Item property - maxItems - used by containers to determine their max item capacity Added new Item property - totalItemCount - used to get total item count in a container (including sub-containers) Added check for max item capacity when creating new items that are added to a character's backpack - items will be created below character's feet if backpack is full! Added new DFN tag for items, used by containers to determine item capacity for a given container: MAXITEMS=# // 125 is the default for all containers if not set Added new JS Item properties: .maxItems // gets/sets item capacity for a given container .totalItemCount // gets total item count in a container, including sub-containers Updated item tooltips for containers to show accurate total item count, as well as to display max item capacity Fixed a bug where picking up items from a non-locked down pile of items on the floor inside a multi could cause the remaining pile to be seen as no longer inside the multi, disallowing locking it back down and causing it to decay based on regular decay timer instead of house-specific one Updated JS command set to allow setting poison-level on items ('set poison #) and hunger-level on characters ('set hunger #) Fixed an issue with js/item/food.js that prevented poisoned food from poisoning characters when eaten Fixed an issue with js/skill/poisoning.js that prevented players from poisoning food! Updated various JS scripts and hardcoded targeting functions to disallow the targeting of locked down resources using skills and tools Updated JS Method TextMessage() to support three extra, optional parameters. Note that if one optional parameter is included, all preceding optional parameters are also required! speechTarget - What kind of target is this message intended for? 0 - Only visible for sender and receiver of message 1 - Visible to all players in range 2 - Visible to all NPCs and players in range 3 - Visible to all PCs everywhere + NPCs in range 4 - Visible to all PCs everywhere (broadcast) 5 - Only visible for the receiver of the message speechTargetSerial - The serial of the receiver of the message, used if speechTarget is 0 or 5 speechFontType - The type of font to display the text in. Defaults to normal. 0 - Bold 1 - Normal with shadow 2 - Bold with shadow 3 - Normal 4 - Gothic 5 - Italic 6 - Small, dark 7 - Colourful 8 - Runic (only works with CAPS) 9 - Small, light Added timestamp to worldsaves in console, to make it easier to see when a particular world-save was done Added info about compiler/environment displayed at the top of the UOX3 console during startup Updated dictionary files with new messages primarily related to housing
2020-11-04 02:00:37 +08:00
{
worldNumber = mChar->WorldNumber();
instanceId = mChar->GetInstanceId();
if( inPack && !ValidateObject( mChar->GetPackItem() ))
Housing Revamp and more Updated JS SysMessage function to accept up to 10 extra, optional arguments, which can be used with dictionary messages that require additional parameters like %s or %i Added new type of house privilege in cMultiObj.cpp to keep track of friends of the multi - HOUSEPRIV_FRIEND - which is stored during worldsaves as one or more Friend=<player serial> tags in house.wsc Added new type of house privilege in cMultiObj.cpp to keep track of guests of the multi - HOUSEPRIV_GUEST - which is stored during worldsaves as one or more Guest=<player serial> tags in house.wsc When items are created for houses upon house placement, a reference to the multi's serial is now stored in the house sign's MORE property to allow easier tracking of which house a particular sign belongs to Added tracking of new, persistent properties for houses via cMultiObj.cpp/h: lockdowns, secure containers, vendors, guests, friends, owners, ban location, public status, number of visits, timestamps Added a multitude of new methods in cMultiObj.cpp/h to assist in improving the functionality of houses Added new tags for houses in house.dfn (default values applied if tag not specified): MAXSECURECONTAINERS=4 - Max amount of secure containers allowed in a multi MAXLOCKDOWNS=256 - Max amount of lockdowns allowed in a multi MAXVENDORS=10 - Max amount of vendors allowed in a multi MAXBANS=50 - Max amount of bans in a multi's ban list MAXFRIENDS=50 - Max amount of friends in a multi's friend list MAXGUESTS=50 - Max amount of guests in a multi's guest list MAXOWNERS=8 - Max amount of owners and co-owners in a multi's owner list MAXTRASHCONTAINERS=1 - Max amount of trash containers allowed in multi SCRIPT=<scriptID> - Assign a JS script-ID directly to a multi FRONTDOOR - indicates that a door is the front door of a house. Cannot be locked in public houses! INTERIORDOOR - indicates that a door is an interior door of a house. Can be locked in public houses. BANX - Location X offset for multi's ban location, if not used, will try to use SE corner of multi instead BANY - Location Y offset for multi's ban location, if not used, will try to use SE corner of multi instead Added JS Event: onHouseCommand( tSock, multiObj, cmdID ) - For handling spoken house commands via JS scripts attached to multi. Updated JS Events: onEntrance() - can now trigger both for multi being entered and/or object entering onLeaving() - can now trigger both for multi being left and/or object entering onSpeech() - can now also trigger for items (in addition to chars) with event & script attached, if UOX.INI setting ITEMSDETECTSPEECH is enabled Added JS Multi methods: .IsBoat() - Returns whether the item (or multi) is a boat .IsOwner( playerToCheck ) - Returns whether a player is the owner of a multi .IsOnOwnerList( playerToCheck ) - Returns whether a player is on the (co-)owner list of a multi .IsOnFriendList( playerToCheck ) - Returns whether a player is on the friend list of a multi .IsOnGuestList( playerToCheck ) - Returns whether a player is on the guest list of a multi .IsOnBanList( playerToCheck ) - Returns whether a player is on the ban list of a multi .AddToFriendList( playertoAdd ) - Adds player to the friend list of a multi .RemoveFromFriendList( playertoRemove ) - Removes player from the friend list of a multi .AddToGuestList( playertoAdd ) - Adds player to the guest list of a multi .RemoveFromGuestList( playertoRemove ) - Removes player from the guest list of a multi .ClearOwnerList() - Clears all entries from a multi's (co-)owner list .ClearFriendList() - Clears all entries from a multi's friend list .ClearGuestList() - Clears all entries from a multi's guest list .ClearBanList() - Clears all entries from a multi's ban list .SecureContainer( itemToSecure ) - Secures a container in a multi .UnsecureContainer( itemToUnsecure ) - Unsecures a container in a multi .IsSecureContainer( itemToCheck ) - Checks if specified item is a secure container in a multi .LockDownItem( itemToLockDown) - Locks down an item in a multi .ReleaseItem( itemToRelease ) - Releases a locked down item in a multi .KillKeys() - Deletes ALL keys associated with a multi .AddTrashCont( itemToAdd ) - Add trash container to multi's list of trash containers .RemoveTrashCont( itemToRemove ) - Remove trash container from multi's list of trash containers Added JS Item (Multi only) properties: .lockdowns - Get the number of lockdowns in a multi .maxLockdowns - Get/Set the max number of lockdowns allowed in a multi .secureContainers - Get the number of secure containers in a multi .maxSecureContainers - Get/Set the max number of secure containers allowed in a multi .trashContainers - Get the number of trash containers in a multi .maxTrashContainers - Get/Set the max number of trash containers allowed in a multi .friends - Get the number of friends in a multi's friend list .maxFriends - Get/Set the max number of friends allowed in a multi's friend list .guests - Get the number of guests in a multi's guest list .maxGuests - Get/Set the max number of guests allowed in a multi's guest list .owners - Get the number of owners in a multi's owner list .maxOwners - Get/Set the max number of owners allowed in a multi's owner list .bans - Get the number of banned players in a multi's ban list .maxBans - Get/Set the max number of banned players allowed in a multi's ban list .vendors - Get the number of player vendors in a multi .maxVendors - Get the max number of player vendors allowed in a multi .deed - Get the item sectionID for deed used to place multi .isPublic - Get/Set the private/public state of a multi .buildTimestamp - Get the timestamp for when the house was originally placed .tradeTimestamp - Get the timestamp for when the house was last traded to another player .banX - Get/Set the ban location X offset for the multi .banY - Get/Set the ban location Y offset for the multi Added JS Character properties: .multi = Get/Set the multi object the character is in .accountNum = Get the account number the character belongs to .housesOwned = Get a count of houses owned by the character .housesCoOwned = Get a count of houses co-owned by the character Updated JS cBaseObject Methods .FirstItem(), .NextItem() and .FinishedItems() to also support iterating through items in multis Updated JS multi Methods .FirstChar(), .NextChar() and .FinishedChars() to support an additional parameter to specify what kind of characters to loop through: "default" or no parameter - all characters inside the multi "owner" - players on multi's owner list "friend" - players on multi's friend list "guest" - players on multi's guest list "banned" - players on multi's ban list Added new INI tags to a new section of uox.ini called [houses] DECAYTIMERINHOUSE=3600 // Decay timer in seconds for non-locked down items inside houses PROTECTPRIVATEHOUSES=1 // Toggles whether private houses will automatically boot unauthorized visitors (1) or not (0) TRACKHOUSESPERACCOUNT=1 // Toggles whether to track (and restrict) house ownership per account (1) or per character (0) MAXHOUSESOWNABLE=1 // Specifies the max amount of houses a player can own per account/char, depending on how house ownership is tracked MAXHOUSESCOOWNABLE=10 // Specifies the max amount of houses a player can co-own per character CANOWNANDCOOWNHOUSES=1 // Toggles whether players can own and co-own houses at the same time COOWNHOUSESONSAMEACCOUNT=1 // Toggles whether characters on same account as house owner will be treated as co-owners Added new INI tags in [settings] section of uox.ini: ITEMSDETECTSPEECH=0 // If enabled, server will search for nearby items with onSpeech JS event running whenever a character speaks. Disabled by default. MAXPLAYERPACKITEMS=125 // Defines max item capacity for player (and NPC) backpacks. Defaults to 125. Moved most of the existing house functionality to JS and expanded upon it to reach feature parity with houses in regular UO around Publish 15/16, with various extras thrown in for good measure and all functionality being customizable: js/server/house/house.js (15000) - handles detection of house commands and characters entering/leaving houses js/server/house/houseSign.js (15001) - contains and handles all house-related gumps/menus and what is shown when players interact with house sign js/server/house/houseCommands.js (15002) - handles functionality of house commands and other functionality such as transfer of ownership, demolishing house, etc. js/server/house/houseDeed.js (15003) - handles initial rules that allow/disallow placement of additional houses for players All house-related menus now fully handled through JS All house commands and other functionality now fully handled through JS Removed redundant hard-coded house functionality Implemented Co-owners, friends, guests for houses, with access rules in place for entry, lockdowns, house commands, etc. Implemented Private and Public houses Implemented Secure Containers and Trash Barrels Definable max lockdowns, secure containers, player vendors, bans, friends, guests, owners, trash containers and more - per house type JS scripts can now be attached directly to houses Doors in houses can be marked as front doors or interior doors, and will be treated differently with regards to private and public houses Added new item to dfndata/items/containers/misc.dfn - [trashbarrel] Added new JS script (js/items/trashbarrel.js) with trash barrel functionality for houses. Trash barrels that are marked as secure containers are only accessible by owners, co-owners and friends of the house. Various options available at top of script. Updated js/items/axe.js to support chopping up trash barrels and house add-ons in houses owned by the player Fixed an issue with house doors being left behind after demolishing houses while their doors were open Fixed an issue where GMs could be banned from player houses Added Line of Sight checks to speech, to give players some privacy in their own homes Updated house placement code to more accurately check for other multis, dynamic and static objects when placing houses; now requires free space around each house that cannot be blocked by other houses or items that can block player movement, and disallows placement of houses on roads Updated house placement code to move characters blocking house placement to SE corner of the house Updated house placement code to disallow placing houses in guarded regions, or in dungeons Added new DFN tag for regions to enable/disable player houses in specific regions: HOUSING=0/1 Added new region (247) that covers path to Valley of Eodon in Felucca Added new region (248) that covers Valley of Eodon in Ter-Mur, with player housing disabled Added new region (249) that covers entire T2A lands, with player housing disabled Updated SPACEX and SPACEY values for all houses in dfndata/house/house.dfn to match updated house placement code Added new JS property to Regions that can be used to determine or change state of player housing in a region: .canPlaceHouse() Updated rules for usage of dye tubs to dye locked down items; now only house owners or co-owners may dye locked down items Updated rules for usage of the following locked down items in a house, which are now only usable by house owners and co-owners Dyes, Guildstone Deeds, Recall Runes (renaming), Rename Deeds, Townstone Deeds, House Deeds, Boat Models, Player Vendor Deeds, Ore, Hair Dye Updated rules for usage of the following locked down items in a house, which are now only usable by house owners, co-owners and friends: Keys, Dye Tubs, Magic Scrolls, Fireworks Wands, Magic Wands, Smithing Tools, Mining Tools, Fishing Poles Updated item lockdown rules to allow locking down (and releasing) items in a container as long as the container is locked down, and to only allow releasing a locked down container if it's empty of locked down items Updated item lockdown rules to only allow locking down movement-blocking items further than 2 tiles away from doors Updated rules for releasing items in houses - now the house owner can release any locked down items, co-owners can release items locked down by themselves or by friends, while friends can release only items locked down by themselves Added some feedback to player about why their attempted house placement failed Items added by GMs directly into multis will now decay based on the house-specific decay timer instead of the regular one Fixed an issue that could cause items to almost instantly decay after being released from lockdown in a house Placing house add-ons now properly takes into account SPACEX and SPACEY values when checking if they can fit in selected area of houses Re-added SPACEX and SPACEY values for Pentagram and Loom house add-ons House add-ons can now be converted back into house add-on deeds by chopping them with an axe Added new item type - IT_HOUSEADDON (201) - used by house add-ons placed in player houses Fixed a bug where keys would stop working after being added to a keyring, and would turn into blank keys upon release from the keyring Added visitor count for public player houses, which keeps track of how many visits a public house has received, with each player counted max 1 time every 24 hours Fixed an issue with FindPlayersInOldVisrange() where it didn't take into account that players could see buildings further away than the standard update range. This could cause players to see ghost images of buildings if they were at the "right" distance when the building was being demolished Added NODECAY tag to all signs and doors in dfndata/house/house.dfn Added FRONTDOOR or INTERIORDOOR (as appropriate) to all doors in dfndata/house/house.dfn Added BANX and BANY to specify ban location for some houses in dfndata/house/house.dfn instead of relying on finding SE corner automatically Implemented strongboxes (js/server/house/strongbox.js) for co-owners of a house, which can be placed with the house command "i wish to place a strongbox". Max capacity is 25 items Updated 'REMOVE command to take an optional parameter - itemID. If supplied, the command will remove all items with this itemID from a targeted container Fixed a bug when checking if dynamic items were blocking valid spawn locations for NPCs, some function arguments were in the wrong order! Improved code that finds valid spawn locations for items and NPCs spawned via spawn regions. As server gradually builds up lists of valid spawn locations per region over time, it will start using these lists more often, rather than always look for brand new spawn locations. Fixed a bug with CMulHandler::CheckStaticFlag() that prevented NPCs from spawning inside buildings with no static floors! Fixed an issue with repeating commands that prevented GMs from being able to cancel them when using the ClassicUO client Exposed character property .accountNum to JS engine Extended CDataList class to include a Clear() method for clearing lists Updated JS File method .Open() to support an optional, third argument - subFolderName - that defines in which sub-folder of UOX3/shared/ to store/look for a file. If no third argument is supplied, UOX3 will default to using the shared folder itself. Updated JS File method .Length() to return a value of -1 for files that don't exist Added new code function, exposed to JS engine with same parameters, which simply checks if a given tile ID has a specific flag bool CheckTileFlag( UI16 itemID, TILEFLAG flagToCheck ) Added JS function used to find the root container of an item (if any) FindRootContainer( itemSerial ) FindRootContainer( item ) Added new JS function that allows deleting files from UOX3/shared/ folder or subfolders of shared folder. If no subFolderName is provided, looks for file directly in shared folder itself. Restrictions on file- and folder-names apply. bool DeleteFile( fileName, subFolderName ) Added new JS functions for checking if a specific client or server feature is enabled. See documentation for full list of client/server features. GetClientFeature( bitNum ) // Returns true if specified client feature is enabled on server GetServerFeature( bitNum ) // Returns true if specified server feature is enabled on server Added new JS function for returning the value of almost any server setting from UOX.INI GetServerSetting( settingNameInDoubleQuotes ) Updated JS function DoesDynamicBlock() with two new parameters - checkOnlyMultis and checkOnlyNonMultis Updated JS function DoesMapBlock() with two new parameters - checkMultiPlacement and checkForRoad Fixed an issue where a LoS check would prevent players from accessing containers in their own backpack Added new functions in findfuncs.cpp to make it easier to find items near another object or location: findNearbyItems( object, distance ) findNearbyItems( x, y, worldNumber, instanceID, distance ) Added new Item property - maxItems - used by containers to determine their max item capacity Added new Item property - totalItemCount - used to get total item count in a container (including sub-containers) Added check for max item capacity when creating new items that are added to a character's backpack - items will be created below character's feet if backpack is full! Added new DFN tag for items, used by containers to determine item capacity for a given container: MAXITEMS=# // 125 is the default for all containers if not set Added new JS Item properties: .maxItems // gets/sets item capacity for a given container .totalItemCount // gets total item count in a container, including sub-containers Updated item tooltips for containers to show accurate total item count, as well as to display max item capacity Fixed a bug where picking up items from a non-locked down pile of items on the floor inside a multi could cause the remaining pile to be seen as no longer inside the multi, disallowing locking it back down and causing it to decay based on regular decay timer instead of house-specific one Updated JS command set to allow setting poison-level on items ('set poison #) and hunger-level on characters ('set hunger #) Fixed an issue with js/item/food.js that prevented poisoned food from poisoning characters when eaten Fixed an issue with js/skill/poisoning.js that prevented players from poisoning food! Updated various JS scripts and hardcoded targeting functions to disallow the targeting of locked down resources using skills and tools Updated JS Method TextMessage() to support three extra, optional parameters. Note that if one optional parameter is included, all preceding optional parameters are also required! speechTarget - What kind of target is this message intended for? 0 - Only visible for sender and receiver of message 1 - Visible to all players in range 2 - Visible to all NPCs and players in range 3 - Visible to all PCs everywhere + NPCs in range 4 - Visible to all PCs everywhere (broadcast) 5 - Only visible for the receiver of the message speechTargetSerial - The serial of the receiver of the message, used if speechTarget is 0 or 5 speechFontType - The type of font to display the text in. Defaults to normal. 0 - Bold 1 - Normal with shadow 2 - Bold with shadow 3 - Normal 4 - Gothic 5 - Italic 6 - Small, dark 7 - Colourful 8 - Runic (only works with CAPS) 9 - Small, light Added timestamp to worldsaves in console, to make it easier to see when a particular world-save was done Added info about compiler/environment displayed at the top of the UOX3 console during startup Updated dictionary files with new messages primarily related to housing
2020-11-04 02:00:37 +08:00
{
UOX3 0.99.6-RC6 Removed arbitrary and hidden restrictions on refreshing list of online players shown with 'wholist command Fixed an issue where player ghosts that get teleported would not see themselves get updated to new location Fixed a server crash from clients disconnecting while running server in debug mode Improved how container updates are sent to players; now only sends to clients that have actually opened the container, and who are still within range Added more information about UO data files being loaded during server startup Enhanced the GM 'add menu to allow clicking directly on images of items/npcs to add them, and adjusted size of menus to accommodate this Fixed an issue with fleeing NPCs that could cause them to attempt to flee across time and space, regardless of distance to target/attacker in combat Added NPC AI that runs away from players if they get too close (even outside combat). Applied to hind, rabbits, squirrels, ferrets and various birds by default: AI_ANIMAL_SCARED (aitype 12) Fixed issues with NPCs fleeing forever, or getting stuck in flee/don't flee loop, by introducing max fleeing distance (50 tiles) and cooldown (30 sec) on fleeing Updated onNameRequest JS Event to include third parameter with origin of name request, so script responses can be tailored appropriately: onNameRequest( myObj, requestedBy, requestSource ) Potential values for requestSource: 0 - Speech/System Messages 1 - Guild Menus 2 - Stat Window (self) 3 - Stat Window (other) 4 - Tooltip 5 - Paperdoll Journal 6 - Paperdoll 7 - Single Click / All-Names 8 - System 9 - Secure Trade Window Added Adaptive Performance System (APS) that dynamically adjust how often NPC AI/movement is checked based on overall shard performance. If performance drops below defined threshold, UOX3 gradually slows down checks for NPC AI/movement to prioritize player movement/speech/command responsiveness. If performance climbs back up above threshold, slowdowns are gradually removed. The following UOX.INI options have been added under [system] category to support this system: APSPERFTHRESHOLD=50 // Performance threshold (measured in simulation cycles/sec) below which the APS kicks in APSINTERVAL=100 // How often (in milliseconds) the APS checks performance and makes adjustments (if needed) to balance out shard performance APSDELAYSTEP=50 // How much the delay timer is modified by (in milliseconds) each time APS makes adjustments APSDELAYMAXCAP=2000 // Max amount of of delay APS can introduce for NPC AI/movement handling when attempting to restore shard performance Added new JS Methods for Region objects: .GetOrePrefs( oreType ) // Get ore preference data for ore type found in town region. Returned as an array containing the following data: orePrefData -> [ oreName, // name of ore color, // color of ore minskill, // min skill to mine ore ingotName, // name of ingot created from ore makemenu, // makemenu entry for crafting something from ingot oreChance, // default global chance of finding this ore type scriptID // script attached to mined ore ], orePrefChance // Chance of finding this ore type in given town region .GetOreChance() // Get base chance of finding any ore in town region Moved Mining skill plus gravedigging feature from hard code to scripts (js/skill/mining.js) to make it easier to maintain and/or customize, and removed hard coded variants Gravedigging now relies on the ore resource system behind the scenes to restrict how often graves in a given area can be dug up Fixed some incorrect references to .worldNumber Character property in misc scripts (should be .worldnumber) Made some "hard-scripted" system messages in misc scripts use dictionary system instead Added spawn region for banker NPCs in Serpent's Hold (dfndata/spawn/felucca/spawn_town_serpents_hold.dfn, dfndata/spawn/trammel/spawn_town_serpents_hold.dfn) Fixed region definition of Ocllo to actually cover the entire town (dfndata/regions/regions.dfn) Added numerous additional locations accessible with 'goplace # command, for key locations in Ilshenar, Malas, Tokuno Islands and Ter Mur (dfndata/location/location.dfn) Revised travel-menu portion of GM menu (shortcut: 'travel) to include more travel options based on new locations (dfndata/items/travelmenu.dfn and travelmenu.bulk.dfn) Fixed an issue where NPCs could attempt to attack targets in other worlds/instances Added new JS Event that triggers for characters who are about to deal damage in combat. Complimentary to onDamage, which triggers for chars receiving damage: onDamageDeal( dmgDealer, dmgReceiver, damageValue, damageType ) Added new JS Event that can trigger in global script upon creation of new player chars. Note that this will trigger in place of onCreateDFN event for player characters: onCreatePlayer( pChar ) Added new JS Event that triggers for characters selecting a target with a spell. Complimentary to onSpellTarget, which triggers for targets selected with a spell: onSpellTargetSelect( caster, target, spellNum ) Updated onCombatStart and onCombatEnd JS Events to also trigger for the other party in combat Updated onPickup JS Event to include a third parameter - the potential container item was picked up from. Event now also triggers event in scripts attached to said containers: onPickup( iPickedUp, pChar, iCont ) Added tracking of total playtime per individual character, and per account across all characters, and exposed these properties to JS engine: .totalPlayTime // Account property, total playtime across all chars .playTime // Character property, total playtime on given character only Added new player-accessible command ('playtime) to spit out the playtime of current character/account as a whole (js/commands/playtime.js) Implemented first version of Young Player System: Replaced the UNUSED9 account flag with YOUNG, to be used by Young/New Player System Added new JS Account property that gets/sets whether player account is considered Young: .isYoung Added new Char timers: TIMER_YOUNGHEAL // Restricts how often Young players are healed by NPC healers TIMER_YOUNGMESSAGE // Restricts how often Young players are warned about dangerous looking monsters in overworld Updated GM commands 'get and 'set to get/set .isYoung property of player's account (js/commands/targeting/get.js and set.js) Added new UOX.INI setting to enable/disable Young Player System (enabled by default): YOUNGPLAYERSYSTEM=1 If Young Player System is enabled, all newly created player accounts are automatically marked with Young flag Added new script to handle various restrictions and functions related to Young characters (js/player/young_player.js): Young characters will have [Young] displayed over their head Young characters will have their Young status checked and verified on every login + every stat/skill gain, to revoke the Young status if any of the following is true: Account has a total playtime of more than 40 hours Any character has more than 350 total (base) skill points Any character has more than 70 skill points in a single skill Any character has more than 150 total stat points Any character has more than 80 stat points in a single stat Young characters can renounce their Young status manually by saying the words "I renounce my young player status" Young characters get two additional items upon creation: a new player ticket (can be combined with any other players new player ticket for both players to get a reward) a sextant (shows Young players directions to nearest moongate/bank regardless of where they are, as long as outdoors) Young characters cannot target other player characters with hostile spells or skills Young characters cannot be the target of other player characters' hostile spells or skills Young characters can only cast beneficial spells upon themselves or other Young characters Young characters can only be the target of beneficial spells from other Young players Young players (and their pets/followers) cannot attack or harm any other players (or their pets/followers), nor themselves be attacked or harmed by any other players (or their pets/followers), whether from combat, spells, skills or items Young players don't lose any of their items on death, and are teleported to the nearest healer upon death with all their items intact Young players receive a warning upon entering dungeons that monsters there will be hostile Updated global script (js/server/global.js) to: Check/Verify Young status of players upon login Attach young player script on login/creation for players on Young accounts Give specific items to Young players upon creation Added new script (js/item/corpse.js) that is assigned to all freshly created corpses. This script handles restrictions related to Young players interactions with corpses, and the interactions of other players with corpses of Young players Updated JS Method .Carve() to return true/false depending on whether carving a corpse was successful Updated Healer AI in code to heal nearby injured Young players Updated Evil AI and Evil Caster AI in code to avoid selecting Young players as targets in combat outside of dungeons Added a new section to UOX.INI - [young player starting locations] - that can be used to define starting locations for Young players. If only one such location is provided, all players start there. Otherwise, it matches the same starting location setup as the regular one - with one entry per town in Britannia. Restricted transferring and/or friending of pets (code) and hirelings (hirelings.js) between Young and non-Young players Restricted Young players from recalling or gating to Felucca facet Young players can instantly logout from anywhere, at any time
2023-07-01 20:02:40 +08:00
std::string charName = GetNpcDictName( mChar, nullptr, NRS_SYSTEM );
Console.Warning( oldstrutil::format( "CreateItem(): Character %s(0x%X) has no pack, item creation aborted.", charName.c_str(), mChar->GetSerial() ));
return nullptr;
}
if( inPack )
{
// Check if character's backpack can hold more items before creating any item
CItem *playerPack = mChar->GetPackItem();
if( ValidateObject( playerPack ))
Housing Revamp and more Updated JS SysMessage function to accept up to 10 extra, optional arguments, which can be used with dictionary messages that require additional parameters like %s or %i Added new type of house privilege in cMultiObj.cpp to keep track of friends of the multi - HOUSEPRIV_FRIEND - which is stored during worldsaves as one or more Friend=<player serial> tags in house.wsc Added new type of house privilege in cMultiObj.cpp to keep track of guests of the multi - HOUSEPRIV_GUEST - which is stored during worldsaves as one or more Guest=<player serial> tags in house.wsc When items are created for houses upon house placement, a reference to the multi's serial is now stored in the house sign's MORE property to allow easier tracking of which house a particular sign belongs to Added tracking of new, persistent properties for houses via cMultiObj.cpp/h: lockdowns, secure containers, vendors, guests, friends, owners, ban location, public status, number of visits, timestamps Added a multitude of new methods in cMultiObj.cpp/h to assist in improving the functionality of houses Added new tags for houses in house.dfn (default values applied if tag not specified): MAXSECURECONTAINERS=4 - Max amount of secure containers allowed in a multi MAXLOCKDOWNS=256 - Max amount of lockdowns allowed in a multi MAXVENDORS=10 - Max amount of vendors allowed in a multi MAXBANS=50 - Max amount of bans in a multi's ban list MAXFRIENDS=50 - Max amount of friends in a multi's friend list MAXGUESTS=50 - Max amount of guests in a multi's guest list MAXOWNERS=8 - Max amount of owners and co-owners in a multi's owner list MAXTRASHCONTAINERS=1 - Max amount of trash containers allowed in multi SCRIPT=<scriptID> - Assign a JS script-ID directly to a multi FRONTDOOR - indicates that a door is the front door of a house. Cannot be locked in public houses! INTERIORDOOR - indicates that a door is an interior door of a house. Can be locked in public houses. BANX - Location X offset for multi's ban location, if not used, will try to use SE corner of multi instead BANY - Location Y offset for multi's ban location, if not used, will try to use SE corner of multi instead Added JS Event: onHouseCommand( tSock, multiObj, cmdID ) - For handling spoken house commands via JS scripts attached to multi. Updated JS Events: onEntrance() - can now trigger both for multi being entered and/or object entering onLeaving() - can now trigger both for multi being left and/or object entering onSpeech() - can now also trigger for items (in addition to chars) with event & script attached, if UOX.INI setting ITEMSDETECTSPEECH is enabled Added JS Multi methods: .IsBoat() - Returns whether the item (or multi) is a boat .IsOwner( playerToCheck ) - Returns whether a player is the owner of a multi .IsOnOwnerList( playerToCheck ) - Returns whether a player is on the (co-)owner list of a multi .IsOnFriendList( playerToCheck ) - Returns whether a player is on the friend list of a multi .IsOnGuestList( playerToCheck ) - Returns whether a player is on the guest list of a multi .IsOnBanList( playerToCheck ) - Returns whether a player is on the ban list of a multi .AddToFriendList( playertoAdd ) - Adds player to the friend list of a multi .RemoveFromFriendList( playertoRemove ) - Removes player from the friend list of a multi .AddToGuestList( playertoAdd ) - Adds player to the guest list of a multi .RemoveFromGuestList( playertoRemove ) - Removes player from the guest list of a multi .ClearOwnerList() - Clears all entries from a multi's (co-)owner list .ClearFriendList() - Clears all entries from a multi's friend list .ClearGuestList() - Clears all entries from a multi's guest list .ClearBanList() - Clears all entries from a multi's ban list .SecureContainer( itemToSecure ) - Secures a container in a multi .UnsecureContainer( itemToUnsecure ) - Unsecures a container in a multi .IsSecureContainer( itemToCheck ) - Checks if specified item is a secure container in a multi .LockDownItem( itemToLockDown) - Locks down an item in a multi .ReleaseItem( itemToRelease ) - Releases a locked down item in a multi .KillKeys() - Deletes ALL keys associated with a multi .AddTrashCont( itemToAdd ) - Add trash container to multi's list of trash containers .RemoveTrashCont( itemToRemove ) - Remove trash container from multi's list of trash containers Added JS Item (Multi only) properties: .lockdowns - Get the number of lockdowns in a multi .maxLockdowns - Get/Set the max number of lockdowns allowed in a multi .secureContainers - Get the number of secure containers in a multi .maxSecureContainers - Get/Set the max number of secure containers allowed in a multi .trashContainers - Get the number of trash containers in a multi .maxTrashContainers - Get/Set the max number of trash containers allowed in a multi .friends - Get the number of friends in a multi's friend list .maxFriends - Get/Set the max number of friends allowed in a multi's friend list .guests - Get the number of guests in a multi's guest list .maxGuests - Get/Set the max number of guests allowed in a multi's guest list .owners - Get the number of owners in a multi's owner list .maxOwners - Get/Set the max number of owners allowed in a multi's owner list .bans - Get the number of banned players in a multi's ban list .maxBans - Get/Set the max number of banned players allowed in a multi's ban list .vendors - Get the number of player vendors in a multi .maxVendors - Get the max number of player vendors allowed in a multi .deed - Get the item sectionID for deed used to place multi .isPublic - Get/Set the private/public state of a multi .buildTimestamp - Get the timestamp for when the house was originally placed .tradeTimestamp - Get the timestamp for when the house was last traded to another player .banX - Get/Set the ban location X offset for the multi .banY - Get/Set the ban location Y offset for the multi Added JS Character properties: .multi = Get/Set the multi object the character is in .accountNum = Get the account number the character belongs to .housesOwned = Get a count of houses owned by the character .housesCoOwned = Get a count of houses co-owned by the character Updated JS cBaseObject Methods .FirstItem(), .NextItem() and .FinishedItems() to also support iterating through items in multis Updated JS multi Methods .FirstChar(), .NextChar() and .FinishedChars() to support an additional parameter to specify what kind of characters to loop through: "default" or no parameter - all characters inside the multi "owner" - players on multi's owner list "friend" - players on multi's friend list "guest" - players on multi's guest list "banned" - players on multi's ban list Added new INI tags to a new section of uox.ini called [houses] DECAYTIMERINHOUSE=3600 // Decay timer in seconds for non-locked down items inside houses PROTECTPRIVATEHOUSES=1 // Toggles whether private houses will automatically boot unauthorized visitors (1) or not (0) TRACKHOUSESPERACCOUNT=1 // Toggles whether to track (and restrict) house ownership per account (1) or per character (0) MAXHOUSESOWNABLE=1 // Specifies the max amount of houses a player can own per account/char, depending on how house ownership is tracked MAXHOUSESCOOWNABLE=10 // Specifies the max amount of houses a player can co-own per character CANOWNANDCOOWNHOUSES=1 // Toggles whether players can own and co-own houses at the same time COOWNHOUSESONSAMEACCOUNT=1 // Toggles whether characters on same account as house owner will be treated as co-owners Added new INI tags in [settings] section of uox.ini: ITEMSDETECTSPEECH=0 // If enabled, server will search for nearby items with onSpeech JS event running whenever a character speaks. Disabled by default. MAXPLAYERPACKITEMS=125 // Defines max item capacity for player (and NPC) backpacks. Defaults to 125. Moved most of the existing house functionality to JS and expanded upon it to reach feature parity with houses in regular UO around Publish 15/16, with various extras thrown in for good measure and all functionality being customizable: js/server/house/house.js (15000) - handles detection of house commands and characters entering/leaving houses js/server/house/houseSign.js (15001) - contains and handles all house-related gumps/menus and what is shown when players interact with house sign js/server/house/houseCommands.js (15002) - handles functionality of house commands and other functionality such as transfer of ownership, demolishing house, etc. js/server/house/houseDeed.js (15003) - handles initial rules that allow/disallow placement of additional houses for players All house-related menus now fully handled through JS All house commands and other functionality now fully handled through JS Removed redundant hard-coded house functionality Implemented Co-owners, friends, guests for houses, with access rules in place for entry, lockdowns, house commands, etc. Implemented Private and Public houses Implemented Secure Containers and Trash Barrels Definable max lockdowns, secure containers, player vendors, bans, friends, guests, owners, trash containers and more - per house type JS scripts can now be attached directly to houses Doors in houses can be marked as front doors or interior doors, and will be treated differently with regards to private and public houses Added new item to dfndata/items/containers/misc.dfn - [trashbarrel] Added new JS script (js/items/trashbarrel.js) with trash barrel functionality for houses. Trash barrels that are marked as secure containers are only accessible by owners, co-owners and friends of the house. Various options available at top of script. Updated js/items/axe.js to support chopping up trash barrels and house add-ons in houses owned by the player Fixed an issue with house doors being left behind after demolishing houses while their doors were open Fixed an issue where GMs could be banned from player houses Added Line of Sight checks to speech, to give players some privacy in their own homes Updated house placement code to more accurately check for other multis, dynamic and static objects when placing houses; now requires free space around each house that cannot be blocked by other houses or items that can block player movement, and disallows placement of houses on roads Updated house placement code to move characters blocking house placement to SE corner of the house Updated house placement code to disallow placing houses in guarded regions, or in dungeons Added new DFN tag for regions to enable/disable player houses in specific regions: HOUSING=0/1 Added new region (247) that covers path to Valley of Eodon in Felucca Added new region (248) that covers Valley of Eodon in Ter-Mur, with player housing disabled Added new region (249) that covers entire T2A lands, with player housing disabled Updated SPACEX and SPACEY values for all houses in dfndata/house/house.dfn to match updated house placement code Added new JS property to Regions that can be used to determine or change state of player housing in a region: .canPlaceHouse() Updated rules for usage of dye tubs to dye locked down items; now only house owners or co-owners may dye locked down items Updated rules for usage of the following locked down items in a house, which are now only usable by house owners and co-owners Dyes, Guildstone Deeds, Recall Runes (renaming), Rename Deeds, Townstone Deeds, House Deeds, Boat Models, Player Vendor Deeds, Ore, Hair Dye Updated rules for usage of the following locked down items in a house, which are now only usable by house owners, co-owners and friends: Keys, Dye Tubs, Magic Scrolls, Fireworks Wands, Magic Wands, Smithing Tools, Mining Tools, Fishing Poles Updated item lockdown rules to allow locking down (and releasing) items in a container as long as the container is locked down, and to only allow releasing a locked down container if it's empty of locked down items Updated item lockdown rules to only allow locking down movement-blocking items further than 2 tiles away from doors Updated rules for releasing items in houses - now the house owner can release any locked down items, co-owners can release items locked down by themselves or by friends, while friends can release only items locked down by themselves Added some feedback to player about why their attempted house placement failed Items added by GMs directly into multis will now decay based on the house-specific decay timer instead of the regular one Fixed an issue that could cause items to almost instantly decay after being released from lockdown in a house Placing house add-ons now properly takes into account SPACEX and SPACEY values when checking if they can fit in selected area of houses Re-added SPACEX and SPACEY values for Pentagram and Loom house add-ons House add-ons can now be converted back into house add-on deeds by chopping them with an axe Added new item type - IT_HOUSEADDON (201) - used by house add-ons placed in player houses Fixed a bug where keys would stop working after being added to a keyring, and would turn into blank keys upon release from the keyring Added visitor count for public player houses, which keeps track of how many visits a public house has received, with each player counted max 1 time every 24 hours Fixed an issue with FindPlayersInOldVisrange() where it didn't take into account that players could see buildings further away than the standard update range. This could cause players to see ghost images of buildings if they were at the "right" distance when the building was being demolished Added NODECAY tag to all signs and doors in dfndata/house/house.dfn Added FRONTDOOR or INTERIORDOOR (as appropriate) to all doors in dfndata/house/house.dfn Added BANX and BANY to specify ban location for some houses in dfndata/house/house.dfn instead of relying on finding SE corner automatically Implemented strongboxes (js/server/house/strongbox.js) for co-owners of a house, which can be placed with the house command "i wish to place a strongbox". Max capacity is 25 items Updated 'REMOVE command to take an optional parameter - itemID. If supplied, the command will remove all items with this itemID from a targeted container Fixed a bug when checking if dynamic items were blocking valid spawn locations for NPCs, some function arguments were in the wrong order! Improved code that finds valid spawn locations for items and NPCs spawned via spawn regions. As server gradually builds up lists of valid spawn locations per region over time, it will start using these lists more often, rather than always look for brand new spawn locations. Fixed a bug with CMulHandler::CheckStaticFlag() that prevented NPCs from spawning inside buildings with no static floors! Fixed an issue with repeating commands that prevented GMs from being able to cancel them when using the ClassicUO client Exposed character property .accountNum to JS engine Extended CDataList class to include a Clear() method for clearing lists Updated JS File method .Open() to support an optional, third argument - subFolderName - that defines in which sub-folder of UOX3/shared/ to store/look for a file. If no third argument is supplied, UOX3 will default to using the shared folder itself. Updated JS File method .Length() to return a value of -1 for files that don't exist Added new code function, exposed to JS engine with same parameters, which simply checks if a given tile ID has a specific flag bool CheckTileFlag( UI16 itemID, TILEFLAG flagToCheck ) Added JS function used to find the root container of an item (if any) FindRootContainer( itemSerial ) FindRootContainer( item ) Added new JS function that allows deleting files from UOX3/shared/ folder or subfolders of shared folder. If no subFolderName is provided, looks for file directly in shared folder itself. Restrictions on file- and folder-names apply. bool DeleteFile( fileName, subFolderName ) Added new JS functions for checking if a specific client or server feature is enabled. See documentation for full list of client/server features. GetClientFeature( bitNum ) // Returns true if specified client feature is enabled on server GetServerFeature( bitNum ) // Returns true if specified server feature is enabled on server Added new JS function for returning the value of almost any server setting from UOX.INI GetServerSetting( settingNameInDoubleQuotes ) Updated JS function DoesDynamicBlock() with two new parameters - checkOnlyMultis and checkOnlyNonMultis Updated JS function DoesMapBlock() with two new parameters - checkMultiPlacement and checkForRoad Fixed an issue where a LoS check would prevent players from accessing containers in their own backpack Added new functions in findfuncs.cpp to make it easier to find items near another object or location: findNearbyItems( object, distance ) findNearbyItems( x, y, worldNumber, instanceID, distance ) Added new Item property - maxItems - used by containers to determine their max item capacity Added new Item property - totalItemCount - used to get total item count in a container (including sub-containers) Added check for max item capacity when creating new items that are added to a character's backpack - items will be created below character's feet if backpack is full! Added new DFN tag for items, used by containers to determine item capacity for a given container: MAXITEMS=# // 125 is the default for all containers if not set Added new JS Item properties: .maxItems // gets/sets item capacity for a given container .totalItemCount // gets total item count in a container, including sub-containers Updated item tooltips for containers to show accurate total item count, as well as to display max item capacity Fixed a bug where picking up items from a non-locked down pile of items on the floor inside a multi could cause the remaining pile to be seen as no longer inside the multi, disallowing locking it back down and causing it to decay based on regular decay timer instead of house-specific one Updated JS command set to allow setting poison-level on items ('set poison #) and hunger-level on characters ('set hunger #) Fixed an issue with js/item/food.js that prevented poisoned food from poisoning characters when eaten Fixed an issue with js/skill/poisoning.js that prevented players from poisoning food! Updated various JS scripts and hardcoded targeting functions to disallow the targeting of locked down resources using skills and tools Updated JS Method TextMessage() to support three extra, optional parameters. Note that if one optional parameter is included, all preceding optional parameters are also required! speechTarget - What kind of target is this message intended for? 0 - Only visible for sender and receiver of message 1 - Visible to all players in range 2 - Visible to all NPCs and players in range 3 - Visible to all PCs everywhere + NPCs in range 4 - Visible to all PCs everywhere (broadcast) 5 - Only visible for the receiver of the message speechTargetSerial - The serial of the receiver of the message, used if speechTarget is 0 or 5 speechFontType - The type of font to display the text in. Defaults to normal. 0 - Bold 1 - Normal with shadow 2 - Bold with shadow 3 - Normal 4 - Gothic 5 - Italic 6 - Small, dark 7 - Colourful 8 - Runic (only works with CAPS) 9 - Small, light Added timestamp to worldsaves in console, to make it easier to see when a particular world-save was done Added info about compiler/environment displayed at the top of the UOX3 console during startup Updated dictionary files with new messages primarily related to housing
2020-11-04 02:00:37 +08:00
{
if( playerPack->GetContainsList()->Num() >= playerPack->GetMaxItems() )
{
if( mSock != nullptr )
{
mSock->SysMessage( 1819 ); // Your backpack cannot hold any more items!
}
inPack = false; // Spawn item at character's feet instead
}
Housing Revamp and more Updated JS SysMessage function to accept up to 10 extra, optional arguments, which can be used with dictionary messages that require additional parameters like %s or %i Added new type of house privilege in cMultiObj.cpp to keep track of friends of the multi - HOUSEPRIV_FRIEND - which is stored during worldsaves as one or more Friend=<player serial> tags in house.wsc Added new type of house privilege in cMultiObj.cpp to keep track of guests of the multi - HOUSEPRIV_GUEST - which is stored during worldsaves as one or more Guest=<player serial> tags in house.wsc When items are created for houses upon house placement, a reference to the multi's serial is now stored in the house sign's MORE property to allow easier tracking of which house a particular sign belongs to Added tracking of new, persistent properties for houses via cMultiObj.cpp/h: lockdowns, secure containers, vendors, guests, friends, owners, ban location, public status, number of visits, timestamps Added a multitude of new methods in cMultiObj.cpp/h to assist in improving the functionality of houses Added new tags for houses in house.dfn (default values applied if tag not specified): MAXSECURECONTAINERS=4 - Max amount of secure containers allowed in a multi MAXLOCKDOWNS=256 - Max amount of lockdowns allowed in a multi MAXVENDORS=10 - Max amount of vendors allowed in a multi MAXBANS=50 - Max amount of bans in a multi's ban list MAXFRIENDS=50 - Max amount of friends in a multi's friend list MAXGUESTS=50 - Max amount of guests in a multi's guest list MAXOWNERS=8 - Max amount of owners and co-owners in a multi's owner list MAXTRASHCONTAINERS=1 - Max amount of trash containers allowed in multi SCRIPT=<scriptID> - Assign a JS script-ID directly to a multi FRONTDOOR - indicates that a door is the front door of a house. Cannot be locked in public houses! INTERIORDOOR - indicates that a door is an interior door of a house. Can be locked in public houses. BANX - Location X offset for multi's ban location, if not used, will try to use SE corner of multi instead BANY - Location Y offset for multi's ban location, if not used, will try to use SE corner of multi instead Added JS Event: onHouseCommand( tSock, multiObj, cmdID ) - For handling spoken house commands via JS scripts attached to multi. Updated JS Events: onEntrance() - can now trigger both for multi being entered and/or object entering onLeaving() - can now trigger both for multi being left and/or object entering onSpeech() - can now also trigger for items (in addition to chars) with event & script attached, if UOX.INI setting ITEMSDETECTSPEECH is enabled Added JS Multi methods: .IsBoat() - Returns whether the item (or multi) is a boat .IsOwner( playerToCheck ) - Returns whether a player is the owner of a multi .IsOnOwnerList( playerToCheck ) - Returns whether a player is on the (co-)owner list of a multi .IsOnFriendList( playerToCheck ) - Returns whether a player is on the friend list of a multi .IsOnGuestList( playerToCheck ) - Returns whether a player is on the guest list of a multi .IsOnBanList( playerToCheck ) - Returns whether a player is on the ban list of a multi .AddToFriendList( playertoAdd ) - Adds player to the friend list of a multi .RemoveFromFriendList( playertoRemove ) - Removes player from the friend list of a multi .AddToGuestList( playertoAdd ) - Adds player to the guest list of a multi .RemoveFromGuestList( playertoRemove ) - Removes player from the guest list of a multi .ClearOwnerList() - Clears all entries from a multi's (co-)owner list .ClearFriendList() - Clears all entries from a multi's friend list .ClearGuestList() - Clears all entries from a multi's guest list .ClearBanList() - Clears all entries from a multi's ban list .SecureContainer( itemToSecure ) - Secures a container in a multi .UnsecureContainer( itemToUnsecure ) - Unsecures a container in a multi .IsSecureContainer( itemToCheck ) - Checks if specified item is a secure container in a multi .LockDownItem( itemToLockDown) - Locks down an item in a multi .ReleaseItem( itemToRelease ) - Releases a locked down item in a multi .KillKeys() - Deletes ALL keys associated with a multi .AddTrashCont( itemToAdd ) - Add trash container to multi's list of trash containers .RemoveTrashCont( itemToRemove ) - Remove trash container from multi's list of trash containers Added JS Item (Multi only) properties: .lockdowns - Get the number of lockdowns in a multi .maxLockdowns - Get/Set the max number of lockdowns allowed in a multi .secureContainers - Get the number of secure containers in a multi .maxSecureContainers - Get/Set the max number of secure containers allowed in a multi .trashContainers - Get the number of trash containers in a multi .maxTrashContainers - Get/Set the max number of trash containers allowed in a multi .friends - Get the number of friends in a multi's friend list .maxFriends - Get/Set the max number of friends allowed in a multi's friend list .guests - Get the number of guests in a multi's guest list .maxGuests - Get/Set the max number of guests allowed in a multi's guest list .owners - Get the number of owners in a multi's owner list .maxOwners - Get/Set the max number of owners allowed in a multi's owner list .bans - Get the number of banned players in a multi's ban list .maxBans - Get/Set the max number of banned players allowed in a multi's ban list .vendors - Get the number of player vendors in a multi .maxVendors - Get the max number of player vendors allowed in a multi .deed - Get the item sectionID for deed used to place multi .isPublic - Get/Set the private/public state of a multi .buildTimestamp - Get the timestamp for when the house was originally placed .tradeTimestamp - Get the timestamp for when the house was last traded to another player .banX - Get/Set the ban location X offset for the multi .banY - Get/Set the ban location Y offset for the multi Added JS Character properties: .multi = Get/Set the multi object the character is in .accountNum = Get the account number the character belongs to .housesOwned = Get a count of houses owned by the character .housesCoOwned = Get a count of houses co-owned by the character Updated JS cBaseObject Methods .FirstItem(), .NextItem() and .FinishedItems() to also support iterating through items in multis Updated JS multi Methods .FirstChar(), .NextChar() and .FinishedChars() to support an additional parameter to specify what kind of characters to loop through: "default" or no parameter - all characters inside the multi "owner" - players on multi's owner list "friend" - players on multi's friend list "guest" - players on multi's guest list "banned" - players on multi's ban list Added new INI tags to a new section of uox.ini called [houses] DECAYTIMERINHOUSE=3600 // Decay timer in seconds for non-locked down items inside houses PROTECTPRIVATEHOUSES=1 // Toggles whether private houses will automatically boot unauthorized visitors (1) or not (0) TRACKHOUSESPERACCOUNT=1 // Toggles whether to track (and restrict) house ownership per account (1) or per character (0) MAXHOUSESOWNABLE=1 // Specifies the max amount of houses a player can own per account/char, depending on how house ownership is tracked MAXHOUSESCOOWNABLE=10 // Specifies the max amount of houses a player can co-own per character CANOWNANDCOOWNHOUSES=1 // Toggles whether players can own and co-own houses at the same time COOWNHOUSESONSAMEACCOUNT=1 // Toggles whether characters on same account as house owner will be treated as co-owners Added new INI tags in [settings] section of uox.ini: ITEMSDETECTSPEECH=0 // If enabled, server will search for nearby items with onSpeech JS event running whenever a character speaks. Disabled by default. MAXPLAYERPACKITEMS=125 // Defines max item capacity for player (and NPC) backpacks. Defaults to 125. Moved most of the existing house functionality to JS and expanded upon it to reach feature parity with houses in regular UO around Publish 15/16, with various extras thrown in for good measure and all functionality being customizable: js/server/house/house.js (15000) - handles detection of house commands and characters entering/leaving houses js/server/house/houseSign.js (15001) - contains and handles all house-related gumps/menus and what is shown when players interact with house sign js/server/house/houseCommands.js (15002) - handles functionality of house commands and other functionality such as transfer of ownership, demolishing house, etc. js/server/house/houseDeed.js (15003) - handles initial rules that allow/disallow placement of additional houses for players All house-related menus now fully handled through JS All house commands and other functionality now fully handled through JS Removed redundant hard-coded house functionality Implemented Co-owners, friends, guests for houses, with access rules in place for entry, lockdowns, house commands, etc. Implemented Private and Public houses Implemented Secure Containers and Trash Barrels Definable max lockdowns, secure containers, player vendors, bans, friends, guests, owners, trash containers and more - per house type JS scripts can now be attached directly to houses Doors in houses can be marked as front doors or interior doors, and will be treated differently with regards to private and public houses Added new item to dfndata/items/containers/misc.dfn - [trashbarrel] Added new JS script (js/items/trashbarrel.js) with trash barrel functionality for houses. Trash barrels that are marked as secure containers are only accessible by owners, co-owners and friends of the house. Various options available at top of script. Updated js/items/axe.js to support chopping up trash barrels and house add-ons in houses owned by the player Fixed an issue with house doors being left behind after demolishing houses while their doors were open Fixed an issue where GMs could be banned from player houses Added Line of Sight checks to speech, to give players some privacy in their own homes Updated house placement code to more accurately check for other multis, dynamic and static objects when placing houses; now requires free space around each house that cannot be blocked by other houses or items that can block player movement, and disallows placement of houses on roads Updated house placement code to move characters blocking house placement to SE corner of the house Updated house placement code to disallow placing houses in guarded regions, or in dungeons Added new DFN tag for regions to enable/disable player houses in specific regions: HOUSING=0/1 Added new region (247) that covers path to Valley of Eodon in Felucca Added new region (248) that covers Valley of Eodon in Ter-Mur, with player housing disabled Added new region (249) that covers entire T2A lands, with player housing disabled Updated SPACEX and SPACEY values for all houses in dfndata/house/house.dfn to match updated house placement code Added new JS property to Regions that can be used to determine or change state of player housing in a region: .canPlaceHouse() Updated rules for usage of dye tubs to dye locked down items; now only house owners or co-owners may dye locked down items Updated rules for usage of the following locked down items in a house, which are now only usable by house owners and co-owners Dyes, Guildstone Deeds, Recall Runes (renaming), Rename Deeds, Townstone Deeds, House Deeds, Boat Models, Player Vendor Deeds, Ore, Hair Dye Updated rules for usage of the following locked down items in a house, which are now only usable by house owners, co-owners and friends: Keys, Dye Tubs, Magic Scrolls, Fireworks Wands, Magic Wands, Smithing Tools, Mining Tools, Fishing Poles Updated item lockdown rules to allow locking down (and releasing) items in a container as long as the container is locked down, and to only allow releasing a locked down container if it's empty of locked down items Updated item lockdown rules to only allow locking down movement-blocking items further than 2 tiles away from doors Updated rules for releasing items in houses - now the house owner can release any locked down items, co-owners can release items locked down by themselves or by friends, while friends can release only items locked down by themselves Added some feedback to player about why their attempted house placement failed Items added by GMs directly into multis will now decay based on the house-specific decay timer instead of the regular one Fixed an issue that could cause items to almost instantly decay after being released from lockdown in a house Placing house add-ons now properly takes into account SPACEX and SPACEY values when checking if they can fit in selected area of houses Re-added SPACEX and SPACEY values for Pentagram and Loom house add-ons House add-ons can now be converted back into house add-on deeds by chopping them with an axe Added new item type - IT_HOUSEADDON (201) - used by house add-ons placed in player houses Fixed a bug where keys would stop working after being added to a keyring, and would turn into blank keys upon release from the keyring Added visitor count for public player houses, which keeps track of how many visits a public house has received, with each player counted max 1 time every 24 hours Fixed an issue with FindPlayersInOldVisrange() where it didn't take into account that players could see buildings further away than the standard update range. This could cause players to see ghost images of buildings if they were at the "right" distance when the building was being demolished Added NODECAY tag to all signs and doors in dfndata/house/house.dfn Added FRONTDOOR or INTERIORDOOR (as appropriate) to all doors in dfndata/house/house.dfn Added BANX and BANY to specify ban location for some houses in dfndata/house/house.dfn instead of relying on finding SE corner automatically Implemented strongboxes (js/server/house/strongbox.js) for co-owners of a house, which can be placed with the house command "i wish to place a strongbox". Max capacity is 25 items Updated 'REMOVE command to take an optional parameter - itemID. If supplied, the command will remove all items with this itemID from a targeted container Fixed a bug when checking if dynamic items were blocking valid spawn locations for NPCs, some function arguments were in the wrong order! Improved code that finds valid spawn locations for items and NPCs spawned via spawn regions. As server gradually builds up lists of valid spawn locations per region over time, it will start using these lists more often, rather than always look for brand new spawn locations. Fixed a bug with CMulHandler::CheckStaticFlag() that prevented NPCs from spawning inside buildings with no static floors! Fixed an issue with repeating commands that prevented GMs from being able to cancel them when using the ClassicUO client Exposed character property .accountNum to JS engine Extended CDataList class to include a Clear() method for clearing lists Updated JS File method .Open() to support an optional, third argument - subFolderName - that defines in which sub-folder of UOX3/shared/ to store/look for a file. If no third argument is supplied, UOX3 will default to using the shared folder itself. Updated JS File method .Length() to return a value of -1 for files that don't exist Added new code function, exposed to JS engine with same parameters, which simply checks if a given tile ID has a specific flag bool CheckTileFlag( UI16 itemID, TILEFLAG flagToCheck ) Added JS function used to find the root container of an item (if any) FindRootContainer( itemSerial ) FindRootContainer( item ) Added new JS function that allows deleting files from UOX3/shared/ folder or subfolders of shared folder. If no subFolderName is provided, looks for file directly in shared folder itself. Restrictions on file- and folder-names apply. bool DeleteFile( fileName, subFolderName ) Added new JS functions for checking if a specific client or server feature is enabled. See documentation for full list of client/server features. GetClientFeature( bitNum ) // Returns true if specified client feature is enabled on server GetServerFeature( bitNum ) // Returns true if specified server feature is enabled on server Added new JS function for returning the value of almost any server setting from UOX.INI GetServerSetting( settingNameInDoubleQuotes ) Updated JS function DoesDynamicBlock() with two new parameters - checkOnlyMultis and checkOnlyNonMultis Updated JS function DoesMapBlock() with two new parameters - checkMultiPlacement and checkForRoad Fixed an issue where a LoS check would prevent players from accessing containers in their own backpack Added new functions in findfuncs.cpp to make it easier to find items near another object or location: findNearbyItems( object, distance ) findNearbyItems( x, y, worldNumber, instanceID, distance ) Added new Item property - maxItems - used by containers to determine their max item capacity Added new Item property - totalItemCount - used to get total item count in a container (including sub-containers) Added check for max item capacity when creating new items that are added to a character's backpack - items will be created below character's feet if backpack is full! Added new DFN tag for items, used by containers to determine item capacity for a given container: MAXITEMS=# // 125 is the default for all containers if not set Added new JS Item properties: .maxItems // gets/sets item capacity for a given container .totalItemCount // gets total item count in a container, including sub-containers Updated item tooltips for containers to show accurate total item count, as well as to display max item capacity Fixed a bug where picking up items from a non-locked down pile of items on the floor inside a multi could cause the remaining pile to be seen as no longer inside the multi, disallowing locking it back down and causing it to decay based on regular decay timer instead of house-specific one Updated JS command set to allow setting poison-level on items ('set poison #) and hunger-level on characters ('set hunger #) Fixed an issue with js/item/food.js that prevented poisoned food from poisoning characters when eaten Fixed an issue with js/skill/poisoning.js that prevented players from poisoning food! Updated various JS scripts and hardcoded targeting functions to disallow the targeting of locked down resources using skills and tools Updated JS Method TextMessage() to support three extra, optional parameters. Note that if one optional parameter is included, all preceding optional parameters are also required! speechTarget - What kind of target is this message intended for? 0 - Only visible for sender and receiver of message 1 - Visible to all players in range 2 - Visible to all NPCs and players in range 3 - Visible to all PCs everywhere + NPCs in range 4 - Visible to all PCs everywhere (broadcast) 5 - Only visible for the receiver of the message speechTargetSerial - The serial of the receiver of the message, used if speechTarget is 0 or 5 speechFontType - The type of font to display the text in. Defaults to normal. 0 - Bold 1 - Normal with shadow 2 - Bold with shadow 3 - Normal 4 - Gothic 5 - Italic 6 - Small, dark 7 - Colourful 8 - Runic (only works with CAPS) 9 - Small, light Added timestamp to worldsaves in console, to make it easier to see when a particular world-save was done Added info about compiler/environment displayed at the top of the UOX3 console during startup Updated dictionary files with new messages primarily related to housing
2020-11-04 02:00:37 +08:00
}
}
}
CItem *iCreated = CreateBaseItem( worldNumber, itemType, instanceId, shouldSave );
2021-06-12 07:30:23 -04:00
if( iCreated == nullptr )
return nullptr;
if( itemId != 0x0000 )
{
if( Map->IsValidTile( itemId ))
{
iCreated->SetId( itemId );
}
}
if( iColour != 0x0000 )
{
iCreated->SetColour( iColour );
}
// Only set item to decayable by default if ini setting is enabled
if( cwmWorldState->ServerData()->BaseItemsDecayable() )
{
iCreated->SetDecayable( true );
}
GetScriptItemSettings( iCreated );
if( iAmount > 1 )
{
iCreated->SetPileable( true );
iCreated->SetAmount( iAmount );
}
Minor JS revamp - multiple scripts per object! Added TryParseJSVal() helper function in cScript.cpp, used to parse jsval values returned from script events. Provides results matching 0 (0, false), 1 (1, true) or any specific int value returned from script. JS events updated to use new TryParseJSVal helper function (no change in behaviour): onDecay, onResurrect, onCommand, onBuyFromVendor, onSellToVendor, onPickup, onCharDoubleClick, onSkillGump, onUseBandageMacro, onCombatStart, onCombatEnd, onDeathBlow, onBuy, onSell JS events with slight change of behaviour after update to use TryParseJSVal: onDrop, onDropItemOnItem, onDropItemOnNpc - previously, a blank or non-existent return value would be treated the same as a return true. This will now be treated as a return false. Update scripts accordingly! JS events updated to support return values from scripts: onCollide, onTalk, onSnooped, OnHungerChange Return false or nothing to prevent hard code from running Return true to allow hard code to run like normal onStolenFrom, onAISliver, onLightChange, onVirtueGumpPress, onQuestGump, onSpecialMove, onSwing, onClick, onHouseCommand, onSellToVendor, onSkillCheck, onSpellGain, onSpellLoss Return false to allow hard code and other scripts with event to run like normal Return true to prevent hard code and other scripts with event from running onSteal Return false or nothing to allow hard code and other scripts with event to run like normal Return true to prevent hard code and onStolenFrom event from running (theft failed?) Return 2 to prevent hard code, but allow onStolenFrom event to run (theft succeeded, but handled in script?) onLeaving, onEntrance, onEquip, onUnequip, onEnterEvadeState, onSoldToVendor, onBoughtFromVendor, onSpellSuccess, onSpellTarget, onFlagChange, onDeath Return false or nothing to allow other scripts with event to run like normal Return true to prevent other scripts with event from running Added new JS events that run prior to items being equipped/unequipped, with support for return values: onEquipAttempt( pEquipper, iEquipping ) onUnequipAttempt( pEquipper, iUnequipping ) Return false or nothing to reject attempt to equip/unequip item, and prevent hard-code or other scripts with event from running Return true to allow hard code to run like normal Added new JS event that runs prior to onSnooped event, for character doing the snooping: onSnoopAttempt( snooped, snooper ) Return false or nothing to prevent hard code and other snooping-related events from running Return true to allow hard code and other snooping-related events to run like normal Updated onSnooped JS event to accept return values: Return true when success state is true to prevent other scripts with event from running Return true when success state is false to prevent hard code and other scripts with event from running Updated onClick JS event to also run for characters with event attached (return 1 to prevent showing hard-coded name for whatever object is clicked) Updated onSteal JS event to include a third parameter, an object reference for the target of the theft Added support for assigning multiple JS scripts per object (item, multi, char, region). Any time a scriptID is added to an object, the list of such IDs for that object will be sorted from lowest to highest scriptID, which also determines the execution order for the scripts. Note that if the same JS event is present in several scripts assigned to an object, each of those events will trigger, unless the rules about return values for said event prevent this DFNs for Items, Multis, Characters and Regions can now contain multiple SCRIPT=scriptID tags per definition. Each such SCRIPT tag will be applied to the object in question, then sorted from lowest to highest scriptID by server. Added new JS property for Items, Multis, Characters and Regions: .scriptTriggers // If used to get property, will return array object with all script IDs assigned to object. If used to set property, will add script ID to existing list of script IDs for object. Modified JS property for Items, Multis, Characters and Regions, which for backwards compatibility functions similar to in older versions: .scripttrigger // If used to get property, will return last script ID in list of script IDs assigned to object. If used to set property, will clear list of script IDs and assign only the new ID Added new JS Methods for Items, Multis, Characters and Regions: .AddScriptTrigger( scriptID ) // Adds a new scriptID to list of scripts assigned to object .RemoveScriptTrigger( scriptID ) // Remove a specific scriptID from object (0 = remove all) Moved SETSCPTRIG command from code to JS (js/commands/targeting/scptrig.js), and supplemented it with some additional commands: GETSCPTRIG // List out all scriptIDs assigned to object SETSCPTRIG scriptID // Clears list of scriptIDs for object, then assigns the specified scriptID ADDSCPTRIG scriptID // Adds specified scriptID to list of scriptsIDs assigned to object REMOVESCPTRIG scriptID // Removes specified scriptID from list of scriptIDs assigned to object (0 = remove all)
2021-05-25 19:37:52 +08:00
std::vector<UI16> scriptTriggers = iCreated->GetScriptTriggers();
for( auto scriptTrig : scriptTriggers )
{
cScript *toExecute = JSMapping->GetScript( scriptTrig );
2021-06-12 07:30:23 -04:00
if( toExecute != nullptr )
Minor JS revamp - multiple scripts per object! Added TryParseJSVal() helper function in cScript.cpp, used to parse jsval values returned from script events. Provides results matching 0 (0, false), 1 (1, true) or any specific int value returned from script. JS events updated to use new TryParseJSVal helper function (no change in behaviour): onDecay, onResurrect, onCommand, onBuyFromVendor, onSellToVendor, onPickup, onCharDoubleClick, onSkillGump, onUseBandageMacro, onCombatStart, onCombatEnd, onDeathBlow, onBuy, onSell JS events with slight change of behaviour after update to use TryParseJSVal: onDrop, onDropItemOnItem, onDropItemOnNpc - previously, a blank or non-existent return value would be treated the same as a return true. This will now be treated as a return false. Update scripts accordingly! JS events updated to support return values from scripts: onCollide, onTalk, onSnooped, OnHungerChange Return false or nothing to prevent hard code from running Return true to allow hard code to run like normal onStolenFrom, onAISliver, onLightChange, onVirtueGumpPress, onQuestGump, onSpecialMove, onSwing, onClick, onHouseCommand, onSellToVendor, onSkillCheck, onSpellGain, onSpellLoss Return false to allow hard code and other scripts with event to run like normal Return true to prevent hard code and other scripts with event from running onSteal Return false or nothing to allow hard code and other scripts with event to run like normal Return true to prevent hard code and onStolenFrom event from running (theft failed?) Return 2 to prevent hard code, but allow onStolenFrom event to run (theft succeeded, but handled in script?) onLeaving, onEntrance, onEquip, onUnequip, onEnterEvadeState, onSoldToVendor, onBoughtFromVendor, onSpellSuccess, onSpellTarget, onFlagChange, onDeath Return false or nothing to allow other scripts with event to run like normal Return true to prevent other scripts with event from running Added new JS events that run prior to items being equipped/unequipped, with support for return values: onEquipAttempt( pEquipper, iEquipping ) onUnequipAttempt( pEquipper, iUnequipping ) Return false or nothing to reject attempt to equip/unequip item, and prevent hard-code or other scripts with event from running Return true to allow hard code to run like normal Added new JS event that runs prior to onSnooped event, for character doing the snooping: onSnoopAttempt( snooped, snooper ) Return false or nothing to prevent hard code and other snooping-related events from running Return true to allow hard code and other snooping-related events to run like normal Updated onSnooped JS event to accept return values: Return true when success state is true to prevent other scripts with event from running Return true when success state is false to prevent hard code and other scripts with event from running Updated onClick JS event to also run for characters with event attached (return 1 to prevent showing hard-coded name for whatever object is clicked) Updated onSteal JS event to include a third parameter, an object reference for the target of the theft Added support for assigning multiple JS scripts per object (item, multi, char, region). Any time a scriptID is added to an object, the list of such IDs for that object will be sorted from lowest to highest scriptID, which also determines the execution order for the scripts. Note that if the same JS event is present in several scripts assigned to an object, each of those events will trigger, unless the rules about return values for said event prevent this DFNs for Items, Multis, Characters and Regions can now contain multiple SCRIPT=scriptID tags per definition. Each such SCRIPT tag will be applied to the object in question, then sorted from lowest to highest scriptID by server. Added new JS property for Items, Multis, Characters and Regions: .scriptTriggers // If used to get property, will return array object with all script IDs assigned to object. If used to set property, will add script ID to existing list of script IDs for object. Modified JS property for Items, Multis, Characters and Regions, which for backwards compatibility functions similar to in older versions: .scripttrigger // If used to get property, will return last script ID in list of script IDs assigned to object. If used to set property, will clear list of script IDs and assign only the new ID Added new JS Methods for Items, Multis, Characters and Regions: .AddScriptTrigger( scriptID ) // Adds a new scriptID to list of scripts assigned to object .RemoveScriptTrigger( scriptID ) // Remove a specific scriptID from object (0 = remove all) Moved SETSCPTRIG command from code to JS (js/commands/targeting/scptrig.js), and supplemented it with some additional commands: GETSCPTRIG // List out all scriptIDs assigned to object SETSCPTRIG scriptID // Clears list of scriptIDs for object, then assigns the specified scriptID ADDSCPTRIG scriptID // Adds specified scriptID to list of scriptsIDs assigned to object REMOVESCPTRIG scriptID // Removes specified scriptID from list of scriptIDs assigned to object (0 = remove all)
2021-05-25 19:37:52 +08:00
{
UOX3 0.99.6-RC6 Removed arbitrary and hidden restrictions on refreshing list of online players shown with 'wholist command Fixed an issue where player ghosts that get teleported would not see themselves get updated to new location Fixed a server crash from clients disconnecting while running server in debug mode Improved how container updates are sent to players; now only sends to clients that have actually opened the container, and who are still within range Added more information about UO data files being loaded during server startup Enhanced the GM 'add menu to allow clicking directly on images of items/npcs to add them, and adjusted size of menus to accommodate this Fixed an issue with fleeing NPCs that could cause them to attempt to flee across time and space, regardless of distance to target/attacker in combat Added NPC AI that runs away from players if they get too close (even outside combat). Applied to hind, rabbits, squirrels, ferrets and various birds by default: AI_ANIMAL_SCARED (aitype 12) Fixed issues with NPCs fleeing forever, or getting stuck in flee/don't flee loop, by introducing max fleeing distance (50 tiles) and cooldown (30 sec) on fleeing Updated onNameRequest JS Event to include third parameter with origin of name request, so script responses can be tailored appropriately: onNameRequest( myObj, requestedBy, requestSource ) Potential values for requestSource: 0 - Speech/System Messages 1 - Guild Menus 2 - Stat Window (self) 3 - Stat Window (other) 4 - Tooltip 5 - Paperdoll Journal 6 - Paperdoll 7 - Single Click / All-Names 8 - System 9 - Secure Trade Window Added Adaptive Performance System (APS) that dynamically adjust how often NPC AI/movement is checked based on overall shard performance. If performance drops below defined threshold, UOX3 gradually slows down checks for NPC AI/movement to prioritize player movement/speech/command responsiveness. If performance climbs back up above threshold, slowdowns are gradually removed. The following UOX.INI options have been added under [system] category to support this system: APSPERFTHRESHOLD=50 // Performance threshold (measured in simulation cycles/sec) below which the APS kicks in APSINTERVAL=100 // How often (in milliseconds) the APS checks performance and makes adjustments (if needed) to balance out shard performance APSDELAYSTEP=50 // How much the delay timer is modified by (in milliseconds) each time APS makes adjustments APSDELAYMAXCAP=2000 // Max amount of of delay APS can introduce for NPC AI/movement handling when attempting to restore shard performance Added new JS Methods for Region objects: .GetOrePrefs( oreType ) // Get ore preference data for ore type found in town region. Returned as an array containing the following data: orePrefData -> [ oreName, // name of ore color, // color of ore minskill, // min skill to mine ore ingotName, // name of ingot created from ore makemenu, // makemenu entry for crafting something from ingot oreChance, // default global chance of finding this ore type scriptID // script attached to mined ore ], orePrefChance // Chance of finding this ore type in given town region .GetOreChance() // Get base chance of finding any ore in town region Moved Mining skill plus gravedigging feature from hard code to scripts (js/skill/mining.js) to make it easier to maintain and/or customize, and removed hard coded variants Gravedigging now relies on the ore resource system behind the scenes to restrict how often graves in a given area can be dug up Fixed some incorrect references to .worldNumber Character property in misc scripts (should be .worldnumber) Made some "hard-scripted" system messages in misc scripts use dictionary system instead Added spawn region for banker NPCs in Serpent's Hold (dfndata/spawn/felucca/spawn_town_serpents_hold.dfn, dfndata/spawn/trammel/spawn_town_serpents_hold.dfn) Fixed region definition of Ocllo to actually cover the entire town (dfndata/regions/regions.dfn) Added numerous additional locations accessible with 'goplace # command, for key locations in Ilshenar, Malas, Tokuno Islands and Ter Mur (dfndata/location/location.dfn) Revised travel-menu portion of GM menu (shortcut: 'travel) to include more travel options based on new locations (dfndata/items/travelmenu.dfn and travelmenu.bulk.dfn) Fixed an issue where NPCs could attempt to attack targets in other worlds/instances Added new JS Event that triggers for characters who are about to deal damage in combat. Complimentary to onDamage, which triggers for chars receiving damage: onDamageDeal( dmgDealer, dmgReceiver, damageValue, damageType ) Added new JS Event that can trigger in global script upon creation of new player chars. Note that this will trigger in place of onCreateDFN event for player characters: onCreatePlayer( pChar ) Added new JS Event that triggers for characters selecting a target with a spell. Complimentary to onSpellTarget, which triggers for targets selected with a spell: onSpellTargetSelect( caster, target, spellNum ) Updated onCombatStart and onCombatEnd JS Events to also trigger for the other party in combat Updated onPickup JS Event to include a third parameter - the potential container item was picked up from. Event now also triggers event in scripts attached to said containers: onPickup( iPickedUp, pChar, iCont ) Added tracking of total playtime per individual character, and per account across all characters, and exposed these properties to JS engine: .totalPlayTime // Account property, total playtime across all chars .playTime // Character property, total playtime on given character only Added new player-accessible command ('playtime) to spit out the playtime of current character/account as a whole (js/commands/playtime.js) Implemented first version of Young Player System: Replaced the UNUSED9 account flag with YOUNG, to be used by Young/New Player System Added new JS Account property that gets/sets whether player account is considered Young: .isYoung Added new Char timers: TIMER_YOUNGHEAL // Restricts how often Young players are healed by NPC healers TIMER_YOUNGMESSAGE // Restricts how often Young players are warned about dangerous looking monsters in overworld Updated GM commands 'get and 'set to get/set .isYoung property of player's account (js/commands/targeting/get.js and set.js) Added new UOX.INI setting to enable/disable Young Player System (enabled by default): YOUNGPLAYERSYSTEM=1 If Young Player System is enabled, all newly created player accounts are automatically marked with Young flag Added new script to handle various restrictions and functions related to Young characters (js/player/young_player.js): Young characters will have [Young] displayed over their head Young characters will have their Young status checked and verified on every login + every stat/skill gain, to revoke the Young status if any of the following is true: Account has a total playtime of more than 40 hours Any character has more than 350 total (base) skill points Any character has more than 70 skill points in a single skill Any character has more than 150 total stat points Any character has more than 80 stat points in a single stat Young characters can renounce their Young status manually by saying the words "I renounce my young player status" Young characters get two additional items upon creation: a new player ticket (can be combined with any other players new player ticket for both players to get a reward) a sextant (shows Young players directions to nearest moongate/bank regardless of where they are, as long as outdoors) Young characters cannot target other player characters with hostile spells or skills Young characters cannot be the target of other player characters' hostile spells or skills Young characters can only cast beneficial spells upon themselves or other Young characters Young characters can only be the target of beneficial spells from other Young players Young players (and their pets/followers) cannot attack or harm any other players (or their pets/followers), nor themselves be attacked or harmed by any other players (or their pets/followers), whether from combat, spells, skills or items Young players don't lose any of their items on death, and are teleported to the nearest healer upon death with all their items intact Young players receive a warning upon entering dungeons that monsters there will be hostile Updated global script (js/server/global.js) to: Check/Verify Young status of players upon login Attach young player script on login/creation for players on Young accounts Give specific items to Young players upon creation Added new script (js/item/corpse.js) that is assigned to all freshly created corpses. This script handles restrictions related to Young players interactions with corpses, and the interactions of other players with corpses of Young players Updated JS Method .Carve() to return true/false depending on whether carving a corpse was successful Updated Healer AI in code to heal nearby injured Young players Updated Evil AI and Evil Caster AI in code to avoid selecting Young players as targets in combat outside of dungeons Added a new section to UOX.INI - [young player starting locations] - that can be used to define starting locations for Young players. If only one such location is provided, all players start there. Otherwise, it matches the same starting location setup as the regular one - with one entry per town in Britannia. Restricted transferring and/or friending of pets (code) and hirelings (hirelings.js) between Young and non-Young players Restricted Young players from recalling or gating to Felucca facet Young players can instantly logout from anywhere, at any time
2023-07-01 20:02:40 +08:00
toExecute->OnCreate( iCreated, false, false );
Minor JS revamp - multiple scripts per object! Added TryParseJSVal() helper function in cScript.cpp, used to parse jsval values returned from script events. Provides results matching 0 (0, false), 1 (1, true) or any specific int value returned from script. JS events updated to use new TryParseJSVal helper function (no change in behaviour): onDecay, onResurrect, onCommand, onBuyFromVendor, onSellToVendor, onPickup, onCharDoubleClick, onSkillGump, onUseBandageMacro, onCombatStart, onCombatEnd, onDeathBlow, onBuy, onSell JS events with slight change of behaviour after update to use TryParseJSVal: onDrop, onDropItemOnItem, onDropItemOnNpc - previously, a blank or non-existent return value would be treated the same as a return true. This will now be treated as a return false. Update scripts accordingly! JS events updated to support return values from scripts: onCollide, onTalk, onSnooped, OnHungerChange Return false or nothing to prevent hard code from running Return true to allow hard code to run like normal onStolenFrom, onAISliver, onLightChange, onVirtueGumpPress, onQuestGump, onSpecialMove, onSwing, onClick, onHouseCommand, onSellToVendor, onSkillCheck, onSpellGain, onSpellLoss Return false to allow hard code and other scripts with event to run like normal Return true to prevent hard code and other scripts with event from running onSteal Return false or nothing to allow hard code and other scripts with event to run like normal Return true to prevent hard code and onStolenFrom event from running (theft failed?) Return 2 to prevent hard code, but allow onStolenFrom event to run (theft succeeded, but handled in script?) onLeaving, onEntrance, onEquip, onUnequip, onEnterEvadeState, onSoldToVendor, onBoughtFromVendor, onSpellSuccess, onSpellTarget, onFlagChange, onDeath Return false or nothing to allow other scripts with event to run like normal Return true to prevent other scripts with event from running Added new JS events that run prior to items being equipped/unequipped, with support for return values: onEquipAttempt( pEquipper, iEquipping ) onUnequipAttempt( pEquipper, iUnequipping ) Return false or nothing to reject attempt to equip/unequip item, and prevent hard-code or other scripts with event from running Return true to allow hard code to run like normal Added new JS event that runs prior to onSnooped event, for character doing the snooping: onSnoopAttempt( snooped, snooper ) Return false or nothing to prevent hard code and other snooping-related events from running Return true to allow hard code and other snooping-related events to run like normal Updated onSnooped JS event to accept return values: Return true when success state is true to prevent other scripts with event from running Return true when success state is false to prevent hard code and other scripts with event from running Updated onClick JS event to also run for characters with event attached (return 1 to prevent showing hard-coded name for whatever object is clicked) Updated onSteal JS event to include a third parameter, an object reference for the target of the theft Added support for assigning multiple JS scripts per object (item, multi, char, region). Any time a scriptID is added to an object, the list of such IDs for that object will be sorted from lowest to highest scriptID, which also determines the execution order for the scripts. Note that if the same JS event is present in several scripts assigned to an object, each of those events will trigger, unless the rules about return values for said event prevent this DFNs for Items, Multis, Characters and Regions can now contain multiple SCRIPT=scriptID tags per definition. Each such SCRIPT tag will be applied to the object in question, then sorted from lowest to highest scriptID by server. Added new JS property for Items, Multis, Characters and Regions: .scriptTriggers // If used to get property, will return array object with all script IDs assigned to object. If used to set property, will add script ID to existing list of script IDs for object. Modified JS property for Items, Multis, Characters and Regions, which for backwards compatibility functions similar to in older versions: .scripttrigger // If used to get property, will return last script ID in list of script IDs assigned to object. If used to set property, will clear list of script IDs and assign only the new ID Added new JS Methods for Items, Multis, Characters and Regions: .AddScriptTrigger( scriptID ) // Adds a new scriptID to list of scripts assigned to object .RemoveScriptTrigger( scriptID ) // Remove a specific scriptID from object (0 = remove all) Moved SETSCPTRIG command from code to JS (js/commands/targeting/scptrig.js), and supplemented it with some additional commands: GETSCPTRIG // List out all scriptIDs assigned to object SETSCPTRIG scriptID // Clears list of scriptIDs for object, then assigns the specified scriptID ADDSCPTRIG scriptID // Adds specified scriptID to list of scriptsIDs assigned to object REMOVESCPTRIG scriptID // Removes specified scriptID from list of scriptIDs assigned to object (0 = remove all)
2021-05-25 19:37:52 +08:00
}
}
return PlaceItem( mSock, mChar, iCreated, inPack, worldNumber, instanceId, xLoc, yLoc, zLoc );
}
//o------------------------------------------------------------------------------------------------o
//| Function - cItem::CreateScriptItem()
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 - 10/12/2003
//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 - Creates a script item, gives it an amount, and sets
//| its location (be it in a pack or on the ground).
//o------------------------------------------------------------------------------------------------o
CItem * cItem::CreateScriptItem( CSocket *mSock, CChar *mChar, const std::string &item, const UI16 iAmount,
const ObjectType itemType, bool inPack, const UI16 iColor, bool shouldSave )
{
if( inPack && !ValidateObject( mChar->GetPackItem() ))
{
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
std::string charName = GetNpcDictName( mChar, nullptr, NRS_SYSTEM );
Console.Warning( oldstrutil::format( "CreateScriptItem(): Character %s(0x%X) has no pack, item creation aborted.", charName.c_str(), mChar->GetSerial() ));
2021-06-12 07:30:23 -04:00
return nullptr;
}
Housing Revamp and more Updated JS SysMessage function to accept up to 10 extra, optional arguments, which can be used with dictionary messages that require additional parameters like %s or %i Added new type of house privilege in cMultiObj.cpp to keep track of friends of the multi - HOUSEPRIV_FRIEND - which is stored during worldsaves as one or more Friend=<player serial> tags in house.wsc Added new type of house privilege in cMultiObj.cpp to keep track of guests of the multi - HOUSEPRIV_GUEST - which is stored during worldsaves as one or more Guest=<player serial> tags in house.wsc When items are created for houses upon house placement, a reference to the multi's serial is now stored in the house sign's MORE property to allow easier tracking of which house a particular sign belongs to Added tracking of new, persistent properties for houses via cMultiObj.cpp/h: lockdowns, secure containers, vendors, guests, friends, owners, ban location, public status, number of visits, timestamps Added a multitude of new methods in cMultiObj.cpp/h to assist in improving the functionality of houses Added new tags for houses in house.dfn (default values applied if tag not specified): MAXSECURECONTAINERS=4 - Max amount of secure containers allowed in a multi MAXLOCKDOWNS=256 - Max amount of lockdowns allowed in a multi MAXVENDORS=10 - Max amount of vendors allowed in a multi MAXBANS=50 - Max amount of bans in a multi's ban list MAXFRIENDS=50 - Max amount of friends in a multi's friend list MAXGUESTS=50 - Max amount of guests in a multi's guest list MAXOWNERS=8 - Max amount of owners and co-owners in a multi's owner list MAXTRASHCONTAINERS=1 - Max amount of trash containers allowed in multi SCRIPT=<scriptID> - Assign a JS script-ID directly to a multi FRONTDOOR - indicates that a door is the front door of a house. Cannot be locked in public houses! INTERIORDOOR - indicates that a door is an interior door of a house. Can be locked in public houses. BANX - Location X offset for multi's ban location, if not used, will try to use SE corner of multi instead BANY - Location Y offset for multi's ban location, if not used, will try to use SE corner of multi instead Added JS Event: onHouseCommand( tSock, multiObj, cmdID ) - For handling spoken house commands via JS scripts attached to multi. Updated JS Events: onEntrance() - can now trigger both for multi being entered and/or object entering onLeaving() - can now trigger both for multi being left and/or object entering onSpeech() - can now also trigger for items (in addition to chars) with event & script attached, if UOX.INI setting ITEMSDETECTSPEECH is enabled Added JS Multi methods: .IsBoat() - Returns whether the item (or multi) is a boat .IsOwner( playerToCheck ) - Returns whether a player is the owner of a multi .IsOnOwnerList( playerToCheck ) - Returns whether a player is on the (co-)owner list of a multi .IsOnFriendList( playerToCheck ) - Returns whether a player is on the friend list of a multi .IsOnGuestList( playerToCheck ) - Returns whether a player is on the guest list of a multi .IsOnBanList( playerToCheck ) - Returns whether a player is on the ban list of a multi .AddToFriendList( playertoAdd ) - Adds player to the friend list of a multi .RemoveFromFriendList( playertoRemove ) - Removes player from the friend list of a multi .AddToGuestList( playertoAdd ) - Adds player to the guest list of a multi .RemoveFromGuestList( playertoRemove ) - Removes player from the guest list of a multi .ClearOwnerList() - Clears all entries from a multi's (co-)owner list .ClearFriendList() - Clears all entries from a multi's friend list .ClearGuestList() - Clears all entries from a multi's guest list .ClearBanList() - Clears all entries from a multi's ban list .SecureContainer( itemToSecure ) - Secures a container in a multi .UnsecureContainer( itemToUnsecure ) - Unsecures a container in a multi .IsSecureContainer( itemToCheck ) - Checks if specified item is a secure container in a multi .LockDownItem( itemToLockDown) - Locks down an item in a multi .ReleaseItem( itemToRelease ) - Releases a locked down item in a multi .KillKeys() - Deletes ALL keys associated with a multi .AddTrashCont( itemToAdd ) - Add trash container to multi's list of trash containers .RemoveTrashCont( itemToRemove ) - Remove trash container from multi's list of trash containers Added JS Item (Multi only) properties: .lockdowns - Get the number of lockdowns in a multi .maxLockdowns - Get/Set the max number of lockdowns allowed in a multi .secureContainers - Get the number of secure containers in a multi .maxSecureContainers - Get/Set the max number of secure containers allowed in a multi .trashContainers - Get the number of trash containers in a multi .maxTrashContainers - Get/Set the max number of trash containers allowed in a multi .friends - Get the number of friends in a multi's friend list .maxFriends - Get/Set the max number of friends allowed in a multi's friend list .guests - Get the number of guests in a multi's guest list .maxGuests - Get/Set the max number of guests allowed in a multi's guest list .owners - Get the number of owners in a multi's owner list .maxOwners - Get/Set the max number of owners allowed in a multi's owner list .bans - Get the number of banned players in a multi's ban list .maxBans - Get/Set the max number of banned players allowed in a multi's ban list .vendors - Get the number of player vendors in a multi .maxVendors - Get the max number of player vendors allowed in a multi .deed - Get the item sectionID for deed used to place multi .isPublic - Get/Set the private/public state of a multi .buildTimestamp - Get the timestamp for when the house was originally placed .tradeTimestamp - Get the timestamp for when the house was last traded to another player .banX - Get/Set the ban location X offset for the multi .banY - Get/Set the ban location Y offset for the multi Added JS Character properties: .multi = Get/Set the multi object the character is in .accountNum = Get the account number the character belongs to .housesOwned = Get a count of houses owned by the character .housesCoOwned = Get a count of houses co-owned by the character Updated JS cBaseObject Methods .FirstItem(), .NextItem() and .FinishedItems() to also support iterating through items in multis Updated JS multi Methods .FirstChar(), .NextChar() and .FinishedChars() to support an additional parameter to specify what kind of characters to loop through: "default" or no parameter - all characters inside the multi "owner" - players on multi's owner list "friend" - players on multi's friend list "guest" - players on multi's guest list "banned" - players on multi's ban list Added new INI tags to a new section of uox.ini called [houses] DECAYTIMERINHOUSE=3600 // Decay timer in seconds for non-locked down items inside houses PROTECTPRIVATEHOUSES=1 // Toggles whether private houses will automatically boot unauthorized visitors (1) or not (0) TRACKHOUSESPERACCOUNT=1 // Toggles whether to track (and restrict) house ownership per account (1) or per character (0) MAXHOUSESOWNABLE=1 // Specifies the max amount of houses a player can own per account/char, depending on how house ownership is tracked MAXHOUSESCOOWNABLE=10 // Specifies the max amount of houses a player can co-own per character CANOWNANDCOOWNHOUSES=1 // Toggles whether players can own and co-own houses at the same time COOWNHOUSESONSAMEACCOUNT=1 // Toggles whether characters on same account as house owner will be treated as co-owners Added new INI tags in [settings] section of uox.ini: ITEMSDETECTSPEECH=0 // If enabled, server will search for nearby items with onSpeech JS event running whenever a character speaks. Disabled by default. MAXPLAYERPACKITEMS=125 // Defines max item capacity for player (and NPC) backpacks. Defaults to 125. Moved most of the existing house functionality to JS and expanded upon it to reach feature parity with houses in regular UO around Publish 15/16, with various extras thrown in for good measure and all functionality being customizable: js/server/house/house.js (15000) - handles detection of house commands and characters entering/leaving houses js/server/house/houseSign.js (15001) - contains and handles all house-related gumps/menus and what is shown when players interact with house sign js/server/house/houseCommands.js (15002) - handles functionality of house commands and other functionality such as transfer of ownership, demolishing house, etc. js/server/house/houseDeed.js (15003) - handles initial rules that allow/disallow placement of additional houses for players All house-related menus now fully handled through JS All house commands and other functionality now fully handled through JS Removed redundant hard-coded house functionality Implemented Co-owners, friends, guests for houses, with access rules in place for entry, lockdowns, house commands, etc. Implemented Private and Public houses Implemented Secure Containers and Trash Barrels Definable max lockdowns, secure containers, player vendors, bans, friends, guests, owners, trash containers and more - per house type JS scripts can now be attached directly to houses Doors in houses can be marked as front doors or interior doors, and will be treated differently with regards to private and public houses Added new item to dfndata/items/containers/misc.dfn - [trashbarrel] Added new JS script (js/items/trashbarrel.js) with trash barrel functionality for houses. Trash barrels that are marked as secure containers are only accessible by owners, co-owners and friends of the house. Various options available at top of script. Updated js/items/axe.js to support chopping up trash barrels and house add-ons in houses owned by the player Fixed an issue with house doors being left behind after demolishing houses while their doors were open Fixed an issue where GMs could be banned from player houses Added Line of Sight checks to speech, to give players some privacy in their own homes Updated house placement code to more accurately check for other multis, dynamic and static objects when placing houses; now requires free space around each house that cannot be blocked by other houses or items that can block player movement, and disallows placement of houses on roads Updated house placement code to move characters blocking house placement to SE corner of the house Updated house placement code to disallow placing houses in guarded regions, or in dungeons Added new DFN tag for regions to enable/disable player houses in specific regions: HOUSING=0/1 Added new region (247) that covers path to Valley of Eodon in Felucca Added new region (248) that covers Valley of Eodon in Ter-Mur, with player housing disabled Added new region (249) that covers entire T2A lands, with player housing disabled Updated SPACEX and SPACEY values for all houses in dfndata/house/house.dfn to match updated house placement code Added new JS property to Regions that can be used to determine or change state of player housing in a region: .canPlaceHouse() Updated rules for usage of dye tubs to dye locked down items; now only house owners or co-owners may dye locked down items Updated rules for usage of the following locked down items in a house, which are now only usable by house owners and co-owners Dyes, Guildstone Deeds, Recall Runes (renaming), Rename Deeds, Townstone Deeds, House Deeds, Boat Models, Player Vendor Deeds, Ore, Hair Dye Updated rules for usage of the following locked down items in a house, which are now only usable by house owners, co-owners and friends: Keys, Dye Tubs, Magic Scrolls, Fireworks Wands, Magic Wands, Smithing Tools, Mining Tools, Fishing Poles Updated item lockdown rules to allow locking down (and releasing) items in a container as long as the container is locked down, and to only allow releasing a locked down container if it's empty of locked down items Updated item lockdown rules to only allow locking down movement-blocking items further than 2 tiles away from doors Updated rules for releasing items in houses - now the house owner can release any locked down items, co-owners can release items locked down by themselves or by friends, while friends can release only items locked down by themselves Added some feedback to player about why their attempted house placement failed Items added by GMs directly into multis will now decay based on the house-specific decay timer instead of the regular one Fixed an issue that could cause items to almost instantly decay after being released from lockdown in a house Placing house add-ons now properly takes into account SPACEX and SPACEY values when checking if they can fit in selected area of houses Re-added SPACEX and SPACEY values for Pentagram and Loom house add-ons House add-ons can now be converted back into house add-on deeds by chopping them with an axe Added new item type - IT_HOUSEADDON (201) - used by house add-ons placed in player houses Fixed a bug where keys would stop working after being added to a keyring, and would turn into blank keys upon release from the keyring Added visitor count for public player houses, which keeps track of how many visits a public house has received, with each player counted max 1 time every 24 hours Fixed an issue with FindPlayersInOldVisrange() where it didn't take into account that players could see buildings further away than the standard update range. This could cause players to see ghost images of buildings if they were at the "right" distance when the building was being demolished Added NODECAY tag to all signs and doors in dfndata/house/house.dfn Added FRONTDOOR or INTERIORDOOR (as appropriate) to all doors in dfndata/house/house.dfn Added BANX and BANY to specify ban location for some houses in dfndata/house/house.dfn instead of relying on finding SE corner automatically Implemented strongboxes (js/server/house/strongbox.js) for co-owners of a house, which can be placed with the house command "i wish to place a strongbox". Max capacity is 25 items Updated 'REMOVE command to take an optional parameter - itemID. If supplied, the command will remove all items with this itemID from a targeted container Fixed a bug when checking if dynamic items were blocking valid spawn locations for NPCs, some function arguments were in the wrong order! Improved code that finds valid spawn locations for items and NPCs spawned via spawn regions. As server gradually builds up lists of valid spawn locations per region over time, it will start using these lists more often, rather than always look for brand new spawn locations. Fixed a bug with CMulHandler::CheckStaticFlag() that prevented NPCs from spawning inside buildings with no static floors! Fixed an issue with repeating commands that prevented GMs from being able to cancel them when using the ClassicUO client Exposed character property .accountNum to JS engine Extended CDataList class to include a Clear() method for clearing lists Updated JS File method .Open() to support an optional, third argument - subFolderName - that defines in which sub-folder of UOX3/shared/ to store/look for a file. If no third argument is supplied, UOX3 will default to using the shared folder itself. Updated JS File method .Length() to return a value of -1 for files that don't exist Added new code function, exposed to JS engine with same parameters, which simply checks if a given tile ID has a specific flag bool CheckTileFlag( UI16 itemID, TILEFLAG flagToCheck ) Added JS function used to find the root container of an item (if any) FindRootContainer( itemSerial ) FindRootContainer( item ) Added new JS function that allows deleting files from UOX3/shared/ folder or subfolders of shared folder. If no subFolderName is provided, looks for file directly in shared folder itself. Restrictions on file- and folder-names apply. bool DeleteFile( fileName, subFolderName ) Added new JS functions for checking if a specific client or server feature is enabled. See documentation for full list of client/server features. GetClientFeature( bitNum ) // Returns true if specified client feature is enabled on server GetServerFeature( bitNum ) // Returns true if specified server feature is enabled on server Added new JS function for returning the value of almost any server setting from UOX.INI GetServerSetting( settingNameInDoubleQuotes ) Updated JS function DoesDynamicBlock() with two new parameters - checkOnlyMultis and checkOnlyNonMultis Updated JS function DoesMapBlock() with two new parameters - checkMultiPlacement and checkForRoad Fixed an issue where a LoS check would prevent players from accessing containers in their own backpack Added new functions in findfuncs.cpp to make it easier to find items near another object or location: findNearbyItems( object, distance ) findNearbyItems( x, y, worldNumber, instanceID, distance ) Added new Item property - maxItems - used by containers to determine their max item capacity Added new Item property - totalItemCount - used to get total item count in a container (including sub-containers) Added check for max item capacity when creating new items that are added to a character's backpack - items will be created below character's feet if backpack is full! Added new DFN tag for items, used by containers to determine item capacity for a given container: MAXITEMS=# // 125 is the default for all containers if not set Added new JS Item properties: .maxItems // gets/sets item capacity for a given container .totalItemCount // gets total item count in a container, including sub-containers Updated item tooltips for containers to show accurate total item count, as well as to display max item capacity Fixed a bug where picking up items from a non-locked down pile of items on the floor inside a multi could cause the remaining pile to be seen as no longer inside the multi, disallowing locking it back down and causing it to decay based on regular decay timer instead of house-specific one Updated JS command set to allow setting poison-level on items ('set poison #) and hunger-level on characters ('set hunger #) Fixed an issue with js/item/food.js that prevented poisoned food from poisoning characters when eaten Fixed an issue with js/skill/poisoning.js that prevented players from poisoning food! Updated various JS scripts and hardcoded targeting functions to disallow the targeting of locked down resources using skills and tools Updated JS Method TextMessage() to support three extra, optional parameters. Note that if one optional parameter is included, all preceding optional parameters are also required! speechTarget - What kind of target is this message intended for? 0 - Only visible for sender and receiver of message 1 - Visible to all players in range 2 - Visible to all NPCs and players in range 3 - Visible to all PCs everywhere + NPCs in range 4 - Visible to all PCs everywhere (broadcast) 5 - Only visible for the receiver of the message speechTargetSerial - The serial of the receiver of the message, used if speechTarget is 0 or 5 speechFontType - The type of font to display the text in. Defaults to normal. 0 - Bold 1 - Normal with shadow 2 - Bold with shadow 3 - Normal 4 - Gothic 5 - Italic 6 - Small, dark 7 - Colourful 8 - Runic (only works with CAPS) 9 - Small, light Added timestamp to worldsaves in console, to make it easier to see when a particular world-save was done Added info about compiler/environment displayed at the top of the UOX3 console during startup Updated dictionary files with new messages primarily related to housing
2020-11-04 02:00:37 +08:00
if( inPack )
{
// Check if character's backpack can hold more items before creating any item
CItem *playerPack = mChar->GetPackItem();
if( ValidateObject( playerPack ))
Housing Revamp and more Updated JS SysMessage function to accept up to 10 extra, optional arguments, which can be used with dictionary messages that require additional parameters like %s or %i Added new type of house privilege in cMultiObj.cpp to keep track of friends of the multi - HOUSEPRIV_FRIEND - which is stored during worldsaves as one or more Friend=<player serial> tags in house.wsc Added new type of house privilege in cMultiObj.cpp to keep track of guests of the multi - HOUSEPRIV_GUEST - which is stored during worldsaves as one or more Guest=<player serial> tags in house.wsc When items are created for houses upon house placement, a reference to the multi's serial is now stored in the house sign's MORE property to allow easier tracking of which house a particular sign belongs to Added tracking of new, persistent properties for houses via cMultiObj.cpp/h: lockdowns, secure containers, vendors, guests, friends, owners, ban location, public status, number of visits, timestamps Added a multitude of new methods in cMultiObj.cpp/h to assist in improving the functionality of houses Added new tags for houses in house.dfn (default values applied if tag not specified): MAXSECURECONTAINERS=4 - Max amount of secure containers allowed in a multi MAXLOCKDOWNS=256 - Max amount of lockdowns allowed in a multi MAXVENDORS=10 - Max amount of vendors allowed in a multi MAXBANS=50 - Max amount of bans in a multi's ban list MAXFRIENDS=50 - Max amount of friends in a multi's friend list MAXGUESTS=50 - Max amount of guests in a multi's guest list MAXOWNERS=8 - Max amount of owners and co-owners in a multi's owner list MAXTRASHCONTAINERS=1 - Max amount of trash containers allowed in multi SCRIPT=<scriptID> - Assign a JS script-ID directly to a multi FRONTDOOR - indicates that a door is the front door of a house. Cannot be locked in public houses! INTERIORDOOR - indicates that a door is an interior door of a house. Can be locked in public houses. BANX - Location X offset for multi's ban location, if not used, will try to use SE corner of multi instead BANY - Location Y offset for multi's ban location, if not used, will try to use SE corner of multi instead Added JS Event: onHouseCommand( tSock, multiObj, cmdID ) - For handling spoken house commands via JS scripts attached to multi. Updated JS Events: onEntrance() - can now trigger both for multi being entered and/or object entering onLeaving() - can now trigger both for multi being left and/or object entering onSpeech() - can now also trigger for items (in addition to chars) with event & script attached, if UOX.INI setting ITEMSDETECTSPEECH is enabled Added JS Multi methods: .IsBoat() - Returns whether the item (or multi) is a boat .IsOwner( playerToCheck ) - Returns whether a player is the owner of a multi .IsOnOwnerList( playerToCheck ) - Returns whether a player is on the (co-)owner list of a multi .IsOnFriendList( playerToCheck ) - Returns whether a player is on the friend list of a multi .IsOnGuestList( playerToCheck ) - Returns whether a player is on the guest list of a multi .IsOnBanList( playerToCheck ) - Returns whether a player is on the ban list of a multi .AddToFriendList( playertoAdd ) - Adds player to the friend list of a multi .RemoveFromFriendList( playertoRemove ) - Removes player from the friend list of a multi .AddToGuestList( playertoAdd ) - Adds player to the guest list of a multi .RemoveFromGuestList( playertoRemove ) - Removes player from the guest list of a multi .ClearOwnerList() - Clears all entries from a multi's (co-)owner list .ClearFriendList() - Clears all entries from a multi's friend list .ClearGuestList() - Clears all entries from a multi's guest list .ClearBanList() - Clears all entries from a multi's ban list .SecureContainer( itemToSecure ) - Secures a container in a multi .UnsecureContainer( itemToUnsecure ) - Unsecures a container in a multi .IsSecureContainer( itemToCheck ) - Checks if specified item is a secure container in a multi .LockDownItem( itemToLockDown) - Locks down an item in a multi .ReleaseItem( itemToRelease ) - Releases a locked down item in a multi .KillKeys() - Deletes ALL keys associated with a multi .AddTrashCont( itemToAdd ) - Add trash container to multi's list of trash containers .RemoveTrashCont( itemToRemove ) - Remove trash container from multi's list of trash containers Added JS Item (Multi only) properties: .lockdowns - Get the number of lockdowns in a multi .maxLockdowns - Get/Set the max number of lockdowns allowed in a multi .secureContainers - Get the number of secure containers in a multi .maxSecureContainers - Get/Set the max number of secure containers allowed in a multi .trashContainers - Get the number of trash containers in a multi .maxTrashContainers - Get/Set the max number of trash containers allowed in a multi .friends - Get the number of friends in a multi's friend list .maxFriends - Get/Set the max number of friends allowed in a multi's friend list .guests - Get the number of guests in a multi's guest list .maxGuests - Get/Set the max number of guests allowed in a multi's guest list .owners - Get the number of owners in a multi's owner list .maxOwners - Get/Set the max number of owners allowed in a multi's owner list .bans - Get the number of banned players in a multi's ban list .maxBans - Get/Set the max number of banned players allowed in a multi's ban list .vendors - Get the number of player vendors in a multi .maxVendors - Get the max number of player vendors allowed in a multi .deed - Get the item sectionID for deed used to place multi .isPublic - Get/Set the private/public state of a multi .buildTimestamp - Get the timestamp for when the house was originally placed .tradeTimestamp - Get the timestamp for when the house was last traded to another player .banX - Get/Set the ban location X offset for the multi .banY - Get/Set the ban location Y offset for the multi Added JS Character properties: .multi = Get/Set the multi object the character is in .accountNum = Get the account number the character belongs to .housesOwned = Get a count of houses owned by the character .housesCoOwned = Get a count of houses co-owned by the character Updated JS cBaseObject Methods .FirstItem(), .NextItem() and .FinishedItems() to also support iterating through items in multis Updated JS multi Methods .FirstChar(), .NextChar() and .FinishedChars() to support an additional parameter to specify what kind of characters to loop through: "default" or no parameter - all characters inside the multi "owner" - players on multi's owner list "friend" - players on multi's friend list "guest" - players on multi's guest list "banned" - players on multi's ban list Added new INI tags to a new section of uox.ini called [houses] DECAYTIMERINHOUSE=3600 // Decay timer in seconds for non-locked down items inside houses PROTECTPRIVATEHOUSES=1 // Toggles whether private houses will automatically boot unauthorized visitors (1) or not (0) TRACKHOUSESPERACCOUNT=1 // Toggles whether to track (and restrict) house ownership per account (1) or per character (0) MAXHOUSESOWNABLE=1 // Specifies the max amount of houses a player can own per account/char, depending on how house ownership is tracked MAXHOUSESCOOWNABLE=10 // Specifies the max amount of houses a player can co-own per character CANOWNANDCOOWNHOUSES=1 // Toggles whether players can own and co-own houses at the same time COOWNHOUSESONSAMEACCOUNT=1 // Toggles whether characters on same account as house owner will be treated as co-owners Added new INI tags in [settings] section of uox.ini: ITEMSDETECTSPEECH=0 // If enabled, server will search for nearby items with onSpeech JS event running whenever a character speaks. Disabled by default. MAXPLAYERPACKITEMS=125 // Defines max item capacity for player (and NPC) backpacks. Defaults to 125. Moved most of the existing house functionality to JS and expanded upon it to reach feature parity with houses in regular UO around Publish 15/16, with various extras thrown in for good measure and all functionality being customizable: js/server/house/house.js (15000) - handles detection of house commands and characters entering/leaving houses js/server/house/houseSign.js (15001) - contains and handles all house-related gumps/menus and what is shown when players interact with house sign js/server/house/houseCommands.js (15002) - handles functionality of house commands and other functionality such as transfer of ownership, demolishing house, etc. js/server/house/houseDeed.js (15003) - handles initial rules that allow/disallow placement of additional houses for players All house-related menus now fully handled through JS All house commands and other functionality now fully handled through JS Removed redundant hard-coded house functionality Implemented Co-owners, friends, guests for houses, with access rules in place for entry, lockdowns, house commands, etc. Implemented Private and Public houses Implemented Secure Containers and Trash Barrels Definable max lockdowns, secure containers, player vendors, bans, friends, guests, owners, trash containers and more - per house type JS scripts can now be attached directly to houses Doors in houses can be marked as front doors or interior doors, and will be treated differently with regards to private and public houses Added new item to dfndata/items/containers/misc.dfn - [trashbarrel] Added new JS script (js/items/trashbarrel.js) with trash barrel functionality for houses. Trash barrels that are marked as secure containers are only accessible by owners, co-owners and friends of the house. Various options available at top of script. Updated js/items/axe.js to support chopping up trash barrels and house add-ons in houses owned by the player Fixed an issue with house doors being left behind after demolishing houses while their doors were open Fixed an issue where GMs could be banned from player houses Added Line of Sight checks to speech, to give players some privacy in their own homes Updated house placement code to more accurately check for other multis, dynamic and static objects when placing houses; now requires free space around each house that cannot be blocked by other houses or items that can block player movement, and disallows placement of houses on roads Updated house placement code to move characters blocking house placement to SE corner of the house Updated house placement code to disallow placing houses in guarded regions, or in dungeons Added new DFN tag for regions to enable/disable player houses in specific regions: HOUSING=0/1 Added new region (247) that covers path to Valley of Eodon in Felucca Added new region (248) that covers Valley of Eodon in Ter-Mur, with player housing disabled Added new region (249) that covers entire T2A lands, with player housing disabled Updated SPACEX and SPACEY values for all houses in dfndata/house/house.dfn to match updated house placement code Added new JS property to Regions that can be used to determine or change state of player housing in a region: .canPlaceHouse() Updated rules for usage of dye tubs to dye locked down items; now only house owners or co-owners may dye locked down items Updated rules for usage of the following locked down items in a house, which are now only usable by house owners and co-owners Dyes, Guildstone Deeds, Recall Runes (renaming), Rename Deeds, Townstone Deeds, House Deeds, Boat Models, Player Vendor Deeds, Ore, Hair Dye Updated rules for usage of the following locked down items in a house, which are now only usable by house owners, co-owners and friends: Keys, Dye Tubs, Magic Scrolls, Fireworks Wands, Magic Wands, Smithing Tools, Mining Tools, Fishing Poles Updated item lockdown rules to allow locking down (and releasing) items in a container as long as the container is locked down, and to only allow releasing a locked down container if it's empty of locked down items Updated item lockdown rules to only allow locking down movement-blocking items further than 2 tiles away from doors Updated rules for releasing items in houses - now the house owner can release any locked down items, co-owners can release items locked down by themselves or by friends, while friends can release only items locked down by themselves Added some feedback to player about why their attempted house placement failed Items added by GMs directly into multis will now decay based on the house-specific decay timer instead of the regular one Fixed an issue that could cause items to almost instantly decay after being released from lockdown in a house Placing house add-ons now properly takes into account SPACEX and SPACEY values when checking if they can fit in selected area of houses Re-added SPACEX and SPACEY values for Pentagram and Loom house add-ons House add-ons can now be converted back into house add-on deeds by chopping them with an axe Added new item type - IT_HOUSEADDON (201) - used by house add-ons placed in player houses Fixed a bug where keys would stop working after being added to a keyring, and would turn into blank keys upon release from the keyring Added visitor count for public player houses, which keeps track of how many visits a public house has received, with each player counted max 1 time every 24 hours Fixed an issue with FindPlayersInOldVisrange() where it didn't take into account that players could see buildings further away than the standard update range. This could cause players to see ghost images of buildings if they were at the "right" distance when the building was being demolished Added NODECAY tag to all signs and doors in dfndata/house/house.dfn Added FRONTDOOR or INTERIORDOOR (as appropriate) to all doors in dfndata/house/house.dfn Added BANX and BANY to specify ban location for some houses in dfndata/house/house.dfn instead of relying on finding SE corner automatically Implemented strongboxes (js/server/house/strongbox.js) for co-owners of a house, which can be placed with the house command "i wish to place a strongbox". Max capacity is 25 items Updated 'REMOVE command to take an optional parameter - itemID. If supplied, the command will remove all items with this itemID from a targeted container Fixed a bug when checking if dynamic items were blocking valid spawn locations for NPCs, some function arguments were in the wrong order! Improved code that finds valid spawn locations for items and NPCs spawned via spawn regions. As server gradually builds up lists of valid spawn locations per region over time, it will start using these lists more often, rather than always look for brand new spawn locations. Fixed a bug with CMulHandler::CheckStaticFlag() that prevented NPCs from spawning inside buildings with no static floors! Fixed an issue with repeating commands that prevented GMs from being able to cancel them when using the ClassicUO client Exposed character property .accountNum to JS engine Extended CDataList class to include a Clear() method for clearing lists Updated JS File method .Open() to support an optional, third argument - subFolderName - that defines in which sub-folder of UOX3/shared/ to store/look for a file. If no third argument is supplied, UOX3 will default to using the shared folder itself. Updated JS File method .Length() to return a value of -1 for files that don't exist Added new code function, exposed to JS engine with same parameters, which simply checks if a given tile ID has a specific flag bool CheckTileFlag( UI16 itemID, TILEFLAG flagToCheck ) Added JS function used to find the root container of an item (if any) FindRootContainer( itemSerial ) FindRootContainer( item ) Added new JS function that allows deleting files from UOX3/shared/ folder or subfolders of shared folder. If no subFolderName is provided, looks for file directly in shared folder itself. Restrictions on file- and folder-names apply. bool DeleteFile( fileName, subFolderName ) Added new JS functions for checking if a specific client or server feature is enabled. See documentation for full list of client/server features. GetClientFeature( bitNum ) // Returns true if specified client feature is enabled on server GetServerFeature( bitNum ) // Returns true if specified server feature is enabled on server Added new JS function for returning the value of almost any server setting from UOX.INI GetServerSetting( settingNameInDoubleQuotes ) Updated JS function DoesDynamicBlock() with two new parameters - checkOnlyMultis and checkOnlyNonMultis Updated JS function DoesMapBlock() with two new parameters - checkMultiPlacement and checkForRoad Fixed an issue where a LoS check would prevent players from accessing containers in their own backpack Added new functions in findfuncs.cpp to make it easier to find items near another object or location: findNearbyItems( object, distance ) findNearbyItems( x, y, worldNumber, instanceID, distance ) Added new Item property - maxItems - used by containers to determine their max item capacity Added new Item property - totalItemCount - used to get total item count in a container (including sub-containers) Added check for max item capacity when creating new items that are added to a character's backpack - items will be created below character's feet if backpack is full! Added new DFN tag for items, used by containers to determine item capacity for a given container: MAXITEMS=# // 125 is the default for all containers if not set Added new JS Item properties: .maxItems // gets/sets item capacity for a given container .totalItemCount // gets total item count in a container, including sub-containers Updated item tooltips for containers to show accurate total item count, as well as to display max item capacity Fixed a bug where picking up items from a non-locked down pile of items on the floor inside a multi could cause the remaining pile to be seen as no longer inside the multi, disallowing locking it back down and causing it to decay based on regular decay timer instead of house-specific one Updated JS command set to allow setting poison-level on items ('set poison #) and hunger-level on characters ('set hunger #) Fixed an issue with js/item/food.js that prevented poisoned food from poisoning characters when eaten Fixed an issue with js/skill/poisoning.js that prevented players from poisoning food! Updated various JS scripts and hardcoded targeting functions to disallow the targeting of locked down resources using skills and tools Updated JS Method TextMessage() to support three extra, optional parameters. Note that if one optional parameter is included, all preceding optional parameters are also required! speechTarget - What kind of target is this message intended for? 0 - Only visible for sender and receiver of message 1 - Visible to all players in range 2 - Visible to all NPCs and players in range 3 - Visible to all PCs everywhere + NPCs in range 4 - Visible to all PCs everywhere (broadcast) 5 - Only visible for the receiver of the message speechTargetSerial - The serial of the receiver of the message, used if speechTarget is 0 or 5 speechFontType - The type of font to display the text in. Defaults to normal. 0 - Bold 1 - Normal with shadow 2 - Bold with shadow 3 - Normal 4 - Gothic 5 - Italic 6 - Small, dark 7 - Colourful 8 - Runic (only works with CAPS) 9 - Small, light Added timestamp to worldsaves in console, to make it easier to see when a particular world-save was done Added info about compiler/environment displayed at the top of the UOX3 console during startup Updated dictionary files with new messages primarily related to housing
2020-11-04 02:00:37 +08:00
{
if( playerPack->GetContainsList()->Num() >= playerPack->GetMaxItems() )
{
2021-06-12 07:30:23 -04:00
if( mSock != nullptr )
{
mSock->SysMessage( 1819 ); // Your backpack cannot hold any more items!
}
Housing Revamp and more Updated JS SysMessage function to accept up to 10 extra, optional arguments, which can be used with dictionary messages that require additional parameters like %s or %i Added new type of house privilege in cMultiObj.cpp to keep track of friends of the multi - HOUSEPRIV_FRIEND - which is stored during worldsaves as one or more Friend=<player serial> tags in house.wsc Added new type of house privilege in cMultiObj.cpp to keep track of guests of the multi - HOUSEPRIV_GUEST - which is stored during worldsaves as one or more Guest=<player serial> tags in house.wsc When items are created for houses upon house placement, a reference to the multi's serial is now stored in the house sign's MORE property to allow easier tracking of which house a particular sign belongs to Added tracking of new, persistent properties for houses via cMultiObj.cpp/h: lockdowns, secure containers, vendors, guests, friends, owners, ban location, public status, number of visits, timestamps Added a multitude of new methods in cMultiObj.cpp/h to assist in improving the functionality of houses Added new tags for houses in house.dfn (default values applied if tag not specified): MAXSECURECONTAINERS=4 - Max amount of secure containers allowed in a multi MAXLOCKDOWNS=256 - Max amount of lockdowns allowed in a multi MAXVENDORS=10 - Max amount of vendors allowed in a multi MAXBANS=50 - Max amount of bans in a multi's ban list MAXFRIENDS=50 - Max amount of friends in a multi's friend list MAXGUESTS=50 - Max amount of guests in a multi's guest list MAXOWNERS=8 - Max amount of owners and co-owners in a multi's owner list MAXTRASHCONTAINERS=1 - Max amount of trash containers allowed in multi SCRIPT=<scriptID> - Assign a JS script-ID directly to a multi FRONTDOOR - indicates that a door is the front door of a house. Cannot be locked in public houses! INTERIORDOOR - indicates that a door is an interior door of a house. Can be locked in public houses. BANX - Location X offset for multi's ban location, if not used, will try to use SE corner of multi instead BANY - Location Y offset for multi's ban location, if not used, will try to use SE corner of multi instead Added JS Event: onHouseCommand( tSock, multiObj, cmdID ) - For handling spoken house commands via JS scripts attached to multi. Updated JS Events: onEntrance() - can now trigger both for multi being entered and/or object entering onLeaving() - can now trigger both for multi being left and/or object entering onSpeech() - can now also trigger for items (in addition to chars) with event & script attached, if UOX.INI setting ITEMSDETECTSPEECH is enabled Added JS Multi methods: .IsBoat() - Returns whether the item (or multi) is a boat .IsOwner( playerToCheck ) - Returns whether a player is the owner of a multi .IsOnOwnerList( playerToCheck ) - Returns whether a player is on the (co-)owner list of a multi .IsOnFriendList( playerToCheck ) - Returns whether a player is on the friend list of a multi .IsOnGuestList( playerToCheck ) - Returns whether a player is on the guest list of a multi .IsOnBanList( playerToCheck ) - Returns whether a player is on the ban list of a multi .AddToFriendList( playertoAdd ) - Adds player to the friend list of a multi .RemoveFromFriendList( playertoRemove ) - Removes player from the friend list of a multi .AddToGuestList( playertoAdd ) - Adds player to the guest list of a multi .RemoveFromGuestList( playertoRemove ) - Removes player from the guest list of a multi .ClearOwnerList() - Clears all entries from a multi's (co-)owner list .ClearFriendList() - Clears all entries from a multi's friend list .ClearGuestList() - Clears all entries from a multi's guest list .ClearBanList() - Clears all entries from a multi's ban list .SecureContainer( itemToSecure ) - Secures a container in a multi .UnsecureContainer( itemToUnsecure ) - Unsecures a container in a multi .IsSecureContainer( itemToCheck ) - Checks if specified item is a secure container in a multi .LockDownItem( itemToLockDown) - Locks down an item in a multi .ReleaseItem( itemToRelease ) - Releases a locked down item in a multi .KillKeys() - Deletes ALL keys associated with a multi .AddTrashCont( itemToAdd ) - Add trash container to multi's list of trash containers .RemoveTrashCont( itemToRemove ) - Remove trash container from multi's list of trash containers Added JS Item (Multi only) properties: .lockdowns - Get the number of lockdowns in a multi .maxLockdowns - Get/Set the max number of lockdowns allowed in a multi .secureContainers - Get the number of secure containers in a multi .maxSecureContainers - Get/Set the max number of secure containers allowed in a multi .trashContainers - Get the number of trash containers in a multi .maxTrashContainers - Get/Set the max number of trash containers allowed in a multi .friends - Get the number of friends in a multi's friend list .maxFriends - Get/Set the max number of friends allowed in a multi's friend list .guests - Get the number of guests in a multi's guest list .maxGuests - Get/Set the max number of guests allowed in a multi's guest list .owners - Get the number of owners in a multi's owner list .maxOwners - Get/Set the max number of owners allowed in a multi's owner list .bans - Get the number of banned players in a multi's ban list .maxBans - Get/Set the max number of banned players allowed in a multi's ban list .vendors - Get the number of player vendors in a multi .maxVendors - Get the max number of player vendors allowed in a multi .deed - Get the item sectionID for deed used to place multi .isPublic - Get/Set the private/public state of a multi .buildTimestamp - Get the timestamp for when the house was originally placed .tradeTimestamp - Get the timestamp for when the house was last traded to another player .banX - Get/Set the ban location X offset for the multi .banY - Get/Set the ban location Y offset for the multi Added JS Character properties: .multi = Get/Set the multi object the character is in .accountNum = Get the account number the character belongs to .housesOwned = Get a count of houses owned by the character .housesCoOwned = Get a count of houses co-owned by the character Updated JS cBaseObject Methods .FirstItem(), .NextItem() and .FinishedItems() to also support iterating through items in multis Updated JS multi Methods .FirstChar(), .NextChar() and .FinishedChars() to support an additional parameter to specify what kind of characters to loop through: "default" or no parameter - all characters inside the multi "owner" - players on multi's owner list "friend" - players on multi's friend list "guest" - players on multi's guest list "banned" - players on multi's ban list Added new INI tags to a new section of uox.ini called [houses] DECAYTIMERINHOUSE=3600 // Decay timer in seconds for non-locked down items inside houses PROTECTPRIVATEHOUSES=1 // Toggles whether private houses will automatically boot unauthorized visitors (1) or not (0) TRACKHOUSESPERACCOUNT=1 // Toggles whether to track (and restrict) house ownership per account (1) or per character (0) MAXHOUSESOWNABLE=1 // Specifies the max amount of houses a player can own per account/char, depending on how house ownership is tracked MAXHOUSESCOOWNABLE=10 // Specifies the max amount of houses a player can co-own per character CANOWNANDCOOWNHOUSES=1 // Toggles whether players can own and co-own houses at the same time COOWNHOUSESONSAMEACCOUNT=1 // Toggles whether characters on same account as house owner will be treated as co-owners Added new INI tags in [settings] section of uox.ini: ITEMSDETECTSPEECH=0 // If enabled, server will search for nearby items with onSpeech JS event running whenever a character speaks. Disabled by default. MAXPLAYERPACKITEMS=125 // Defines max item capacity for player (and NPC) backpacks. Defaults to 125. Moved most of the existing house functionality to JS and expanded upon it to reach feature parity with houses in regular UO around Publish 15/16, with various extras thrown in for good measure and all functionality being customizable: js/server/house/house.js (15000) - handles detection of house commands and characters entering/leaving houses js/server/house/houseSign.js (15001) - contains and handles all house-related gumps/menus and what is shown when players interact with house sign js/server/house/houseCommands.js (15002) - handles functionality of house commands and other functionality such as transfer of ownership, demolishing house, etc. js/server/house/houseDeed.js (15003) - handles initial rules that allow/disallow placement of additional houses for players All house-related menus now fully handled through JS All house commands and other functionality now fully handled through JS Removed redundant hard-coded house functionality Implemented Co-owners, friends, guests for houses, with access rules in place for entry, lockdowns, house commands, etc. Implemented Private and Public houses Implemented Secure Containers and Trash Barrels Definable max lockdowns, secure containers, player vendors, bans, friends, guests, owners, trash containers and more - per house type JS scripts can now be attached directly to houses Doors in houses can be marked as front doors or interior doors, and will be treated differently with regards to private and public houses Added new item to dfndata/items/containers/misc.dfn - [trashbarrel] Added new JS script (js/items/trashbarrel.js) with trash barrel functionality for houses. Trash barrels that are marked as secure containers are only accessible by owners, co-owners and friends of the house. Various options available at top of script. Updated js/items/axe.js to support chopping up trash barrels and house add-ons in houses owned by the player Fixed an issue with house doors being left behind after demolishing houses while their doors were open Fixed an issue where GMs could be banned from player houses Added Line of Sight checks to speech, to give players some privacy in their own homes Updated house placement code to more accurately check for other multis, dynamic and static objects when placing houses; now requires free space around each house that cannot be blocked by other houses or items that can block player movement, and disallows placement of houses on roads Updated house placement code to move characters blocking house placement to SE corner of the house Updated house placement code to disallow placing houses in guarded regions, or in dungeons Added new DFN tag for regions to enable/disable player houses in specific regions: HOUSING=0/1 Added new region (247) that covers path to Valley of Eodon in Felucca Added new region (248) that covers Valley of Eodon in Ter-Mur, with player housing disabled Added new region (249) that covers entire T2A lands, with player housing disabled Updated SPACEX and SPACEY values for all houses in dfndata/house/house.dfn to match updated house placement code Added new JS property to Regions that can be used to determine or change state of player housing in a region: .canPlaceHouse() Updated rules for usage of dye tubs to dye locked down items; now only house owners or co-owners may dye locked down items Updated rules for usage of the following locked down items in a house, which are now only usable by house owners and co-owners Dyes, Guildstone Deeds, Recall Runes (renaming), Rename Deeds, Townstone Deeds, House Deeds, Boat Models, Player Vendor Deeds, Ore, Hair Dye Updated rules for usage of the following locked down items in a house, which are now only usable by house owners, co-owners and friends: Keys, Dye Tubs, Magic Scrolls, Fireworks Wands, Magic Wands, Smithing Tools, Mining Tools, Fishing Poles Updated item lockdown rules to allow locking down (and releasing) items in a container as long as the container is locked down, and to only allow releasing a locked down container if it's empty of locked down items Updated item lockdown rules to only allow locking down movement-blocking items further than 2 tiles away from doors Updated rules for releasing items in houses - now the house owner can release any locked down items, co-owners can release items locked down by themselves or by friends, while friends can release only items locked down by themselves Added some feedback to player about why their attempted house placement failed Items added by GMs directly into multis will now decay based on the house-specific decay timer instead of the regular one Fixed an issue that could cause items to almost instantly decay after being released from lockdown in a house Placing house add-ons now properly takes into account SPACEX and SPACEY values when checking if they can fit in selected area of houses Re-added SPACEX and SPACEY values for Pentagram and Loom house add-ons House add-ons can now be converted back into house add-on deeds by chopping them with an axe Added new item type - IT_HOUSEADDON (201) - used by house add-ons placed in player houses Fixed a bug where keys would stop working after being added to a keyring, and would turn into blank keys upon release from the keyring Added visitor count for public player houses, which keeps track of how many visits a public house has received, with each player counted max 1 time every 24 hours Fixed an issue with FindPlayersInOldVisrange() where it didn't take into account that players could see buildings further away than the standard update range. This could cause players to see ghost images of buildings if they were at the "right" distance when the building was being demolished Added NODECAY tag to all signs and doors in dfndata/house/house.dfn Added FRONTDOOR or INTERIORDOOR (as appropriate) to all doors in dfndata/house/house.dfn Added BANX and BANY to specify ban location for some houses in dfndata/house/house.dfn instead of relying on finding SE corner automatically Implemented strongboxes (js/server/house/strongbox.js) for co-owners of a house, which can be placed with the house command "i wish to place a strongbox". Max capacity is 25 items Updated 'REMOVE command to take an optional parameter - itemID. If supplied, the command will remove all items with this itemID from a targeted container Fixed a bug when checking if dynamic items were blocking valid spawn locations for NPCs, some function arguments were in the wrong order! Improved code that finds valid spawn locations for items and NPCs spawned via spawn regions. As server gradually builds up lists of valid spawn locations per region over time, it will start using these lists more often, rather than always look for brand new spawn locations. Fixed a bug with CMulHandler::CheckStaticFlag() that prevented NPCs from spawning inside buildings with no static floors! Fixed an issue with repeating commands that prevented GMs from being able to cancel them when using the ClassicUO client Exposed character property .accountNum to JS engine Extended CDataList class to include a Clear() method for clearing lists Updated JS File method .Open() to support an optional, third argument - subFolderName - that defines in which sub-folder of UOX3/shared/ to store/look for a file. If no third argument is supplied, UOX3 will default to using the shared folder itself. Updated JS File method .Length() to return a value of -1 for files that don't exist Added new code function, exposed to JS engine with same parameters, which simply checks if a given tile ID has a specific flag bool CheckTileFlag( UI16 itemID, TILEFLAG flagToCheck ) Added JS function used to find the root container of an item (if any) FindRootContainer( itemSerial ) FindRootContainer( item ) Added new JS function that allows deleting files from UOX3/shared/ folder or subfolders of shared folder. If no subFolderName is provided, looks for file directly in shared folder itself. Restrictions on file- and folder-names apply. bool DeleteFile( fileName, subFolderName ) Added new JS functions for checking if a specific client or server feature is enabled. See documentation for full list of client/server features. GetClientFeature( bitNum ) // Returns true if specified client feature is enabled on server GetServerFeature( bitNum ) // Returns true if specified server feature is enabled on server Added new JS function for returning the value of almost any server setting from UOX.INI GetServerSetting( settingNameInDoubleQuotes ) Updated JS function DoesDynamicBlock() with two new parameters - checkOnlyMultis and checkOnlyNonMultis Updated JS function DoesMapBlock() with two new parameters - checkMultiPlacement and checkForRoad Fixed an issue where a LoS check would prevent players from accessing containers in their own backpack Added new functions in findfuncs.cpp to make it easier to find items near another object or location: findNearbyItems( object, distance ) findNearbyItems( x, y, worldNumber, instanceID, distance ) Added new Item property - maxItems - used by containers to determine their max item capacity Added new Item property - totalItemCount - used to get total item count in a container (including sub-containers) Added check for max item capacity when creating new items that are added to a character's backpack - items will be created below character's feet if backpack is full! Added new DFN tag for items, used by containers to determine item capacity for a given container: MAXITEMS=# // 125 is the default for all containers if not set Added new JS Item properties: .maxItems // gets/sets item capacity for a given container .totalItemCount // gets total item count in a container, including sub-containers Updated item tooltips for containers to show accurate total item count, as well as to display max item capacity Fixed a bug where picking up items from a non-locked down pile of items on the floor inside a multi could cause the remaining pile to be seen as no longer inside the multi, disallowing locking it back down and causing it to decay based on regular decay timer instead of house-specific one Updated JS command set to allow setting poison-level on items ('set poison #) and hunger-level on characters ('set hunger #) Fixed an issue with js/item/food.js that prevented poisoned food from poisoning characters when eaten Fixed an issue with js/skill/poisoning.js that prevented players from poisoning food! Updated various JS scripts and hardcoded targeting functions to disallow the targeting of locked down resources using skills and tools Updated JS Method TextMessage() to support three extra, optional parameters. Note that if one optional parameter is included, all preceding optional parameters are also required! speechTarget - What kind of target is this message intended for? 0 - Only visible for sender and receiver of message 1 - Visible to all players in range 2 - Visible to all NPCs and players in range 3 - Visible to all PCs everywhere + NPCs in range 4 - Visible to all PCs everywhere (broadcast) 5 - Only visible for the receiver of the message speechTargetSerial - The serial of the receiver of the message, used if speechTarget is 0 or 5 speechFontType - The type of font to display the text in. Defaults to normal. 0 - Bold 1 - Normal with shadow 2 - Bold with shadow 3 - Normal 4 - Gothic 5 - Italic 6 - Small, dark 7 - Colourful 8 - Runic (only works with CAPS) 9 - Small, light Added timestamp to worldsaves in console, to make it easier to see when a particular world-save was done Added info about compiler/environment displayed at the top of the UOX3 console during startup Updated dictionary files with new messages primarily related to housing
2020-11-04 02:00:37 +08:00
inPack = false; // Spawn item at character's feet instead
}
}
}
CItem *iCreated = CreateBaseScriptItem( nullptr, item, mChar->WorldNumber(), iAmount, mChar->GetInstanceId(), itemType, 0xFFFF, shouldSave );
2021-06-12 07:30:23 -04:00
if( iCreated == nullptr )
return nullptr;
if( iColor != 0xFFFF )
{
iCreated->SetColour( iColor );
}
if( iAmount > 1 && !iCreated->IsPileable() )
{
// Turns out we need to spawn more than one item, let's do that here:
2021-06-12 07:30:23 -04:00
CItem *iCreated2 = nullptr;
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
for( UI16 i = 1; i < iAmount; i++ )
{
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
if( inPack )
{
CItem *mPack = mChar->GetPackItem();
iCreated2 = CreateBaseScriptItem( mPack, item, mChar->WorldNumber(), 1, mChar->GetInstanceId(), itemType );
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
}
else
{
iCreated2 = CreateBaseScriptItem( nullptr, item, mChar->WorldNumber(), 1, mChar->GetInstanceId(), itemType );
}
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
if( iCreated2 )
{
if( iColor != 0xFFFF )
{
iCreated2->SetColour( iColor );
}
PlaceItem( mSock, mChar, iCreated2, inPack );
}
}
}
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
// Return the original item created in the function.
return PlaceItem( mSock, mChar, iCreated, inPack );
}
//o------------------------------------------------------------------------------------------------o
//| Function - cItem::*CreateRandomItem()
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 - 10/12/2003
//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 - Creates a random item from an itemlist in specified dfn file,
//| gives it a random buy/sell value, and places it
//o------------------------------------------------------------------------------------------------o
CItem *cItem::CreateRandomItem( CSocket *mSock, const std::string& itemList )
{
CChar *mChar = mSock->CurrcharObj();
if( !ValidateObject( mChar ))
2021-06-12 07:30:23 -04:00
return nullptr;
CItem *iCreated = CreateRandomItem( nullptr, itemList, mChar->WorldNumber(), mChar->GetInstanceId() );
2021-06-12 07:30:23 -04:00
if( iCreated == nullptr )
return nullptr;
if( iCreated->GetBuyValue() != 0 )
{
iCreated->SetBuyValue( RandomNum( static_cast<UI32>( 1 ), iCreated->GetBuyValue() ));
iCreated->SetSellValue( static_cast<UI32>( iCreated->GetBuyValue() / 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
if( iCreated->GetHP() != 0 )
{
iCreated->SetHP( static_cast<SI16>( RandomNum( static_cast<SI16>( 1 ), iCreated->GetHP() )));
}
return PlaceItem( mSock, mChar, iCreated, true );
}
//o------------------------------------------------------------------------------------------------o
//| Function - cItem::CreateRandomItem()
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 - 10/12/2003
//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 - Creates a random item from an itemlist in specified dfn file
//o------------------------------------------------------------------------------------------------o
auto cItem::CreateRandomItem( CItem *mCont, const std::string& sItemList, const UI08 worldNum, const UI16 instanceId, bool shouldSave, bool useLootlist ) -> CItem *
{
CItem *iCreated = nullptr;
2022-06-09 11:41:07 -04:00
std::string sect;
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
// Are we looking for a LOOTLIST, or an ITEMLIST?
if( useLootlist )
{
2022-06-09 11:41:07 -04:00
sect = "LOOTLIST "s + sItemList;
}
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
else
{
2022-06-09 11:41:07 -04:00
sect = "ITEMLIST "s + sItemList;
}
2022-06-09 11:41:07 -04:00
sect = oldstrutil::trim( oldstrutil::removeTrailing( sect, "//" ));
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
// This is never "blank", since we assign "LOOTLIST" or "ITEMLIST" in the previous step!!
if( sect == "blank" ) // The itemlist-entry is just a blank filler item
return nullptr;
// Look up the relevant LOOTLIST or ITEMLIST from DFNs
auto ItemList = FileLookup->FindEntry( sect, items_def );
if( ItemList )
{
// Count the number of entries in the list
const size_t itemListSize = ItemList->NumEntries();
if( itemListSize > 0 )
{
int itemEntryToSpawn = -1;
int sum_of_weight = 0;
// Let's see if the entries in the list are setup with randomization weights,
// and sum them all up if that's the case. Format of string:
// weight|sectionName,amount
// weight|sectionName,amountMin amountMax
// weight|LOOTLIST=sectionName,amount
// weight|LOOTLIST=sectionName,amountMin amountMax
// weight|ITEMLIST=sectionName,amount
// weight|ITEMLIST=sectionName,amountMin amountMax
2022-11-04 17:12:13 -04:00
for( size_t j = 0; j < itemListSize; j++ )
{
// Split string for entry into a stringlist, based on | as a separator
auto csecs = oldstrutil::sections( oldstrutil::trim( oldstrutil::removeTrailing( ItemList->MoveTo( j ), "//" )), "|" );
if( csecs.size() == 2 )
{
// The entry has a weight assigned to it - let's add the weight to the total
sum_of_weight += static_cast<int>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( csecs[0], "//" )), nullptr, 0 ));
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
}
else
{
// The entry has no weight assigned to it - add a default weight of 1
sum_of_weight += 1;
}
}
// Choose a random number between 0 and the total sum of all weights
Thief Revamp - 0.99.6-RC5 Added script for NPC guildmasters (js/npc/ai/guildmaster.js). Only one NPC guild has been setup in the script so far (more can be easily added) - the Thieves Guild - which if joined grants players the ability to steal from other players and to buy disguise kits Added two new NPCs, which there will now spawn one of in a random location in each city in Britannia (felucca facet): m_thief_guildmaster (dfndata/npc/male_human.dfn) f_thief_guildmaster (dfndata/npc/female_Human.dfn) Added two new character properties to keep track of which NPC guild a player (or NPC) belongs to. These properties have been exposed as the following Character JS properties: .npcGuild // ID of NPC guild, as defined in script .npcGuildJoined // Timestamp for when player joined NPC guild Added script for Disguise Kits (js/item/disguisekit.js). These allow members of the Thieves Guild to disguise themselves from the prying eyes of other players. Added two new character properties: .isDisguised // true/false flag for character being disguised .origName // used to store character's original name before disguise went into effect Moved implementation of Stealing skill from code to script (js/skill/stealing.js) and revamped it completely in the process. Changes include: New features: Town rare stealing - any item marked as "special stealable" with new item property .stealable can be stolen, even if it's locked down by a GM on the ground, or inside a container When stealing from item piles, thief can potentially steal the amount of items that makes up the max weight limit for what they can steal, from those piles Chance to successfully steal is now affected by whether there are any characters (NPCs or Players) that witness the attempt. Depends on distance to character, and direction character is facing Players now become "permagrey" when successfully stealing from another player, regardless of whether it's witnessed Players now receive a "stealing" flag when stealing from another player, regardless of whether it's witnessed Stolen items cannot be removed from thief's backpack for 30 seconds following the theft of the item (AoS core shard era and above) Optional AoS feature to steal special consumable items from monsters Updated default stealing rules: Updated calculations to determine chance of success when stealing Players cannot steal while engaged in combat Players are revealed if hidden as soon as they use the stealing skill Players can no longer steal items in the secure trade window Players can no longer steal items from NPC shopkeepers Both hands must be free to steal Stealing now checks line of sight to target player/object Only members of Thieves Guild (NPC guild) can now steal from other players, unless they are guild enemies Players can no longer steal from NPC guards by default Players can no longer steal from the same NPC monster more than once Only gold and gems can be stolen from innocent players in dungeon/ll areas of Felucca, if core shard era is set to AoS or higher Players can no longer steal items held on cursor by other players Orcish masks now eplode if player steals from orcs while wearing it If core shard era is set to LBR or lower, player is marked as an aggressor if they steal from another player Guards can only be called on players that are flagged as criminals within the first 10 seconds of them being flagged Stealing script options: Allow stealing entire containers (off by default pre-AoS) Return stolen items on thief death (off by default) Temporarily make stolen items immovable in thief's backpack (on by default post-AoS) Temporarily protect traded items (on by default) Let dexterity affect chance for successful theft (off by default) Let light level affect chance for successful theft (off by default) Allow stealing from NPC Guards (off by default) Allow stealing special loot from monsters (on by default post-ml) Moved implementation of Snooping skill from code to script (js/skill/snooping.js), with some changes: Players cannot snoop pack animals from inside a house, if the animal is outside The deeper inside main backpack a container sits, the harder it becomes to snoop inside it Included an optional feature that lets targets of snooping gradually become more aware, increasing the difficulty of succeeding. This awareness fades over time. Players have a chance to stay hidden while snooping, based on their Hiding skill Karma is now lowered by snooping regardless of success or failure Added tracking system for "aggressors" in combat. A player attacking someone (regardless of flag status) will be marked as aggressor to that someone for 2 minutes Added tracking system for "permagrey" flags - these are stored on a per-target basis, so a player can be flagged visibly as permagrey to multiple other players. Persists until player dies. Player combat targets and war mode are now cleared on logout Players will now be unable to hide if within visual distance and in line of sight of their attacker or current target in combat Server leave-announcement now only happens after the logout timer has expired, instead of the exact moment the player presses the logout button Fixed an issue that could cause swimming NPCs to swim on land NPCs now have the ability to temporarily ignore unreachable targets in combat. If attacked by someone they are ignoring, they will enter evade state and try to move away from that someone. SpawnRegions now support NPCLISTS with weighted entries. Example of an NPCLIST with 75% chance of spawning some kind of orc, and 25% chance of spawning a ratman archer: [NPCLIST example] { 75|NPCLIST=allorc 25|ratman } Added 3 additional "all purpose" item properties (.more0, .more1 and .more2) and exposed those to JS engine. These work the same as more/morex/morey/morez Mark spell now stores a 4th property on recall runes - instanceID. This is stored in the rune's .more0 property. Recall and Gate spells now check the recall rune (or runebook)'s 4th location property - instanceID - to determine where the player ends up Fixed a server crash related to equipment being automatically unequipped if character is no longer strong enough to have it equipped Added new JS Function to check if any characters at specified location potentially block movement: DoesCharacterBlock( x, y, z, worldNum, instanceID ) // returns true if a character exists at given coordinate (within z +/- 4)
2023-06-20 02:21:16 +08:00
int rndChoice = RandomNum( 0, sum_of_weight - 1 );
int itemWeight = 0;
// Prepare a vector to hold multiple entries, if more than one qualifies based on weighting
std::vector<int> matchingEntries;
// Loop through the items in the itemlist/lootlist
int weightOfChosenItem = 0;
for( auto j = 0; j < static_cast<int>( itemListSize ); j++ )
{
auto csecs = oldstrutil::sections( oldstrutil::trim( oldstrutil::removeTrailing( ItemList->MoveTo( j ), "//" )), "|" );
if( csecs.size() == 2 )
{
// Ok, item entry has a weight, let's compare that weight to our chosen random number
itemWeight = static_cast<int>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( csecs[0], "//" )), nullptr, 0 ));
if( rndChoice < itemWeight )
{
// If we find another entry with same weight as the first one found, or if none have been found yet, add to list
if( weightOfChosenItem == 0 || weightOfChosenItem == itemWeight )
{
itemEntryToSpawn = j;
weightOfChosenItem = itemWeight;
// Add the entry index to a temporary vector of all entries with same weight, then continue looking for more!
matchingEntries.push_back( j );
continue;
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
}
}
rndChoice -= itemWeight;
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
}
}
// Did we find more than one entry that matched our random weight criteria?
Thief Revamp - 0.99.6-RC5 Added script for NPC guildmasters (js/npc/ai/guildmaster.js). Only one NPC guild has been setup in the script so far (more can be easily added) - the Thieves Guild - which if joined grants players the ability to steal from other players and to buy disguise kits Added two new NPCs, which there will now spawn one of in a random location in each city in Britannia (felucca facet): m_thief_guildmaster (dfndata/npc/male_human.dfn) f_thief_guildmaster (dfndata/npc/female_Human.dfn) Added two new character properties to keep track of which NPC guild a player (or NPC) belongs to. These properties have been exposed as the following Character JS properties: .npcGuild // ID of NPC guild, as defined in script .npcGuildJoined // Timestamp for when player joined NPC guild Added script for Disguise Kits (js/item/disguisekit.js). These allow members of the Thieves Guild to disguise themselves from the prying eyes of other players. Added two new character properties: .isDisguised // true/false flag for character being disguised .origName // used to store character's original name before disguise went into effect Moved implementation of Stealing skill from code to script (js/skill/stealing.js) and revamped it completely in the process. Changes include: New features: Town rare stealing - any item marked as "special stealable" with new item property .stealable can be stolen, even if it's locked down by a GM on the ground, or inside a container When stealing from item piles, thief can potentially steal the amount of items that makes up the max weight limit for what they can steal, from those piles Chance to successfully steal is now affected by whether there are any characters (NPCs or Players) that witness the attempt. Depends on distance to character, and direction character is facing Players now become "permagrey" when successfully stealing from another player, regardless of whether it's witnessed Players now receive a "stealing" flag when stealing from another player, regardless of whether it's witnessed Stolen items cannot be removed from thief's backpack for 30 seconds following the theft of the item (AoS core shard era and above) Optional AoS feature to steal special consumable items from monsters Updated default stealing rules: Updated calculations to determine chance of success when stealing Players cannot steal while engaged in combat Players are revealed if hidden as soon as they use the stealing skill Players can no longer steal items in the secure trade window Players can no longer steal items from NPC shopkeepers Both hands must be free to steal Stealing now checks line of sight to target player/object Only members of Thieves Guild (NPC guild) can now steal from other players, unless they are guild enemies Players can no longer steal from NPC guards by default Players can no longer steal from the same NPC monster more than once Only gold and gems can be stolen from innocent players in dungeon/ll areas of Felucca, if core shard era is set to AoS or higher Players can no longer steal items held on cursor by other players Orcish masks now eplode if player steals from orcs while wearing it If core shard era is set to LBR or lower, player is marked as an aggressor if they steal from another player Guards can only be called on players that are flagged as criminals within the first 10 seconds of them being flagged Stealing script options: Allow stealing entire containers (off by default pre-AoS) Return stolen items on thief death (off by default) Temporarily make stolen items immovable in thief's backpack (on by default post-AoS) Temporarily protect traded items (on by default) Let dexterity affect chance for successful theft (off by default) Let light level affect chance for successful theft (off by default) Allow stealing from NPC Guards (off by default) Allow stealing special loot from monsters (on by default post-ml) Moved implementation of Snooping skill from code to script (js/skill/snooping.js), with some changes: Players cannot snoop pack animals from inside a house, if the animal is outside The deeper inside main backpack a container sits, the harder it becomes to snoop inside it Included an optional feature that lets targets of snooping gradually become more aware, increasing the difficulty of succeeding. This awareness fades over time. Players have a chance to stay hidden while snooping, based on their Hiding skill Karma is now lowered by snooping regardless of success or failure Added tracking system for "aggressors" in combat. A player attacking someone (regardless of flag status) will be marked as aggressor to that someone for 2 minutes Added tracking system for "permagrey" flags - these are stored on a per-target basis, so a player can be flagged visibly as permagrey to multiple other players. Persists until player dies. Player combat targets and war mode are now cleared on logout Players will now be unable to hide if within visual distance and in line of sight of their attacker or current target in combat Server leave-announcement now only happens after the logout timer has expired, instead of the exact moment the player presses the logout button Fixed an issue that could cause swimming NPCs to swim on land NPCs now have the ability to temporarily ignore unreachable targets in combat. If attacked by someone they are ignoring, they will enter evade state and try to move away from that someone. SpawnRegions now support NPCLISTS with weighted entries. Example of an NPCLIST with 75% chance of spawning some kind of orc, and 25% chance of spawning a ratman archer: [NPCLIST example] { 75|NPCLIST=allorc 25|ratman } Added 3 additional "all purpose" item properties (.more0, .more1 and .more2) and exposed those to JS engine. These work the same as more/morex/morey/morez Mark spell now stores a 4th property on recall runes - instanceID. This is stored in the rune's .more0 property. Recall and Gate spells now check the recall rune (or runebook)'s 4th location property - instanceID - to determine where the player ends up Fixed a server crash related to equipment being automatically unequipped if character is no longer strong enough to have it equipped Added new JS Function to check if any characters at specified location potentially block movement: DoesCharacterBlock( x, y, z, worldNum, instanceID ) // returns true if a character exists at given coordinate (within z +/- 4)
2023-06-20 02:21:16 +08:00
if( matchingEntries.size() > 0 )
{
// Choose a random one of these!
Thief Revamp - 0.99.6-RC5 Added script for NPC guildmasters (js/npc/ai/guildmaster.js). Only one NPC guild has been setup in the script so far (more can be easily added) - the Thieves Guild - which if joined grants players the ability to steal from other players and to buy disguise kits Added two new NPCs, which there will now spawn one of in a random location in each city in Britannia (felucca facet): m_thief_guildmaster (dfndata/npc/male_human.dfn) f_thief_guildmaster (dfndata/npc/female_Human.dfn) Added two new character properties to keep track of which NPC guild a player (or NPC) belongs to. These properties have been exposed as the following Character JS properties: .npcGuild // ID of NPC guild, as defined in script .npcGuildJoined // Timestamp for when player joined NPC guild Added script for Disguise Kits (js/item/disguisekit.js). These allow members of the Thieves Guild to disguise themselves from the prying eyes of other players. Added two new character properties: .isDisguised // true/false flag for character being disguised .origName // used to store character's original name before disguise went into effect Moved implementation of Stealing skill from code to script (js/skill/stealing.js) and revamped it completely in the process. Changes include: New features: Town rare stealing - any item marked as "special stealable" with new item property .stealable can be stolen, even if it's locked down by a GM on the ground, or inside a container When stealing from item piles, thief can potentially steal the amount of items that makes up the max weight limit for what they can steal, from those piles Chance to successfully steal is now affected by whether there are any characters (NPCs or Players) that witness the attempt. Depends on distance to character, and direction character is facing Players now become "permagrey" when successfully stealing from another player, regardless of whether it's witnessed Players now receive a "stealing" flag when stealing from another player, regardless of whether it's witnessed Stolen items cannot be removed from thief's backpack for 30 seconds following the theft of the item (AoS core shard era and above) Optional AoS feature to steal special consumable items from monsters Updated default stealing rules: Updated calculations to determine chance of success when stealing Players cannot steal while engaged in combat Players are revealed if hidden as soon as they use the stealing skill Players can no longer steal items in the secure trade window Players can no longer steal items from NPC shopkeepers Both hands must be free to steal Stealing now checks line of sight to target player/object Only members of Thieves Guild (NPC guild) can now steal from other players, unless they are guild enemies Players can no longer steal from NPC guards by default Players can no longer steal from the same NPC monster more than once Only gold and gems can be stolen from innocent players in dungeon/ll areas of Felucca, if core shard era is set to AoS or higher Players can no longer steal items held on cursor by other players Orcish masks now eplode if player steals from orcs while wearing it If core shard era is set to LBR or lower, player is marked as an aggressor if they steal from another player Guards can only be called on players that are flagged as criminals within the first 10 seconds of them being flagged Stealing script options: Allow stealing entire containers (off by default pre-AoS) Return stolen items on thief death (off by default) Temporarily make stolen items immovable in thief's backpack (on by default post-AoS) Temporarily protect traded items (on by default) Let dexterity affect chance for successful theft (off by default) Let light level affect chance for successful theft (off by default) Allow stealing from NPC Guards (off by default) Allow stealing special loot from monsters (on by default post-ml) Moved implementation of Snooping skill from code to script (js/skill/snooping.js), with some changes: Players cannot snoop pack animals from inside a house, if the animal is outside The deeper inside main backpack a container sits, the harder it becomes to snoop inside it Included an optional feature that lets targets of snooping gradually become more aware, increasing the difficulty of succeeding. This awareness fades over time. Players have a chance to stay hidden while snooping, based on their Hiding skill Karma is now lowered by snooping regardless of success or failure Added tracking system for "aggressors" in combat. A player attacking someone (regardless of flag status) will be marked as aggressor to that someone for 2 minutes Added tracking system for "permagrey" flags - these are stored on a per-target basis, so a player can be flagged visibly as permagrey to multiple other players. Persists until player dies. Player combat targets and war mode are now cleared on logout Players will now be unable to hide if within visual distance and in line of sight of their attacker or current target in combat Server leave-announcement now only happens after the logout timer has expired, instead of the exact moment the player presses the logout button Fixed an issue that could cause swimming NPCs to swim on land NPCs now have the ability to temporarily ignore unreachable targets in combat. If attacked by someone they are ignoring, they will enter evade state and try to move away from that someone. SpawnRegions now support NPCLISTS with weighted entries. Example of an NPCLIST with 75% chance of spawning some kind of orc, and 25% chance of spawning a ratman archer: [NPCLIST example] { 75|NPCLIST=allorc 25|ratman } Added 3 additional "all purpose" item properties (.more0, .more1 and .more2) and exposed those to JS engine. These work the same as more/morex/morey/morez Mark spell now stores a 4th property on recall runes - instanceID. This is stored in the rune's .more0 property. Recall and Gate spells now check the recall rune (or runebook)'s 4th location property - instanceID - to determine where the player ends up Fixed a server crash related to equipment being automatically unequipped if character is no longer strong enough to have it equipped Added new JS Function to check if any characters at specified location potentially block movement: DoesCharacterBlock( x, y, z, worldNum, instanceID ) // returns true if a character exists at given coordinate (within z +/- 4)
2023-06-20 02:21:16 +08:00
itemEntryToSpawn = matchingEntries[static_cast<int>( RandomNum( static_cast<size_t>( 0 ), matchingEntries.size() - 1 ))];
}
matchingEntries.clear();
std::string k = "";
std::vector<std::string> csecs;
if( itemEntryToSpawn != -1 )
{
// If an entry has been selected based on weights, use that
csecs = oldstrutil::sections( oldstrutil::trim( oldstrutil::removeTrailing( ItemList->MoveTo( itemEntryToSpawn ), "//" )), "," );
}
else
{
// Otherwise choose a random entry
csecs = oldstrutil::sections( oldstrutil::trim( oldstrutil::removeTrailing( ItemList->MoveTo( RandomNum( static_cast<size_t>( 0 ), itemListSize - 1 )), "//" )), "," );
}
Thief Revamp - 0.99.6-RC5 Added script for NPC guildmasters (js/npc/ai/guildmaster.js). Only one NPC guild has been setup in the script so far (more can be easily added) - the Thieves Guild - which if joined grants players the ability to steal from other players and to buy disguise kits Added two new NPCs, which there will now spawn one of in a random location in each city in Britannia (felucca facet): m_thief_guildmaster (dfndata/npc/male_human.dfn) f_thief_guildmaster (dfndata/npc/female_Human.dfn) Added two new character properties to keep track of which NPC guild a player (or NPC) belongs to. These properties have been exposed as the following Character JS properties: .npcGuild // ID of NPC guild, as defined in script .npcGuildJoined // Timestamp for when player joined NPC guild Added script for Disguise Kits (js/item/disguisekit.js). These allow members of the Thieves Guild to disguise themselves from the prying eyes of other players. Added two new character properties: .isDisguised // true/false flag for character being disguised .origName // used to store character's original name before disguise went into effect Moved implementation of Stealing skill from code to script (js/skill/stealing.js) and revamped it completely in the process. Changes include: New features: Town rare stealing - any item marked as "special stealable" with new item property .stealable can be stolen, even if it's locked down by a GM on the ground, or inside a container When stealing from item piles, thief can potentially steal the amount of items that makes up the max weight limit for what they can steal, from those piles Chance to successfully steal is now affected by whether there are any characters (NPCs or Players) that witness the attempt. Depends on distance to character, and direction character is facing Players now become "permagrey" when successfully stealing from another player, regardless of whether it's witnessed Players now receive a "stealing" flag when stealing from another player, regardless of whether it's witnessed Stolen items cannot be removed from thief's backpack for 30 seconds following the theft of the item (AoS core shard era and above) Optional AoS feature to steal special consumable items from monsters Updated default stealing rules: Updated calculations to determine chance of success when stealing Players cannot steal while engaged in combat Players are revealed if hidden as soon as they use the stealing skill Players can no longer steal items in the secure trade window Players can no longer steal items from NPC shopkeepers Both hands must be free to steal Stealing now checks line of sight to target player/object Only members of Thieves Guild (NPC guild) can now steal from other players, unless they are guild enemies Players can no longer steal from NPC guards by default Players can no longer steal from the same NPC monster more than once Only gold and gems can be stolen from innocent players in dungeon/ll areas of Felucca, if core shard era is set to AoS or higher Players can no longer steal items held on cursor by other players Orcish masks now eplode if player steals from orcs while wearing it If core shard era is set to LBR or lower, player is marked as an aggressor if they steal from another player Guards can only be called on players that are flagged as criminals within the first 10 seconds of them being flagged Stealing script options: Allow stealing entire containers (off by default pre-AoS) Return stolen items on thief death (off by default) Temporarily make stolen items immovable in thief's backpack (on by default post-AoS) Temporarily protect traded items (on by default) Let dexterity affect chance for successful theft (off by default) Let light level affect chance for successful theft (off by default) Allow stealing from NPC Guards (off by default) Allow stealing special loot from monsters (on by default post-ml) Moved implementation of Snooping skill from code to script (js/skill/snooping.js), with some changes: Players cannot snoop pack animals from inside a house, if the animal is outside The deeper inside main backpack a container sits, the harder it becomes to snoop inside it Included an optional feature that lets targets of snooping gradually become more aware, increasing the difficulty of succeeding. This awareness fades over time. Players have a chance to stay hidden while snooping, based on their Hiding skill Karma is now lowered by snooping regardless of success or failure Added tracking system for "aggressors" in combat. A player attacking someone (regardless of flag status) will be marked as aggressor to that someone for 2 minutes Added tracking system for "permagrey" flags - these are stored on a per-target basis, so a player can be flagged visibly as permagrey to multiple other players. Persists until player dies. Player combat targets and war mode are now cleared on logout Players will now be unable to hide if within visual distance and in line of sight of their attacker or current target in combat Server leave-announcement now only happens after the logout timer has expired, instead of the exact moment the player presses the logout button Fixed an issue that could cause swimming NPCs to swim on land NPCs now have the ability to temporarily ignore unreachable targets in combat. If attacked by someone they are ignoring, they will enter evade state and try to move away from that someone. SpawnRegions now support NPCLISTS with weighted entries. Example of an NPCLIST with 75% chance of spawning some kind of orc, and 25% chance of spawning a ratman archer: [NPCLIST example] { 75|NPCLIST=allorc 25|ratman } Added 3 additional "all purpose" item properties (.more0, .more1 and .more2) and exposed those to JS engine. These work the same as more/morex/morey/morez Mark spell now stores a 4th property on recall runes - instanceID. This is stored in the rune's .more0 property. Recall and Gate spells now check the recall rune (or runebook)'s 4th location property - instanceID - to determine where the player ends up Fixed a server crash related to equipment being automatically unequipped if character is no longer strong enough to have it equipped Added new JS Function to check if any characters at specified location potentially block movement: DoesCharacterBlock( x, y, z, worldNum, instanceID ) // returns true if a character exists at given coordinate (within z +/- 4)
2023-06-20 02:21:16 +08:00
auto csecs2 = oldstrutil::sections( oldstrutil::trim( csecs[0] ), "|" );
k = csecs2.size() > 1 ? csecs2[1] : csecs2[0];
// Also fetch amount to spawn, if specified
Thief Revamp - 0.99.6-RC5 Added script for NPC guildmasters (js/npc/ai/guildmaster.js). Only one NPC guild has been setup in the script so far (more can be easily added) - the Thieves Guild - which if joined grants players the ability to steal from other players and to buy disguise kits Added two new NPCs, which there will now spawn one of in a random location in each city in Britannia (felucca facet): m_thief_guildmaster (dfndata/npc/male_human.dfn) f_thief_guildmaster (dfndata/npc/female_Human.dfn) Added two new character properties to keep track of which NPC guild a player (or NPC) belongs to. These properties have been exposed as the following Character JS properties: .npcGuild // ID of NPC guild, as defined in script .npcGuildJoined // Timestamp for when player joined NPC guild Added script for Disguise Kits (js/item/disguisekit.js). These allow members of the Thieves Guild to disguise themselves from the prying eyes of other players. Added two new character properties: .isDisguised // true/false flag for character being disguised .origName // used to store character's original name before disguise went into effect Moved implementation of Stealing skill from code to script (js/skill/stealing.js) and revamped it completely in the process. Changes include: New features: Town rare stealing - any item marked as "special stealable" with new item property .stealable can be stolen, even if it's locked down by a GM on the ground, or inside a container When stealing from item piles, thief can potentially steal the amount of items that makes up the max weight limit for what they can steal, from those piles Chance to successfully steal is now affected by whether there are any characters (NPCs or Players) that witness the attempt. Depends on distance to character, and direction character is facing Players now become "permagrey" when successfully stealing from another player, regardless of whether it's witnessed Players now receive a "stealing" flag when stealing from another player, regardless of whether it's witnessed Stolen items cannot be removed from thief's backpack for 30 seconds following the theft of the item (AoS core shard era and above) Optional AoS feature to steal special consumable items from monsters Updated default stealing rules: Updated calculations to determine chance of success when stealing Players cannot steal while engaged in combat Players are revealed if hidden as soon as they use the stealing skill Players can no longer steal items in the secure trade window Players can no longer steal items from NPC shopkeepers Both hands must be free to steal Stealing now checks line of sight to target player/object Only members of Thieves Guild (NPC guild) can now steal from other players, unless they are guild enemies Players can no longer steal from NPC guards by default Players can no longer steal from the same NPC monster more than once Only gold and gems can be stolen from innocent players in dungeon/ll areas of Felucca, if core shard era is set to AoS or higher Players can no longer steal items held on cursor by other players Orcish masks now eplode if player steals from orcs while wearing it If core shard era is set to LBR or lower, player is marked as an aggressor if they steal from another player Guards can only be called on players that are flagged as criminals within the first 10 seconds of them being flagged Stealing script options: Allow stealing entire containers (off by default pre-AoS) Return stolen items on thief death (off by default) Temporarily make stolen items immovable in thief's backpack (on by default post-AoS) Temporarily protect traded items (on by default) Let dexterity affect chance for successful theft (off by default) Let light level affect chance for successful theft (off by default) Allow stealing from NPC Guards (off by default) Allow stealing special loot from monsters (on by default post-ml) Moved implementation of Snooping skill from code to script (js/skill/snooping.js), with some changes: Players cannot snoop pack animals from inside a house, if the animal is outside The deeper inside main backpack a container sits, the harder it becomes to snoop inside it Included an optional feature that lets targets of snooping gradually become more aware, increasing the difficulty of succeeding. This awareness fades over time. Players have a chance to stay hidden while snooping, based on their Hiding skill Karma is now lowered by snooping regardless of success or failure Added tracking system for "aggressors" in combat. A player attacking someone (regardless of flag status) will be marked as aggressor to that someone for 2 minutes Added tracking system for "permagrey" flags - these are stored on a per-target basis, so a player can be flagged visibly as permagrey to multiple other players. Persists until player dies. Player combat targets and war mode are now cleared on logout Players will now be unable to hide if within visual distance and in line of sight of their attacker or current target in combat Server leave-announcement now only happens after the logout timer has expired, instead of the exact moment the player presses the logout button Fixed an issue that could cause swimming NPCs to swim on land NPCs now have the ability to temporarily ignore unreachable targets in combat. If attacked by someone they are ignoring, they will enter evade state and try to move away from that someone. SpawnRegions now support NPCLISTS with weighted entries. Example of an NPCLIST with 75% chance of spawning some kind of orc, and 25% chance of spawning a ratman archer: [NPCLIST example] { 75|NPCLIST=allorc 25|ratman } Added 3 additional "all purpose" item properties (.more0, .more1 and .more2) and exposed those to JS engine. These work the same as more/morex/morey/morez Mark spell now stores a 4th property on recall runes - instanceID. This is stored in the rune's .more0 property. Recall and Gate spells now check the recall rune (or runebook)'s 4th location property - instanceID - to determine where the player ends up Fixed a server crash related to equipment being automatically unequipped if character is no longer strong enough to have it equipped Added new JS Function to check if any characters at specified location potentially block movement: DoesCharacterBlock( x, y, z, worldNum, instanceID ) // returns true if a character exists at given coordinate (within z +/- 4)
2023-06-20 02:21:16 +08:00
int amountToSpawn = 1;
if( csecs.size() > 1 )
{
// UI16 iAmount = 0;
std::string amountData = oldstrutil::trim( oldstrutil::removeTrailing( csecs[1], "//" ));
auto tsects = oldstrutil::sections( amountData, " " );
if( tsects.size() > 1 ) // check if the second part of the tag-data contains two sections separated by a space
{
auto first = static_cast<UI16>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( tsects[0], "//" )), nullptr, 0 ));
auto second = static_cast<UI16>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( tsects[1], "//" )), nullptr, 0 ));
// Tag contained a minimum and maximum value for amount! Let's randomize!
amountToSpawn = static_cast<UI16>( RandomNum( first, second ));
}
else
{
amountToSpawn = static_cast<UI16>( std::stoul(amountData, nullptr, 0 ));
}
}
if( !k.empty() )
{
if( oldstrutil::upper( k ) == "ITEMLIST" || oldstrutil::upper( k ) == "LOOTLIST" )
{
// The chosen entry contained another ITEMLIST or LOOTLIST reference! Let's dive back into it...
iCreated = CreateRandomItem( mCont, ItemList->GrabData(), worldNum, instanceId, shouldSave );
}
else
{
// Finally, we have an item! Spawn it!
iCreated = CreateBaseScriptItem( nullptr, k, worldNum, amountToSpawn, instanceId, OT_ITEM, 0xFFFF, shouldSave );
// However, we have a valid container, and the amount is larger than 1, and the item is not stackable, let's spawn some more items!
if( ValidateObject( mCont ) && amountToSpawn > 1 && !iCreated->IsPileable() )
{
for( int i = 1; i < amountToSpawn; i++ )
{
CItem *iCreated2 = CreateBaseScriptItem( mCont, k, worldNum, 1, instanceId, OT_ITEM, 0xFFFF, shouldSave );
if( ValidateObject( iCreated2 ))
{
// Place item in container and randomize location
iCreated2->SetCont( mCont );
iCreated2->PlaceInPack();
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
}
}
}
}
}
}
}
return iCreated;
}
//o------------------------------------------------------------------------------------------------o
//| Function - cItem::CreateMulti()
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 - 10/12/2003
//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 - Creates a multi, and looks for an entry in harditems.dfn
//o------------------------------------------------------------------------------------------------o
CMultiObj * cItem::CreateMulti( const std::string& cName, const UI16 itemId, const bool isBoat, const UI16 worldNum, const UI16 instanceId, const bool isBaseMulti )
{
CMultiObj *mCreated = static_cast<CMultiObj *>( ObjectFactory::GetSingleton().CreateObject(( isBoat ) ? OT_BOAT : OT_MULTI ));
2021-06-12 07:30:23 -04:00
if( mCreated == nullptr )
return nullptr;
mCreated->SetId( itemId );
if( !isBaseMulti )
{
GetScriptItemSettings( mCreated );
}
mCreated->WorldNumber( worldNum );
mCreated->SetInstanceId( instanceId );
mCreated->SetDecayable( false );
if( !cName.empty() )
{
mCreated->SetName( cName );
}
return mCreated;
}
//o------------------------------------------------------------------------------------------------o
//| Function - CItem *CreateBaseItem( const UI08 worldNum, const ObjectType itemType, const UI16 instanceId )
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 - 10/12/2003
//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 - Creates a basic item
//o------------------------------------------------------------------------------------------------o
CItem * cItem::CreateBaseItem( const UI08 worldNum, const ObjectType itemType, const UI16 instanceId, bool shouldSave )
{
if( itemType != OT_ITEM && itemType != OT_SPAWNER )
2021-06-12 07:30:23 -04:00
return nullptr;
CItem *iCreated = static_cast<CItem *>( ObjectFactory::GetSingleton().CreateObject( itemType ));
2021-06-12 07:30:23 -04:00
if( iCreated == nullptr )
return nullptr;
0.99.4x Fixed an issue where the color of NPC corpse names would not always match up with the NPC's flag color Fixed a bug where the baseRange and maxRange properties of ranged weapons would not get saved to world files. These values are now saved in the format of RANGE=baseRange,maxRange Changed the way items are added to containers, to ensure that the order in which the items are displayed to the player always reflects the order in which they were added; now the most recent item added/moved in a container will always be rendered on top of older items. Made adjustments to how items are randomly added to containers; should use more of a given container gump's available area now Exposed Item property to JS engine, which contains serial of the creator of an item: .creator // contains serial of the creator of an item. If set, maker's marks will show up in the item's tooltip Fixed an issue where JS engine would lose track of script context if one script used CreateDFNItem() or SpawnNPC() functions and the new objects had events that triggered upon creation. UOX3 now restores the original script context at the tail end of these functions. Added new JS Event to allow inserting custom tooltip text for objects, which will be displayed in tooltips right after the object name. Any text returned from the event will be displayed, and the text can make use of the same HTML tags as gumps to make changes to color, font, etc. onTooltip( myObj ) // Triggers for objects right before the object's tooltip properties are sent to client Updated 'tweak and 'set commands to refresh item being modified if movable state of item changes, so the change is reflected in nearby clients Fixed an issue with NPC vendors and items bought from players not being properly removed from the vendor's "bought container" when players buy them again Ported Item Identification skill from code to JS (js/skill/itemid.js) and removed hard-coded version Implemented magic item generator in JS (js/item/magic_item.js). When this script is attached to an NPC, it has a chance to generate magic weapons, armors, wands/staffs and rings as loot on the NPC's corpse when slain. The chance of getting quality magical items increases with the fame level of the NPC in question. The types of magical items generated follows the pattern of such items as implemented in UO prior to the AoS expansion. Examples: exceedingly accurate war hammer of vanquishing substantial, accurate axe of power and Daemon's Breath silver long sword massive platemail arms of Protection metal shield of defense durable ringmail tunic of guarding All magic items have a chance to have spell effects attached (with rings/wands being guaranteed to have these), with a limited amount of charges available. For weapons, these effects activate on successful hits in combat, while for armors they activate on equip, and then periodically as long as the item is worn. Rings and wands/staffs have to be manually activated and targeted - with the exception of rings of invisibility, which activate the moment you equip them! Related scripts: js/item/magic_armor_equipeffects.js js/item/magic_weapon_accbonus.js js/item/magic_weapon_equip.js js/item/magic_weapon_spell_attack.js The magic item loot generation script has been attached to a number of different NPCs, all of which now have a chance to drop magic items as loot when defeated. A bonus magical item - the glacial staff - has also been implemented (js/item/magic_glacial_staff.js), and has a chance to drop as loot from Giant Ice Serpents! Fixed an issue with CustomTarget where the target message would not be displayed if the cursorType parameter was provided Fixed bug with 'rename command, which referenced a non-existing variable that caused a script crash Added additional object properties to 'get and 'set commands: .shouldSave // Determines if an item should be saved in worldfiles or not .baseRange // Determines the base range of a ranged weapon, less than which it becomes less effective .maxRange // Determines the max range of a ranged weapon, beyond which it cannot reach its target The feature that allows stats like Strength, Dexterity and Intelligence to provide bonuses to skill checks has been turned into a UOX.INI setting, which is disabled by default. The bonuses have also been nerfed; they will no longer contribute more to the success of a skill check than the actual skill being checked! STATSAFFECTSKILLCHECKS=0/1 // If enabled, stats can provide bonuses to skill checks based on the weighting for those stats as setup in dfndata/skills/skills.dfn Updated damage tracking code to include the type of damage that was dealt (PHYSICAl vs HEAT vs COLD, etc) Updated Character JS Method Damage() to include a new parameter that can specify the type of damage that was dealt to the character. The new parameter must always be included if other optional parameters are used. Note that updates might be required for scripts making use of this method.Updated syntax: .Damage( amount ) .Damage( amount, damageType ) .Damage( amount, damageType, attacker ) .Damage( amount, damageType, attacker, doRepsys ) Supported damageTypes: PHYSICAL = 1 LIGHT = 2 RAIN = 3 COLD = 4 HEAT = 5 LIGHTNING = 6 // magic damage POISON = 7 SNOW = 8 Updated JS Event OnDamage to include an additional parameter that describes the type of damage that was dealt. New syntax: onDamage( damaged, attacker, damageValue, damageType ) Updated JS Event OnSpellTarget to allow rejecting a spell being cast on a target by returning a value of 2 from the script Split the character priv flag for magic reflection into a temporary one (one-time magic reflection spell) and a permanent one (innate permanent reflection ability). The temporary effect is put in place by Magic Reflection spell, and is removed after a successful spell reflect. The permanent one is an innate ability of a character and is not removed even after a spell is reflected. Added new Character JS property to get/set state of a character's permanent magic reflect ability: .permanentMagicReflect // 0 = disable, 1 = enable Added special abilities/effects for the following NPCs: Acid Elementals now have a chance to damage the melee weapons of their attackers Dull Copper Elementals now explode on death Shadow Iron Elemental is immune to targeted spell damage Copper Elementals have permanent magic reflect, and reflect some physical damage back at their attacker Bronze Elementals deal passive area damage to nearby players every 5 to 10 seconds Valorite Elementals have permanent magic reflect, reflect some physical damage back at their attacker Snow/Ice Elementals deal passive area damage to nearby players every 5 to 10 seconds Lava Serpents deal passive area damage to nearby players every 5 to 10 seconds Phoenixes deal passive area damage to nearby players every 5 to 10 seconds Pixies have a chance to cast a random spell upon receiving a death blow: Bless (target) Curse (target) Explosion (target) Greater Poison (target) Greater Heal (self, prevents death) Ethereal Warriors will now resurrect dead players with positive karma Ethereal Warriors now have a chance to drain target's health, stamina or mana on hit Fire Breath special ability added to the following NPCs, with the random ability damage scaling with the NPCs current health: Hell Cat, 5 to 8 dmg at max health Fire Steed, 6 to 9 dmg at max health Hell Hounds, 8 to 11 dmg at max health Lava Lizard, 8 to 11 dmg at max health Predator Hell Cat, 9 to 14 dmg at max health Sea Serpent, 11 to 17 dmg at max health Swamp Dragon, 15 to 22 dmg at max health Armored Swamp Dragon, 15 to 22 dmg at max health Fire Gargoyle, 20 to 30 dmg at max health Deep Sea Serpent, 21 to 32 dmg at max health Serpentine Dragon, 22 to 32 dmg at max health Drake (Gray), 22 to 32 dmg at max health Drake (Red), 22 to 32 dmg at max health Nightmare, 26 to 39 dmg at max health Dark Steed, 26 to 39 dmg at max health Silver Steed, 26 to 39 dmg at max health Kraken, 39 to 59 dmg at max health Dragon (Red), 41 to 62 dmg at max health Dragon (Gray), 41 to 62 dmg at max health Shadow Wyrm, 50 to 75 dmg at max health Reptalon, 51 to 77 dmg at max health Skeletal Dragon, 52 to 77 dmg at max health Ancient Wyrm, 60 to 90 dmg at max health Update stats, skills and loot for all currently implemented NPCs Removed an ancient piece of code that prevented corpses from being generated for various elementals and blade spirits on death. This was originally put in place because these creatures had no corpses, and would replace it with a backpack instead, but these creatures now all have corpses in all client versions supported by UOX3 Updated potions script (js/item/potion.js) with updated formula for amount of hitpoints healed by healing potions, and added restrictions for using them when at full health and/or if poisoned (Dragon Slayer) Fixed a bug where creatures (and humans, if FORCENEWANIMATIONPACKET was disabled in uox.ini) would play animations with wrong frame count, causing the animations to either freeze for a few frames at the end, or get cut off a couple of frames early Implemented bonus hit chance for Archery skill, based on mention of such a bonus in Publish 5 patch notes and related UO House of Commons chat. This has been exposed as a UOX.INI setting where this bonus can be tweaked: ARCHERYHITBONUS=10 // Bonus hit chance for Archery skill added to regular hit chance in combat. Defaults to 10% Implemented optional extra delay between moving and being able to shoot with ranged weapons in combat (in addition to whatever delay is there due to speed of the ranged weapon). This is exposed as a UOX.INI setting: ARCHERYSHOOTDELAY=0.5 // Minimum delay in seconds from a player stops moving until they can start to fire their ranged weapon. Defaults to 0.5s Fixed a bug where players who never entered combat mode could fire ranged weapons while moving Updated Add-menu with some improvements for usability: Menu now directly on the Objects (previously "Shard") tab for quicker access, with a small welcome text and quick-link button for UOX3 docs Settings tab contains some (persistent, will be saved with character) options for how the Add-menu behaves, along with a few quick-access buttons to some useful commands. Available options: Option to add chosen item at specific location instead of in GM's backpack Option to add chosen item repeatedly until cancelled Option to automatically reopen Add-menu on last menu that was open when a selection is made Option to force decayable state of all added items to either off (doesn't decay), on (decays) or nothing (use item default) Option to force movable state of all added items to either off (not movable), on (movable) or nothing (use item default) Added a Home button at the bottom of the menu, that takes the user back to the front page of the Add-menu regardless of which menu page they're on Updated Character/Socket JS Method SysMessage() with an optional parameter to specify the color used to display the system message. Updated syntax: .SysMessage( "Text" ) // Display "Text" to user as a system message with default system message color from ini .SysMessage( "Text %s %s", txtArg1, txtArg2 ) // Display "Text" to player with string arguments injected into text .SysMessage( txtColor, "Text" ) // Display "Text" to user with a specified color .SysMessage( txtColor, "Text %s %s", txtArg1, txtArg2 ) // Combination of text color, text and string arguments Fixed a bug where hair/beard items could show up inside corpses Fixed a bug where items could sometimes vanish (visually) from containers when bouncing back because player was not able to pick them up Fixed a bug where players would be unable to pick up a freely movable item from a locked down container Updated handling of item bouncing on pickup to use UOX3 dictionary messages instead of hard-coded client messages Added support for new Dictionary language: dictionary.POL - Polish (SERVERLANGUAGE=8 in uox.ini, or client language 83 if SERVERLANGUAGE is set to 0) Added taming restrictions for Unicorn, Ki-Rin and Cu Sidhe (js/skill/taming.js) Added modification of some creatures stats after they've been tamed (js/skill/taming.js) Added restrictions for who can ride certain creatures (Unicorn, Ki-Rin, Cu Sidhe) Updated words of power for Meteor Swarm spell to follow the same logic as other spells using Kal (Summon): Kal Des Flam Ylem Added new Item/Character JS Methods to get/set temporary custom tags which don't persist across worldsaves (or across reconnects, for players): .GetTempTag( "tagName" ) .SetTempTag( "tagName", tagValue ) When applying HPMAX, STAMINAMAX AND MANAMAX DFN tags to new NPCs, their current HP, STAMINA and MANA properties will now be automatically updated to match Fixed a server crash caused by empty speech messages sent from certain clients Fixed a bug that prevented teleport locations in Felucca/Trammel from working properly Updated calculations in code for duration and damage of existing poison strengths (1 - Lesser, 2 - Normal, 3 - Greater, 4 - Deadly) to match with ~Publish 15 (LBR/pre-AoS), and added another poison strength for monster usage (5 - Lethal) The strength of the Poison and Poison Field spells is now based on the average of the caster's Magery and Poisoning skills, the distance from the target (Poison spell only) and the target's Resisting Spells skill. If caster is further away than 2 tiles from target, the poison strength always equals Lesser Poison, otherwise the following rules apply: If caster's combined skill is higher than 100.0, poison strength equals Greater Poison, with 5% chance of Deadly Poison (if Poison spell) or Deadly Poison (if Poison Field spell) If caster's combined skill is higher than 70.2, poison strength equals Greater Poison If caster's combined skill is higher than 30.2, poison strength equals Normal Poison If caster's combined skill is 30.2 or lower, poison strength equals Lesser Poison If target resists spell, poison strength is reduced by 1 level, unless it's already at the lowest level Fixed an issue that would would let players move faster than they should have been allowed to Fixed misc issues with Party System: Mana and Stamina should now update for Party Members when added to the party, when going in/out of range and when their stats update while in range Players who get disconnected or relog should now find themselves back in the same party they were in previously Added system messages to inform party members about updates to their party, and to let invited players know they've successfully joined a party (or rejoined, if relogging) World saves now operate on the principle of only saving changes done since the last world save. Combined with the fact that NPCs in UOX3 are only active if there are players in the same/neighbouring map regions, shard owners may expect to see a decrease in world save times ranging from ~11% to ~99%, depending on how active and how spread out their player base is. If no changes have taken place since last save, saves are virtually instantaneous!
2021-09-20 21:35:17 +08:00
iCreated->ShouldSave( shouldSave );
iCreated->SetWipeable( true );
iCreated->WorldNumber( worldNum );
iCreated->SetInstanceId( instanceId );
return iCreated;
}
//o------------------------------------------------------------------------------------------------o
//| Function - cItem::CreateBaseScriptItem()
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 - 10/12/2003
//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 - Creates a basic item from the scripts
//o------------------------------------------------------------------------------------------------o
CItem * cItem::CreateBaseScriptItem( CItem *mCont, std::string ourItem, const UI08 worldNum, const UI16 iAmount, const UI16 instanceId, const ObjectType itemType, const UI16 iColor, bool shouldSave )
{
ourItem = oldstrutil::trim( oldstrutil::removeTrailing( ourItem, "//" ));
if( ourItem == "blank" ) // The lootlist-entry is just a blank filler item
2021-06-12 07:30:23 -04:00
return nullptr;
CScriptSection *itemCreate = FileLookup->FindEntry( ourItem, items_def );
2021-06-12 07:30:23 -04:00
if( itemCreate == nullptr )
{
Console.Error( oldstrutil::format( "CreateBaseScriptItem(): Bad script item %s (Item Not Found).", ourItem.c_str() ));
2021-06-12 07:30:23 -04:00
return nullptr;
}
2021-06-12 07:30:23 -04:00
CItem *iCreated = nullptr;
if( itemCreate->ItemListExist() )
{
iCreated = CreateRandomItem( mCont, itemCreate->ItemListData(), worldNum, instanceId, shouldSave );
}
else
{
iCreated = CreateBaseItem( worldNum, itemType, instanceId, shouldSave );
2021-06-12 07:30:23 -04:00
if( iCreated == nullptr )
return nullptr;
// Only set item to decayable by default if ini setting is enabled
if( cwmWorldState->ServerData()->ScriptItemsDecayable() )
{
iCreated->SetDecayable( true );
}
if( !ApplyItemSection( iCreated, itemCreate, ourItem ))
{
Console.Error( "Trying to apply an item section failed" );
}
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
2025-01-16 21:30:32 -06:00
// If the durabilityhpbonus tag is on the item, it will add to its Durability (aka Health).
auto durabilityHpBonus = iCreated->GetDurabilityHpBonus();
// If maxHP has not been defined for a new item, set it to the same value as HP
if (!iCreated->GetMaxHP() && iCreated->GetHP())
{
iCreated->SetMaxHP(iCreated->GetHP());
}
if( durabilityHpBonus > 0 )
{
// Calculate percentage increase
auto baseHP = iCreated->GetHP();
auto baseMaxHP = iCreated->GetMaxHP();
// If maxHP has not been defined, default it to HP
if( baseMaxHP == 0 && baseHP > 0 )
{
baseMaxHP = baseHP;
iCreated->SetMaxHP( baseMaxHP );
}
// Apply the percentage bonus to HP and MaxHP
auto hpBonus = static_cast<int>( baseHP * ( durabilityHpBonus / 100.0 ));
auto maxHpBonus = static_cast<int>( baseMaxHP * ( durabilityHpBonus / 100.0 ));
iCreated->SetHP( baseHP + hpBonus );
iCreated->SetMaxHP( baseMaxHP + maxHpBonus );
}
// If maxUses is higher than usesLeft for a new item, randomize the amount of usesLeft the item should have!
if( iCreated->GetMaxUses() > iCreated->GetUsesLeft() )
{
iCreated->SetUsesLeft( static_cast<UI16>( RandomNum( iCreated->GetUsesLeft(), iCreated->GetMaxUses() )));
}
else if( !iCreated->GetMaxUses() && iCreated->GetUsesLeft() )
{
// Also, if maxUses has not been defined, but usesLeft HAS, set maxUses to equal usesLeft
iCreated->SetMaxUses( iCreated->GetUsesLeft() );
}
// Check for (and run) onCreateDFN() event for newly created item
Minor JS revamp - multiple scripts per object! Added TryParseJSVal() helper function in cScript.cpp, used to parse jsval values returned from script events. Provides results matching 0 (0, false), 1 (1, true) or any specific int value returned from script. JS events updated to use new TryParseJSVal helper function (no change in behaviour): onDecay, onResurrect, onCommand, onBuyFromVendor, onSellToVendor, onPickup, onCharDoubleClick, onSkillGump, onUseBandageMacro, onCombatStart, onCombatEnd, onDeathBlow, onBuy, onSell JS events with slight change of behaviour after update to use TryParseJSVal: onDrop, onDropItemOnItem, onDropItemOnNpc - previously, a blank or non-existent return value would be treated the same as a return true. This will now be treated as a return false. Update scripts accordingly! JS events updated to support return values from scripts: onCollide, onTalk, onSnooped, OnHungerChange Return false or nothing to prevent hard code from running Return true to allow hard code to run like normal onStolenFrom, onAISliver, onLightChange, onVirtueGumpPress, onQuestGump, onSpecialMove, onSwing, onClick, onHouseCommand, onSellToVendor, onSkillCheck, onSpellGain, onSpellLoss Return false to allow hard code and other scripts with event to run like normal Return true to prevent hard code and other scripts with event from running onSteal Return false or nothing to allow hard code and other scripts with event to run like normal Return true to prevent hard code and onStolenFrom event from running (theft failed?) Return 2 to prevent hard code, but allow onStolenFrom event to run (theft succeeded, but handled in script?) onLeaving, onEntrance, onEquip, onUnequip, onEnterEvadeState, onSoldToVendor, onBoughtFromVendor, onSpellSuccess, onSpellTarget, onFlagChange, onDeath Return false or nothing to allow other scripts with event to run like normal Return true to prevent other scripts with event from running Added new JS events that run prior to items being equipped/unequipped, with support for return values: onEquipAttempt( pEquipper, iEquipping ) onUnequipAttempt( pEquipper, iUnequipping ) Return false or nothing to reject attempt to equip/unequip item, and prevent hard-code or other scripts with event from running Return true to allow hard code to run like normal Added new JS event that runs prior to onSnooped event, for character doing the snooping: onSnoopAttempt( snooped, snooper ) Return false or nothing to prevent hard code and other snooping-related events from running Return true to allow hard code and other snooping-related events to run like normal Updated onSnooped JS event to accept return values: Return true when success state is true to prevent other scripts with event from running Return true when success state is false to prevent hard code and other scripts with event from running Updated onClick JS event to also run for characters with event attached (return 1 to prevent showing hard-coded name for whatever object is clicked) Updated onSteal JS event to include a third parameter, an object reference for the target of the theft Added support for assigning multiple JS scripts per object (item, multi, char, region). Any time a scriptID is added to an object, the list of such IDs for that object will be sorted from lowest to highest scriptID, which also determines the execution order for the scripts. Note that if the same JS event is present in several scripts assigned to an object, each of those events will trigger, unless the rules about return values for said event prevent this DFNs for Items, Multis, Characters and Regions can now contain multiple SCRIPT=scriptID tags per definition. Each such SCRIPT tag will be applied to the object in question, then sorted from lowest to highest scriptID by server. Added new JS property for Items, Multis, Characters and Regions: .scriptTriggers // If used to get property, will return array object with all script IDs assigned to object. If used to set property, will add script ID to existing list of script IDs for object. Modified JS property for Items, Multis, Characters and Regions, which for backwards compatibility functions similar to in older versions: .scripttrigger // If used to get property, will return last script ID in list of script IDs assigned to object. If used to set property, will clear list of script IDs and assign only the new ID Added new JS Methods for Items, Multis, Characters and Regions: .AddScriptTrigger( scriptID ) // Adds a new scriptID to list of scripts assigned to object .RemoveScriptTrigger( scriptID ) // Remove a specific scriptID from object (0 = remove all) Moved SETSCPTRIG command from code to JS (js/commands/targeting/scptrig.js), and supplemented it with some additional commands: GETSCPTRIG // List out all scriptIDs assigned to object SETSCPTRIG scriptID // Clears list of scriptIDs for object, then assigns the specified scriptID ADDSCPTRIG scriptID // Adds specified scriptID to list of scriptsIDs assigned to object REMOVESCPTRIG scriptID // Removes specified scriptID from list of scriptIDs assigned to object (0 = remove all)
2021-05-25 19:37:52 +08:00
std::vector<UI16> scriptTriggers = iCreated->GetScriptTriggers();
for( auto scriptTrig : scriptTriggers )
{
cScript *toExecute = JSMapping->GetScript( scriptTrig );
2021-06-12 07:30:23 -04:00
if( toExecute != nullptr )
Minor JS revamp - multiple scripts per object! Added TryParseJSVal() helper function in cScript.cpp, used to parse jsval values returned from script events. Provides results matching 0 (0, false), 1 (1, true) or any specific int value returned from script. JS events updated to use new TryParseJSVal helper function (no change in behaviour): onDecay, onResurrect, onCommand, onBuyFromVendor, onSellToVendor, onPickup, onCharDoubleClick, onSkillGump, onUseBandageMacro, onCombatStart, onCombatEnd, onDeathBlow, onBuy, onSell JS events with slight change of behaviour after update to use TryParseJSVal: onDrop, onDropItemOnItem, onDropItemOnNpc - previously, a blank or non-existent return value would be treated the same as a return true. This will now be treated as a return false. Update scripts accordingly! JS events updated to support return values from scripts: onCollide, onTalk, onSnooped, OnHungerChange Return false or nothing to prevent hard code from running Return true to allow hard code to run like normal onStolenFrom, onAISliver, onLightChange, onVirtueGumpPress, onQuestGump, onSpecialMove, onSwing, onClick, onHouseCommand, onSellToVendor, onSkillCheck, onSpellGain, onSpellLoss Return false to allow hard code and other scripts with event to run like normal Return true to prevent hard code and other scripts with event from running onSteal Return false or nothing to allow hard code and other scripts with event to run like normal Return true to prevent hard code and onStolenFrom event from running (theft failed?) Return 2 to prevent hard code, but allow onStolenFrom event to run (theft succeeded, but handled in script?) onLeaving, onEntrance, onEquip, onUnequip, onEnterEvadeState, onSoldToVendor, onBoughtFromVendor, onSpellSuccess, onSpellTarget, onFlagChange, onDeath Return false or nothing to allow other scripts with event to run like normal Return true to prevent other scripts with event from running Added new JS events that run prior to items being equipped/unequipped, with support for return values: onEquipAttempt( pEquipper, iEquipping ) onUnequipAttempt( pEquipper, iUnequipping ) Return false or nothing to reject attempt to equip/unequip item, and prevent hard-code or other scripts with event from running Return true to allow hard code to run like normal Added new JS event that runs prior to onSnooped event, for character doing the snooping: onSnoopAttempt( snooped, snooper ) Return false or nothing to prevent hard code and other snooping-related events from running Return true to allow hard code and other snooping-related events to run like normal Updated onSnooped JS event to accept return values: Return true when success state is true to prevent other scripts with event from running Return true when success state is false to prevent hard code and other scripts with event from running Updated onClick JS event to also run for characters with event attached (return 1 to prevent showing hard-coded name for whatever object is clicked) Updated onSteal JS event to include a third parameter, an object reference for the target of the theft Added support for assigning multiple JS scripts per object (item, multi, char, region). Any time a scriptID is added to an object, the list of such IDs for that object will be sorted from lowest to highest scriptID, which also determines the execution order for the scripts. Note that if the same JS event is present in several scripts assigned to an object, each of those events will trigger, unless the rules about return values for said event prevent this DFNs for Items, Multis, Characters and Regions can now contain multiple SCRIPT=scriptID tags per definition. Each such SCRIPT tag will be applied to the object in question, then sorted from lowest to highest scriptID by server. Added new JS property for Items, Multis, Characters and Regions: .scriptTriggers // If used to get property, will return array object with all script IDs assigned to object. If used to set property, will add script ID to existing list of script IDs for object. Modified JS property for Items, Multis, Characters and Regions, which for backwards compatibility functions similar to in older versions: .scripttrigger // If used to get property, will return last script ID in list of script IDs assigned to object. If used to set property, will clear list of script IDs and assign only the new ID Added new JS Methods for Items, Multis, Characters and Regions: .AddScriptTrigger( scriptID ) // Adds a new scriptID to list of scripts assigned to object .RemoveScriptTrigger( scriptID ) // Remove a specific scriptID from object (0 = remove all) Moved SETSCPTRIG command from code to JS (js/commands/targeting/scptrig.js), and supplemented it with some additional commands: GETSCPTRIG // List out all scriptIDs assigned to object SETSCPTRIG scriptID // Clears list of scriptIDs for object, then assigns the specified scriptID ADDSCPTRIG scriptID // Adds specified scriptID to list of scriptsIDs assigned to object REMOVESCPTRIG scriptID // Removes specified scriptID from list of scriptIDs assigned to object (0 = remove all)
2021-05-25 19:37:52 +08:00
{
UOX3 0.99.6-RC6 Removed arbitrary and hidden restrictions on refreshing list of online players shown with 'wholist command Fixed an issue where player ghosts that get teleported would not see themselves get updated to new location Fixed a server crash from clients disconnecting while running server in debug mode Improved how container updates are sent to players; now only sends to clients that have actually opened the container, and who are still within range Added more information about UO data files being loaded during server startup Enhanced the GM 'add menu to allow clicking directly on images of items/npcs to add them, and adjusted size of menus to accommodate this Fixed an issue with fleeing NPCs that could cause them to attempt to flee across time and space, regardless of distance to target/attacker in combat Added NPC AI that runs away from players if they get too close (even outside combat). Applied to hind, rabbits, squirrels, ferrets and various birds by default: AI_ANIMAL_SCARED (aitype 12) Fixed issues with NPCs fleeing forever, or getting stuck in flee/don't flee loop, by introducing max fleeing distance (50 tiles) and cooldown (30 sec) on fleeing Updated onNameRequest JS Event to include third parameter with origin of name request, so script responses can be tailored appropriately: onNameRequest( myObj, requestedBy, requestSource ) Potential values for requestSource: 0 - Speech/System Messages 1 - Guild Menus 2 - Stat Window (self) 3 - Stat Window (other) 4 - Tooltip 5 - Paperdoll Journal 6 - Paperdoll 7 - Single Click / All-Names 8 - System 9 - Secure Trade Window Added Adaptive Performance System (APS) that dynamically adjust how often NPC AI/movement is checked based on overall shard performance. If performance drops below defined threshold, UOX3 gradually slows down checks for NPC AI/movement to prioritize player movement/speech/command responsiveness. If performance climbs back up above threshold, slowdowns are gradually removed. The following UOX.INI options have been added under [system] category to support this system: APSPERFTHRESHOLD=50 // Performance threshold (measured in simulation cycles/sec) below which the APS kicks in APSINTERVAL=100 // How often (in milliseconds) the APS checks performance and makes adjustments (if needed) to balance out shard performance APSDELAYSTEP=50 // How much the delay timer is modified by (in milliseconds) each time APS makes adjustments APSDELAYMAXCAP=2000 // Max amount of of delay APS can introduce for NPC AI/movement handling when attempting to restore shard performance Added new JS Methods for Region objects: .GetOrePrefs( oreType ) // Get ore preference data for ore type found in town region. Returned as an array containing the following data: orePrefData -> [ oreName, // name of ore color, // color of ore minskill, // min skill to mine ore ingotName, // name of ingot created from ore makemenu, // makemenu entry for crafting something from ingot oreChance, // default global chance of finding this ore type scriptID // script attached to mined ore ], orePrefChance // Chance of finding this ore type in given town region .GetOreChance() // Get base chance of finding any ore in town region Moved Mining skill plus gravedigging feature from hard code to scripts (js/skill/mining.js) to make it easier to maintain and/or customize, and removed hard coded variants Gravedigging now relies on the ore resource system behind the scenes to restrict how often graves in a given area can be dug up Fixed some incorrect references to .worldNumber Character property in misc scripts (should be .worldnumber) Made some "hard-scripted" system messages in misc scripts use dictionary system instead Added spawn region for banker NPCs in Serpent's Hold (dfndata/spawn/felucca/spawn_town_serpents_hold.dfn, dfndata/spawn/trammel/spawn_town_serpents_hold.dfn) Fixed region definition of Ocllo to actually cover the entire town (dfndata/regions/regions.dfn) Added numerous additional locations accessible with 'goplace # command, for key locations in Ilshenar, Malas, Tokuno Islands and Ter Mur (dfndata/location/location.dfn) Revised travel-menu portion of GM menu (shortcut: 'travel) to include more travel options based on new locations (dfndata/items/travelmenu.dfn and travelmenu.bulk.dfn) Fixed an issue where NPCs could attempt to attack targets in other worlds/instances Added new JS Event that triggers for characters who are about to deal damage in combat. Complimentary to onDamage, which triggers for chars receiving damage: onDamageDeal( dmgDealer, dmgReceiver, damageValue, damageType ) Added new JS Event that can trigger in global script upon creation of new player chars. Note that this will trigger in place of onCreateDFN event for player characters: onCreatePlayer( pChar ) Added new JS Event that triggers for characters selecting a target with a spell. Complimentary to onSpellTarget, which triggers for targets selected with a spell: onSpellTargetSelect( caster, target, spellNum ) Updated onCombatStart and onCombatEnd JS Events to also trigger for the other party in combat Updated onPickup JS Event to include a third parameter - the potential container item was picked up from. Event now also triggers event in scripts attached to said containers: onPickup( iPickedUp, pChar, iCont ) Added tracking of total playtime per individual character, and per account across all characters, and exposed these properties to JS engine: .totalPlayTime // Account property, total playtime across all chars .playTime // Character property, total playtime on given character only Added new player-accessible command ('playtime) to spit out the playtime of current character/account as a whole (js/commands/playtime.js) Implemented first version of Young Player System: Replaced the UNUSED9 account flag with YOUNG, to be used by Young/New Player System Added new JS Account property that gets/sets whether player account is considered Young: .isYoung Added new Char timers: TIMER_YOUNGHEAL // Restricts how often Young players are healed by NPC healers TIMER_YOUNGMESSAGE // Restricts how often Young players are warned about dangerous looking monsters in overworld Updated GM commands 'get and 'set to get/set .isYoung property of player's account (js/commands/targeting/get.js and set.js) Added new UOX.INI setting to enable/disable Young Player System (enabled by default): YOUNGPLAYERSYSTEM=1 If Young Player System is enabled, all newly created player accounts are automatically marked with Young flag Added new script to handle various restrictions and functions related to Young characters (js/player/young_player.js): Young characters will have [Young] displayed over their head Young characters will have their Young status checked and verified on every login + every stat/skill gain, to revoke the Young status if any of the following is true: Account has a total playtime of more than 40 hours Any character has more than 350 total (base) skill points Any character has more than 70 skill points in a single skill Any character has more than 150 total stat points Any character has more than 80 stat points in a single stat Young characters can renounce their Young status manually by saying the words "I renounce my young player status" Young characters get two additional items upon creation: a new player ticket (can be combined with any other players new player ticket for both players to get a reward) a sextant (shows Young players directions to nearest moongate/bank regardless of where they are, as long as outdoors) Young characters cannot target other player characters with hostile spells or skills Young characters cannot be the target of other player characters' hostile spells or skills Young characters can only cast beneficial spells upon themselves or other Young characters Young characters can only be the target of beneficial spells from other Young players Young players (and their pets/followers) cannot attack or harm any other players (or their pets/followers), nor themselves be attacked or harmed by any other players (or their pets/followers), whether from combat, spells, skills or items Young players don't lose any of their items on death, and are teleported to the nearest healer upon death with all their items intact Young players receive a warning upon entering dungeons that monsters there will be hostile Updated global script (js/server/global.js) to: Check/Verify Young status of players upon login Attach young player script on login/creation for players on Young accounts Give specific items to Young players upon creation Added new script (js/item/corpse.js) that is assigned to all freshly created corpses. This script handles restrictions related to Young players interactions with corpses, and the interactions of other players with corpses of Young players Updated JS Method .Carve() to return true/false depending on whether carving a corpse was successful Updated Healer AI in code to heal nearby injured Young players Updated Evil AI and Evil Caster AI in code to avoid selecting Young players as targets in combat outside of dungeons Added a new section to UOX.INI - [young player starting locations] - that can be used to define starting locations for Young players. If only one such location is provided, all players start there. Otherwise, it matches the same starting location setup as the regular one - with one entry per town in Britannia. Restricted transferring and/or friending of pets (code) and hirelings (hirelings.js) between Young and non-Young players Restricted Young players from recalling or gating to Felucca facet Young players can instantly logout from anywhere, at any time
2023-07-01 20:02:40 +08:00
toExecute->OnCreate( iCreated, true, false );
Minor JS revamp - multiple scripts per object! Added TryParseJSVal() helper function in cScript.cpp, used to parse jsval values returned from script events. Provides results matching 0 (0, false), 1 (1, true) or any specific int value returned from script. JS events updated to use new TryParseJSVal helper function (no change in behaviour): onDecay, onResurrect, onCommand, onBuyFromVendor, onSellToVendor, onPickup, onCharDoubleClick, onSkillGump, onUseBandageMacro, onCombatStart, onCombatEnd, onDeathBlow, onBuy, onSell JS events with slight change of behaviour after update to use TryParseJSVal: onDrop, onDropItemOnItem, onDropItemOnNpc - previously, a blank or non-existent return value would be treated the same as a return true. This will now be treated as a return false. Update scripts accordingly! JS events updated to support return values from scripts: onCollide, onTalk, onSnooped, OnHungerChange Return false or nothing to prevent hard code from running Return true to allow hard code to run like normal onStolenFrom, onAISliver, onLightChange, onVirtueGumpPress, onQuestGump, onSpecialMove, onSwing, onClick, onHouseCommand, onSellToVendor, onSkillCheck, onSpellGain, onSpellLoss Return false to allow hard code and other scripts with event to run like normal Return true to prevent hard code and other scripts with event from running onSteal Return false or nothing to allow hard code and other scripts with event to run like normal Return true to prevent hard code and onStolenFrom event from running (theft failed?) Return 2 to prevent hard code, but allow onStolenFrom event to run (theft succeeded, but handled in script?) onLeaving, onEntrance, onEquip, onUnequip, onEnterEvadeState, onSoldToVendor, onBoughtFromVendor, onSpellSuccess, onSpellTarget, onFlagChange, onDeath Return false or nothing to allow other scripts with event to run like normal Return true to prevent other scripts with event from running Added new JS events that run prior to items being equipped/unequipped, with support for return values: onEquipAttempt( pEquipper, iEquipping ) onUnequipAttempt( pEquipper, iUnequipping ) Return false or nothing to reject attempt to equip/unequip item, and prevent hard-code or other scripts with event from running Return true to allow hard code to run like normal Added new JS event that runs prior to onSnooped event, for character doing the snooping: onSnoopAttempt( snooped, snooper ) Return false or nothing to prevent hard code and other snooping-related events from running Return true to allow hard code and other snooping-related events to run like normal Updated onSnooped JS event to accept return values: Return true when success state is true to prevent other scripts with event from running Return true when success state is false to prevent hard code and other scripts with event from running Updated onClick JS event to also run for characters with event attached (return 1 to prevent showing hard-coded name for whatever object is clicked) Updated onSteal JS event to include a third parameter, an object reference for the target of the theft Added support for assigning multiple JS scripts per object (item, multi, char, region). Any time a scriptID is added to an object, the list of such IDs for that object will be sorted from lowest to highest scriptID, which also determines the execution order for the scripts. Note that if the same JS event is present in several scripts assigned to an object, each of those events will trigger, unless the rules about return values for said event prevent this DFNs for Items, Multis, Characters and Regions can now contain multiple SCRIPT=scriptID tags per definition. Each such SCRIPT tag will be applied to the object in question, then sorted from lowest to highest scriptID by server. Added new JS property for Items, Multis, Characters and Regions: .scriptTriggers // If used to get property, will return array object with all script IDs assigned to object. If used to set property, will add script ID to existing list of script IDs for object. Modified JS property for Items, Multis, Characters and Regions, which for backwards compatibility functions similar to in older versions: .scripttrigger // If used to get property, will return last script ID in list of script IDs assigned to object. If used to set property, will clear list of script IDs and assign only the new ID Added new JS Methods for Items, Multis, Characters and Regions: .AddScriptTrigger( scriptID ) // Adds a new scriptID to list of scripts assigned to object .RemoveScriptTrigger( scriptID ) // Remove a specific scriptID from object (0 = remove all) Moved SETSCPTRIG command from code to JS (js/commands/targeting/scptrig.js), and supplemented it with some additional commands: GETSCPTRIG // List out all scriptIDs assigned to object SETSCPTRIG scriptID // Clears list of scriptIDs for object, then assigns the specified scriptID ADDSCPTRIG scriptID // Adds specified scriptID to list of scriptsIDs assigned to object REMOVESCPTRIG scriptID // Removes specified scriptID from list of scriptIDs assigned to object (0 = remove all)
2021-05-25 19:37:52 +08:00
}
}
}
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
if( ValidateObject( iCreated ))
{
if( iColor != 0xFFFF )
{
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
iCreated->SetColour( iColor );
}
if( iAmount > 1 && iCreated->IsPileable() )
{
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
iCreated->SetAmount( iAmount );
}
// Keep reference to DFN sectionId item was created from (if it has not been set already via special DFN tag SECTIONID)
UOX3 0.99.6-RC3 Updated Item DFNs with ORIGIN and SECTIONID tags for relevant items Added JS Function to make comparing eras (based on object origin or server settings) easier: EraStringToNum( eraString ) // Takes an era string (uo, t2a, uor, td, lbr, aos, etc) and returns an int Updated some JS scripts to use EraStringToNum() for era comparisons (potionkeg.js) Default CORESHARDERA setting is now LBR Removed PUB15 as a separate "era" - it's identical to late stage LBR anyway: Removed support for GETPUB15 tag Added support for GETUO tag for items/NPCs: GETUO=<sectionID> // Inherit DFN section if core shard era is Ultima Online (original release, before T2A) Rewrote portions of MsgBoardQuestEscortCreate() function in msgboard.cpp to ensure only escort regions within same world as NPC can be selected as destinations Increased maximum number of possible escort regions that can exist from 255 to 65535 Added region definitions for all shrines in Britannia (Fel & Trammel), and marked them as valid destinations for NPC escorts (uox3/regions/regions.dfn) Moved bankers from vendor to human DFN files, and made them inherit basehuman instead of basevendor - since they are not vendors To address an issue with escorted NPCs not timing out and vanishing if they are left in a "dormant" area of the world with no player activity, the NPCs are marked as "always awake" the moment they arrive at their destination. Note that the uox.ini setting ALLOWAWAKENPCS needs to be enabled for this to work. Fixed an issue where spawnsection of spawners did not show up correctly in tweak menu Fixed an issue where the generic Orc AI script didn't have a return true at end of onDamage() event, which prevented all orcs from taking damage in combat (js/npc/ai/monster/orc.js) Moved Anatomy skill-check in healing script (js/skill/healing.js) from onCallback1() function to onTimer() to prevent the skill-check from being spammable Added mount ID for Frost Mite in creatures.dfn, allowing it to be used as mount Exposed the following character properties to JS engine, which can be used to view/adjust the permanent hair/beard options for a character: .hairStyle .hairColour .beardStyle .beardColour Updated 'kill hair, 'shavehair, 'shavebeard and 'remove commands to clear permanent hair/beard colour and style properties in addition to removing the item itself Added a GM override to let GMs place as many houses as they want (js/server/house/houseDeed.js) Fixed an issue where attempting to sell items to NPC shopkeepers could result in client crashing Added a new JS Event: onMultiLogout( iMulti, cPlayer ) // Handles players logging out while inside multis Updated house script (js/server/house/house.js) with onMultiLogout event, which allows owners (always) and co-owners/friends/guests (if option enabled in uox.ini) to safely log out inside the house (without getting booted). Added a "keyless" option for interacting with locked doors (js/item/doors.js) of player-owned houses, which lets owners/co-owners/friends/guests of a house use locked doors in the house without requiring a key in their backpack, if the options for that are enabled in UOX.INI. Enabled for owners/co-owners and friends by default (but not for guests) Note that if option to safely log out is enabled, but keyless option is NOT enabled, then the server will check if the player has a key to the house in their backpack, and eject them from the house upon logging out if not. This is to make sure players don't get stuck inside a house they can't get out of because they lack the rights to open doors etc. Added new UOX.INI options, under the [houses] section: SAFECOOWNERLOGOUT=1 // Allow co-owners to safely and instantly log out inside house SAFEFRIENDLOGOUT=1 // Allow friends to safely and instantly log out inside house SAFEGUESTLOGOUT=1 // Allow guests to safely and instantly log out inside house KEYLESSOWNERACCESS=1 // Allow owner of house to use locked doors in house without key in pack KEYLESSCOOWNERACCESS=1 // Allow co-owners of house to use locked doors in house without key in pack KEYLESSFRIENDACCESS=1 // Allow friends of house to use locked doors in house without key in pack KEYLESSGUESTACCESS=0 // Allow guests of house to use locked doors in house without key in pack Fixed NOHAIR tag from races.dfn not being loaded correctly
2023-03-04 22:50:55 +08:00
if( iCreated->GetSectionId() == "UNKNOWN" )
{
iCreated->SetSectionId( ourItem );
}
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
}
return iCreated;
}
//o------------------------------------------------------------------------------------------------o
//| Function - cItem::GetScriptItemSettings()
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 - 10/12/2003
//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 - Grabs item entries from harditems.dfn
//o------------------------------------------------------------------------------------------------o
void cItem::GetScriptItemSettings( CItem *iCreated )
{
std::string hexId = oldstrutil::number( iCreated->GetId(), 16 );
while( hexId.size() < 4 )
0.99.4d Added new option in UOX.INI under [settings] section: MAPDIFFSENABLED=0/1 // If enabled, server will attempt to load diff files, and send "Enable Map-diff files" packet to client to also load these. Disabled by default. Server no longer loads map/statics diff files by default, nor does it send packet to client to request loading these files, as only client versions below 7.0.8.2 will actively load these files. Can be re-enabled with new UOX.INI setting mentioned above! Fixed incorrect ID for gargish dagger in CHandleCombat::getWeaponType() Added missing weapon entries in CHandleCombat::getWeaponType(): bladed whip, barbed whip, spiked whip, gargish talwar Fixed an issue that would show the end part of some tiledata names as garbled text instead of cutting off the text(!) at 20 characters Fixed an issue with advanced character creation template when using ClassicUO client, which sends a profession value of 255 instead of 0 when no profession template has been selected. Fixed an issue where clones of NPCs that can split in combat didn't get the NPC flag correctly set Guild titles are now removed for players who leave their guilds Enabled closing some hard-coded gump menus using right-click (howto, guild, towns, wholist, addmenu, craftmenu, info) Fixed an issue where adding base items using 'add [itemID] would sometimes get false positive hits from harditems.dfn, depending on the length of the itemID Fixed an issue where items added using 'add [itemID] would not get names applied properly from harditems.dfn Item/NPC DFN tag GET can now inherit a random parent by adding additional values separated by spaces. Syntax: GET=parent1 parent2 parent3 (etc) Fixed an issue where NPC backpacks would not have the max item capacity set properly Added new properties for CItem objects (also exposed as JS Item Properties): maxRange // max distance a ranged weapon can fire at (replaces ARCHERRANGE ini setting) baseRange // base distance throwing weapons (when implemented) can be used at Added support for new Item DFN tag that replaces global UOX.INI setting ARCHERRANGE: MAXRANGE=# // Specifies max range of ranged weapon Added support for new Item/NPC DFN tags to support randomizing elemental resistances: RESISTFIRE=#/# # // Set NPC's poison resistance; fixed or random value RESISTCOLD=#/# # // Set NPC's poison resistance; fixed or random value RESISTLIGHTNING=#/# # // Set NPC's poison resistance; fixed or random value RESISTPOISON=#/# # // Set NPC's poison resistance; fixed or random value Added support for two new DFN tags in dfndata/race/races.dfn that can be used to allow/ban lists of equipment for specific races ALLOWEQUIPLIST=# BANEQUIPLIST=# Added support for new section in dfndata/race/races.dfn - [EQUIPLIST #], which can be used to define lists of equipment that is whitelisted or banned for specific races. Fixed a bug that would report incorrect weight in tooltips for Item/NPC spawner objects ScriptSections are now reapplied for items bought by players from NPC vendors Fixed an issue where players could drop an item on the ground and other players would still see the item after it was picked up, because of a failed distance check vs old location coordinates (in pack) instead of vs current location on ground Fixed a bug with players being able to use last-target macro to target objects picked up and held by other players on their cursor Updated all references to "devinelock" to be "divinelock" instead - this includes the name of the JS Item property Fixed house commands triggering (useless) targeting cursors for players onboard boats Changed default statcap in UOX.INI from 325 to 225 Fixed a out-of-range error for players attempting to combine ore inside their own backpack Fixed various issues with distance checks and container checks when using/target objects Added optional 4th "hue" parameter to AddGump JS method Added JS Function to get total amount of accounts on server - GetAccountCount() Added JS Function to get total amount of players online - GetPlayerCount() onSwing JS Event can now trigger in scripts attached to items, not just items attached to characters Added some JS Functions to expose some hard-coded constants to JS scripts: BASEITEMSERIAL() // Base item serial INVALIDSERIAL() // Invalid serial INVALIDID() // Invalid ID INVALIDCOLOUR() // Invalid colour Fixed an issue where JS character property .colour would modify origSkin property instead of colour Fixed an issue where JS character property .guildTitle returned the name of the character instead of the guild title Character JS property .poison can now also be used to set a character's poisoned level, not just read it Exposed Item property to JS engine: .ac // armour class for item (0-128). Primarily used for setting race-restrictions for equippable items, i.e. race X cannot equip items of armour class Y. .def // defensive value of item (Physical resistance post-AoS, AR in older UO) // NOTE: The following properties don't actually do anything yet, but can still be used in custom JS scripts if desired .resistCold // Cold resistance of item 0-1000, where 1000 equals 100.0% .resistHeat // Heat/Fire resistance of item 0-1000, where 1000 equals 100.0% .resistLight // Light resistance of item 0-1000, where 1000 equals 100.0% .resistLightning // Energy/Lightning resistance of item 0-1000, where 1000 equals 100.0% .resistPoison // Poison resistance of item 0-1000, where 1000 equals 100.0% .resistRain // Rain resistance of item 0-1000, where 1000 equals 100.0% .resistSnow // Snow resistance of item 0-1000, where 1000 equals 100.0% .damageHeat // Weapon deals Heat/Fire elemental damage (true/false) .damageCold // Weapon deals Cold elemental damage (true/false) .damageLight // Weapon deals Light elemental damage (true/false) .damageLightning // Weapon deals Lightning elemental damage (true/false) .damagePoison // Weapon deals Poison elemental damage (true/false) .damageRain // Weapon deals Rain/Water elemental damage (true/false) .damageSnow // Weapon deals Snow/Ice elemental damage (true/false) Added new UOX.INI setting under [server] to enable/disable shard response to ConnectUO server polling (disabled by default) Sub-commands are no longer included when registering packets to be overloaded via RegisterPacket function, as that part was never fully implemented. Packet-hook scripts can be setup for specific packet IDs, but any sub-command checking will need to be done in the script itself JS Packet Method GetDWord() now uses JS_NewNumberValue instead of INT_TO_JSVAL to read from the socket buffer, to better handle large numbers, which could previously be returned with wrong values. JS Function CalcItemFromSer() now uses a JS_GetStringBytes() and str_value() combo instead of JSVAL_TO_INT() to read the data provided in the function argument. This allows JS scripts to provide item serials to the function directly without needing to split it into four parts first (though that still works) Fixed issue where JS properties for multis didn't always return correct values The 'set command can now be used to set the armour class of items ('set ac #) Reimplemented 'tweak command in JS engine (js/commands/targeting/tweak.js) - can be used to view and modify properties of characters, character skills, items, multis and regions (target ground) Added placeholder packet-hook script (js/server/network/0xf1_connectUoServerPoll.js) to handle responses to ConnectUO server polling. By default this script does nothing, but serves as a placeholder for drop-in replacement scripts generated specifically for each shard by the ConnectUO service. Updated some commands to support an alternate STATIC keyword (can also be ommitted) to add base items: 'add static itemID 'tile static itemID Updated some commands with support for randomization. Provided itemID will be randomized based on provided rndValue: /js/commands/targeting/add.js: 'add itemID rndValue cmdtable.cpp and targeting.cpp: 'tile itemID rndValue 'tile itemID x1 x2 y1 y2 z rndValue Updated js/commands/custom/repeatingcmds.js to support 'm delete as an alias for 'rremove Added 'props as an alias for the 'tweak command Added 'teleport as an alias for the 'tele command (js/commands/targeting/tele.js) Added 'shavehair and 'shavebeard as aliases for 'kill hair and 'kill beard (js/commands/targeting/kill.js) Added 'noinvul and 'mortal aliases for the 'invul false command (js/commands/custom/misc-cmds.js) Added 'immortal and 'invul (without parameter) as aliases for the 'invul true command Added 'bringtopack as an alias of 'movetobag command (js/commands/targeting/movetobag.js) Updated check for cancelling of target cursor in various JS scripts Minor updates to various JS scripts Fixed issue where some item definitions in dfndata/harditems/harditems.dfn and dfndata/items/building/lighting.dfn used comma instead of space as delimiter for the VALUE tag, which thus never got applied Updated all NPC definitions to let NPCs spawn facing in random directions
2021-03-22 05:59:20 +08:00
{
hexId = "0" + hexId;
0.99.4d Added new option in UOX.INI under [settings] section: MAPDIFFSENABLED=0/1 // If enabled, server will attempt to load diff files, and send "Enable Map-diff files" packet to client to also load these. Disabled by default. Server no longer loads map/statics diff files by default, nor does it send packet to client to request loading these files, as only client versions below 7.0.8.2 will actively load these files. Can be re-enabled with new UOX.INI setting mentioned above! Fixed incorrect ID for gargish dagger in CHandleCombat::getWeaponType() Added missing weapon entries in CHandleCombat::getWeaponType(): bladed whip, barbed whip, spiked whip, gargish talwar Fixed an issue that would show the end part of some tiledata names as garbled text instead of cutting off the text(!) at 20 characters Fixed an issue with advanced character creation template when using ClassicUO client, which sends a profession value of 255 instead of 0 when no profession template has been selected. Fixed an issue where clones of NPCs that can split in combat didn't get the NPC flag correctly set Guild titles are now removed for players who leave their guilds Enabled closing some hard-coded gump menus using right-click (howto, guild, towns, wholist, addmenu, craftmenu, info) Fixed an issue where adding base items using 'add [itemID] would sometimes get false positive hits from harditems.dfn, depending on the length of the itemID Fixed an issue where items added using 'add [itemID] would not get names applied properly from harditems.dfn Item/NPC DFN tag GET can now inherit a random parent by adding additional values separated by spaces. Syntax: GET=parent1 parent2 parent3 (etc) Fixed an issue where NPC backpacks would not have the max item capacity set properly Added new properties for CItem objects (also exposed as JS Item Properties): maxRange // max distance a ranged weapon can fire at (replaces ARCHERRANGE ini setting) baseRange // base distance throwing weapons (when implemented) can be used at Added support for new Item DFN tag that replaces global UOX.INI setting ARCHERRANGE: MAXRANGE=# // Specifies max range of ranged weapon Added support for new Item/NPC DFN tags to support randomizing elemental resistances: RESISTFIRE=#/# # // Set NPC's poison resistance; fixed or random value RESISTCOLD=#/# # // Set NPC's poison resistance; fixed or random value RESISTLIGHTNING=#/# # // Set NPC's poison resistance; fixed or random value RESISTPOISON=#/# # // Set NPC's poison resistance; fixed or random value Added support for two new DFN tags in dfndata/race/races.dfn that can be used to allow/ban lists of equipment for specific races ALLOWEQUIPLIST=# BANEQUIPLIST=# Added support for new section in dfndata/race/races.dfn - [EQUIPLIST #], which can be used to define lists of equipment that is whitelisted or banned for specific races. Fixed a bug that would report incorrect weight in tooltips for Item/NPC spawner objects ScriptSections are now reapplied for items bought by players from NPC vendors Fixed an issue where players could drop an item on the ground and other players would still see the item after it was picked up, because of a failed distance check vs old location coordinates (in pack) instead of vs current location on ground Fixed a bug with players being able to use last-target macro to target objects picked up and held by other players on their cursor Updated all references to "devinelock" to be "divinelock" instead - this includes the name of the JS Item property Fixed house commands triggering (useless) targeting cursors for players onboard boats Changed default statcap in UOX.INI from 325 to 225 Fixed a out-of-range error for players attempting to combine ore inside their own backpack Fixed various issues with distance checks and container checks when using/target objects Added optional 4th "hue" parameter to AddGump JS method Added JS Function to get total amount of accounts on server - GetAccountCount() Added JS Function to get total amount of players online - GetPlayerCount() onSwing JS Event can now trigger in scripts attached to items, not just items attached to characters Added some JS Functions to expose some hard-coded constants to JS scripts: BASEITEMSERIAL() // Base item serial INVALIDSERIAL() // Invalid serial INVALIDID() // Invalid ID INVALIDCOLOUR() // Invalid colour Fixed an issue where JS character property .colour would modify origSkin property instead of colour Fixed an issue where JS character property .guildTitle returned the name of the character instead of the guild title Character JS property .poison can now also be used to set a character's poisoned level, not just read it Exposed Item property to JS engine: .ac // armour class for item (0-128). Primarily used for setting race-restrictions for equippable items, i.e. race X cannot equip items of armour class Y. .def // defensive value of item (Physical resistance post-AoS, AR in older UO) // NOTE: The following properties don't actually do anything yet, but can still be used in custom JS scripts if desired .resistCold // Cold resistance of item 0-1000, where 1000 equals 100.0% .resistHeat // Heat/Fire resistance of item 0-1000, where 1000 equals 100.0% .resistLight // Light resistance of item 0-1000, where 1000 equals 100.0% .resistLightning // Energy/Lightning resistance of item 0-1000, where 1000 equals 100.0% .resistPoison // Poison resistance of item 0-1000, where 1000 equals 100.0% .resistRain // Rain resistance of item 0-1000, where 1000 equals 100.0% .resistSnow // Snow resistance of item 0-1000, where 1000 equals 100.0% .damageHeat // Weapon deals Heat/Fire elemental damage (true/false) .damageCold // Weapon deals Cold elemental damage (true/false) .damageLight // Weapon deals Light elemental damage (true/false) .damageLightning // Weapon deals Lightning elemental damage (true/false) .damagePoison // Weapon deals Poison elemental damage (true/false) .damageRain // Weapon deals Rain/Water elemental damage (true/false) .damageSnow // Weapon deals Snow/Ice elemental damage (true/false) Added new UOX.INI setting under [server] to enable/disable shard response to ConnectUO server polling (disabled by default) Sub-commands are no longer included when registering packets to be overloaded via RegisterPacket function, as that part was never fully implemented. Packet-hook scripts can be setup for specific packet IDs, but any sub-command checking will need to be done in the script itself JS Packet Method GetDWord() now uses JS_NewNumberValue instead of INT_TO_JSVAL to read from the socket buffer, to better handle large numbers, which could previously be returned with wrong values. JS Function CalcItemFromSer() now uses a JS_GetStringBytes() and str_value() combo instead of JSVAL_TO_INT() to read the data provided in the function argument. This allows JS scripts to provide item serials to the function directly without needing to split it into four parts first (though that still works) Fixed issue where JS properties for multis didn't always return correct values The 'set command can now be used to set the armour class of items ('set ac #) Reimplemented 'tweak command in JS engine (js/commands/targeting/tweak.js) - can be used to view and modify properties of characters, character skills, items, multis and regions (target ground) Added placeholder packet-hook script (js/server/network/0xf1_connectUoServerPoll.js) to handle responses to ConnectUO server polling. By default this script does nothing, but serves as a placeholder for drop-in replacement scripts generated specifically for each shard by the ConnectUO service. Updated some commands to support an alternate STATIC keyword (can also be ommitted) to add base items: 'add static itemID 'tile static itemID Updated some commands with support for randomization. Provided itemID will be randomized based on provided rndValue: /js/commands/targeting/add.js: 'add itemID rndValue cmdtable.cpp and targeting.cpp: 'tile itemID rndValue 'tile itemID x1 x2 y1 y2 z rndValue Updated js/commands/custom/repeatingcmds.js to support 'm delete as an alias for 'rremove Added 'props as an alias for the 'tweak command Added 'teleport as an alias for the 'tele command (js/commands/targeting/tele.js) Added 'shavehair and 'shavebeard as aliases for 'kill hair and 'kill beard (js/commands/targeting/kill.js) Added 'noinvul and 'mortal aliases for the 'invul false command (js/commands/custom/misc-cmds.js) Added 'immortal and 'invul (without parameter) as aliases for the 'invul true command Added 'bringtopack as an alias of 'movetobag command (js/commands/targeting/movetobag.js) Updated check for cancelling of target cursor in various JS scripts Minor updates to various JS scripts Fixed issue where some item definitions in dfndata/harditems/harditems.dfn and dfndata/items/building/lighting.dfn used comma instead of space as delimiter for the VALUE tag, which thus never got applied Updated all NPC definitions to let NPCs spawn facing in random directions
2021-03-22 05:59:20 +08:00
}
const std::string item = "x" + hexId;
CScriptSection *toFind = FileLookup->FindEntrySubStr( item, hard_items_def );
2021-06-12 07:30:23 -04:00
if( toFind != nullptr )
{
ApplyItemSection( iCreated, toFind, item );
}
}
CItem *AutoStack( CSocket *mSock, CItem *iToStack, CItem *iPack );
//o------------------------------------------------------------------------------------------------o
//| Function - cItem::PlaceItem()
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 - 10/12/2003
//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 - Places an item that was just created
//o------------------------------------------------------------------------------------------------o
CItem * cItem::PlaceItem( CSocket *mSock, CChar *mChar, CItem *iCreated, const bool inPack, UI08 worldNumber, UI16 instanceId, SI16 xLoc, SI16 yLoc, SI08 zLoc )
{
if( ValidateObject( mChar ) && inPack )
2003-03-05 00:53:45 +00:00
{
if( iCreated->IsPileable() )
{
iCreated = AutoStack( mSock, iCreated, mChar->GetPackItem() ); // if it didn't stack, it's iCreated... if it did, then it's the stack!
}
2003-03-05 00:53:45 +00:00
else
{
iCreated->SetCont( mChar->GetPackItem() );
iCreated->PlaceInPack();
2003-03-05 00:53:45 +00:00
}
Housing Revamp and more Updated JS SysMessage function to accept up to 10 extra, optional arguments, which can be used with dictionary messages that require additional parameters like %s or %i Added new type of house privilege in cMultiObj.cpp to keep track of friends of the multi - HOUSEPRIV_FRIEND - which is stored during worldsaves as one or more Friend=<player serial> tags in house.wsc Added new type of house privilege in cMultiObj.cpp to keep track of guests of the multi - HOUSEPRIV_GUEST - which is stored during worldsaves as one or more Guest=<player serial> tags in house.wsc When items are created for houses upon house placement, a reference to the multi's serial is now stored in the house sign's MORE property to allow easier tracking of which house a particular sign belongs to Added tracking of new, persistent properties for houses via cMultiObj.cpp/h: lockdowns, secure containers, vendors, guests, friends, owners, ban location, public status, number of visits, timestamps Added a multitude of new methods in cMultiObj.cpp/h to assist in improving the functionality of houses Added new tags for houses in house.dfn (default values applied if tag not specified): MAXSECURECONTAINERS=4 - Max amount of secure containers allowed in a multi MAXLOCKDOWNS=256 - Max amount of lockdowns allowed in a multi MAXVENDORS=10 - Max amount of vendors allowed in a multi MAXBANS=50 - Max amount of bans in a multi's ban list MAXFRIENDS=50 - Max amount of friends in a multi's friend list MAXGUESTS=50 - Max amount of guests in a multi's guest list MAXOWNERS=8 - Max amount of owners and co-owners in a multi's owner list MAXTRASHCONTAINERS=1 - Max amount of trash containers allowed in multi SCRIPT=<scriptID> - Assign a JS script-ID directly to a multi FRONTDOOR - indicates that a door is the front door of a house. Cannot be locked in public houses! INTERIORDOOR - indicates that a door is an interior door of a house. Can be locked in public houses. BANX - Location X offset for multi's ban location, if not used, will try to use SE corner of multi instead BANY - Location Y offset for multi's ban location, if not used, will try to use SE corner of multi instead Added JS Event: onHouseCommand( tSock, multiObj, cmdID ) - For handling spoken house commands via JS scripts attached to multi. Updated JS Events: onEntrance() - can now trigger both for multi being entered and/or object entering onLeaving() - can now trigger both for multi being left and/or object entering onSpeech() - can now also trigger for items (in addition to chars) with event & script attached, if UOX.INI setting ITEMSDETECTSPEECH is enabled Added JS Multi methods: .IsBoat() - Returns whether the item (or multi) is a boat .IsOwner( playerToCheck ) - Returns whether a player is the owner of a multi .IsOnOwnerList( playerToCheck ) - Returns whether a player is on the (co-)owner list of a multi .IsOnFriendList( playerToCheck ) - Returns whether a player is on the friend list of a multi .IsOnGuestList( playerToCheck ) - Returns whether a player is on the guest list of a multi .IsOnBanList( playerToCheck ) - Returns whether a player is on the ban list of a multi .AddToFriendList( playertoAdd ) - Adds player to the friend list of a multi .RemoveFromFriendList( playertoRemove ) - Removes player from the friend list of a multi .AddToGuestList( playertoAdd ) - Adds player to the guest list of a multi .RemoveFromGuestList( playertoRemove ) - Removes player from the guest list of a multi .ClearOwnerList() - Clears all entries from a multi's (co-)owner list .ClearFriendList() - Clears all entries from a multi's friend list .ClearGuestList() - Clears all entries from a multi's guest list .ClearBanList() - Clears all entries from a multi's ban list .SecureContainer( itemToSecure ) - Secures a container in a multi .UnsecureContainer( itemToUnsecure ) - Unsecures a container in a multi .IsSecureContainer( itemToCheck ) - Checks if specified item is a secure container in a multi .LockDownItem( itemToLockDown) - Locks down an item in a multi .ReleaseItem( itemToRelease ) - Releases a locked down item in a multi .KillKeys() - Deletes ALL keys associated with a multi .AddTrashCont( itemToAdd ) - Add trash container to multi's list of trash containers .RemoveTrashCont( itemToRemove ) - Remove trash container from multi's list of trash containers Added JS Item (Multi only) properties: .lockdowns - Get the number of lockdowns in a multi .maxLockdowns - Get/Set the max number of lockdowns allowed in a multi .secureContainers - Get the number of secure containers in a multi .maxSecureContainers - Get/Set the max number of secure containers allowed in a multi .trashContainers - Get the number of trash containers in a multi .maxTrashContainers - Get/Set the max number of trash containers allowed in a multi .friends - Get the number of friends in a multi's friend list .maxFriends - Get/Set the max number of friends allowed in a multi's friend list .guests - Get the number of guests in a multi's guest list .maxGuests - Get/Set the max number of guests allowed in a multi's guest list .owners - Get the number of owners in a multi's owner list .maxOwners - Get/Set the max number of owners allowed in a multi's owner list .bans - Get the number of banned players in a multi's ban list .maxBans - Get/Set the max number of banned players allowed in a multi's ban list .vendors - Get the number of player vendors in a multi .maxVendors - Get the max number of player vendors allowed in a multi .deed - Get the item sectionID for deed used to place multi .isPublic - Get/Set the private/public state of a multi .buildTimestamp - Get the timestamp for when the house was originally placed .tradeTimestamp - Get the timestamp for when the house was last traded to another player .banX - Get/Set the ban location X offset for the multi .banY - Get/Set the ban location Y offset for the multi Added JS Character properties: .multi = Get/Set the multi object the character is in .accountNum = Get the account number the character belongs to .housesOwned = Get a count of houses owned by the character .housesCoOwned = Get a count of houses co-owned by the character Updated JS cBaseObject Methods .FirstItem(), .NextItem() and .FinishedItems() to also support iterating through items in multis Updated JS multi Methods .FirstChar(), .NextChar() and .FinishedChars() to support an additional parameter to specify what kind of characters to loop through: "default" or no parameter - all characters inside the multi "owner" - players on multi's owner list "friend" - players on multi's friend list "guest" - players on multi's guest list "banned" - players on multi's ban list Added new INI tags to a new section of uox.ini called [houses] DECAYTIMERINHOUSE=3600 // Decay timer in seconds for non-locked down items inside houses PROTECTPRIVATEHOUSES=1 // Toggles whether private houses will automatically boot unauthorized visitors (1) or not (0) TRACKHOUSESPERACCOUNT=1 // Toggles whether to track (and restrict) house ownership per account (1) or per character (0) MAXHOUSESOWNABLE=1 // Specifies the max amount of houses a player can own per account/char, depending on how house ownership is tracked MAXHOUSESCOOWNABLE=10 // Specifies the max amount of houses a player can co-own per character CANOWNANDCOOWNHOUSES=1 // Toggles whether players can own and co-own houses at the same time COOWNHOUSESONSAMEACCOUNT=1 // Toggles whether characters on same account as house owner will be treated as co-owners Added new INI tags in [settings] section of uox.ini: ITEMSDETECTSPEECH=0 // If enabled, server will search for nearby items with onSpeech JS event running whenever a character speaks. Disabled by default. MAXPLAYERPACKITEMS=125 // Defines max item capacity for player (and NPC) backpacks. Defaults to 125. Moved most of the existing house functionality to JS and expanded upon it to reach feature parity with houses in regular UO around Publish 15/16, with various extras thrown in for good measure and all functionality being customizable: js/server/house/house.js (15000) - handles detection of house commands and characters entering/leaving houses js/server/house/houseSign.js (15001) - contains and handles all house-related gumps/menus and what is shown when players interact with house sign js/server/house/houseCommands.js (15002) - handles functionality of house commands and other functionality such as transfer of ownership, demolishing house, etc. js/server/house/houseDeed.js (15003) - handles initial rules that allow/disallow placement of additional houses for players All house-related menus now fully handled through JS All house commands and other functionality now fully handled through JS Removed redundant hard-coded house functionality Implemented Co-owners, friends, guests for houses, with access rules in place for entry, lockdowns, house commands, etc. Implemented Private and Public houses Implemented Secure Containers and Trash Barrels Definable max lockdowns, secure containers, player vendors, bans, friends, guests, owners, trash containers and more - per house type JS scripts can now be attached directly to houses Doors in houses can be marked as front doors or interior doors, and will be treated differently with regards to private and public houses Added new item to dfndata/items/containers/misc.dfn - [trashbarrel] Added new JS script (js/items/trashbarrel.js) with trash barrel functionality for houses. Trash barrels that are marked as secure containers are only accessible by owners, co-owners and friends of the house. Various options available at top of script. Updated js/items/axe.js to support chopping up trash barrels and house add-ons in houses owned by the player Fixed an issue with house doors being left behind after demolishing houses while their doors were open Fixed an issue where GMs could be banned from player houses Added Line of Sight checks to speech, to give players some privacy in their own homes Updated house placement code to more accurately check for other multis, dynamic and static objects when placing houses; now requires free space around each house that cannot be blocked by other houses or items that can block player movement, and disallows placement of houses on roads Updated house placement code to move characters blocking house placement to SE corner of the house Updated house placement code to disallow placing houses in guarded regions, or in dungeons Added new DFN tag for regions to enable/disable player houses in specific regions: HOUSING=0/1 Added new region (247) that covers path to Valley of Eodon in Felucca Added new region (248) that covers Valley of Eodon in Ter-Mur, with player housing disabled Added new region (249) that covers entire T2A lands, with player housing disabled Updated SPACEX and SPACEY values for all houses in dfndata/house/house.dfn to match updated house placement code Added new JS property to Regions that can be used to determine or change state of player housing in a region: .canPlaceHouse() Updated rules for usage of dye tubs to dye locked down items; now only house owners or co-owners may dye locked down items Updated rules for usage of the following locked down items in a house, which are now only usable by house owners and co-owners Dyes, Guildstone Deeds, Recall Runes (renaming), Rename Deeds, Townstone Deeds, House Deeds, Boat Models, Player Vendor Deeds, Ore, Hair Dye Updated rules for usage of the following locked down items in a house, which are now only usable by house owners, co-owners and friends: Keys, Dye Tubs, Magic Scrolls, Fireworks Wands, Magic Wands, Smithing Tools, Mining Tools, Fishing Poles Updated item lockdown rules to allow locking down (and releasing) items in a container as long as the container is locked down, and to only allow releasing a locked down container if it's empty of locked down items Updated item lockdown rules to only allow locking down movement-blocking items further than 2 tiles away from doors Updated rules for releasing items in houses - now the house owner can release any locked down items, co-owners can release items locked down by themselves or by friends, while friends can release only items locked down by themselves Added some feedback to player about why their attempted house placement failed Items added by GMs directly into multis will now decay based on the house-specific decay timer instead of the regular one Fixed an issue that could cause items to almost instantly decay after being released from lockdown in a house Placing house add-ons now properly takes into account SPACEX and SPACEY values when checking if they can fit in selected area of houses Re-added SPACEX and SPACEY values for Pentagram and Loom house add-ons House add-ons can now be converted back into house add-on deeds by chopping them with an axe Added new item type - IT_HOUSEADDON (201) - used by house add-ons placed in player houses Fixed a bug where keys would stop working after being added to a keyring, and would turn into blank keys upon release from the keyring Added visitor count for public player houses, which keeps track of how many visits a public house has received, with each player counted max 1 time every 24 hours Fixed an issue with FindPlayersInOldVisrange() where it didn't take into account that players could see buildings further away than the standard update range. This could cause players to see ghost images of buildings if they were at the "right" distance when the building was being demolished Added NODECAY tag to all signs and doors in dfndata/house/house.dfn Added FRONTDOOR or INTERIORDOOR (as appropriate) to all doors in dfndata/house/house.dfn Added BANX and BANY to specify ban location for some houses in dfndata/house/house.dfn instead of relying on finding SE corner automatically Implemented strongboxes (js/server/house/strongbox.js) for co-owners of a house, which can be placed with the house command "i wish to place a strongbox". Max capacity is 25 items Updated 'REMOVE command to take an optional parameter - itemID. If supplied, the command will remove all items with this itemID from a targeted container Fixed a bug when checking if dynamic items were blocking valid spawn locations for NPCs, some function arguments were in the wrong order! Improved code that finds valid spawn locations for items and NPCs spawned via spawn regions. As server gradually builds up lists of valid spawn locations per region over time, it will start using these lists more often, rather than always look for brand new spawn locations. Fixed a bug with CMulHandler::CheckStaticFlag() that prevented NPCs from spawning inside buildings with no static floors! Fixed an issue with repeating commands that prevented GMs from being able to cancel them when using the ClassicUO client Exposed character property .accountNum to JS engine Extended CDataList class to include a Clear() method for clearing lists Updated JS File method .Open() to support an optional, third argument - subFolderName - that defines in which sub-folder of UOX3/shared/ to store/look for a file. If no third argument is supplied, UOX3 will default to using the shared folder itself. Updated JS File method .Length() to return a value of -1 for files that don't exist Added new code function, exposed to JS engine with same parameters, which simply checks if a given tile ID has a specific flag bool CheckTileFlag( UI16 itemID, TILEFLAG flagToCheck ) Added JS function used to find the root container of an item (if any) FindRootContainer( itemSerial ) FindRootContainer( item ) Added new JS function that allows deleting files from UOX3/shared/ folder or subfolders of shared folder. If no subFolderName is provided, looks for file directly in shared folder itself. Restrictions on file- and folder-names apply. bool DeleteFile( fileName, subFolderName ) Added new JS functions for checking if a specific client or server feature is enabled. See documentation for full list of client/server features. GetClientFeature( bitNum ) // Returns true if specified client feature is enabled on server GetServerFeature( bitNum ) // Returns true if specified server feature is enabled on server Added new JS function for returning the value of almost any server setting from UOX.INI GetServerSetting( settingNameInDoubleQuotes ) Updated JS function DoesDynamicBlock() with two new parameters - checkOnlyMultis and checkOnlyNonMultis Updated JS function DoesMapBlock() with two new parameters - checkMultiPlacement and checkForRoad Fixed an issue where a LoS check would prevent players from accessing containers in their own backpack Added new functions in findfuncs.cpp to make it easier to find items near another object or location: findNearbyItems( object, distance ) findNearbyItems( x, y, worldNumber, instanceID, distance ) Added new Item property - maxItems - used by containers to determine their max item capacity Added new Item property - totalItemCount - used to get total item count in a container (including sub-containers) Added check for max item capacity when creating new items that are added to a character's backpack - items will be created below character's feet if backpack is full! Added new DFN tag for items, used by containers to determine item capacity for a given container: MAXITEMS=# // 125 is the default for all containers if not set Added new JS Item properties: .maxItems // gets/sets item capacity for a given container .totalItemCount // gets total item count in a container, including sub-containers Updated item tooltips for containers to show accurate total item count, as well as to display max item capacity Fixed a bug where picking up items from a non-locked down pile of items on the floor inside a multi could cause the remaining pile to be seen as no longer inside the multi, disallowing locking it back down and causing it to decay based on regular decay timer instead of house-specific one Updated JS command set to allow setting poison-level on items ('set poison #) and hunger-level on characters ('set hunger #) Fixed an issue with js/item/food.js that prevented poisoned food from poisoning characters when eaten Fixed an issue with js/skill/poisoning.js that prevented players from poisoning food! Updated various JS scripts and hardcoded targeting functions to disallow the targeting of locked down resources using skills and tools Updated JS Method TextMessage() to support three extra, optional parameters. Note that if one optional parameter is included, all preceding optional parameters are also required! speechTarget - What kind of target is this message intended for? 0 - Only visible for sender and receiver of message 1 - Visible to all players in range 2 - Visible to all NPCs and players in range 3 - Visible to all PCs everywhere + NPCs in range 4 - Visible to all PCs everywhere (broadcast) 5 - Only visible for the receiver of the message speechTargetSerial - The serial of the receiver of the message, used if speechTarget is 0 or 5 speechFontType - The type of font to display the text in. Defaults to normal. 0 - Bold 1 - Normal with shadow 2 - Bold with shadow 3 - Normal 4 - Gothic 5 - Italic 6 - Small, dark 7 - Colourful 8 - Runic (only works with CAPS) 9 - Small, light Added timestamp to worldsaves in console, to make it easier to see when a particular world-save was done Added info about compiler/environment displayed at the top of the UOX3 console during startup Updated dictionary files with new messages primarily related to housing
2020-11-04 02:00:37 +08:00
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
// Only send tooltip if server feature for tooltips is enabled
if( cwmWorldState->ServerData()->GetServerFeature( SF_BIT_AOS ))
{
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
if( mSock != nullptr )
{
// Refresh container tooltip
CPToolTip pSend( iCreated->GetContSerial(), mSock );
mSock->Send(&pSend);
}
}
2003-03-05 00:53:45 +00:00
}
else if( ValidateObject( mChar ))
{
iCreated->SetLocation( mChar );
}
else
{
iCreated->SetLocation( xLoc, yLoc, zLoc, worldNumber, instanceId );
}
return iCreated;
}
//o------------------------------------------------------------------------------------------------o
//| Function - DecayItem()
//o------------------------------------------------------------------------------------------------o
//| Purpose - Cause items to decay when left on the ground
//o------------------------------------------------------------------------------------------------o
0.99.6d Cleaned up an issue with last commit where wrong npclists were used in some spawn regions Made a few additional adjustments to the new spawn regions in Lost Lands/New Haven Included more changes related to poison updates that should've been in previous commit (like the complete UOX.INI support for POISONCORROSIONSYSTEM setting) Adjusted region setup for New Haven to set the individual "building" regions within as a sub-region of the main town (regions.dfn) Fixed an issue where the displayed HP of an equipped item would not update correctly Further updates to convert timers 32-bit to 64-bit. This affects and addresses some potential issues with: Character creation/NPC guild-join timestamps, NPC movement, combat timers, idle timeouts, item decay, spellcasting Added support for new JS Events that can trigger from global script, and can be used to store persistent custom entries in players' paperdoll profiles: onProfileRequest( socket, profileOwnerChar ) - Triggers when client requests data for a paperdoll profile onProfileUpdate( socket, updatedText ) - Triggers when client sends updated data from paperdoll profile Added two new helper functions in code that allows faster (but very slightly less accurate) distance checks between two points: GetApproxDist( Point3_st a, Point3_st b ) GetApproxDist( CBaseObject *a, CBaseObject *b ) Improved pathfinding for NPCs attempting to follow another character, by adopting a system of weighted variables to help the NPC determine when to recalculate the path vs when to stick with the old, combined with faster distance checks via GetApproxDist(). The end result of this is faster, smarter and more responsive NPC followers and NPC opponents in combat. The variables influencing this include: how far the target has moved from last pathfind target location, whether NPC is heading in the overall right direction or not, time since last path calculation and some small randomization to avoid edge case jitters. Updated default command levels in commands.dfn, code and scripts to support the Seer role and make space for some custom roles. These are the new defaults as listed in commands.dfn, which should not be changed as they are linked to specific enums in code. Do take note that this might invalidate command levels for existing GMs/Seers/Counselors, who might need another round of 'make gm/seer/cns from an admin: ADMIN - command level 10 GM - command level 9 SEER - command level 7 CNS - command level 4 PLAYER - command level 0 Updated how UOX3 makes use of the account-level flags 0x2000 (Seer) and 0x4000 (Counselor). If either of these flags are set on an account, all new characters created on the accounts will automatically receive the relevant command privileges. Fixed an issue with 'wholist command that prevented admin characters from seeing characters with lower privilege levels in the list (js/commands/wholist.js) Fixed an issue with hiding/GM hide that prevented admin characters from seeing hidden characters with lower privilege levels in the world UOX3 now includes the cross-platform, header-only utf8cpp library found at https://github.com/nemtrif/utfcpp and freely available under Boost Software License v1.0. The immediate use-case for this is in code right now is to better handle strings related to custom paperdoll profiles, but will also look to make more heavy use of this in future updates
2025-06-28 22:37:42 +08:00
auto DecayItem( CItem& toDecay, const TIMERVAL nextDecayItems, const TIMERVAL nextDecayItemsInHouses ) -> bool
{
if( toDecay.GetDecayTime() == 0 || !cwmWorldState->ServerData()->GlobalItemDecay() )
{
if( toDecay.GetMulti() == INVALIDSERIAL )
{
Housing Revamp and more Updated JS SysMessage function to accept up to 10 extra, optional arguments, which can be used with dictionary messages that require additional parameters like %s or %i Added new type of house privilege in cMultiObj.cpp to keep track of friends of the multi - HOUSEPRIV_FRIEND - which is stored during worldsaves as one or more Friend=<player serial> tags in house.wsc Added new type of house privilege in cMultiObj.cpp to keep track of guests of the multi - HOUSEPRIV_GUEST - which is stored during worldsaves as one or more Guest=<player serial> tags in house.wsc When items are created for houses upon house placement, a reference to the multi's serial is now stored in the house sign's MORE property to allow easier tracking of which house a particular sign belongs to Added tracking of new, persistent properties for houses via cMultiObj.cpp/h: lockdowns, secure containers, vendors, guests, friends, owners, ban location, public status, number of visits, timestamps Added a multitude of new methods in cMultiObj.cpp/h to assist in improving the functionality of houses Added new tags for houses in house.dfn (default values applied if tag not specified): MAXSECURECONTAINERS=4 - Max amount of secure containers allowed in a multi MAXLOCKDOWNS=256 - Max amount of lockdowns allowed in a multi MAXVENDORS=10 - Max amount of vendors allowed in a multi MAXBANS=50 - Max amount of bans in a multi's ban list MAXFRIENDS=50 - Max amount of friends in a multi's friend list MAXGUESTS=50 - Max amount of guests in a multi's guest list MAXOWNERS=8 - Max amount of owners and co-owners in a multi's owner list MAXTRASHCONTAINERS=1 - Max amount of trash containers allowed in multi SCRIPT=<scriptID> - Assign a JS script-ID directly to a multi FRONTDOOR - indicates that a door is the front door of a house. Cannot be locked in public houses! INTERIORDOOR - indicates that a door is an interior door of a house. Can be locked in public houses. BANX - Location X offset for multi's ban location, if not used, will try to use SE corner of multi instead BANY - Location Y offset for multi's ban location, if not used, will try to use SE corner of multi instead Added JS Event: onHouseCommand( tSock, multiObj, cmdID ) - For handling spoken house commands via JS scripts attached to multi. Updated JS Events: onEntrance() - can now trigger both for multi being entered and/or object entering onLeaving() - can now trigger both for multi being left and/or object entering onSpeech() - can now also trigger for items (in addition to chars) with event & script attached, if UOX.INI setting ITEMSDETECTSPEECH is enabled Added JS Multi methods: .IsBoat() - Returns whether the item (or multi) is a boat .IsOwner( playerToCheck ) - Returns whether a player is the owner of a multi .IsOnOwnerList( playerToCheck ) - Returns whether a player is on the (co-)owner list of a multi .IsOnFriendList( playerToCheck ) - Returns whether a player is on the friend list of a multi .IsOnGuestList( playerToCheck ) - Returns whether a player is on the guest list of a multi .IsOnBanList( playerToCheck ) - Returns whether a player is on the ban list of a multi .AddToFriendList( playertoAdd ) - Adds player to the friend list of a multi .RemoveFromFriendList( playertoRemove ) - Removes player from the friend list of a multi .AddToGuestList( playertoAdd ) - Adds player to the guest list of a multi .RemoveFromGuestList( playertoRemove ) - Removes player from the guest list of a multi .ClearOwnerList() - Clears all entries from a multi's (co-)owner list .ClearFriendList() - Clears all entries from a multi's friend list .ClearGuestList() - Clears all entries from a multi's guest list .ClearBanList() - Clears all entries from a multi's ban list .SecureContainer( itemToSecure ) - Secures a container in a multi .UnsecureContainer( itemToUnsecure ) - Unsecures a container in a multi .IsSecureContainer( itemToCheck ) - Checks if specified item is a secure container in a multi .LockDownItem( itemToLockDown) - Locks down an item in a multi .ReleaseItem( itemToRelease ) - Releases a locked down item in a multi .KillKeys() - Deletes ALL keys associated with a multi .AddTrashCont( itemToAdd ) - Add trash container to multi's list of trash containers .RemoveTrashCont( itemToRemove ) - Remove trash container from multi's list of trash containers Added JS Item (Multi only) properties: .lockdowns - Get the number of lockdowns in a multi .maxLockdowns - Get/Set the max number of lockdowns allowed in a multi .secureContainers - Get the number of secure containers in a multi .maxSecureContainers - Get/Set the max number of secure containers allowed in a multi .trashContainers - Get the number of trash containers in a multi .maxTrashContainers - Get/Set the max number of trash containers allowed in a multi .friends - Get the number of friends in a multi's friend list .maxFriends - Get/Set the max number of friends allowed in a multi's friend list .guests - Get the number of guests in a multi's guest list .maxGuests - Get/Set the max number of guests allowed in a multi's guest list .owners - Get the number of owners in a multi's owner list .maxOwners - Get/Set the max number of owners allowed in a multi's owner list .bans - Get the number of banned players in a multi's ban list .maxBans - Get/Set the max number of banned players allowed in a multi's ban list .vendors - Get the number of player vendors in a multi .maxVendors - Get the max number of player vendors allowed in a multi .deed - Get the item sectionID for deed used to place multi .isPublic - Get/Set the private/public state of a multi .buildTimestamp - Get the timestamp for when the house was originally placed .tradeTimestamp - Get the timestamp for when the house was last traded to another player .banX - Get/Set the ban location X offset for the multi .banY - Get/Set the ban location Y offset for the multi Added JS Character properties: .multi = Get/Set the multi object the character is in .accountNum = Get the account number the character belongs to .housesOwned = Get a count of houses owned by the character .housesCoOwned = Get a count of houses co-owned by the character Updated JS cBaseObject Methods .FirstItem(), .NextItem() and .FinishedItems() to also support iterating through items in multis Updated JS multi Methods .FirstChar(), .NextChar() and .FinishedChars() to support an additional parameter to specify what kind of characters to loop through: "default" or no parameter - all characters inside the multi "owner" - players on multi's owner list "friend" - players on multi's friend list "guest" - players on multi's guest list "banned" - players on multi's ban list Added new INI tags to a new section of uox.ini called [houses] DECAYTIMERINHOUSE=3600 // Decay timer in seconds for non-locked down items inside houses PROTECTPRIVATEHOUSES=1 // Toggles whether private houses will automatically boot unauthorized visitors (1) or not (0) TRACKHOUSESPERACCOUNT=1 // Toggles whether to track (and restrict) house ownership per account (1) or per character (0) MAXHOUSESOWNABLE=1 // Specifies the max amount of houses a player can own per account/char, depending on how house ownership is tracked MAXHOUSESCOOWNABLE=10 // Specifies the max amount of houses a player can co-own per character CANOWNANDCOOWNHOUSES=1 // Toggles whether players can own and co-own houses at the same time COOWNHOUSESONSAMEACCOUNT=1 // Toggles whether characters on same account as house owner will be treated as co-owners Added new INI tags in [settings] section of uox.ini: ITEMSDETECTSPEECH=0 // If enabled, server will search for nearby items with onSpeech JS event running whenever a character speaks. Disabled by default. MAXPLAYERPACKITEMS=125 // Defines max item capacity for player (and NPC) backpacks. Defaults to 125. Moved most of the existing house functionality to JS and expanded upon it to reach feature parity with houses in regular UO around Publish 15/16, with various extras thrown in for good measure and all functionality being customizable: js/server/house/house.js (15000) - handles detection of house commands and characters entering/leaving houses js/server/house/houseSign.js (15001) - contains and handles all house-related gumps/menus and what is shown when players interact with house sign js/server/house/houseCommands.js (15002) - handles functionality of house commands and other functionality such as transfer of ownership, demolishing house, etc. js/server/house/houseDeed.js (15003) - handles initial rules that allow/disallow placement of additional houses for players All house-related menus now fully handled through JS All house commands and other functionality now fully handled through JS Removed redundant hard-coded house functionality Implemented Co-owners, friends, guests for houses, with access rules in place for entry, lockdowns, house commands, etc. Implemented Private and Public houses Implemented Secure Containers and Trash Barrels Definable max lockdowns, secure containers, player vendors, bans, friends, guests, owners, trash containers and more - per house type JS scripts can now be attached directly to houses Doors in houses can be marked as front doors or interior doors, and will be treated differently with regards to private and public houses Added new item to dfndata/items/containers/misc.dfn - [trashbarrel] Added new JS script (js/items/trashbarrel.js) with trash barrel functionality for houses. Trash barrels that are marked as secure containers are only accessible by owners, co-owners and friends of the house. Various options available at top of script. Updated js/items/axe.js to support chopping up trash barrels and house add-ons in houses owned by the player Fixed an issue with house doors being left behind after demolishing houses while their doors were open Fixed an issue where GMs could be banned from player houses Added Line of Sight checks to speech, to give players some privacy in their own homes Updated house placement code to more accurately check for other multis, dynamic and static objects when placing houses; now requires free space around each house that cannot be blocked by other houses or items that can block player movement, and disallows placement of houses on roads Updated house placement code to move characters blocking house placement to SE corner of the house Updated house placement code to disallow placing houses in guarded regions, or in dungeons Added new DFN tag for regions to enable/disable player houses in specific regions: HOUSING=0/1 Added new region (247) that covers path to Valley of Eodon in Felucca Added new region (248) that covers Valley of Eodon in Ter-Mur, with player housing disabled Added new region (249) that covers entire T2A lands, with player housing disabled Updated SPACEX and SPACEY values for all houses in dfndata/house/house.dfn to match updated house placement code Added new JS property to Regions that can be used to determine or change state of player housing in a region: .canPlaceHouse() Updated rules for usage of dye tubs to dye locked down items; now only house owners or co-owners may dye locked down items Updated rules for usage of the following locked down items in a house, which are now only usable by house owners and co-owners Dyes, Guildstone Deeds, Recall Runes (renaming), Rename Deeds, Townstone Deeds, House Deeds, Boat Models, Player Vendor Deeds, Ore, Hair Dye Updated rules for usage of the following locked down items in a house, which are now only usable by house owners, co-owners and friends: Keys, Dye Tubs, Magic Scrolls, Fireworks Wands, Magic Wands, Smithing Tools, Mining Tools, Fishing Poles Updated item lockdown rules to allow locking down (and releasing) items in a container as long as the container is locked down, and to only allow releasing a locked down container if it's empty of locked down items Updated item lockdown rules to only allow locking down movement-blocking items further than 2 tiles away from doors Updated rules for releasing items in houses - now the house owner can release any locked down items, co-owners can release items locked down by themselves or by friends, while friends can release only items locked down by themselves Added some feedback to player about why their attempted house placement failed Items added by GMs directly into multis will now decay based on the house-specific decay timer instead of the regular one Fixed an issue that could cause items to almost instantly decay after being released from lockdown in a house Placing house add-ons now properly takes into account SPACEX and SPACEY values when checking if they can fit in selected area of houses Re-added SPACEX and SPACEY values for Pentagram and Loom house add-ons House add-ons can now be converted back into house add-on deeds by chopping them with an axe Added new item type - IT_HOUSEADDON (201) - used by house add-ons placed in player houses Fixed a bug where keys would stop working after being added to a keyring, and would turn into blank keys upon release from the keyring Added visitor count for public player houses, which keeps track of how many visits a public house has received, with each player counted max 1 time every 24 hours Fixed an issue with FindPlayersInOldVisrange() where it didn't take into account that players could see buildings further away than the standard update range. This could cause players to see ghost images of buildings if they were at the "right" distance when the building was being demolished Added NODECAY tag to all signs and doors in dfndata/house/house.dfn Added FRONTDOOR or INTERIORDOOR (as appropriate) to all doors in dfndata/house/house.dfn Added BANX and BANY to specify ban location for some houses in dfndata/house/house.dfn instead of relying on finding SE corner automatically Implemented strongboxes (js/server/house/strongbox.js) for co-owners of a house, which can be placed with the house command "i wish to place a strongbox". Max capacity is 25 items Updated 'REMOVE command to take an optional parameter - itemID. If supplied, the command will remove all items with this itemID from a targeted container Fixed a bug when checking if dynamic items were blocking valid spawn locations for NPCs, some function arguments were in the wrong order! Improved code that finds valid spawn locations for items and NPCs spawned via spawn regions. As server gradually builds up lists of valid spawn locations per region over time, it will start using these lists more often, rather than always look for brand new spawn locations. Fixed a bug with CMulHandler::CheckStaticFlag() that prevented NPCs from spawning inside buildings with no static floors! Fixed an issue with repeating commands that prevented GMs from being able to cancel them when using the ClassicUO client Exposed character property .accountNum to JS engine Extended CDataList class to include a Clear() method for clearing lists Updated JS File method .Open() to support an optional, third argument - subFolderName - that defines in which sub-folder of UOX3/shared/ to store/look for a file. If no third argument is supplied, UOX3 will default to using the shared folder itself. Updated JS File method .Length() to return a value of -1 for files that don't exist Added new code function, exposed to JS engine with same parameters, which simply checks if a given tile ID has a specific flag bool CheckTileFlag( UI16 itemID, TILEFLAG flagToCheck ) Added JS function used to find the root container of an item (if any) FindRootContainer( itemSerial ) FindRootContainer( item ) Added new JS function that allows deleting files from UOX3/shared/ folder or subfolders of shared folder. If no subFolderName is provided, looks for file directly in shared folder itself. Restrictions on file- and folder-names apply. bool DeleteFile( fileName, subFolderName ) Added new JS functions for checking if a specific client or server feature is enabled. See documentation for full list of client/server features. GetClientFeature( bitNum ) // Returns true if specified client feature is enabled on server GetServerFeature( bitNum ) // Returns true if specified server feature is enabled on server Added new JS function for returning the value of almost any server setting from UOX.INI GetServerSetting( settingNameInDoubleQuotes ) Updated JS function DoesDynamicBlock() with two new parameters - checkOnlyMultis and checkOnlyNonMultis Updated JS function DoesMapBlock() with two new parameters - checkMultiPlacement and checkForRoad Fixed an issue where a LoS check would prevent players from accessing containers in their own backpack Added new functions in findfuncs.cpp to make it easier to find items near another object or location: findNearbyItems( object, distance ) findNearbyItems( x, y, worldNumber, instanceID, distance ) Added new Item property - maxItems - used by containers to determine their max item capacity Added new Item property - totalItemCount - used to get total item count in a container (including sub-containers) Added check for max item capacity when creating new items that are added to a character's backpack - items will be created below character's feet if backpack is full! Added new DFN tag for items, used by containers to determine item capacity for a given container: MAXITEMS=# // 125 is the default for all containers if not set Added new JS Item properties: .maxItems // gets/sets item capacity for a given container .totalItemCount // gets total item count in a container, including sub-containers Updated item tooltips for containers to show accurate total item count, as well as to display max item capacity Fixed a bug where picking up items from a non-locked down pile of items on the floor inside a multi could cause the remaining pile to be seen as no longer inside the multi, disallowing locking it back down and causing it to decay based on regular decay timer instead of house-specific one Updated JS command set to allow setting poison-level on items ('set poison #) and hunger-level on characters ('set hunger #) Fixed an issue with js/item/food.js that prevented poisoned food from poisoning characters when eaten Fixed an issue with js/skill/poisoning.js that prevented players from poisoning food! Updated various JS scripts and hardcoded targeting functions to disallow the targeting of locked down resources using skills and tools Updated JS Method TextMessage() to support three extra, optional parameters. Note that if one optional parameter is included, all preceding optional parameters are also required! speechTarget - What kind of target is this message intended for? 0 - Only visible for sender and receiver of message 1 - Visible to all players in range 2 - Visible to all NPCs and players in range 3 - Visible to all PCs everywhere + NPCs in range 4 - Visible to all PCs everywhere (broadcast) 5 - Only visible for the receiver of the message speechTargetSerial - The serial of the receiver of the message, used if speechTarget is 0 or 5 speechFontType - The type of font to display the text in. Defaults to normal. 0 - Bold 1 - Normal with shadow 2 - Bold with shadow 3 - Normal 4 - Gothic 5 - Italic 6 - Small, dark 7 - Colourful 8 - Runic (only works with CAPS) 9 - Small, light Added timestamp to worldsaves in console, to make it easier to see when a particular world-save was done Added info about compiler/environment displayed at the top of the UOX3 console during startup Updated dictionary files with new messages primarily related to housing
2020-11-04 02:00:37 +08:00
toDecay.SetDecayTime( nextDecayItems );
}
else
{
Housing Revamp and more Updated JS SysMessage function to accept up to 10 extra, optional arguments, which can be used with dictionary messages that require additional parameters like %s or %i Added new type of house privilege in cMultiObj.cpp to keep track of friends of the multi - HOUSEPRIV_FRIEND - which is stored during worldsaves as one or more Friend=<player serial> tags in house.wsc Added new type of house privilege in cMultiObj.cpp to keep track of guests of the multi - HOUSEPRIV_GUEST - which is stored during worldsaves as one or more Guest=<player serial> tags in house.wsc When items are created for houses upon house placement, a reference to the multi's serial is now stored in the house sign's MORE property to allow easier tracking of which house a particular sign belongs to Added tracking of new, persistent properties for houses via cMultiObj.cpp/h: lockdowns, secure containers, vendors, guests, friends, owners, ban location, public status, number of visits, timestamps Added a multitude of new methods in cMultiObj.cpp/h to assist in improving the functionality of houses Added new tags for houses in house.dfn (default values applied if tag not specified): MAXSECURECONTAINERS=4 - Max amount of secure containers allowed in a multi MAXLOCKDOWNS=256 - Max amount of lockdowns allowed in a multi MAXVENDORS=10 - Max amount of vendors allowed in a multi MAXBANS=50 - Max amount of bans in a multi's ban list MAXFRIENDS=50 - Max amount of friends in a multi's friend list MAXGUESTS=50 - Max amount of guests in a multi's guest list MAXOWNERS=8 - Max amount of owners and co-owners in a multi's owner list MAXTRASHCONTAINERS=1 - Max amount of trash containers allowed in multi SCRIPT=<scriptID> - Assign a JS script-ID directly to a multi FRONTDOOR - indicates that a door is the front door of a house. Cannot be locked in public houses! INTERIORDOOR - indicates that a door is an interior door of a house. Can be locked in public houses. BANX - Location X offset for multi's ban location, if not used, will try to use SE corner of multi instead BANY - Location Y offset for multi's ban location, if not used, will try to use SE corner of multi instead Added JS Event: onHouseCommand( tSock, multiObj, cmdID ) - For handling spoken house commands via JS scripts attached to multi. Updated JS Events: onEntrance() - can now trigger both for multi being entered and/or object entering onLeaving() - can now trigger both for multi being left and/or object entering onSpeech() - can now also trigger for items (in addition to chars) with event & script attached, if UOX.INI setting ITEMSDETECTSPEECH is enabled Added JS Multi methods: .IsBoat() - Returns whether the item (or multi) is a boat .IsOwner( playerToCheck ) - Returns whether a player is the owner of a multi .IsOnOwnerList( playerToCheck ) - Returns whether a player is on the (co-)owner list of a multi .IsOnFriendList( playerToCheck ) - Returns whether a player is on the friend list of a multi .IsOnGuestList( playerToCheck ) - Returns whether a player is on the guest list of a multi .IsOnBanList( playerToCheck ) - Returns whether a player is on the ban list of a multi .AddToFriendList( playertoAdd ) - Adds player to the friend list of a multi .RemoveFromFriendList( playertoRemove ) - Removes player from the friend list of a multi .AddToGuestList( playertoAdd ) - Adds player to the guest list of a multi .RemoveFromGuestList( playertoRemove ) - Removes player from the guest list of a multi .ClearOwnerList() - Clears all entries from a multi's (co-)owner list .ClearFriendList() - Clears all entries from a multi's friend list .ClearGuestList() - Clears all entries from a multi's guest list .ClearBanList() - Clears all entries from a multi's ban list .SecureContainer( itemToSecure ) - Secures a container in a multi .UnsecureContainer( itemToUnsecure ) - Unsecures a container in a multi .IsSecureContainer( itemToCheck ) - Checks if specified item is a secure container in a multi .LockDownItem( itemToLockDown) - Locks down an item in a multi .ReleaseItem( itemToRelease ) - Releases a locked down item in a multi .KillKeys() - Deletes ALL keys associated with a multi .AddTrashCont( itemToAdd ) - Add trash container to multi's list of trash containers .RemoveTrashCont( itemToRemove ) - Remove trash container from multi's list of trash containers Added JS Item (Multi only) properties: .lockdowns - Get the number of lockdowns in a multi .maxLockdowns - Get/Set the max number of lockdowns allowed in a multi .secureContainers - Get the number of secure containers in a multi .maxSecureContainers - Get/Set the max number of secure containers allowed in a multi .trashContainers - Get the number of trash containers in a multi .maxTrashContainers - Get/Set the max number of trash containers allowed in a multi .friends - Get the number of friends in a multi's friend list .maxFriends - Get/Set the max number of friends allowed in a multi's friend list .guests - Get the number of guests in a multi's guest list .maxGuests - Get/Set the max number of guests allowed in a multi's guest list .owners - Get the number of owners in a multi's owner list .maxOwners - Get/Set the max number of owners allowed in a multi's owner list .bans - Get the number of banned players in a multi's ban list .maxBans - Get/Set the max number of banned players allowed in a multi's ban list .vendors - Get the number of player vendors in a multi .maxVendors - Get the max number of player vendors allowed in a multi .deed - Get the item sectionID for deed used to place multi .isPublic - Get/Set the private/public state of a multi .buildTimestamp - Get the timestamp for when the house was originally placed .tradeTimestamp - Get the timestamp for when the house was last traded to another player .banX - Get/Set the ban location X offset for the multi .banY - Get/Set the ban location Y offset for the multi Added JS Character properties: .multi = Get/Set the multi object the character is in .accountNum = Get the account number the character belongs to .housesOwned = Get a count of houses owned by the character .housesCoOwned = Get a count of houses co-owned by the character Updated JS cBaseObject Methods .FirstItem(), .NextItem() and .FinishedItems() to also support iterating through items in multis Updated JS multi Methods .FirstChar(), .NextChar() and .FinishedChars() to support an additional parameter to specify what kind of characters to loop through: "default" or no parameter - all characters inside the multi "owner" - players on multi's owner list "friend" - players on multi's friend list "guest" - players on multi's guest list "banned" - players on multi's ban list Added new INI tags to a new section of uox.ini called [houses] DECAYTIMERINHOUSE=3600 // Decay timer in seconds for non-locked down items inside houses PROTECTPRIVATEHOUSES=1 // Toggles whether private houses will automatically boot unauthorized visitors (1) or not (0) TRACKHOUSESPERACCOUNT=1 // Toggles whether to track (and restrict) house ownership per account (1) or per character (0) MAXHOUSESOWNABLE=1 // Specifies the max amount of houses a player can own per account/char, depending on how house ownership is tracked MAXHOUSESCOOWNABLE=10 // Specifies the max amount of houses a player can co-own per character CANOWNANDCOOWNHOUSES=1 // Toggles whether players can own and co-own houses at the same time COOWNHOUSESONSAMEACCOUNT=1 // Toggles whether characters on same account as house owner will be treated as co-owners Added new INI tags in [settings] section of uox.ini: ITEMSDETECTSPEECH=0 // If enabled, server will search for nearby items with onSpeech JS event running whenever a character speaks. Disabled by default. MAXPLAYERPACKITEMS=125 // Defines max item capacity for player (and NPC) backpacks. Defaults to 125. Moved most of the existing house functionality to JS and expanded upon it to reach feature parity with houses in regular UO around Publish 15/16, with various extras thrown in for good measure and all functionality being customizable: js/server/house/house.js (15000) - handles detection of house commands and characters entering/leaving houses js/server/house/houseSign.js (15001) - contains and handles all house-related gumps/menus and what is shown when players interact with house sign js/server/house/houseCommands.js (15002) - handles functionality of house commands and other functionality such as transfer of ownership, demolishing house, etc. js/server/house/houseDeed.js (15003) - handles initial rules that allow/disallow placement of additional houses for players All house-related menus now fully handled through JS All house commands and other functionality now fully handled through JS Removed redundant hard-coded house functionality Implemented Co-owners, friends, guests for houses, with access rules in place for entry, lockdowns, house commands, etc. Implemented Private and Public houses Implemented Secure Containers and Trash Barrels Definable max lockdowns, secure containers, player vendors, bans, friends, guests, owners, trash containers and more - per house type JS scripts can now be attached directly to houses Doors in houses can be marked as front doors or interior doors, and will be treated differently with regards to private and public houses Added new item to dfndata/items/containers/misc.dfn - [trashbarrel] Added new JS script (js/items/trashbarrel.js) with trash barrel functionality for houses. Trash barrels that are marked as secure containers are only accessible by owners, co-owners and friends of the house. Various options available at top of script. Updated js/items/axe.js to support chopping up trash barrels and house add-ons in houses owned by the player Fixed an issue with house doors being left behind after demolishing houses while their doors were open Fixed an issue where GMs could be banned from player houses Added Line of Sight checks to speech, to give players some privacy in their own homes Updated house placement code to more accurately check for other multis, dynamic and static objects when placing houses; now requires free space around each house that cannot be blocked by other houses or items that can block player movement, and disallows placement of houses on roads Updated house placement code to move characters blocking house placement to SE corner of the house Updated house placement code to disallow placing houses in guarded regions, or in dungeons Added new DFN tag for regions to enable/disable player houses in specific regions: HOUSING=0/1 Added new region (247) that covers path to Valley of Eodon in Felucca Added new region (248) that covers Valley of Eodon in Ter-Mur, with player housing disabled Added new region (249) that covers entire T2A lands, with player housing disabled Updated SPACEX and SPACEY values for all houses in dfndata/house/house.dfn to match updated house placement code Added new JS property to Regions that can be used to determine or change state of player housing in a region: .canPlaceHouse() Updated rules for usage of dye tubs to dye locked down items; now only house owners or co-owners may dye locked down items Updated rules for usage of the following locked down items in a house, which are now only usable by house owners and co-owners Dyes, Guildstone Deeds, Recall Runes (renaming), Rename Deeds, Townstone Deeds, House Deeds, Boat Models, Player Vendor Deeds, Ore, Hair Dye Updated rules for usage of the following locked down items in a house, which are now only usable by house owners, co-owners and friends: Keys, Dye Tubs, Magic Scrolls, Fireworks Wands, Magic Wands, Smithing Tools, Mining Tools, Fishing Poles Updated item lockdown rules to allow locking down (and releasing) items in a container as long as the container is locked down, and to only allow releasing a locked down container if it's empty of locked down items Updated item lockdown rules to only allow locking down movement-blocking items further than 2 tiles away from doors Updated rules for releasing items in houses - now the house owner can release any locked down items, co-owners can release items locked down by themselves or by friends, while friends can release only items locked down by themselves Added some feedback to player about why their attempted house placement failed Items added by GMs directly into multis will now decay based on the house-specific decay timer instead of the regular one Fixed an issue that could cause items to almost instantly decay after being released from lockdown in a house Placing house add-ons now properly takes into account SPACEX and SPACEY values when checking if they can fit in selected area of houses Re-added SPACEX and SPACEY values for Pentagram and Loom house add-ons House add-ons can now be converted back into house add-on deeds by chopping them with an axe Added new item type - IT_HOUSEADDON (201) - used by house add-ons placed in player houses Fixed a bug where keys would stop working after being added to a keyring, and would turn into blank keys upon release from the keyring Added visitor count for public player houses, which keeps track of how many visits a public house has received, with each player counted max 1 time every 24 hours Fixed an issue with FindPlayersInOldVisrange() where it didn't take into account that players could see buildings further away than the standard update range. This could cause players to see ghost images of buildings if they were at the "right" distance when the building was being demolished Added NODECAY tag to all signs and doors in dfndata/house/house.dfn Added FRONTDOOR or INTERIORDOOR (as appropriate) to all doors in dfndata/house/house.dfn Added BANX and BANY to specify ban location for some houses in dfndata/house/house.dfn instead of relying on finding SE corner automatically Implemented strongboxes (js/server/house/strongbox.js) for co-owners of a house, which can be placed with the house command "i wish to place a strongbox". Max capacity is 25 items Updated 'REMOVE command to take an optional parameter - itemID. If supplied, the command will remove all items with this itemID from a targeted container Fixed a bug when checking if dynamic items were blocking valid spawn locations for NPCs, some function arguments were in the wrong order! Improved code that finds valid spawn locations for items and NPCs spawned via spawn regions. As server gradually builds up lists of valid spawn locations per region over time, it will start using these lists more often, rather than always look for brand new spawn locations. Fixed a bug with CMulHandler::CheckStaticFlag() that prevented NPCs from spawning inside buildings with no static floors! Fixed an issue with repeating commands that prevented GMs from being able to cancel them when using the ClassicUO client Exposed character property .accountNum to JS engine Extended CDataList class to include a Clear() method for clearing lists Updated JS File method .Open() to support an optional, third argument - subFolderName - that defines in which sub-folder of UOX3/shared/ to store/look for a file. If no third argument is supplied, UOX3 will default to using the shared folder itself. Updated JS File method .Length() to return a value of -1 for files that don't exist Added new code function, exposed to JS engine with same parameters, which simply checks if a given tile ID has a specific flag bool CheckTileFlag( UI16 itemID, TILEFLAG flagToCheck ) Added JS function used to find the root container of an item (if any) FindRootContainer( itemSerial ) FindRootContainer( item ) Added new JS function that allows deleting files from UOX3/shared/ folder or subfolders of shared folder. If no subFolderName is provided, looks for file directly in shared folder itself. Restrictions on file- and folder-names apply. bool DeleteFile( fileName, subFolderName ) Added new JS functions for checking if a specific client or server feature is enabled. See documentation for full list of client/server features. GetClientFeature( bitNum ) // Returns true if specified client feature is enabled on server GetServerFeature( bitNum ) // Returns true if specified server feature is enabled on server Added new JS function for returning the value of almost any server setting from UOX.INI GetServerSetting( settingNameInDoubleQuotes ) Updated JS function DoesDynamicBlock() with two new parameters - checkOnlyMultis and checkOnlyNonMultis Updated JS function DoesMapBlock() with two new parameters - checkMultiPlacement and checkForRoad Fixed an issue where a LoS check would prevent players from accessing containers in their own backpack Added new functions in findfuncs.cpp to make it easier to find items near another object or location: findNearbyItems( object, distance ) findNearbyItems( x, y, worldNumber, instanceID, distance ) Added new Item property - maxItems - used by containers to determine their max item capacity Added new Item property - totalItemCount - used to get total item count in a container (including sub-containers) Added check for max item capacity when creating new items that are added to a character's backpack - items will be created below character's feet if backpack is full! Added new DFN tag for items, used by containers to determine item capacity for a given container: MAXITEMS=# // 125 is the default for all containers if not set Added new JS Item properties: .maxItems // gets/sets item capacity for a given container .totalItemCount // gets total item count in a container, including sub-containers Updated item tooltips for containers to show accurate total item count, as well as to display max item capacity Fixed a bug where picking up items from a non-locked down pile of items on the floor inside a multi could cause the remaining pile to be seen as no longer inside the multi, disallowing locking it back down and causing it to decay based on regular decay timer instead of house-specific one Updated JS command set to allow setting poison-level on items ('set poison #) and hunger-level on characters ('set hunger #) Fixed an issue with js/item/food.js that prevented poisoned food from poisoning characters when eaten Fixed an issue with js/skill/poisoning.js that prevented players from poisoning food! Updated various JS scripts and hardcoded targeting functions to disallow the targeting of locked down resources using skills and tools Updated JS Method TextMessage() to support three extra, optional parameters. Note that if one optional parameter is included, all preceding optional parameters are also required! speechTarget - What kind of target is this message intended for? 0 - Only visible for sender and receiver of message 1 - Visible to all players in range 2 - Visible to all NPCs and players in range 3 - Visible to all PCs everywhere + NPCs in range 4 - Visible to all PCs everywhere (broadcast) 5 - Only visible for the receiver of the message speechTargetSerial - The serial of the receiver of the message, used if speechTarget is 0 or 5 speechFontType - The type of font to display the text in. Defaults to normal. 0 - Bold 1 - Normal with shadow 2 - Bold with shadow 3 - Normal 4 - Gothic 5 - Italic 6 - Small, dark 7 - Colourful 8 - Runic (only works with CAPS) 9 - Small, light Added timestamp to worldsaves in console, to make it easier to see when a particular world-save was done Added info about compiler/environment displayed at the top of the UOX3 console during startup Updated dictionary files with new messages primarily related to housing
2020-11-04 02:00:37 +08:00
toDecay.SetDecayTime( nextDecayItemsInHouses );
}
return false;
}
const auto isCorpse = toDecay.IsCorpse();
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
// Multis
if( !toDecay.IsFieldSpell() && !isCorpse ) // Gives fieldspells a chance to decay in multis
{
if( toDecay.IsLockedDown() || toDecay.IsDoorOpen() ||
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
( ValidateObject( toDecay.GetMultiObj() ) &&
( toDecay.GetMovable() >= 2 || !cwmWorldState->ServerData()->ItemDecayInHouses() )))
{
Housing Revamp and more Updated JS SysMessage function to accept up to 10 extra, optional arguments, which can be used with dictionary messages that require additional parameters like %s or %i Added new type of house privilege in cMultiObj.cpp to keep track of friends of the multi - HOUSEPRIV_FRIEND - which is stored during worldsaves as one or more Friend=<player serial> tags in house.wsc Added new type of house privilege in cMultiObj.cpp to keep track of guests of the multi - HOUSEPRIV_GUEST - which is stored during worldsaves as one or more Guest=<player serial> tags in house.wsc When items are created for houses upon house placement, a reference to the multi's serial is now stored in the house sign's MORE property to allow easier tracking of which house a particular sign belongs to Added tracking of new, persistent properties for houses via cMultiObj.cpp/h: lockdowns, secure containers, vendors, guests, friends, owners, ban location, public status, number of visits, timestamps Added a multitude of new methods in cMultiObj.cpp/h to assist in improving the functionality of houses Added new tags for houses in house.dfn (default values applied if tag not specified): MAXSECURECONTAINERS=4 - Max amount of secure containers allowed in a multi MAXLOCKDOWNS=256 - Max amount of lockdowns allowed in a multi MAXVENDORS=10 - Max amount of vendors allowed in a multi MAXBANS=50 - Max amount of bans in a multi's ban list MAXFRIENDS=50 - Max amount of friends in a multi's friend list MAXGUESTS=50 - Max amount of guests in a multi's guest list MAXOWNERS=8 - Max amount of owners and co-owners in a multi's owner list MAXTRASHCONTAINERS=1 - Max amount of trash containers allowed in multi SCRIPT=<scriptID> - Assign a JS script-ID directly to a multi FRONTDOOR - indicates that a door is the front door of a house. Cannot be locked in public houses! INTERIORDOOR - indicates that a door is an interior door of a house. Can be locked in public houses. BANX - Location X offset for multi's ban location, if not used, will try to use SE corner of multi instead BANY - Location Y offset for multi's ban location, if not used, will try to use SE corner of multi instead Added JS Event: onHouseCommand( tSock, multiObj, cmdID ) - For handling spoken house commands via JS scripts attached to multi. Updated JS Events: onEntrance() - can now trigger both for multi being entered and/or object entering onLeaving() - can now trigger both for multi being left and/or object entering onSpeech() - can now also trigger for items (in addition to chars) with event & script attached, if UOX.INI setting ITEMSDETECTSPEECH is enabled Added JS Multi methods: .IsBoat() - Returns whether the item (or multi) is a boat .IsOwner( playerToCheck ) - Returns whether a player is the owner of a multi .IsOnOwnerList( playerToCheck ) - Returns whether a player is on the (co-)owner list of a multi .IsOnFriendList( playerToCheck ) - Returns whether a player is on the friend list of a multi .IsOnGuestList( playerToCheck ) - Returns whether a player is on the guest list of a multi .IsOnBanList( playerToCheck ) - Returns whether a player is on the ban list of a multi .AddToFriendList( playertoAdd ) - Adds player to the friend list of a multi .RemoveFromFriendList( playertoRemove ) - Removes player from the friend list of a multi .AddToGuestList( playertoAdd ) - Adds player to the guest list of a multi .RemoveFromGuestList( playertoRemove ) - Removes player from the guest list of a multi .ClearOwnerList() - Clears all entries from a multi's (co-)owner list .ClearFriendList() - Clears all entries from a multi's friend list .ClearGuestList() - Clears all entries from a multi's guest list .ClearBanList() - Clears all entries from a multi's ban list .SecureContainer( itemToSecure ) - Secures a container in a multi .UnsecureContainer( itemToUnsecure ) - Unsecures a container in a multi .IsSecureContainer( itemToCheck ) - Checks if specified item is a secure container in a multi .LockDownItem( itemToLockDown) - Locks down an item in a multi .ReleaseItem( itemToRelease ) - Releases a locked down item in a multi .KillKeys() - Deletes ALL keys associated with a multi .AddTrashCont( itemToAdd ) - Add trash container to multi's list of trash containers .RemoveTrashCont( itemToRemove ) - Remove trash container from multi's list of trash containers Added JS Item (Multi only) properties: .lockdowns - Get the number of lockdowns in a multi .maxLockdowns - Get/Set the max number of lockdowns allowed in a multi .secureContainers - Get the number of secure containers in a multi .maxSecureContainers - Get/Set the max number of secure containers allowed in a multi .trashContainers - Get the number of trash containers in a multi .maxTrashContainers - Get/Set the max number of trash containers allowed in a multi .friends - Get the number of friends in a multi's friend list .maxFriends - Get/Set the max number of friends allowed in a multi's friend list .guests - Get the number of guests in a multi's guest list .maxGuests - Get/Set the max number of guests allowed in a multi's guest list .owners - Get the number of owners in a multi's owner list .maxOwners - Get/Set the max number of owners allowed in a multi's owner list .bans - Get the number of banned players in a multi's ban list .maxBans - Get/Set the max number of banned players allowed in a multi's ban list .vendors - Get the number of player vendors in a multi .maxVendors - Get the max number of player vendors allowed in a multi .deed - Get the item sectionID for deed used to place multi .isPublic - Get/Set the private/public state of a multi .buildTimestamp - Get the timestamp for when the house was originally placed .tradeTimestamp - Get the timestamp for when the house was last traded to another player .banX - Get/Set the ban location X offset for the multi .banY - Get/Set the ban location Y offset for the multi Added JS Character properties: .multi = Get/Set the multi object the character is in .accountNum = Get the account number the character belongs to .housesOwned = Get a count of houses owned by the character .housesCoOwned = Get a count of houses co-owned by the character Updated JS cBaseObject Methods .FirstItem(), .NextItem() and .FinishedItems() to also support iterating through items in multis Updated JS multi Methods .FirstChar(), .NextChar() and .FinishedChars() to support an additional parameter to specify what kind of characters to loop through: "default" or no parameter - all characters inside the multi "owner" - players on multi's owner list "friend" - players on multi's friend list "guest" - players on multi's guest list "banned" - players on multi's ban list Added new INI tags to a new section of uox.ini called [houses] DECAYTIMERINHOUSE=3600 // Decay timer in seconds for non-locked down items inside houses PROTECTPRIVATEHOUSES=1 // Toggles whether private houses will automatically boot unauthorized visitors (1) or not (0) TRACKHOUSESPERACCOUNT=1 // Toggles whether to track (and restrict) house ownership per account (1) or per character (0) MAXHOUSESOWNABLE=1 // Specifies the max amount of houses a player can own per account/char, depending on how house ownership is tracked MAXHOUSESCOOWNABLE=10 // Specifies the max amount of houses a player can co-own per character CANOWNANDCOOWNHOUSES=1 // Toggles whether players can own and co-own houses at the same time COOWNHOUSESONSAMEACCOUNT=1 // Toggles whether characters on same account as house owner will be treated as co-owners Added new INI tags in [settings] section of uox.ini: ITEMSDETECTSPEECH=0 // If enabled, server will search for nearby items with onSpeech JS event running whenever a character speaks. Disabled by default. MAXPLAYERPACKITEMS=125 // Defines max item capacity for player (and NPC) backpacks. Defaults to 125. Moved most of the existing house functionality to JS and expanded upon it to reach feature parity with houses in regular UO around Publish 15/16, with various extras thrown in for good measure and all functionality being customizable: js/server/house/house.js (15000) - handles detection of house commands and characters entering/leaving houses js/server/house/houseSign.js (15001) - contains and handles all house-related gumps/menus and what is shown when players interact with house sign js/server/house/houseCommands.js (15002) - handles functionality of house commands and other functionality such as transfer of ownership, demolishing house, etc. js/server/house/houseDeed.js (15003) - handles initial rules that allow/disallow placement of additional houses for players All house-related menus now fully handled through JS All house commands and other functionality now fully handled through JS Removed redundant hard-coded house functionality Implemented Co-owners, friends, guests for houses, with access rules in place for entry, lockdowns, house commands, etc. Implemented Private and Public houses Implemented Secure Containers and Trash Barrels Definable max lockdowns, secure containers, player vendors, bans, friends, guests, owners, trash containers and more - per house type JS scripts can now be attached directly to houses Doors in houses can be marked as front doors or interior doors, and will be treated differently with regards to private and public houses Added new item to dfndata/items/containers/misc.dfn - [trashbarrel] Added new JS script (js/items/trashbarrel.js) with trash barrel functionality for houses. Trash barrels that are marked as secure containers are only accessible by owners, co-owners and friends of the house. Various options available at top of script. Updated js/items/axe.js to support chopping up trash barrels and house add-ons in houses owned by the player Fixed an issue with house doors being left behind after demolishing houses while their doors were open Fixed an issue where GMs could be banned from player houses Added Line of Sight checks to speech, to give players some privacy in their own homes Updated house placement code to more accurately check for other multis, dynamic and static objects when placing houses; now requires free space around each house that cannot be blocked by other houses or items that can block player movement, and disallows placement of houses on roads Updated house placement code to move characters blocking house placement to SE corner of the house Updated house placement code to disallow placing houses in guarded regions, or in dungeons Added new DFN tag for regions to enable/disable player houses in specific regions: HOUSING=0/1 Added new region (247) that covers path to Valley of Eodon in Felucca Added new region (248) that covers Valley of Eodon in Ter-Mur, with player housing disabled Added new region (249) that covers entire T2A lands, with player housing disabled Updated SPACEX and SPACEY values for all houses in dfndata/house/house.dfn to match updated house placement code Added new JS property to Regions that can be used to determine or change state of player housing in a region: .canPlaceHouse() Updated rules for usage of dye tubs to dye locked down items; now only house owners or co-owners may dye locked down items Updated rules for usage of the following locked down items in a house, which are now only usable by house owners and co-owners Dyes, Guildstone Deeds, Recall Runes (renaming), Rename Deeds, Townstone Deeds, House Deeds, Boat Models, Player Vendor Deeds, Ore, Hair Dye Updated rules for usage of the following locked down items in a house, which are now only usable by house owners, co-owners and friends: Keys, Dye Tubs, Magic Scrolls, Fireworks Wands, Magic Wands, Smithing Tools, Mining Tools, Fishing Poles Updated item lockdown rules to allow locking down (and releasing) items in a container as long as the container is locked down, and to only allow releasing a locked down container if it's empty of locked down items Updated item lockdown rules to only allow locking down movement-blocking items further than 2 tiles away from doors Updated rules for releasing items in houses - now the house owner can release any locked down items, co-owners can release items locked down by themselves or by friends, while friends can release only items locked down by themselves Added some feedback to player about why their attempted house placement failed Items added by GMs directly into multis will now decay based on the house-specific decay timer instead of the regular one Fixed an issue that could cause items to almost instantly decay after being released from lockdown in a house Placing house add-ons now properly takes into account SPACEX and SPACEY values when checking if they can fit in selected area of houses Re-added SPACEX and SPACEY values for Pentagram and Loom house add-ons House add-ons can now be converted back into house add-on deeds by chopping them with an axe Added new item type - IT_HOUSEADDON (201) - used by house add-ons placed in player houses Fixed a bug where keys would stop working after being added to a keyring, and would turn into blank keys upon release from the keyring Added visitor count for public player houses, which keeps track of how many visits a public house has received, with each player counted max 1 time every 24 hours Fixed an issue with FindPlayersInOldVisrange() where it didn't take into account that players could see buildings further away than the standard update range. This could cause players to see ghost images of buildings if they were at the "right" distance when the building was being demolished Added NODECAY tag to all signs and doors in dfndata/house/house.dfn Added FRONTDOOR or INTERIORDOOR (as appropriate) to all doors in dfndata/house/house.dfn Added BANX and BANY to specify ban location for some houses in dfndata/house/house.dfn instead of relying on finding SE corner automatically Implemented strongboxes (js/server/house/strongbox.js) for co-owners of a house, which can be placed with the house command "i wish to place a strongbox". Max capacity is 25 items Updated 'REMOVE command to take an optional parameter - itemID. If supplied, the command will remove all items with this itemID from a targeted container Fixed a bug when checking if dynamic items were blocking valid spawn locations for NPCs, some function arguments were in the wrong order! Improved code that finds valid spawn locations for items and NPCs spawned via spawn regions. As server gradually builds up lists of valid spawn locations per region over time, it will start using these lists more often, rather than always look for brand new spawn locations. Fixed a bug with CMulHandler::CheckStaticFlag() that prevented NPCs from spawning inside buildings with no static floors! Fixed an issue with repeating commands that prevented GMs from being able to cancel them when using the ClassicUO client Exposed character property .accountNum to JS engine Extended CDataList class to include a Clear() method for clearing lists Updated JS File method .Open() to support an optional, third argument - subFolderName - that defines in which sub-folder of UOX3/shared/ to store/look for a file. If no third argument is supplied, UOX3 will default to using the shared folder itself. Updated JS File method .Length() to return a value of -1 for files that don't exist Added new code function, exposed to JS engine with same parameters, which simply checks if a given tile ID has a specific flag bool CheckTileFlag( UI16 itemID, TILEFLAG flagToCheck ) Added JS function used to find the root container of an item (if any) FindRootContainer( itemSerial ) FindRootContainer( item ) Added new JS function that allows deleting files from UOX3/shared/ folder or subfolders of shared folder. If no subFolderName is provided, looks for file directly in shared folder itself. Restrictions on file- and folder-names apply. bool DeleteFile( fileName, subFolderName ) Added new JS functions for checking if a specific client or server feature is enabled. See documentation for full list of client/server features. GetClientFeature( bitNum ) // Returns true if specified client feature is enabled on server GetServerFeature( bitNum ) // Returns true if specified server feature is enabled on server Added new JS function for returning the value of almost any server setting from UOX.INI GetServerSetting( settingNameInDoubleQuotes ) Updated JS function DoesDynamicBlock() with two new parameters - checkOnlyMultis and checkOnlyNonMultis Updated JS function DoesMapBlock() with two new parameters - checkMultiPlacement and checkForRoad Fixed an issue where a LoS check would prevent players from accessing containers in their own backpack Added new functions in findfuncs.cpp to make it easier to find items near another object or location: findNearbyItems( object, distance ) findNearbyItems( x, y, worldNumber, instanceID, distance ) Added new Item property - maxItems - used by containers to determine their max item capacity Added new Item property - totalItemCount - used to get total item count in a container (including sub-containers) Added check for max item capacity when creating new items that are added to a character's backpack - items will be created below character's feet if backpack is full! Added new DFN tag for items, used by containers to determine item capacity for a given container: MAXITEMS=# // 125 is the default for all containers if not set Added new JS Item properties: .maxItems // gets/sets item capacity for a given container .totalItemCount // gets total item count in a container, including sub-containers Updated item tooltips for containers to show accurate total item count, as well as to display max item capacity Fixed a bug where picking up items from a non-locked down pile of items on the floor inside a multi could cause the remaining pile to be seen as no longer inside the multi, disallowing locking it back down and causing it to decay based on regular decay timer instead of house-specific one Updated JS command set to allow setting poison-level on items ('set poison #) and hunger-level on characters ('set hunger #) Fixed an issue with js/item/food.js that prevented poisoned food from poisoning characters when eaten Fixed an issue with js/skill/poisoning.js that prevented players from poisoning food! Updated various JS scripts and hardcoded targeting functions to disallow the targeting of locked down resources using skills and tools Updated JS Method TextMessage() to support three extra, optional parameters. Note that if one optional parameter is included, all preceding optional parameters are also required! speechTarget - What kind of target is this message intended for? 0 - Only visible for sender and receiver of message 1 - Visible to all players in range 2 - Visible to all NPCs and players in range 3 - Visible to all PCs everywhere + NPCs in range 4 - Visible to all PCs everywhere (broadcast) 5 - Only visible for the receiver of the message speechTargetSerial - The serial of the receiver of the message, used if speechTarget is 0 or 5 speechFontType - The type of font to display the text in. Defaults to normal. 0 - Bold 1 - Normal with shadow 2 - Bold with shadow 3 - Normal 4 - Gothic 5 - Italic 6 - Small, dark 7 - Colourful 8 - Runic (only works with CAPS) 9 - Small, light Added timestamp to worldsaves in console, to make it easier to see when a particular world-save was done Added info about compiler/environment displayed at the top of the UOX3 console during startup Updated dictionary files with new messages primarily related to housing
2020-11-04 02:00:37 +08:00
toDecay.SetDecayTime( nextDecayItemsInHouses );
return false;
}
}
UOX3 0.99.5b-6 Increased world load speed by almost 20% by reducing how often loading progress is written to the console Increased world save speed by almost 50% through the use of binary mode and buffer tweaks for ofstream combined with a cached newline char and std::to_string instead of static_cast Fixed a server crash involving killing NPCs of a specific spawn region using the 'spawnkill # command Fixed a server crash involving moving items from decaying corpses to the ground Fixed a server crash involving carving up human corpses Fixed a server crash related to AreaCharacterFunction JS function, which could trigger for any script that potentially kills any NPC this function iterates over (like explosion potions) Fixed a server crash related to GMs attempting to add items from add-menu while having no backpack Fixed a client crash issue caused by attempting to sell house deeds back to architect NPCs Fixed an issue where players would get incorrect amounts of gold for selling house deeds back to architect NPCs Fixed an issue with characters dying onboard boats which prevented players from packing up the boats later Added new item property in code (via bools bitset) that can be used to enable/disable maker's mark on crafted items. This property can be set to true for items crafted at exceptional quality by GM craftsmen Exposed the new item property to JS engine: .isMarkedByMaker // If true, maker's mark will be displayed Updated default item tooltip to display " of exceptional quality" for items crafted with exceptional quality Updated default item tooltip to display "[Crafted] by [Crafter's Name]" for exceptional quality items crafted by GM craftsmen. The [Crafted] text comes from the MADEWORD defined in dfndata/skills/skills.dfn for the primary skill used to craft the item Updated old-school single-click names for items (when AoS bit is disabled in client/server features) to display exceptional status and/or maker's mark for appropriate items Fixed an issue with the display of titles for NPCs that used dictionary lookups for their title Added new UOX.INI settings under the [settings] section: DISPLAYMAKERSMARK=1/0 // Controls if maker's marks on crafted items are shown on a global level SHOWNPCTITLESOVERHEAD=1/0 // Controls whether NPC titles are shown over their heads SHOWINVULNERABLETAGOVERHEAD=0/1 // Controls whether invulnerable tags are shown overhead GLOBALRESTOCKMULTIPLIER=1.0 // Global multiplier applied to RESTOCK property of items when loaded from DFNs Added new UOX.INI settings under the [combat] section: PETCOMBATTRAINING=1/0 // Controls whether pets can gain skills/stats from combat HIRELINGCOMBATTRAINING=1/0 // Controls whether hirelings can gain skills/stats from combat NPCCOMBATTRAINING=0/1 // Controls whether NPCs in general can gain skills/stats from combat Fixed an issue where a player meeting the exact minimum requirements for crafting an item would always fail Fixed a bug with teleporting off boats to valid nearby locations when double-clicking boat planks while standing on it Updated behaviour of planks on boats: Boat key can unlock plank, but won't automatically open it Boat key used on an open, unlocked plank will lock and automatically close the plank Boat key used on an open, locked plank will unlock the plank and leave it open Player using an unlocked plank now opens it Player using an open plank will disembark (if onboard) or embark (if not) the boat Player can always open a locked plank if they're on the boat, even with no key, to allow disembarking the boat. Planks that are open, but locked cannot be accessed from outside the boat, and will close automatically after five of seconds Updated behaviour of Magic Lock/Unlock spells: Magic Lock cannot be used on objects inside a multi Magic Lock applies difficulty to lock based on caster's Magery skill Magic Lock effect will last between 7 to 50 seconds (depending on caster's Magery skill) Any object that can be locked via Magic Lock spell can also be unlocked via Magic Unlock spell, if caster has high enough Magery skill Fixed a bug where certain JS Functions, Methods and Properties would occasionally pass incorrect values to scripts that called upon them. Scripts that rely on the GetCurrentClock() Function, the .GetTimer() Method, .decayTime, .logTime, .oreTime and .fishTime Properties might need to be updated to account for the fix, which causes larger values to be passed in than before. Fixed a bug related to GetCurrentClock() that caused decay and respawning of dungeon chests from working properly Fixed a bug related to GetCurrentClock() and .logTime/.fishTime that prevented consumption and regeneration of log/fish resources from working properly Added a new JS Function: GetStartTime() // Returns a timestamp for when server started up Fixed a bug related to GetCurrentClock() where server uptime stats in help menu was showing up incorrectly Fixed a bug related to GetCurrentClock() and purging of registrations of visitors in public houses so their visits can be counted again later Fixed a bug related to GetCurrentClock() that caused monster speech to not work properly Fixed a Z-related issue that sometimes prevented players from fishing when standing on the shoreline next to the sea Fixed an issue with Animal Lore skill that would always return a pet's loyalty level as "Wild" Increased max range pets can be from their owner in order to still be included in moongate/teleporter travel from 12 to 24 tiles Fixed an issue where the alchemy bonus damage for explosion potions was off by an order of magnitude Fixed an issue where food IDs from foodlists referenced by other foodlists was not detected as valid food for tamed pets or NPCs Fixed an issue where Alchemy crafting skill did not properly check for the existence of the crafting tool before proceeding with the crafting process Fixed an issue that prevented the Teleport spell from working as intended Fixed an issue where players would still get 1 gold even if STARTGOLD in uox.ini was set to 0 Fixed an issue with mount restrictions script that prevented players from mounting Unicorns, Ki-rins and Cu Sidhes Fixed an issue where aggressive creatures wouldn't stop attacking player after being tamed (js/skill/taming.js) Added a system message to inform the player when they've dropped out of stealth due to taking too many steps Fixed an issue where hunger level of NPCs instantly dropped upon spawning because hunger timer was not active yet Fixed a bug where character corpses would appear with a [unidentified] tag attached Fixed an issue where the [unidentified] tag did not show up for unidentified magic items Added ANIMAL tag to a small bunch of creature definitions (dfndata/creatures/creatures.dfn) Fixed an issue with Bowcraft skill where player could not gain enough skill from crafting bows to reach min requirement for crossbows, and similiarly could not reach min requirement for heavy crossbows from crossbows Updated default value of MURDERDECAYTIMER INI setting from 60 seconds to 28800 seconds (8 hours), to match the amount of time it would take for one (short term) murder count to decay on LBR-era OSI shards.
2022-08-25 02:13:00 +08:00
if( toDecay.IsContType() )
{
2024-04-27 05:06:12 -05:00
if( isCorpse && (( ValidateObject( toDecay.GetOwnerObj() ) && !cwmWorldState->ServerData()->PlayerCorpseLootDecay() ) // Player corpse
|| ( !ValidateObject( toDecay.GetOwnerObj() ) && !cwmWorldState->ServerData()->NpcCorpseLootDecay() ))) // NPC corpse
UOX3 0.99.5b-6 Increased world load speed by almost 20% by reducing how often loading progress is written to the console Increased world save speed by almost 50% through the use of binary mode and buffer tweaks for ofstream combined with a cached newline char and std::to_string instead of static_cast Fixed a server crash involving killing NPCs of a specific spawn region using the 'spawnkill # command Fixed a server crash involving moving items from decaying corpses to the ground Fixed a server crash involving carving up human corpses Fixed a server crash related to AreaCharacterFunction JS function, which could trigger for any script that potentially kills any NPC this function iterates over (like explosion potions) Fixed a server crash related to GMs attempting to add items from add-menu while having no backpack Fixed a client crash issue caused by attempting to sell house deeds back to architect NPCs Fixed an issue where players would get incorrect amounts of gold for selling house deeds back to architect NPCs Fixed an issue with characters dying onboard boats which prevented players from packing up the boats later Added new item property in code (via bools bitset) that can be used to enable/disable maker's mark on crafted items. This property can be set to true for items crafted at exceptional quality by GM craftsmen Exposed the new item property to JS engine: .isMarkedByMaker // If true, maker's mark will be displayed Updated default item tooltip to display " of exceptional quality" for items crafted with exceptional quality Updated default item tooltip to display "[Crafted] by [Crafter's Name]" for exceptional quality items crafted by GM craftsmen. The [Crafted] text comes from the MADEWORD defined in dfndata/skills/skills.dfn for the primary skill used to craft the item Updated old-school single-click names for items (when AoS bit is disabled in client/server features) to display exceptional status and/or maker's mark for appropriate items Fixed an issue with the display of titles for NPCs that used dictionary lookups for their title Added new UOX.INI settings under the [settings] section: DISPLAYMAKERSMARK=1/0 // Controls if maker's marks on crafted items are shown on a global level SHOWNPCTITLESOVERHEAD=1/0 // Controls whether NPC titles are shown over their heads SHOWINVULNERABLETAGOVERHEAD=0/1 // Controls whether invulnerable tags are shown overhead GLOBALRESTOCKMULTIPLIER=1.0 // Global multiplier applied to RESTOCK property of items when loaded from DFNs Added new UOX.INI settings under the [combat] section: PETCOMBATTRAINING=1/0 // Controls whether pets can gain skills/stats from combat HIRELINGCOMBATTRAINING=1/0 // Controls whether hirelings can gain skills/stats from combat NPCCOMBATTRAINING=0/1 // Controls whether NPCs in general can gain skills/stats from combat Fixed an issue where a player meeting the exact minimum requirements for crafting an item would always fail Fixed a bug with teleporting off boats to valid nearby locations when double-clicking boat planks while standing on it Updated behaviour of planks on boats: Boat key can unlock plank, but won't automatically open it Boat key used on an open, unlocked plank will lock and automatically close the plank Boat key used on an open, locked plank will unlock the plank and leave it open Player using an unlocked plank now opens it Player using an open plank will disembark (if onboard) or embark (if not) the boat Player can always open a locked plank if they're on the boat, even with no key, to allow disembarking the boat. Planks that are open, but locked cannot be accessed from outside the boat, and will close automatically after five of seconds Updated behaviour of Magic Lock/Unlock spells: Magic Lock cannot be used on objects inside a multi Magic Lock applies difficulty to lock based on caster's Magery skill Magic Lock effect will last between 7 to 50 seconds (depending on caster's Magery skill) Any object that can be locked via Magic Lock spell can also be unlocked via Magic Unlock spell, if caster has high enough Magery skill Fixed a bug where certain JS Functions, Methods and Properties would occasionally pass incorrect values to scripts that called upon them. Scripts that rely on the GetCurrentClock() Function, the .GetTimer() Method, .decayTime, .logTime, .oreTime and .fishTime Properties might need to be updated to account for the fix, which causes larger values to be passed in than before. Fixed a bug related to GetCurrentClock() that caused decay and respawning of dungeon chests from working properly Fixed a bug related to GetCurrentClock() and .logTime/.fishTime that prevented consumption and regeneration of log/fish resources from working properly Added a new JS Function: GetStartTime() // Returns a timestamp for when server started up Fixed a bug related to GetCurrentClock() where server uptime stats in help menu was showing up incorrectly Fixed a bug related to GetCurrentClock() and purging of registrations of visitors in public houses so their visits can be counted again later Fixed a bug related to GetCurrentClock() that caused monster speech to not work properly Fixed a Z-related issue that sometimes prevented players from fishing when standing on the shoreline next to the sea Fixed an issue with Animal Lore skill that would always return a pet's loyalty level as "Wild" Increased max range pets can be from their owner in order to still be included in moongate/teleporter travel from 12 to 24 tiles Fixed an issue where the alchemy bonus damage for explosion potions was off by an order of magnitude Fixed an issue where food IDs from foodlists referenced by other foodlists was not detected as valid food for tamed pets or NPCs Fixed an issue where Alchemy crafting skill did not properly check for the existence of the crafting tool before proceeding with the crafting process Fixed an issue that prevented the Teleport spell from working as intended Fixed an issue where players would still get 1 gold even if STARTGOLD in uox.ini was set to 0 Fixed an issue with mount restrictions script that prevented players from mounting Unicorns, Ki-rins and Cu Sidhes Fixed an issue where aggressive creatures wouldn't stop attacking player after being tamed (js/skill/taming.js) Added a system message to inform the player when they've dropped out of stealth due to taking too many steps Fixed an issue where hunger level of NPCs instantly dropped upon spawning because hunger timer was not active yet Fixed a bug where character corpses would appear with a [unidentified] tag attached Fixed an issue where the [unidentified] tag did not show up for unidentified magic items Added ANIMAL tag to a small bunch of creature definitions (dfndata/creatures/creatures.dfn) Fixed an issue with Bowcraft skill where player could not gain enough skill from crafting bows to reach min requirement for crossbows, and similiarly could not reach min requirement for heavy crossbows from crossbows Updated default value of MURDERDECAYTIMER INI setting from 60 seconds to 28800 seconds (8 hours), to match the amount of time it would take for one (short term) murder count to decay on LBR-era OSI shards.
2022-08-25 02:13:00 +08:00
{
std::vector<CItem *> corpseItems;
auto iCont = toDecay.GetContainsList();
UOX3 0.99.5b-6 Increased world load speed by almost 20% by reducing how often loading progress is written to the console Increased world save speed by almost 50% through the use of binary mode and buffer tweaks for ofstream combined with a cached newline char and std::to_string instead of static_cast Fixed a server crash involving killing NPCs of a specific spawn region using the 'spawnkill # command Fixed a server crash involving moving items from decaying corpses to the ground Fixed a server crash involving carving up human corpses Fixed a server crash related to AreaCharacterFunction JS function, which could trigger for any script that potentially kills any NPC this function iterates over (like explosion potions) Fixed a server crash related to GMs attempting to add items from add-menu while having no backpack Fixed a client crash issue caused by attempting to sell house deeds back to architect NPCs Fixed an issue where players would get incorrect amounts of gold for selling house deeds back to architect NPCs Fixed an issue with characters dying onboard boats which prevented players from packing up the boats later Added new item property in code (via bools bitset) that can be used to enable/disable maker's mark on crafted items. This property can be set to true for items crafted at exceptional quality by GM craftsmen Exposed the new item property to JS engine: .isMarkedByMaker // If true, maker's mark will be displayed Updated default item tooltip to display " of exceptional quality" for items crafted with exceptional quality Updated default item tooltip to display "[Crafted] by [Crafter's Name]" for exceptional quality items crafted by GM craftsmen. The [Crafted] text comes from the MADEWORD defined in dfndata/skills/skills.dfn for the primary skill used to craft the item Updated old-school single-click names for items (when AoS bit is disabled in client/server features) to display exceptional status and/or maker's mark for appropriate items Fixed an issue with the display of titles for NPCs that used dictionary lookups for their title Added new UOX.INI settings under the [settings] section: DISPLAYMAKERSMARK=1/0 // Controls if maker's marks on crafted items are shown on a global level SHOWNPCTITLESOVERHEAD=1/0 // Controls whether NPC titles are shown over their heads SHOWINVULNERABLETAGOVERHEAD=0/1 // Controls whether invulnerable tags are shown overhead GLOBALRESTOCKMULTIPLIER=1.0 // Global multiplier applied to RESTOCK property of items when loaded from DFNs Added new UOX.INI settings under the [combat] section: PETCOMBATTRAINING=1/0 // Controls whether pets can gain skills/stats from combat HIRELINGCOMBATTRAINING=1/0 // Controls whether hirelings can gain skills/stats from combat NPCCOMBATTRAINING=0/1 // Controls whether NPCs in general can gain skills/stats from combat Fixed an issue where a player meeting the exact minimum requirements for crafting an item would always fail Fixed a bug with teleporting off boats to valid nearby locations when double-clicking boat planks while standing on it Updated behaviour of planks on boats: Boat key can unlock plank, but won't automatically open it Boat key used on an open, unlocked plank will lock and automatically close the plank Boat key used on an open, locked plank will unlock the plank and leave it open Player using an unlocked plank now opens it Player using an open plank will disembark (if onboard) or embark (if not) the boat Player can always open a locked plank if they're on the boat, even with no key, to allow disembarking the boat. Planks that are open, but locked cannot be accessed from outside the boat, and will close automatically after five of seconds Updated behaviour of Magic Lock/Unlock spells: Magic Lock cannot be used on objects inside a multi Magic Lock applies difficulty to lock based on caster's Magery skill Magic Lock effect will last between 7 to 50 seconds (depending on caster's Magery skill) Any object that can be locked via Magic Lock spell can also be unlocked via Magic Unlock spell, if caster has high enough Magery skill Fixed a bug where certain JS Functions, Methods and Properties would occasionally pass incorrect values to scripts that called upon them. Scripts that rely on the GetCurrentClock() Function, the .GetTimer() Method, .decayTime, .logTime, .oreTime and .fishTime Properties might need to be updated to account for the fix, which causes larger values to be passed in than before. Fixed a bug related to GetCurrentClock() that caused decay and respawning of dungeon chests from working properly Fixed a bug related to GetCurrentClock() and .logTime/.fishTime that prevented consumption and regeneration of log/fish resources from working properly Added a new JS Function: GetStartTime() // Returns a timestamp for when server started up Fixed a bug related to GetCurrentClock() where server uptime stats in help menu was showing up incorrectly Fixed a bug related to GetCurrentClock() and purging of registrations of visitors in public houses so their visits can be counted again later Fixed a bug related to GetCurrentClock() that caused monster speech to not work properly Fixed a Z-related issue that sometimes prevented players from fishing when standing on the shoreline next to the sea Fixed an issue with Animal Lore skill that would always return a pet's loyalty level as "Wild" Increased max range pets can be from their owner in order to still be included in moongate/teleporter travel from 12 to 24 tiles Fixed an issue where the alchemy bonus damage for explosion potions was off by an order of magnitude Fixed an issue where food IDs from foodlists referenced by other foodlists was not detected as valid food for tamed pets or NPCs Fixed an issue where Alchemy crafting skill did not properly check for the existence of the crafting tool before proceeding with the crafting process Fixed an issue that prevented the Teleport spell from working as intended Fixed an issue where players would still get 1 gold even if STARTGOLD in uox.ini was set to 0 Fixed an issue with mount restrictions script that prevented players from mounting Unicorns, Ki-rins and Cu Sidhes Fixed an issue where aggressive creatures wouldn't stop attacking player after being tamed (js/skill/taming.js) Added a system message to inform the player when they've dropped out of stealth due to taking too many steps Fixed an issue where hunger level of NPCs instantly dropped upon spawning because hunger timer was not active yet Fixed a bug where character corpses would appear with a [unidentified] tag attached Fixed an issue where the [unidentified] tag did not show up for unidentified magic items Added ANIMAL tag to a small bunch of creature definitions (dfndata/creatures/creatures.dfn) Fixed an issue with Bowcraft skill where player could not gain enough skill from crafting bows to reach min requirement for crossbows, and similiarly could not reach min requirement for heavy crossbows from crossbows Updated default value of MURDERDECAYTIMER INI setting from 60 seconds to 28800 seconds (8 hours), to match the amount of time it would take for one (short term) murder count to decay on LBR-era OSI shards.
2022-08-25 02:13:00 +08:00
for( const auto &io : iCont->collection() )
{
if( ValidateObject( io ))
{
if( io->GetLayer() != IL_HAIR && io->GetLayer() != IL_FACIALHAIR )
{
// Store a reference to the item we want to move out of corpse...
corpseItems.push_back( io );
}
}
}
UOX3 0.99.5b-6 Increased world load speed by almost 20% by reducing how often loading progress is written to the console Increased world save speed by almost 50% through the use of binary mode and buffer tweaks for ofstream combined with a cached newline char and std::to_string instead of static_cast Fixed a server crash involving killing NPCs of a specific spawn region using the 'spawnkill # command Fixed a server crash involving moving items from decaying corpses to the ground Fixed a server crash involving carving up human corpses Fixed a server crash related to AreaCharacterFunction JS function, which could trigger for any script that potentially kills any NPC this function iterates over (like explosion potions) Fixed a server crash related to GMs attempting to add items from add-menu while having no backpack Fixed a client crash issue caused by attempting to sell house deeds back to architect NPCs Fixed an issue where players would get incorrect amounts of gold for selling house deeds back to architect NPCs Fixed an issue with characters dying onboard boats which prevented players from packing up the boats later Added new item property in code (via bools bitset) that can be used to enable/disable maker's mark on crafted items. This property can be set to true for items crafted at exceptional quality by GM craftsmen Exposed the new item property to JS engine: .isMarkedByMaker // If true, maker's mark will be displayed Updated default item tooltip to display " of exceptional quality" for items crafted with exceptional quality Updated default item tooltip to display "[Crafted] by [Crafter's Name]" for exceptional quality items crafted by GM craftsmen. The [Crafted] text comes from the MADEWORD defined in dfndata/skills/skills.dfn for the primary skill used to craft the item Updated old-school single-click names for items (when AoS bit is disabled in client/server features) to display exceptional status and/or maker's mark for appropriate items Fixed an issue with the display of titles for NPCs that used dictionary lookups for their title Added new UOX.INI settings under the [settings] section: DISPLAYMAKERSMARK=1/0 // Controls if maker's marks on crafted items are shown on a global level SHOWNPCTITLESOVERHEAD=1/0 // Controls whether NPC titles are shown over their heads SHOWINVULNERABLETAGOVERHEAD=0/1 // Controls whether invulnerable tags are shown overhead GLOBALRESTOCKMULTIPLIER=1.0 // Global multiplier applied to RESTOCK property of items when loaded from DFNs Added new UOX.INI settings under the [combat] section: PETCOMBATTRAINING=1/0 // Controls whether pets can gain skills/stats from combat HIRELINGCOMBATTRAINING=1/0 // Controls whether hirelings can gain skills/stats from combat NPCCOMBATTRAINING=0/1 // Controls whether NPCs in general can gain skills/stats from combat Fixed an issue where a player meeting the exact minimum requirements for crafting an item would always fail Fixed a bug with teleporting off boats to valid nearby locations when double-clicking boat planks while standing on it Updated behaviour of planks on boats: Boat key can unlock plank, but won't automatically open it Boat key used on an open, unlocked plank will lock and automatically close the plank Boat key used on an open, locked plank will unlock the plank and leave it open Player using an unlocked plank now opens it Player using an open plank will disembark (if onboard) or embark (if not) the boat Player can always open a locked plank if they're on the boat, even with no key, to allow disembarking the boat. Planks that are open, but locked cannot be accessed from outside the boat, and will close automatically after five of seconds Updated behaviour of Magic Lock/Unlock spells: Magic Lock cannot be used on objects inside a multi Magic Lock applies difficulty to lock based on caster's Magery skill Magic Lock effect will last between 7 to 50 seconds (depending on caster's Magery skill) Any object that can be locked via Magic Lock spell can also be unlocked via Magic Unlock spell, if caster has high enough Magery skill Fixed a bug where certain JS Functions, Methods and Properties would occasionally pass incorrect values to scripts that called upon them. Scripts that rely on the GetCurrentClock() Function, the .GetTimer() Method, .decayTime, .logTime, .oreTime and .fishTime Properties might need to be updated to account for the fix, which causes larger values to be passed in than before. Fixed a bug related to GetCurrentClock() that caused decay and respawning of dungeon chests from working properly Fixed a bug related to GetCurrentClock() and .logTime/.fishTime that prevented consumption and regeneration of log/fish resources from working properly Added a new JS Function: GetStartTime() // Returns a timestamp for when server started up Fixed a bug related to GetCurrentClock() where server uptime stats in help menu was showing up incorrectly Fixed a bug related to GetCurrentClock() and purging of registrations of visitors in public houses so their visits can be counted again later Fixed a bug related to GetCurrentClock() that caused monster speech to not work properly Fixed a Z-related issue that sometimes prevented players from fishing when standing on the shoreline next to the sea Fixed an issue with Animal Lore skill that would always return a pet's loyalty level as "Wild" Increased max range pets can be from their owner in order to still be included in moongate/teleporter travel from 12 to 24 tiles Fixed an issue where the alchemy bonus damage for explosion potions was off by an order of magnitude Fixed an issue where food IDs from foodlists referenced by other foodlists was not detected as valid food for tamed pets or NPCs Fixed an issue where Alchemy crafting skill did not properly check for the existence of the crafting tool before proceeding with the crafting process Fixed an issue that prevented the Teleport spell from working as intended Fixed an issue where players would still get 1 gold even if STARTGOLD in uox.ini was set to 0 Fixed an issue with mount restrictions script that prevented players from mounting Unicorns, Ki-rins and Cu Sidhes Fixed an issue where aggressive creatures wouldn't stop attacking player after being tamed (js/skill/taming.js) Added a system message to inform the player when they've dropped out of stealth due to taking too many steps Fixed an issue where hunger level of NPCs instantly dropped upon spawning because hunger timer was not active yet Fixed a bug where character corpses would appear with a [unidentified] tag attached Fixed an issue where the [unidentified] tag did not show up for unidentified magic items Added ANIMAL tag to a small bunch of creature definitions (dfndata/creatures/creatures.dfn) Fixed an issue with Bowcraft skill where player could not gain enough skill from crafting bows to reach min requirement for crossbows, and similiarly could not reach min requirement for heavy crossbows from crossbows Updated default value of MURDERDECAYTIMER INI setting from 60 seconds to 28800 seconds (8 hours), to match the amount of time it would take for one (short term) murder count to decay on LBR-era OSI shards.
2022-08-25 02:13:00 +08:00
// Loop through the items we want to move out of corpse
std::for_each( corpseItems.begin(), corpseItems.end(), [toDecay, nextDecayItems]( CItem *corpseItem )
{
corpseItem->SetCont( nullptr );
corpseItem->SetLocation(( &toDecay ));
UOX3 0.99.5b-6 Increased world load speed by almost 20% by reducing how often loading progress is written to the console Increased world save speed by almost 50% through the use of binary mode and buffer tweaks for ofstream combined with a cached newline char and std::to_string instead of static_cast Fixed a server crash involving killing NPCs of a specific spawn region using the 'spawnkill # command Fixed a server crash involving moving items from decaying corpses to the ground Fixed a server crash involving carving up human corpses Fixed a server crash related to AreaCharacterFunction JS function, which could trigger for any script that potentially kills any NPC this function iterates over (like explosion potions) Fixed a server crash related to GMs attempting to add items from add-menu while having no backpack Fixed a client crash issue caused by attempting to sell house deeds back to architect NPCs Fixed an issue where players would get incorrect amounts of gold for selling house deeds back to architect NPCs Fixed an issue with characters dying onboard boats which prevented players from packing up the boats later Added new item property in code (via bools bitset) that can be used to enable/disable maker's mark on crafted items. This property can be set to true for items crafted at exceptional quality by GM craftsmen Exposed the new item property to JS engine: .isMarkedByMaker // If true, maker's mark will be displayed Updated default item tooltip to display " of exceptional quality" for items crafted with exceptional quality Updated default item tooltip to display "[Crafted] by [Crafter's Name]" for exceptional quality items crafted by GM craftsmen. The [Crafted] text comes from the MADEWORD defined in dfndata/skills/skills.dfn for the primary skill used to craft the item Updated old-school single-click names for items (when AoS bit is disabled in client/server features) to display exceptional status and/or maker's mark for appropriate items Fixed an issue with the display of titles for NPCs that used dictionary lookups for their title Added new UOX.INI settings under the [settings] section: DISPLAYMAKERSMARK=1/0 // Controls if maker's marks on crafted items are shown on a global level SHOWNPCTITLESOVERHEAD=1/0 // Controls whether NPC titles are shown over their heads SHOWINVULNERABLETAGOVERHEAD=0/1 // Controls whether invulnerable tags are shown overhead GLOBALRESTOCKMULTIPLIER=1.0 // Global multiplier applied to RESTOCK property of items when loaded from DFNs Added new UOX.INI settings under the [combat] section: PETCOMBATTRAINING=1/0 // Controls whether pets can gain skills/stats from combat HIRELINGCOMBATTRAINING=1/0 // Controls whether hirelings can gain skills/stats from combat NPCCOMBATTRAINING=0/1 // Controls whether NPCs in general can gain skills/stats from combat Fixed an issue where a player meeting the exact minimum requirements for crafting an item would always fail Fixed a bug with teleporting off boats to valid nearby locations when double-clicking boat planks while standing on it Updated behaviour of planks on boats: Boat key can unlock plank, but won't automatically open it Boat key used on an open, unlocked plank will lock and automatically close the plank Boat key used on an open, locked plank will unlock the plank and leave it open Player using an unlocked plank now opens it Player using an open plank will disembark (if onboard) or embark (if not) the boat Player can always open a locked plank if they're on the boat, even with no key, to allow disembarking the boat. Planks that are open, but locked cannot be accessed from outside the boat, and will close automatically after five of seconds Updated behaviour of Magic Lock/Unlock spells: Magic Lock cannot be used on objects inside a multi Magic Lock applies difficulty to lock based on caster's Magery skill Magic Lock effect will last between 7 to 50 seconds (depending on caster's Magery skill) Any object that can be locked via Magic Lock spell can also be unlocked via Magic Unlock spell, if caster has high enough Magery skill Fixed a bug where certain JS Functions, Methods and Properties would occasionally pass incorrect values to scripts that called upon them. Scripts that rely on the GetCurrentClock() Function, the .GetTimer() Method, .decayTime, .logTime, .oreTime and .fishTime Properties might need to be updated to account for the fix, which causes larger values to be passed in than before. Fixed a bug related to GetCurrentClock() that caused decay and respawning of dungeon chests from working properly Fixed a bug related to GetCurrentClock() and .logTime/.fishTime that prevented consumption and regeneration of log/fish resources from working properly Added a new JS Function: GetStartTime() // Returns a timestamp for when server started up Fixed a bug related to GetCurrentClock() where server uptime stats in help menu was showing up incorrectly Fixed a bug related to GetCurrentClock() and purging of registrations of visitors in public houses so their visits can be counted again later Fixed a bug related to GetCurrentClock() that caused monster speech to not work properly Fixed a Z-related issue that sometimes prevented players from fishing when standing on the shoreline next to the sea Fixed an issue with Animal Lore skill that would always return a pet's loyalty level as "Wild" Increased max range pets can be from their owner in order to still be included in moongate/teleporter travel from 12 to 24 tiles Fixed an issue where the alchemy bonus damage for explosion potions was off by an order of magnitude Fixed an issue where food IDs from foodlists referenced by other foodlists was not detected as valid food for tamed pets or NPCs Fixed an issue where Alchemy crafting skill did not properly check for the existence of the crafting tool before proceeding with the crafting process Fixed an issue that prevented the Teleport spell from working as intended Fixed an issue where players would still get 1 gold even if STARTGOLD in uox.ini was set to 0 Fixed an issue with mount restrictions script that prevented players from mounting Unicorns, Ki-rins and Cu Sidhes Fixed an issue where aggressive creatures wouldn't stop attacking player after being tamed (js/skill/taming.js) Added a system message to inform the player when they've dropped out of stealth due to taking too many steps Fixed an issue where hunger level of NPCs instantly dropped upon spawning because hunger timer was not active yet Fixed a bug where character corpses would appear with a [unidentified] tag attached Fixed an issue where the [unidentified] tag did not show up for unidentified magic items Added ANIMAL tag to a small bunch of creature definitions (dfndata/creatures/creatures.dfn) Fixed an issue with Bowcraft skill where player could not gain enough skill from crafting bows to reach min requirement for crossbows, and similiarly could not reach min requirement for heavy crossbows from crossbows Updated default value of MURDERDECAYTIMER INI setting from 60 seconds to 28800 seconds (8 hours), to match the amount of time it would take for one (short term) murder count to decay on LBR-era OSI shards.
2022-08-25 02:13:00 +08:00
corpseItem->SetDecayTime( nextDecayItems );
});
}
}
if( toDecay.CanBeObjType( OT_MULTI ))
{
toDecay.SetDecayTime( nextDecayItems );
Console.Warning( oldstrutil::format( "Warning: Prevented multi (serial: 0x%X) from decaying!", toDecay.GetSerial() ));
}
2022-06-10 15:10:12 -04:00
toDecay.Delete(); // This is a problem, if done in a ierator loop
return true;
}
//o------------------------------------------------------------------------------------------------o
//| Function - cItem::GetPackType()
//o------------------------------------------------------------------------------------------------o
//| Purpose - Get the pack type based on ID
//o------------------------------------------------------------------------------------------------o
PackTypes cItem::GetPackType( CItem *i )
{
PackTypes packType = PT_UNKNOWN;
switch( i->GetId() )
{
case 0x2006: // coffin
case 0x0ECA: // bones
case 0x0ECB: // bones
case 0x0ECC: // bones
case 0x0ECD: // bones
case 0x0ECE: // bones
case 0x0ECF: // bones
case 0x0ED0: // bones
case 0x0ED1: // bones
case 0x0ED2: // bones
packType = PT_COFFIN;
break;
case 0x0E75: // backpack
case 0x0E79: // pouch
case 0x09B0: // pouch
case 0xA1F6: // First Aid Belt
packType = PT_PACK;
break;
case 0x0E76: // leather bag
case 0x2256: // bagball
case 0x2257: // bagball
packType = PT_BAG;
break;
case 0x0E77: // barrel
case 0x0E7F: // keg
Various fixes and additions Updated CGump_AddToolTip() gump method - now accepts up to 10 optional cliloc arguments to go with specified cliloc. Can also be used to display custom tooltip text if used with a cliloc like 1114778. Cliloc arguments and custom tooltips only work in client version 7.0.16.0 or above. Updated CPSendGumpMenu::AddCommand() to use the safer vsnprintf instead of vsprintf, and increased msg buffer size from 512 to 1024 Updated CPIUpdateRangeChange::Handle() to include additional client definitions: CV_HS2D and CV_HS3D Added new pack types in PackTypes enum: PT_GAME_BACKGAMMON, PT_GAME_CHESS, PT_MAILBOX1, PT_MAILBOX2, PT_MAILBOX3, PT_MAILBOX4, PT_MAILBOX5, PT_MAILBOX6, PT_MAILBOX7, PT_MAILBOX8, PT_MAILBOX9, PT_WALLSAFE, PT_SAFE Updated getPackType() with additional container definitions for the following pack types: PT_RBASKET - winnoning basket (0x1882) PT_GCHEST - gargoyle chests (0x4025, 0x4026), metal chests (0xA304, 0xA305), rusty metal chests (0xA306, 0xA307), gold chests (0xA308, 0xA309), barnacle metal chests (0xA30A, 0xA30B) PT_GAME_BACKGAMMON - backgammon boards (0x0E1C, 0x0FAD) PT_GAME_CHESS - chess board (0x0FA6) PT_MAILBOX1 - dolphin mailbox (0xA202, 0xA203, 0xA204, 0xA205) PT_MAILBOX2 - squirrel mailbox (0xA206, 0xA207, 0xA208, 0xA209) PT_MAILBOX3 - barrel mailbox (0xA1F5, 0xA1F6, 0xA1F7, 0xA1F8) PT_MAILBOX4 - light mailbox (0xA268, 0xA269, 0xA26A, 0xA26B, 0xA26C, 0xA26D, 0xA26E, 0xA26F) PT_MAILBOX5 - sitting kitten mailbox (0xA3EB, 0xA3EC, 0xA3ED, 0xA3EE) PT_MAILBOX6 - standing kitten mailbox (0xA3EF, 0xA3F0, 0xA3F1, 0xA3F2) PT_MAILBOX7 - scarecrow mailbox (0xA3F3, 0xA3F4, 0xA3F5, 0xA3F6) PT_MAILBOX8 - lion mailbox (0xA3F7, 0xA3F8, 0xA3F9, 0xA3FA) PT_MAILBOX9 - square gray mailbox (0x4141, 0x4142, 0x4143, 0x4144) PT_WALLSAFE - wall safe (0x8B8F, 0x8B90) PT_SAFE - safe (0x9C18, 0x9C19) Updated CItem::IsShieldType() to include shield IDs from SA expansion Added IL_TALISMAN (0x09) and IL_FACE (0x0F) to ItemLayers enum to allow equipping talismans and faces in clients that support this Updated getWeaponType() (in both code and JS) with additional weapon definitions: ONEHND_LG_SWORDS - anquique sword 1 (0xA33B, 0xA33C), antique sword 2 (0xA33D, 0xA33E), antique sword 3 (0xA33F, 0xA340), skull sword (0xA341, 0xA342), gargoyle skull sword (0xA345, 0xA346) LG_MACES - skull staff (0xA343, 0xA344), gargoyle skull staff (0xA347, 0xA348) Updates keys.js with some distance checks Misc updates to JS Docs
2020-08-05 09:19:43 +08:00
case 0x0E83: // empty tub
case 0x0FAE: // barrel with lids
case 0x1AD7: // potion kegs
case 0x1940: // barrel with lids
packType = PT_BARREL;
break;
case 0x0E7A: // square basket
case 0x24D5: // SE basket
case 0x24D6: // SE basket
case 0x24D9: // SE basket
case 0x24DA: // SE basket
packType = PT_SQBASKET;
break;
case 0x0990: // round basket
case 0x09AC: // round bushel
case 0x09B1: // round basket
case 0x24D7: // SE basket
case 0x24D8: // SE basket
case 0x24DD: // SE basket
Various fixes and additions Updated CGump_AddToolTip() gump method - now accepts up to 10 optional cliloc arguments to go with specified cliloc. Can also be used to display custom tooltip text if used with a cliloc like 1114778. Cliloc arguments and custom tooltips only work in client version 7.0.16.0 or above. Updated CPSendGumpMenu::AddCommand() to use the safer vsnprintf instead of vsprintf, and increased msg buffer size from 512 to 1024 Updated CPIUpdateRangeChange::Handle() to include additional client definitions: CV_HS2D and CV_HS3D Added new pack types in PackTypes enum: PT_GAME_BACKGAMMON, PT_GAME_CHESS, PT_MAILBOX1, PT_MAILBOX2, PT_MAILBOX3, PT_MAILBOX4, PT_MAILBOX5, PT_MAILBOX6, PT_MAILBOX7, PT_MAILBOX8, PT_MAILBOX9, PT_WALLSAFE, PT_SAFE Updated getPackType() with additional container definitions for the following pack types: PT_RBASKET - winnoning basket (0x1882) PT_GCHEST - gargoyle chests (0x4025, 0x4026), metal chests (0xA304, 0xA305), rusty metal chests (0xA306, 0xA307), gold chests (0xA308, 0xA309), barnacle metal chests (0xA30A, 0xA30B) PT_GAME_BACKGAMMON - backgammon boards (0x0E1C, 0x0FAD) PT_GAME_CHESS - chess board (0x0FA6) PT_MAILBOX1 - dolphin mailbox (0xA202, 0xA203, 0xA204, 0xA205) PT_MAILBOX2 - squirrel mailbox (0xA206, 0xA207, 0xA208, 0xA209) PT_MAILBOX3 - barrel mailbox (0xA1F5, 0xA1F6, 0xA1F7, 0xA1F8) PT_MAILBOX4 - light mailbox (0xA268, 0xA269, 0xA26A, 0xA26B, 0xA26C, 0xA26D, 0xA26E, 0xA26F) PT_MAILBOX5 - sitting kitten mailbox (0xA3EB, 0xA3EC, 0xA3ED, 0xA3EE) PT_MAILBOX6 - standing kitten mailbox (0xA3EF, 0xA3F0, 0xA3F1, 0xA3F2) PT_MAILBOX7 - scarecrow mailbox (0xA3F3, 0xA3F4, 0xA3F5, 0xA3F6) PT_MAILBOX8 - lion mailbox (0xA3F7, 0xA3F8, 0xA3F9, 0xA3FA) PT_MAILBOX9 - square gray mailbox (0x4141, 0x4142, 0x4143, 0x4144) PT_WALLSAFE - wall safe (0x8B8F, 0x8B90) PT_SAFE - safe (0x9C18, 0x9C19) Updated CItem::IsShieldType() to include shield IDs from SA expansion Added IL_TALISMAN (0x09) and IL_FACE (0x0F) to ItemLayers enum to allow equipping talismans and faces in clients that support this Updated getWeaponType() (in both code and JS) with additional weapon definitions: ONEHND_LG_SWORDS - anquique sword 1 (0xA33B, 0xA33C), antique sword 2 (0xA33D, 0xA33E), antique sword 3 (0xA33F, 0xA340), skull sword (0xA341, 0xA342), gargoyle skull sword (0xA345, 0xA346) LG_MACES - skull staff (0xA343, 0xA344), gargoyle skull staff (0xA347, 0xA348) Updates keys.js with some distance checks Misc updates to JS Docs
2020-08-05 09:19:43 +08:00
case 0x1882: // winnoning basket
packType = PT_RBASKET;
break;
case 0x0E40: // gold chest
case 0x0E41: // gold chest
Various fixes and additions Updated CGump_AddToolTip() gump method - now accepts up to 10 optional cliloc arguments to go with specified cliloc. Can also be used to display custom tooltip text if used with a cliloc like 1114778. Cliloc arguments and custom tooltips only work in client version 7.0.16.0 or above. Updated CPSendGumpMenu::AddCommand() to use the safer vsnprintf instead of vsprintf, and increased msg buffer size from 512 to 1024 Updated CPIUpdateRangeChange::Handle() to include additional client definitions: CV_HS2D and CV_HS3D Added new pack types in PackTypes enum: PT_GAME_BACKGAMMON, PT_GAME_CHESS, PT_MAILBOX1, PT_MAILBOX2, PT_MAILBOX3, PT_MAILBOX4, PT_MAILBOX5, PT_MAILBOX6, PT_MAILBOX7, PT_MAILBOX8, PT_MAILBOX9, PT_WALLSAFE, PT_SAFE Updated getPackType() with additional container definitions for the following pack types: PT_RBASKET - winnoning basket (0x1882) PT_GCHEST - gargoyle chests (0x4025, 0x4026), metal chests (0xA304, 0xA305), rusty metal chests (0xA306, 0xA307), gold chests (0xA308, 0xA309), barnacle metal chests (0xA30A, 0xA30B) PT_GAME_BACKGAMMON - backgammon boards (0x0E1C, 0x0FAD) PT_GAME_CHESS - chess board (0x0FA6) PT_MAILBOX1 - dolphin mailbox (0xA202, 0xA203, 0xA204, 0xA205) PT_MAILBOX2 - squirrel mailbox (0xA206, 0xA207, 0xA208, 0xA209) PT_MAILBOX3 - barrel mailbox (0xA1F5, 0xA1F6, 0xA1F7, 0xA1F8) PT_MAILBOX4 - light mailbox (0xA268, 0xA269, 0xA26A, 0xA26B, 0xA26C, 0xA26D, 0xA26E, 0xA26F) PT_MAILBOX5 - sitting kitten mailbox (0xA3EB, 0xA3EC, 0xA3ED, 0xA3EE) PT_MAILBOX6 - standing kitten mailbox (0xA3EF, 0xA3F0, 0xA3F1, 0xA3F2) PT_MAILBOX7 - scarecrow mailbox (0xA3F3, 0xA3F4, 0xA3F5, 0xA3F6) PT_MAILBOX8 - lion mailbox (0xA3F7, 0xA3F8, 0xA3F9, 0xA3FA) PT_MAILBOX9 - square gray mailbox (0x4141, 0x4142, 0x4143, 0x4144) PT_WALLSAFE - wall safe (0x8B8F, 0x8B90) PT_SAFE - safe (0x9C18, 0x9C19) Updated CItem::IsShieldType() to include shield IDs from SA expansion Added IL_TALISMAN (0x09) and IL_FACE (0x0F) to ItemLayers enum to allow equipping talismans and faces in clients that support this Updated getWeaponType() (in both code and JS) with additional weapon definitions: ONEHND_LG_SWORDS - anquique sword 1 (0xA33B, 0xA33C), antique sword 2 (0xA33D, 0xA33E), antique sword 3 (0xA33F, 0xA340), skull sword (0xA341, 0xA342), gargoyle skull sword (0xA345, 0xA346) LG_MACES - skull staff (0xA343, 0xA344), gargoyle skull staff (0xA347, 0xA348) Updates keys.js with some distance checks Misc updates to JS Docs
2020-08-05 09:19:43 +08:00
case 0x4025: // gargoyle chest
case 0x4026: // gargoyle chest
case 0xA304: // metal chest
case 0xA305: // metal chest
case 0xA306: // rusty metal chest
case 0xA307: // rusty metal chest
case 0xA308: // gold chest
case 0xA309: // gold chest
case 0xA30A: // barnacle metal chest
case 0xA30B: // barnacle metal chest
packType = PT_GCHEST;
break;
case 0x0E7D: // wooden box
case 0x09AA: // wooden box
packType = PT_WBOX;
break;
case 0x0E3C: // large wooden crate
case 0x0E3D: // large wooden crate
case 0x0E3E: // small wooden create
case 0x0E3F: // small wooden crate
case 0x0E7E: // wooden crate
case 0x09A9: // small wooden crate
packType = PT_CRATE;
break;
case 0x2AF8: // Shopkeeper buy, sell and sold layers
packType = PT_SHOPPACK;
break;
case 0x0A30: // chest of drawers (fancy)
case 0x0A38: // chest of drawers (fancy)
packType = PT_DRAWER;
break;
case 0x0E42: // wooden chest
case 0x0E43: // wooden chest
packType = PT_WCHEST;
break;
case 0x0E80: // brass box
case 0x09A8: // metal box
packType = PT_MBOX;
break;
case 0x0E7C: // silver chest
case 0x09AB: // silver chest
packType = PT_SCHEST;
break;
case 0x0A97: // bookcase
case 0x0A98: // bookcase
case 0x0A99: // bookcase
case 0x0A9A: // bookcase
case 0x0A9B: // bookcase
case 0x0A9C: // bookcase
case 0x0A9D: // bookcase (empty)
case 0x0A9E: // bookcase (empty)
packType = PT_BOOKCASE;
break;
case 0x0A4C: // fancy armoire (open)
case 0x0A4D: // fancy armoire
case 0x0A50: // fancy armoire (open)
case 0x0A51: // fancy armoire
packType = PT_FARMOIRE;
break;
case 0x0A4E: // wooden armoire (open)
case 0x0A4F: // wooden armoire
case 0x0A52: // wooden armoire (open)
case 0x0A53: // wooden armoire
packType = PT_WARMOIRE;
break;
case 0x0A2C: // chest of drawers (wood)
case 0x0A34: // chest of drawers (wood)
case 0x0A35: // dresser
case 0x0A3C: // dresser
case 0x0A3D: // dresser
case 0x0A44: // dresser
packType = PT_DRESSER;
break;
case 0x09B2: // bank box ..OR.. backpack 2
if( i->GetTempVar( CITV_MOREX ) == 1 )
{
packType = PT_BANK;
}
else
{
packType = PT_PACK2;
}
break;
case 0x2bd9:
case 0x2BDA:
case 0x2BDB:
case 0x2BDC:
packType = PT_STOCKING;
break;
case 0x232A: // giftbox
case 0x232B: // giftbox
packType = PT_GIFTBOX1;
break;
case 0x2857: // SE armoire
case 0x2858: // SE armoire
packType = PT_SEARMOIRE1;
break;
case 0x285B: // SE armoire
case 0x285C: // SE armoire
packType = PT_SEARMOIRE2;
break;
case 0x285D: // SE armoire
case 0x285E: // SE armoire
case 0x2859: // SE armoire
case 0x285A: // SE armoire
packType = PT_SEARMOIRE3;
break;
case 0x24DB: // SE basket
case 0x24DC: // SE basket
packType = PT_SEBASKET;
break;
case 0x280B: // SE chest
case 0x280C: // SE chest
packType = PT_SECHEST1;
break;
case 0x280D: // SE chest
case 0x280E: // SE chest
packType = PT_SECHEST2;
break;
case 0x280F: // SE chest
case 0x2810: // SE chest
packType = PT_SECHEST3;
break;
case 0x2811: // SE chest
case 0x2812: // SE chest
case 0x2815: // SE cabinet
case 0x2816: // SE cabinet
case 0x2817: // SE chest
case 0x2818: // SE chest
packType = PT_SECHEST4;
break;
case 0x2813: // SE chest
case 0x2814: // SE chest
packType = PT_SECHEST5;
break;
case 0x46A5: // SA giftbox
case 0x46A6: // SA giftbox
packType = PT_GIFTBOX2;
break;
case 0x46A2: // SA giftbox
packType = PT_GIFTBOX3;
break;
case 0x46A3: // SA giftbox
packType = PT_GIFTBOX4;
break;
case 0x46A4: // SA giftbox
packType = PT_GIFTBOX5;
break;
case 0x46A7: // SA giftbox
packType = PT_GIFTBOX6;
break;
Various fixes and additions Updated CGump_AddToolTip() gump method - now accepts up to 10 optional cliloc arguments to go with specified cliloc. Can also be used to display custom tooltip text if used with a cliloc like 1114778. Cliloc arguments and custom tooltips only work in client version 7.0.16.0 or above. Updated CPSendGumpMenu::AddCommand() to use the safer vsnprintf instead of vsprintf, and increased msg buffer size from 512 to 1024 Updated CPIUpdateRangeChange::Handle() to include additional client definitions: CV_HS2D and CV_HS3D Added new pack types in PackTypes enum: PT_GAME_BACKGAMMON, PT_GAME_CHESS, PT_MAILBOX1, PT_MAILBOX2, PT_MAILBOX3, PT_MAILBOX4, PT_MAILBOX5, PT_MAILBOX6, PT_MAILBOX7, PT_MAILBOX8, PT_MAILBOX9, PT_WALLSAFE, PT_SAFE Updated getPackType() with additional container definitions for the following pack types: PT_RBASKET - winnoning basket (0x1882) PT_GCHEST - gargoyle chests (0x4025, 0x4026), metal chests (0xA304, 0xA305), rusty metal chests (0xA306, 0xA307), gold chests (0xA308, 0xA309), barnacle metal chests (0xA30A, 0xA30B) PT_GAME_BACKGAMMON - backgammon boards (0x0E1C, 0x0FAD) PT_GAME_CHESS - chess board (0x0FA6) PT_MAILBOX1 - dolphin mailbox (0xA202, 0xA203, 0xA204, 0xA205) PT_MAILBOX2 - squirrel mailbox (0xA206, 0xA207, 0xA208, 0xA209) PT_MAILBOX3 - barrel mailbox (0xA1F5, 0xA1F6, 0xA1F7, 0xA1F8) PT_MAILBOX4 - light mailbox (0xA268, 0xA269, 0xA26A, 0xA26B, 0xA26C, 0xA26D, 0xA26E, 0xA26F) PT_MAILBOX5 - sitting kitten mailbox (0xA3EB, 0xA3EC, 0xA3ED, 0xA3EE) PT_MAILBOX6 - standing kitten mailbox (0xA3EF, 0xA3F0, 0xA3F1, 0xA3F2) PT_MAILBOX7 - scarecrow mailbox (0xA3F3, 0xA3F4, 0xA3F5, 0xA3F6) PT_MAILBOX8 - lion mailbox (0xA3F7, 0xA3F8, 0xA3F9, 0xA3FA) PT_MAILBOX9 - square gray mailbox (0x4141, 0x4142, 0x4143, 0x4144) PT_WALLSAFE - wall safe (0x8B8F, 0x8B90) PT_SAFE - safe (0x9C18, 0x9C19) Updated CItem::IsShieldType() to include shield IDs from SA expansion Added IL_TALISMAN (0x09) and IL_FACE (0x0F) to ItemLayers enum to allow equipping talismans and faces in clients that support this Updated getWeaponType() (in both code and JS) with additional weapon definitions: ONEHND_LG_SWORDS - anquique sword 1 (0xA33B, 0xA33C), antique sword 2 (0xA33D, 0xA33E), antique sword 3 (0xA33F, 0xA340), skull sword (0xA341, 0xA342), gargoyle skull sword (0xA345, 0xA346) LG_MACES - skull staff (0xA343, 0xA344), gargoyle skull staff (0xA347, 0xA348) Updates keys.js with some distance checks Misc updates to JS Docs
2020-08-05 09:19:43 +08:00
case 0x0E1C: // Backgammon board
case 0x0FAD: // Backgammon board
packType = PT_GAME_BACKGAMMON;
break;
case 0x0FA6: // Chess board
packType = PT_GAME_CHESS;
break;
case 0xA202: // Dolphin mailbox
case 0xA203: // Dolphin mailbox
case 0xA204: // Dolphin mailbox
case 0xA205: // Dolphin mailbox
packType = PT_MAILBOX1;
break;
case 0xA206: // Squirrel mailbox
case 0xA207: // Squirrel mailbox
case 0xA208: // Squirrel mailbox
case 0xA209: // Squirrel mailbox
packType = PT_MAILBOX2;
break;
case 0xA1F5: // Wooden barrel mailbox
case 0xA1F7: // Wooden barrel mailbox
case 0xA1F8: // Wooden barrel mailbox
case 0xA1F9: // Wooden barrel mailbox
packType = PT_MAILBOX3;
break;
case 0xA268: // Light mailbox
case 0xA269: // Light mailbox
case 0xA26A: // Light mailbox
case 0xA26B: // Light mailbox
case 0xA26C: // Light mailbox
case 0xA26D: // Light mailbox
case 0xA26E: // Light mailbox
case 0xA26F: // Light mailbox
packType = PT_MAILBOX4;
break;
case 0xA3EB: // Sitting kitten mailbox
case 0xA3EC: // Sitting kitten mailbox
case 0xA3ED: // Sitting kitten mailbox
case 0xA3EE: // Sitting kitten mailbox
packType = PT_MAILBOX5;
break;
case 0xA3EF: // Standing kitten mailbox
case 0xA3F0: // Standing kitten mailbox
case 0xA3F1: // Standing kitten mailbox
case 0xA3F2: // Standing kitten mailbox
packType = PT_MAILBOX6;
break;
case 0xA3F3: // Scarecrow mailbox
case 0xA3F4: // Scarecrow mailbox
case 0xA3F5: // Scarecrow mailbox
case 0xA3F6: // Scarecrow mailbox
packType = PT_MAILBOX7;
break;
case 0xA3F7: // Lion mailbox
case 0xA3F8: // Lion mailbox
case 0xA3F9: // Lion mailbox
case 0xA3FA: // Lion mailbox
packType = PT_MAILBOX8;
break;
case 0x4141: // Square gray mailbox
case 0x4142: // Square gray mailbox
case 0x4143: // Square gray mailbox
case 0x4144: // Square gray mailbox
packType = PT_MAILBOX9;
break;
default:
packType = PT_UNKNOWN;
break;
}
return packType;
}
//o------------------------------------------------------------------------------------------------o
//| Function - cItem::AddRespawnItem()
//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 - Handles spawning of items from spawn objects/containers
//o------------------------------------------------------------------------------------------------o
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
void cItem::AddRespawnItem( CItem *mCont, const std::string& iString, const bool inCont, const bool randomItem, const UI16 itemAmount, bool useLootlist )
{
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
if( !ValidateObject( mCont ) || iString.empty() )
return;
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
CItem *iCreated = nullptr;
if( randomItem )
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
{
// LOOT tag was used
iCreated = CreateRandomItem( mCont, iString, mCont->WorldNumber(), mCont->GetInstanceId(), true, useLootlist );
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
}
else
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
{
// PACKITEM tag was used
iCreated = CreateBaseScriptItem( mCont, iString, mCont->WorldNumber(), itemAmount, mCont->GetInstanceId() );
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
}
if( iCreated == nullptr )
return;
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
// If item is stackable and amount is > 1, amount should have been set already
// However, if item is not stackable, spawn each item individually
if(( itemAmount > 1 ) && (( !randomItem && !iCreated->IsPileable() ) || randomItem ))
{
2021-06-12 07:30:23 -04:00
CItem *iCreated2 = nullptr;
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
for( UI08 i = 1; i < itemAmount; ++i )
{
if( randomItem )
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
{
// If amount was specified for a LOOT tag, spawn a random item each time
iCreated2 = CreateRandomItem( mCont, iString, mCont->WorldNumber(), mCont->GetInstanceId(), true, useLootlist );
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
}
else
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
{
// If amount was specified for a PACKITEM tag, spawn more copies of the same item
iCreated2 = CreateBaseScriptItem( mCont, iString, mCont->WorldNumber(), 1, mCont->GetInstanceId() );
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
}
if( iCreated2 )
{
if( inCont )
{
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
// Place item randomly in container
iCreated2->SetCont( mCont );
iCreated2->PlaceInPack();
}
else
{
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
iCreated2->SetLocation( mCont ); // Set item'mCont location in the world
}
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
iCreated2->SetSpawn( mCont->GetSerial() ); // Set source item was spawned from
// Try to stack the new item with existing items in the container, if any
if( iCreated2->IsPileable() )
{
AutoStack( nullptr, iCreated2, mCont );
}
}
}
}
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
// Ok, time to finalize setup of original item that was spawned
if( inCont )
{
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
iCreated->SetCont( mCont );
}
else
{
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
iCreated->SetLocation( mCont );
}
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
iCreated->SetSpawn( mCont->GetSerial() );
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( inCont )
{
if( ValidateObject( mCont ))
{
Fishing revamp Extended Character JS Method DoAction() to support two additional parameters - frameCount and playBackwards - which define the length of the animation (defaults to 7) and whether the animation should be played backwards (defaults to false). Note that this only works for old-style animations, and thus is not available for Gargoyle characters. Updated method syntax: .DoAction( actionID ) // Old animation packet .DoAction( actionID, null, frameCount) // Old animation packet with frameCount .DoAction( actionID, null, frameCount, frameDelay ) // Old animation packet with frameCount, frameDelay .DoAction( actionID, null, frameCount, frameDelay, playBackwards) // Old animation packet with frameCount, frameDelay, playBackwards .DoAction( actionID, subActionID ) // New animation packet Extended fishing JS script to include: Fishing special fishing nets, big fish, messages in a bottle/SOS messages and associated shipwreck treasures, with chances of attracting sea serpents, deep sea serpents, water elementals and krakens while fishing. Enhanced detection of fishing in shallow vs deep water, with deep water now being defined as any water tile that's 16 or more tiles away from the nearest land area. Updated timer system, LoS checks, Implemented SOS messages and shipwreck locations, with areas valid for potential shipwreck locations being defined in a new section of regions.dfn named [SOSAREAS], which follows the same syntax as the INSTALOG section in the same file. Once a message in a bottle is opened, a SOS message is generated with coordinates for a random shipwreck location, which players can sail to and fish near in order to find a sunken treasure (and other items). Implemented shipwreck treasures, which come in 3 levels of quality (with an optional 4th quality level available), with increasing amount of gold, gems, scrolls, reagents and magic items (coming in next commit!) per quality level of treasure Implemented special fishing nets, which can be used to fish up a variety of sea creatures (sea serpents, deep sea serpents, water elementals, kraken), which have a high chance of having SOS bottles on their corpses when defeated Updated fishinglist.dfn, itemlist.dfn and lootlist.dfn to support new fishing updates Updated movable state of various items that can be fished up (pillows, some pieces of furniture) to ensure players can move them! Renamed ORERESPAWNAREA ini setting to RESOURCEAREASIZE (it's also used for ore, and logs) and reduced it from 10 to 8 to divide each world into 8x8 sized resource areas Fixed a bug where the new fish resource type was not getting regenerated or saved properly Added INSTANCEID support to INSTALOG section of regions.dfn, and added default WORLD and INSTANCEID entries to all areas Fixed an issue with Runebooks (js/item/runebook.js) where the coordinates of a rune location would not be displayed properly Separated map coordinate function from Runebook script to its own script (js/server/data/map_coordinates.js), which other scripts can call upon to get map coords using TriggerEvent() JS function Ported sextant implementation from code to JS (5033=js/item/sextant.js), and removed the hard-coded version of this. Updated Item DFN entry for sextants to include script=5033 tag Fixed a bug in handling of the LOOT tag for NPCs where server would crash if a number was specified behind the item/itemlist to add as loot The DFN tags PACKITEM and LOOT are now handled similarly when used for NPCs and Items respectively. PACKITEM can be used for adding items with specific IDs, or "list objects" from itemlists.dfn, while LOOT can be used to add items from lootlists.dfn. One big difference between these is that if the optional amount parameter is specified for either tag when used with itemlists/lootlists (PACKITEM=listObject,amount vs LOOT=lootlist,amount), PACKITEM will add the specified amount of the specified/randomly chosen item, while LOOT will add X amount of random items. Updated implementation of ITEMLISTs and LOOTLISTs to support an optional weighting system, which can be used to adjust the probability of some items being chosen from these lists over other items. In the below example, specialfishingnet has a weight of 10, while the blank entry has a weight of 90, making it 9 times more likely for the blank entry to be chosen than the specialfishingnet! Note that higher weighted items should be sorted first for this to be accurate: [LOOTLIST shipwreck_treasure_special] { 90|blank 10|specialfishingnet } Using bladed weapons on stacks of fish will now cut the entire stack at once, instead of one fish at a time Updated DFN entries for various sea creatures (dfndata/npc/seacreatures.dfn) to adjust color of NPCs, loot and NPC AI Extended functionality of JS Function DoMovingEffect() to allow a set of coordinates as source location, without having to specify a character as either the source or target of the effect Fixed an issue with sea creatures being unable to pathfind in shallow water due to underwater land tiles being treated as blocking Moved fishing skill out of code and into js for more user friendly control Added js/item/magicfish.js for the magic fish food
2021-09-20 18:47:54 +08:00
// Determine random location within container to place item
iCreated->PlaceInPack();
// Try to stack the new item with existing items in the container, if any
AutoStack( nullptr, iCreated, mCont );
}
}
2003-03-05 00:53:45 +00:00
}
//o------------------------------------------------------------------------------------------------o
//| Function - cItem::GlowItem()
//o------------------------------------------------------------------------------------------------o
//| Purpose - Handle glowing items
//o------------------------------------------------------------------------------------------------o
void cItem::GlowItem( CItem *i )
{
if( i->GetGlow() != INVALIDSERIAL )
{
CItem *j = CalcItemObjFromSer( i->GetGlow() );
if( !ValidateObject( j ))
return;
CBaseObject *getCont = i->GetCont();
2021-06-12 07:30:23 -04:00
if( getCont == nullptr ) // On the ground
{
2021-06-12 07:30:23 -04:00
j->SetCont( nullptr );
j->SetDir( 29 );
j->SetLocation( i );
}
2003-03-05 00:53:45 +00:00
else if( getCont->GetObjType() == OT_ITEM ) // In a pack
{
j->SetCont( getCont );
j->SetDir( 99 ); // gives no light in backpacks
j->SetX( i->GetX() );
j->SetY( i->GetY() );
j->SetZ( i->GetZ() );
}
else // Equipped
{
CChar *s = static_cast<CChar *>( getCont );
if( ValidateObject( s ))
{
j->SetCont( getCont );
j->SetX( s->GetX() );
j->SetY( s->GetY() );
j->SetZ( s->GetZ()+4 );
if( IsOnline(( *s )))
{
j->SetDir( 29 );
}
else
{
j->SetDir( 99 );
}
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
j->SetLayer( IL_TALISMAN );
}
}
}
}
//o------------------------------------------------------------------------------------------------o
//| Function - cItem::CheckEquipment()
//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 equipment of character and validates that they have enough strength
//| to have each item equipped
//o------------------------------------------------------------------------------------------------o
void cItem::CheckEquipment( CChar *p )
{
if( ValidateObject( p ))
{
CSocket *pSock = p->GetSocket();
2021-06-12 07:30:23 -04:00
if( pSock == nullptr )
return;
Thief Revamp - 0.99.6-RC5 Added script for NPC guildmasters (js/npc/ai/guildmaster.js). Only one NPC guild has been setup in the script so far (more can be easily added) - the Thieves Guild - which if joined grants players the ability to steal from other players and to buy disguise kits Added two new NPCs, which there will now spawn one of in a random location in each city in Britannia (felucca facet): m_thief_guildmaster (dfndata/npc/male_human.dfn) f_thief_guildmaster (dfndata/npc/female_Human.dfn) Added two new character properties to keep track of which NPC guild a player (or NPC) belongs to. These properties have been exposed as the following Character JS properties: .npcGuild // ID of NPC guild, as defined in script .npcGuildJoined // Timestamp for when player joined NPC guild Added script for Disguise Kits (js/item/disguisekit.js). These allow members of the Thieves Guild to disguise themselves from the prying eyes of other players. Added two new character properties: .isDisguised // true/false flag for character being disguised .origName // used to store character's original name before disguise went into effect Moved implementation of Stealing skill from code to script (js/skill/stealing.js) and revamped it completely in the process. Changes include: New features: Town rare stealing - any item marked as "special stealable" with new item property .stealable can be stolen, even if it's locked down by a GM on the ground, or inside a container When stealing from item piles, thief can potentially steal the amount of items that makes up the max weight limit for what they can steal, from those piles Chance to successfully steal is now affected by whether there are any characters (NPCs or Players) that witness the attempt. Depends on distance to character, and direction character is facing Players now become "permagrey" when successfully stealing from another player, regardless of whether it's witnessed Players now receive a "stealing" flag when stealing from another player, regardless of whether it's witnessed Stolen items cannot be removed from thief's backpack for 30 seconds following the theft of the item (AoS core shard era and above) Optional AoS feature to steal special consumable items from monsters Updated default stealing rules: Updated calculations to determine chance of success when stealing Players cannot steal while engaged in combat Players are revealed if hidden as soon as they use the stealing skill Players can no longer steal items in the secure trade window Players can no longer steal items from NPC shopkeepers Both hands must be free to steal Stealing now checks line of sight to target player/object Only members of Thieves Guild (NPC guild) can now steal from other players, unless they are guild enemies Players can no longer steal from NPC guards by default Players can no longer steal from the same NPC monster more than once Only gold and gems can be stolen from innocent players in dungeon/ll areas of Felucca, if core shard era is set to AoS or higher Players can no longer steal items held on cursor by other players Orcish masks now eplode if player steals from orcs while wearing it If core shard era is set to LBR or lower, player is marked as an aggressor if they steal from another player Guards can only be called on players that are flagged as criminals within the first 10 seconds of them being flagged Stealing script options: Allow stealing entire containers (off by default pre-AoS) Return stolen items on thief death (off by default) Temporarily make stolen items immovable in thief's backpack (on by default post-AoS) Temporarily protect traded items (on by default) Let dexterity affect chance for successful theft (off by default) Let light level affect chance for successful theft (off by default) Allow stealing from NPC Guards (off by default) Allow stealing special loot from monsters (on by default post-ml) Moved implementation of Snooping skill from code to script (js/skill/snooping.js), with some changes: Players cannot snoop pack animals from inside a house, if the animal is outside The deeper inside main backpack a container sits, the harder it becomes to snoop inside it Included an optional feature that lets targets of snooping gradually become more aware, increasing the difficulty of succeeding. This awareness fades over time. Players have a chance to stay hidden while snooping, based on their Hiding skill Karma is now lowered by snooping regardless of success or failure Added tracking system for "aggressors" in combat. A player attacking someone (regardless of flag status) will be marked as aggressor to that someone for 2 minutes Added tracking system for "permagrey" flags - these are stored on a per-target basis, so a player can be flagged visibly as permagrey to multiple other players. Persists until player dies. Player combat targets and war mode are now cleared on logout Players will now be unable to hide if within visual distance and in line of sight of their attacker or current target in combat Server leave-announcement now only happens after the logout timer has expired, instead of the exact moment the player presses the logout button Fixed an issue that could cause swimming NPCs to swim on land NPCs now have the ability to temporarily ignore unreachable targets in combat. If attacked by someone they are ignoring, they will enter evade state and try to move away from that someone. SpawnRegions now support NPCLISTS with weighted entries. Example of an NPCLIST with 75% chance of spawning some kind of orc, and 25% chance of spawning a ratman archer: [NPCLIST example] { 75|NPCLIST=allorc 25|ratman } Added 3 additional "all purpose" item properties (.more0, .more1 and .more2) and exposed those to JS engine. These work the same as more/morex/morey/morez Mark spell now stores a 4th property on recall runes - instanceID. This is stored in the rune's .more0 property. Recall and Gate spells now check the recall rune (or runebook)'s 4th location property - instanceID - to determine where the player ends up Fixed a server crash related to equipment being automatically unequipped if character is no longer strong enough to have it equipped Added new JS Function to check if any characters at specified location potentially block movement: DoesCharacterBlock( x, y, z, worldNum, instanceID ) // returns true if a character exists at given coordinate (within z +/- 4)
2023-06-20 02:21:16 +08:00
std::vector<CItem *> itemsToUnequip;
const SI16 StrengthToCompare = p->GetStrength();
for( CItem *i = p->FirstItem(); !p->FinishedItems(); i = p->NextItem() )
{
if( ValidateObject( i ))
{
const SI16 scaledStrength = ( i->GetStrength() * ( 100 - i->GetLowerStatReq() )) / 100;
if( scaledStrength > StrengthToCompare )//if strength required > character's strength
{
Thief Revamp - 0.99.6-RC5 Added script for NPC guildmasters (js/npc/ai/guildmaster.js). Only one NPC guild has been setup in the script so far (more can be easily added) - the Thieves Guild - which if joined grants players the ability to steal from other players and to buy disguise kits Added two new NPCs, which there will now spawn one of in a random location in each city in Britannia (felucca facet): m_thief_guildmaster (dfndata/npc/male_human.dfn) f_thief_guildmaster (dfndata/npc/female_Human.dfn) Added two new character properties to keep track of which NPC guild a player (or NPC) belongs to. These properties have been exposed as the following Character JS properties: .npcGuild // ID of NPC guild, as defined in script .npcGuildJoined // Timestamp for when player joined NPC guild Added script for Disguise Kits (js/item/disguisekit.js). These allow members of the Thieves Guild to disguise themselves from the prying eyes of other players. Added two new character properties: .isDisguised // true/false flag for character being disguised .origName // used to store character's original name before disguise went into effect Moved implementation of Stealing skill from code to script (js/skill/stealing.js) and revamped it completely in the process. Changes include: New features: Town rare stealing - any item marked as "special stealable" with new item property .stealable can be stolen, even if it's locked down by a GM on the ground, or inside a container When stealing from item piles, thief can potentially steal the amount of items that makes up the max weight limit for what they can steal, from those piles Chance to successfully steal is now affected by whether there are any characters (NPCs or Players) that witness the attempt. Depends on distance to character, and direction character is facing Players now become "permagrey" when successfully stealing from another player, regardless of whether it's witnessed Players now receive a "stealing" flag when stealing from another player, regardless of whether it's witnessed Stolen items cannot be removed from thief's backpack for 30 seconds following the theft of the item (AoS core shard era and above) Optional AoS feature to steal special consumable items from monsters Updated default stealing rules: Updated calculations to determine chance of success when stealing Players cannot steal while engaged in combat Players are revealed if hidden as soon as they use the stealing skill Players can no longer steal items in the secure trade window Players can no longer steal items from NPC shopkeepers Both hands must be free to steal Stealing now checks line of sight to target player/object Only members of Thieves Guild (NPC guild) can now steal from other players, unless they are guild enemies Players can no longer steal from NPC guards by default Players can no longer steal from the same NPC monster more than once Only gold and gems can be stolen from innocent players in dungeon/ll areas of Felucca, if core shard era is set to AoS or higher Players can no longer steal items held on cursor by other players Orcish masks now eplode if player steals from orcs while wearing it If core shard era is set to LBR or lower, player is marked as an aggressor if they steal from another player Guards can only be called on players that are flagged as criminals within the first 10 seconds of them being flagged Stealing script options: Allow stealing entire containers (off by default pre-AoS) Return stolen items on thief death (off by default) Temporarily make stolen items immovable in thief's backpack (on by default post-AoS) Temporarily protect traded items (on by default) Let dexterity affect chance for successful theft (off by default) Let light level affect chance for successful theft (off by default) Allow stealing from NPC Guards (off by default) Allow stealing special loot from monsters (on by default post-ml) Moved implementation of Snooping skill from code to script (js/skill/snooping.js), with some changes: Players cannot snoop pack animals from inside a house, if the animal is outside The deeper inside main backpack a container sits, the harder it becomes to snoop inside it Included an optional feature that lets targets of snooping gradually become more aware, increasing the difficulty of succeeding. This awareness fades over time. Players have a chance to stay hidden while snooping, based on their Hiding skill Karma is now lowered by snooping regardless of success or failure Added tracking system for "aggressors" in combat. A player attacking someone (regardless of flag status) will be marked as aggressor to that someone for 2 minutes Added tracking system for "permagrey" flags - these are stored on a per-target basis, so a player can be flagged visibly as permagrey to multiple other players. Persists until player dies. Player combat targets and war mode are now cleared on logout Players will now be unable to hide if within visual distance and in line of sight of their attacker or current target in combat Server leave-announcement now only happens after the logout timer has expired, instead of the exact moment the player presses the logout button Fixed an issue that could cause swimming NPCs to swim on land NPCs now have the ability to temporarily ignore unreachable targets in combat. If attacked by someone they are ignoring, they will enter evade state and try to move away from that someone. SpawnRegions now support NPCLISTS with weighted entries. Example of an NPCLIST with 75% chance of spawning some kind of orc, and 25% chance of spawning a ratman archer: [NPCLIST example] { 75|NPCLIST=allorc 25|ratman } Added 3 additional "all purpose" item properties (.more0, .more1 and .more2) and exposed those to JS engine. These work the same as more/morex/morey/morez Mark spell now stores a 4th property on recall runes - instanceID. This is stored in the rune's .more0 property. Recall and Gate spells now check the recall rune (or runebook)'s 4th location property - instanceID - to determine where the player ends up Fixed a server crash related to equipment being automatically unequipped if character is no longer strong enough to have it equipped Added new JS Function to check if any characters at specified location potentially block movement: DoesCharacterBlock( x, y, z, worldNum, instanceID ) // returns true if a character exists at given coordinate (within z +/- 4)
2023-06-20 02:21:16 +08:00
itemsToUnequip.push_back( i );
}
}
}
Thief Revamp - 0.99.6-RC5 Added script for NPC guildmasters (js/npc/ai/guildmaster.js). Only one NPC guild has been setup in the script so far (more can be easily added) - the Thieves Guild - which if joined grants players the ability to steal from other players and to buy disguise kits Added two new NPCs, which there will now spawn one of in a random location in each city in Britannia (felucca facet): m_thief_guildmaster (dfndata/npc/male_human.dfn) f_thief_guildmaster (dfndata/npc/female_Human.dfn) Added two new character properties to keep track of which NPC guild a player (or NPC) belongs to. These properties have been exposed as the following Character JS properties: .npcGuild // ID of NPC guild, as defined in script .npcGuildJoined // Timestamp for when player joined NPC guild Added script for Disguise Kits (js/item/disguisekit.js). These allow members of the Thieves Guild to disguise themselves from the prying eyes of other players. Added two new character properties: .isDisguised // true/false flag for character being disguised .origName // used to store character's original name before disguise went into effect Moved implementation of Stealing skill from code to script (js/skill/stealing.js) and revamped it completely in the process. Changes include: New features: Town rare stealing - any item marked as "special stealable" with new item property .stealable can be stolen, even if it's locked down by a GM on the ground, or inside a container When stealing from item piles, thief can potentially steal the amount of items that makes up the max weight limit for what they can steal, from those piles Chance to successfully steal is now affected by whether there are any characters (NPCs or Players) that witness the attempt. Depends on distance to character, and direction character is facing Players now become "permagrey" when successfully stealing from another player, regardless of whether it's witnessed Players now receive a "stealing" flag when stealing from another player, regardless of whether it's witnessed Stolen items cannot be removed from thief's backpack for 30 seconds following the theft of the item (AoS core shard era and above) Optional AoS feature to steal special consumable items from monsters Updated default stealing rules: Updated calculations to determine chance of success when stealing Players cannot steal while engaged in combat Players are revealed if hidden as soon as they use the stealing skill Players can no longer steal items in the secure trade window Players can no longer steal items from NPC shopkeepers Both hands must be free to steal Stealing now checks line of sight to target player/object Only members of Thieves Guild (NPC guild) can now steal from other players, unless they are guild enemies Players can no longer steal from NPC guards by default Players can no longer steal from the same NPC monster more than once Only gold and gems can be stolen from innocent players in dungeon/ll areas of Felucca, if core shard era is set to AoS or higher Players can no longer steal items held on cursor by other players Orcish masks now eplode if player steals from orcs while wearing it If core shard era is set to LBR or lower, player is marked as an aggressor if they steal from another player Guards can only be called on players that are flagged as criminals within the first 10 seconds of them being flagged Stealing script options: Allow stealing entire containers (off by default pre-AoS) Return stolen items on thief death (off by default) Temporarily make stolen items immovable in thief's backpack (on by default post-AoS) Temporarily protect traded items (on by default) Let dexterity affect chance for successful theft (off by default) Let light level affect chance for successful theft (off by default) Allow stealing from NPC Guards (off by default) Allow stealing special loot from monsters (on by default post-ml) Moved implementation of Snooping skill from code to script (js/skill/snooping.js), with some changes: Players cannot snoop pack animals from inside a house, if the animal is outside The deeper inside main backpack a container sits, the harder it becomes to snoop inside it Included an optional feature that lets targets of snooping gradually become more aware, increasing the difficulty of succeeding. This awareness fades over time. Players have a chance to stay hidden while snooping, based on their Hiding skill Karma is now lowered by snooping regardless of success or failure Added tracking system for "aggressors" in combat. A player attacking someone (regardless of flag status) will be marked as aggressor to that someone for 2 minutes Added tracking system for "permagrey" flags - these are stored on a per-target basis, so a player can be flagged visibly as permagrey to multiple other players. Persists until player dies. Player combat targets and war mode are now cleared on logout Players will now be unable to hide if within visual distance and in line of sight of their attacker or current target in combat Server leave-announcement now only happens after the logout timer has expired, instead of the exact moment the player presses the logout button Fixed an issue that could cause swimming NPCs to swim on land NPCs now have the ability to temporarily ignore unreachable targets in combat. If attacked by someone they are ignoring, they will enter evade state and try to move away from that someone. SpawnRegions now support NPCLISTS with weighted entries. Example of an NPCLIST with 75% chance of spawning some kind of orc, and 25% chance of spawning a ratman archer: [NPCLIST example] { 75|NPCLIST=allorc 25|ratman } Added 3 additional "all purpose" item properties (.more0, .more1 and .more2) and exposed those to JS engine. These work the same as more/morex/morey/morez Mark spell now stores a 4th property on recall runes - instanceID. This is stored in the rune's .more0 property. Recall and Gate spells now check the recall rune (or runebook)'s 4th location property - instanceID - to determine where the player ends up Fixed a server crash related to equipment being automatically unequipped if character is no longer strong enough to have it equipped Added new JS Function to check if any characters at specified location potentially block movement: DoesCharacterBlock( x, y, z, worldNum, instanceID ) // returns true if a character exists at given coordinate (within z +/- 4)
2023-06-20 02:21:16 +08:00
// Loop through the items we want to move out of corpse
std::for_each( itemsToUnequip.begin(), itemsToUnequip.end(), [p, pSock]( CItem *iUnequip )
{
auto pPack = p->GetPackItem();
if( ValidateObject( pPack ) )
{
// Pack detected, drop to pack
iUnequip->SetCont( pPack );
iUnequip->PlaceInPack();
}
else
{
// No pack detected - drop on ground
iUnequip->SetCont( nullptr );
iUnequip->SetLocation( p );
}
for( auto &item : FindNearbyPlayers( p ))
{
p->SendWornItems( item );
}
pSock->SysMessage( 2782 ); // You are not strong enough to keep some of your items equipped!
Effects->ItemSound( pSock, iUnequip );
});
}
}
//o------------------------------------------------------------------------------------------------o
//| Function - cItem::StoreItemRandomValue()
//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 - Stores an item's random "good" value (used by trade system)
//o------------------------------------------------------------------------------------------------o
void cItem::StoreItemRandomValue( CItem *i, CTownRegion *tReg )
{
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( i->GetGood() < 0 )
return;
2021-06-12 07:30:23 -04:00
if( tReg == nullptr )
{
CBaseObject *getLastCont = i->GetCont();
2021-06-12 07:30:23 -04:00
if( getLastCont != nullptr )
{
tReg = CalcRegionFromXY( getLastCont->GetX(), getLastCont->GetY(), getLastCont->WorldNumber(), getLastCont->GetInstanceId() );
}
2021-06-12 07:30:23 -04:00
if( tReg == nullptr )
{
2003-03-05 00:53:45 +00: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
const SI32 min = tReg->GetGoodRnd1( static_cast<UI08>( i->GetGood() ));
const SI32 max = tReg->GetGoodRnd2( static_cast<UI08>( i->GetGood() ));
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( max != 0 || min != 0 )
{
i->SetRndValueRate( RandomNum( min, max ));
}
}
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
//o------------------------------------------------------------------------------------------------o
//| Function - cItem::DupeItem()
//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 - Duplicates selected item
//o------------------------------------------------------------------------------------------------o
CItem *cItem::DupeItem( CSocket *s, CItem *i, UI32 amount )
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
{
CChar *mChar = s->CurrcharObj();
CBaseObject *iCont = i->GetCont();
CItem *charPack = mChar->GetPackItem();
if( !ValidateObject( mChar ) || i->IsCorpse() || ( !ValidateObject( iCont ) && !ValidateObject( charPack )))
2021-06-12 07:30:23 -04:00
return nullptr;
Numerous changes with focus on feature and stability parity across Windows, Linux and MacOS platforms Added new Makefile that handles compiling UOX3 and Spidermonkey on both Linux and MacOS (punt) Added VS solution (SpiderMonkey.sln) and VC++ project files for compiling SpiderMonkey on Windows (Xuri) Updated SpiderMonkey from v1.6.0 to v1.7.0 Added optimization flag -O2 for release build in CMakeLists.txt in project root (Xuri) Added StringUtility file with general common string manipulation functions (punt) Updated RandomNum function to use a "seedless" random number generator from C++11 instead of the old C rand() function. (punt) Overall code cleanup to remove/replace platform-dependent code (punt) Replaced potentially unsafe usage of C string stuff like sprintf, vsprintf, vsnprintf, strncat, strcpy and strlen throughout the code with calls to a format() function containing only a single, safe use of vsnprintf, ensuring there's a single place of failure if there's anything to fix and and making it easy to potentially replace this with std::format from C++20 when the time comes. (punt) Replaced usage of char in many places with std::string (punt) Started process of replacing UString usage with functions provided through StringUtility instead (punt) Replaced platform specific fileIO handling in Windows/Linux with cross-platform C++17 standard std::filesystem (punt) Replaced platform specific time handling by using cross-platform chrono library (punt) Removed UOX namespace to reduce complexity (punt) Elimitated template code approach to singletons for more modern c++ constructs, removing dependices in the process (punt) Removed ODBC support; it hasn't been touched since the initial implementation in 2008, and there is a lack of someone to maintain the code. (punt) Removed some platform specific files like uoxlinux.h, which is no longer required (punt) Removed legacy crash protection code, and removed support for cluox (punt) Removed legacy "support" for Borland compiler (punt) Removed legacy VC++ 6 Workspace/Project files, VS2005 Solution/Project files, as these are no longer supported (Xuri) Removed legacy BUILD folder with outdated compilation instructions (Xuri) Removed old Changelog file (merged into Changelog.txt) (Xuri) Fixed a pointer bug for items in multis on world load (punt) Fixed a dictionary related issue that caused segmentation faults on Linux/MacOS (punt) Fixed an issue with callbacks to JS scripts that caused segmentation faults on Linux/MacOS (punt) Paths in uox.ini should now load properly on all platforms regardless of whether those paths use slashes or backslashes, and whether or not they end in a slash/backslash. (punt) Moved to c++17 style of threading, and got rid of threadsafeobject.cpp/h (punt) Replaced parsing of UOX.INI tags with a system that's more easily maintainable (punt) Added some new commands to js/commands/custom/misc-cmd.js (Xuri) cont // Targeted item will be made a container, set to nondecay and movable 2 endfight // Targeted character (and character being fought) will stop fighting getmulti // Get multiObject for targeted item finditem // Find item at layer X movespeed // Set movement speed of target player (0x0 Normal, 0x1 Mounted, 0x2 Slow (walk only), 0x3 Hybrid ("jog"?), 0x4 Frozen) Added new HTML based documentation in docs folder, and removed many old legacy docs that are either incorporated into this document already or no longer relevant for the current UOX3 version (Xuri) Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2020-09-07 18:09:55 +08:00
CItem *c = i->Dupe();
2021-06-12 07:30:23 -04:00
if( c == nullptr )
return nullptr;
c->IncLocation( 2, 2 );
if(( !ValidateObject( iCont ) || iCont->GetObjType() != OT_ITEM ) && ValidateObject( charPack ))
{
c->SetCont( charPack );
}
if( amount > MAX_STACK )
{
amount -= MAX_STACK;
DupeItem( s, i, MAX_STACK );
}
c->SetAmount( amount );
Minor JS revamp - multiple scripts per object! Added TryParseJSVal() helper function in cScript.cpp, used to parse jsval values returned from script events. Provides results matching 0 (0, false), 1 (1, true) or any specific int value returned from script. JS events updated to use new TryParseJSVal helper function (no change in behaviour): onDecay, onResurrect, onCommand, onBuyFromVendor, onSellToVendor, onPickup, onCharDoubleClick, onSkillGump, onUseBandageMacro, onCombatStart, onCombatEnd, onDeathBlow, onBuy, onSell JS events with slight change of behaviour after update to use TryParseJSVal: onDrop, onDropItemOnItem, onDropItemOnNpc - previously, a blank or non-existent return value would be treated the same as a return true. This will now be treated as a return false. Update scripts accordingly! JS events updated to support return values from scripts: onCollide, onTalk, onSnooped, OnHungerChange Return false or nothing to prevent hard code from running Return true to allow hard code to run like normal onStolenFrom, onAISliver, onLightChange, onVirtueGumpPress, onQuestGump, onSpecialMove, onSwing, onClick, onHouseCommand, onSellToVendor, onSkillCheck, onSpellGain, onSpellLoss Return false to allow hard code and other scripts with event to run like normal Return true to prevent hard code and other scripts with event from running onSteal Return false or nothing to allow hard code and other scripts with event to run like normal Return true to prevent hard code and onStolenFrom event from running (theft failed?) Return 2 to prevent hard code, but allow onStolenFrom event to run (theft succeeded, but handled in script?) onLeaving, onEntrance, onEquip, onUnequip, onEnterEvadeState, onSoldToVendor, onBoughtFromVendor, onSpellSuccess, onSpellTarget, onFlagChange, onDeath Return false or nothing to allow other scripts with event to run like normal Return true to prevent other scripts with event from running Added new JS events that run prior to items being equipped/unequipped, with support for return values: onEquipAttempt( pEquipper, iEquipping ) onUnequipAttempt( pEquipper, iUnequipping ) Return false or nothing to reject attempt to equip/unequip item, and prevent hard-code or other scripts with event from running Return true to allow hard code to run like normal Added new JS event that runs prior to onSnooped event, for character doing the snooping: onSnoopAttempt( snooped, snooper ) Return false or nothing to prevent hard code and other snooping-related events from running Return true to allow hard code and other snooping-related events to run like normal Updated onSnooped JS event to accept return values: Return true when success state is true to prevent other scripts with event from running Return true when success state is false to prevent hard code and other scripts with event from running Updated onClick JS event to also run for characters with event attached (return 1 to prevent showing hard-coded name for whatever object is clicked) Updated onSteal JS event to include a third parameter, an object reference for the target of the theft Added support for assigning multiple JS scripts per object (item, multi, char, region). Any time a scriptID is added to an object, the list of such IDs for that object will be sorted from lowest to highest scriptID, which also determines the execution order for the scripts. Note that if the same JS event is present in several scripts assigned to an object, each of those events will trigger, unless the rules about return values for said event prevent this DFNs for Items, Multis, Characters and Regions can now contain multiple SCRIPT=scriptID tags per definition. Each such SCRIPT tag will be applied to the object in question, then sorted from lowest to highest scriptID by server. Added new JS property for Items, Multis, Characters and Regions: .scriptTriggers // If used to get property, will return array object with all script IDs assigned to object. If used to set property, will add script ID to existing list of script IDs for object. Modified JS property for Items, Multis, Characters and Regions, which for backwards compatibility functions similar to in older versions: .scripttrigger // If used to get property, will return last script ID in list of script IDs assigned to object. If used to set property, will clear list of script IDs and assign only the new ID Added new JS Methods for Items, Multis, Characters and Regions: .AddScriptTrigger( scriptID ) // Adds a new scriptID to list of scripts assigned to object .RemoveScriptTrigger( scriptID ) // Remove a specific scriptID from object (0 = remove all) Moved SETSCPTRIG command from code to JS (js/commands/targeting/scptrig.js), and supplemented it with some additional commands: GETSCPTRIG // List out all scriptIDs assigned to object SETSCPTRIG scriptID // Clears list of scriptIDs for object, then assigns the specified scriptID ADDSCPTRIG scriptID // Adds specified scriptID to list of scriptsIDs assigned to object REMOVESCPTRIG scriptID // Removes specified scriptID from list of scriptIDs assigned to object (0 = remove all)
2021-05-25 19:37:52 +08:00
std::vector<UI16> scriptTriggers = c->GetScriptTriggers();
for( auto scriptTrig : scriptTriggers )
{
cScript *toExecute = JSMapping->GetScript( scriptTrig );
2021-06-12 07:30:23 -04:00
if( toExecute != nullptr )
Minor JS revamp - multiple scripts per object! Added TryParseJSVal() helper function in cScript.cpp, used to parse jsval values returned from script events. Provides results matching 0 (0, false), 1 (1, true) or any specific int value returned from script. JS events updated to use new TryParseJSVal helper function (no change in behaviour): onDecay, onResurrect, onCommand, onBuyFromVendor, onSellToVendor, onPickup, onCharDoubleClick, onSkillGump, onUseBandageMacro, onCombatStart, onCombatEnd, onDeathBlow, onBuy, onSell JS events with slight change of behaviour after update to use TryParseJSVal: onDrop, onDropItemOnItem, onDropItemOnNpc - previously, a blank or non-existent return value would be treated the same as a return true. This will now be treated as a return false. Update scripts accordingly! JS events updated to support return values from scripts: onCollide, onTalk, onSnooped, OnHungerChange Return false or nothing to prevent hard code from running Return true to allow hard code to run like normal onStolenFrom, onAISliver, onLightChange, onVirtueGumpPress, onQuestGump, onSpecialMove, onSwing, onClick, onHouseCommand, onSellToVendor, onSkillCheck, onSpellGain, onSpellLoss Return false to allow hard code and other scripts with event to run like normal Return true to prevent hard code and other scripts with event from running onSteal Return false or nothing to allow hard code and other scripts with event to run like normal Return true to prevent hard code and onStolenFrom event from running (theft failed?) Return 2 to prevent hard code, but allow onStolenFrom event to run (theft succeeded, but handled in script?) onLeaving, onEntrance, onEquip, onUnequip, onEnterEvadeState, onSoldToVendor, onBoughtFromVendor, onSpellSuccess, onSpellTarget, onFlagChange, onDeath Return false or nothing to allow other scripts with event to run like normal Return true to prevent other scripts with event from running Added new JS events that run prior to items being equipped/unequipped, with support for return values: onEquipAttempt( pEquipper, iEquipping ) onUnequipAttempt( pEquipper, iUnequipping ) Return false or nothing to reject attempt to equip/unequip item, and prevent hard-code or other scripts with event from running Return true to allow hard code to run like normal Added new JS event that runs prior to onSnooped event, for character doing the snooping: onSnoopAttempt( snooped, snooper ) Return false or nothing to prevent hard code and other snooping-related events from running Return true to allow hard code and other snooping-related events to run like normal Updated onSnooped JS event to accept return values: Return true when success state is true to prevent other scripts with event from running Return true when success state is false to prevent hard code and other scripts with event from running Updated onClick JS event to also run for characters with event attached (return 1 to prevent showing hard-coded name for whatever object is clicked) Updated onSteal JS event to include a third parameter, an object reference for the target of the theft Added support for assigning multiple JS scripts per object (item, multi, char, region). Any time a scriptID is added to an object, the list of such IDs for that object will be sorted from lowest to highest scriptID, which also determines the execution order for the scripts. Note that if the same JS event is present in several scripts assigned to an object, each of those events will trigger, unless the rules about return values for said event prevent this DFNs for Items, Multis, Characters and Regions can now contain multiple SCRIPT=scriptID tags per definition. Each such SCRIPT tag will be applied to the object in question, then sorted from lowest to highest scriptID by server. Added new JS property for Items, Multis, Characters and Regions: .scriptTriggers // If used to get property, will return array object with all script IDs assigned to object. If used to set property, will add script ID to existing list of script IDs for object. Modified JS property for Items, Multis, Characters and Regions, which for backwards compatibility functions similar to in older versions: .scripttrigger // If used to get property, will return last script ID in list of script IDs assigned to object. If used to set property, will clear list of script IDs and assign only the new ID Added new JS Methods for Items, Multis, Characters and Regions: .AddScriptTrigger( scriptID ) // Adds a new scriptID to list of scripts assigned to object .RemoveScriptTrigger( scriptID ) // Remove a specific scriptID from object (0 = remove all) Moved SETSCPTRIG command from code to JS (js/commands/targeting/scptrig.js), and supplemented it with some additional commands: GETSCPTRIG // List out all scriptIDs assigned to object SETSCPTRIG scriptID // Clears list of scriptIDs for object, then assigns the specified scriptID ADDSCPTRIG scriptID // Adds specified scriptID to list of scriptsIDs assigned to object REMOVESCPTRIG scriptID // Removes specified scriptID from list of scriptIDs assigned to object (0 = remove all)
2021-05-25 19:37:52 +08:00
{
UOX3 0.99.6-RC6 Removed arbitrary and hidden restrictions on refreshing list of online players shown with 'wholist command Fixed an issue where player ghosts that get teleported would not see themselves get updated to new location Fixed a server crash from clients disconnecting while running server in debug mode Improved how container updates are sent to players; now only sends to clients that have actually opened the container, and who are still within range Added more information about UO data files being loaded during server startup Enhanced the GM 'add menu to allow clicking directly on images of items/npcs to add them, and adjusted size of menus to accommodate this Fixed an issue with fleeing NPCs that could cause them to attempt to flee across time and space, regardless of distance to target/attacker in combat Added NPC AI that runs away from players if they get too close (even outside combat). Applied to hind, rabbits, squirrels, ferrets and various birds by default: AI_ANIMAL_SCARED (aitype 12) Fixed issues with NPCs fleeing forever, or getting stuck in flee/don't flee loop, by introducing max fleeing distance (50 tiles) and cooldown (30 sec) on fleeing Updated onNameRequest JS Event to include third parameter with origin of name request, so script responses can be tailored appropriately: onNameRequest( myObj, requestedBy, requestSource ) Potential values for requestSource: 0 - Speech/System Messages 1 - Guild Menus 2 - Stat Window (self) 3 - Stat Window (other) 4 - Tooltip 5 - Paperdoll Journal 6 - Paperdoll 7 - Single Click / All-Names 8 - System 9 - Secure Trade Window Added Adaptive Performance System (APS) that dynamically adjust how often NPC AI/movement is checked based on overall shard performance. If performance drops below defined threshold, UOX3 gradually slows down checks for NPC AI/movement to prioritize player movement/speech/command responsiveness. If performance climbs back up above threshold, slowdowns are gradually removed. The following UOX.INI options have been added under [system] category to support this system: APSPERFTHRESHOLD=50 // Performance threshold (measured in simulation cycles/sec) below which the APS kicks in APSINTERVAL=100 // How often (in milliseconds) the APS checks performance and makes adjustments (if needed) to balance out shard performance APSDELAYSTEP=50 // How much the delay timer is modified by (in milliseconds) each time APS makes adjustments APSDELAYMAXCAP=2000 // Max amount of of delay APS can introduce for NPC AI/movement handling when attempting to restore shard performance Added new JS Methods for Region objects: .GetOrePrefs( oreType ) // Get ore preference data for ore type found in town region. Returned as an array containing the following data: orePrefData -> [ oreName, // name of ore color, // color of ore minskill, // min skill to mine ore ingotName, // name of ingot created from ore makemenu, // makemenu entry for crafting something from ingot oreChance, // default global chance of finding this ore type scriptID // script attached to mined ore ], orePrefChance // Chance of finding this ore type in given town region .GetOreChance() // Get base chance of finding any ore in town region Moved Mining skill plus gravedigging feature from hard code to scripts (js/skill/mining.js) to make it easier to maintain and/or customize, and removed hard coded variants Gravedigging now relies on the ore resource system behind the scenes to restrict how often graves in a given area can be dug up Fixed some incorrect references to .worldNumber Character property in misc scripts (should be .worldnumber) Made some "hard-scripted" system messages in misc scripts use dictionary system instead Added spawn region for banker NPCs in Serpent's Hold (dfndata/spawn/felucca/spawn_town_serpents_hold.dfn, dfndata/spawn/trammel/spawn_town_serpents_hold.dfn) Fixed region definition of Ocllo to actually cover the entire town (dfndata/regions/regions.dfn) Added numerous additional locations accessible with 'goplace # command, for key locations in Ilshenar, Malas, Tokuno Islands and Ter Mur (dfndata/location/location.dfn) Revised travel-menu portion of GM menu (shortcut: 'travel) to include more travel options based on new locations (dfndata/items/travelmenu.dfn and travelmenu.bulk.dfn) Fixed an issue where NPCs could attempt to attack targets in other worlds/instances Added new JS Event that triggers for characters who are about to deal damage in combat. Complimentary to onDamage, which triggers for chars receiving damage: onDamageDeal( dmgDealer, dmgReceiver, damageValue, damageType ) Added new JS Event that can trigger in global script upon creation of new player chars. Note that this will trigger in place of onCreateDFN event for player characters: onCreatePlayer( pChar ) Added new JS Event that triggers for characters selecting a target with a spell. Complimentary to onSpellTarget, which triggers for targets selected with a spell: onSpellTargetSelect( caster, target, spellNum ) Updated onCombatStart and onCombatEnd JS Events to also trigger for the other party in combat Updated onPickup JS Event to include a third parameter - the potential container item was picked up from. Event now also triggers event in scripts attached to said containers: onPickup( iPickedUp, pChar, iCont ) Added tracking of total playtime per individual character, and per account across all characters, and exposed these properties to JS engine: .totalPlayTime // Account property, total playtime across all chars .playTime // Character property, total playtime on given character only Added new player-accessible command ('playtime) to spit out the playtime of current character/account as a whole (js/commands/playtime.js) Implemented first version of Young Player System: Replaced the UNUSED9 account flag with YOUNG, to be used by Young/New Player System Added new JS Account property that gets/sets whether player account is considered Young: .isYoung Added new Char timers: TIMER_YOUNGHEAL // Restricts how often Young players are healed by NPC healers TIMER_YOUNGMESSAGE // Restricts how often Young players are warned about dangerous looking monsters in overworld Updated GM commands 'get and 'set to get/set .isYoung property of player's account (js/commands/targeting/get.js and set.js) Added new UOX.INI setting to enable/disable Young Player System (enabled by default): YOUNGPLAYERSYSTEM=1 If Young Player System is enabled, all newly created player accounts are automatically marked with Young flag Added new script to handle various restrictions and functions related to Young characters (js/player/young_player.js): Young characters will have [Young] displayed over their head Young characters will have their Young status checked and verified on every login + every stat/skill gain, to revoke the Young status if any of the following is true: Account has a total playtime of more than 40 hours Any character has more than 350 total (base) skill points Any character has more than 70 skill points in a single skill Any character has more than 150 total stat points Any character has more than 80 stat points in a single stat Young characters can renounce their Young status manually by saying the words "I renounce my young player status" Young characters get two additional items upon creation: a new player ticket (can be combined with any other players new player ticket for both players to get a reward) a sextant (shows Young players directions to nearest moongate/bank regardless of where they are, as long as outdoors) Young characters cannot target other player characters with hostile spells or skills Young characters cannot be the target of other player characters' hostile spells or skills Young characters can only cast beneficial spells upon themselves or other Young characters Young characters can only be the target of beneficial spells from other Young players Young players (and their pets/followers) cannot attack or harm any other players (or their pets/followers), nor themselves be attacked or harmed by any other players (or their pets/followers), whether from combat, spells, skills or items Young players don't lose any of their items on death, and are teleported to the nearest healer upon death with all their items intact Young players receive a warning upon entering dungeons that monsters there will be hostile Updated global script (js/server/global.js) to: Check/Verify Young status of players upon login Attach young player script on login/creation for players on Young accounts Give specific items to Young players upon creation Added new script (js/item/corpse.js) that is assigned to all freshly created corpses. This script handles restrictions related to Young players interactions with corpses, and the interactions of other players with corpses of Young players Updated JS Method .Carve() to return true/false depending on whether carving a corpse was successful Updated Healer AI in code to heal nearby injured Young players Updated Evil AI and Evil Caster AI in code to avoid selecting Young players as targets in combat outside of dungeons Added a new section to UOX.INI - [young player starting locations] - that can be used to define starting locations for Young players. If only one such location is provided, all players start there. Otherwise, it matches the same starting location setup as the regular one - with one entry per town in Britannia. Restricted transferring and/or friending of pets (code) and hirelings (hirelings.js) between Young and non-Young players Restricted Young players from recalling or gating to Felucca facet Young players can instantly logout from anywhere, at any time
2023-07-01 20:02:40 +08:00
toExecute->OnCreate( c, false, false );
Minor JS revamp - multiple scripts per object! Added TryParseJSVal() helper function in cScript.cpp, used to parse jsval values returned from script events. Provides results matching 0 (0, false), 1 (1, true) or any specific int value returned from script. JS events updated to use new TryParseJSVal helper function (no change in behaviour): onDecay, onResurrect, onCommand, onBuyFromVendor, onSellToVendor, onPickup, onCharDoubleClick, onSkillGump, onUseBandageMacro, onCombatStart, onCombatEnd, onDeathBlow, onBuy, onSell JS events with slight change of behaviour after update to use TryParseJSVal: onDrop, onDropItemOnItem, onDropItemOnNpc - previously, a blank or non-existent return value would be treated the same as a return true. This will now be treated as a return false. Update scripts accordingly! JS events updated to support return values from scripts: onCollide, onTalk, onSnooped, OnHungerChange Return false or nothing to prevent hard code from running Return true to allow hard code to run like normal onStolenFrom, onAISliver, onLightChange, onVirtueGumpPress, onQuestGump, onSpecialMove, onSwing, onClick, onHouseCommand, onSellToVendor, onSkillCheck, onSpellGain, onSpellLoss Return false to allow hard code and other scripts with event to run like normal Return true to prevent hard code and other scripts with event from running onSteal Return false or nothing to allow hard code and other scripts with event to run like normal Return true to prevent hard code and onStolenFrom event from running (theft failed?) Return 2 to prevent hard code, but allow onStolenFrom event to run (theft succeeded, but handled in script?) onLeaving, onEntrance, onEquip, onUnequip, onEnterEvadeState, onSoldToVendor, onBoughtFromVendor, onSpellSuccess, onSpellTarget, onFlagChange, onDeath Return false or nothing to allow other scripts with event to run like normal Return true to prevent other scripts with event from running Added new JS events that run prior to items being equipped/unequipped, with support for return values: onEquipAttempt( pEquipper, iEquipping ) onUnequipAttempt( pEquipper, iUnequipping ) Return false or nothing to reject attempt to equip/unequip item, and prevent hard-code or other scripts with event from running Return true to allow hard code to run like normal Added new JS event that runs prior to onSnooped event, for character doing the snooping: onSnoopAttempt( snooped, snooper ) Return false or nothing to prevent hard code and other snooping-related events from running Return true to allow hard code and other snooping-related events to run like normal Updated onSnooped JS event to accept return values: Return true when success state is true to prevent other scripts with event from running Return true when success state is false to prevent hard code and other scripts with event from running Updated onClick JS event to also run for characters with event attached (return 1 to prevent showing hard-coded name for whatever object is clicked) Updated onSteal JS event to include a third parameter, an object reference for the target of the theft Added support for assigning multiple JS scripts per object (item, multi, char, region). Any time a scriptID is added to an object, the list of such IDs for that object will be sorted from lowest to highest scriptID, which also determines the execution order for the scripts. Note that if the same JS event is present in several scripts assigned to an object, each of those events will trigger, unless the rules about return values for said event prevent this DFNs for Items, Multis, Characters and Regions can now contain multiple SCRIPT=scriptID tags per definition. Each such SCRIPT tag will be applied to the object in question, then sorted from lowest to highest scriptID by server. Added new JS property for Items, Multis, Characters and Regions: .scriptTriggers // If used to get property, will return array object with all script IDs assigned to object. If used to set property, will add script ID to existing list of script IDs for object. Modified JS property for Items, Multis, Characters and Regions, which for backwards compatibility functions similar to in older versions: .scripttrigger // If used to get property, will return last script ID in list of script IDs assigned to object. If used to set property, will clear list of script IDs and assign only the new ID Added new JS Methods for Items, Multis, Characters and Regions: .AddScriptTrigger( scriptID ) // Adds a new scriptID to list of scripts assigned to object .RemoveScriptTrigger( scriptID ) // Remove a specific scriptID from object (0 = remove all) Moved SETSCPTRIG command from code to JS (js/commands/targeting/scptrig.js), and supplemented it with some additional commands: GETSCPTRIG // List out all scriptIDs assigned to object SETSCPTRIG scriptID // Clears list of scriptIDs for object, then assigns the specified scriptID ADDSCPTRIG scriptID // Adds specified scriptID to list of scriptsIDs assigned to object REMOVESCPTRIG scriptID // Removes specified scriptID from list of scriptIDs assigned to object (0 = remove all)
2021-05-25 19:37:52 +08:00
}
}
return c;
}