TrinityCoreCustomChanges
TrinityCoreCustomChanges copied to clipboard
CFBG system is not working properly
Description:
FIRST ISSUE IS : cfbg after compilation looks like it works properly, but ingame when you run the battleground, it connects all players to one team and the other team is empty. (for example 2 alliance players join bg and 2 horde players join bg, now who first clicks on enter battleground, if horde player changes it to alliance player and puts it in the team alliance, then all players put it in the alliance team, if he gives the first enter battleground alliance player, then it turns him into a horde player and everyone is in the horde team. SECOND ISSUE IS : when the battleground starts, it can no longer be joined, it does not send an invitation to the ongoing battleground.
Current behaviour:
no crash nothing happens, everything looks like it works well.
Expected behaviour:
cfbg should work as a balance system, it should assign one player to one team, another to another team, and gradually fill bg to full. and you should definitely join the ongoing battleground.
Steps to reproduce the problem:
- Compile Core
- Set up min players for battleground start in my case 4 players for WSG
- Run Server
- Create 6 Accounts
- Log ingame and Join WSG battleground
- Enter the battleground and check the system as the player connects
Branch(es):
Writing server debug on console will return the best results for reporting bugs (3.3.5a for now) 3.3.5, CFBG or both
TC rev. hash/commit:
TrinityCore rev. 2302a5bc4451+ 2021-08-30 00:48:59 +0000 (master branch) (Win64, RelWithDebInfo, Static)
TDB version: TDB 335.21081
Operating system: Win64
confirmed this is still the issue
Is there anyone who is fixing the custom code bugs? Or anyone has more current/updated/fixed version somewhere else? Thank you for the info!
unfortunately the CFBG mod is still broken -(
#include "ScriptMgr.h" #include "CFBGData.h" #include "Chat.h" #include "RBAC.h" #include "WorldSession.h" #include "Battleground.h" #include "World.h" #include "Config.h"
using namespace Trinity::ChatCommands;
class CrossFactionBattlegroundPlayerScript : public PlayerScript { public: CrossFactionBattlegroundPlayerScript() : PlayerScript("CrossfactionBattlegroundPlayerScript") { }
void OnLogin(Player* player, bool /*firstLogin*/)
{
// Get the number of registered players in each faction in the battleground
int alliancePlayers = player->cfbgdata->GetAlliancePlayersCount();
int hordePlayers = player->cfbgdata->GetHordePlayersCount();
// Check the difference in player count between the factions
int difference = abs(alliancePlayers - hordePlayers);
if (difference >= 2) {
// If the difference in player count is 2 or more, assign the player to the less populous faction
if (alliancePlayers > hordePlayers) {
// Assign the player to the Horde faction
player->SetRace(player->cfbgdata->GetHRace());
player->SetFactionForRace(player->GetRace());
} else {
// Assign the player to the Alliance faction
player->SetRace(player->cfbgdata->GetFRace());
player->SetFactionForRace(player->GetRace());
}
player->cfbgdata->SetRaceDisplayID();
}
}
};
class CrossFactionBattlegroundCommandScript : public CommandScript { public: CrossFactionBattlegroundCommandScript() : CommandScript("CrossFactionBattlegroundCommandScript") { }
ChatCommandTable GetCommands() const override
{
static ChatCommandTable debugCommandTable =
{
{ "startbg", HandleDebugBattlegroundCommand, rbac::RBAC_PERM_COMMAND_DEBUG, Console::No },
};
static ChatCommandTable commandTable =
{
{ "cfbg", debugCommandTable },
};
return commandTable;
}
static bool HandleDebugBattlegroundCommand(ChatHandler* handler)
{
if (!handler->GetSession())
return false;
auto bg = handler->GetSession()->GetPlayer()->GetBattleground();
if (bg)
{
bg->SetStartDelayTime(-1);
handler->SendSysMessage("Battleground started");
}
return true;
}
};
class CrossFactionBattlegroundWorldScript : public WorldScript { public: CrossFactionBattlegroundWorldScript() : WorldScript("CrossFactionBattlegroundWorldScript") { }
void OnConfigLoad(bool /*reload*/)
{
sWorld->setBoolConfig(CONFIG_CFBG_ENABLED, sConfigMgr->GetBoolDefault("CrossFactionBattlegrounds.Enable", true));
sWorld->setBoolConfig(CONFIG_CFBG_REPLACELANGUAGES, sConfigMgr->GetBoolDefault("CrossFactionBattlegrounds.ReplaceLanguages", true));
sWorld->setBoolConfig(CONFIG_CFBG_REPLACERACIALS, sConfigMgr->GetBoolDefault("CrossFactionBattlegrounds.ReplaceRacials", false));
}
};
void AddSC_CrossfactionBattlegrounds() { new CrossFactionBattlegroundPlayerScript(); new CrossFactionBattlegroundCommandScript(); new CrossFactionBattlegroundWorldScript(); }
Try modify this , maybe some can fix