Jump to content

Search the Community

Showing results for tags 'battleground'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • News and Announcements
    • News
  • General
    • Suggestions & Feedback
    • General Chat
    • GFX
    • VFX
  • MMO Hub
    • Gamer's Lounge
    • Member's Lounge
    • Developer Lounge
  • MMO Corner
    • World of Warcraft
    • Lineage 2
    • Minecraft
    • Host Listing
    • Server Listing
    • Server Recruitment
    • Server Reviews
    • The Underground
  • User Hub
    • Support
    • Report
    • Contact Staff
  • Merchant Corner
    • Marketplace
  • General Development Releases
    • Applications
  • Tutorials
    • Programming
    • Web Development
  • Wasteland

Categories

  • Creative Corner
    • GFX Releases
    • VFX Releases
    • Resources
  • MMO and MMORPG
    • World of Warcraft
    • Lineage 2
    • Minecraft
  • Webmasters
    • Content Management Systems
    • Addons
    • Scripts
    • Designs
    • Proxies
    • HTML
  • Applications
  • Gaming
    • World of Warcraft
    • Lineage 2
    • Minecraft
    • Emulation
    • Nulled Distributions
  • Marketplace
    • Marsh Designs
    • iDarts

Product Groups

  • Membership
  • Advertise
  • Promote

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Interests


How Did You Find Us?


Contributor


Discord

