Skip to content

Commit

Permalink
Merge pull request #10 from araxiaonline/feature_marketprice
Browse files Browse the repository at this point in the history
Feature marketprice
  • Loading branch information
james-huston authored Nov 26, 2023
2 parents c608769 + 6ab0466 commit b67b557
Show file tree
Hide file tree
Showing 19 changed files with 633 additions and 266 deletions.
100 changes: 73 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ This mod is meant to keep a healthy auction house stocked on a low-pop server. I
1. Download the code into your source code `modules/` folder
2. Do the Compilation Things as best you can.
3. Run the database script in `mod-auctionator/data/sql/db-world/base/2023-09-18.sql` against your `acore_world` database.
4. If you want a fresh start clear you auction house with these SQL commands. Do this ONLY when your server is stopped. The AH is cached in memory and if you do this while your server is running then likely ... things won't go well. Run this against your character database (default of `acore_characters`).
4. **NOTE** you may not need to do this, looks like server runs this automatically? Run the database script in `modules/mod-auctionator/data/sql/db-characters/updates/2023_11_12_00_marketprice.sql` against your `acore_characters` database.
5. If you want a fresh start clear you auction house with these SQL commands. Do this ONLY when your server is stopped. The AH is cached in memory and if you do this while your server is running then likely ... things won't go well. Run this against your character database (default of `acore_characters`).

```
DELETE FROM `item_instance` WHERE `guid` IN (SELECT `itemguid` FROM `auctionhouse`);
Expand All @@ -16,6 +17,30 @@ DELETE FROM `auctionhouse`;

## GM commands

### auctionator add <houseid> <itemid> <price>

ItemID can be looked up in the database table `item_template`.

Add an Iridescent Pearl to the Neutral AH for 1 gold buyout.

```
.auctionator add 7 5500 10000
```

### auctionator auctionspercycle <value>

Set the number of auctions per cycle that get added to each auction house.
This setting is shared by all houses. You should keep this number lower
than query limit or else ... I don't know, try it and see.

Also this has a direct impact on how hard each cycle hits your worldserver
and your mysql server so if you are running on smaller hardware you
might want to tune this and the query limit down to lower numbers.

```
.auctionator auctionspercycle 45
```

### auctionator bidonown <value>

Enable bidding on the auctions created by the auctionator. There is
Expand Down Expand Up @@ -53,21 +78,23 @@ Expire all auctions for the specified house on the next tick.
.auctionator expireall 7
```

### auctionator multiplier <qualitytext> <multiplier>
### auctionator multiplier <typetext> <qualitytext> <multiplier>

Typetext is either `seller` or `bidder` depending on which you want to set.

Set the sell and buy multiplier for a quality. Qualities are:

* poor
* normal
* uncommon
* rare
* epic
* legendary
* `poor`
* `normal`
* `uncommon`
* `rare`
* `epic`
* `legendary`

Multiplier is a decimal value. Defaults are set in the config file.

```
.auctionator multiplier epic 10
.auctionator multiplier bidder epic 10
```

