• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

[SOLVED] CFBG simple errors!

Status
Not open for further replies.

Synth

Exalted Member
Sup everyone!
Well today i added CFBG to my TrinityCore and once i am compiling i get simple errors cz some code are outdated so if you can help for i can slove my issue?

The errors are:
Code:
2>..\..\..\..\Source\src\server\game\Cfbg\Cfbg.cpp(112) : error C3861: 'BuildPlayerChat': identifier not found
2>..\..\..\..\Source\src\server\game\Cfbg\Cfbg.cpp(114) : error C3861: 'BuildPlayerChat': identifier not found
2>..\..\..\..\Source\src\server\game\Battlegrounds\Battleground.cpp(714) : error C2039: 'outError' : is not a member of 'Log'
2>Core\Source\src\server\shared\Logging/Log.h(34) : see declaration of 'Log'
2>..\..\..\..\Source\src\server\game\Battlegrounds\Battleground.cpp(714) : error C2065: 'LOG_FILTER_GENERAL' : undeclared identifier
2>..\..\..\..\Source\src\server\game\Entities\Player\Player.cpp(12009) : error C3861: 'getORaceMask': identifier not found
2>..\..\..\..\Source\src\server\game\Entities\Player\Player.cpp(22902) : error C2065: 'LOG_FILTER_PLAYER_LOADING' : undeclared identifier
2>..\..\..\..\Source\src\server\game\Entities\Player\Player.cpp(22902) : error C2065: 'LOG_FILTER_PLAYER_LOADING' : undeclared identifier

Code:
Line 112 is: BuildPlayerChat(&data, msgtype, message, LANG_UNIVERSAL);
Line 114 is: BuildPlayerChat(&data, msgtype, message, pPlayer->GetTeam() == ALLIANCE ? LANG_ORCISH : LANG_COMMON);
Line 714 is: sLog->outError(LOG_FILTER_GENERAL, "BattleGround:RewardReputationToTeam: %u not found!", itr->first);
Line 12009 is: if ((proto->AllowableClass & getClassMask()) == 0 || (proto->AllowableRace & getORaceMask()) == 0)
Line 22902 is: TC_LOG_DEBUG(LOG_FILTER_PLAYER_LOADING, "PLAYER (Class: %u Race: %u): Adding initial spell, id = %u", uint32(getClass()), uint32(getORace()), tspell);

So can i know what i should replace for i can slove my issue ?


and ofc i take the script from here: http://emudevs.com/showthread.php/2245-Trinity-Cross-Faction-Battlegrounds

Thank you!
Best regards,
Synth !
 
Last edited:

Barebones

BETA Tester
For 112 and 114 replace that bracket section with

WorldPacket data(SMSG_MESSAGECHAT, 200);

if (GetTeam() == pPlayer->GetTeam())
(data, (ChatMsg)msgtype, LANG_UNIVERSAL, this, pPlayer, message);
else if (msgtype != CHAT_MSG_EMOTE)
ChatHandler::BuildChatPacket(data, (ChatMsg)msgtype, pPlayer->GetTeam() == ALLIANCE ? LANG_ORCISH : LANG_COMMON, this, pPlayer, message);

pPlayer->GetSession()->SendPacket(&data);

This is the entire section for 714

void Battleground::RewardReputationToTeam(uint32 a_faction_id, uint32 h_faction_id, uint32 Reputation, uint32 teamId)
{
FactionEntry const* a_factionEntry = sFactionStore.LookupEntry(a_faction_id);
FactionEntry const* h_factionEntry = sFactionStore.LookupEntry(h_faction_id);

if (!a_factionEntry || !h_factionEntry)
return;

for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
{
if (itr->second.OfflineRemoveTime)
continue;

Player* plr = ObjectAccessor::FindPlayer(itr->first);

if (!plr)
{
TC_LOG_INFO("misc", "BattleGround:RewardReputationToTeam: %u not found!", itr->first);
continue;
}

uint32 team = plr->GetTeam();

if (team == teamId)
plr->GetReputationMgr().ModifyReputation(plr->GetOTeam() == ALLIANCE ? a_factionEntry : h_factionEntry, Reputation);
}
}

I'm unsure about the get0mask.

The last one, replace that line with this:

TC_LOG_DEBUG("entities.player.loading", "PLAYER (Class: %u Race: %u): Adding initial spell, id = %u", uint32(getClass()), uint32(getORace()), tspell);
 
Last edited:

Tommy

Founder
For the sLog error, look at: http://emudevs.com/showthread.php/1...ore-s-Logging-define-directives?p=954#post954

Also, BuildPlayerChat was changed to:

"ChatHandler::BuildChatPacket", arguments you'll be using:

Code:
    WorldPacket data;
    ChatHandler::BuildChatPacket(data, chatType, Language, sender, NULL, message); // Null = Receiver, mainly for whispering

If you need further help with ChatHandler::BuildChatPacket, you can go to ChatHandler.cpp https://github.com/TrinityCore/TrinityCore/blob/master/src/server/game/Handlers/ChatHandler.cpp and look at how they do it.
 

Synth

