diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp index 1a75dafc394..180eef28bff 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp @@ -435,7 +435,7 @@ void AuctionHouseObject::AddAuction(AuctionEntry* auction) sScriptMgr->OnAuctionAdd(this, auction); } -bool AuctionHouseObject::RemoveAuction(AuctionEntry* auction, uint32 /*itemEntry*/) +bool AuctionHouseObject::RemoveAuction(AuctionEntry* auction) { bool wasInMap = AuctionsMap.erase(auction->Id) ? true : false; @@ -457,23 +457,20 @@ void AuctionHouseObject::Update() if (AuctionsMap.empty()) return; - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_AUCTION_BY_TIME); - stmt->setUInt32(0, (uint32)curTime+60); - PreparedQueryResult result = CharacterDatabase.Query(stmt); - if (!result) - return; + SQLTransaction trans = CharacterDatabase.BeginTransaction(); - do + for (AuctionEntryMap::iterator it = AuctionsMap.begin(); it != AuctionsMap.end();) { // from auctionhousehandler.cpp, creates auction pointer & player pointer - AuctionEntry* auction = GetAuction(result->Fetch()->GetUInt32()); + AuctionEntry* auction = it->second; + // Increment iterator due to AuctionEntry deletion + ++it; - if (!auction) + ///- filter auctions expired on next update + if (auction->expire_time > curTime + 60) continue; - SQLTransaction trans = CharacterDatabase.BeginTransaction(); - ///- Either cancel the auction if there was no bidder if (auction->bidder == 0) { @@ -491,16 +488,15 @@ void AuctionHouseObject::Update() sScriptMgr->OnAuctionSuccessful(this, auction); } - uint32 itemEntry = auction->itemEntry; - ///- In any case clear the auction auction->DeleteFromDB(trans); - CharacterDatabase.CommitTransaction(trans); sAuctionMgr->RemoveAItem(auction->itemGUIDLow); - RemoveAuction(auction, itemEntry); + RemoveAuction(auction); } - while (result->NextRow()); + + // Run DB changes + CharacterDatabase.CommitTransaction(trans); } void AuctionHouseObject::BuildListBidderItems(WorldPacket& data, Player* player, uint32& count, uint32& totalcount) @@ -595,22 +591,31 @@ void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player if (propRefID) { // Append the suffix to the name (ie: of the Monkey) if one exists - // These are found in ItemRandomProperties.dbc, not ItemRandomSuffix.dbc + // These are found in ItemRandomSuffix.dbc and ItemRandomProperties.dbc // even though the DBC names seem misleading - const ItemRandomPropertiesEntry* itemRandProp = sItemRandomPropertiesStore.LookupEntry(propRefID); - if (itemRandProp) + char* const* suffix = nullptr; + + if (propRefID < 0) { - char* temp = itemRandProp->nameSuffix; + const ItemRandomSuffixEntry* itemRandSuffix = sItemRandomSuffixStore.LookupEntry(-propRefID); + if (itemRandSuffix) + suffix = itemRandSuffix->nameSuffix; + } + else + { + const ItemRandomPropertiesEntry* itemRandProp = sItemRandomPropertiesStore.LookupEntry(propRefID); + if (itemRandProp) + suffix = itemRandProp->nameSuffix; + } - // dbc local name - if (temp) - { - // Append the suffix (ie: of the Monkey) to the name using localization - // or default enUS if localization is invalid - name += ' '; - name += temp[locdbc_idx >= 0 ? locdbc_idx : LOCALE_enUS]; - } + // dbc local name + if (suffix) + { + // Append the suffix (ie: of the Monkey) to the name using localization + // or default enUS if localization is invalid + name += ' '; + name += suffix[locdbc_idx >= 0 ? locdbc_idx : LOCALE_enUS]; } } diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.h b/src/server/game/AuctionHouse/AuctionHouseMgr.h index 172c1975618..6c2ac7ec3a3 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.h +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.h @@ -117,7 +117,7 @@ class AuctionHouseObject void AddAuction(AuctionEntry* auction); - bool RemoveAuction(AuctionEntry* auction, uint32 itemEntry); + bool RemoveAuction(AuctionEntry* auction); void Update(); diff --git a/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp b/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp index 1c5aacdf1d5..5db80d49dd9 100644 --- a/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp +++ b/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp @@ -207,12 +207,12 @@ bool AuctionBotSeller::Initialize() { if (sAuctionBotConfig->GetConfig(CONFIG_AHBOT_BUYPRICE_SELLER)) { - if (prototype->BuyPrice == 0) + if (prototype->SellPrice == 0) continue; } else { - if (prototype->SellPrice == 0) + if (prototype->BuyPrice == 0) continue; } } @@ -706,7 +706,7 @@ void AuctionBotSeller::SetPricesOfItem(ItemTemplate const* itemProto, SellerConf if (sellPrice == 0) sellPrice = (buyPrice > 10 ? buyPrice / GetSellModifier(itemProto) : buyPrice); - if (!sAuctionBotConfig->GetConfig(CONFIG_AHBOT_BUYPRICE_SELLER)) + if (sAuctionBotConfig->GetConfig(CONFIG_AHBOT_BUYPRICE_SELLER)) buyPrice = sellPrice; uint32 basePrice = (buyPrice * stackCount * priceRatio) / (itemProto->Class == 6 ? 200 : itemProto->BuyCount) / 100; diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp index 4cfd855cd14..fc11d99c196 100644 --- a/src/server/game/Handlers/AuctionHouseHandler.cpp +++ b/src/server/game/Handlers/AuctionHouseHandler.cpp @@ -528,9 +528,8 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData) auction->DeleteFromDB(trans); - uint32 itemEntry = auction->itemEntry; sAuctionMgr->RemoveAItem(auction->itemGUIDLow); - auctionHouse->RemoveAuction(auction, itemEntry); + auctionHouse->RemoveAuction(auction); } player->SaveInventoryAndGoldToDB(trans); CharacterDatabase.CommitTransaction(trans); @@ -606,9 +605,8 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData) auction->DeleteFromDB(trans); CharacterDatabase.CommitTransaction(trans); - uint32 itemEntry = auction->itemEntry; sAuctionMgr->RemoveAItem(auction->itemGUIDLow); - auctionHouse->RemoveAuction(auction, itemEntry); + auctionHouse->RemoveAuction(auction); } //called when player lists his bids diff --git a/src/server/scripts/Commands/cs_ahbot.cpp b/src/server/scripts/Commands/cs_ahbot.cpp index 5b123b48fa7..559a775da31 100644 --- a/src/server/scripts/Commands/cs_ahbot.cpp +++ b/src/server/scripts/Commands/cs_ahbot.cpp @@ -146,11 +146,9 @@ public: static bool HandleAHBotRebuildCommand(ChatHandler* /*handler*/, const char* args) { char* arg = strtok((char*)args, " "); - if (!arg) - return false; bool all = false; - if (strcmp(arg, "all") == 0) + if (arg && strcmp(arg, "all") == 0) all = true; sAuctionBot->Rebuild(all); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp index 9db3c1a9340..604cb6c48d1 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp @@ -78,6 +78,7 @@ class instance_ulduar : public InstanceMapScript illusion = 0; keepersCount = 0; conSpeedAtory = false; + lumberjacked = false; Unbroken = true; IsDriveMeCrazyEligible = true; _algalonSummoned = false; @@ -102,6 +103,7 @@ class instance_ulduar : public InstanceMapScript ObjectGuid ThorimGUID; ObjectGuid FreyaGUID; ObjectGuid ElderGUIDs[3]; + ObjectGuid FreyaAchieveTriggerGUID; ObjectGuid MimironGUID; ObjectGuid MimironVehicleGUIDs[3]; ObjectGuid MimironComputerGUID; @@ -141,6 +143,7 @@ class instance_ulduar : public InstanceMapScript uint8 illusion; uint8 keepersCount; bool conSpeedAtory; + bool lumberjacked; bool Unbroken; bool IsDriveMeCrazyEligible; @@ -321,7 +324,10 @@ class instance_ulduar : public InstanceMapScript ElderGUIDs[2] = creature->GetGUID(); if (GetBossState(BOSS_FREYA) == DONE) creature->DespawnOrUnsummon(); - break; + break; + case NPC_FREYA_ACHIEVE_TRIGGER: + FreyaAchieveTriggerGUID = creature->GetGUID(); + break; // Mimiron case NPC_MIMIRON: @@ -606,6 +612,15 @@ class instance_ulduar : public InstanceMapScript conSpeedAtory = true; } break; + case NPC_IRONBRANCH: + case NPC_STONEBARK: + case NPC_BRIGHTLEAF: + if (!lumberjacked) + { + DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, CRITERIA_LUMBERJACKED); + lumberjacked = true; + } + break; default: break; } @@ -669,6 +684,13 @@ class instance_ulduar : public InstanceMapScript if (state == DONE) instance->SummonCreature(NPC_FREYA_OBSERVATION_RING, ObservationRingKeepersPos[0]); break; + case BOSS_IRONBRANCH: + case BOSS_STONEBARK: + case BOSS_BRIGHTLEAF: + if (GetBossState(BOSS_BRIGHTLEAF) == DONE && GetBossState(BOSS_IRONBRANCH) == DONE && GetBossState(BOSS_STONEBARK) == DONE && GetBossState(BOSS_FREYA) != DONE) + if (Creature* trigger = instance->GetCreature(FreyaAchieveTriggerGUID)) + trigger->CastSpell(trigger, SPELL_LUMBERJACKED_CREDIT, true); + break; case BOSS_KOLOGARN: if (state == DONE) { diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h index a374b4edd46..b3b17cb0f11 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h @@ -129,6 +129,9 @@ enum UlduarNPCs NPC_NATURES_BLADE = 33527, NPC_GUARDIAN_OF_LIFE = 33528, + // Freya Achievement Trigger + NPC_FREYA_ACHIEVE_TRIGGER = 33406, + // Yogg-Saron NPC_SARA = 33134, NPC_GUARDIAN_OF_YOGG_SARON = 33136, @@ -273,6 +276,7 @@ enum LeviathanActions enum UlduarAchievementCriteriaIds { CRITERIA_CON_SPEED_ATORY = 21597, + CRITERIA_LUMBERJACKED = 21686, CRITERIA_DISARMED = 21687, CRITERIA_WAITS_DREAMING_STORMWIND_25 = 10321, CRITERIA_WAITS_DREAMING_CHAMBER_25 = 10322, @@ -362,6 +366,7 @@ enum UlduarAchievementData DATA_UNBROKEN = 29052906, // 2905, 2906 are achievement IDs, MAX_HERALD_ARMOR_ITEMLEVEL = 226, MAX_HERALD_WEAPON_ITEMLEVEL = 232, + SPELL_LUMBERJACKED_CREDIT = 65296 }; enum UlduarEvents diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp index 4c381fc6790..5f3b22c3377 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp +++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp @@ -129,7 +129,6 @@ void CharacterDatabaseConnection::DoPrepareStatements() PrepareStatement(CHAR_SEL_AUCTIONS, "SELECT id, auctioneerguid, itemguid, itemEntry, count, itemowner, buyoutprice, time, buyguid, lastbid, startbid, deposit FROM auctionhouse ah INNER JOIN item_instance ii ON ii.guid = ah.itemguid", CONNECTION_SYNCH); PrepareStatement(CHAR_INS_AUCTION, "INSERT INTO auctionhouse (id, auctioneerguid, itemguid, itemowner, buyoutprice, time, buyguid, lastbid, startbid, deposit) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); PrepareStatement(CHAR_DEL_AUCTION, "DELETE FROM auctionhouse WHERE id = ?", CONNECTION_ASYNC); - PrepareStatement(CHAR_SEL_AUCTION_BY_TIME, "SELECT id FROM auctionhouse WHERE time <= ? ORDER BY TIME ASC", CONNECTION_SYNCH); PrepareStatement(CHAR_UPD_AUCTION_BID, "UPDATE auctionhouse SET buyguid = ?, lastbid = ? WHERE id = ?", CONNECTION_ASYNC); PrepareStatement(CHAR_INS_MAIL, "INSERT INTO mail(id, messageType, stationery, mailTemplateId, sender, receiver, subject, body, has_items, expire_time, deliver_time, money, cod, checked) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); PrepareStatement(CHAR_DEL_MAIL_BY_ID, "DELETE FROM mail WHERE id = ?", CONNECTION_ASYNC); diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h index 43c52a8efb4..49a1762ce1c 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.h +++ b/src/server/shared/Database/Implementation/CharacterDatabase.h @@ -128,7 +128,6 @@ enum CharacterDatabaseStatements CHAR_SEL_AUCTION_ITEMS, CHAR_INS_AUCTION, CHAR_DEL_AUCTION, - CHAR_SEL_AUCTION_BY_TIME, CHAR_UPD_AUCTION_BID, CHAR_SEL_AUCTIONS, CHAR_INS_MAIL, diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 74e37cf8955..79c26092605 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -27,6 +27,9 @@ # CONSOLE AND REMOTE ACCESS # CHARACTER DELETE OPTIONS # CUSTOM SERVER OPTIONS +# AUCTION HOUSE BOT SETTINGS +# AUCTION HOUSE BOT ITEM FINE TUNING +# AUCTION HOUSE BOT BUYER CONFIG # LOGGING SYSTEM SETTINGS # CURRENCIES SETTINGS # PACKET SPOOF PROTECTION SETTINGS @@ -2871,8 +2874,8 @@ AuctionHouseBot.Class.Glyph = 3 ################################################################################################### ################################################################################################### +# AUCTION HOUSE BOT ITEM FINE TUNING # -# AHBot ITEM FINE TUNING # The following are usefull for limiting what character levels can # benefit from the auction house # @@ -2945,7 +2948,7 @@ AuctionHouseBot.forceExcludeItems = "" ################################################################################################### ################################################################################################### -# AHBot Buyer config +# AUCTION HOUSE BOT BUYER CONFIG # # AuctionHouseBot.Buyer.Enabled # Description: General enable or disable AuctionHouseBot Buyer functionality