艾泽拉斯核心改变种族或派系 "could not change race for character"

AzerothCore change race or faction "could not change race for character"

在角色 xxx 上使用 .character changefaction xxx.character changerace xxx 后,我无法自定义和保存角色,因为它失败了:

Could not change faction for character

TLDR:这是解决方案:

  • 确保角色不在公会中
  • 确保角色不是竞技场队长
  • 确保该角色的邮箱中没有任何邮件
  • 确保角色没有任何待拍卖

下面是我找到解决方案的方法。

此操作由以下方法处理:

void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)

CharacterHandler.cpp 文件中。

所以这里是所有可能出错的地方:

        // if player is in a guild
        if (playerData->guildId && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD))
        {
            WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1);
            data << (uint8)CHAR_CREATE_CHARACTER_IN_GUILD;
            SendPacket(&data);
            return;
        }

        // is arena team captain
        if (sArenaTeamMgr->GetArenaTeamByCaptain(guid))
        {
            WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1);
            data << (uint8)CHAR_CREATE_CHARACTER_ARENA_LEADER;
            SendPacket(&data);
            return;
        }

        // check mailbox
        if (playerData->mailCount)
        {
            WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1);
            data << (uint8)CHAR_CREATE_CHARACTER_DELETE_MAIL;
            SendPacket(&data);
            return;
        }

        // check auctions, current packet is processed single-threaded way, so not a problem
        bool has_auctions = false;
        for (uint8 i = 0; i < 2; ++i) // check both neutral and faction-specific AH
        {
            AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(i == 0 ? 0 : (((1 << (playerData->race - 1))&RACEMASK_ALLIANCE) ? 12 : 29));
            AuctionHouseObject::AuctionEntryMap::const_iterator itr = auctionHouse->GetAuctionsBegin();
            AuctionHouseObject::AuctionEntryMap::const_iterator _end = auctionHouse->GetAuctionsEnd();
            for (; itr != _end; ++itr)
            {
                AuctionEntry* Aentry = itr->second;
                if (Aentry && (Aentry->owner == guid || Aentry->bidder == guid))
                {
                    has_auctions = true;
                    break;
                }
            }
            if (has_auctions)
                break;
        }
        if (has_auctions)
        {
            WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1);
            data << (uint8)CHAR_CREATE_ERROR;
            SendPacket(&data);
            return;
        }
    }