Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CFBG system is not working properly #64

Open
Bolek25 opened this issue Oct 22, 2021 · 4 comments
Open

CFBG system is not working properly #64

Bolek25 opened this issue Oct 22, 2021 · 4 comments

Comments

@Bolek25
Copy link

Bolek25 commented Oct 22, 2021

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:

  1. Compile Core
  2. Set up min players for battleground start in my case 4 players for WSG
  3. Run Server
  4. Create 6 Accounts
  5. Log ingame and Join WSG battleground
  6. 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

@mikex2k
Copy link

mikex2k commented Feb 23, 2022

confirmed this is still the issue

@AByakugans
Copy link

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!

@6yTblJIka
Copy link

unfortunately the CFBG mod is still broken -(

@6yTblJIka
Copy link

#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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants