-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(Misc): base rework module #57
base: master
Are you sure you want to change the base?
Conversation
config->SetMinPrice(ITEM_QUALITY_POOR, minpricegrey); | ||
config->SetMaxPrice(ITEM_QUALITY_POOR, maxpricegrey); | ||
config->SetMinPrice(ITEM_QUALITY_NORMAL, minpricewhite); | ||
config->SetMaxPrice(ITEM_QUALITY_NORMAL, maxpricewhite); | ||
config->SetMinPrice(ITEM_QUALITY_UNCOMMON, minpricegreen); | ||
config->SetMaxPrice(ITEM_QUALITY_UNCOMMON, maxpricegreen); | ||
config->SetMinPrice(ITEM_QUALITY_RARE, minpriceblue); | ||
config->SetMaxPrice(ITEM_QUALITY_RARE, maxpriceblue); | ||
config->SetMinPrice(ITEM_QUALITY_EPIC, minpricepurple); | ||
config->SetMaxPrice(ITEM_QUALITY_EPIC, maxpricepurple); | ||
config->SetMinPrice(ITEM_QUALITY_LEGENDARY, minpriceorange); | ||
config->SetMaxPrice(ITEM_QUALITY_LEGENDARY, maxpriceorange); | ||
config->SetMinPrice(ITEM_QUALITY_ARTIFACT, minpriceyellow); | ||
config->SetMaxPrice(ITEM_QUALITY_ARTIFACT, maxpriceyellow); | ||
|
||
// Load min and max bid prices | ||
config->SetMinBidPrice(ITEM_QUALITY_POOR, minbidpricegrey); | ||
config->SetMaxBidPrice(ITEM_QUALITY_POOR, maxbidpricegrey); | ||
config->SetMinBidPrice(ITEM_QUALITY_NORMAL, minbidpricewhite); | ||
config->SetMaxBidPrice(ITEM_QUALITY_NORMAL, maxbidpricewhite); | ||
config->SetMinBidPrice(ITEM_QUALITY_UNCOMMON, minbidpricegreen); | ||
config->SetMaxBidPrice(ITEM_QUALITY_UNCOMMON, maxbidpricegreen); | ||
config->SetMinBidPrice(ITEM_QUALITY_RARE, minbidpriceblue); | ||
config->SetMaxBidPrice(ITEM_QUALITY_RARE, maxbidpriceblue); | ||
config->SetMinBidPrice(ITEM_QUALITY_EPIC, minbidpricepurple); | ||
config->SetMaxBidPrice(ITEM_QUALITY_EPIC, maxbidpricepurple); | ||
config->SetMinBidPrice(ITEM_QUALITY_LEGENDARY, minbidpriceorange); | ||
config->SetMaxBidPrice(ITEM_QUALITY_LEGENDARY, maxbidpriceorange); | ||
config->SetMinBidPrice(ITEM_QUALITY_ARTIFACT, minbidpriceyellow); | ||
config->SetMaxBidPrice(ITEM_QUALITY_ARTIFACT, maxbidpriceyellow); | ||
|
||
// Load max stacks | ||
config->SetMaxStack(ITEM_QUALITY_POOR, maxstackgrey); | ||
config->SetMaxStack(ITEM_QUALITY_NORMAL, maxstackwhite); | ||
config->SetMaxStack(ITEM_QUALITY_UNCOMMON, maxstackgreen); | ||
config->SetMaxStack(ITEM_QUALITY_RARE, maxstackblue); | ||
config->SetMaxStack(ITEM_QUALITY_EPIC, maxstackpurple); | ||
config->SetMaxStack(ITEM_QUALITY_LEGENDARY, maxstackorange); | ||
config->SetMaxStack(ITEM_QUALITY_ARTIFACT, maxstackyellow); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bad indent
config->SetMinPrice(ITEM_QUALITY_POOR, minpricegrey); | |
config->SetMaxPrice(ITEM_QUALITY_POOR, maxpricegrey); | |
config->SetMinPrice(ITEM_QUALITY_NORMAL, minpricewhite); | |
config->SetMaxPrice(ITEM_QUALITY_NORMAL, maxpricewhite); | |
config->SetMinPrice(ITEM_QUALITY_UNCOMMON, minpricegreen); | |
config->SetMaxPrice(ITEM_QUALITY_UNCOMMON, maxpricegreen); | |
config->SetMinPrice(ITEM_QUALITY_RARE, minpriceblue); | |
config->SetMaxPrice(ITEM_QUALITY_RARE, maxpriceblue); | |
config->SetMinPrice(ITEM_QUALITY_EPIC, minpricepurple); | |
config->SetMaxPrice(ITEM_QUALITY_EPIC, maxpricepurple); | |
config->SetMinPrice(ITEM_QUALITY_LEGENDARY, minpriceorange); | |
config->SetMaxPrice(ITEM_QUALITY_LEGENDARY, maxpriceorange); | |
config->SetMinPrice(ITEM_QUALITY_ARTIFACT, minpriceyellow); | |
config->SetMaxPrice(ITEM_QUALITY_ARTIFACT, maxpriceyellow); | |
// Load min and max bid prices | |
config->SetMinBidPrice(ITEM_QUALITY_POOR, minbidpricegrey); | |
config->SetMaxBidPrice(ITEM_QUALITY_POOR, maxbidpricegrey); | |
config->SetMinBidPrice(ITEM_QUALITY_NORMAL, minbidpricewhite); | |
config->SetMaxBidPrice(ITEM_QUALITY_NORMAL, maxbidpricewhite); | |
config->SetMinBidPrice(ITEM_QUALITY_UNCOMMON, minbidpricegreen); | |
config->SetMaxBidPrice(ITEM_QUALITY_UNCOMMON, maxbidpricegreen); | |
config->SetMinBidPrice(ITEM_QUALITY_RARE, minbidpriceblue); | |
config->SetMaxBidPrice(ITEM_QUALITY_RARE, maxbidpriceblue); | |
config->SetMinBidPrice(ITEM_QUALITY_EPIC, minbidpricepurple); | |
config->SetMaxBidPrice(ITEM_QUALITY_EPIC, maxbidpricepurple); | |
config->SetMinBidPrice(ITEM_QUALITY_LEGENDARY, minbidpriceorange); | |
config->SetMaxBidPrice(ITEM_QUALITY_LEGENDARY, maxbidpriceorange); | |
config->SetMinBidPrice(ITEM_QUALITY_ARTIFACT, minbidpriceyellow); | |
config->SetMaxBidPrice(ITEM_QUALITY_ARTIFACT, maxbidpriceyellow); | |
// Load max stacks | |
config->SetMaxStack(ITEM_QUALITY_POOR, maxstackgrey); | |
config->SetMaxStack(ITEM_QUALITY_NORMAL, maxstackwhite); | |
config->SetMaxStack(ITEM_QUALITY_UNCOMMON, maxstackgreen); | |
config->SetMaxStack(ITEM_QUALITY_RARE, maxstackblue); | |
config->SetMaxStack(ITEM_QUALITY_EPIC, maxstackpurple); | |
config->SetMaxStack(ITEM_QUALITY_LEGENDARY, maxstackorange); | |
config->SetMaxStack(ITEM_QUALITY_ARTIFACT, maxstackyellow); | |
config->SetMinPrice(ITEM_QUALITY_POOR, minpricegrey); | |
config->SetMaxPrice(ITEM_QUALITY_POOR, maxpricegrey); | |
config->SetMinPrice(ITEM_QUALITY_NORMAL, minpricewhite); | |
config->SetMaxPrice(ITEM_QUALITY_NORMAL, maxpricewhite); | |
config->SetMinPrice(ITEM_QUALITY_UNCOMMON, minpricegreen); | |
config->SetMaxPrice(ITEM_QUALITY_UNCOMMON, maxpricegreen); | |
config->SetMinPrice(ITEM_QUALITY_RARE, minpriceblue); | |
config->SetMaxPrice(ITEM_QUALITY_RARE, maxpriceblue); | |
config->SetMinPrice(ITEM_QUALITY_EPIC, minpricepurple); | |
config->SetMaxPrice(ITEM_QUALITY_EPIC, maxpricepurple); | |
config->SetMinPrice(ITEM_QUALITY_LEGENDARY, minpriceorange); | |
config->SetMaxPrice(ITEM_QUALITY_LEGENDARY, maxpriceorange); | |
config->SetMinPrice(ITEM_QUALITY_ARTIFACT, minpriceyellow); | |
config->SetMaxPrice(ITEM_QUALITY_ARTIFACT, maxpriceyellow); | |
// Load min and max bid prices | |
config->SetMinBidPrice(ITEM_QUALITY_POOR, minbidpricegrey); | |
config->SetMaxBidPrice(ITEM_QUALITY_POOR, maxbidpricegrey); | |
config->SetMinBidPrice(ITEM_QUALITY_NORMAL, minbidpricewhite); | |
config->SetMaxBidPrice(ITEM_QUALITY_NORMAL, maxbidpricewhite); | |
config->SetMinBidPrice(ITEM_QUALITY_UNCOMMON, minbidpricegreen); | |
config->SetMaxBidPrice(ITEM_QUALITY_UNCOMMON, maxbidpricegreen); | |
config->SetMinBidPrice(ITEM_QUALITY_RARE, minbidpriceblue); | |
config->SetMaxBidPrice(ITEM_QUALITY_RARE, maxbidpriceblue); | |
config->SetMinBidPrice(ITEM_QUALITY_EPIC, minbidpricepurple); | |
config->SetMaxBidPrice(ITEM_QUALITY_EPIC, maxbidpricepurple); | |
config->SetMinBidPrice(ITEM_QUALITY_LEGENDARY, minbidpriceorange); | |
config->SetMaxBidPrice(ITEM_QUALITY_LEGENDARY, maxbidpriceorange); | |
config->SetMinBidPrice(ITEM_QUALITY_ARTIFACT, minbidpriceyellow); | |
config->SetMaxBidPrice(ITEM_QUALITY_ARTIFACT, maxbidpriceyellow); | |
// Load max stacks | |
config->SetMaxStack(ITEM_QUALITY_POOR, maxstackgrey); | |
config->SetMaxStack(ITEM_QUALITY_NORMAL, maxstackwhite); | |
config->SetMaxStack(ITEM_QUALITY_UNCOMMON, maxstackgreen); | |
config->SetMaxStack(ITEM_QUALITY_RARE, maxstackblue); | |
config->SetMaxStack(ITEM_QUALITY_EPIC, maxstackpurple); | |
config->SetMaxStack(ITEM_QUALITY_LEGENDARY, maxstackorange); | |
config->SetMaxStack(ITEM_QUALITY_ARTIFACT, maxstackyellow); |
AuctionEntry *Aentry = itr->second; | ||
Item *item = sAuctionMgr->GetAItem(Aentry->item_guid); | ||
if (item) | ||
Item* item = sAuctionMgr->GetAItem(auction->item_guid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Item* item = sAuctionMgr->GetAItem(auction->item_guid); | |
Item* item = sAuctionMgr->GetAItem(auction->item_guid); |
// Load buyer bid prices | ||
config->SetBuyerPrice(ITEM_QUALITY_POOR, buyerpricegrey); | ||
config->SetBuyerPrice(ITEM_QUALITY_NORMAL, buyerpricewhite); | ||
config->SetBuyerPrice(ITEM_QUALITY_UNCOMMON, buyerpricegreen); | ||
config->SetBuyerPrice(ITEM_QUALITY_RARE, buyerpriceblue); | ||
config->SetBuyerPrice(ITEM_QUALITY_EPIC, buyerpricepurple); | ||
config->SetBuyerPrice(ITEM_QUALITY_LEGENDARY, buyerpriceorange); | ||
config->SetBuyerPrice(ITEM_QUALITY_ARTIFACT, buyerpriceyellow); | ||
|
||
// Load bidding interval | ||
config->SetBiddingInterval(Minutes(buyerbiddinginterval)); | ||
|
||
// Load bids per interval | ||
config->SetBidsPerInterval(buyerbidsperinterval); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Load buyer bid prices | |
config->SetBuyerPrice(ITEM_QUALITY_POOR, buyerpricegrey); | |
config->SetBuyerPrice(ITEM_QUALITY_NORMAL, buyerpricewhite); | |
config->SetBuyerPrice(ITEM_QUALITY_UNCOMMON, buyerpricegreen); | |
config->SetBuyerPrice(ITEM_QUALITY_RARE, buyerpriceblue); | |
config->SetBuyerPrice(ITEM_QUALITY_EPIC, buyerpricepurple); | |
config->SetBuyerPrice(ITEM_QUALITY_LEGENDARY, buyerpriceorange); | |
config->SetBuyerPrice(ITEM_QUALITY_ARTIFACT, buyerpriceyellow); | |
// Load bidding interval | |
config->SetBiddingInterval(Minutes(buyerbiddinginterval)); | |
// Load bids per interval | |
config->SetBidsPerInterval(buyerbidsperinterval); | |
// Load buyer bid prices | |
config->SetBuyerPrice(ITEM_QUALITY_POOR, buyerpricegrey); | |
config->SetBuyerPrice(ITEM_QUALITY_NORMAL, buyerpricewhite); | |
config->SetBuyerPrice(ITEM_QUALITY_UNCOMMON, buyerpricegreen); | |
config->SetBuyerPrice(ITEM_QUALITY_RARE, buyerpriceblue); | |
config->SetBuyerPrice(ITEM_QUALITY_EPIC, buyerpricepurple); | |
config->SetBuyerPrice(ITEM_QUALITY_LEGENDARY, buyerpriceorange); | |
config->SetBuyerPrice(ITEM_QUALITY_ARTIFACT, buyerpriceyellow); | |
// Load bidding interval | |
config->SetBiddingInterval(Minutes(buyerbiddinginterval)); | |
// Load bids per interval | |
config->SetBidsPerInterval(buyerbidsperinterval); | |
src/AuctionHouseBotConfig.cpp
Outdated
} | ||
else if (totalPercent != 100) | ||
{ | ||
_itemsPercent[ITEM_QUALITY_POOR] = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should print a warning log message here?
Or re-normalize the values
80+80 = 160
value*(100/160)
so it becomes 50+50
What is holding this back? looks good to me |
I don't remember if I finished everything here or forgot something |
If I find time I'll deploy this on my server on the weekend. |
return _buyerBiddingInterval; | ||
} | ||
|
||
void CalculatePercents(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a bad name
This doesn't calculate "Percents", it calculates the maximum number of items per quality level.
I will probably rename to "CalculateMaxCounts" later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general naming is bad all over the place.
"SetMinPrice" doesn't set the min price. It sets the minimum price multiplier in percent with 0-100 value.
return; | ||
} | ||
|
||
QueryResult result = CharacterDatabase.Query("SELECT id FROM auctionhouse WHERE itemowner<>{} AND buyguid<>{}", AHBplayerGUID, AHBplayerGUID); | ||
auto sharedConfig = std::make_shared<AHBConfig>(*config); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every time we add new auctions, we copy the whole config.
The config should've been a shared_ptr to begin with..
I'll rework that later
Co-authored-by: Dedmen Miller <[email protected]>
* You should have received a copy of the GNU General Public License along | ||
* with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing include guard, including this file twice will break stuff
isVendorItem = true; | ||
} | ||
|
||
if (isVendorItem) | ||
continue; | ||
} | ||
|
||
if ((Vendor_TGs == 0) && (itr->second.Class == ITEM_CLASS_TRADE_GOODS)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BUG!
Class check went from == to !=
There are more of these here
isLootTG = true; | ||
} | ||
|
||
if (isLootTG) | ||
continue; | ||
} | ||
|
||
if ((Other_Items == 0) && !(itr->second.Class == ITEM_CLASS_TRADE_GOODS)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more bug.
Other_Items == 0 turned into OtherItems
Please merge my indent fixes. |
I'm now running this plus my PR on my server, no issues so far 🤞 |
* chore: switch to reusable module workflow (#58) * chore(Module/Structure): update structure (#72) * chore(Bot): add db env include * Split item indexing into separate files * Fixed copyright headers * Remove unused variable --------- Co-authored-by: Patrick Lewis <[email protected]> Co-authored-by: Walter Pagani <[email protected]> Co-authored-by: Winfidonarleyan <[email protected]>
Changes: