Skip to content

Commit

Permalink
Merge pull request #22 from jaylittle/bugfix/add-missing-include
Browse files Browse the repository at this point in the history
Added newly required QueryResult include and updated for new AuctionHouseId enum
  • Loading branch information
james-huston authored Jan 12, 2025
2 parents 5d4c991 + 4db9394 commit b3303ab
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 43 deletions.
48 changes: 24 additions & 24 deletions src/Auctionator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void Auctionator::CreateAuction(AuctionatorItem newItem)
logTrace("creating auction entry");
AuctionEntry* auctionEntry = new AuctionEntry();
auctionEntry->Id = sObjectMgr->GenerateAuctionID();
auctionEntry->houseId = houseId;
auctionEntry->houseId = (AuctionHouseId)houseId;
auctionEntry->item_guid = item->GetGUID();
auctionEntry->item_template = item->GetEntry();
auctionEntry->owner = player.GetGUID();
Expand Down Expand Up @@ -130,10 +130,10 @@ void Auctionator::CreateAuction(AuctionatorItem newItem)
AuctionHouseEntry const *Auctionator::GetAuctionHouseEntry(uint32 houseId)
{
switch(houseId) {
case(AUCTIONHOUSE_ALLIANCE):
case((uint32)AuctionHouseId::Alliance):
return AllianceAhEntry;
break;
case(AUCTIONHOUSE_HORDE):
case((uint32)AuctionHouseId::Horde):
return HordeAhEntry;
break;
default:
Expand All @@ -149,10 +149,10 @@ AuctionHouseEntry const *Auctionator::GetAuctionHouseEntry(uint32 houseId)
*/
AuctionHouseObject *Auctionator::GetAuctionHouse(uint32 houseId) {
switch(houseId) {
case(AUCTIONHOUSE_ALLIANCE):
case((uint32)AuctionHouseId::Alliance):
return AllianceAh;
break;
case(AUCTIONHOUSE_HORDE):
case((uint32)AuctionHouseId::Horde):
return HordeAh;
break;
default:
Expand All @@ -164,14 +164,14 @@ void Auctionator::Initialize()
{
std::string accountName = "Auctionator";

HordeAh = sAuctionMgr->GetAuctionsMapByHouseId(AUCTIONHOUSE_HORDE);
HordeAhEntry = sAuctionHouseStore.LookupEntry(AUCTIONHOUSE_HORDE);
HordeAh = sAuctionMgr->GetAuctionsMapByHouseId(AuctionHouseId::Horde);
HordeAhEntry = sAuctionHouseStore.LookupEntry((uint32)AuctionHouseId::Horde);

AllianceAh = sAuctionMgr->GetAuctionsMapByHouseId(AUCTIONHOUSE_ALLIANCE);
AllianceAhEntry = sAuctionHouseStore.LookupEntry(AUCTIONHOUSE_ALLIANCE);
AllianceAh = sAuctionMgr->GetAuctionsMapByHouseId(AuctionHouseId::Alliance);
AllianceAhEntry = sAuctionHouseStore.LookupEntry((uint32)AuctionHouseId::Alliance);

NeutralAh = sAuctionMgr->GetAuctionsMapByHouseId(AUCTIONHOUSE_NEUTRAL);
NeutralAhEntry = sAuctionHouseStore.LookupEntry(AUCTIONHOUSE_NEUTRAL);
NeutralAh = sAuctionMgr->GetAuctionsMapByHouseId(AuctionHouseId::Neutral);
NeutralAhEntry = sAuctionHouseStore.LookupEntry((uint32)AuctionHouseId::Neutral);

WorldSession _session(
config->characterId,
Expand Down Expand Up @@ -283,7 +283,7 @@ void Auctionator::Update()
/*
if (config->allianceSeller.enabled) {
AuctionatorSeller sellerAlliance =
AuctionatorSeller(gAuctionator, static_cast<uint32>(AUCTIONHOUSE_ALLIANCE));
AuctionatorSeller(gAuctionator, static_cast<uint32>(AuctionHouseId::Alliance));
uint32 auctionCountAlliance = AllianceAh->Getcount();
Expand All @@ -294,7 +294,7 @@ void Auctionator::Update()
+ " of " + std::to_string(config->allianceSeller.maxAuctions)
);
sellerAlliance.LetsGetToIt(100, AUCTIONHOUSE_ALLIANCE);
sellerAlliance.LetsGetToIt(100, AuctionHouseId::Alliance);
} else {
logInfo("Alliance count over max: " + std::to_string(auctionCountAlliance));
}
Expand All @@ -304,7 +304,7 @@ void Auctionator::Update()
if (config->hordeSeller.enabled) {
AuctionatorSeller sellerHorde =
AuctionatorSeller(gAuctionator, static_cast<uint32>(AUCTIONHOUSE_HORDE));
AuctionatorSeller(gAuctionator, static_cast<uint32>(AuctionHouseId::Horde));
uint32 auctionCountHorde = HordeAh->Getcount();
Expand All @@ -315,7 +315,7 @@ void Auctionator::Update()
+ " of " + std::to_string(config->hordeSeller.maxAuctions)
);
sellerHorde.LetsGetToIt(100, AUCTIONHOUSE_HORDE);
sellerHorde.LetsGetToIt(100, AuctionHouseId::Horde);
} else {
logInfo("Horde count over max: " + std::to_string(auctionCountHorde));
}
Expand All @@ -325,7 +325,7 @@ void Auctionator::Update()
if (config->neutralSeller.enabled) {
AuctionatorSeller sellerNeutral =
AuctionatorSeller(gAuctionator, static_cast<uint32>(AUCTIONHOUSE_NEUTRAL));
AuctionatorSeller(gAuctionator, static_cast<uint32>(AuctionHouseId::Neutral));
uint32 auctionCountNeutral = NeutralAh->Getcount();
Expand All @@ -336,7 +336,7 @@ void Auctionator::Update()
+ " of " + std::to_string(config->neutralSeller.maxAuctions)
);
sellerNeutral.LetsGetToIt(100, AUCTIONHOUSE_NEUTRAL);
sellerNeutral.LetsGetToIt(100, AuctionHouseId::Neutral);
} else {
logInfo("Neutral count over max: " + std::to_string(auctionCountNeutral));
}
Expand All @@ -354,10 +354,10 @@ void Auctionator::Update()
AuctionHouseObject* Auctionator::GetAuctionMgr(uint32 auctionHouseId)
{
switch(auctionHouseId) {
case AUCTIONHOUSE_ALLIANCE:
case (uint32)AuctionHouseId::Alliance:
return AllianceAh;
break;
case AUCTIONHOUSE_HORDE:
case (uint32)AuctionHouseId::Horde:
return HordeAh;
break;
default:
Expand All @@ -368,9 +368,9 @@ AuctionHouseObject* Auctionator::GetAuctionMgr(uint32 auctionHouseId)

void Auctionator::ExpireAllAuctions(uint32 houseId)
{
if (houseId != AUCTIONHOUSE_ALLIANCE &&
houseId != AUCTIONHOUSE_HORDE &&
houseId != AUCTIONHOUSE_NEUTRAL
if (houseId != (uint32)AuctionHouseId::Alliance &&
houseId != (uint32)AuctionHouseId::Horde &&
houseId != (uint32)AuctionHouseId::Neutral
) {
logDebug("Invalid houseId: " + std::to_string(houseId));
return;
Expand All @@ -384,7 +384,7 @@ void Auctionator::ExpireAllAuctions(uint32 houseId)
// it won't happen till after the next tick of Auctionator passes
// because our update happens before the server gets a chance to update.
//
AuctionHouseObject* ah = sAuctionMgr->GetAuctionsMapByHouseId(houseId);
AuctionHouseObject* ah = sAuctionMgr->GetAuctionsMapByHouseId((AuctionHouseId)houseId);
for (
AuctionHouseObject::AuctionEntryMap::iterator itr,
iter = ah->GetAuctionsBegin();
Expand All @@ -394,7 +394,7 @@ void Auctionator::ExpireAllAuctions(uint32 houseId)
itr = iter++;
AuctionEntry* auction = (*itr).second;
logTrace("Expiring auction " + std::to_string(auction->Id) +
" for house " + std::to_string(auction->houseId));
" for house " + std::to_string((uint32)auction->houseId));
auction->expire_time = 0;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Auctionator.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct AuctionatorItem

AuctionatorItem() :
itemId(0),
houseId(AUCTIONHOUSE_NEUTRAL),
houseId((uint32)AuctionHouseId::Neutral),
bid(0),
buyout(0),
time(172800),
Expand Down
9 changes: 5 additions & 4 deletions src/AuctionatorBidder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
#include "Auctionator.h"
#include "ObjectMgr.h"
#include <random>
#include "QueryResult.h"


AuctionatorBidder::AuctionatorBidder(uint32 auctionHouseIdParam, ObjectGuid buyer, AuctionatorConfig* auctionatorConfig)
{
SetLogPrefix("[AuctionatorBidder] ");
auctionHouseId = auctionHouseIdParam;
buyerGuid = buyer;
ahMgr = sAuctionMgr->GetAuctionsMapByHouseId(auctionHouseId);
ahMgr = sAuctionMgr->GetAuctionsMapByHouseId((AuctionHouseId)auctionHouseId);
config = auctionatorConfig;
bidOnOwn = config->bidOnOwn;
}
Expand Down Expand Up @@ -237,13 +238,13 @@ bool AuctionatorBidder::BuyoutAuction(AuctionEntry* auction, ItemTemplate const*
uint32 AuctionatorBidder::GetAuctionsPerCycle()
{
switch(auctionHouseId) {
case AUCTIONHOUSE_ALLIANCE:
case (uint32)AuctionHouseId::Alliance:
return config->allianceBidder.maxPerCycle;
break;
case AUCTIONHOUSE_HORDE:
case (uint32)AuctionHouseId::Horde:
return config->hordeBidder.maxPerCycle;
break;
case AUCTIONHOUSE_NEUTRAL:
case (uint32)AuctionHouseId::Neutral:
return config->neutralBidder.maxPerCycle;
break;
default:
Expand Down
6 changes: 3 additions & 3 deletions src/AuctionatorCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,23 +239,23 @@ help
statusString += " Horde:\n";
statusString += " Seller Enabled: " + std::to_string(auctionator->config->hordeSeller.enabled) + "\n";
statusString += " Max Auctions: " + std::to_string(auctionator->config->hordeSeller.maxAuctions) + "\n";
statusString += " Auctions: " + std::to_string(auctionator->GetAuctionHouse(AUCTIONHOUSE_HORDE)->Getcount()) + "\n";
statusString += " Auctions: " + std::to_string(auctionator->GetAuctionHouse((uint32)AuctionHouseId::Horde)->Getcount()) + "\n";
statusString += " Bidder Enabled: " + std::to_string(auctionator->config->hordeBidder.enabled) + "\n";
statusString += " Cycle Time: " + std::to_string(auctionator->config->hordeBidder.cycleMinutes) + "\n";
statusString += " Per Cycle: " + std::to_string(auctionator->config->hordeBidder.maxPerCycle) + "\n";

statusString += " Alliance:\n";
statusString += " Seller Enabled: " + std::to_string(auctionator->config->allianceSeller.enabled) + "\n";
statusString += " Max Auctions: " + std::to_string(auctionator->config->allianceSeller.maxAuctions) + "\n";
statusString += " Auctions: " + std::to_string(auctionator->GetAuctionHouse(AUCTIONHOUSE_ALLIANCE)->Getcount()) + "\n";
statusString += " Auctions: " + std::to_string(auctionator->GetAuctionHouse((uint32)AuctionHouseId::Alliance)->Getcount()) + "\n";
statusString += " Bidder Enabled: " + std::to_string(auctionator->config->allianceBidder.enabled) + "\n";
statusString += " Cycle Time: " + std::to_string(auctionator->config->allianceBidder.cycleMinutes) + "\n";
statusString += " Per Cycle: " + std::to_string(auctionator->config->allianceBidder.maxPerCycle) + "\n";

statusString += " Neutral:\n";
statusString += " Seller Enabled: " + std::to_string(auctionator->config->neutralSeller.enabled) + "\n";
statusString += " Max Auctions: " + std::to_string(auctionator->config->neutralSeller.maxAuctions) + "\n";
statusString += " Auctions: " + std::to_string(auctionator->GetAuctionHouse(AUCTIONHOUSE_NEUTRAL)->Getcount()) + "\n";
statusString += " Auctions: " + std::to_string(auctionator->GetAuctionHouse((uint32)AuctionHouseId::Neutral)->Getcount()) + "\n";
statusString += " Bidder Enabled: " + std::to_string(auctionator->config->neutralBidder.enabled) + "\n";
statusString += " Cycle Time: " + std::to_string(auctionator->config->neutralBidder.cycleMinutes) + "\n";
statusString += " Per Cycle: " + std::to_string(auctionator->config->neutralBidder.maxPerCycle) + "\n";
Expand Down
18 changes: 9 additions & 9 deletions src/AuctionatorEvents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,28 +148,28 @@ void AuctionatorEvents::SetHouses(AuctionatorHouses* auctionatorHouses)
void AuctionatorEvents::EventAllianceBidder()
{
logInfo("Starting Alliance Bidder");
AuctionatorBidder bidder = AuctionatorBidder(AUCTIONHOUSE_ALLIANCE, auctionatorGuid, config);
AuctionatorBidder bidder = AuctionatorBidder((uint32)AuctionHouseId::Alliance, auctionatorGuid, config);
bidder.SpendSomeCash();
}

void AuctionatorEvents::EventHordeBidder()
{
logInfo("Starting Horde Bidder");
AuctionatorBidder bidder = AuctionatorBidder(AUCTIONHOUSE_HORDE, auctionatorGuid, config);
AuctionatorBidder bidder = AuctionatorBidder((uint32)AuctionHouseId::Horde, auctionatorGuid, config);
bidder.SpendSomeCash();
}

void AuctionatorEvents::EventNeutralBidder()
{
logInfo("Starting Neutral Bidder");
AuctionatorBidder bidder = AuctionatorBidder(AUCTIONHOUSE_NEUTRAL, auctionatorGuid, config);
AuctionatorBidder bidder = AuctionatorBidder((uint32)AuctionHouseId::Neutral, auctionatorGuid, config);
bidder.SpendSomeCash();
}

void AuctionatorEvents::EventAllianceSeller()
{
AuctionatorSeller sellerAlliance =
AuctionatorSeller(gAuctionator, static_cast<uint32>(AUCTIONHOUSE_ALLIANCE));
AuctionatorSeller(gAuctionator, static_cast<uint32>(AuctionHouseId::Alliance));

uint32 auctionCountAlliance = houses->AllianceAh->Getcount();

Expand All @@ -182,7 +182,7 @@ void AuctionatorEvents::EventAllianceSeller()

sellerAlliance.LetsGetToIt(
config->sellerConfig.auctionsPerRun,
AUCTIONHOUSE_ALLIANCE
(uint32)AuctionHouseId::Alliance
);
} else {
logInfo("Alliance count over max: " + std::to_string(auctionCountAlliance));
Expand All @@ -193,7 +193,7 @@ void AuctionatorEvents::EventAllianceSeller()
void AuctionatorEvents::EventHordeSeller()
{
AuctionatorSeller sellerHorde =
AuctionatorSeller(gAuctionator, static_cast<uint32>(AUCTIONHOUSE_HORDE));
AuctionatorSeller(gAuctionator, static_cast<uint32>(AuctionHouseId::Horde));

uint32 auctionCountHorde = houses->HordeAh->Getcount();

Expand All @@ -206,7 +206,7 @@ void AuctionatorEvents::EventHordeSeller()

sellerHorde.LetsGetToIt(
config->sellerConfig.auctionsPerRun,
AUCTIONHOUSE_HORDE
(uint32)AuctionHouseId::Horde
);
} else {
logInfo("Horde count over max: " + std::to_string(auctionCountHorde));
Expand All @@ -216,7 +216,7 @@ void AuctionatorEvents::EventHordeSeller()
void AuctionatorEvents::EventNeutralSeller()
{
AuctionatorSeller sellerNeutral =
AuctionatorSeller(gAuctionator, static_cast<uint32>(AUCTIONHOUSE_NEUTRAL));
AuctionatorSeller(gAuctionator, static_cast<uint32>(AuctionHouseId::Neutral));

uint32 auctionCountNeutral = houses->NeutralAh->Getcount();

Expand All @@ -229,7 +229,7 @@ void AuctionatorEvents::EventNeutralSeller()

sellerNeutral.LetsGetToIt(
config->sellerConfig.auctionsPerRun,
AUCTIONHOUSE_NEUTRAL
(uint32)AuctionHouseId::Neutral
);

} else {
Expand Down
2 changes: 1 addition & 1 deletion src/AuctionatorScript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class AuctionatorHouseScript : public AuctionHouseScript
{
if (oldBidder && !newBidder)
oldBidder->GetSession()->SendAuctionBidderNotification(
auction->GetHouseId(),
(uint32)auction->GetHouseId(),
auction->Id,
ObjectGuid::Create<HighGuid::Player>(gAuctionator->config->characterGuid),
newPrice,
Expand Down
3 changes: 2 additions & 1 deletion src/AuctionatorSeller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "DatabaseEnv.h"
#include "PreparedStatement.h"
#include <random>
#include "QueryResult.h"


AuctionatorSeller::AuctionatorSeller(Auctionator* natorParam, uint32 auctionHouseIdParam)
Expand Down Expand Up @@ -206,4 +207,4 @@ uint32 AuctionatorSeller::GetRandomNumber(uint32 min, uint32 max)
std::mt19937 gen(rd());
std::uniform_int_distribution<> dis(min, max);
return dis(gen);
}
}

0 comments on commit b3303ab

Please sign in to comment.