original: http://www.runuo.com/community/threads/runuo-2-0-rc1-xanthos-auction-system.73486/
I had to change a few things to get this working.
Main change was the view item gump how uses Object Property List for item properties instead of listing them in html list.
I had to change a few things to get this working.
Main change was the view item gump how uses Object Property List for item properties instead of listing them in html list.
Installation
Installation is pretty straightforward: Unzip the the Auction and Utilities zip files into a Xanthos folder in your customs scripts folder and copy Ultima.dll into your RunUO folder. Open RunUO\Data\Assemblies.cfg and add the line:
Ultima.dll
Note on modified distro files:
If you plan to use the Savings account, remove the distribution files RunUO\Scripts\Mobiles\Townfolk\Banker.cs and RunUO\Scripts\Items\Misc\BankCheck.cs. Otherwise if you do not want the savings account feature or wish to use only unmodified disribution files, remove the Xanthos\Auction\Modified folder.
Once the system is installed and the server is running, use the [InitAuction command to create the auction control stone. This is a special item that can only be constructed using the command. This item is invisible, so it can be placed pretty much anywhere. Also it cannot be deleted by using the [Remove command (in such a case it will simply re-create itself). The stone holds all the information about the system, including all auctions, bids and items. It can only be deleted using the [AuctionAdmin command which will terminate unsuccesfully all auctions.
In order for players to access the system, spawn Auctioner mobiles in your world. They can access the system by using the 'Buy' context menu on the Auctioner or by saying the 'auction' keyword.
Important : This script requires access to a fully patched cliloc.enu file. To ensure this, install AoS on the server machine and patch it up. There is still a chance the script will not find the file because of wrong registry information. If you have trouble with the system (namely if nothing happens when you target an item that you wish to auction), specify the path to the cliloc.enu file manually.
Configuration
A number of parameters are available for configuration in the file AuctionConfig.xml. The settings in the AuctionConfig.xml will only take effect if the file is placed in your RunUO\Data directory.:
Commands
Creating an auction
In order to create an auction, a player must visit an Auctioner NPC. After selecting the object they wish to auction, the item will be removed from their backpack. The user will then have to specify the parameters of the auction:
Bidding on an auction
If a player can bid on an auction, they will see the option in the lower left area of the auction gump. They must have the required money for the bid in their bank, which will be withdrawn as soon as the bid is placed. When a higher bid is placed, the previous highest bidder will receive the money back in the form of a auction gold check (which will display a gump that will allow the player to quickly return to the auction).
Restrictions on bidding:
Item checks and gold checks
Items and gold are moved through the system using checks. A check, when double clicked, will show the player a gump which will specify the name of the auction (if the auction still exists in the system, a button will allow the player to view the auction page), and the reason of the check. A button will allow the player to claim the gold or item by placing it in their bank.
Ambiguous situations and auction messages
In two situations, when an auction ends, the system will not be able to take a decision about the outcome:
This situation can last at most at few days, as specified in the auction configuration.
Administering the system
The system takes little administration. The staff can only review bids, but cannot interfere in an auction itself (by either modifying its parameters or deleting it).
The Staff Cloak
Included with the system is a cloak that staff can put on to temporarily set their access level to "Player". This allows staff to use the auction system in the same way as a player would. With the Staff Cloak on, staff can auction items and bid on auctions without having to log in an alternate character.
Setting up the Savings Accounts
To add the savings accounts to existing user's bank boxes, issue the following gm command [InstallSavings. Optionally, a savings account gold box can placed somewhere in the world accessible to players, made non-movable and used by players to install a savings account into the player's bank box when double clicked by the player.
To have savings accounts added to new players bank boxes automatically, open CharacterCreation.cs and find:
Code:
if ( young && newChar.BankBox != null )
{
NewPlayerTicket ticket = new NewPlayerTicket();
ticket.Owner = newChar;
newChar.BankBox.DropItem( ticket );
}
Add the following on a new line after that block:
Code:
if ( newChar.BankBox != null )
newChar.BankBox.DropItem( new Arya.Savings.SavingsAccount());
Another command is supplied to allow staff to change the balance of accounts en masse: [ScaleSavings [-g|-t] <percent>. Where -g targets gold balances, -t targets savings and both are scaled if neither is specified. Percent is a decimal value (e.g. 10 for 10%).
Requirements
Requires the Xanthos Utilities package.
Acknowledgements
The bulk of the system is based on the original Auction System by Arya. All credit for the wonderful and creative work on the original Auction System goes to Arya. My goal in maintenance of the system is to move the functionality forward to provide an integrated solution for commerce on RunUO shards. Credit must also be given to Phoo, who provided the inspiration for the first of such enhancements. A re-written Savings Account system has been implemented here with permission from Phoo.
Caveats
You may use or modify this system in any way you desire, however I ask that you leave the original headers in the source files if you re-write or redistribute the sources in any way.
- Xanthos
Changes
Version 2.1
Version 2.0
Version 1.15
Version 1.14
Version 1.13
Version 1.12
Version 1.11
Version 1.10
Version 1.9
Version 1.8
Version 1.7
Version 1.6
Installation is pretty straightforward: Unzip the the Auction and Utilities zip files into a Xanthos folder in your customs scripts folder and copy Ultima.dll into your RunUO folder. Open RunUO\Data\Assemblies.cfg and add the line:
Ultima.dll
Note on modified distro files:
If you plan to use the Savings account, remove the distribution files RunUO\Scripts\Mobiles\Townfolk\Banker.cs and RunUO\Scripts\Items\Misc\BankCheck.cs. Otherwise if you do not want the savings account feature or wish to use only unmodified disribution files, remove the Xanthos\Auction\Modified folder.
Once the system is installed and the server is running, use the [InitAuction command to create the auction control stone. This is a special item that can only be constructed using the command. This item is invisible, so it can be placed pretty much anywhere. Also it cannot be deleted by using the [Remove command (in such a case it will simply re-create itself). The stone holds all the information about the system, including all auctions, bids and items. It can only be deleted using the [AuctionAdmin command which will terminate unsuccesfully all auctions.
In order for players to access the system, spawn Auctioner mobiles in your world. They can access the system by using the 'Buy' context menu on the Auctioner or by saying the 'auction' keyword.
Important : This script requires access to a fully patched cliloc.enu file. To ensure this, install AoS on the server machine and patch it up. There is still a chance the script will not find the file because of wrong registry information. If you have trouble with the system (namely if nothing happens when you target an item that you wish to auction), specify the path to the cliloc.enu file manually.
Configuration
A number of parameters are available for configuration in the file AuctionConfig.xml. The settings in the AuctionConfig.xml will only take effect if the file is placed in your RunUO\Data directory.:
- MessageHue: defines the hue number used by all the messages in the system
- m_ForbiddenTypes: defines a list of item types that cannot be sold through the auction system
- DaysForConfirmation: in some cases after the auction has ended, either the buyer or seller must confirm their will to proceed with the auction. They will be notified through the messaging system and required to take a decision. If no decision is taken within a number of days, the auction ends unsuccesfully (item returned to seller, highest bid returned to bidder). This parameter specifies the number of days the system will wait before finalizing the auction.
- MaxReserveMultiplier: this is a limiting factor on the value of the reserve which cannot be higher than the starting bid multiplied by this parameter. This should avoid player exploiting the reserve feature by adding very high reserves to all auctions and always have the chance to decide whether to sell in the end or not.
- BlackHue : gumps have a weird behaviour when it comes to hues. Simply put they are not capable to display hue #1 aka pure black, therefore for items hued 1 a replacemente hue must be used. By default this is a black hue (#2000) in the OSI hues file. You might need to verify this value if your shard uses a custom hues.mul.
- AllowPetsAuction : true by default, enables auctioning of pets.
- AuctionAdminAccessLevel : the minimum AccessLevel required to access administration functions (Using the [AuctionAdmin command and the staff panel for each auction).
- ClilocLocation : specify the full path for the cliloc.enu file if having trouble with it.
- EnableLogging : true by default, will record all auction activity in \RunUO\Logs\Auction.
- LateBidExtension: when a bid is placed within 5 minutes from the auction end, and a positive time span is assigned to this option, the duration of the auction will be extended by the amount specified. By default this is zero ( TimeSpan.FromMinutes( 0.0 ) ).
- CostOfAuction: specifies how much the auction of an item costs (see the code for details on how to configure this parameter).
- MaxAuctionaPerAccount: specifies the maximum number of simultaneous auctions a single account can own.
- MinAuctionDays: specifies the minimum number of days an auction must last.
- MaxAuctionDays: specifies the maximum number of days an auction can last.
Commands
- [Admin] InitAuction : this command is used to create the auction control stone (see: Installation). If a control stone already exists in the world, this command will teleport the user to the stone location.
- [Admin] AuctionAdmin : this displays a panel giving control over the whole system (delete, perform auction verification, profiling...)
- [GameMaster] Auction: brings up the main auction gump. Players have to access this through the Auctioner NPC.
- [Player] MyAuction: brings up a limited auction gump. Players can only access auctions they're already participating in. They can't use this gump to create new auctions or to place bids on items they haven't bid on before.
Creating an auction
In order to create an auction, a player must visit an Auctioner NPC. After selecting the object they wish to auction, the item will be removed from their backpack. The user will then have to specify the parameters of the auction:
- Starting bid: the minimum bid accepted for this auction
- Duration: the running time for the auction in days
- Reserve: a safety value considered when the auction ends. If the highest bid is higher than the reserve the item is automatically sold, otherwise the owner will be given the option to withdraw the auction and have the item returned. The reserve value is not known to the bidder, but only information whether it has been met or not.
- Name: the system will try to guess an appropriate name for the auction. The user can of course change it to whatever they wish to.
- Description: any additional information should be given here. The system will extract the properties of each item and automatically display them, so there is no need to write them in this field.
- Web link: a web link can be provided optionally
Bidding on an auction
If a player can bid on an auction, they will see the option in the lower left area of the auction gump. They must have the required money for the bid in their bank, which will be withdrawn as soon as the bid is placed. When a higher bid is placed, the previous highest bidder will receive the money back in the form of a auction gold check (which will display a gump that will allow the player to quickly return to the auction).
Restrictions on bidding:
- Characters belonging to the same account as the auction owner cannot place bids on the auction.
- Staff cannot place bids unless they are wearing the Staff Cloak. Staff can create auctions with or without the Staff Cloak.
Item checks and gold checks
Items and gold are moved through the system using checks. A check, when double clicked, will show the player a gump which will specify the name of the auction (if the auction still exists in the system, a button will allow the player to view the auction page), and the reason of the check. A button will allow the player to claim the gold or item by placing it in their bank.
Ambiguous situations and auction messages
In two situations, when an auction ends, the system will not be able to take a decision about the outcome:
- to sell or not.
- One or more items in the auction no longer exist. This can occur in case of item wipes or serialization errors. In this case the buyer will be able to decide whether to purchase or not.
This situation can last at most at few days, as specified in the auction configuration.
Administering the system
The system takes little administration. The staff can only review bids, but cannot interfere in an auction itself (by either modifying its parameters or deleting it).
The Staff Cloak
Included with the system is a cloak that staff can put on to temporarily set their access level to "Player". This allows staff to use the auction system in the same way as a player would. With the Staff Cloak on, staff can auction items and bid on auctions without having to log in an alternate character.
Setting up the Savings Accounts
To add the savings accounts to existing user's bank boxes, issue the following gm command [InstallSavings. Optionally, a savings account gold box can placed somewhere in the world accessible to players, made non-movable and used by players to install a savings account into the player's bank box when double clicked by the player.
To have savings accounts added to new players bank boxes automatically, open CharacterCreation.cs and find:
Code:
if ( young && newChar.BankBox != null )
{
NewPlayerTicket ticket = new NewPlayerTicket();
ticket.Owner = newChar;
newChar.BankBox.DropItem( ticket );
}
Add the following on a new line after that block:
Code:
if ( newChar.BankBox != null )
newChar.BankBox.DropItem( new Arya.Savings.SavingsAccount());
Another command is supplied to allow staff to change the balance of accounts en masse: [ScaleSavings [-g|-t] <percent>. Where -g targets gold balances, -t targets savings and both are scaled if neither is specified. Percent is a decimal value (e.g. 10 for 10%).
Requirements
Requires the Xanthos Utilities package.
Acknowledgements
The bulk of the system is based on the original Auction System by Arya. All credit for the wonderful and creative work on the original Auction System goes to Arya. My goal in maintenance of the system is to move the functionality forward to provide an integrated solution for commerce on RunUO shards. Credit must also be given to Phoo, who provided the inspiration for the first of such enhancements. A re-written Savings Account system has been implemented here with permission from Phoo.
Caveats
You may use or modify this system in any way you desire, however I ask that you leave the original headers in the source files if you re-write or redistribute the sources in any way.
- Xanthos
Changes
Version 2.1
- Fixed a null reference occurring when setting the parent item of an item being redeemded from auction. Items added to the control stone, for safe keeping during auction, are now removed using RemoveItem rather than being removed from the control stones Items directly. The latter worked under RunUO 1.0 but does not under 2.0.
Version 2.0
- Made the system compatible with RunUO 2.0
- Fixed an exploit - players can no longer use a PowerScroll while also placing it on auction
- Savings Accounts no longer announce interest events if the system is not being used
- Removed the interest timer - interest events are now keyed off of WorldSave
- Removed unnecessary code in the system gumps.
Version 1.15
- Moved enable/disable of Daat99 Tokens out of the SavingsAccount source into the xml config file.
- Changed the SavingsAccount initial value, in the config file, of the interest paid to 4% rather than 40%.
- Fixed the SavingsAccount name and properties displayed on mouse over.
- Added a command: ScaleSavings, that scales the balance of all savings accounts by a percentage. Options -g and -t let staff scale only gold or tokens. The amount to be scaled is spedcified as an integer value.
Version 1.14
- Aligned the code with changes in the IShrinkItem interface.
- Now using the fully qualified name of Xanthos.Utilities.Misc.IsArtifact() to avoid an error one person was seeing
Version 1.13
- Auction View Gump Cleanup
- Fixed a graphics glitch that cuased some ugly broken borders
- Streamlined the UI to look cleaner and better handle containers
- Implemented a simple hue item to allow viewing of the item's hue if it has one.
Version 1.12
- Fixed a null reference introduced in fixing the gold and item leak to the null map. The code has been simplified and the evil allocate-on-read property has been removed
- Added a command, InstallSavings, that places a savings account in each player's bank, if there is not one there already
- Fixed a crasher on dclicking a savings account outside of a bank box
- SavingsAccounts outside of a bank box, when dclicked, place a SavingsAccount in the users bank box.
Version 1.11
- Banker now places commas in gold amounts when he/she speaks
- Moved StaffCloak into the Arya namespace
- Savings account now displays balance on mouse over
- Fixed a compile error for those who do not use Daat99 Tokens
- Reworded a couple of gump strings
- Fixed a gold leak to the internal map occuring when a gold auction check was d-clicked and subsequently not redeemed
- Auction gumps now display commas in gold amounts
- ConfigParser no longer halts shard start-up when a bad value is found in the xml file. Instead it displays the error on the console, leaving the default value untouched
- Added a ConfigParser option to halt the shard on bad values in the xml config file.
Version 1.10
- Re-fixed the dead pet exploit in a way that does not demand one have Xanthos shrink system. Any shrink system that implements the IShrinkItem interface will do. Xanthos shrink system implements the IShrinkItem interface.
Version 1.9
- Fixed an exploit: will no longer accept invalid shrunken pets in auctions (provided Xanthos shrink system is used)
- Pets bonded to the seller are unbonded when retrieved from the system by the auction winner
- Added Staff Cloak to allow staff to quickly change to player access level to bid on auctions. Original author unknown
- A Savings Account gold box is provided to be placed in users' bank boxes. Gold and Daat99Tokens can be recorded in the account - reducing item count
- Bid funds will be taken from a player's Savings Account if there are insufficient funds in the player's bank box
- Two modified standard distribution files are provided: Banker.cs and BankCheck.cs. With these modified files, commas can be used in creating checks and making withdrawls, and checks will display commas
- A number of parameters are available for configuration in the file AuctionConfig.xml (place this file in your RunUO\Data directory). This allows configuration parameters to be modified without code changes.
Version 1.8
- Fixed a crash occurring when the system delivered a check to a player whose backpack has been deleted
- Fixed a crash with the control stone properties list when the system wasn't running
- 1.0 Compatibility fix (no more EmptyArrayList warning on the console when creating auctions/moving items into the system)
- Added option to extend the duration of the auction if a bid is placed within 5 minutes from the end. (default: no late bid extension)
- Added an option to charge for the auction service (either a fixed value, or a percentage cost. default: no charge)
- For those running localized versions: 3 new entries in the string table (228-230).
Version 1.7
- Fixed max number of auctions parameter to behave correctly
- When a player retrieves an item that's a container, the item count and weight should be correctly updated
- Fixed potential gump-related crash
- Threaded operations lock the World.Items and World.Mobiles objects. This should address some cases where the system would cause a crash on world save
- All gumps now register available buttons. This should fix the malicious crash that could be caused using a razor macro on the system gumps
- Pets should no longer go wild when stored in the system (hopefully)
- Fixed crash associated with text search (hopefully).
- Added option the specify the location of the cliloc.enu file
- Buy Now function implemented
- Gold checks will now use the Banker.Desposit() method to deliver money (allowing any amount of money to be safely transferred
- Fixed an issue with the auction props and the highest bid. Now this will display two new fields (HighestBidder and HighestBidValue)
- Fixed overflow when setting a duration that's too long
- Added a staff control panel for each auction. Access to this panel is configured through the AuctionAdminAccessLevel parameter
- Added logging (enabled by default, disable in AuctionSystem.cs Configuration region). Will log all activity to RunUO\Logs\Auction
- When the cliloc.enu can't be found, the system will output a message on the console.
Version 1.6
- The system will now also trade creatures. The following restrictions apply on pet auctions: 1. You must own the pet. 2. No summoned, dead or animated pets allowed. 3. When claiming the pet, it will go to your stable and you will need a free stable slot
- When the pet or item is deleted from the world due to a wipe, the auction is ended by default and the money returned to the highest bidder. - Removed the DeleteAuction command (see AuctionAdmin)
- Added an administration gump accessible through the [AuctionAdmin command: The admin gump displays the number of running and pending auctions, and the next deadling (that is whenever the next automtic check will occur and verify all expried auctions). Functions: 1. Profiling: will print a file to \RunUO\AuctionProfile.txt with all the relevant information about the system. 2. Force Verify: will perform a verification and end all expired auctions. 3. Temporarily Shut Down: this will disable the auction system until the next reboot 4. Permanently Shut Down: deletes the system (formerly DeleteAuction command)
- Mode admin functions. Staff can now delete on the fly a particular auction from its view gump (Delete button). Staff can also view various auction properties through the Props button in the view gump.