diff --git a/conf/arena_3v3_solo_queue.conf.dist b/conf/arena_3v3_solo_queue.conf.dist index ee7ecb4..8fd686f 100644 --- a/conf/arena_3v3_solo_queue.conf.dist +++ b/conf/arena_3v3_solo_queue.conf.dist @@ -12,10 +12,10 @@ Solo.3v3.Enable = 1 Solo.3v3.MinLevel = 80 Solo.3v3.Cost = 45 Solo.3v3.ArenaPointsMulti = 0.8 -Solo.3v3.FilterTalents = 1 +Solo.3v3.FilterTalents = 0 Solo.3v3.VendorRating = 1 Arena.3v3.BlockForbiddenTalents = 0 -Arena.CheckEquipAndTalents = 1 +Arena.CheckEquipAndTalents = 0 Solo.3v3.CastDeserterOnAfk = 1 -Solo.3v3.CastDeserterOnLeave = 1 -Solo.3v3.StopGameIncomplete = 1 +Solo.3v3.CastDeserterOnLeave = 0 +Solo.3v3.StopGameIncomplete = 0 diff --git a/src/solo3v3.cpp b/src/solo3v3.cpp index bbcd65c..161c36c 100644 --- a/src/solo3v3.cpp +++ b/src/solo3v3.cpp @@ -235,14 +235,21 @@ bool Solo3v3::CheckSolo3v3Arena(BattlegroundQueue* queue, BattlegroundBracketId if (!filterTalents && queue->m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() + queue->m_SelectionPools[TEAM_HORDE].GetPlayerCount() == MinPlayersPerTeam * 2) return true; - Solo3v3TalentCat plrCat = GetTalentCatForSolo3v3(plr); // get talent cat + if (!plr) + return false; + + Solo3v3TalentCat playerSlotIndex; + if (sConfigMgr->GetOption("Solo.3v3.FilterTalents", false)) + playerSlotIndex = GetTalentCatForSolo3v3(plr); + else + playerSlotIndex = GetFirstAvailableSlot(soloTeam); // is slot free in alliance team? - if ((filterTalents && soloTeam[TEAM_ALLIANCE][plrCat] == false) || (!filterTalents && queue->m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() != MinPlayersPerTeam)) + if ((filterTalents && soloTeam[TEAM_ALLIANCE][playerSlotIndex] == false) || (!filterTalents && queue->m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() != MinPlayersPerTeam)) { if (queue->m_SelectionPools[TEAM_ALLIANCE].AddGroup((*itr), MinPlayersPerTeam)) // added successfully? { - soloTeam[TEAM_ALLIANCE][plrCat] = true; // okay take this slot + soloTeam[TEAM_ALLIANCE][playerSlotIndex] = true; // okay take this slot if ((*itr)->teamId != TEAM_ALLIANCE) // move to other team { @@ -254,11 +261,11 @@ bool Solo3v3::CheckSolo3v3Arena(BattlegroundQueue* queue, BattlegroundBracketId } } } - else if ((filterTalents && soloTeam[TEAM_HORDE][plrCat] == false) || !filterTalents) // nope? and in horde team? + else if ((filterTalents && soloTeam[TEAM_HORDE][playerSlotIndex] == false) || !filterTalents) // nope? and in horde team? { if (queue->m_SelectionPools[TEAM_HORDE].AddGroup((*itr), MinPlayersPerTeam)) { - soloTeam[TEAM_HORDE][plrCat] = true; + soloTeam[TEAM_HORDE][playerSlotIndex] = true; if ((*itr)->teamId != TEAM_HORDE) // move to other team { @@ -354,15 +361,12 @@ bool Solo3v3::Arena3v3CheckTalents(Player* player) ChatHandler(player->GetSession()).SendSysMessage("You can't join, because you have invested to much points in a forbidden talent. Please edit your talents."); return false; } - else - return true; + + return true; } Solo3v3TalentCat Solo3v3::GetTalentCatForSolo3v3(Player* player) { - if (!player || !sConfigMgr->GetOption("Solo.3v3.FilterTalents", false)) - return MELEE; - uint32 count[MAX_TALENT_CAT]; for (int i = 0; i < MAX_TALENT_CAT; i++) @@ -412,3 +416,16 @@ Solo3v3TalentCat Solo3v3::GetTalentCatForSolo3v3(Player* player) return talCat; } + +Solo3v3TalentCat Solo3v3::GetFirstAvailableSlot(bool soloTeam[][MAX_TALENT_CAT]) { + if (!soloTeam[0][MELEE] || !soloTeam[1][MELEE]) + return MELEE; + + if (!soloTeam[0][RANGE] || !soloTeam[1][RANGE]) + return RANGE; + + if (!soloTeam[0][HEALER] || !soloTeam[1][HEALER]) + return HEALER; + + return MELEE; +} diff --git a/src/solo3v3.h b/src/solo3v3.h index e475571..a02bcb6 100644 --- a/src/solo3v3.h +++ b/src/solo3v3.h @@ -23,12 +23,21 @@ #include "BattlegroundMgr.h" #include "Player.h" -constexpr uint32 ARENA_TEAM_SOLO_3v3 = 3; -constexpr uint32 ARENA_TYPE_3v3_SOLO = 3; -constexpr uint32 ARENA_SLOT_SOLO_3v3 = 3; -constexpr uint32 BATTLEGROUND_QUEUE_3v3_SOLO = 11; +// Custom 1v1 Arena Rated +constexpr uint32 ARENA_TYPE_1v1 = 1; +constexpr uint32 ARENA_TEAM_1v1 = 1; +constexpr uint32 ARENA_SLOT_1v1 = 3; +constexpr uint32 BATTLEGROUND_QUEUE_1v1 = 11; +constexpr BattlegroundQueueTypeId bgQueueTypeId1v1 = (BattlegroundQueueTypeId)((int)BATTLEGROUND_QUEUE_5v5 + 1); + +// custom 3v3 Arena +constexpr uint32 ARENA_TEAM_SOLO_3v3 = 4; +constexpr uint32 ARENA_TYPE_3v3_SOLO = 4; +constexpr uint32 ARENA_SLOT_SOLO_3v3 = 4; +constexpr uint32 BATTLEGROUND_QUEUE_3v3_SOLO = 12; constexpr BattlegroundQueueTypeId bgQueueTypeId = (BattlegroundQueueTypeId)((int)BATTLEGROUND_QUEUE_3v3); + const uint32 FORBIDDEN_TALENTS_IN_1V1_ARENA[] = { // Healer @@ -115,6 +124,7 @@ class Solo3v3 // Returns MELEE, RANGE or HEALER (depends on talent builds) Solo3v3TalentCat GetTalentCatForSolo3v3(Player* player); + Solo3v3TalentCat GetFirstAvailableSlot(bool soloTeam[][MAX_TALENT_CAT]); }; #define sSolo Solo3v3::instance() diff --git a/src/solo3v3_sc.cpp b/src/solo3v3_sc.cpp index df978f8..014f6b3 100644 --- a/src/solo3v3_sc.cpp +++ b/src/solo3v3_sc.cpp @@ -221,6 +221,7 @@ bool NpcSolo3v3::ArenaCheckFullEquipAndTalents(Player* player) ChatHandler(player->GetSession()).SendSysMessage(err.str().c_str()); return false; } + return true; } @@ -263,7 +264,7 @@ bool NpcSolo3v3::JoinQueueArena(Player* player, Creature* creature, bool isRated // check if already in queue if (player->GetBattlegroundQueueIndex(bgQueueTypeId) < PLAYER_MAX_BATTLEGROUND_QUEUES) - return false; // //player is already in this queue + return false; // player is already in this queue // check if has free queue slots if (!player->HasFreeBattlegroundQueueId()) diff --git a/src/solo3v3_sc.h b/src/solo3v3_sc.h index db96a93..c604462 100644 --- a/src/solo3v3_sc.h +++ b/src/solo3v3_sc.h @@ -89,6 +89,41 @@ class PlayerScript3v3Arena : public PlayerScript void AddSC_Solo_3v3_Arena() { + // ArenaSlotByType + if (!ArenaTeam::ArenaSlotByType.count(ARENA_TEAM_1v1)) + ArenaTeam::ArenaSlotByType[ARENA_TEAM_1v1] = ARENA_SLOT_1v1; + + if (!ArenaTeam::ArenaSlotByType.count(ARENA_TEAM_SOLO_3v3)) + ArenaTeam::ArenaSlotByType[ARENA_TEAM_SOLO_3v3] = ARENA_SLOT_SOLO_3v3; + + // ArenaReqPlayersForType + if (!ArenaTeam::ArenaReqPlayersForType.count(ARENA_TYPE_1v1)) + ArenaTeam::ArenaReqPlayersForType[ARENA_TYPE_1v1] = 2; + + if (!ArenaTeam::ArenaReqPlayersForType.count(ARENA_TYPE_3v3_SOLO)) + ArenaTeam::ArenaReqPlayersForType[ARENA_TYPE_3v3_SOLO] = 6; + + // queueToBg + if (!BattlegroundMgr::queueToBg.count(BATTLEGROUND_QUEUE_1v1)) + BattlegroundMgr::queueToBg[BATTLEGROUND_QUEUE_1v1] = BATTLEGROUND_AA; + + if (!BattlegroundMgr::queueToBg.count(BATTLEGROUND_QUEUE_3v3_SOLO)) + BattlegroundMgr::queueToBg[BATTLEGROUND_QUEUE_3v3_SOLO] = BATTLEGROUND_AA; + + // ArenaTypeToQueue + if (!BattlegroundMgr::ArenaTypeToQueue.count(ARENA_TYPE_1v1)) + BattlegroundMgr::ArenaTypeToQueue[ARENA_TYPE_1v1] = (BattlegroundQueueTypeId)BATTLEGROUND_QUEUE_1v1; + + if (!BattlegroundMgr::ArenaTypeToQueue.count(ARENA_TYPE_3v3_SOLO)) + BattlegroundMgr::ArenaTypeToQueue[ARENA_TYPE_3v3_SOLO] = (BattlegroundQueueTypeId)BATTLEGROUND_QUEUE_3v3_SOLO; + + // QueueToArenaType + if (!BattlegroundMgr::QueueToArenaType.count(BATTLEGROUND_QUEUE_1v1)) + BattlegroundMgr::QueueToArenaType[BATTLEGROUND_QUEUE_1v1] = (ArenaType)ARENA_TYPE_1v1; + + if (!BattlegroundMgr::QueueToArenaType.count(BATTLEGROUND_QUEUE_3v3_SOLO)) + BattlegroundMgr::QueueToArenaType[BATTLEGROUND_QUEUE_3v3_SOLO] = (ArenaType)ARENA_TYPE_3v3_SOLO; + new NpcSolo3v3(); new Solo3v3BG(); new Team3v3arena();