Found 1 result

  1. Configuration 1) Open World.h and Inside: enum WorldBoolConfigs add: CONFIG_CROSSFACTIONBG 2) Open World.cpp and add: m_bool_configs[CONFIG_CROSSFACTIONBG] = sConfigMgr->GetBoolDefault("MixedBGs", true); Around line #1191 where all the other options are loading. Player source & header file 1) Open Player.h and Player.cpp. In Player.h go to line #1061 and above line #1066 add: //CROSSFACION BG START private: bool m_ForgetBGPlayers; bool m_ForgetInListPlayers; public: typedef std::vector<uint64> FakePlayers; void FitPlayerInTeam(bool action); void DoForgetPlayersInList(); void DoForgetPlayersInBG(Battleground* pBattleGround); uint8 GetFakeRaceOrRace(); void SetForgetBGPlayers(bool tralse) { m_ForgetBGPlayers = tralse; } bool ShouldForgetBGPlayers() { return m_ForgetBGPlayers; } void SetForgetInListPlayers(bool tralse) { m_ForgetInListPlayers = tralse; } bool ShouldForgetInListPlayers() { return m_ForgetInListPlayers; } bool SendBattleGroundChat(uint32 msgtype, std::string message); void MorphFit(bool value); bool TeamIsBGTeam() { return GetBGTeam() == GetTeam(); } FakePlayers m_FakePlayers; //CROSSFACION BG END 2) Go to line #1887 and above that add: TeamId GetBGTeamId() const { return GetBGTeam() == ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE; } 3) Go to Player.cpp and on any line under a function of your choice add: /*#################################################################################### ###############################CROSSFACTION BATTLEGROUNDS############################# ####################################################################################*/ void Player::FitPlayerInTeam(bool action) { ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(GetFakeRaceOrRace()); if(rEntry && !TeamIsBGTeam() && action) setFaction(rEntry->FactionID); else setFactionForRace(getRace()); if (action) SetForgetBGPlayers(true); else SetForgetInListPlayers(true); MorphFit(action); if (GetBattleground() && action) ChatHandler(GetSession()).PSendSysMessage("You are playing for the %s%s in %s!", GetBGTeam() == ALLIANCE ? "|cff0000FFalliance|r" : "|cffFF0000horde|r", GetBattleground()->GetName()); } uint8 Player::GetFakeRaceOrRace() { if(!TeamIsBGTeam()) return GetBGTeam() == ALLIANCE ? RACE_HUMAN : RACE_BLOODELF; else return getRace(); } void Player::DoForgetPlayersInList() { // m_FakePlayers is filled from a vector within the battleground // they were in previously so all players that have been in that BG will be invalidated. for (FakePlayers::const_iterator itr = m_FakePlayers.begin(); itr != m_FakePlayers.end(); ++itr) { WorldPacket data(SMSG_INVALIDATE_PLAYER, 8); data << *itr; GetSession()->SendPacket(&data); if (Player* pPlayer = ObjectAccessor::FindPlayer(*itr)) GetSession()->SendNameQueryOpcode(*itr); } m_FakePlayers.clear(); } void Player::DoForgetPlayersInBG(Battleground* pBattleGround) { if (!pBattleGround || pBattleGround->isArena()) return; for (Battleground::BattlegroundPlayerMap::const_iterator itr = pBattleGround->GetPlayers().begin(); itr != pBattleGround->GetPlayers().end(); ++itr) { // Here we invalidate players in the bg to the added player WorldPacket data1(SMSG_INVALIDATE_PLAYER, 8); data1 << itr->first; GetSession()->SendPacket(&data1); GetSession()->SendNameQueryOpcode(itr->first); if (Player* pPlayer = ObjectAccessor::FindPlayer(itr->first)) { // Here we invalidate the player added to players in the bg WorldPacket data2(SMSG_INVALIDATE_PLAYER, 8); data2 << GetGUID(); pPlayer->GetSession()->SendPacket(&data2); pPlayer->GetSession()->SendNameQueryOpcode(GetGUID()); } } } bool BattlegroundQueue::CheckCrossFactionMatch(BattlegroundBracketId bracket_id, Battleground* bg) { TC_LOG_DEBUG("misc", "BattleGroundQueue::CheckCrossFactionMatch"); if (bg->isArena()) return false; // Only do this if crossbg's are enabled. // Here we will add all players to selectionpool, later we check if there are enough and launch a bg. FillXPlayersToBG(bracket_id, bg, true); uint8 MPT = bg->GetMinPlayersPerTeam(); if (m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() < MPT || m_SelectionPools[TEAM_HORDE].GetPlayerCount() < MPT) { TC_LOG_DEBUG("misc", "Not enough players. Has: %u Need: %u", m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() + m_SelectionPools[TEAM_HORDE].GetPlayerCount(), MPT * 2); return false; } return true; } // This function will invite players in the least populated faction, which makes battleground queues much faster. // This function will return true if cross faction battlegrounds are enabled, otherwise return false, // which is useful in FillPlayersToBG. Because then we can interrupt the regular invitation if cross faction bg's are enabled. bool BattlegroundQueue::FillXPlayersToBG(BattlegroundBracketId bracket_id, Battleground* bg, bool start) { if (sWorld->getBoolConfig(CONFIG_CROSSFACTIONBG)) { int32 aliFree = start ? bg->GetMinPlayersPerTeam() : bg->GetFreeSlotsForTeam(ALLIANCE); int32 hordeFree = start ? bg->GetMinPlayersPerTeam() : bg->GetFreeSlotsForTeam(HORDE); // Empty selection pools. They will be refilled from queued groups. m_SelectionPools[TEAM_ALLIANCE].Init(); m_SelectionPools[TEAM_HORDE].Init(); int32 valiFree = aliFree; int32 vhordeFree = hordeFree; int32 diff = 0; TC_LOG_DEBUG("misc", "valiFree: %u vhordeFree: %u", valiFree, vhordeFree); for (GroupsQueueType::iterator itr = m_QueuedGroups[bracket_id][BG_QUEUE_MIXED].begin(); itr != m_QueuedGroups[bracket_id][BG_QUEUE_MIXED].end(); ++itr) { if ((*itr)->IsInvitedToBGInstanceGUID) continue; diff = abs(valiFree - vhordeFree); bool moreAli = valiFree < vhordeFree; if (diff > 0) (*itr)->Team = moreAli ? HORDE : ALLIANCE; bool alliance = (*itr)->Team == ALLIANCE; if (m_SelectionPools[alliance ? TEAM_ALLIANCE : TEAM_HORDE].AddGroup((*itr), alliance ? aliFree : hordeFree)) { uint8 GSize = (*itr)->Players.size(); alliance ? valiFree -= GSize : vhordeFree -= GSize; } } return true; } return false; } bool Player::SendBattleGroundChat(uint32 msgtype, std::string message) { float distance = msgtype == CHAT_MSG_SAY ? sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY) : sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL); if (Battleground* pBattleGround = GetBattleground()) { for (Battleground::BattlegroundPlayerMap::const_iterator itr = pBattleGround->GetPlayers().begin(); itr != pBattleGround->GetPlayers().end(); ++itr) { if (Player* pPlayer = ObjectAccessor::FindPlayer(itr->first)) { if (GetDistance2d(pPlayer->GetPositionX(), pPlayer->GetPositionY()) <= distance) { if (GetBGTeam() == pPlayer->GetBGTeam()) { WorldPacket data; ChatHandler::BuildChatPacket(data, ChatMsg(msgtype), LANG_UNIVERSAL, pPlayer, NULL, message); pPlayer->GetSession()->SendPacket(&data); } else if (msgtype != CHAT_MSG_EMOTE) { WorldPacket data; ChatHandler::BuildChatPacket(data, ChatMsg(msgtype), pPlayer->GetTeam() == ALLIANCE ? LANG_ORCISH : LANG_COMMON, pPlayer, NULL, message); pPlayer->GetSession()->SendPacket(&data); } } } } return true; } else return false; } void Player::MorphFit(bool value) { if (!TeamIsBGTeam() && value) { if (GetBGTeam() == ALLIANCE) { if (getGender() == GENDER_MALE) { SetDisplayId(19723); SetNativeDisplayId(19723); } else { SetDisplayId(19724); SetNativeDisplayId(19724); } } else { if (getGender() == GENDER_MALE) { SetDisplayId(20578); SetNativeDisplayId(20578); } else { SetDisplayId(20579); SetNativeDisplayId(20579); } } } else InitDisplayIds(); } Unit.cpp & Handlers 1) Open QueryHandler.cpp and under SendNameQueryOpcode(uint64 guid), change: data << uint8(nameData->m_race); to data << uint8(player ? player->GetFakeRaceOrRace() : nameData->m_race); 2) Open MiscHandler.cpp and under void WorldSession::HandleTimeSyncResp(WorldPacket& recvData) add: (Above or below line: #1418) Battleground* bg = _player->GetBattleground(); if (bg) { if (_player->ShouldForgetBGPlayers()) { _player->DoForgetPlayersInBG(bg); _player->SetForgetBGPlayers(false); } } else if (_player->ShouldForgetInListPlayers()) { _player->DoForgetPlayersInList(); _player->SetForgetInListPlayers(false); } 3) Open ChatHandler.cpp and Inside of void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData) add: (Above line #251) if (!GetPlayer()->IsGameMaster()) if (GetPlayer()->SendBattleGroundChat(type, msg)) return; 4) Open CharacterHandler.cpp and Inside of void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder) Under line #1031 add: if (sWorld->getBoolConfig(CONFIG_CROSSFACTIONBG)) { float x = pCurrChar->GetPositionX(); float y = pCurrChar->GetPositionY(); float z = pCurrChar->GetPositionZ(); uint32 hm = pCurrChar->m_homebindMapId; float hx = pCurrChar->m_homebindX; float hy = pCurrChar->m_homebindX; float hz = pCurrChar->m_homebindX; if (z+1 < pCurrChar->GetMap()->GetHeight(x, y, MAX_HEIGHT) && pCurrChar->GetMap()->IsOutdoors(x, y, z)) pCurrChar->TeleportTo(hm, hx, hy, hz, 0); } if (pCurrChar->GetBattleground() && !pCurrChar->GetBattleground()->isArena()) pCurrChar->FitPlayerInTeam(true); else pCurrChar->FitPlayerInTeam(false); 5) Open Unit.cpp and Inside of void Unit::RestoreFaction() on line #15921, change: ToPlayer()->setFactionForRace(getRace()); to ToPlayer()->setFactionForRace(ToPlayer()->GetFakeRaceOrRace()); BattlegroundQueue.h 1) Open BattlegroundQueue.h and Inside of enum BattlegroundQueueGroupTypes under BG_QUEUE_NORMAL_HORDE = 3, add: BG_QUEUE_MIXED = 4 End Result: enum BattlegroundQueueGroupTypes { BG_QUEUE_PREMADE_ALLIANCE = 0, BG_QUEUE_PREMADE_HORDE = 1, BG_QUEUE_NORMAL_ALLIANCE = 2, BG_QUEUE_NORMAL_HORDE = 3, BG_QUEUE_MIXED = 4 }; 2) On line #65 replace #define BG_QUEUE_GROUP_TYPES_COUNT 4 with: #define BG_QUEUE_GROUP_TYPES_COUNT 5 3) Under line #75 add: bool FillXPlayersToBG(BattlegroundBracketId bracket_id, Battleground* bg, bool start = false); bool CheckCrossFactionMatch(BattlegroundBracketId bracket_id, Battleground* bg); BattlegroundQueue.cpp 1) Open BattlegroundQueue.cpp and on line #840, change: if (CheckNormalMatch(bg_template, bracket_id, MinPlayersPerTeam, MaxPlayersPerTeam) || (bg_template->isArena() && CheckSkirmishForSameFaction(bracket_id, MinPlayersPerTeam))) to if (CheckNormalMatch(bg_template, bracket_id, MinPlayersPerTeam, MaxPlayersPerTeam) || (bg_template->isArena() && CheckSkirmishForSameFaction(bracket_id, MinPlayersPerTeam)) || CheckCrossFactionMatch(bracket_id, bg_template)) 2) On line #747, change: if (m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].empty() && m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].empty() && m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE].empty() && m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].empty()) return; to if (m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].empty() && m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].empty() && m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE].empty() && m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].empty() && m_QueuedGroups[bracket_id][BG_QUEUE_MIXED].empty()) return; 3) On line #501 add: if (!bg->isArena()) if (FillXPlayersToBG(bracket_id, bg, false)) return; 4) On line #313, change: for (uint32 j = index; j < BG_QUEUE_GROUP_TYPES_COUNT; j += BG_TEAMS_COUNT) to for (uint32 j = 0; j < BG_QUEUE_GROUP_TYPES_COUNT; ++j) 5) On line #298, change: TC_LOG_ERROR("bg.battleground", "BattlegroundQueue: couldn't find player %s (GUID: %u)", playerName.c_str(), GUID_LOPART(guid)); to TC_LOG_DEBUG("bg.battleground", "BattlegroundQueue: couldn't find player %s (GUID: %u)", playerName.c_str(), GUID_LOPART(guid)); 6) Inside of GroupQueueInfo* BattlegroundQueue::AddGroup(Player* leader, Group* grp, BattlegroundTypeId BgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 ArenaType, bool isRated, bool isPremade, uint32 ArenaRating, uint32 MatchmakerRating, uint32 arenateamid) on line #143 change: ginfo->Team = leader->GetTeam(); to ginfo->Team = leader->GetBGTeam(); 7) Above line #157 add: if (sWorld->getBoolConfig(CONFIG_CROSSFACTIONBG) && ArenaType == 0) index = BG_QUEUE_MIXED; 8) On line #200 change: if (Battleground* bg = sBattlegroundMgr->GetBattlegroundTemplate(ginfo->BgTypeId)) { char const* bgName = bg->GetName(); uint32 MinPlayers = bg->GetMinPlayersPerTeam(); uint32 qHorde = 0; uint32 qAlliance = 0; uint32 q_min_level = bracketEntry->minLevel; uint32 q_max_level = bracketEntry->maxLevel; GroupsQueueType::const_iterator itr; for (itr = m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_ALLIANCE].begin(); itr != m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_ALLIANCE].end(); ++itr) if (!(*itr)->IsInvitedToBGInstanceGUID) qAlliance += (*itr)->Players.size(); for (itr = m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_HORDE].begin(); itr != m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_HORDE].end(); ++itr) if (!(*itr)->IsInvitedToBGInstanceGUID) qHorde += (*itr)->Players.size(); // Show queue status to player only (when joining queue) if (sWorld->getBoolConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY)) { ChatHandler(leader->GetSession()).PSendSysMessage(LANG_BG_QUEUE_ANNOUNCE_SELF, bgName, q_min_level, q_max_level, qAlliance, (MinPlayers > qAlliance) ? MinPlayers - qAlliance : (uint32)0, qHorde, (MinPlayers > qHorde) ? MinPlayers - qHorde : (uint32)0); } // System message else { sWorld->SendWorldText(LANG_BG_QUEUE_ANNOUNCE_WORLD, bgName, q_min_level, q_max_level, qAlliance, (MinPlayers > qAlliance) ? MinPlayers - qAlliance : (uint32)0, qHorde, (MinPlayers > qHorde) ? MinPlayers - qHorde : (uint32)0); } } to if (Battleground* bg = sBattlegroundMgr->GetBattlegroundTemplate(ginfo->BgTypeId)) { if (sWorld->getBoolConfig(CONFIG_CROSSFACTIONBG)) { char const* bgName = bg->GetName(); uint32 MinPlayers = bg->GetMinPlayersPerTeam()*2; uint32 qPlayers = 0; uint32 q_min_level = bracketEntry->minLevel; uint32 q_max_level = bracketEntry->maxLevel; for (GroupsQueueType::const_iterator itr = m_QueuedGroups[bracketId][BG_QUEUE_MIXED].begin(); itr != m_QueuedGroups[bracketId][BG_QUEUE_MIXED].end(); ++itr) if (!(*itr)->IsInvitedToBGInstanceGUID) qPlayers += (*itr)->Players.size(); if (sWorld->getBoolConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY)) ChatHandler(leader->GetSession()).PSendSysMessage("Queue status for %s (Lvl: %u to %u) Queued players: %u (Need at least %u more)", bgName, q_min_level, q_max_level, qPlayers, MinPlayers - qPlayers); else { std::ostringstream ss; ss << "|cffff0000[BG Queue Announcer]:|r " << bgName << " -- [" << q_min_level << "-" << q_max_level << "]" << qPlayers << "/" << MinPlayers; sWorld->SendGlobalText(ss.str().c_str(), NULL); } } else { char const* bgName = bg->GetName(); uint32 MinPlayers = bg->GetMinPlayersPerTeam(); uint32 qHorde = 0; uint32 qAlliance = 0; uint32 q_min_level = bracketEntry->minLevel; uint32 q_max_level = bracketEntry->maxLevel; GroupsQueueType::const_iterator itr; for (itr = m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_ALLIANCE].begin(); itr != m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_ALLIANCE].end(); ++itr) if (!(*itr)->IsInvitedToBGInstanceGUID) qAlliance += (*itr)->Players.size(); for (itr = m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_HORDE].begin(); itr != m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_HORDE].end(); ++itr) if (!(*itr)->IsInvitedToBGInstanceGUID) qHorde += (*itr)->Players.size(); // Show queue status to player only (when joining queue) if (sWorld->getBoolConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY)) { ChatHandler(leader->GetSession()).PSendSysMessage(LANG_BG_QUEUE_ANNOUNCE_SELF, bgName, q_min_level, q_max_level, qAlliance, (MinPlayers > qAlliance) ? MinPlayers - qAlliance : (uint32)0, qHorde, (MinPlayers > qHorde) ? MinPlayers - qHorde : (uint32)0); } // System message else { sWorld->SendWorldText(LANG_BG_QUEUE_ANNOUNCE_WORLD, bgName, q_min_level, q_max_level, qAlliance, (MinPlayers > qAlliance) ? MinPlayers - qAlliance : (uint32)0, qHorde, (MinPlayers > qHorde) ? MinPlayers - qHorde : (uint32)0); } } } Credits: QQrofl(Script) Death(Tutorial reformat)
×
×
  • Create New...