diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScriptMgr.cpp | 18 | ||||
-rw-r--r-- | src/server/game/AuctionHouse/AuctionHouseMgr.cpp | 118 | ||||
-rw-r--r-- | src/server/game/AuctionHouse/AuctionHouseMgr.h | 4 | ||||
-rw-r--r-- | src/server/game/Loot/LootMgr.h | 8 | ||||
-rw-r--r-- | src/server/game/World/World.cpp | 4 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_holiday.cpp | 32 | ||||
-rw-r--r-- | src/server/shared/Database/Implementation/CharacterDatabase.cpp | 3 | ||||
-rw-r--r-- | src/server/shared/Database/Implementation/CharacterDatabase.h | 2 |
8 files changed, 49 insertions, 140 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index 86119785cbd..6a380476c90 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -749,8 +749,24 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) if (e.action.randomEmote.emote6 && !IsEmoteValid(e, e.action.randomEmote.emote6)) return false; break; - case SMART_ACTION_ADD_AURA: case SMART_ACTION_CAST: + { + if (!IsSpellValid(e, e.action.cast.spell)) + return false; + + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(e.action.cast.spell); + for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j) + { + if (spellInfo->Effects[j].IsEffect(SPELL_EFFECT_KILL_CREDIT) || spellInfo->Effects[j].IsEffect(SPELL_EFFECT_KILL_CREDIT2)) + { + if (spellInfo->Effects[j].TargetA.GetTarget() == TARGET_UNIT_CASTER) + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u Effect: SPELL_EFFECT_KILL_CREDIT: (SpellId: %u targetA: %u - targetB: %u) has invalid target for this Action", + e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.cast.spell, spellInfo->Effects[j].TargetA, spellInfo->Effects[j].TargetB); + } + } + break; + } + case SMART_ACTION_ADD_AURA: case SMART_ACTION_INVOKER_CAST: if (!IsSpellValid(e, e.action.cast.spell)) return false; diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp index 46ac5b8f511..4c00b3d8781 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp @@ -740,124 +740,6 @@ bool AuctionEntry::LoadFromDB(Field* fields) } return true; } - -void AuctionHouseMgr::DeleteExpiredAuctionsAtStartup() -{ - // Deletes expired auctions. Should be called at server start before loading auctions. - - // DO NOT USE after auctions are already loaded since this deletes from the DB - // and assumes the auctions HAVE NOT been loaded into a list or AuctionEntryMap yet - - uint32 oldMSTime = getMSTime(); - uint32 expirecount = 0; - time_t curTime = sWorld->GetGameTime(); - - // Query the DB to see if there are any expired auctions - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_EXPIRED_AUCTIONS); - stmt->setUInt32(0, (uint32)curTime+60); - PreparedQueryResult expAuctions = CharacterDatabase.Query(stmt); - - if (!expAuctions) - { - TC_LOG_INFO("server.loading", ">> No expired auctions to delete"); - - return; - } - - do - { - Field* fields = expAuctions->Fetch(); - - AuctionEntry* auction = new AuctionEntry(); - - // Can't use LoadFromDB() because it assumes the auction map is loaded - if (!auction->LoadFromFieldList(fields)) - { - // For some reason the record in the DB is broken (possibly corrupt - // faction info). Delete the object and move on. - delete auction; - continue; - } - - SQLTransaction trans = CharacterDatabase.BeginTransaction(); - - if (auction->bidder==0) - { - // Cancel the auction, there was no bidder - sAuctionMgr->SendAuctionExpiredMail(auction, trans); - } - else - { - // Send the item to the winner and money to seller - sAuctionMgr->SendAuctionSuccessfulMail(auction, trans); - sAuctionMgr->SendAuctionWonMail(auction, trans); - } - - // Call the appropriate AuctionHouseObject script - // ** Do we need to do this while core is still loading? ** - sScriptMgr->OnAuctionExpire(GetAuctionsMap(auction->factionTemplateId), auction); - - // Delete the auction from the DB - auction->DeleteFromDB(trans); - CharacterDatabase.CommitTransaction(trans); - - // Release memory - delete auction; - ++expirecount; - - } - while (expAuctions->NextRow()); - - TC_LOG_INFO("server.loading", ">> Deleted %u expired auctions in %u ms", expirecount, GetMSTimeDiffToNow(oldMSTime)); - - -} - -bool AuctionEntry::LoadFromFieldList(Field* fields) -{ - // Loads an AuctionEntry item from a field list. Unlike "LoadFromDB()", this one - // does not require the AuctionEntryMap to have been loaded with items. It simply - // acts as a wrapper to fill out an AuctionEntry struct from a field list - - Id = fields[0].GetUInt32(); - auctioneer = fields[1].GetUInt32(); - itemGUIDLow = fields[2].GetUInt32(); - itemEntry = fields[3].GetUInt32(); - itemCount = fields[4].GetUInt32(); - owner = fields[5].GetUInt32(); - buyout = fields[6].GetUInt32(); - expire_time = fields[7].GetUInt32(); - bidder = fields[8].GetUInt32(); - bid = fields[9].GetUInt32(); - startbid = fields[10].GetUInt32(); - deposit = fields[11].GetUInt32(); - - CreatureData const* auctioneerData = sObjectMgr->GetCreatureData(auctioneer); - if (!auctioneerData) - { - TC_LOG_ERROR("misc", "AuctionEntry::LoadFromFieldList() - Auction %u has not a existing auctioneer (GUID : %u)", Id, auctioneer); - return false; - } - - CreatureTemplate const* auctioneerInfo = sObjectMgr->GetCreatureTemplate(auctioneerData->id); - if (!auctioneerInfo) - { - TC_LOG_ERROR("misc", "AuctionEntry::LoadFromFieldList() - Auction %u has not a existing auctioneer (GUID : %u Entry: %u)", Id, auctioneer, auctioneerData->id); - return false; - } - - factionTemplateId = auctioneerInfo->faction; - auctionHouseEntry = AuctionHouseMgr::GetAuctionHouseEntry(factionTemplateId); - - if (!auctionHouseEntry) - { - TC_LOG_ERROR("misc", "AuctionEntry::LoadFromFieldList() - Auction %u has auctioneer (GUID : %u Entry: %u) with wrong faction %u", Id, auctioneer, auctioneerData->id, factionTemplateId); - return false; - } - - return true; -} - std::string AuctionEntry::BuildAuctionMailSubject(MailAuctionAnswers response) const { std::ostringstream strm; diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.h b/src/server/game/AuctionHouse/AuctionHouseMgr.h index 7d0b7bb9b27..a167acfbd73 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.h +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.h @@ -87,7 +87,6 @@ struct AuctionEntry void DeleteFromDB(SQLTransaction& trans) const; void SaveToDB(SQLTransaction& trans) const; bool LoadFromDB(Field* fields); - bool LoadFromFieldList(Field* fields); std::string BuildAuctionMailSubject(MailAuctionAnswers response) const; static std::string BuildAuctionMailBody(uint32 lowGuid, uint32 bid, uint32 buyout, uint32 deposit, uint32 cut); @@ -173,9 +172,6 @@ class AuctionHouseMgr public: - // Used primarily at server start to avoid loading a list of expired auctions - void DeleteExpiredAuctionsAtStartup(); - //load first auction items, because of check if item exists, when loading void LoadAuctionItems(); void LoadAuctions(); diff --git a/src/server/game/Loot/LootMgr.h b/src/server/game/Loot/LootMgr.h index 1f5c0251eec..1685996fd03 100644 --- a/src/server/game/Loot/LootMgr.h +++ b/src/server/game/Loot/LootMgr.h @@ -127,18 +127,18 @@ struct LootStoreItem uint32 itemid; // id of the item uint32 reference; // referenced TemplateleId float chance; // chance to drop for both quest and non-quest items, chance to be used for refs - bool needs_quest : 1; // quest drop (quest is required for item to drop) uint16 lootmode; + bool needs_quest : 1; // quest drop (quest is required for item to drop) uint8 groupid : 7; uint8 mincount; // mincount for drop items - uint8 maxcount : 8; // max drop count for the item mincount or Ref multiplicator + uint8 maxcount; // max drop count for the item mincount or Ref multiplicator ConditionList conditions; // additional loot condition // Constructor // displayid is filled in IsValid() which must be called after LootStoreItem(uint32 _itemid, uint32 _reference, float _chance, bool _needs_quest, uint16 _lootmode, uint8 _groupid, int32 _mincount, uint8 _maxcount) - : itemid(_itemid), reference(_reference), chance(_chance), needs_quest(_needs_quest), - lootmode(_lootmode), groupid(_groupid), mincount(_mincount), maxcount(_maxcount) + : itemid(_itemid), reference(_reference), chance(_chance), lootmode(_lootmode), + needs_quest(_needs_quest), groupid(_groupid), mincount(_mincount), maxcount(_maxcount) { } bool Roll(bool rate) const; // Checks if the entry takes it's chance (at loot generation) diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 163d76a18bd..3a183ec50bc 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1657,10 +1657,6 @@ void World::SetInitialWorldSettings() TC_LOG_INFO("server.loading", "Loading Completed Achievements..."); sAchievementMgr->LoadCompletedAchievements(); - // Delete expired auctions before loading - TC_LOG_INFO("server.loading", "Deleting expired auctions..."); - sAuctionMgr->DeleteExpiredAuctionsAtStartup(); - ///- Load dynamic data tables from the database TC_LOG_INFO("server.loading", "Loading Item Auctions..."); sAuctionMgr->LoadAuctionItems(); diff --git a/src/server/scripts/Spells/spell_holiday.cpp b/src/server/scripts/Spells/spell_holiday.cpp index e43249ff8aa..126aa561c05 100644 --- a/src/server/scripts/Spells/spell_holiday.cpp +++ b/src/server/scripts/Spells/spell_holiday.cpp @@ -430,9 +430,6 @@ class spell_winter_veil_px_238_winter_wondervolt : public SpellScriptLoader { OnEffectHitTarget += SpellEffectFn(spell_winter_veil_px_238_winter_wondervolt_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } - - private: - }; SpellScript* GetSpellScript() const override @@ -738,18 +735,37 @@ class spell_brewfest_dismount_ram : public SpellScriptLoader enum RamBlub { + // Horde QUEST_BARK_FOR_DROHNS_DISTILLERY = 11407, QUEST_BARK_FOR_TCHALIS_VOODOO_BREWERY = 11408, + // Alliance + QUEST_BARK_BARLEYBREW = 11293, + QUEST_BARK_FOR_THUNDERBREWS = 11294, + + // Bark for Drohn's Distillery! SAY_DROHN_DISTILLERY_1 = 23520, SAY_DROHN_DISTILLERY_2 = 23521, SAY_DROHN_DISTILLERY_3 = 23522, SAY_DROHN_DISTILLERY_4 = 23523, + // Bark for T'chali's Voodoo Brewery! SAY_TCHALIS_VOODOO_1 = 23524, SAY_TCHALIS_VOODOO_2 = 23525, SAY_TCHALIS_VOODOO_3 = 23526, - SAY_TCHALIS_VOODOO_4 = 23527 + SAY_TCHALIS_VOODOO_4 = 23527, + + // Bark for the Barleybrews! + SAY_BARLEYBREW_1 = 23464, + SAY_BARLEYBREW_2 = 23465, + SAY_BARLEYBREW_3 = 23466, + SAY_BARLEYBREW_4 = 23467, + + // Bark for the Thunderbrews! + SAY_THUNDERBREWS_1 = 23467, + SAY_THUNDERBREWS_2 = 23468, + SAY_THUNDERBREWS_3 = 23469, + SAY_THUNDERBREWS_4 = 22942 }; // 43259 Brewfest - Barker Bunny 1 @@ -784,6 +800,14 @@ class spell_brewfest_barker_bunny : public SpellScriptLoader target->GetQuestStatus(QUEST_BARK_FOR_TCHALIS_VOODOO_BREWERY) == QUEST_STATUS_COMPLETE) BroadcastTextId = RAND(SAY_TCHALIS_VOODOO_1, SAY_TCHALIS_VOODOO_2, SAY_TCHALIS_VOODOO_3, SAY_TCHALIS_VOODOO_4); + if (target->GetQuestStatus(QUEST_BARK_BARLEYBREW) == QUEST_STATUS_INCOMPLETE || + target->GetQuestStatus(QUEST_BARK_BARLEYBREW) == QUEST_STATUS_COMPLETE) + BroadcastTextId = RAND(SAY_BARLEYBREW_1, SAY_BARLEYBREW_2, SAY_BARLEYBREW_3, SAY_BARLEYBREW_4); + + if (target->GetQuestStatus(QUEST_BARK_FOR_THUNDERBREWS) == QUEST_STATUS_INCOMPLETE || + target->GetQuestStatus(QUEST_BARK_FOR_THUNDERBREWS) == QUEST_STATUS_COMPLETE) + BroadcastTextId = RAND(SAY_THUNDERBREWS_1, SAY_THUNDERBREWS_2, SAY_THUNDERBREWS_3, SAY_THUNDERBREWS_4); + if (BroadcastTextId) target->Talk(BroadcastTextId, CHAT_MSG_SAY, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), target); } diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp index 061415ae607..a0fb6e74a39 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp +++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp @@ -362,9 +362,6 @@ void CharacterDatabaseConnection::DoPrepareStatements() PrepareStatement(CHAR_INS_GM_SUBSURVEY, "INSERT INTO gm_subsurveys (surveyId, subsurveyId, rank, comment) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC); PrepareStatement(CHAR_INS_LAG_REPORT, "INSERT INTO lag_reports (guid, lagType, mapId, posX, posY, posZ, latency, createTime) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); - // For loading and deleting expired auctions at startup - PrepareStatement(CHAR_SEL_EXPIRED_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 WHERE ah.time <= ?", CONNECTION_SYNCH); - // LFG Data PrepareStatement(CHAR_INS_LFG_DATA, "INSERT INTO lfg_data (guid, dungeon, state) VALUES (?, ?, ?)", CONNECTION_ASYNC); PrepareStatement(CHAR_DEL_LFG_DATA, "DELETE FROM lfg_data WHERE guid = ?", CONNECTION_ASYNC); diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h index e2a046ac6e1..4764d653f17 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.h +++ b/src/server/shared/Database/Implementation/CharacterDatabase.h @@ -319,8 +319,6 @@ enum CharacterDatabaseStatements CHAR_INS_GM_SUBSURVEY, CHAR_INS_LAG_REPORT, - CHAR_SEL_EXPIRED_AUCTIONS, - CHAR_INS_CHARACTER, CHAR_UPD_CHARACTER, |