From 80b5c18c04f78c49cc26bba2147cb075faddc2e0 Mon Sep 17 00:00:00 2001 From: Barbz Date: Thu, 30 Jan 2020 23:49:03 +0100 Subject: [PATCH 1/2] Update ahbot.patch --- ahbot.patch | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/ahbot.patch b/ahbot.patch index c302e12..08d168d 100644 --- a/ahbot.patch +++ b/ahbot.patch @@ -9,7 +9,7 @@ index 4aba5703b2..5c9a332016 100644 +#ifdef MOD_AH_BOT +#include "AuctionHouseBot.h" +#endif - + enum eAuctionHouse { @@ -139,8 +142,11 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry* auction, SQLTransa @@ -35,7 +35,7 @@ index 4aba5703b2..5c9a332016 100644 if (owner) +#endif owner->GetSession()->SendAuctionOwnerNotification(auction); - + MailDraft(auction->BuildAuctionMailSubject(AUCTION_EXPIRED), AuctionEntry::BuildAuctionMailBody(0, 0, auction->buyout, auction->deposit, 0)) @@ -207,6 +217,11 @@ void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 new // old bidder exist @@ -48,23 +48,23 @@ index 4aba5703b2..5c9a332016 100644 + if (oldBidder && newBidder) oldBidder->GetSession()->SendAuctionBidderNotification(auction->GetHouseId(), auction->Id, newBidder->GetGUID(), newPrice, auction->GetAuctionOutBid(), auction->item_template); - + @@ -407,10 +422,16 @@ void AuctionHouseObject::AddAuction(AuctionEntry* auction) - + AuctionsMap[auction->Id] = auction; sScriptMgr->OnAuctionAdd(this, auction); +#ifdef MOD_AH_BOT + auctionbot->IncrementItemCounts(auction); +#endif } - + bool AuctionHouseObject::RemoveAuction(AuctionEntry* auction) { +#ifdef MOD_AH_BOT + auctionbot->DecrementItemCounts(auction, auction->item_template); +#endif bool wasInMap = AuctionsMap.erase(auction->Id) ? true : false; - + sScriptMgr->OnAuctionRemove(this, auction); diff --git a/src/server/game/Mails/Mail.cpp b/src/server/game/Mails/Mail.cpp index 6683fe2f15..9fcd209454 100644 @@ -77,13 +77,13 @@ index 6683fe2f15..9fcd209454 100644 +#ifdef MOD_AH_BOT +#include "AuctionHouseBot.h" +#endif - + MailSender::MailSender(Object* sender, MailStationery stationery) : m_stationery(stationery) { @@ -175,6 +178,15 @@ void MailDraft::SendMailTo(SQLTransaction& trans, MailReceiver const& receiver, - + uint32 mailId = sObjectMgr->GenerateMailID(); - + +#ifdef MOD_AH_BOT + if (receiver.GetPlayerGUIDLow() == auctionbot->GetAHBplayerGUID()) + { @@ -94,7 +94,7 @@ index 6683fe2f15..9fcd209454 100644 +#endif + time_t deliver_time = time(NULL) + deliver_delay; - + //expire time if COD 3 days, if no COD 30 days, if auction sale pending 1 hour diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index d1a82ee70f..7ea4386788 100644 @@ -103,7 +103,7 @@ index d1a82ee70f..7ea4386788 100644 @@ -82,6 +82,10 @@ #include "LuaEngine.h" #endif - + +#ifdef MOD_AH_BOT +#include "AuctionHouseBot.h" +#endif @@ -114,7 +114,7 @@ index d1a82ee70f..7ea4386788 100644 @@ -1709,6 +1713,11 @@ void World::SetInitialWorldSettings() sLog->outString("Loading Completed Achievements..."); sAchievementMgr->LoadCompletedAchievements(); - + +#ifdef MOD_AH_BOT + // Initialize AHBot settings before deleting expired auctions due to AHBot hooks + auctionbot->InitializeConfiguration(); @@ -123,18 +123,6 @@ index d1a82ee70f..7ea4386788 100644 ///- Load dynamic data tables from the database sLog->outString("Loading Item Auctions..."); sAuctionMgr->LoadAuctionItems(); -@@ -1949,6 +1958,11 @@ void World::SetInitialWorldSettings() - sEluna->OnConfigLoad(false,false); // Must be done after Eluna is initialized and scripts have run. - #endif - -+#ifdef MOD_AH_BOT -+ sLog->outString("Initialize AuctionHouseBot..."); -+ auctionbot->Initialize(); -+#endif -+ - uint32 startupDuration = GetMSTimeDiffToNow(startupBegin); - sLog->outString(); - sLog->outError("WORLD: World initialized in %u minutes %u seconds", (startupDuration / 60000), ((startupDuration % 60000) / 1000)); @@ -2114,6 +2128,9 @@ void World::Update(uint32 diff) // pussywizard: handle auctions when the timer has passed if (m_timers[WUPDATE_AUCTIONS].Passed()) @@ -143,5 +131,5 @@ index d1a82ee70f..7ea4386788 100644 + auctionbot->Update(); +#endif m_timers[WUPDATE_AUCTIONS].Reset(); - + // pussywizard: handle expired auctions, auctions expired when realm was offline are also handled here (not during loading when many required things aren't loaded yet) From 7bb2f66ce2b500b041842de0d6d45ffb171d1de0 Mon Sep 17 00:00:00 2001 From: Barbz Date: Thu, 30 Jan 2020 23:51:19 +0100 Subject: [PATCH 2/2] Update ahbot.patch --- ahbot.patch | 60 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 23 deletions(-) diff --git a/ahbot.patch b/ahbot.patch index 08d168d..092c405 100644 --- a/ahbot.patch +++ b/ahbot.patch @@ -1,5 +1,16 @@ +From 147a844c7a6fe88c3f1a07aed48fdba499a20754 Mon Sep 17 00:00:00 2001 +From: BarbzYHOOL +Date: Thu, 30 Jan 2020 23:49:28 +0100 +Subject: [PATCH] fix: ah_bot.patch + +--- + .../game/AuctionHouse/AuctionHouseMgr.cpp | 23 ++++++++++++++++++- + src/server/game/Mails/Mail.cpp | 12 ++++++++++ + src/server/game/World/World.cpp | 12 ++++++++++ + 3 files changed, 46 insertions(+), 1 deletion(-) + diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp -index 4aba5703b2..5c9a332016 100644 +index b8363279..05318818 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp @@ -21,6 +21,9 @@ @@ -9,10 +20,10 @@ index 4aba5703b2..5c9a332016 100644 +#ifdef MOD_AH_BOT +#include "AuctionHouseBot.h" +#endif - + enum eAuctionHouse { -@@ -139,8 +142,11 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry* auction, SQLTransa +@@ -145,8 +148,11 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry* auction, SQLTransa if (owner || owner_accId) { uint32 profit = auction->bid + auction->deposit - auction->GetAuctionCut(); @@ -25,7 +36,7 @@ index 4aba5703b2..5c9a332016 100644 { owner->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_EARNED_BY_AUCTIONS, profit); owner->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_SOLD, auction->bid); -@@ -183,7 +189,11 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction, SQLTransacti +@@ -189,7 +195,11 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction, SQLTransacti // owner exist if (owner || owner_accId) { @@ -35,9 +46,9 @@ index 4aba5703b2..5c9a332016 100644 if (owner) +#endif owner->GetSession()->SendAuctionOwnerNotification(auction); - + MailDraft(auction->BuildAuctionMailSubject(AUCTION_EXPIRED), AuctionEntry::BuildAuctionMailBody(0, 0, auction->buyout, auction->deposit, 0)) -@@ -207,6 +217,11 @@ void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 new +@@ -213,6 +223,11 @@ void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 new // old bidder exist if (oldBidder || oldBidder_accId) { @@ -48,26 +59,26 @@ index 4aba5703b2..5c9a332016 100644 + if (oldBidder && newBidder) oldBidder->GetSession()->SendAuctionBidderNotification(auction->GetHouseId(), auction->Id, newBidder->GetGUID(), newPrice, auction->GetAuctionOutBid(), auction->item_template); - -@@ -407,10 +422,16 @@ void AuctionHouseObject::AddAuction(AuctionEntry* auction) - + +@@ -413,10 +428,16 @@ void AuctionHouseObject::AddAuction(AuctionEntry* auction) + AuctionsMap[auction->Id] = auction; sScriptMgr->OnAuctionAdd(this, auction); +#ifdef MOD_AH_BOT + auctionbot->IncrementItemCounts(auction); +#endif } - + bool AuctionHouseObject::RemoveAuction(AuctionEntry* auction) { +#ifdef MOD_AH_BOT + auctionbot->DecrementItemCounts(auction, auction->item_template); +#endif bool wasInMap = AuctionsMap.erase(auction->Id) ? true : false; - + sScriptMgr->OnAuctionRemove(this, auction); diff --git a/src/server/game/Mails/Mail.cpp b/src/server/game/Mails/Mail.cpp -index 6683fe2f15..9fcd209454 100644 +index 6683fe2f..9fcd2094 100644 --- a/src/server/game/Mails/Mail.cpp +++ b/src/server/game/Mails/Mail.cpp @@ -15,6 +15,9 @@ @@ -77,13 +88,13 @@ index 6683fe2f15..9fcd209454 100644 +#ifdef MOD_AH_BOT +#include "AuctionHouseBot.h" +#endif - + MailSender::MailSender(Object* sender, MailStationery stationery) : m_stationery(stationery) { @@ -175,6 +178,15 @@ void MailDraft::SendMailTo(SQLTransaction& trans, MailReceiver const& receiver, - + uint32 mailId = sObjectMgr->GenerateMailID(); - + +#ifdef MOD_AH_BOT + if (receiver.GetPlayerGUIDLow() == auctionbot->GetAHBplayerGUID()) + { @@ -94,16 +105,16 @@ index 6683fe2f15..9fcd209454 100644 +#endif + time_t deliver_time = time(NULL) + deliver_delay; - + //expire time if COD 3 days, if no COD 30 days, if auction sale pending 1 hour diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp -index d1a82ee70f..7ea4386788 100644 +index 53ce3fc1..3b39a994 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp -@@ -82,6 +82,10 @@ +@@ -83,6 +83,10 @@ #include "LuaEngine.h" #endif - + +#ifdef MOD_AH_BOT +#include "AuctionHouseBot.h" +#endif @@ -111,10 +122,10 @@ index d1a82ee70f..7ea4386788 100644 ACE_Atomic_Op World::m_stopEvent = false; uint8 World::m_ExitCode = SHUTDOWN_EXIT_CODE; uint32 World::m_worldLoopCounter = 0; -@@ -1709,6 +1713,11 @@ void World::SetInitialWorldSettings() +@@ -1739,6 +1743,11 @@ void World::SetInitialWorldSettings() sLog->outString("Loading Completed Achievements..."); sAchievementMgr->LoadCompletedAchievements(); - + +#ifdef MOD_AH_BOT + // Initialize AHBot settings before deleting expired auctions due to AHBot hooks + auctionbot->InitializeConfiguration(); @@ -123,7 +134,7 @@ index d1a82ee70f..7ea4386788 100644 ///- Load dynamic data tables from the database sLog->outString("Loading Item Auctions..."); sAuctionMgr->LoadAuctionItems(); -@@ -2114,6 +2128,9 @@ void World::Update(uint32 diff) +@@ -2165,6 +2174,9 @@ void World::Update(uint32 diff) // pussywizard: handle auctions when the timer has passed if (m_timers[WUPDATE_AUCTIONS].Passed()) { @@ -131,5 +142,8 @@ index d1a82ee70f..7ea4386788 100644 + auctionbot->Update(); +#endif m_timers[WUPDATE_AUCTIONS].Reset(); - + // pussywizard: handle expired auctions, auctions expired when realm was offline are also handled here (not during loading when many required things aren't loaded yet) +-- +2.17.0 +