Exalted Member
For 112 and 114 replace that bracket section with



This is the entire section for 714
I replaced both and now it look like this:
Code:
if (GetDistance2d(pPlayer->GetPositionX(), pPlayer->GetPositionY()) <= distance)
                {
                    WorldPacket data(SMSG_MESSAGECHAT, 200);

if (GetTeam() == pPlayer->GetTeam())
(data, (ChatMsg)msgtype, LANG_UNIVERSAL, this, pPlayer, message);
else if (msgtype != CHAT_MSG_EMOTE)
ChatHandler::BuildChatPacket(data, (ChatMsg)msgtype, pPlayer->GetTeam() == ALLIANCE ? LANG_ORCISH : LANG_COMMON, this, pPlayer, message);

pPlayer->GetSession()->SendPacket(&data); 
                    else if (msgtype != CHAT_MSG_EMOTE)
                       WorldPacket data(SMSG_MESSAGECHAT, 200);

if (GetTeam() == pPlayer->GetTeam())
(data, (ChatMsg)msgtype, LANG_UNIVERSAL, this, pPlayer, message);
else if (msgtype != CHAT_MSG_EMOTE)
ChatHandler::BuildChatPacket(data, (ChatMsg)msgtype, pPlayer->GetTeam() == ALLIANCE ? LANG_ORCISH : LANG_COMMON, this, pPlayer, message);

pPlayer->GetSession()->SendPacket(&data);
2>..\..\..\..\Source\src\server\game\Cfbg\Cfbg.cpp(117) : error C2181: illegal else without matching if
And line 117 is:
Code:
else if (msgtype != CHAT_MSG_EMOTE)
 

Barebones

BETA Tester
This what it should look like

Code:
bool Player::SendBattleGroundChat(uint32 msgtype, std::string message)
{
    // Select distance to broadcast to.
    float distance = msgtype == CHAT_MSG_SAY ? sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY) : sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL);

    if (Battleground* pBattleGround = GetBattleground())
    {
        if (pBattleGround->isArena()) // Only fake chat in BG's. CFBG should not interfere with arenas.
            return false;

        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)
                {
                    WorldPacket data(SMSG_MESSAGECHAT, 200);

                    if (GetTeam() == pPlayer->GetTeam())
                        (data, (ChatMsg)msgtype, LANG_UNIVERSAL, this, pPlayer, message);
                    else if (msgtype != CHAT_MSG_EMOTE)
                        ChatHandler::BuildChatPacket(data, (ChatMsg)msgtype, pPlayer->GetTeam() == ALLIANCE ? LANG_ORCISH : LANG_COMMON, this, pPlayer, message);

                    pPlayer->GetSession()->SendPacket(&data);
                }
            }
        }
        return true;
    }
    else
        return false;
}
 

Synth

Exalted Member
Thank you very much Barebones/Tommy i still get this error i can't found what's the problem:
Code:
if ((proto->AllowableClass & getClassMask()) == 0 || (proto->AllowableRace & getORaceMask()) == 0)
 

Barebones

BETA Tester
That may not be entirely true. There are some oRace/Class/Team functions? (is that what you call em?) out there in the scripts. Or maybe it's just oteam.
 

Synth

Exalted Member
Code:
getORaceMask()

Should be:

Code:
getRaceMask()

Looks like a failed typo. :p
You're right :p
Btw i no errors i go to test it i can't talk on BG when i try to say something maybe this code we do it for BuildPlayerChat there is something wrong any idea?
 

Tommy

Founder
That may not be entirely true. There are some oRace/Class/Team functions? (is that what you call em?) out there in the scripts. Or maybe it's just oteam.

The error is in the player class and it is trying to get the player race mask. If it was related to something else, it would more than likely have a variable.

You're right :p
Btw i no errors i go to test it i can't talk on BG when i try to say something maybe this code we do it for BuildPlayerChat there is something wrong any idea?

I helped Watcher is the errors in the donator section, along with me making a guide on how to actually set the Crossfaction BG up.

Here's my edit:

Player.cpp, under 'Player::SendBattleGroundChat', change:

(SendBattleGroundChat is a CrossfactionBG function)

Code:
                    if (GetBGTeam() == pPlayer->GetBGTeam())
                    {
                        WorldPacket data(SMSG_MESSAGECHAT, 200);
                        ChatHandler::BuildChatPacket(&data, msgtype, message, LANG_UNIVERSAL);
                        pPlayer->GetSession()->SendPacket(&data);
                    }
                    else if (msgtype != CHAT_MSG_EMOTE)
                    {
                        WorldPacket data(SMSG_MESSAGECHAT, 200);
                        ChatHandler::BuildChatPacket(&data, msgtype, message, pPlayer->GetTeam() == ALLIANCE ? LANG_ORCISH : LANG_COMMON);
                        pPlayer->GetSession()->SendPacket(&data);
                    }

to:

Code:
                    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);
                    }

If you need anymore help related to this, look at my tutorial I made: http://emudevs.com/showthread.php/2288-How-to-setup-Crossfaction-Battlegrounds?p=15534#post15534
 
Last edited:

Synth

Exalted Member
The error is in the player class and it is trying to get the player race mask. If it was related to something else, it would more than likely have a variable.



I helped Watcher is the errors in the donator section, along with me making a guide on how to actually set the Crossfaction BG up.

Here's my edit:

Player.cpp, under 'Player::SendBattleGroundChat', change:

(SendBattleGroundChat is a CrossfactionBG function)

Code:
                    if (GetBGTeam() == pPlayer->GetBGTeam())
                    {
                        WorldPacket data(SMSG_MESSAGECHAT, 200);
                        ChatHandler::BuildChatPacket(&data, msgtype, message, LANG_UNIVERSAL);
                        pPlayer->GetSession()->SendPacket(&data);
                    }
                    else if (msgtype != CHAT_MSG_EMOTE)
                    {
                        WorldPacket data(SMSG_MESSAGECHAT, 200);
                        ChatHandler::BuildChatPacket(&data, msgtype, message, pPlayer->GetTeam() == ALLIANCE ? LANG_ORCISH : LANG_COMMON);
                        pPlayer->GetSession()->SendPacket(&data);
                    }

to:

Code:
                    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);
                    }

If you need anymore help related to this, look at my tutorial I made: http://emudevs.com/showthread.php/2288-How-to-setup-Crossfaction-Battlegrounds?p=15534#post15534

I get errors once i replaced:
Code:
2>Compiling...
2>Cfbg.cpp
2>..\..\..\..\Source\src\server\game\Cfbg\Cfbg.cpp(109) : error C2039: 'GetBGTeam' : is not a member of 'Player'
2>        Core\Source\src\server\game\Entities\Player\Player.h(1061) : see declaration of 'Player'
2>..\..\..\..\Source\src\server\game\Cfbg\Cfbg.cpp(109) : error C3861: 'GetBGTeam': identifier not found
2>..\..\..\..\Source\src\server\game\Cfbg\Cfbg.cpp(125) : error C2181: illegal else without matching if
2>..\..\..\..\Source\src\server\game\Cfbg\Cfbg.cpp(130) : error C2601: 'Player::MorphFit' : local function definitions are illegal
2>        ..\..\..\..\Source\src\server\game\Cfbg\Cfbg.cpp(94): this line contains a '{' which has not yet been matched
2>..\..\..\..\Source\src\server\game\Cfbg\Cfbg.cpp(141) : error C2601: 'Player::FitPlayerInTeam' : local function definitions are illegal
2>        ..\..\..\..\Source\src\server\game\Cfbg\Cfbg.cpp(94): this line contains a '{' which has not yet been matched
2>..\..\..\..\Source\src\server\game\Cfbg\Cfbg.cpp(165) : error C2601: 'Player::DoForgetPlayersInList' : local function definitions are illegal
2>        ..\..\..\..\Source\src\server\game\Cfbg\Cfbg.cpp(94): this line contains a '{' which has not yet been matched
2>..\..\..\..\Source\src\server\game\Cfbg\Cfbg.cpp(180) : error C2601: 'Player::DoForgetPlayersInBG' : local function definitions are illegal
2>        ..\..\..\..\Source\src\server\game\Cfbg\Cfbg.cpp(94): this line contains a '{' which has not yet been matched
2>..\..\..\..\Source\src\server\game\Cfbg\Cfbg.cpp(201) : error C2601: 'BattlegroundQueue::CheckCrossFactionMatch' : local function definitions are illegal
2>        ..\..\..\..\Source\src\server\game\Cfbg\Cfbg.cpp(94): this line contains a '{' which has not yet been matched
2>..\..\..\..\Source\src\server\game\Cfbg\Cfbg.cpp(222) : error C2601: 'BattlegroundQueue::FillXPlayersToBG' : local function definitions are illegal
2>        ..\..\..\..\Source\src\server\game\Cfbg\Cfbg.cpp(94): this line contains a '{' which has not yet been matched
2>..\..\..\..\Source\src\server\game\Cfbg\Cfbg.cpp(311) : error C2601: 'BattlegroundQueue::PreAddPlayers' : local function definitions are illegal
2>        ..\..\..\..\Source\src\server\game\Cfbg\Cfbg.cpp(94): this line contains a '{' which has not yet been matched
2>..\..\..\..\Source\src\server\game\Cfbg\Cfbg.cpp(328) : error C2601: 'Player::SendChatMessage' : local function definitions are illegal
2>        ..\..\..\..\Source\src\server\game\Cfbg\Cfbg.cpp(94): this line contains a '{' which has not yet been matched
2>..\..\..\..\Source\src\server\game\Cfbg\Cfbg.cpp(343) : fatal error C1075: end of file found before the left brace '{' at '..\..\..\..\Source\src\server\game\Cfbg\Cfbg.cpp(94)' was matched
2>Build log was saved at "file://c:\Core\Build\src\server\game\game.dir\Release\BuildLog.htm"
2>game - 12 error(s), 0 warning(s)
========== Build: 1 succeeded, 1 failed, 14 up-to-date, 0 skipped ==========
Also its not on player.cpp its on Cfbg.cpp
 
Status
Not open for further replies.
Top