### auctionator status
Expand All @@ -89,49 +116,68 @@ Output:
CharacterGuid: 2
Horde:
Seller Enabled: 1
Max Auctions: 15000
Auctions: 15023
Max Auctions: 20000
Auctions: 9319
Bidder Enabled: 1
Cycle Time: 2
Per Cycle: 5
Per Cycle: 20
Alliance:
Seller Enabled: 1
Max Auctions: 15000
Auctions: 15040
Max Auctions: 20000
Auctions: 8959
Bidder Enabled: 1
Cycle Time: 3
Per Cycle: 10
Cycle Time: 1
Per Cycle: 20
Neutral:
Seller Enabled: 1
Max Auctions: 15000
Auctions: 15064
Max Auctions: 20000
Auctions: 9379
Bidder Enabled: 1
Cycle Time: 1
Per Cycle: 5
Multipliers:
Cycle Time: 3
Per Cycle: 30
Seller Multipliers:
Poor: 1.000000
Normal: 2.000000
Normal: 1.000000
Uncommon: 1.500000
Rare: 2.000000
Epic: 6.000000
Legendary: 10.000000
Bidder Multipliers:
Poor: 1.000000
Normal: 1.000000
Uncommon: 1.500000
Rare: 2.000000
Epic: 6.000000
Legendary: 10.000000
Seller settings:
Auctions per run: 100
Query Limit: 1000
Default Price: 10000000
```

### auctionator add <houseid> <itemid> <price>
## Importing Marketplace Data (v0.6)

ItemID can be looked up in the database table `item_template`.
There is a helper script in `mod-auctionator/apps/marketprices` for creating the sql to import the market data from a csv. You need to start the server first to make sure that the `mod_auctionator_market_price` table has been created. Using a newer version of Node (18+ should do it) you can generate insert queries that you can pipe to mysql something like this:

Add an Iridescent Pearl to the Neutral AH for 1 gold buyout.
```
cd apps/marketprice
cp ~/mypricedata.csv .
# only need to do this the first time
npm install
node index.js mypricedata.csv | mysql -u <dbuser> -p <character_database_name>
```
.auctionator add 7 5500 10000

The script skips the first line and expects the following columns:

```
scan_datetime,item_entry,avg_price,minimum_buyout,minimum_bid,item_count
```

minimum_buyout, minimum_bid, and item_count are currently not used for anything and can be set to 0.

## Current limitations

1. Stacks are acting weird, especially things like enchanter rods.
1. ~~Stacks are acting weird, especially things like enchanter rods.~~ This is now fixed BUT many stacks with the multipler are maxed out now to 20 and way to expensive. Whoopsie.
2. No control on stack size, it is hard coded to 20 (you can edit and recompile).
3. No control over item ranges (you can change the query).
3 changes: 3 additions & 0 deletions apps/marketprice/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.sql
*.csv
node_modules
51 changes: 51 additions & 0 deletions apps/marketprice/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
const fs = require("fs");
const { parse } = require("csv-parse");

if (process.argv.length !== 3) {
console.error('You must specify a filename for importing');
process.exit(1);
}

let filename = process.argv[2];


let counter = 0;
fs.createReadStream(filename)
.pipe(parse({ delimiter: ",", from_line: 2 }))
.on("data", function(row) {
if (counter === 0) {
outputHeader();
}

if (counter !== 0) {
console.log(",");
}
console.log(
"(",
row[1], ",",
row[2], ",",
row[3], ",",
row[4], ",",
row[5], ",",
"'", row[0], "')"
);
counter++;
// if (counter !== 100) {
// console.log(",");
// }

if (counter === 100) {
console.log(";");
counter = 0;
}
})
.on("end", function() {
console.log(";");
});

function outputHeader() {

console.log("INSERT INTO mod_auctionator_market_price ");
console.log("(`entry`, `average_price`, `buyout`, `bid`, `count`, `scan_datetime`) VALUES");

}
50 changes: 50 additions & 0 deletions apps/marketprice/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions apps/marketprice/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "auctionator_marketprice",
"version": "1.0.0",
"description": "Market price utilities for mod-auctionator",
"main": "index.js",
"scripts": {
"test": "npm test"
},
"author": "James Huston",
"license": "MIT",
"dependencies": {
"csv": "^6.3.5"
}
}
36 changes: 28 additions & 8 deletions conf/mod_auctionator.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,17 @@ Auctionator.Seller.QueryLimit = 1000
# Default price for items that have a BuyPrice of 0.
# Default is 1000 gold.
########################################
Auctoinator.Seller.DefaultPrice = 10000000
Auctionator.Seller.DefaultPrice = 10000000

########################################
# Number of auctions added to the AH per run. This needs to
# be less than the Seller.QueryLimit or you will run out of
# items. In theory this also needs to be less thatn the number
# of available items not in the AH though I am not really sure
# what happens if it's not.
# Default is 100 per house per cycle.
########################################
Auctionator.Seller.AuctionsPerRun = 100

########################################
# Allows the bidder to bid on their own auctions.
Expand All @@ -74,14 +84,24 @@ Auctoinator.Seller.DefaultPrice = 10000000
Auctionator.Bidder.BidOnOwn = 0

########################################
# Multipliers for seller and bidder prices
# Multipliers for seller
########################################
Auctionator.Multipliers.Seller.Poor = 1.0
Auctionator.Multipliers.Seller.Normal = 1.0
Auctionator.Multipliers.Seller.Uncommon = 1.5
Auctionator.Multipliers.Seller.Rare = 2.0
Auctionator.Multipliers.Seller.Epic = 6.0
Auctionator.Multipliers.Seller.Legendary = 10.0

########################################
# Multipliers for bidder prices
########################################
Auctionator.Multipliers.Poor = 1.0
Auctionator.Multipliers.Normal = 1.0
Auctionator.Multipliers.Uncommon = 1.5
Auctionator.Multipliers.Rare = 2.0
Auctionator.Multipliers.Epic = 6.0
Auctionator.Multipliers.Legendary = 10.0
Auctionator.Multipliers.Bidder.Poor = 1.0
Auctionator.Multipliers.Bidder.Normal = 1.0
Auctionator.Multipliers.Bidder.Uncommon = 1.5
Auctionator.Multipliers.Bidder.Rare = 2.0
Auctionator.Multipliers.Bidder.Epic = 6.0
Auctionator.Multipliers.Bidder.Legendary = 10.0

###################################################################################################
# LOGGING SYSTEM SETTINGS
Expand Down
11 changes: 11 additions & 0 deletions data/sql/db-characters/updates/2023_11_12_00_marketprice.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- create the table we use to store market data
CREATE TABLE IF NOT EXISTS `mod_auctionator_market_price` (
`entry` INT,
`average_price` INT,
`buyout` INT,
`bid` INT,
`count` INT,
`scan_datetime` DATETIME,
PRIMARY KEY (`entry`),
Index(`entry`, `scan_datetime`)
);
Loading

0 comments on commit b67b557

Please sign in to comment.