From 0d04d89e811fd6fb82647bc80d58841e798007ec Mon Sep 17 00:00:00 2001 From: leelf00 Date: Fri, 10 Nov 2023 16:01:45 +0800 Subject: [PATCH] [Core/Custom] Remove Premium Create 2023_11_10_world_trinity_string.sql --- sql/base/auth.sql | 56 -- sql/updates/master/world/2023_11_10_auth.sql | 4 + .../world/2023_11_10_world_trinity_string.sql | 4 + src/server/game/BattlePay/BattlePayMgr.cpp | 11 - src/server/game/BattlePay/ServiceBoost.cpp | 11 +- .../game/Battlefield/Zones/BattlefieldWG.cpp | 4 - .../game/Battlegrounds/Battleground.cpp | 46 -- .../game/Battlegrounds/BattlegroundQueue.cpp | 160 ---- .../game/Battlegrounds/BattlegroundQueue.h | 24 - src/server/game/DungeonFinding/LFGMgr.cpp | 171 ---- src/server/game/DungeonFinding/LFGMgr.h | 10 - .../game/Entities/Creature/GossipDef.cpp | 19 +- .../game/Entities/GameObject/GameObject.cpp | 2 - .../game/Entities/Player/KillRewarder.cpp | 9 - src/server/game/Entities/Player/Player.cpp | 127 +-- src/server/game/Entities/Player/Player.h | 2 - .../game/Handlers/AuctionHouseHandler.cpp | 15 - .../game/Handlers/BattleGroundHandler.cpp | 42 +- src/server/game/Handlers/GroupHandler.cpp | 3 - src/server/game/Handlers/LFGHandler.cpp | 7 - src/server/game/Handlers/MailHandler.cpp | 23 +- src/server/game/Handlers/TradeHandler.cpp | 6 - src/server/game/Instances/InstanceScript.cpp | 21 - src/server/game/OutdoorPvP/OutdoorPvP.cpp | 4 - src/server/game/Reputation/ReputationMgr.cpp | 4 - src/server/game/Server/WorldSession.cpp | 26 +- src/server/game/Server/WorldSession.h | 5 - src/server/game/Server/WorldSocket.cpp | 15 - src/server/game/Spells/Spell.cpp | 10 - src/server/game/Spells/SpellEffects.cpp | 7 - src/server/game/World/World.cpp | 781 ------------------ src/server/game/World/World.h | 280 +------ src/server/scripts/Commands/cs_misc.cpp | 152 +--- src/server/scripts/Commands/cs_support.cpp | 75 -- .../scripts/OutdoorPvP/OutdoorPvPNA.cpp | 3 - src/server/scripts/Spells/spell_generic.cpp | 1 - .../Database/Implementation/LoginDatabase.cpp | 9 - .../Database/Implementation/LoginDatabase.h | 8 - 38 files changed, 32 insertions(+), 2125 deletions(-) create mode 100644 sql/updates/master/world/2023_11_10_auth.sql create mode 100644 sql/updates/master/world/2023_11_10_world_trinity_string.sql diff --git a/sql/base/auth.sql b/sql/base/auth.sql index 41a27ac03..c9cb81a4e 100644 --- a/sql/base/auth.sql +++ b/sql/base/auth.sql @@ -580,62 +580,6 @@ CREATE TABLE `pay_history` ( /*Data for the table `pay_history` */ -/*Table structure for table `project_member_premiums` */ - -DROP TABLE IF EXISTS `project_member_premiums`; - -CREATE TABLE `project_member_premiums` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `member_id` mediumint(8) NOT NULL, - `setdate` bigint(40) NOT NULL, - `unsetdate` bigint(40) NOT NULL, - `active` tinyint(1) NOT NULL DEFAULT '1', - `card_id` int(11) DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `fk__nighthold_member_premium__members1_idx` (`member_id`), - KEY `fk__nighthold_member_premiums__nighthold_member_items1_idx` (`card_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Premium Members'; - -/*Data for the table `project_member_premiums` */ - -/*Table structure for table `project_member_rewards` */ - -DROP TABLE IF EXISTS `project_member_rewards`; - -CREATE TABLE `project_member_rewards` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `member_id` int(10) unsigned NOT NULL, - `character_guid` int(10) unsigned NOT NULL, - `account_id` int(10) unsigned NOT NULL, - `realmid` int(10) unsigned NOT NULL, - `source_type` tinyint(3) unsigned NOT NULL, - `source_id` int(10) unsigned NOT NULL, - `reward_amount` int(10) unsigned NOT NULL, - `reward_date` int(10) unsigned NOT NULL, - `reward_day` int(10) unsigned NOT NULL COMMENT 'Used only for indexing purposes', - `processed` tinyint(3) unsigned NOT NULL DEFAULT '0', - `process_date` int(10) unsigned NOT NULL DEFAULT '0', - PRIMARY KEY (`id`), - KEY `member_id_reward_day_source_type` (`member_id`,`reward_day`,`source_type`), - KEY `idx__member_id` (`member_id`), - KEY `idx__processed` (`processed`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Member Rewards'; - -/*Data for the table `project_member_rewards` */ - -/*Table structure for table `project_member_settings` */ - -DROP TABLE IF EXISTS `project_member_settings`; - -CREATE TABLE `project_member_settings` ( - `member_id` int(10) unsigned NOT NULL, - `setting` int(10) unsigned NOT NULL COMMENT 'nightholdMemberInfo::Setting in core', - `value` varchar(255) NOT NULL, - PRIMARY KEY (`member_id`,`setting`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Member Settings'; - -/*Data for the table `project_member_settings` */ - /*Table structure for table `promocodes` */ DROP TABLE IF EXISTS `promocodes`; diff --git a/sql/updates/master/world/2023_11_10_auth.sql b/sql/updates/master/world/2023_11_10_auth.sql new file mode 100644 index 000000000..159c3a2d8 --- /dev/null +++ b/sql/updates/master/world/2023_11_10_auth.sql @@ -0,0 +1,4 @@ +-- Drop non-used custom tables +DROP TABLE IF EXISTS `project_member_premiums`; +DROP TABLE IF EXISTS `project_member_rewards`; +DROP TABLE IF EXISTS `project_member_settings`; diff --git a/sql/updates/master/world/2023_11_10_world_trinity_string.sql b/sql/updates/master/world/2023_11_10_world_trinity_string.sql new file mode 100644 index 000000000..600e11f42 --- /dev/null +++ b/sql/updates/master/world/2023_11_10_world_trinity_string.sql @@ -0,0 +1,4 @@ +-- trinity_string +DELETE FROM `trinity_string` WHERE `entry`=15005; +INSERT INTO `trinity_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`, `content_loc9`, `content_loc10`, `content_loc11`, `content_female`, `content_female_loc1`, `content_female_loc2`, `content_female_loc3`, `content_female_loc4`, `content_female_loc5`, `content_female_loc6`, `content_female_loc7`, `content_female_loc8`, `content_female_loc9`, `content_female_loc10`, `content_female_loc11`) VALUES +(15005, 'Your new balance is:', NULL, NULL, 'Deine neues Guthaben beträgt:', '您的余额:', '您的余額', NULL, NULL, 'Ваш остаток на балансе:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); diff --git a/src/server/game/BattlePay/BattlePayMgr.cpp b/src/server/game/BattlePay/BattlePayMgr.cpp index 668ce2291..3c1c69cb6 100644 --- a/src/server/game/BattlePay/BattlePayMgr.cpp +++ b/src/server/game/BattlePay/BattlePayMgr.cpp @@ -583,9 +583,6 @@ void BattlePayMgr::SendBattlePayProductList(WorldSession* session) if (product->Id == BATTLE_PAY_SERVICE_BOOST) if (session->HasBoost()) hasProduct = true; - if (product->Id == BATTLE_PAY_SERVICE_PREMIUM) - if (session->IsPremium()) - hasProduct = true; } else if (product->Type == BATTLE_PAY_PRODUCT_TYPE_ITEM) { @@ -936,9 +933,6 @@ void BattlePayMgr::SendBattlePayPurchaseUpdate(PurchaseInfo* purchase) BattlePayProduct* product = GetProductId(purchase->ProductId); if (product->Id == BATTLE_PAY_SERVICE_BOOST && purchase->GetSession()->HasBoost()) validPurchase = false; - if (product->Id == BATTLE_PAY_SERVICE_PREMIUM && purchase->GetSession()->IsPremium()) - validPurchase = false; - uint32 serverToken = irand(1, 999999); // temp solution @@ -995,11 +989,6 @@ void BattlePayMgr::SendBattlePayPurchaseUpdate(PurchaseInfo* purchase) SetBoosting(purchase->GetSession(), purchase->GetSession()->GetAccountId(), true); SendBattlePayDistributionUpdate(purchase->GetSession(), BATTLE_PAY_SERVICE_BOOST, CHARACTER_BOOST_ALLOW); } - if (product->Id == BATTLE_PAY_SERVICE_PREMIUM) - if (!purchase->GetSession()->IsPremium()) - { - //purchase->GetSession()->SetPremium(true); - } } else if (product->Type == BATTLE_PAY_PRODUCT_TYPE_ITEM) { diff --git a/src/server/game/BattlePay/ServiceBoost.cpp b/src/server/game/BattlePay/ServiceBoost.cpp index 77184b869..4e92bc374 100644 --- a/src/server/game/BattlePay/ServiceBoost.cpp +++ b/src/server/game/BattlePay/ServiceBoost.cpp @@ -68,13 +68,7 @@ void SetBoosting(WorldSession* session, uint32 accountId, bool boost) if (sWorld->getBoolConfig(CONFIG_BOOST_PROMOTION) && !boost) { - uint32 memberId = sWorld->GetprojectMemberID(accountId); - auto promoted = LoginDatabase.PQuery("SELECT member_id FROM boost_promotion_executed WHERE member_id = '%d'", memberId); - if (!promoted) - { - LoginDatabase.PExecute("INSERT INTO boost_promotion_executed (member_id) VALUES ('%d')", memberId); - return; - } + // to be impl new here } uint32 counter = 0; @@ -643,9 +637,8 @@ void CharacterBooster::_HandleCharacterBoost() const if (sWorld->getBoolConfig(CONFIG_BOOST_PROMOTION)) { - auto promoted = LoginDatabase.PQuery("SELECT member_id FROM boost_promotion_executed WHERE member_id = '%d'", sWorld->GetprojectMemberID(GetSession()->GetAccountId())); auto paid = LoginDatabase.PQuery("SELECT counter FROM account_boost WHERE id = '%d' AND realmid = '%d' AND counter > 0", GetSession()->GetAccountId(), realmID); - if (promoted && !paid) + if (!paid) return; } diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 9299f7268..65ee856e2 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -393,9 +393,6 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer) for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) if (Player* player = sObjectAccessor->FindPlayer(*itr)) { - if (sWorld->AreprojectDailyQuestsEnabled() && player->HasAura(SPELL_LIEUTENANT)) - player->CreditprojectDailyQuest(180014); // project Daily Quest Credit - Wintergrasp First Lieutenant Participation - RemoveAurasFromPlayer(player); } @@ -648,7 +645,6 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim) if (player->GetDistance2d(killer) < 40) { PromotePlayer(player); - player->CreditprojectDailyQuest(180010); // project Daily Quest Credit - Outdoor PvP Honorable Kill } return; } diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 550813379..a20775cec 100644 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -1317,52 +1317,6 @@ void Battleground::EndBattleground(uint32 winner) sBattlegroundMgr->EnqueueNewGameStat(stat); } - if (sWorld->AreprojectDailyQuestsEnabled()) - { - for (BattlegroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) - { - if (Player* player = _GetPlayer(itr, "EndBattleground")) - { - bool won = itr->second.Team == winner; - if (winnerArenaTeam && loserArenaTeam && winnerArenaTeam != loserArenaTeam || // ARENA_NORMAL - GetStatus() == STATUS_WAIT_JOIN || // ARENA_TIMEOUT - m_winner == WINNER_NONE || // ARENA_NO_WINNERS - m_Players.empty()) // ARENA_NO_WINNERS - { - if (GetArenaType() == ARENA_TYPE_3v3) - player->CreditprojectDailyQuest(180015); // project Daily Quest Credit - 3v3 Arena Participation - if (won) - player->CreditprojectDailyQuest(180003); // project Daily Quest Credit - Any Arena Victory - player->CreditprojectDailyQuest(180002); // project Daily Quest Credit - Any Arena Participation - } - else // BG_DEFAULT - { - if (IsArena()) // Unrated arenas end up here. - break; - if (won) - player->CreditprojectDailyQuest(180001); // project Daily Quest Credit - Any Battleground Victory - player->CreditprojectDailyQuest(180000); // project Daily Quest Credit - Any Battleground Participation - player->CreditprojectDailyQuest(180100 + GetTypeID()); // project Daily Quest Credit - * Participation - auto itr = PlayerScores.find(player->GetGUID()); - if (itr != PlayerScores.end() && itr->second) - { - if (uint32 damage = itr->second->DamageDone / 1000) - player->CreditprojectDailyQuest(180004, damage); // project Daily Quest Credit - Battleground Damage Dealt - if (uint32 heal = itr->second->HealingDone / 1000) - player->CreditprojectDailyQuest(180005, heal); // project Daily Quest Credit - Battleground Damage Healed - if (uint32 kills = itr->second->HonorableKills) - player->CreditprojectDailyQuest(180009, kills); // project Daily Quest Credit - Battleground Honorable Kill - } - if (IsRatedBG()) - { - if (won) - player->CreditprojectDailyQuest(180019); // project Daily Quest Credit - Solo 3v3 Arena Victory - player->CreditprojectDailyQuest(180020); // project Daily Quest Credit - Solo 3v3 Arena Participation - } - } - } - } - } } uint32 Battleground::GetBonusHonorFromKill(uint32 kills) const diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp index b41af386b..04a32f679 100644 --- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp +++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp @@ -164,146 +164,6 @@ bool BattlegroundQueue::SelectionPool::AddGroup(GroupQueueInfo* ginfo, uint32 de /*** BATTLEGROUND QUEUES ***/ /*********************************************************/ -bool QueueAnnounceContext::IsEnabled(BattlegroundTypeId bgTypeId, bool isRated, bool isSolo) -{ - if (BattlegroundMgr::IsArenaType(bgTypeId)) - return isRated && sWorld->getBoolConfig(isSolo ? CONFIG_ICORE_QUEUE_ANNOUNCE_ARENA_SOLO : CONFIG_ICORE_QUEUE_ANNOUNCE_ARENA); - return sWorld->getBoolConfig(CONFIG_ICORE_QUEUE_ANNOUNCE_BATTLEGROUND); -} - -void QueueAnnounceContext::Announce() const -{ - if (!IsEnabled(GroupInfo.BgTypeId, GroupInfo.IsRated, IsSolo)) - return; - - bool isArena = BattlegroundMgr::IsArenaType(GroupInfo.BgTypeId); - Battleground* bg = isArena ? nullptr : sBattlegroundMgr->GetBattlegroundTemplate(GroupInfo.BgTypeId); - PvPDifficultyEntry const* bracket = bg ? GetBattlegroundBracketById(bg->GetMapId(), BracketId) : nullptr; - auto builder = [this, isArena, bg, bracket](std::vector& packets, LocaleConstant locale) - { - std::string text; - if (isArena) - { - switch (GroupInfo.ArenaType) - { - case ARENA_TYPE_2v2: - case ARENA_TYPE_3v3: - case ARENA_TYPE_5v5: - if (IsSolo) - { - //[Solo]: joined with %u MMR, %u %u in queue - text = Format(sObjectMgr->GetTrinityString(SoloSpec == SoloQueueRole::Healer ? LANG_QUEUE_ANNOUNCE_ARENA_SOLO_H : LANG_QUEUE_ANNOUNCE_ARENA_SOLO_D, locale), - GroupInfo.ArenaMatchmakerRating, - QueuedA, QueuedH); - } - else - { - //[%uv%u]: Team joined with %u MMR, %u teams in queue - text = Format(sObjectMgr->GetTrinityString(LANG_QUEUE_ANNOUNCE_ARENA, locale), - (uint32)GroupInfo.ArenaType, (uint32)GroupInfo.ArenaType, - GroupInfo.ArenaMatchmakerRating, - QueuedA + QueuedH); - } - break; - } - } - else - { - if (!bg || !bracket) - return; - - if (sWorld->getBoolConfig(CONFIG_BATTLEGROUND_IGNORE_FACTION)) - { - //[%s (%u-%u)]: %u players joined, %u/%u in queue - text = Format(sObjectMgr->GetTrinityString(LANG_QUEUE_ANNOUNCE_BATTLEGROUND_N, locale), - bg->GetName(locale), - bracket->minLevel, bracket->maxLevel, - GroupInfo.Players.size(), - QueuedA + QueuedH, bg->GetMinPlayersPerTeam() * 2); - } - else - { - TrinityStrings textId; - switch (GroupInfo.Team) - { - case ALLIANCE: textId = LANG_QUEUE_ANNOUNCE_BATTLEGROUND_A; break; - case HORDE: textId = LANG_QUEUE_ANNOUNCE_BATTLEGROUND_H; break; - } - - //[%s (%u-%u)]: %u players joined, %u/%u %u/%u in queue - text = Format(sObjectMgr->GetTrinityString(textId, locale), - bg->GetName(locale), - bracket->minLevel, bracket->maxLevel, - GroupInfo.Players.size(), - QueuedH, bg->GetMinPlayersPerTeam(), - QueuedA, bg->GetMinPlayersPerTeam()); - } - } - WorldPacket* data = new WorldPacket(); - ChatHandler::BuildChatPacket(*data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, 0, 0, text); - packets.push_back(data); - }; - Trinity::LocalizedPacketListDo sender { builder }; - for (auto&& session : sWorld->GetAllSessions()) - { - Player* player = session.second->GetPlayer(); - projectMemberInfo* info = session.second->GetprojectMemberInfo(); - if (!player || !info) - continue; - - // Don't show to players in the wrong level range - if (bracket && (player->GetLevel() < bracket->minLevel || player->GetLevel() > bracket->maxLevel)) - continue; - - Show setting = info->GetSetting(isArena ? projectMemberInfo::Setting::QueueAnnounceArenaHorizon : projectMemberInfo::Setting::QueueAnnounceBattlegroundHorizon).As(); - - // Always show for the players that just queued - if (GroupInfo.Players.find(player->GetGUID()) != GroupInfo.Players.end()) - setting = Show::Always; - - switch (setting) - { - case Show::Never: - continue; - case Show::WhileInSameQueue: - { - BattlegroundQueueTypeId queue = BattlegroundMgr::BGQueueTypeId(GroupInfo.BgTypeId, GroupInfo.ArenaType); - if (!player->InBattlegroundQueueForBattlegroundQueueType(queue)) - continue; - //[[fallthrough]] - } - case Show::WhileQueued: - if (IsSolo) - { - if (!player->InBattlegroundQueueForBattlegroundQueueType(BATTLEGROUND_QUEUE_SOLO)) - continue; - } - else if (isArena) - { - if (!player->InBattlegroundQueueForBattlegroundQueueType(BATTLEGROUND_QUEUE_2v2) && - !player->InBattlegroundQueueForBattlegroundQueueType(BATTLEGROUND_QUEUE_3v3) && - !player->InBattlegroundQueueForBattlegroundQueueType(BATTLEGROUND_QUEUE_5v5)) - continue; - } - else - { - if (!player->InBattlegroundQueue()) - continue; - } - //[[fallthrough]] - case Show::Always: - sender(player); - - if (!session.second->queueAnnounceSent) - { - session.second->queueAnnounceSent = true; - ChatHandler(player).SendSysMessage(LANG_QUEUE_ANNOUNCE_INFO); - } - break; - } - } -} - // add group or player (grp == NULL) to bg queue with the given leader and bg specifications GroupQueueInfo* BattlegroundQueue::AddGroup(Player* leader, Group* grp, BattlegroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 arenaType, bool isRated, bool isPremade, uint32 arenaRating, uint32 matchmakerRating) { @@ -442,26 +302,6 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player* leader, Group* grp, Battlegr //ACE_Guard guard(m_Lock); m_QueuedGroups[bracketId][index].push_back(ginfo); - //announce personal - if (QueueAnnounceContext::IsEnabled(bgTypeId, isRated, m_isSolo)) - { - auto& queueA = m_QueuedGroups[bracketId][isRated || isPremade ? BG_QUEUE_PREMADE_ALLIANCE : BG_QUEUE_NORMAL_ALLIANCE]; - auto& queueH = m_QueuedGroups[bracketId][isRated || isPremade ? BG_QUEUE_PREMADE_HORDE : BG_QUEUE_NORMAL_HORDE ]; - //ArenaTeam* team = sArenaTeamMgr->GetArenaTeamById(ginfo->ArenaTeamId); - QueueAnnounceContext - { - true, - *ginfo, - bracketId, - isPremade, - m_isSolo, - m_isSolo ? ginfo->Players.begin()->second->Role : SoloQueueRole::None, - m_isSolo ? m_damagersCount : BattlegroundMgr::IsArenaType(bgTypeId) ? uint32(queueA.size()) : std::accumulate(queueA.begin(), queueA.end(), 0u, [](uint32 a, GroupQueueInfo* b) { return a + (b->IsInvitedToBGInstanceGUID ? 0 : b->Players.size()); }), - m_isSolo ? m_healersCount : BattlegroundMgr::IsArenaType(bgTypeId) ? uint32(queueH.size()) : std::accumulate(queueH.begin(), queueH.end(), 0u, [](uint32 a, GroupQueueInfo* b) { return a + (b->IsInvitedToBGInstanceGUID ? 0 : b->Players.size()); }), - "", //team ? team->GetName() : "", - }.Announce(); - } - //announce to world, this code needs mutex if (!isRated && !isPremade && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE)) { diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.h b/src/server/game/Battlegrounds/BattlegroundQueue.h index 03489671c..4d57d6533 100644 --- a/src/server/game/Battlegrounds/BattlegroundQueue.h +++ b/src/server/game/Battlegrounds/BattlegroundQueue.h @@ -73,30 +73,6 @@ enum BattlegroundQueueGroupTypes }; #define BG_QUEUE_GROUP_TYPES_COUNT 4 -struct QueueAnnounceContext -{ - enum class Show : uint32 - { - Never, - WhileInSameQueue, - WhileQueued, - Always, - }; - - bool Enter; - GroupQueueInfo const& GroupInfo; - BattlegroundBracketId BracketId; - bool IsPremade; - bool IsSolo; - SoloQueueRole SoloSpec; - uint32 QueuedA; - uint32 QueuedH; - std::string ArenaTeamName; - - static bool IsEnabled(BattlegroundTypeId bgTypeId, bool isRated, bool isSolo); - void Announce() const; -}; - class Battleground; class BattlegroundQueue { diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index bf9eb1a91..815505eab 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -55,142 +55,7 @@ static void AlmostAssert(char const* filter, Args... args) namespace lfg { -bool QueueAnnounceContextLFG::IsEnabled() -{ - return sWorld->getBoolConfig(CONFIG_ICORE_QUEUE_ANNOUNCE_RAID); -} - -void QueueAnnounceContextLFG::Announce() const -{ - LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(DungeonId); - if (!dungeon) - return; - - if (!IsEnabled()) - return; - - if (dungeon->difficulty != RAID_DIFFICULTY_25MAN_LFR) - return; - - sWorld->SendRaidQueueInfo(); - - auto builder = [this, dungeon](std::vector& packets, LocaleConstant locale) - { - auto& queue = sLFGMgr->GetQueueManager(Queuers.begin()->first).GetQueue(dungeon->ID); - uint32 queuedTanks = queue.GetTotalPlayers(PLAYER_ROLE_TANK); - uint32 queuedHealers = queue.GetTotalPlayers(PLAYER_ROLE_HEALER); - uint32 queuedDPS = queue.GetTotalPlayers(PLAYER_ROLE_DAMAGE); - - std::string roleStr; - if (Queuers.size() == 1) - { - uint32 role = Queuers.begin()->second & ~PLAYER_ROLE_LEADER; - switch (role) - { - case PLAYER_ROLE_TANK: roleStr += "|cFF00AEF01 |TInterface\\LFGFrame\\UI-LFG-ICON-PORTRAITROLES:0:0:1:-1:64:64:0:18:22:40|t"; break; - case PLAYER_ROLE_HEALER: roleStr += "|cFF00FF441 |TInterface\\LFGFrame\\UI-LFG-ICON-PORTRAITROLES:0:0:1:-1:64:64:20:38:1:19|t"; break; - case PLAYER_ROLE_DAMAGE: roleStr += "|cFFF00A0A1 |TInterface\\LFGFrame\\UI-LFG-ICON-PORTRAITROLES:0:0:1:-1:64:64:20:38:22:40|t"; break; - default: roleStr += "|cFFF00A0A1 |TInterface\\LFGFrame\\UI-LFG-ICON-PORTRAITROLES:0:0:1:-1:64:64:20:38:22:40|t"; break; - } - roleStr += locale == LOCALE_ruRU ? " |cFFFFFFFFвступил" : " |cFFFFFFFFjoined"; - } - else - roleStr = Format("%u %s", (uint32)Queuers.size(), locale == LOCALE_ruRU ? "|4игрок|r|cFFFFFFFF вступил:игрока|r|cFFFFFFFF вступили:игроков|r|cFFFFFFFF вступило;" : "|4player:players;|r|cFFFFFFFF joined"); - - //[Raid: %s]: %s joined, %u %u %u in queue - std::string text = Format(sObjectMgr->GetTrinityString(LANG_QUEUE_ANNOUNCE_RAID, locale), - dungeon->name[locale], roleStr.c_str(), queuedTanks, queuedHealers, queuedDPS); - - WorldPacket* data = new WorldPacket(); - ChatHandler::BuildChatPacket(*data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, 0, 0, text); - packets.push_back(data); - }; - Trinity::LocalizedPacketListDo sender{ builder }; - for (auto&& session : sWorld->GetAllSessions()) - { - Player* player = session.second->GetPlayer(); - projectMemberInfo* info = session.second->GetprojectMemberInfo(); - if (!player || !info) - continue; - - // Don't show to players in the wrong level range - if (dungeon && (player->GetLevel() < dungeon->minlevel || player->GetLevel() > dungeon->maxlevel)) - continue; - - Show setting = info->GetSetting(projectMemberInfo::Setting::QueueAnnounceRaidFinder).As(); - - // Always show for the players that just queued - if (Queuers.find(player->GetGUID()) != Queuers.end()) - setting = Show::Always; - - uint64 gguid = player->GetGroup() ? player->GetGroup()->GetGUID() : player->GetGUID(); - switch (setting) - { - case Show::Never: - continue; - case Show::WhileInSameQueue: - { - if (!player->IsUsingLfg()) - continue; - - bool found = false; - if (auto queues = sLFGMgr->GetPlayerQueues(player->GetGUID())) - { - for (auto&& itr : *queues) - { - // TODO: We can check only state, no? - if (sLFGMgr->GetQueueManager(Queuers.begin()->first).Contains(Queuer{ gguid, itr.first })) - { - found = true; - break; - } - } - } - if (!found) - continue; - - //[[fallthrough]]; - } - case Show::WhileQueued: - { - if (!player->IsUsingLfg()) - continue; - bool found = false; - if (auto queues = sLFGMgr->GetPlayerQueues(player->GetGUID())) - { - for (auto&& itr : *queues) - { - auto& dungeons = itr.second.Dungeons; - if (std::any_of(dungeons.begin(), dungeons.end(), [](uint32 dungeonId) - { - if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId)) - return dungeon->difficulty == RAID_DIFFICULTY_25MAN_LFR; - return false; - })) - { - found = true; - break; - } - } - } - if (!found) - continue; - - //[[fallthrough]]; - } - case Show::Always: - sender(player); - - if (!session.second->queueAnnounceSent) - { - session.second->queueAnnounceSent = true; - ChatHandler(player).SendSysMessage(LANG_QUEUE_ANNOUNCE_INFO); - } - break; - } - } -} LFGMgr::LFGMgr(): m_QueueTimer(0), m_ShortageCheckTimer(0), m_lfgProposalId(1), m_options(sWorld->getIntConfig(CONFIG_LFG_OPTIONSMASK)) @@ -936,14 +801,6 @@ void LFGMgr::JoinLfg(Player* player, LfgRoles roles, LfgDungeonSet& dungeons, co if (!roles) role = PLAYER_ROLE_DAMAGE; - if (QueueAnnounceContextLFG::IsEnabled() && isRaid && !dungeons.empty()) - { - QueueAnnounceContextLFG - { - *dungeons.begin(), - { { guid, role } }, - }.Announce(); - } } if (sLog->ShouldLog("lfg", LOG_LEVEL_DEBUG)) @@ -1235,16 +1092,6 @@ void LFGMgr::UpdateRoleCheck(uint64 gguid, uint64 guid /* = 0 */, uint8 roles /* } } - // announce personal - if (QueueAnnounceContextLFG::IsEnabled() && roleCheck.raid && !roleCheck.rDungeonId && !roleCheck.dungeons.empty()) - { - QueueAnnounceContextLFG - { - *roleCheck.dungeons.begin(), - roleCheck.roles, - }.Announce(); - } - RoleChecksStore.erase(itRoleCheck); } else if (roleCheck.state != LFG_ROLECHECK_INITIALITING) @@ -2317,24 +2164,6 @@ void LFGMgr::FinishDungeon(uint64 gguid, uint32 dungeonId, Map* map) } } - // Award daily quest credit - if (sWorld->AreprojectDailyQuestsEnabled()) - { - player->CreditprojectDailyQuest(180017); // project Daily Quest Credit - Random Dungeon - if (Group* group = sGroupMgr->GetGroupByGUID(gguid)) - { - for (auto&& slot : group->GetMemberSlots()) - { - if (slot.guid == guid) - { - if (slot.roles & (PLAYER_ROLE_TANK | PLAYER_ROLE_HEALER | PLAYER_ROLE_DAMAGE)) - player->CreditprojectDailyQuest(slot.roles & PLAYER_ROLE_TANK ? 180006 : slot.roles & PLAYER_ROLE_HEALER ? 180007 : 180008); // project Daily Quest Credit - Random Dungeons as * - if (slot.roles & (PLAYER_ROLE_TANK | PLAYER_ROLE_HEALER)) - player->CreditprojectDailyQuest(180016); // project Daily Quest Credit - Random Dungeons as Tank or Healer - } - } - } - } if (queueData.CTARoles != PLAYER_ROLE_NONE && player->GetGroup() && (player->GetGroup()->GetLfgRoles(guid) & ~PLAYER_ROLE_LEADER) == queueData.CTARoles) { diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h index 93ff3bea0..e8721a5a8 100644 --- a/src/server/game/DungeonFinding/LFGMgr.h +++ b/src/server/game/DungeonFinding/LFGMgr.h @@ -32,16 +32,6 @@ class Quest; namespace lfg { -struct QueueAnnounceContextLFG -{ - using Show = QueueAnnounceContext::Show; - - uint32 DungeonId; - LfgRolesMap const& Queuers; - - static bool IsEnabled(); - void Announce() const; -}; enum LfgOptions { diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp index e47025803..092a67418 100644 --- a/src/server/game/Entities/Creature/GossipDef.cpp +++ b/src/server/game/Entities/Creature/GossipDef.cpp @@ -463,7 +463,6 @@ void PlayerMenu::SendQuestGiverStatus(uint32 questStatus, uint64 npcGUID) const void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID, bool activateAccept, bool startedByAreaTrigger) const { - projectMemberInfo* info = quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_project_DAILY_QUEST) ? _session->GetprojectMemberInfo() : nullptr; std::string questTitle = quest->GetTitle(); std::string questDetails = quest->GetDetails(); @@ -510,10 +509,6 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID, uint32 id = quest->RewardItemId[i]; uint32 count = quest->RewardItemIdCount[i]; - // Add fake reward item for premium players - if (info) - info->ModifyQuestReward(quest, i, id, count); - if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(id)) rewItemDisplayId[i] = itemTemplate->DisplayInfoID; else @@ -588,7 +583,7 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID, data << uint32(quest->GetFlags2()); data << uint32(0); // should be quest->GetRewSpellCast(), but need to know in which cases this need sends data << uint32(quest->RewardChoiceItemId[3]); - data << uint32(quest->GetRewItemsCount() + (info && info->GetPremiumQuestRewardBonus(quest) ? 1 : 0) + (info && info->GetVotingQuestRewardBonus(quest) ? 1 : 0)); + data << uint32(quest->GetRewItemsCount()); data << uint32(quest->GetRewardSkillPoints()); data << uint32(rewItemDisplayId[0]); data << uint32(quest->RewardChoiceItemId[4]); @@ -671,7 +666,6 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID, void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const { - projectMemberInfo* info = quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_project_DAILY_QUEST) ? _session->GetprojectMemberInfo() : nullptr; std::string questTitle = quest->GetTitle(); std::string questDetails = quest->GetDetails(); @@ -707,10 +701,6 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const uint32 id = quest->RewardItemId[i]; uint32 count = quest->RewardItemIdCount[i]; - // Add fake reward item for premium players - if (info) - info->ModifyQuestReward(quest, i, id, count); - rewInfo.push_back(std::make_pair(id, count)); } @@ -864,7 +854,6 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGuid, bool enableNext) const { - projectMemberInfo* info = quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_project_DAILY_QUEST) ? _session->GetprojectMemberInfo() : nullptr; std::string questTitle = quest->GetTitle(); std::string questOfferRewardText = quest->GetOfferRewardText(); @@ -899,10 +888,6 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGuid, b uint32 id = quest->RewardItemId[i]; uint32 count = quest->RewardItemIdCount[i]; - // Add fake reward item for premium players - if (info) - info->ModifyQuestReward(quest, i, id, count); - ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(id); rewItemDisplayId[i] = itemTemplate ? itemTemplate->DisplayInfoID : 0; @@ -982,7 +967,7 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGuid, b data << uint32(quest->XPValue(_session->GetPlayer()) * sWorld->getRate(RATE_XP_QUEST)); data << uint32(quest->GetCharTitleId()); data << uint32(quest->RewardChoiceItemId[2]); - data << uint32(quest->GetRewItemsCount() + (info && info->GetPremiumQuestRewardBonus(quest) ? 1 : 0) + (info && info->GetVotingQuestRewardBonus(quest) ? 1 : 0)); + data << uint32(quest->GetRewItemsCount()); data << uint32(quest->GetSuggestedPlayers()); data << uint32(quest->RewardChoiceItemId[4]); data << uint32(questEnderEntry); diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 04a7f3bc6..eb62d09e1 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -1515,8 +1515,6 @@ void GameObject::Use(Unit* user) { player->UpdateFishingSkill(); - player->CreditprojectDailyQuest(182000 + GetZoneId()); // project Daily Quest Credit - Fishing - * - /// @todo I do not understand this hack. Need some explanation. // prevent removing GO at spell cancel RemoveFromOwner(); diff --git a/src/server/game/Entities/Player/KillRewarder.cpp b/src/server/game/Entities/Player/KillRewarder.cpp index 4252bf35c..ebb5b45f6 100644 --- a/src/server/game/Entities/Player/KillRewarder.cpp +++ b/src/server/game/Entities/Player/KillRewarder.cpp @@ -186,7 +186,6 @@ void KillRewarder::RewardKillCredit(Player* player) if (Creature* target = _victim->ToCreature()) { player->KilledMonster(target->GetCreatureTemplate(), target->GetGUID()); - player->CreditprojectDailyQuest(target->GetEntry()); player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE_TYPE, target->GetCreatureType(), 1, 0, target); if (Guild* guild = sGuildMgr->GetGuildById(player->GetGuildId())) @@ -198,14 +197,6 @@ void KillRewarder::RewardKillCredit(Player* player) guild->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, target->GetEntry(), 1, 0, target, player); } } - - if (sWorld->AreprojectDailyQuestsEnabled()) - { - if (uint32 type = target->GetCreatureType()) - player->CreditprojectDailyQuest(180300 + type); // project Daily Quest Credit - * - if (uint32 family = target->GetCreatureTemplate()->family) - player->CreditprojectDailyQuest(180400 + family); // project Daily Quest Credit - * - } } } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index ba406e3d1..27c2f7ad7 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -3022,9 +3022,6 @@ void Player::GiveLevel(uint8 level) SetSaveTimer(1); - if (!(level % 10) && oldLevel < level) - if (projectMemberInfo* info = GetSession()->GetprojectMemberInfo()) - info->Notify(this, projectMemberInfo::Notification::LevelUp); } void Player::InitTalentForLevel() @@ -16228,19 +16225,6 @@ bool Player::CanRewardQuest(Quest const* quest, uint32 reward, bool msg) } } - if (quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_project_DAILY_QUEST)) - { - if (!sWorld->AreprojectDailyQuestsEnabled()) - return false; - - projectMemberInfo* info = GetSession()->GetprojectMemberInfo(); - if (!info || !info->CanCompleteMoreDailyQuests()) - return false; - - if (info->CompletedDailyQuestExclusiveGroups.find(quest->GetExclusiveGroup()) != info->CompletedDailyQuestExclusiveGroups.end()) - return false; - } - uint32 count = 0; if (quest->GetRewardPackageItemId()) { @@ -16588,11 +16572,6 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, { uint32 count = quest->RewardItemIdCount[i]; - // Increase reward for premium players - if (i == 0 && quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_project_DAILY_QUEST)) - if (projectMemberInfo* info = GetSession()->GetprojectMemberInfo()) - count += info->GetPremiumQuestRewardBonus(quest) + info->GetVotingQuestRewardBonus(quest); - ItemPosCountVec dest; if (CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count) == EQUIP_ERR_OK) { @@ -16690,7 +16669,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, CharacterDatabase.CommitTransaction(trans); } - if (quest->IsDaily() && !quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_project_DAILY_QUEST) || quest->IsDFQuest()) + if (quest->IsDaily() || quest->IsDFQuest()) { SetDailyQuestStatus(quest_id); if (quest->IsDaily()) @@ -16729,15 +16708,12 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, else if (quest->GetRewSpell() > 0) CastSpell(this, quest->GetRewSpell(), true); - if (!quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_project_DAILY_QUEST)) - { - if (quest->GetZoneOrSort() > 0) - UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE, quest->GetZoneOrSort()); - UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT); - UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST, quest->GetQuestId()); - if (Guild* guild = GetGuild()) - guild->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_GUILD, 0, 0, 0, this, this); - } + if (quest->GetZoneOrSort() > 0) + UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE, quest->GetZoneOrSort()); + UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT); + UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST, quest->GetQuestId()); + if (Guild* guild = GetGuild()) + guild->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_GUILD, 0, 0, 0, this, this); if (uint32 questBit = GetQuestUniqueBitFlag(quest_id)) { @@ -16765,13 +16741,6 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, SetSaveTimer(1); - if (sWorld->AreprojectDailyQuestsEnabled()) - { - if (!quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_project_DAILY_QUEST)) - CreditprojectDailyQuest(180018); // project Daily Quest Credit - Quest Completed - else if (projectMemberInfo* info = GetSession()->GetprojectMemberInfo()) - info->Notify(this, projectMemberInfo::Notification::QuestComplete); - } } void Player::FailQuest(uint32 questId) @@ -17197,22 +17166,6 @@ bool Player::SatisfyQuestDay(Quest const* qInfo, bool msg) if (!qInfo->IsDaily() && !qInfo->IsDFQuest()) return true; - if (qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_project_DAILY_QUEST)) - { - if (!sWorld->AreprojectDailyQuestsEnabled()) - return false; - - // Skip native daily quest limit check - projectMemberInfo* info = GetSession()->GetprojectMemberInfo(); - if (!info || !info->CanCompleteMoreDailyQuests()) - return false; - - if (info->CompletedDailyQuestExclusiveGroups.find(qInfo->GetExclusiveGroup()) != info->CompletedDailyQuestExclusiveGroups.end()) - return false; - - return true; - } - return m_dailyquests.find(qInfo->GetQuestId()) == m_dailyquests.end(); } @@ -17781,23 +17734,6 @@ void Player::KilledMonsterCredit(uint32 entry, uint64 guid /*= 0*/, uint32 count SendQuestUpdateAddCredit(qInfo, questObjective, ObjectGuid(guid), currentCounter, addKillCount); - // Complete all objectives on completion of one - if (qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_project_DAILY_QUEST) && questObjective->Type == QUEST_OBJECTIVE_TYPE_NPC && GetQuestObjectiveCounter(questObjective->Id) >= uint32(questObjective->Amount)) - { - for (auto&& objective2 : qInfo->m_questObjectives) - { - if (questObjective->Id == objective2->Id || !objective2->Amount) - continue; - - uint16 c = GetQuestObjectiveCounter(objective2->Id); - uint32 r = objective2->Amount; - if (c >= r) - continue; - - m_questObjectiveStatus[objective2->Id] = objective2->Amount; - SendQuestUpdateAddCredit(qInfo, objective2, ObjectGuid(guid), c, r - c); - } - } } if (CanCompleteQuest(questId)) @@ -20010,19 +19946,6 @@ void Player::_LoadQuestStatus(PreparedQueryResult result) for (uint16 i = slot; i < MAX_QUEST_LOG_SIZE; ++i) SetQuestSlot(i, 0); - // Remove status of all daily quests, in case the player completed them on another character/account - if (sWorld->AreprojectDailyQuestsEnabled()) - { - if (projectMemberInfo* info = GetSession()->GetprojectMemberInfo()) - { - for (auto&& group : info->CompletedDailyQuestExclusiveGroups) - { - auto bounds = sObjectMgr->mExclusiveQuestGroups.equal_range(group); - for (auto itr = bounds.first; itr != bounds.second; ++itr) - RemoveActiveQuest(itr->second, false, true); - } - } - } } void Player::_LoadQuestObjectiveStatus(PreparedQueryResult result) @@ -24601,13 +24524,6 @@ bool Player::CanAlwaysSee(WorldObject const* obj) const if (obj->GetGUID() == guid) return true; - // Exploiting our visibility system to make summoned .premium NPCs only visible to the summoner - if (obj->GetEntry() >= 190000) - if (Unit const* unit = obj->ToUnit()) - if (TempSummon const* summon = unit->ToTempSummon()) - if (summon->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_project_NPC && summon->GetSummonerGUID() == GetGUID()) - return true; - return false; } @@ -30481,7 +30397,6 @@ void Player::SolveResearchProject(Spell* spell) UpdateResearchProjects(); - CreditprojectDailyQuest(180025); // project Daily Quest Credit - Artifacts } bool Player::HasCompletedAllRareProjectsForRace(uint32 researchBranchId) @@ -31151,34 +31066,6 @@ void Player::SetCanTurnWhileFalling(bool on) SendDirectMessage(&data); } -bool Player::CreditprojectDailyQuest(uint32 entry, uint32 count) -{ - if (!sWorld->AreprojectDailyQuestsEnabled()) - return true; - - auto&& quests = sWorld->GetprojectDailyQuestRelation(entry); - if (!quests) - return false; - - for (auto&& quest : *quests) - if (!IsActiveQuest(quest->GetQuestId())) - if (projectMemberInfo* info = GetSession()->GetprojectMemberInfo()) - if (info->CanCompleteMoreDailyQuests() && info->GetSetting(projectMemberInfo::Setting::AutoAcceptprojectDailyQuests).Bool) - if (CanTakeQuest(quest, false)) - if (!sPoolMgr->IsPartOfAPool(quest->GetQuestId()) || sPoolMgr->IsSpawnedObject(quest->GetQuestId())) - { - AddQuest(quest, nullptr); - - if (CanCompleteQuest(quest->GetQuestId())) - CompleteQuest(quest->GetQuestId()); - } - - if (std::any_of(quests->begin(), quests->end(), [this](Quest const* const& quest) { return IsActiveQuest(quest->GetQuestId()); })) - KilledMonsterCredit(entry, 0, count); - - return true; -} - std::list Player::GetAllItems() { std::list allItems; diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index a4539263b..fa5f5ccb5 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -3329,8 +3329,6 @@ class Player : public Unit, public GridObject float GetBonusRollExtraChance() const { return m_bonusRollBonusChance; } void SetBonusRollExtraChance(float value); - bool CreditprojectDailyQuest(uint32 entry, uint32 count = 1); - std::unordered_map overrideTexts; void AddOverrideText(uint32 id, std::string text) { diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp index 6b949c18e..54fad8114 100644 --- a/src/server/game/Handlers/AuctionHouseHandler.cpp +++ b/src/server/game/Handlers/AuctionHouseHandler.cpp @@ -314,11 +314,6 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER); if (!creature) { - if (IsPremium() && auctioneer == _player->GetGUID()) // for premium auc command - { - creature = sServiceMgr->GetPremiumAuc(GetPlayer()); - auctioneer = creature ? creature->GetGUID() : 0; - } if (!creature) { TC_LOG_DEBUG("network", "WORLD: HandleAuctionSellItem - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(auctioneer)); @@ -600,8 +595,6 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData) Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER); if (!creature) { - if (IsPremium() && auctioneer == _player->GetGUID()) // for premium auc command - creature = sServiceMgr->GetPremiumAuc(GetPlayer()); if (!creature) { TC_LOG_DEBUG("network", "WORLD: HandleAuctionPlaceBid - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer))); @@ -747,8 +740,6 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData) Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER); if (!creature) { - if (IsPremium() && auctioneer == _player->GetGUID()) // for premium auc command - creature = sServiceMgr->GetPremiumAuc(GetPlayer()); if (!creature) { TC_LOG_DEBUG("network", "WORLD: HandleAuctionRemoveItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer))); @@ -858,8 +849,6 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket& recvData) Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER); if (!creature) { - if (IsPremium() && auctioneer == _player->GetGUID()) // for premium auc command - creature = sServiceMgr->GetPremiumAuc(GetPlayer()); if (!creature) { TC_LOG_DEBUG("network", "WORLD: HandleAuctionListBidderItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer))); @@ -928,8 +917,6 @@ void WorldSession::HandleAuctionListOwnerItems(WorldPacket& recvData) Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER); if (!creature) { - if (IsPremium() && auctioneer == _player->GetGUID()) // for premium auc command - creature = sServiceMgr->GetPremiumAuc(GetPlayer()); if (!creature) { TC_LOG_DEBUG("network", "WORLD: HandleAuctionListOwnerItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer))); @@ -1010,8 +997,6 @@ void WorldSession::HandleAuctionListItems(WorldPacket& recvData) Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER); if (!creature) { - if (IsPremium() && auctioneer == _player->GetGUID()) // for premium auc command - creature = sServiceMgr->GetPremiumAuc(GetPlayer()); if (!creature) { TC_LOG_DEBUG("network", "WORLD: HandleAuctionListItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer))); diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp index 349734060..d07fd398d 100644 --- a/src/server/game/Handlers/BattleGroundHandler.cpp +++ b/src/server/game/Handlers/BattleGroundHandler.cpp @@ -210,8 +210,6 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recvData) TC_LOG_DEBUG("bg.battleground", "Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s", bgQueueTypeId, bgTypeId, _player->GetGUIDLow(), _player->GetName().c_str()); - if (projectMemberInfo* info = _player->GetSession()->GetprojectMemberInfo()) - info->Notify(_player, projectMemberInfo::Notification::BGRewards); } else { @@ -263,8 +261,6 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recvData) TC_LOG_DEBUG("bg.battleground", "Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s", bgQueueTypeId, bgTypeId, member->GetGUIDLow(), member->GetName().c_str()); - if (projectMemberInfo* info = member->GetSession()->GetprojectMemberInfo()) - info->Notify(member, projectMemberInfo::Notification::BGRewards); } TC_LOG_DEBUG("bg.battleground", "Battleground: group end"); } @@ -570,20 +566,6 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recvData*/) } } -std::function sendAnnounce = [](Player* player) -{ - projectMemberInfo::Notification notify = projectMemberInfo::Notification::ArenaQueue; - switch (urand(0, 3)) - { - case 0: notify = projectMemberInfo::Notification::ArenaQueue; break; - case 1: notify = projectMemberInfo::Notification::ArenaRewards; break; - case 2: notify = projectMemberInfo::Notification::ArenaWinStreak; break; - case 3: notify = projectMemberInfo::Notification::ArenaRBGRewards; break; - } - if (projectMemberInfo* info = player->GetSession()->GetprojectMemberInfo()) - info->Notify(player, notify); -}; - void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: CMSG_BATTLEMASTER_JOIN_ARENA"); @@ -679,7 +661,6 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recvData) TC_LOG_DEBUG("bg.battleground", "Battleground: player joined queue for arena as group bg queue type %u bg type %u: GUID %u, NAME %s", bgQueueTypeId, bgTypeId, member->GetGUIDLow(), member->GetName().c_str()); - sendAnnounce(member); } sBattlegroundMgr->ScheduleQueueUpdate(matchmakerRating, arenatype, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId()); @@ -901,24 +882,6 @@ void WorldSession::HandleRequestConquestFormulaConstants(WorldPacket& /*recvData void WorldSession::EnterSoloQueue(bool asGroup) { - if (projectMemberInfo* info = GetprojectMemberInfo()) - { - uint32 now = time(nullptr); - uint32 unbandate = info->GetSetting(projectMemberInfo::Setting::SoloArenaBanUnbanDate).UInt32; - std::string author = info->GetSetting(projectMemberInfo::Setting::SoloArenaBanBannedBy).String; - if (now < unbandate) - { - uint32 duration = unbandate - now; - std::string durationStr; - if (duration >= DAY) - durationStr = Format(GetTrinityString(LANG_SOLO_QUEUE_BAN_DURATION_DAYS), duration / DAY, (duration % DAY) / HOUR, ((duration % DAY) % HOUR) / MINUTE, ((duration % DAY) % HOUR) % MINUTE); - else - durationStr = Format(GetTrinityString(LANG_SOLO_QUEUE_BAN_DURATION), duration / HOUR, (duration % HOUR) / MINUTE, (duration % HOUR) % MINUTE); - - SendNotification(author.empty() ? LANG_SOLO_QUEUE_BANNED : LANG_SOLO_QUEUE_BANNED_BY, durationStr.c_str(), author.c_str()); - return; - } - } Battleground* bg = sBattlegroundMgr->GetBattlegroundTemplate(BATTLEGROUND_AA); if (!bg) @@ -1119,11 +1082,9 @@ void WorldSession::EnterSoloQueue(bool asGroup) sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, member, queueSlot, STATUS_WAIT_QUEUE, avgTime, ginfo->JoinTime, ARENA_TYPE_3v3); member->GetSession()->SendPacket(&data); - sendAnnounce(member); + } - if (projectMemberInfo* info = _player->GetSession()->GetprojectMemberInfo()) - info->Notify(_player, projectMemberInfo::Notification::BGRewards); } else { @@ -1135,7 +1096,6 @@ void WorldSession::EnterSoloQueue(bool asGroup) sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, GetPlayer(), queueSlot, STATUS_WAIT_QUEUE, avgTime, ginfo->JoinTime, ARENA_TYPE_3v3); SendPacket(&data); - sendAnnounce(GetPlayer()); } if (ginfo) diff --git a/src/server/game/Handlers/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp index 245dc02d5..fa7cb9593 100644 --- a/src/server/game/Handlers/GroupHandler.cpp +++ b/src/server/game/Handlers/GroupHandler.cpp @@ -353,9 +353,6 @@ void WorldSession::HandleGroupInviteResponseOpcode(WorldPacket& recvData) group->BroadcastGroupUpdate(); - if (group->isRaidGroup()) - if (projectMemberInfo* info = _player->GetSession()->GetprojectMemberInfo()) - info->Notify(_player, projectMemberInfo::Notification::RaidInvite); } else { diff --git a/src/server/game/Handlers/LFGHandler.cpp b/src/server/game/Handlers/LFGHandler.cpp index fb5977875..32639bdfd 100644 --- a/src/server/game/Handlers/LFGHandler.cpp +++ b/src/server/game/Handlers/LFGHandler.cpp @@ -975,13 +975,6 @@ void WorldSession::SendLfgPlayerReward(lfg::LfgPlayerRewardData const& rewardDat SendPacket(&data); - if (auto dungeon = sLFGDungeonStore.LookupEntry(rewardData.sdungeonEntry & 0xFFFFFF)) - { - if (dungeon->difficulty == SCENARIO_DIFFICULTY_NORMAL || dungeon->difficulty == SCENARIO_DIFFICULTY_HEROIC) - GetPlayer()->CreditprojectDailyQuest(180021); // project Daily Quest Credit - Scenario - if (dungeon->difficulty == RAID_DIFFICULTY_25MAN_LFR) - GetPlayer()->CreditprojectDailyQuest(180023); // project Daily Quest Credit - Raid Finder - } } void WorldSession::SendLfgBootProposalUpdate(lfg::LfgPlayerBoot const& boot) diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp index daf68e61c..cc9750774 100644 --- a/src/server/game/Handlers/MailHandler.cpp +++ b/src/server/game/Handlers/MailHandler.cpp @@ -109,7 +109,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData) if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX)) if (!GetPlayer()->GetNPCIfCanInteractWith(mailbox, UNIT_NPC_FLAG_MAILBOX)) - if (!IsPremium() || mailbox != GetPlayer()->GetGUID()) // for premium mail command + if (mailbox != GetPlayer()->GetGUID()) // for premium mail command { GetPlayer()->SendMailResult(0, MAIL_SEND, MAIL_ERR_SILENT); return; @@ -249,11 +249,8 @@ void WorldSession::HandleSendMail(WorldPacket& recvData) } } - uint32 myMemberId = sWorld->GetprojectMemberID(GetAccountId()); - uint32 receiverMemberId = sWorld->GetprojectMemberID(receiverAccountId); - if (!accountBound && player->GetTeam() != receiverTeam && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_MAIL) && - GetAccountId() != receiverAccountId && myMemberId != receiverMemberId && GetSecurity() == SEC_PLAYER) + GetAccountId() != receiverAccountId && GetSecurity() == SEC_PLAYER) { player->SendMailResult(0, MAIL_SEND, MAIL_ERR_NOT_YOUR_TEAM); return; @@ -423,7 +420,7 @@ void WorldSession::HandleMailMarkAsRead(WorldPacket& recvData) if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX)) if (!GetPlayer()->GetNPCIfCanInteractWith(mailbox, UNIT_NPC_FLAG_MAILBOX)) - if (!IsPremium() || mailbox != GetPlayer()->GetGUID()) // for premium mail command + if (mailbox != GetPlayer()->GetGUID()) // for premium mail command return;// Mail interactions on client don't get locked up when this action is performed, thus no result packet is needed if (Mail* mail = _player->GetMail(mailId)) @@ -580,7 +577,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket& recvData) if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX)) if (!GetPlayer()->GetNPCIfCanInteractWith(mailbox, UNIT_NPC_FLAG_MAILBOX)) - if (!IsPremium() || mailbox != GetPlayer()->GetGUID()) // for premium mail command + if (mailbox != GetPlayer()->GetGUID()) // for premium mail command { GetPlayer()->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_SILENT); return; @@ -733,7 +730,7 @@ void WorldSession::HandleMailTakeMoney(WorldPacket& recvData) if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX)) if (!GetPlayer()->GetNPCIfCanInteractWith(mailbox, UNIT_NPC_FLAG_MAILBOX)) - if (!IsPremium() || mailbox != GetPlayer()->GetGUID()) // for premium mail command + if (mailbox != GetPlayer()->GetGUID()) // for premium mail command { GetPlayer()->SendMailResult(mailId, MAIL_MONEY_TAKEN, MAIL_ERR_SILENT); return; @@ -813,7 +810,7 @@ void WorldSession::HandleGetMailList(WorldPacket& recvData) if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX)) if (!GetPlayer()->GetNPCIfCanInteractWith(mailbox, UNIT_NPC_FLAG_MAILBOX)) - if (!IsPremium() || mailbox != GetPlayer()->GetGUID()) // for premium mail command + if (mailbox != GetPlayer()->GetGUID()) // for premium mail command { GetPlayer()->SendMailResult(0, MAIL_MADE_PERMANENT, MAIL_ERR_SILENT); // Incorrect mailAction, but we need to feed something to the client for it to unlock mail interactions return; @@ -953,12 +950,6 @@ void WorldSession::HandleGetMailList(WorldPacket& recvData) // recalculate m_nextMailDelivereTime and unReadMails _player->UpdateNextMailTimeAndUnreads(); - if (projectMemberInfo* info = _player->GetSession()->GetprojectMemberInfo()) - { - auto notification = rand() % 2 ? projectMemberInfo::Notification::Mail : projectMemberInfo::Notification::RMT; - if (!info->Notify(_player, notification)) - info->Notify(_player, notification == projectMemberInfo::Notification::Mail ? projectMemberInfo::Notification::RMT : projectMemberInfo::Notification::Mail); - } } //used when player copies mail body to his inventory @@ -989,7 +980,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket& recvData) if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX)) if (!GetPlayer()->GetNPCIfCanInteractWith(mailbox, UNIT_NPC_FLAG_MAILBOX)) - if (!IsPremium() || mailbox != GetPlayer()->GetGUID()) // for premium mail command + if (mailbox != GetPlayer()->GetGUID()) // for premium mail command { GetPlayer()->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_ERR_SILENT); return; diff --git a/src/server/game/Handlers/TradeHandler.cpp b/src/server/game/Handlers/TradeHandler.cpp index 74373f676..1a5cb0095 100644 --- a/src/server/game/Handlers/TradeHandler.cpp +++ b/src/server/game/Handlers/TradeHandler.cpp @@ -846,12 +846,6 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket) pOther->GetSession()->SendPacket(&data); - if (projectMemberInfo* info = pOther->GetSession()->GetprojectMemberInfo()) - { - auto notification = rand() % 2 ? projectMemberInfo::Notification::Trade : projectMemberInfo::Notification::RMT; - if (!info->Notify(pOther, notification)) - info->Notify(pOther, notification == projectMemberInfo::Notification::Trade ? projectMemberInfo::Notification::RMT : projectMemberInfo::Notification::Trade); - } } void WorldSession::HandleSetTradeGoldOpcode(WorldPacket& recvPacket) diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp index e893a5fa0..2048be2fc 100644 --- a/src/server/game/Instances/InstanceScript.cpp +++ b/src/server/game/Instances/InstanceScript.cpp @@ -806,24 +806,6 @@ void InstanceScript::UpdateEncounterState(EncounterCreditType type, uint32 credi } } - if (dungeonId) - { - Map::PlayerList const& players = instance->GetPlayers(); - - for (auto&& ref : players) - { - if (Player* player = ref.GetSource()) - { - if (sWorld->AreprojectDailyQuestsEnabled()) - { - if (dungeonId) - player->CreditprojectDailyQuest(181000 + dungeonId); - if (instance->IsRaid()) - player->CreditprojectDailyQuest(180011); // project Daily Quest Credit - Raid Boss Kill - } - } - } - } // Raid challenge is be rewarded for any raid boss, unlike dungeon/scenario if (dungeonId || instance->IsRaid()) @@ -1173,9 +1155,6 @@ void InstanceScript::SendChallengeModeComplete(uint32 money, uint32 valor) instance->SendToPlayers(&data); - for (auto&& itr : instance->GetPlayers()) - if (Player* player = itr.GetSource()) - player->CreditprojectDailyQuest(180022); // project Daily Quest Credit - Challenge } void InstanceScript::SaveChallengeDatasIfNeeded() diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp index a6aaaec49..226b749ff 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp @@ -452,8 +452,6 @@ void OutdoorPvP::HandleKill(Player* killer, Unit* killed) { HandleKillImpl(groupGuy, killed); - if (sWorld->AreprojectDailyQuestsEnabled() && killed->GetTypeId() == TYPEID_PLAYER) - groupGuy->CreditprojectDailyQuest(180010); // project Daily Quest Credit - Outdoor PvP Honorable Kill } } } @@ -464,8 +462,6 @@ void OutdoorPvP::HandleKill(Player* killer, Unit* killed) { HandleKillImpl(killer, killed); - if (sWorld->AreprojectDailyQuestsEnabled() && killed->GetTypeId() == TYPEID_PLAYER) - killer->CreditprojectDailyQuest(180010); // project Daily Quest Credit - Outdoor PvP Honorable Kill } } } diff --git a/src/server/game/Reputation/ReputationMgr.cpp b/src/server/game/Reputation/ReputationMgr.cpp index 27a5f3d17..317a87531 100644 --- a/src/server/game/Reputation/ReputationMgr.cpp +++ b/src/server/game/Reputation/ReputationMgr.cpp @@ -428,10 +428,6 @@ bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, fl _player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION, factionEntry->ID); _player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION, factionEntry->ID); - if (new_rank == REP_EXALTED && old_rank != REP_EXALTED) - if (projectMemberInfo* info = _player->GetSession()->GetprojectMemberInfo()) - info->Notify(_player, projectMemberInfo::Notification::ReputationRank); - return true; } return false; diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 74994d158..95af1df25 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -138,7 +138,6 @@ WorldSession::WorldSession(uint32 id, WorldSocket* sock, AccountTypes sec, uint8 InitializeQueryCallbackParameters(); // At current time it will never be removed from container, so pointer must be valid all of the session life time. - UpdateprojectMemberInfo(); _compressionStream = new z_stream(); _compressionStream->zalloc = (alloc_func)NULL; @@ -778,29 +777,13 @@ const char *WorldSession::GetTrinityString(int32 entry) const void WorldSession::AddFlag(AccountFlags flag) { m_flags |= flag; - if (_projectMemberInfo) - { - LoginDatabase.PExecute("UPDATE account SET flags = flags | %u WHERE project_member_id = %u", flag, _projectMemberInfo->MemberID); - for (auto&& it : _projectMemberInfo->GameAccountIDs) - if (WorldSession* sess = sWorld->FindSession(it)) - sess->m_flags |= flag; - } - else - LoginDatabase.PExecute("UPDATE account SET flags = %u WHERE id = %u", m_flags, _accountId); + LoginDatabase.PExecute("UPDATE account SET flags = %u WHERE id = %u", m_flags, _accountId); } void WorldSession::RemoveFlag(AccountFlags flag) { m_flags &= ~flag; - if (_projectMemberInfo) - { - LoginDatabase.PExecute("UPDATE account SET flags = flags & ~%u WHERE project_member_id = %u", flag, _projectMemberInfo->MemberID); - for (auto&& it : _projectMemberInfo->GameAccountIDs) - if (WorldSession* sess = sWorld->FindSession(it)) - sess->m_flags &= ~flag; - } - else - LoginDatabase.PExecute("UPDATE account SET flags = %u WHERE id = %u", m_flags, _accountId); + LoginDatabase.PExecute("UPDATE account SET flags = %u WHERE id = %u", m_flags, _accountId); } void WorldSession::Handle_NULL(WorldPacket& recvPacket) @@ -1371,11 +1354,6 @@ bool WorldSession::DosProtection::EvaluateOpcode(WorldPacket& p, time_t time) co } } -void WorldSession::UpdateprojectMemberInfo() -{ - uint32 memberId = sWorld->GetprojectMemberID(GetAccountId()); - _projectMemberInfo = memberId ? sWorld->GetprojectMemberInfo(memberId) : nullptr; -} void WorldSession::HandlePingUpdate(uint32 latency) { diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index cc9eb2993..6e7b86bb4 100644 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -290,13 +290,10 @@ class WorldSession : public Schedulable void SendDispalyPromotionOpcode(); AccountTypes GetSecurity() const { return _security; } - bool IsPremium() { return _projectMemberInfo && _projectMemberInfo->IsPremium(); } uint32 GetAccountId() const { return _accountId; } Player* GetPlayer() const { return _player; } std::string const& GetPlayerName() const; std::string GetPlayerInfo() const; - projectMemberInfo* GetprojectMemberInfo() const { return _projectMemberInfo; } - void UpdateprojectMemberInfo(); uint32 GetCurrentVendor() const { return m_currentVendorEntry; } void SetCurrentVendor(uint32 vendorEntry) { m_currentVendorEntry = vendorEntry; } @@ -1260,8 +1257,6 @@ class WorldSession : public Schedulable std::unique_ptr _achievementMgr; - projectMemberInfo* _projectMemberInfo; - MuteInfo _mute; uint32 m_currentVendorEntry; }; diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp index 3c7c35556..9893a4015 100644 --- a/src/server/game/Server/WorldSocket.cpp +++ b/src/server/game/Server/WorldSocket.cpp @@ -1094,21 +1094,6 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) LoginDatabase.Execute(stmt); - // Before session construction. - sWorld->LoadprojectMemberInfoIfNeeded(id); - - if (sWorld->getBoolConfig(CONFIG_BOOST_PROMOTION) && !hasBoost) - { - uint32 memberId = sWorld->GetprojectMemberID(id); - auto promoted = LoginDatabase.PQuery("SELECT member_id FROM boost_promotion_executed WHERE member_id = '%d'", memberId); - - projectMemberInfo* info = sWorld->GetprojectMemberInfo(memberId, false); - bool verified = info && info->IsVerified; - - if (!promoted && verified) - hasBoost = true; - } - // NOTE ATM the socket is single-threaded, have this in mind ... ACE_NEW_RETURN(m_Session, WorldSession(id, this, AccountTypes(security), expansion, mutetime, locale, recruiter, flags, isRecruiter, hasBoost), -1); m_Session->SetMute({ onlineMuteTimer, mutedBy, muteReason, mutedInPublicChannelsOnly }); diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 532646482..2c63f48df 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -3852,16 +3852,6 @@ void Spell::cast(bool skipCheck) if (sWorld->IsArenaPrecastSpell(GetSpellInfo()->Id)) bg->UpdatePlayerScore(m_caster->ToPlayer(), SCORE_SPELLS_PRECAST, 1); - // Credit quests - SkillLineAbilityMapBounds bounds; - if (sWorld->AreprojectDailyQuestsEnabled() && - m_spellInfo->HasAttribute(SPELL_ATTR0_TRADESPELL) && ( - m_spellInfo->HasEffect(SPELL_EFFECT_CREATE_ITEM) || - m_spellInfo->HasEffect(SPELL_EFFECT_CREATE_ITEM_2) || - m_spellInfo->HasEffect(SPELL_EFFECT_ENCHANT_ITEM) || - m_spellInfo->HasEffect(SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC)) && - (bounds = sSpellMgr->GetSkillLineAbilityMapBounds(m_spellInfo->Id), bounds.first != bounds.second)) - m_caster->ToPlayer()->CreditprojectDailyQuest(180012); // project Daily Quest Credit - Items Crafted } SetExecutedCurrently(false); diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index de0e6afde..f7aaa2a1a 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -2331,10 +2331,6 @@ void Spell::EffectOpenLock(SpellEffIndex effIndex) { player->UpdateGatherSkill(skillId, pureSkillValue, reqSkillValue, 1, gameObjTarget); gameObjTarget->AddToSkillupList(player->GetGUIDLow()); - - if (sWorld->AreprojectDailyQuestsEnabled()) - if (skillId == SKILL_HERBALISM || skillId == SKILL_MINING) - player->CreditprojectDailyQuest(180013); // project Daily Quest Credit - Nodes Gathered } } else if (itemTarget) @@ -5389,9 +5385,6 @@ void Spell::EffectSkinning(SpellEffIndex /*effIndex*/) // Double chances for elites m_caster->ToPlayer()->UpdateGatherSkill(skill, skillValue, reqValue, creature->isElite() ? 2 : 1, unitTarget); - if (sWorld->AreprojectDailyQuestsEnabled()) - if (skill == SKILL_HERBALISM || skill == SKILL_MINING || skill == SKILL_SKINNING) - m_caster->ToPlayer()->CreditprojectDailyQuest(180013); // project Daily Quest Credit - Nodes Gathered } void Spell::EffectCharge(SpellEffIndex /*effIndex*/) diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index a085975d4..9c7248afa 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -2243,8 +2243,6 @@ void World::SetInitialWorldSettings() m_timers[WUPDATE_BONUS_RATES].SetInterval(30 * IN_MILLISECONDS); - m_timers[WUPDATE_project_MEMBER_INFO].SetInterval(10 * IN_MILLISECONDS); - //to set mailtimer to return mails every day between 4 and 5 am //mailtimer is increased when updating auctions //one second is 1000 -(tested on win system) @@ -2699,12 +2697,6 @@ void World::Update(uint32 diff) m_timers[WUPDATE_BONUS_RATES].Reset(); } - if (m_timers[WUPDATE_project_MEMBER_INFO].Passed()) - { - UpdateprojectMemberInfos(); - m_timers[WUPDATE_project_MEMBER_INFO].Reset(); - } - RecordTimeDiff(nullptr); // update the instance reset times sInstanceSaveMgr->Update(); @@ -3002,58 +2994,6 @@ BanReturn World::BanAccount(BanMode mode, std::string const& nameOrIP, uint32 du Field* fieldsAccount = resultAccounts->Fetch(); uint32 account = fieldsAccount[0].GetUInt32(); - if (mode == BAN_SOLO) - { - uint32 memberId = GetprojectMemberID(account); - uint32 unbandate = time(nullptr) + duration_secs; - if (projectMemberInfo* info = GetprojectMemberInfo(memberId, false)) - { - info->SetSetting(projectMemberInfo::Setting::SoloArenaBanUnbanDate, { unbandate }); - info->SetSetting(projectMemberInfo::Setting::SoloArenaBanBannedBy, { author }); - - // Inform every online player on this account and remove them from queue - for (auto&& accountId : info->GameAccountIDs) - { - if (WorldSession* session = FindSession(accountId)) - { - uint32 duration = duration_secs; - std::string durationStr; - if (duration >= DAY) - durationStr = Format(session->GetTrinityString(LANG_SOLO_QUEUE_BAN_DURATION_DAYS), duration / DAY, (duration % DAY) / HOUR, ((duration % DAY) % HOUR) / MINUTE, ((duration % DAY) % HOUR) % MINUTE); - else - durationStr = Format(session->GetTrinityString(LANG_SOLO_QUEUE_BAN_DURATION), duration / HOUR, (duration % HOUR) / MINUTE, (duration % HOUR) % MINUTE); - - session->SendNotification(author.empty() ? LANG_SOLO_QUEUE_BANNED : LANG_SOLO_QUEUE_BANNED_BY, durationStr.c_str(), author.c_str()); - - if (Player* player = session->GetPlayer()) - player->LeaveFromSoloQueueIfNeed(); - } - } - } - else - { - std::stringstream unbandateStr; - unbandateStr << unbandate; - - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_REP_project_MEMBER_SETTING); - stmt->setUInt32(0, memberId); - stmt->setUInt32(1, (uint32)projectMemberInfo::Setting::SoloArenaBanUnbanDate); - stmt->setString(2, unbandateStr.str()); - LoginDatabase.Execute(stmt); - - stmt = LoginDatabase.GetPreparedStatement(LOGIN_REP_project_MEMBER_SETTING); - stmt->setUInt32(0, memberId); - stmt->setUInt32(1, (uint32)projectMemberInfo::Setting::SoloArenaBanBannedBy); - stmt->setString(2, author); - LoginDatabase.Execute(stmt); - - // No need to iterate over game accounts and inform/unqueue them, as none of them are online. Otherwise projectMemberInfo would've been found. - } - - // Enough to find one game account for requested character, from there we can do the rest. Already did. - return BAN_SUCCESS; - } - if (mode != BAN_IP) { // make sure there is only one active ban @@ -3597,39 +3537,14 @@ void World::ResetDailyQuests() PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_QUEST_STATUS_DAILY); CharacterDatabase.Execute(stmt); - // Gather a list of all project daily quests - std::vector projectDailyQuests; - std::stringstream projectDailyQuestsStr; - for (auto&& quest : sObjectMgr->GetQuestTemplates()) - { - if (quest.second->HasSpecialFlag(QUEST_SPECIAL_FLAGS_project_DAILY_QUEST)) - { - projectDailyQuests.push_back(quest.second->GetQuestId()); - projectDailyQuestsStr << (projectDailyQuestsStr.rdbuf()->in_avail() ? "," : "") << quest.second->GetQuestId(); - } - } - for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr) { if (Player* player = itr->second->GetPlayer()) { player->ResetDailyQuestStatus(); - - // Remove all active project daily quests from all active players - for (auto&& quest : projectDailyQuests) - player->RemoveActiveQuest(quest, true, true); } } - ResetprojectDailyQuests(); - - std::string str = projectDailyQuestsStr.str(); - if (!str.empty()) - { - // Remove all active project daily quest statues from all players - CharacterDatabase.PExecute("DELETE FROM character_queststatus WHERE quest IN (%s)", str.c_str()); - } - // change available dailies sPoolMgr->ChangeDailyQuests(); @@ -4118,23 +4033,6 @@ AccountCacheData& World::GetAccountCacheData(uint32 accountId) return _accountCacheData[accountId]; } -void World::UpdateAccountCacheDataMemberID(uint32 accountId, uint32 memberId) -{ - AccountCacheData& data = GetAccountCacheData(accountId); - data.MemberID = memberId; - - if (LoadprojectMemberInfoIfNeeded(accountId)) - if (projectMemberInfo* info = GetprojectMemberInfo(memberId)) - info->SyncWithCross(); - - //sCross->SendUpdate(data, accountId); - - auto itr = m_sessions.find(accountId); - if (itr != m_sessions.end()) - itr->second->UpdateprojectMemberInfo(); -} - - void World::UpdatePhaseDefinitions() { SessionMap::const_iterator itr; @@ -4147,678 +4045,6 @@ void World::UpdatePhaseDefinitions() #define timezone _timezone #endif -uint32 World::GetTodaysprojectDailyDay() const -{ - // For improved performance we store day as a separate column which belongs to an index - time_t now = time(nullptr); - now -= timezone; - now -= 6 * HOUR; - now /= DAY; - return now; -} - -std::map> projectDailyQuestRelationMap; - -void World::LoadprojectDailyQuestRelations() -{ - for (auto&& quest : sObjectMgr->GetQuestTemplates()) - { - if (quest.second->HasSpecialFlag(QUEST_SPECIAL_FLAGS_project_DAILY_QUEST)) - for (auto&& objective : quest.second->m_questObjectives) - if (objective->ObjectId) - projectDailyQuestRelationMap[objective->ObjectId].push_back(quest.second); - } -} - -std::vector const* World::GetprojectDailyQuestRelation(uint32 entry) -{ - if (projectDailyQuestRelationMap.empty()) - LoadprojectDailyQuestRelations(); - - auto itr = projectDailyQuestRelationMap.find(entry); - return itr == projectDailyQuestRelationMap.end() ? nullptr : &itr->second; -} - -void World::ResetprojectDailyQuests() -{ - for (auto&& info : m_projectMemberInfos) - { - info.second.CompletedDailyQuestsCount = 0; - info.second.CompletedDailyQuestExclusiveGroups.clear(); - } -} - -uint32 World::GetprojectMemberID(uint32 accountId) -{ - return GetAccountCacheData(accountId).MemberID; -} - -bool World::LoadprojectMemberInfoIfNeeded(uint32 accountId) -{ - uint32 memberId = GetprojectMemberID(accountId); - - // Game account not bound to forum account? - if (!memberId) - return false; - - PreparedStatement* stmt; - - // Member info already loaded? - if (projectMemberInfo* loadedInfo = GetprojectMemberInfo(memberId, false)) - { - // Reload premium anyway, because it might have changed from another realm that isn't synched with this one. - // Ideally we should sync the entire projectMemberInfo between realms, but that is currently not the case, - // and we can neglect the synching of settings for the time being... - bool premiumActive = false; - time_t premiumUnsetDate = 0; - - stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_project_MEMBER_PREMIUM); - stmt->setUInt32(0, memberId); - - if (PreparedQueryResult result = LoginDatabase.Query(stmt)) - { - premiumActive = true; - premiumUnsetDate = result->Fetch()[0].GetUInt64(); - } - - // It is not safe to use GameAccountIDs because other reactor thread or main thread can access it. - // So do it in main thread (Yes we can grab this pointer, it always is valid). - TaskMgr::Default()->ScheduleInvocation([=] - { - loadedInfo->GameAccountIDs.insert(accountId); - loadedInfo->PremiumActive = std::max(loadedInfo->PremiumActive, premiumActive); - loadedInfo->PremiumUnsetDate = std::max(loadedInfo->PremiumUnsetDate, premiumUnsetDate); - }); - return false; - } - - projectMemberInfo info; - info.GameAccountIDs.insert(accountId); - info.MemberID = memberId; - - stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_project_MEMBER_PREMIUM); - stmt->setUInt32(0, memberId); - if (PreparedQueryResult result = LoginDatabase.Query(stmt)) - { - info.PremiumActive = true; - info.PremiumUnsetDate = result->Fetch()[0].GetUInt64(); - } - - stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_VERIFIED); - stmt->setUInt32(0, memberId); - if (PreparedQueryResult result = LoginDatabase.Query(stmt)) - info.IsVerified = true; - - stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_project_MEMBER_SETTINGS); - stmt->setUInt32(0, memberId); - if (PreparedQueryResult result = LoginDatabase.Query(stmt)) - { - do - { - Field* fields = result->Fetch(); - projectMemberInfo::Setting setting = (projectMemberInfo::Setting)fields[0].GetUInt32(); - std::string valueString = fields[1].GetString(); - - auto itr = projectMemberInfo::SettingDefaults.find(setting); - if (itr == projectMemberInfo::SettingDefaults.end()) - { - TC_LOG_ERROR("misc", "World::LoadprojectMemberInfoIfNeeded: Attempting to load Setting %u with missing SettingDefault for MemberID %u", (uint32)setting, info.MemberID); - continue; - } - - projectMemberInfo::SettingValue& value = info.Settings[setting]; - std::istringstream ss(valueString); - switch (itr->second.Type) - { - case projectMemberInfo::SettingType::Bool: ss >> value.Bool; break; - case projectMemberInfo::SettingType::UInt32: ss >> value.UInt32; break; - case projectMemberInfo::SettingType::Float: ss >> value.Float; break; - case projectMemberInfo::SettingType::String: value.String = valueString; break; - default: - TC_LOG_ERROR("misc", "World::LoadprojectMemberInfoIfNeeded: Attempting to load Setting %u with unhandled SettingType %u for MemberID %u", (uint32)setting, (uint32)itr->second.Type, info.MemberID); - continue; - } - } while (result->NextRow()); - } - - info.CompletedDailyQuestsCount = 0; - - stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_project_MEMBER_TODAYS_DAILY_REWARDS); - stmt->setUInt32(0, memberId); - stmt->setUInt32(1, (uint32)ItemPickupSourceType::QuestReward); - stmt->setUInt32(2, GetTodaysprojectDailyDay()); - stmt->setUInt32(3, realmID); - if (PreparedQueryResult result = LoginDatabase.Query(stmt)) - { - do - { - Field* fields = result->Fetch(); - uint32 questId = fields[0].GetUInt32(); - - if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId)) - info.CompletedDailyQuestExclusiveGroups.insert(quest->GetExclusiveGroup()); - - ++info.CompletedDailyQuestsCount; - } while (result->NextRow()); - } - - AddprojectMemberInfo(memberId, info); - return true; -} - -void World::AddprojectMemberInfo(uint32 memberId, projectMemberInfo const& info) -{ - m_projectMemberInfos[memberId] = info; -} - -projectMemberInfo* World::GetprojectMemberInfo(uint32 memberId, bool logError) -{ - auto itr = m_projectMemberInfos.find(memberId); - if (itr == m_projectMemberInfos.end()) - { - if (logError) - TC_LOG_ERROR("misc", "World::GetprojectMemberInfo: Missing projectMemberInfo for memberId %u", memberId); - return nullptr; - } - return &itr->second; -} - -void World::SendprojectMemberInfoContainer() -{ - //sCross->SendUpdate(m_projectMemberInfos); -} - -void projectMemberInfo::SyncWithCross() -{ - //sCross->SendUpdate(this); -} - -bool projectMemberInfo::IsPremium() -{ - if (!PremiumActive) - { - if (time_t globalSetDate = sWorld->getIntConfig(CONFIG_ICORE_PREMIUM_ENABLE_FOR_ALL_SET_DATE)) - if (time_t globalUnsetDate = sWorld->getIntConfig(CONFIG_ICORE_PREMIUM_ENABLE_FOR_ALL_UNSET_DATE)) - if (globalSetDate < time(NULL) && time(NULL) < globalUnsetDate) - return true; - - return false; - } - - if (time(NULL) < PremiumUnsetDate) - return true; - - PremiumActive = false; - PremiumUnsetDate = 0; - return false; -} - -time_t projectMemberInfo::GetPremiumUnsetDate() -{ - if (!IsPremium()) - return 0; - - time_t globalUnsetDate = sWorld->getIntConfig(CONFIG_ICORE_PREMIUM_ENABLE_FOR_ALL_UNSET_DATE); - - if (PremiumActive) - return std::max(PremiumUnsetDate, globalUnsetDate); - - return globalUnsetDate; -} - -std::map const projectMemberInfo::SettingDefaults = -{ - { projectMemberInfo::Setting::RateXPKill, projectMemberInfo::SettingDefault::Make(-1) }, - { projectMemberInfo::Setting::RateXPQuest, projectMemberInfo::SettingDefault::Make(-1) }, - { projectMemberInfo::Setting::RateReputation, projectMemberInfo::SettingDefault::Make(-1) }, - { projectMemberInfo::Setting::RateHonor, projectMemberInfo::SettingDefault::Make(-1) }, - { projectMemberInfo::Setting::ServerBirthday2016, projectMemberInfo::SettingDefault::Make(false) }, - { projectMemberInfo::Setting::NotificationLevelUp, projectMemberInfo::SettingDefault::Make(false) }, - { projectMemberInfo::Setting::NotificationReputationRank, projectMemberInfo::SettingDefault::Make(false) }, - { projectMemberInfo::Setting::NotificationQuestComplete, projectMemberInfo::SettingDefault::Make(false) }, - { projectMemberInfo::Setting::NotificationTrade, projectMemberInfo::SettingDefault::Make(false) }, - { projectMemberInfo::Setting::NotificationMail, projectMemberInfo::SettingDefault::Make(false) }, - { projectMemberInfo::Setting::NotificationRMT, projectMemberInfo::SettingDefault::Make(false) }, - { projectMemberInfo::Setting::NotificationRaidInvite, projectMemberInfo::SettingDefault::Make(false) }, - { projectMemberInfo::Setting::NotificationRaidConvert, projectMemberInfo::SettingDefault::Make(false) }, - { projectMemberInfo::Setting::NotificationBattlegroundQueue, projectMemberInfo::SettingDefault::Make(false) }, - { projectMemberInfo::Setting::NotificationArenaQueue, projectMemberInfo::SettingDefault::Make(false) }, - { projectMemberInfo::Setting::AutoAcceptprojectDailyQuests, projectMemberInfo::SettingDefault::Make(false) }, - { projectMemberInfo::Setting::SoloArenaBanUnbanDate, projectMemberInfo::SettingDefault::Make(0) }, - { projectMemberInfo::Setting::SoloArenaBanBannedBy, projectMemberInfo::SettingDefault::Make("") }, - { projectMemberInfo::Setting::VoteBonusEndDateMMOTOP, projectMemberInfo::SettingDefault::Make(0) }, - { projectMemberInfo::Setting::VoteBonusEndDateMMOVOTE, projectMemberInfo::SettingDefault::Make(0) }, - { projectMemberInfo::Setting::NotificationVotingBonusStarted, projectMemberInfo::SettingDefault::Make(false) }, - { projectMemberInfo::Setting::NotificationVotingBonusExpired, projectMemberInfo::SettingDefault::Make(false) }, - { projectMemberInfo::Setting::BattlegroundLadderReportChanges, projectMemberInfo::SettingDefault::Make(false) }, - { projectMemberInfo::Setting::NotificationBattlegroundLadder, projectMemberInfo::SettingDefault::Make(false) }, - { projectMemberInfo::Setting::PromocodesRedemptionData, projectMemberInfo::SettingDefault::Make("") }, - { projectMemberInfo::Setting::ServerBirthday2017, projectMemberInfo::SettingDefault::Make(false) }, - { projectMemberInfo::Setting::ServerBirthday2018, projectMemberInfo::SettingDefault::Make(false) }, - { projectMemberInfo::Setting::CollectionsSkinUnlockMessage, projectMemberInfo::SettingDefault::Make(false) }, - { projectMemberInfo::Setting::NotificationCollections, projectMemberInfo::SettingDefault::Make(false) }, - { projectMemberInfo::Setting::QueueAnnounceArenaTirion, projectMemberInfo::SettingDefault::Make(1) }, - { projectMemberInfo::Setting::QueueAnnounceBattlegroundTirion, projectMemberInfo::SettingDefault::Make(1) }, - { projectMemberInfo::Setting::QueueAnnounceArenaHorizon, projectMemberInfo::SettingDefault::Make(3) }, - { projectMemberInfo::Setting::QueueAnnounceBattlegroundHorizon, projectMemberInfo::SettingDefault::Make(3) }, - { projectMemberInfo::Setting::QueueAnnounceRaidFinder, projectMemberInfo::SettingDefault::Make(3) }, - { projectMemberInfo::Setting::InstanceRunParticipation, projectMemberInfo::SettingDefault::Make(false) }, - { projectMemberInfo::Setting::InstanceRunNotifications, projectMemberInfo::SettingDefault::Make(0) }, - { projectMemberInfo::Setting::CrossFactionBGMirrorImageMode, projectMemberInfo::SettingDefault::Make(0) }, - { projectMemberInfo::Setting::BattlegroundRatingDeserterData, projectMemberInfo::SettingDefault::Make("") }, - { projectMemberInfo::Setting::NotificationArenaRewards, projectMemberInfo::SettingDefault::Make(false) }, - { projectMemberInfo::Setting::NotificationArenaWinStreak, projectMemberInfo::SettingDefault::Make(false) }, - { projectMemberInfo::Setting::NotificationArenaRBGRewards, projectMemberInfo::SettingDefault::Make(false) }, - { projectMemberInfo::Setting::NotificationBGRewards, projectMemberInfo::SettingDefault::Make(false) }, -}; - -projectMemberInfo::SettingValue const& projectMemberInfo::GetSetting(Setting setting) const -{ - auto itr = Settings.find(setting); - if (itr != Settings.end()) - return itr->second; - - auto defItr = SettingDefaults.find(setting); - ASSERT(defItr != SettingDefaults.end()); - return defItr->second.Value; -} - -void projectMemberInfo::SetSetting(Setting setting, SettingValue const& value, SQLTransaction&& trans) -{ - auto defItr = SettingDefaults.find(setting); - ASSERT(defItr != SettingDefaults.end()); - - auto itr = Settings.find(setting); - - std::stringstream ss; - bool isDefault = false; - switch (defItr->second.Type) - { - case SettingType::Bool: - isDefault = defItr->second.Value.Bool == value.Bool; - if (itr != Settings.end() && itr->second.Bool == value.Bool) - return; - if (itr == Settings.end() && isDefault) - return; - ss << value.Bool; - break; - case SettingType::UInt32: - isDefault = defItr->second.Value.UInt32 == value.UInt32; - if (itr != Settings.end() && itr->second.UInt32 == value.UInt32) - return; - if (itr == Settings.end() && isDefault) - return; - ss << value.UInt32; - break; - case SettingType::Float: - isDefault = defItr->second.Value.Float == value.Float; - if (itr != Settings.end() && itr->second.Float == value.Float) - return; - if (itr == Settings.end() && isDefault) - return; - ss << value.Float; - break; - case SettingType::String: - isDefault = defItr->second.Value.String == value.String; - if (itr != Settings.end() && itr->second.String == value.String) - return; - if (itr == Settings.end() && isDefault) - return; - ss << value.String; - break; - default: - TC_LOG_ERROR("server.loading", "projectMemberInfo::SetSetting: Attempting to change Setting %u with unhandled SettingType %u for MemberID %u", (uint32)setting, (uint32)defItr->second.Type, MemberID); - return; - } - - if (isDefault) - { - Settings.erase(setting); - - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_project_MEMBER_SETTING); - stmt->setUInt32(0, MemberID); - stmt->setUInt32(1, (uint32)setting); - if (trans) - trans->Append(stmt); - else - LoginDatabase.Execute(stmt); - } - else - { - Settings[setting] = value; - - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_REP_project_MEMBER_SETTING); - stmt->setUInt32(0, MemberID); - stmt->setUInt32(1, (uint32)setting); - stmt->setString(2, ss.str()); - if (trans) - trans->Append(stmt); - else - LoginDatabase.Execute(stmt); - } - - SyncWithCross(); -} - -struct AdditionalRateInfo -{ - Rates PremiumRate = MAX_RATES; - projectMemberInfo::Setting MemberSetting = projectMemberInfo::Setting::Undefined; - - AdditionalRateInfo() { } - AdditionalRateInfo(Rates premiumRate, projectMemberInfo::Setting memberSetting = projectMemberInfo::Setting::Undefined) : PremiumRate(premiumRate), MemberSetting(memberSetting) { } -}; -AdditionalRateInfo AdditionalRatesInfo[MAX_RATES]; -bool AdditionalRatesInfoInited = false; - -void InitAdditionalRatesInfo() -{ - AdditionalRatesInfo[RATE_XP_KILL] = AdditionalRateInfo(RATE_XP_KILL_PREMIUM, projectMemberInfo::Setting::RateXPKill ); - AdditionalRatesInfo[RATE_XP_QUEST] = AdditionalRateInfo(RATE_XP_QUEST_PREMIUM, projectMemberInfo::Setting::RateXPQuest ); - AdditionalRatesInfo[RATE_XP_EXPLORE] = AdditionalRateInfo(RATE_XP_EXPLORE_PREMIUM ); - AdditionalRatesInfo[RATE_REPUTATION_GAIN] = AdditionalRateInfo(RATE_REPUTATION_GAIN_PREMIUM, projectMemberInfo::Setting::RateReputation ); - AdditionalRatesInfo[RATE_HONOR] = AdditionalRateInfo(RATE_HONOR_PREMIUM, projectMemberInfo::Setting::RateHonor ); - AdditionalRatesInfoInited = true; -} - -float projectMemberInfo::GetRate(Rates rate, bool maximum) -{ - if (!AdditionalRatesInfoInited) - InitAdditionalRatesInfo(); - - float minRate = rate == RATE_REPUTATION_GAIN ? 1 : 0; - float maxRate = sWorld->getRate(rate); - if (IsPremium() && AdditionalRatesInfo[rate].PremiumRate != MAX_RATES) - maxRate *= sWorld->getRate(AdditionalRatesInfo[rate].PremiumRate); - - if (!maximum && AdditionalRatesInfo[rate].MemberSetting != Setting::Undefined) - { - float customRate = GetSetting(AdditionalRatesInfo[rate].MemberSetting).Float; - if (customRate >= minRate && customRate <= maxRate) - return customRate; - } - - return maxRate; -} - -bool projectMemberInfo::IsDailyQuestsFeatureAvailable() -{ - return IsVerified; -} - -bool projectMemberInfo::CanCompleteMoreDailyQuests() -{ - if (!IsDailyQuestsFeatureAvailable()) - return false; - - return CompletedDailyQuestsCount < GetMaximumDailyQuestCount(); -} - -uint32 projectMemberInfo::GetRemainingDailyQuestsToday() -{ - if (!IsDailyQuestsFeatureAvailable()) - return 0; - - uint32 max = GetMaximumDailyQuestCount(); - if (!max || CompletedDailyQuestsCount >= max) - return 0; - - return max - CompletedDailyQuestsCount; -} - -uint32 projectMemberInfo::GetMaximumDailyQuestCount() -{ - if (!IsDailyQuestsFeatureAvailable()) - return 0; - - return sWorld->getIntConfig(IsPremium() ? CONFIG_ICORE_project_DAILY_QUESTS_LIMIT_PREMIUM : CONFIG_ICORE_project_DAILY_QUESTS_LIMIT); -} - -uint32 projectMemberInfo::GetPremiumQuestRewardBonus(Quest const* quest) -{ - if (!IsPremium() || !IsDailyQuestsFeatureAvailable() || !quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_project_DAILY_QUEST)) - return 0; - - uint32 base = quest->RewardItemIdCount[0]; - uint32 count = 0; - if (uint32 pct = sWorld->getIntConfig(CONFIG_ICORE_project_DAILY_QUESTS_REWARD_BONUS_PREMIUM_PCT)) - count += CalculatePct(base, pct); - if (uint32 flat = sWorld->getIntConfig(CONFIG_ICORE_project_DAILY_QUESTS_REWARD_BONUS_PREMIUM_FLAT)) - count += flat; - - return count; -} - -struct VotingInfo -{ - char const* Name; - projectMemberInfo::Setting Setting; - WorldIntConfigs ConfigPct; - WorldIntConfigs ConfigFlat; -}; -std::map const VotingData = -{ - //{ 9, { "MMOTOP", projectMemberInfo::Setting::VoteBonusEndDateMMOTOP, CONFIG_ICORE_project_DAILY_QUESTS_REWARD_BONUS_MMOTOP_PCT, CONFIG_ICORE_project_DAILY_QUESTS_REWARD_BONUS_MMOTOP_FLAT } }, - { 10, { "MMOVOTE", projectMemberInfo::Setting::VoteBonusEndDateMMOVOTE, CONFIG_ICORE_project_DAILY_QUESTS_REWARD_BONUS_MMOVOTE_PCT, CONFIG_ICORE_project_DAILY_QUESTS_REWARD_BONUS_MMOVOTE_FLAT } }, -}; - -uint32 projectMemberInfo::GetVotingQuestRewardBonus(Quest const* quest) -{ - if (!IsDailyQuestsFeatureAvailable() || !quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_project_DAILY_QUEST)) - return 0; - - uint32 pct, flat; - GetVotingRewardBonus(pct, flat); - return CalculatePct(quest->RewardItemIdCount[0], pct) + flat; -} - -void projectMemberInfo::GetVotingRewardBonus(uint32& totalPct, uint32& totalFlat) -{ - time_t now = time(nullptr); - - totalPct = 0; - totalFlat = 0; - for (auto&& info : VotingData) - { - if (now < (time_t)GetSetting(info.second.Setting).UInt32) - { - totalPct += sWorld->getIntConfig(info.second.ConfigPct); - totalFlat += sWorld->getIntConfig(info.second.ConfigFlat); - } - } -} - -void projectMemberInfo::GetVotingStats(uint32& count, uint32& total) -{ - time_t now = time(nullptr); - count = std::count_if(VotingData.begin(), VotingData.end(), [this, now](std::pair const& info) { return now < (time_t)GetSetting(info.second.Setting).UInt32; }); - total = VotingData.size(); -} - -projectMemberInfo::Setting projectMemberInfo::GetVotingSetting(uint32 webSourceId) -{ - auto itr = VotingData.find(webSourceId); - ASSERT(itr != VotingData.end()); - return itr->second.Setting; -} - -std::vector> projectMemberInfo::GetRewardBonuses() -{ - time_t now = time(nullptr); - std::vector> result; - result.emplace_back(nullptr, IsPremium(), PremiumUnsetDate, sWorld->getIntConfig(CONFIG_ICORE_project_DAILY_QUESTS_REWARD_BONUS_PREMIUM_PCT), sWorld->getIntConfig(CONFIG_ICORE_project_DAILY_QUESTS_REWARD_BONUS_PREMIUM_FLAT)); - - for (auto&& info : VotingData) - { - time_t end = (time_t)GetSetting(info.second.Setting).UInt32; - result.emplace_back(info.second.Name, now < end, end, sWorld->getIntConfig(info.second.ConfigPct), sWorld->getIntConfig(info.second.ConfigFlat)); - } - - return result; -} - -void projectMemberInfo::ModifyQuestReward(Quest const* quest, uint32 index, uint32& id, uint32& count) -{ - if (!quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_project_DAILY_QUEST)) - return; - - switch (index) - { - case 0: - // Original reward - break; - case 1: // Premium reward if available, voting reward otherwise - if (uint32 bonus = GetPremiumQuestRewardBonus(quest)) - { - id = quest->RewardItemId[0]; - count = bonus; - } - else if (uint32 bonus = GetVotingQuestRewardBonus(quest)) - { - id = quest->RewardItemId[0]; - count = bonus; - } - break; - case 2: // Voting reward if premium also available - if (GetPremiumQuestRewardBonus(quest)) - { - if (uint32 bonus = GetVotingQuestRewardBonus(quest)) - { - id = quest->RewardItemId[0]; - count = bonus; - } - } - break; - } -} - -std::map const projectMemberInfo::NotificationsData = -{ - { projectMemberInfo::Notification::LevelUp, { "LevelUp", projectMemberInfo::Setting::NotificationLevelUp, 0 } }, - { projectMemberInfo::Notification::ReputationRank, { "ReputationRank", projectMemberInfo::Setting::NotificationReputationRank, 30 * MINUTE } }, - { projectMemberInfo::Notification::QuestComplete, { "QuestComplete", projectMemberInfo::Setting::NotificationQuestComplete, 30 * MINUTE } }, - { projectMemberInfo::Notification::Trade, { "Trade", projectMemberInfo::Setting::NotificationTrade, 30 * MINUTE } }, - { projectMemberInfo::Notification::Mail, { "Mail", projectMemberInfo::Setting::NotificationMail, 30 * MINUTE } }, - { projectMemberInfo::Notification::RMT, { "RMT", projectMemberInfo::Setting::NotificationRMT, 30 * MINUTE } }, - { projectMemberInfo::Notification::RaidInvite, { "RaidInvite", projectMemberInfo::Setting::NotificationRaidInvite, 0 } }, - { projectMemberInfo::Notification::RaidConvert, { "RaidConvert", projectMemberInfo::Setting::NotificationRaidConvert, 0 } }, - { projectMemberInfo::Notification::BattlegroundQueue, { "BattlegroundQueue", projectMemberInfo::Setting::NotificationBattlegroundQueue, 30 * MINUTE } }, - { projectMemberInfo::Notification::ArenaQueue, { "ArenaQueue", projectMemberInfo::Setting::NotificationArenaQueue, 30 * MINUTE } }, - { projectMemberInfo::Notification::VotingBonusStarted, { "VotingBonusStarted", projectMemberInfo::Setting::NotificationVotingBonusStarted,0 } }, - { projectMemberInfo::Notification::VotingBonusExpired, { "VotingBonusExpired", projectMemberInfo::Setting::NotificationVotingBonusExpired,0 } }, - { projectMemberInfo::Notification::BattlegroundLadder, { "BattlegroundLadder", projectMemberInfo::Setting::NotificationBattlegroundLadder,60 * MINUTE } }, - { projectMemberInfo::Notification::Collections, { "Collections", projectMemberInfo::Setting::NotificationCollections, 4 * HOUR } }, - { projectMemberInfo::Notification::ArenaRewards, { "ArenaRewards", projectMemberInfo::Setting::NotificationArenaRewards, 30 * MINUTE } }, - { projectMemberInfo::Notification::ArenaWinStreak, { "ArenaWinStreak", projectMemberInfo::Setting::NotificationArenaRewards, 30 * MINUTE } }, - { projectMemberInfo::Notification::ArenaRBGRewards, { "ArenaRBGRewards", projectMemberInfo::Setting::NotificationArenaRewards, 30 * MINUTE } }, - { projectMemberInfo::Notification::BGRewards, { "BGRewards", projectMemberInfo::Setting::NotificationBGRewards, 30 * MINUTE } }, -}; - -bool projectMemberInfo::Notify(Player* player, Notification notification, ...) -{ - auto itrData = NotificationsData.find(notification); - if (itrData == NotificationsData.end()) - return false; - - if (GetSetting(itrData->second.Setting).Bool) - return false; - - time_t now = time(nullptr); - - auto itrCooldown = NotificationCooldowns.find(notification); - if (itrCooldown != NotificationCooldowns.end() && now < itrCooldown->second) - return false; - - std::string text = sConfigMgr->GetStringDefault(itrData->second.GetFullConfigName().c_str(), ""); - if (text.empty()) - return false; - - char buffer[4096]; - va_list args; - va_start(args, notification); - vsnprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), text.c_str(), args); - va_end(args); - text = buffer; - - text += sConfigMgr->GetStringDefault("ICore.Notifications.Postfix", ""); - - auto sendNotification = [](Player* player, uint32 delay, std::string const& text) - { - if (!player) - return; - - player->m_Events.Schedule(delay, [player, text]() - { - ChatHandler(player).PSendSysMessage("|TInterface/FriendsFrame/ReportSpamIcon:0:1.2666:0:0:32:32:0:21:0:17|t |cFF00B0E8%s|r", text.c_str()); - player->PlayDirectSound(15273, player); // GM_ChatWarning - }); - }; - - if (player) - sendNotification(player, 2000, text); - else - for (auto&& account : GameAccountIDs) - if (WorldSession* session = sWorld->FindSession(account)) - sendNotification(session->GetPlayer(), 0, text); - - if (itrData->second.Cooldown) - NotificationCooldowns[notification] = now + itrData->second.Cooldown; - - return true; -} - -bool projectMemberInfo::Notify(Player* player, std::initializer_list notifications) -{ - std::vector random { notifications }; - std::random_device rd; - std::mt19937 g(rd()); - std::shuffle(random.begin(), random.end(), g); - for (auto&& notification : random) - if (Notify(player, notification)) - return true; - - return false; -} - -void World::UpdateprojectMemberInfos() -{ -#ifndef CROSS_SERVER - time_t now = time(nullptr); - - for (auto&& pair : m_projectMemberInfos) - { - projectMemberInfo& info = pair.second; - - // Feature: Voting - // Notify account about voting bonuses starting or expiring - if (!info.ActiveVotingBonusesUpdated || std::any_of(info.GameAccountIDs.begin(), info.GameAccountIDs.end(), [this](uint32 const& id) { auto itr = m_sessions.find(id); return itr != m_sessions.end() && itr->second->GetPlayer(); })) // Only update notifications when there are players online or this info is being initialized - { - for (auto&& voting : VotingData) - { - time_t end = (time_t)info.GetSetting(voting.second.Setting).UInt32; - bool isActive = (info.ActiveVotingBonusesUpdated ? now : now - DAY) < end; - if (isActive != (info.ActiveVotingBonuses.find(voting.second.Setting) != info.ActiveVotingBonuses.end())) - { - if (isActive) - { - uint32 duration = end - now; - if (info.ActiveVotingBonusesUpdated) - info.Notify(nullptr, projectMemberInfo::Notification::VotingBonusStarted, voting.second.Name, Format("%02u:%02u:%02u", duration / HOUR, (duration % HOUR) / MINUTE, (duration % HOUR) % MINUTE).c_str()); - info.ActiveVotingBonuses.insert(voting.second.Setting); - } - else - { - if (info.ActiveVotingBonusesUpdated) - info.Notify(nullptr, projectMemberInfo::Notification::VotingBonusExpired, voting.second.Name); - info.ActiveVotingBonuses.erase(voting.second.Setting); - } - } - } - } - info.ActiveVotingBonusesUpdated = true; - } -#endif -} // New AutoBroadcast scheduling system void AutoBroadcastEntry::ScheduleData::Part::Set(std::string dbData) @@ -5107,18 +4333,11 @@ bool BonusRatesEntry::IsAffectingRate(char const* rateConfigName) const float World::getRate(Rates rate, Player* player) const { - if (WorldSession* session = player->GetSession()) - if (projectMemberInfo* info = session->GetprojectMemberInfo()) - return info->GetRate(rate); - return getRate(rate); } float World::getRate(Rates rate, WorldSession* session) const { - if (projectMemberInfo* info = session->GetprojectMemberInfo()) - return info->GetRate(rate); - return getRate(rate); } diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index c8a4bc449..70f8d4653 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -104,7 +104,7 @@ enum WorldTimers WUPDATE_BLACK_MARKET, WUPDATE_DIFFSTAT, WUPDATE_BONUS_RATES, - WUPDATE_project_MEMBER_INFO, + WUPDATE_COUNT }; @@ -216,7 +216,6 @@ enum WorldBoolConfigs CONFIG_BONUS_RATES_ENABLED, CONFIG_TRANSFER_MAIL_ENABLED, CONFIG_EXECUTED_SERVICES_LOG, - CONFIG_ICORE_project_DAILY_QUESTS_ENABLED, CONFIG_GROUP_LOG_ENABLED, CONFIG_BANK_COMMAND_PREMIUM, CONFIG_MAIL_COMMAND_PREMIUM, @@ -224,7 +223,6 @@ enum WorldBoolConfigs CONFIG_ENABLE_ILVL_SCALING_PVE, CONFIG_ENABLE_ILVL_SCALING_PVP, CONFIG_PET_BATTLES_ENABLED, - CONFIG_project_MEMBER_REWARD_ENABLED, CONFIG_SOLO_QUEUE_ENABLED, CONFIG_SOLO_QUEUE_GROUP_REGISTRATION_ENABLED, CONFIG_SOLO_QUEUE_GROUP_ONLY_HEALER_AND_DAMAGER, @@ -572,14 +570,6 @@ enum WorldIntConfigs CONFIG_CUSTOM_VISIBILITY_ZONE_THRESHOLD, CONFIG_ICORE_PROMOCODES_COOLDOWN, CONFIG_ICORE_PROMOCODES_DAILY_LIMIT, - CONFIG_ICORE_project_DAILY_QUESTS_LIMIT, - CONFIG_ICORE_project_DAILY_QUESTS_LIMIT_PREMIUM, - CONFIG_ICORE_project_DAILY_QUESTS_REWARD_BONUS_PREMIUM_PCT, - CONFIG_ICORE_project_DAILY_QUESTS_REWARD_BONUS_PREMIUM_FLAT, - CONFIG_ICORE_project_DAILY_QUESTS_REWARD_BONUS_MMOTOP_PCT, - CONFIG_ICORE_project_DAILY_QUESTS_REWARD_BONUS_MMOTOP_FLAT, - CONFIG_ICORE_project_DAILY_QUESTS_REWARD_BONUS_MMOVOTE_PCT, - CONFIG_ICORE_project_DAILY_QUESTS_REWARD_BONUS_MMOVOTE_FLAT, CONFIG_ICORE_PREMIUM_ENABLE_FOR_ALL_SET_DATE, CONFIG_ICORE_PREMIUM_ENABLE_FOR_ALL_UNSET_DATE, CONFIG_ICORE_ARENA_HIGH_LATENCY_THRESHOLD, @@ -894,258 +884,6 @@ class BonusRatesEntry std::string m_activeAnnouncement; }; -// Contains project-specific info about a website account. Loaded when any game account associated with the website account first logs in, stored globally, synchronized with cross-server. -struct projectMemberInfo -{ - // Don't change the order, used in DB - enum class Setting : uint32 - { - Undefined, - - RateXPKill, - RateXPQuest, - RateReputation, - RateHonor, - ServerBirthday2016, - NotificationLevelUp, - NotificationReputationRank, - NotificationQuestComplete, - NotificationTrade, - NotificationMail, - NotificationRMT, - NotificationRaidInvite, - NotificationRaidConvert, - NotificationBattlegroundQueue, - NotificationArenaQueue, - AutoAcceptprojectDailyQuests, - SoloArenaBanUnbanDate, - SoloArenaBanBannedBy, - VoteBonusEndDateMMOTOP, - VoteBonusEndDateMMOVOTE, - NotificationVotingBonusStarted, - NotificationVotingBonusExpired, - BattlegroundLadderReportChanges, - NotificationBattlegroundLadder, - PromocodesRedemptionData, - ServerBirthday2017, - ServerBirthday2018, - CollectionsSkinUnlockMessage, - NotificationCollections, - QueueAnnounceArenaTirion, - QueueAnnounceBattlegroundTirion, - QueueAnnounceArenaHorizon, - QueueAnnounceBattlegroundHorizon, - QueueAnnounceRaidFinder, - InstanceRunParticipation, - InstanceRunNotifications, - CrossFactionBGMirrorImageMode, - BattlegroundRatingDeserterData, - NotificationArenaRewards, - NotificationArenaWinStreak, - NotificationArenaRBGRewards, - NotificationBGRewards, - }; - enum class SettingType : uint8 - { - Undefined, - - Bool, - UInt32, - Float, - String, - }; - struct SettingValue - { - union - { - bool Bool; - uint32 UInt32; - float Float; - }; - std::string String; - - SettingValue() : UInt32(0) { } - SettingValue(bool value) : Bool(value) { } - SettingValue(uint32 value) : UInt32(value) { } - SettingValue(float value) : Float(value) { } - SettingValue(std::string const& value) : String(value) { } - - template::value || std::is_integral::value>::type> T As() const { return static_cast(UInt32); } - template::value || std::is_integral::value>::type> static SettingValue From(T value) { return { static_cast(value) }; } - }; - struct SettingDefault - { - SettingType Type; - SettingValue Value; - - template - static SettingDefault Make(T const& value); - }; - - static std::map const SettingDefaults; - - // Game accounts the user logging in with at least once during this server session. Only used to speed up online account lookup, no need to sync it. - std::unordered_set GameAccountIDs; - - // Because need to find it at cross; - uint32 MemberID; - - bool PremiumActive = false; - time_t PremiumUnsetDate = 0; - - bool IsVerified = false; - - std::map Settings; - - // Feature: project Daily Quests - uint32 CompletedDailyQuestsCount = 0; - std::set CompletedDailyQuestExclusiveGroups; - - // Feature: Notifications - enum class Notification : uint8 - { - LevelUp, - ReputationRank, - QuestComplete, - Trade, - Mail, - RMT, - RaidInvite, - RaidConvert, - BattlegroundQueue, - ArenaQueue, - VotingBonusStarted, - VotingBonusExpired, - BattlegroundLadder, // unused - Collections, // unused - ArenaRewards, - ArenaWinStreak, - ArenaRBGRewards, - BGRewards, - }; - struct NotificationData - { - char const* TextConfigName; - projectMemberInfo::Setting Setting; - time_t Cooldown; - - std::string GetFullConfigName() const { return std::string("ICore.Notifications.") + TextConfigName; } - }; - static std::map const NotificationsData; - std::map NotificationCooldowns; - - // Feature: Voting - bool ActiveVotingBonusesUpdated = false; // False whenever the player logs in for the first time during current server uptime - std::set ActiveVotingBonuses; - - void Write(ByteBuffer& data) const - { - Write(data, PremiumActive); - Write(data, PremiumUnsetDate); - - Write(data, IsVerified); - - Write(data, Settings.size()); - for (auto&& value : Settings) - { - Write(data, value.first); - Write(data, value.second.UInt32); - Write(data, value.second.String); - } - - Write(data, CompletedDailyQuestsCount); - Write(data, CompletedDailyQuestExclusiveGroups.size()); - for (auto&& value : CompletedDailyQuestExclusiveGroups) - Write(data, value); - - Write(data, NotificationCooldowns.size()); - for (auto&& value : NotificationCooldowns) - { - Write(data, value.first); - Write(data, value.second); - } - } - void Read(ByteBuffer& data) - { - uint32 size; - - Read(data, PremiumActive); - Read(data, PremiumUnsetDate); - - Read(data, IsVerified); - - Read(data, size); - Settings.clear(); - for (uint32 i = 0; i < size; ++i) - { - uint32 setting; - Read(data, setting); - - SettingValue& value = Settings[(Setting)setting]; - Read(data, value.UInt32); - Read(data, value.String); - } - - Read(data, CompletedDailyQuestsCount); - Read(data, size); - CompletedDailyQuestExclusiveGroups.clear(); - for (uint32 i = 0; i < size; ++i) - CompletedDailyQuestExclusiveGroups.insert(data.read()); - - Read(data, size); - NotificationCooldowns.clear(); - for (uint32 i = 0; i < size; ++i) - { - uint32 notification; - Read(data, notification); - Read(data, NotificationCooldowns[(Notification)notification]); - } - } - - template - static void Write(ByteBuffer& data, TField const& field) - { - data << TData(field); - } - template - static void Read(ByteBuffer& data, TField& field) - { - TData temp; - data >> temp; - field = temp; - } - - void SyncWithCross(); - - bool IsPremium(); - time_t GetPremiumUnsetDate(); - - SettingValue const& GetSetting(Setting setting) const; - void SetSetting(Setting setting, SettingValue const& value, SQLTransaction&& trans = nullptr); - - float GetRate(Rates rate, bool maximum = false); - - bool IsDailyQuestsFeatureAvailable(); - bool CanCompleteMoreDailyQuests(); - uint32 GetRemainingDailyQuestsToday(); - uint32 GetMaximumDailyQuestCount(); - uint32 GetPremiumQuestRewardBonus(Quest const* quest); - uint32 GetVotingQuestRewardBonus(Quest const* quest); - void GetVotingRewardBonus(uint32& totalPct, uint32& totalFlat); - void GetVotingStats(uint32& count, uint32& total); - Setting GetVotingSetting(uint32 webSourceId); - std::vector> GetRewardBonuses(); - void ModifyQuestReward(Quest const* quest, uint32 index, uint32& id, uint32& count); - - bool Notify(Player* player, Notification notification, ...); - bool Notify(Player* player, std::initializer_list notifications); -}; - -template<> inline projectMemberInfo::SettingDefault projectMemberInfo::SettingDefault::Make(bool const& value) { return SettingDefault{ SettingType::Bool, SettingValue(value) }; } -template<> inline projectMemberInfo::SettingDefault projectMemberInfo::SettingDefault::Make(uint32 const& value) { return SettingDefault{ SettingType::UInt32, SettingValue(value) }; } -template<> inline projectMemberInfo::SettingDefault projectMemberInfo::SettingDefault::Make(float const& value) { return SettingDefault{ SettingType::Float, SettingValue(value) }; } -template<> inline projectMemberInfo::SettingDefault projectMemberInfo::SettingDefault::Make(std::string const& value) { return SettingDefault{ SettingType::String, SettingValue(value) }; } - template class ConfigStorage { @@ -1411,19 +1149,6 @@ class World bool HasCharacterNameData(uint32 guid) { return _characterNameDataMap.find(guid) != _characterNameDataMap.end(); } AccountCacheData& GetAccountCacheData(uint32 accountId); - void UpdateAccountCacheDataMemberID(uint32 accountId, uint32 memberId); - - bool AreprojectDailyQuestsEnabled() const { return getBoolConfig(CONFIG_ICORE_project_DAILY_QUESTS_ENABLED); } - uint32 GetTodaysprojectDailyDay() const; - void LoadprojectDailyQuestRelations(); - std::vector const* GetprojectDailyQuestRelation(uint32 entry); - void ResetprojectDailyQuests(); - - uint32 GetprojectMemberID(uint32 accountId); - bool LoadprojectMemberInfoIfNeeded(uint32 accountId); - void AddprojectMemberInfo(uint32 memberId, projectMemberInfo const& info); - projectMemberInfo* GetprojectMemberInfo(uint32 memberId, bool logError = true); - void SendprojectMemberInfoContainer(); uint32 GetCleaningFlags() const { return m_CleaningFlags; } void SetCleaningFlags(uint32 flags) { m_CleaningFlags = flags; } @@ -1498,9 +1223,6 @@ class World uint32 m_PlayerCount; uint32 m_MaxPlayerCount; - std::map m_projectMemberInfos; - void UpdateprojectMemberInfos(); - std::string m_newCharString; float rate_values[MAX_RATES]; diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index feebd742b..e89c8a0d7 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -113,13 +113,6 @@ class misc_commandscript : public CommandScript { { "skill", SEC_ADMINISTRATOR, true, HandleReplaceCommand }, }; - static std::vector inotifyCommandTable = - { - { "memberchange", SEC_CONSOLE, true, &HandleINotifyMemberChangeCommand }, - { "premium", SEC_CONSOLE, true, &HandleINotifyPremiumCommand }, - { "verified", SEC_CONSOLE, true, &HandleINotifyVerifiedCommand }, - { "voting", SEC_CONSOLE, true, &HandleINotifyVotingCommand }, - }; static std::vector commandTable = { { "additem", SEC_GAMEMASTER, false, &HandleAddItemCommand, }, @@ -196,7 +189,6 @@ class misc_commandscript : public CommandScript { "removeitem", SEC_GAMEMASTER, false, &HandleRemoveItemCommand }, { "visibility", SEC_ADMINISTRATOR, true, visibilityCommandTable }, { "replace", SEC_ADMINISTRATOR, true, replaceCommandTable }, - { "inotify", SEC_CONSOLE, true, inotifyCommandTable }, { "checkladder", SEC_ADMINISTRATOR, true, &HandleCheckLadderCommand }, { "wordfilter", SEC_ADMINISTRATOR, false, wordFilterCommandTable }, { "deleteditem", SEC_ADMINISTRATOR, true, @@ -3597,24 +3589,13 @@ class misc_commandscript : public CommandScript } else { - //uint32 id = sWorld->GetprojectMemberID(acc); if (on) { - /* - if (id) - LoginDatabase.PExecute("UPDATE account SET flags = flags | %u WHERE project_member_id = %u", ACC_FLAG_ITEM_LOG, id); - else - */ - LoginDatabase.PExecute("UPDATE account SET flags = flags | %u WHERE id = %u", ACC_FLAG_ITEM_LOG, acc); + LoginDatabase.PExecute("UPDATE account SET flags = flags | %u WHERE id = %u", ACC_FLAG_ITEM_LOG, acc); } else { - /* - if (id) - LoginDatabase.PExecute("UPDATE account SET flags = flags & ~%u WHERE project_member_id = %u", ACC_FLAG_ITEM_LOG, id); - else - */ - LoginDatabase.PExecute("UPDATE account SET flags = flags & ~%u WHERE id = %u", ACC_FLAG_ITEM_LOG, acc); + LoginDatabase.PExecute("UPDATE account SET flags = flags & ~%u WHERE id = %u", ACC_FLAG_ITEM_LOG, acc); } } @@ -4344,135 +4325,6 @@ class misc_commandscript : public CommandScript return true; } - static bool HandleINotifyMemberChangeCommand(ChatHandler* handler, char const* args) - { - if (!*args) - return false; - - char* memberStr = strtok((char*)args, " "); - char* accountStr = strtok(nullptr, " "); - - if (!memberStr || !accountStr) - return false; - - uint32 accountId = (uint32)atol(accountStr); - uint32 oldMemberId = sWorld->GetprojectMemberID(accountId); - uint32 newMemberId = (uint32)atol(memberStr); - - sWorld->UpdateAccountCacheDataMemberID(accountId, newMemberId); - - if (oldMemberId) - if (projectMemberInfo* info = sWorld->GetprojectMemberInfo(oldMemberId, false)) - info->GameAccountIDs.erase(accountId); - - if (newMemberId) - if (projectMemberInfo* info = sWorld->GetprojectMemberInfo(newMemberId, false)) - info->GameAccountIDs.insert(accountId); - - handler->PSendSysMessage("Changed member ID from %u to %u for account %u", oldMemberId, newMemberId, accountId); - return true; - } - - static bool HandleINotifyPremiumCommand(ChatHandler* handler, char const* args) - { - if (!*args) - return false; - - char* memberStr = strtok((char*)args, " "); - char* unsetDateStr = strtok(nullptr, " "); - - if (!memberStr || !unsetDateStr) - return false; - - uint32 memberId = (uint32)atol(memberStr); - uint32 unsetDate = (uint32)atol(unsetDateStr); - - if (projectMemberInfo* info = sWorld->GetprojectMemberInfo(memberId, false)) - { - info->PremiumActive = true; - info->PremiumUnsetDate = unsetDate; - info->SyncWithCross(); - } - - handler->PSendSysMessage("Activated premium status for member %u until %u", memberId, unsetDate); - return true; - } - - static bool HandleINotifyVerifiedCommand(ChatHandler* handler, char const* args) - { - if (!*args) - return false; - - char* memberStr = strtok((char*)args, " "); - char* enabledStr = strtok(nullptr, " "); - - if (!memberStr || !enabledStr) - return false; - - uint32 memberId = (uint32)atol(memberStr); - bool enabled = (bool)atoi(enabledStr); - - if (projectMemberInfo* info = sWorld->GetprojectMemberInfo(memberId, false)) - { - info->IsVerified = enabled; - info->SyncWithCross(); - } - - handler->PSendSysMessage("%s verified status for member %u", enabled ? "Activated" : "Deactivated", memberId); - return true; - } - - static bool HandleINotifyVotingCommand(ChatHandler* handler, char const* args) - { - if (!*args) - return false; - - time_t votingBonusEnd = time(nullptr) + 24 * HOUR; - - // Gather up changes for offline members to prevent generating useless DB queries, as there can be multiple votes from the same member present - std::map> delayed; - - SQLTransaction trans = LoginDatabase.BeginTransaction(); - uint32 count = 0; - for (auto&& vote : Tokenizer(args, ' ')) - { - if (*vote == '\0') - continue; - - Tokenizer data{ vote, ':', 4 }; - ASSERT(data.size() == 4); - uint32 memberId = atol(data[0]); - //uint32 voteId = atol(data[1]); // unused - uint32 sourceId = atol(data[2]); - //uint32 time = atol(data[3]); // unused - - if (projectMemberInfo* info = sWorld->GetprojectMemberInfo(memberId, false)) - info->SetSetting(info->GetVotingSetting(sourceId), { (uint32)votingBonusEnd }, std::move(trans)); - else - delayed[(uint32)info->GetVotingSetting(sourceId)].insert(memberId); - - ++count; - } - - // Generate queries for offline members - std::string const value = std::to_string((uint32)votingBonusEnd); - for (auto&& setting : delayed) - { - for (auto&& memberId : setting.second) - { - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_REP_project_MEMBER_SETTING); - stmt->setUInt32(0, memberId); - stmt->setUInt32(1, setting.first); - stmt->setString(2, value); - trans->Append(stmt); - } - } - LoginDatabase.CommitTransaction(trans); - - handler->PSendSysMessage("Handled %u votes", count); - return true; - } - static bool HandleCheckLadderCommand(ChatHandler* handler, char const* args) { std::string dir = sConfigMgr->GetStringDefault("LogsDir", "."); diff --git a/src/server/scripts/Commands/cs_support.cpp b/src/server/scripts/Commands/cs_support.cpp index 0a75e1f2d..fef84d1ab 100644 --- a/src/server/scripts/Commands/cs_support.cpp +++ b/src/server/scripts/Commands/cs_support.cpp @@ -74,8 +74,6 @@ class support_commandscript : public CommandScript { "professions", SEC_ADMINISTRATOR, true, &HandleSupportCheckProfCommand, }, { "aura", SEC_ADMINISTRATOR, true, &HandleSupportCheckAuraCommand, }, { "auras", SEC_ADMINISTRATOR, true, &HandleSupportCheckAurasCommand, }, - { "premium", SEC_ADMINISTRATOR, true, &HandleSupportCheckPremCommand, }, - { "verified", SEC_ADMINISTRATOR, true, &HandleSupportCheckVerifCommand, }, { "boost", SEC_ADMINISTRATOR, true, &HandleSupportCheckBoostCommand, }, { "services", SEC_ADMINISTRATOR, false, { @@ -2435,79 +2433,6 @@ class support_commandscript : public CommandScript } // quest support end - static bool HandleSupportCheckPremCommand(ChatHandler* handler, char const* args) - { - if (!args) - return false; - - Tokenizer tok{ args, ' ' }; - if (tok.size() != 1) - return false; - - Player* player; - uint64 guid; - std::string name; - if (!handler->extractPlayerTarget((char*)tok[0], &player, &guid, &name)) - return false; - - if (player) - { - if (player->GetSession()->IsPremium()) - { - auto member = player->GetSession()->GetprojectMemberInfo(); - time_t until = member->GetPremiumUnsetDate(); - handler->PSendSysMessage("Player %s (guid: %u, memberId: %u) has premium until %s.", handler->GetNameLink(player).c_str(), GUID_LOPART(guid), member->MemberID, TimeToTimestampStr(until).c_str()); - } - } - else - { - if (QueryResult charResult = CharacterDatabase.PQuery("SELECT account FROM characters WHERE guid = %u", GUID_LOPART(guid))) - { - if (QueryResult memberResult = LoginDatabase.PQuery("SELECT member_id, unsetdate, active FROM project_member_premiums WHERE id = %u", (*charResult)[0].GetUInt32())) - { - if ((*memberResult)[2].GetUInt32()) - { - uint32 memberId = (*memberResult)[0].GetUInt32(); - time_t until = (*memberResult)[1].GetUInt32(); - handler->PSendSysMessage("Player %s (guid: %u, memberId: %u) has premium until %s.", name.c_str(), GUID_LOPART(guid), memberId, TimeToTimestampStr(until).c_str()); - } - } - } - } - return true; - } - - static bool HandleSupportCheckVerifCommand(ChatHandler* handler, char const* args) - { - if (!args) - return false; - - Tokenizer tok{ args, ' ' }; - if (tok.size() != 1) - return false; - - Player* player; - uint64 guid; - std::string name; - if (!handler->extractPlayerTarget((char*)tok[0], &player, &guid, &name)) - return false; - - if (player) - { - if (auto member = player->GetSession()->GetprojectMemberInfo()) - if (member->IsVerified) - handler->PSendSysMessage("Player %s (guid: %u, memberId: %u) is verified.", handler->GetNameLink(player).c_str(), GUID_LOPART(guid), member->MemberID); - } - else - { - if (QueryResult charResult = CharacterDatabase.PQuery("SELECT account FROM characters WHERE guid = %u", GUID_LOPART(guid))) - if (QueryResult accountResult = LoginDatabase.PQuery("SELECT project_member_id FROM account WHERE id = %u", (*charResult)[0].GetUInt32())) - if (uint32 memberId = (*accountResult)[0].GetUInt32()) - handler->PSendSysMessage("Player %s (guid: %u, memberId: %u) is verified.", name.c_str(), GUID_LOPART(guid), memberId); - } - return true; - } - static bool HandleSupportCheckBoostCommand(ChatHandler* handler, char const* args) { if (!args) diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp index 8148d695b..a8b192a91 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp @@ -32,9 +32,6 @@ OutdoorPvPNA::OutdoorPvPNA() void OutdoorPvPNA::HandleKillImpl(Player* player, Unit* killed) { - if (sWorld->AreprojectDailyQuestsEnabled() && killed->GetTypeId() == TYPEID_PLAYER) - player->CreditprojectDailyQuest(180010); // project Daily Quest Credit - Outdoor PvP Honorable Kill - if (killed->GetTypeId() == TYPEID_PLAYER && player->GetTeam() != killed->ToPlayer()->GetTeam()) { player->KilledMonsterCredit(NA_CREDIT_MARKER, 0); // 0 guid, btw it isn't even used in killedmonster function :S diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 75619e47f..921cff8ff 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -3278,7 +3278,6 @@ class spell_gen_survey : public SpellScriptLoader go = player->SummonGameObject(find->goEntry, find->x, find->y, find->z, 0, { }, 30); // TODO: verify despawn time - player->CreditprojectDailyQuest(180024); // project Daily Quest Credit - Surveys } else { diff --git a/src/server/shared/Database/Implementation/LoginDatabase.cpp b/src/server/shared/Database/Implementation/LoginDatabase.cpp index 457b8d4d1..0a6490a2c 100644 --- a/src/server/shared/Database/Implementation/LoginDatabase.cpp +++ b/src/server/shared/Database/Implementation/LoginDatabase.cpp @@ -138,14 +138,5 @@ void LoginDatabaseConnection::DoPrepareStatements() // WoW-Token PrepareStatement(LOGIN_INS_WOW_TOKEN, "INSERT INTO wow_token (accountId, characterGuid, realm, coins) VALUES (?, ?, ?, ?)", CONNECTION_SYNCH); - // project - PrepareStatement(LOGIN_SEL_project_MEMBER_PREMIUM, "SELECT unsetdate FROM project_member_premiums WHERE (member_id = ? OR member_id = 0) AND active = 1 ORDER BY unsetdate DESC", CONNECTION_SYNCH); - PrepareStatement(LOGIN_SEL_ACCOUNT_VERIFIED, "SELECT 1 FROM account WHERE project_member_id = ? AND project_verified LIMIT 1", CONNECTION_SYNCH); - PrepareStatement(LOGIN_SEL_project_MEMBER_SETTINGS, "SELECT setting, value FROM project_member_settings WHERE member_id = ?", CONNECTION_SYNCH); - PrepareStatement(LOGIN_REP_project_MEMBER_SETTING, "REPLACE INTO project_member_settings (member_id, setting, value) VALUES (?, ?, ?)", CONNECTION_ASYNC); - PrepareStatement(LOGIN_DEL_project_MEMBER_SETTING, "DELETE FROM project_member_settings WHERE member_id = ? AND setting = ?", CONNECTION_ASYNC); - PrepareStatement(LOGIN_SEL_project_MEMBER_TODAYS_DAILY_REWARDS, "SELECT source_id FROM project_member_rewards WHERE member_id = ? AND source_type = ? AND reward_day = ? AND realmid = ?", CONNECTION_SYNCH); - PrepareStatement(LOGIN_INS_project_MEMBER_REWARD, "INSERT INTO project_member_rewards (member_id, character_guid, account_id, realmid, source_type, source_id, reward_amount, reward_date, reward_day) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); - PrepareStatement(LOGIN_INS_ARENA_GAMES, "INSERT INTO arena_games (`gameid`, `teamid`, `guid`, `changeType`, `ratingChange`, `teamRating`, `damageDone`, `deaths`, `healingDone`, `damageTaken`, `healingTaken`, `killingBlows`, `damageAbsorbed`, `timeControlled`, `aurasDispelled`, `aurasStolen`, `highLatencyTimes`, `spellsPrecast`, `mapId`, `start`, `end`, `class`, `season`, `type`, `realmid`, `matchMakerRating`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); } diff --git a/src/server/shared/Database/Implementation/LoginDatabase.h b/src/server/shared/Database/Implementation/LoginDatabase.h index 1418d71a0..dd6979205 100644 --- a/src/server/shared/Database/Implementation/LoginDatabase.h +++ b/src/server/shared/Database/Implementation/LoginDatabase.h @@ -142,14 +142,6 @@ enum LoginDatabaseStatements LOGIN_GET_ACCOUNT_ID_BY_USERNAME, LOGIN_GET_ACCOUNT_ACCESS_GMLEVEL, - LOGIN_SEL_project_MEMBER_PREMIUM, - LOGIN_SEL_ACCOUNT_VERIFIED, - LOGIN_SEL_project_MEMBER_SETTINGS, - LOGIN_REP_project_MEMBER_SETTING, - LOGIN_DEL_project_MEMBER_SETTING, - LOGIN_SEL_project_MEMBER_TODAYS_DAILY_REWARDS, - LOGIN_INS_project_MEMBER_REWARD, - LOGIN_INS_ARENA_GAMES, MAX_LOGINDATABASE_STATEMENTS