uox3/source/quantityfuncs.cpp

244 lines
8.4 KiB
C++
Raw Permalink Normal View History

2002-04-07 20:53:41 +00:00
#include "uox3.h"
Added: -JS Get/Set "vulnerable" handlers for character properties (Abaddon) -willHunger with Get/Set HungerStatus() wrappers to CChar class (can now selectively stop a character/creature from continuing to hunger) -JS Get/Set "willhunger" handlers for character properties Changed: Linux compile fixes (thanks Malketh) Hash.h warning fixed (thanks Philantrop) Fixes to getRootPack() and getPackOwner() Removed many #includes from the global scope, including them in the specific files that need them This should greatly reduce compile time and filesize, along with the need to recompile after altering most headers Removed the linux ifdefs around typedefd function declarations, this should work with gcc 3.2 Moved global loading functions into a new cFileIO() class to take them out of global scope Fixed an issue causing items to not be sent to the client (thanks Malketh) Moved some global structs into the CWorldMain class Fixed a bug causing a crash on character / item creation Moved all effects stuff into its own class to take it out of global scope Changed the variable CChar::region to CChar::regionNum to avoid conflicts with the cTownRegion region[] indexes Moved getbestskill(), isHuman(), and inDungeon() into the CChar class to remove them from global scope Took npcSimpleAttackTarget() out of global scope Rewrote restock() to make use of restockNPC() Changed the typedef'd iterator in hash.h to HASHITERATOR to kill a Linux warning Renamed cEffects::soundeffect() to PlaySound() and removed unneeded overloads Fixed a bug causing executebatch to be set with locationcount data Rewrote cEffects::bgsound() Documented sounds.cpp Misc minor cleanups / fixes Removed: sendItemsInRange() (CChar::Teleport() does the same thing) Many #includes that were not being used deathMenu() respawnnow() and moved all of its code into command_respawn() one instance of cEffects::scpSoundEffect() and renamed the other to PlaySound() 3/13/2003 Changed Fixed an issue allowing the server to not have a dictionary.ZRO (which would cause a crash when a dictionary entry was called with no language) Fixed an issue causing the server to puke when it attempted a restart Moved SpawnRandomItem() into cItem class Moved SpawnRandomMonster() into cCharHandle class Broke necro.dfn into fishing.dfn and digging.dfn Made better use of SpawnRandomItem() and SpawnRandomMonster() 3/12/2003 Added: CPOpenGump and CPSpeech packet class to remove some global vars (Note these are pretty basic classes and someone with a better understanding of how we handle sending/recieving packets could probably expand these to make better use of them) Changed: Moved many global vars into the CWorldMain() class Cleaned ResetVars() in uox3.cpp as ResetDefaults() in CWorldMain() now handles much of that Added a check to ensure text wasn't sent twice in talking(), should fix double-speech Cleaned up cmdtable.cpp removing a couple duplicate entries, etc Changed target() to only require 4 values (as the first two were always 0 and 1) Removed many unneeded typedefs and globals Went through cServerData() and noted unused server.ini entries Moved title1(), title2(), and title3() to cClick.cpp since that is their only usage, made use of MAX_TITLE to ensure we wouldn't overrun the buffers, and renamed them matching what title they were 3/11/2003 Changed: Fixed a potentially very serious bugs with how containers were being set upon loading the world Fixed possible re-adding of weight to containers and characters at load Fixed a bug causing equipped items that were not weapons to take damage in combat Minor cleanups / warning fixes / Linux compatability issues (punt) 3/7/2003 Overhauls/Additions/Major Changes Changed: Tweaks/Object Conversions/Misc Small Changes Changed: Changed CItem::Get/SetLayer() to a UI08 Fixed a bug in speech causing you to see your own text twice Fixed a nasty crash bug
2003-03-23 10:18:02 +00:00
#include "weight.h"
2002-04-07 20:53:41 +00:00
//o------------------------------------------------------------------------------------------------o
//| Function - GetSubTotalItemCount()
//o------------------------------------------------------------------------------------------------o
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
//| Purpose - Get the total amount of items in a container
//o------------------------------------------------------------------------------------------------o
2022-10-24 23:42:16 +08:00
auto GetSubTotalItemCount( CItem *objCont ) -> UI32
{
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
UI32 total = 0;
auto pCont = objCont->GetContainsList();
for( const auto &i : pCont->collection() )
{
if( ValidateObject( i ))
{
if( i->GetType() == IT_CONTAINER || i->GetType() == IT_LOCKEDCONTAINER )
{
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
total += 1; // Also count the container
total += GetSubTotalItemCount( i );
}
else
{
if( !( i->GetLayer() == IL_FACIALHAIR || i->GetLayer() == IL_HAIR ))
{
total += 1;
}
0.99.4z++ Updated 'decorate save command to not save items that are inside multis (the multis themselves are not saved anyway!) Fixed some issues that would crash decorate script when attempting to use event subcommands without event names Renamed 'fixcontweight command to 'fixcont and updated it to also fix maxItems property for containers that don't already have that set Updated container world file template for Felucca with containers with proper maxWeight and maxItems seet Updated admin welcome gump (js/server/misc/admin_welcome.js) to also include containers (previously missing) and disable facets that don't have any decorations yet. Anyone who already used the admin welcome gump to place default decorations for their shards can use 'decorate load containers to add the missing containers. Changed how house addons are marked as addons; they will no longer have their item type set to 201 (IT_HOUSEADDON), as this would override any existing item type functionality of the items being setup as addons (like the dresser, which is a container). Instead, house addons are now marked with a custom tag "addon", which is used by scripts like axe.js to identify them as house addons instead of relying on the item type. Uncommented the dresser house-addon from 'add menu, as it now works as intended Added house-addons to ArchitectShopping SHOPLIST so they can be bought from Architect shopkeepers for roughly the cost of the material it would have taken to craft them. This is a temporary solution until crafting these have been implemented. Updated default region spawn file to evict the beekeeper from Skara Brae bank to make room for some actual bankers! The beekeeper is now tending to the bees outside the bank instead. Fixed issue where NPC vendors would not restock more than 1 leather tunic and/or leather gloves, because of a missing restock tag in the DFN entries for those items Removed kindling from the shoplist of Armourer vendors Bananas are now edible Bowyer shopkeepers will now restock more than 1 shaft and/or feather Provisioner shopkeepers will now restock more than 1 candle, lantern, various masks, kindling, flour Jeweler shopkeepers will now buy some gems (star sapphire and tourmaline) they were previously not so interested in Bowyer shopkeepers now sell fletching tools Added fletcher's tools as newbie item for players starting with Bowcraft/Fletching skill NPC shopkeepers now spawn with full stocks of goods, instead of the bare minimum Fixed item weight tooltip for pileable items appearing in vendor shoplists Fixed an issue where selling items to NPC shopkeepers would sometimes not visually remove the items from player's backpack Fixed missing base_item inheritance and missing restock property for mount statues sold by animal trainers/stablekeepers, which prevented them from being presented for sale Hairs and Beards no longer count towards the total item count showing for corpses All leather containers are now dyable Animals that belong in the Arctic (polar bears, snow leopards, walrus) will no longer spawn in forests and jungles Hellhounds will no longer spawn in forest and jungles; they can now only be found in dungeons Silver Serpents have been removed from the "weakforestlist" NPCLIST, because they are anything but GM/Admin characters can now drag immovable items out of their own backpack even with "allmove" disabled A tip to enable "allmove" or modify item's movable property now shows for GMs attempting to pick up immovable items from the ground Hungry creatures with AI type 6 (AI_ANIMAL) will no longer suicide by indiscriminately attacking creatures with AI type 2 (AI_EVIL), but will instead only attack "peaceful" animals, or - if really hungry - other types of predatory animals (including humans...)
2021-11-02 07:11:09 +08: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
}
}
return total;
}
//o------------------------------------------------------------------------------------------------o
//| Function - GetTotalItemCount()
//o------------------------------------------------------------------------------------------------o
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
//| Purpose - Get the total amount of items in a container
//o------------------------------------------------------------------------------------------------o
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
UI32 GetTotalItemCount( CItem *objCont )
{
if( !ValidateObject( objCont ) || ( objCont->GetType() != IT_CONTAINER && objCont->GetType() != IT_LOCKEDCONTAINER ))
return 0;
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
return GetSubTotalItemCount( objCont );
}
//o------------------------------------------------------------------------------------------------o
//| Function - GetSubItemAmount()
//o------------------------------------------------------------------------------------------------o
//| Purpose - Get the total amount of an item in a pack
//o------------------------------------------------------------------------------------------------o
auto GetSubItemAmount( CItem* p, UI16 realId, UI16 realColour, UI32 realMoreVal, bool colorCheck, bool moreCheck, std::string sectionId ) -> UI32
{
2003-03-05 01:51:10 +00:00
UI32 total = 0;
auto pCont = p->GetContainsList();
for( const auto &i : pCont->collection() )
{
if( ValidateObject( i ))
{
if( i->GetId() != realId && ( i->GetType() == IT_CONTAINER || i->GetType() == IT_LOCKEDCONTAINER ))
{
total += GetSubItemAmount( i, realId, realColour, realMoreVal, colorCheck, moreCheck, sectionId );
}
else if( i->GetId() == realId
&& ( !colorCheck || ( colorCheck && i->GetColour() == realColour ))
&& ( !moreCheck || ( moreCheck && i->GetTempVar( CITV_MORE ) == realMoreVal ))
&& ( sectionId == "" || oldstrutil::lower( sectionId ) == oldstrutil::lower( i->GetSectionId() )))
{
if( i->GetUsesLeft() > 0 )
{
total += i->GetUsesLeft();
}
else
{
total += i->GetAmount();
}
}
}
2002-04-07 20:53:41 +00:00
}
return total;
}
//o------------------------------------------------------------------------------------------------o
//| Function - GetItemAmount()
//o------------------------------------------------------------------------------------------------o
//| Purpose - Get the total amount of an item on a character
//o------------------------------------------------------------------------------------------------o
UI32 GetItemAmount( CChar *s, UI16 realId, UI16 realColour, UI32 realMoreVal, bool colorCheck, bool moreCheck, std::string sectionId )
2002-04-07 20:53:41 +00:00
{
CItem *p = s->GetPackItem();
if( !ValidateObject( p ))
return 0;
return GetSubItemAmount( p, realId, realColour, realMoreVal, colorCheck, moreCheck, sectionId );
2002-04-07 20:53:41 +00:00
}
//o------------------------------------------------------------------------------------------------o
//| Function - DeleteSubItemAmount()
//o------------------------------------------------------------------------------------------------o
Instance-support and misc code cleanup Misc code and documentation cleanup: Updated and standardized function comment blocks throughout entire codebase Grouped getters and setters together in pairs and documented them as one Removed empty and/or non-useful information from comment blocks Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors Added new feature - Instances Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified. Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present) Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present) Updated TWEAK menu to include WorldNumber and instanceID Fixed BaseWeight option in TWEAK menu Updated CBase_Teleport - now takes an optional 5th parameter instanceID Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID Updated SE_FindMulti now takes an optional 5th parameter - instanceID Updated SE_GetItem now takes an optional 5th parameter - instanceID Updated SE_FindItem now takes an optional 6th parameter - instanceID Added new JS property for Items, Characters, Regions: .instanceID Added JS property for Regions: .members - returns comma-separated list of town member serials Updated JS scripts making use of the above-mentioned JS Methods/Functions Updated dictionaries with new tweak menu entry texts Exposed SpawnRegions to JS engine, and updated JS docs with details: SpawnRegion JS Functions IterateOverSpawnRegions() GetSpawnRegion( spawnRegNum ) GetSpawnRegionCount() SpawnRegion JS Properties name regionNum itemList npcList item npc maxItems maxNpcs itemCount npcCount onlyOutside prefZ x1 y1 x2 y2 world instanceID minTime maxTime call
2020-08-08 13:57:15 +08:00
//| Purpose - Remove a certain amount of an item of specified color in a pack
//o------------------------------------------------------------------------------------------------o
auto DeleteSubItemAmount( CItem *p, UI32 amount, UI16 realId, UI16 realColour, UI32 realMoreVal, bool colorCheck, bool moreCheck, std::string sectionId ) -> UI32
{
if( !ValidateObject( p ))
return 0;
UI32 amtDeleted = 0;
UI32 total = amount;
auto pCont = p->GetContainsList();
auto collection = pCont->collection(); // force a copy, we will be deleting
for( auto &i : collection )
{
if( !ValidateObject( i ))
continue;
if( i->GetId() != realId && ( i->GetType() == IT_CONTAINER || i->GetType() == IT_LOCKEDCONTAINER ))
{
// Is item an pack or container?
amtDeleted += DeleteSubItemAmount( i, total, realId, realColour, realMoreVal, colorCheck, moreCheck, sectionId );
}
else if( i->GetId() == realId
&& ( !colorCheck || ( colorCheck && i->GetColour() == realColour ))
&& ( !moreCheck || ( moreCheck && i->GetTempVar( CITV_MORE ) == realMoreVal ))
&& ( sectionId == "" || oldstrutil::lower( sectionId ) == oldstrutil::lower( i->GetSectionId() )))
{
UI16 usesLeft = i->GetUsesLeft();
if( usesLeft > 0 )
{
// If item has uses left, but not enough to cover the total resource cost...
if( usesLeft <= total )
{
// ...deplete remaining uses from total and delete item
amtDeleted += usesLeft;
i->Delete();
}
else
{
// Otherwise, reduce amount of uses left on item
i->SetUsesLeft( usesLeft - total );
2002-04-07 20:53:41 +00:00
}
}
else
{
// There are no uses on item, but there might be a stack of the item, or multiple items
if( i->GetAmount() <= total )
{
amtDeleted += i->GetAmount();
i->Delete();
}
else
{
i->IncAmount( -( static_cast<SI32>( total )));
amtDeleted += total;
}
2002-04-07 20:53:41 +00:00
}
}
if( amtDeleted >= amount )
{
break;
}
else
{
total = static_cast<UI32>( amount - amtDeleted );
}
2002-04-07 20:53:41 +00:00
}
return amtDeleted;
2002-04-07 20:53:41 +00:00
}
//o------------------------------------------------------------------------------------------------o
//| Function - DeleteItemAmount()
//o------------------------------------------------------------------------------------------------o
Instance-support and misc code cleanup Misc code and documentation cleanup: Updated and standardized function comment blocks throughout entire codebase Grouped getters and setters together in pairs and documented them as one Removed empty and/or non-useful information from comment blocks Removed unused function from cItem.cpp/h - IncID() - formerly used to change IDs for doors Added new feature - Instances Objects (characters, items, multis, spawnregions) can now make use of a 5th parameter to determine their location in the game world. In addition to the traditional X, Y, Z and WORLDNUMBER parameters, a new one has been added - INSTANCEID - that allows objects to exist at the same coordinates in the same world, but in different "dimensions". Code has been updated in multiple places to support this, and a default instanceID of 0 is assumed if nothing else is specified. Added support for new DFN tag in town regions, spawn regions and locations - INSTANCEID (defaults to 0 if not present) Added support for another start location parameter after worldNum in UOX.INI representing instanceID (defaults to 0 if not present) Updated TWEAK menu to include WorldNumber and instanceID Fixed BaseWeight option in TWEAK menu Updated CBase_Teleport - now takes an optional 5th parameter instanceID Updated SE_SpawnNPC now takes an optional 5th parameter - instanceID Updated SE_FindMulti now takes an optional 5th parameter - instanceID Updated SE_GetItem now takes an optional 5th parameter - instanceID Updated SE_FindItem now takes an optional 6th parameter - instanceID Added new JS property for Items, Characters, Regions: .instanceID Added JS property for Regions: .members - returns comma-separated list of town member serials Updated JS scripts making use of the above-mentioned JS Methods/Functions Updated dictionaries with new tweak menu entry texts Exposed SpawnRegions to JS engine, and updated JS docs with details: SpawnRegion JS Functions IterateOverSpawnRegions() GetSpawnRegion( spawnRegNum ) GetSpawnRegionCount() SpawnRegion JS Properties name regionNum itemList npcList item npc maxItems maxNpcs itemCount npcCount onlyOutside prefZ x1 y1 x2 y2 world instanceID minTime maxTime call
2020-08-08 13:57:15 +08:00
//| Purpose - Remove a certain amount of an item of specified color on a character
Numerous changes with focus on feature and stability parity across Windows, Linux and MacOS platforms Added new Makefile that handles compiling UOX3 and Spidermonkey on both Linux and MacOS (punt) Added VS solution (SpiderMonkey.sln) and VC++ project files for compiling SpiderMonkey on Windows (Xuri) Updated SpiderMonkey from v1.6.0 to v1.7.0 Added optimization flag -O2 for release build in CMakeLists.txt in project root (Xuri) Added StringUtility file with general common string manipulation functions (punt) Updated RandomNum function to use a "seedless" random number generator from C++11 instead of the old C rand() function. (punt) Overall code cleanup to remove/replace platform-dependent code (punt) Replaced potentially unsafe usage of C string stuff like sprintf, vsprintf, vsnprintf, strncat, strcpy and strlen throughout the code with calls to a format() function containing only a single, safe use of vsnprintf, ensuring there's a single place of failure if there's anything to fix and and making it easy to potentially replace this with std::format from C++20 when the time comes. (punt) Replaced usage of char in many places with std::string (punt) Started process of replacing UString usage with functions provided through StringUtility instead (punt) Replaced platform specific fileIO handling in Windows/Linux with cross-platform C++17 standard std::filesystem (punt) Replaced platform specific time handling by using cross-platform chrono library (punt) Removed UOX namespace to reduce complexity (punt) Elimitated template code approach to singletons for more modern c++ constructs, removing dependices in the process (punt) Removed ODBC support; it hasn't been touched since the initial implementation in 2008, and there is a lack of someone to maintain the code. (punt) Removed some platform specific files like uoxlinux.h, which is no longer required (punt) Removed legacy crash protection code, and removed support for cluox (punt) Removed legacy "support" for Borland compiler (punt) Removed legacy VC++ 6 Workspace/Project files, VS2005 Solution/Project files, as these are no longer supported (Xuri) Removed legacy BUILD folder with outdated compilation instructions (Xuri) Removed old Changelog file (merged into Changelog.txt) (Xuri) Fixed a pointer bug for items in multis on world load (punt) Fixed a dictionary related issue that caused segmentation faults on Linux/MacOS (punt) Fixed an issue with callbacks to JS scripts that caused segmentation faults on Linux/MacOS (punt) Paths in uox.ini should now load properly on all platforms regardless of whether those paths use slashes or backslashes, and whether or not they end in a slash/backslash. (punt) Moved to c++17 style of threading, and got rid of threadsafeobject.cpp/h (punt) Replaced parsing of UOX.INI tags with a system that's more easily maintainable (punt) Added some new commands to js/commands/custom/misc-cmd.js (Xuri) cont // Targeted item will be made a container, set to nondecay and movable 2 endfight // Targeted character (and character being fought) will stop fighting getmulti // Get multiObject for targeted item finditem // Find item at layer X movespeed // Set movement speed of target player (0x0 Normal, 0x1 Mounted, 0x2 Slow (walk only), 0x3 Hybrid ("jog"?), 0x4 Frozen) Added new HTML based documentation in docs folder, and removed many old legacy docs that are either incorporated into this document already or no longer relevant for the current UOX3 version (Xuri) Co-Authored-By: Charles Kerr <punt1959@users.noreply.github.com>
2020-09-07 18:09:55 +08:00
//|
//| Changes - 09/24/2002 - Resource calculations fixed.
//|
//| Changes - 09/25/2002 - Weight Fixes
//o------------------------------------------------------------------------------------------------o
UI32 DeleteItemAmount( CChar *s, UI32 amount, UI16 realId, UI16 realColour, UI32 realMoreVal, bool colorCheck, bool moreCheck, std::string sectionId )
2002-04-07 20:53:41 +00:00
{
if( !ValidateObject( s ))
return 0;
CItem *p = s->GetPackItem();
if( !ValidateObject( p ))
return 0;
return DeleteSubItemAmount( p, amount, realId, realColour, realMoreVal, colorCheck, moreCheck, sectionId );
2002-04-07 20:53:41 +00:00
}
//o------------------------------------------------------------------------------------------------o
//| Function - GetBankCount()
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 - October 23rd, 2000
//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 - Searches through the bank to count the amount of items with a specific ID and colour
//o------------------------------------------------------------------------------------------------o
UI32 GetBankCount( CChar *p, UI16 itemId, UI16 colour, UI32 moreVal )
2002-04-07 20:53:41 +00:00
{
if( !ValidateObject( p ))
2002-04-07 20:53:41 +00:00
return 0;
2003-03-05 01:51:10 +00:00
UI32 goldCount = 0;
for( auto &oItem : *p->GetOwnedItems() )
{
if( ValidateObject( oItem ))
2002-04-07 20:53:41 +00:00
{
if( oItem->GetType() == IT_CONTAINER && oItem->GetTempVar( CITV_MOREX ) == 1 )
{
goldCount += GetSubItemAmount( oItem, itemId, colour, moreVal, false );
}
2002-04-07 20:53:41 +00:00
}
}
return goldCount;
}
//o------------------------------------------------------------------------------------------------o
//| Function - DeleteBankItem()
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 - October 23rd, 2000
//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 - Searches through the bank to and deletes a certain amount of a certain item
//| Returns how many left over
//o------------------------------------------------------------------------------------------------o
UI32 DeleteBankItem( CChar *p, UI32 amt, UI16 itemId, UI16 colour, UI32 moreVal )
2002-04-07 20:53:41 +00:00
{
if( !ValidateObject( p ))
2002-04-07 20:53:41 +00:00
return amt;
for( auto &oItem : *p->GetOwnedItems() )
{
if( ValidateObject( oItem ))
2002-04-07 20:53:41 +00:00
{
if( oItem->GetType() == IT_CONTAINER && oItem->GetTempVar( CITV_MOREX ) == 1 )
2002-04-07 20:53:41 +00:00
{
amt -= DeleteSubItemAmount( oItem, amt, itemId, colour, moreVal );
2002-04-07 20:53:41 +00:00
if( amt == 0 )
return 0;
}
}
}
return amt;
}